Skip to content

Commit

Permalink
Update the headers (#53)
Browse files Browse the repository at this point in the history
* update headers

* small fix
  • Loading branch information
Yanis002 authored Sep 16, 2024
1 parent 9947334 commit 253983b
Show file tree
Hide file tree
Showing 37 changed files with 703 additions and 178 deletions.
13 changes: 13 additions & 0 deletions include/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ extern "C" {

#define NO_INLINE __attribute__((never_inline))

#define __CONCAT(x, y) x##y
#define CONCAT(x, y) __CONCAT(x, y)

// Force unused data to be exported
#ifndef NON_MATCHING
#define FORCE_ACTIVE(module, ...) \
void fake_function(char, ...); \
void CONCAT(##module##_unused_L, __LINE__)(void); \
void CONCAT(##module##_unused_L, __LINE__)(void) { fake_function(0, __VA_ARGS__); }
#else
#define FORCE_ACTIVE(module, ...)
#endif

// Adds a stack variable in an inline function, which can be used to pad the
// stack after other functions have been inlined
inline void padStack(void) { int pad = 0; }
Expand Down
6 changes: 5 additions & 1 deletion include/revolution/ai/ai.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _RVL_SDK_AI_H

#include "revolution/os/OSContext.h"
#include "revolution/os/OSInterrupt.h"
#include "revolution/types.h"

#ifdef __cplusplus
Expand All @@ -17,12 +18,15 @@ typedef enum {

AIDMACallback AIRegisterDMACallback(AIDMACallback callback);
void AIInitDMA(void* buffer, u32 length);
u32 AIGetDMAEnableFlag(void);
void AIStartDMA(void);
void AIStopDMA(void);
u32 AIGetDMABytesLeft(void);
void AISetDSPSampleRate(u32 rate);
u32 AIGetDSPSampleRate(void);
void AIInit(void* stack);
void __AIDHandler(s16 intr, struct OSContext* ctx);
void AIReset(void);
void __AIDHandler(__OSInterrupt intr, struct OSContext* ctx);

#ifdef __cplusplus
}
Expand Down
10 changes: 5 additions & 5 deletions include/revolution/arc/arc.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ typedef struct ARCHeader {
} ARCHeader;

typedef struct ARCHandle {
/* 0x0 */ ARCHeader* header;
/* 0x4 */ ARCNode* nodes;
/* 0x8 */ u8* file;
/* 0xC */ u32 count;
/* 0x00 */ ARCHeader* header;
/* 0x04 */ ARCNode* nodes;
/* 0x08 */ u8* file;
/* 0x0C */ u32 count;
/* 0x10 */ const char* strings;
/* 0x14 */ u32 fstSize;
/* 0x18 */ s32 entrynum;
} ARCHandle;
} ARCHandle; // size = 0x1C

typedef struct ARCFileInfo {
/* 0x0 */ ARCHandle* handle;
Expand Down
2 changes: 1 addition & 1 deletion include/revolution/ax/AXCL.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern "C" {
// Command list can hold up to 64 commands
#define AX_CL_MAX_CMD 64
// Each command takes up two bytes
#define AX_CL_SIZE (AX_CL_MAX_CMD * sizeof(u16))
#define AX_CL_SIZE (AX_CL_MAX_CMD * sizeof(u16) * 6)

typedef enum {
AX_OUTPUT_STEREO,
Expand Down
100 changes: 49 additions & 51 deletions include/revolution/ax/AXPB.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ typedef enum {
};

typedef struct _AXPBMIX {
/* 0x0 */ u16 vL;
/* 0x2 */ u16 vDeltaL;
/* 0x4 */ u16 vR;
/* 0x6 */ u16 vDeltaR;
/* 0x8 */ u16 vAuxAL;
/* 0xA */ u16 vDeltaAuxAL;
/* 0xC */ u16 vAuxAR;
/* 0xE */ u16 vDeltaAuxAR;
/* 0x00 */ u16 vL;
/* 0x02 */ u16 vDeltaL;
/* 0x04 */ u16 vR;
/* 0x06 */ u16 vDeltaR;
/* 0x08 */ u16 vAuxAL;
/* 0x0A */ u16 vDeltaAuxAL;
/* 0x0C */ u16 vAuxAR;
/* 0x0E */ u16 vDeltaAuxAR;
/* 0x10 */ u16 vAuxBL;
/* 0x12 */ u16 vDeltaAuxBL;
/* 0x14 */ u16 vAuxBR;
Expand All @@ -128,32 +128,32 @@ typedef struct _AXPBMIX {
/* 0x2A */ u16 vDeltaAuxBS;
/* 0x2C */ u16 vAuxCS;
/* 0x2E */ u16 vDeltaAuxCS;
} AXPBMIX;
} AXPBMIX; // size = 0x30

typedef struct _AXPBITD {
/* 0x0 */ u16 flag;
/* 0x2 */ u16 bufferHi;
/* 0x4 */ u16 bufferLo;
/* 0x6 */ u16 shiftL;
/* 0x8 */ u16 shiftR;
/* 0xA */ u16 targetShiftL;
/* 0xC */ u16 targetShiftR;
} AXPBITD;
/* 0x00 */ u16 flag;
/* 0x02 */ u16 bufferHi;
/* 0x04 */ u16 bufferLo;
/* 0x06 */ u16 shiftL;
/* 0x08 */ u16 shiftR;
/* 0x0A */ u16 targetShiftL;
/* 0x0C */ u16 targetShiftR;
} AXPBITD; // size = 0xE

typedef struct _AXPBDPOP {
/* 0x0 */ s16 aL;
/* 0x2 */ s16 aAuxAL;
/* 0x4 */ s16 aAuxBL;
/* 0x6 */ s16 aAuxCL;
/* 0x8 */ s16 aR;
/* 0xA */ s16 aAuxAR;
/* 0xC */ s16 aAuxBR;
/* 0xE */ s16 aAuxCR;
/* 0x00 */ s16 aL;
/* 0x02 */ s16 aAuxAL;
/* 0x04 */ s16 aAuxBL;
/* 0x06 */ s16 aAuxCL;
/* 0x08 */ s16 aR;
/* 0x0A */ s16 aAuxAR;
/* 0x0C */ s16 aAuxBR;
/* 0x0E */ s16 aAuxCR;
/* 0x10 */ s16 aS;
/* 0x12 */ s16 aAuxAS;
/* 0x14 */ s16 aAuxBS;
/* 0x16 */ s16 aAuxCS;
} AXPBDPOP;
} AXPBDPOP; // size = 0x18

typedef struct _AXPBVE {
/* 0x0 */ u16 currentVolume;
Expand Down Expand Up @@ -253,33 +253,31 @@ typedef union __AXPBRMTIIR {
} AXPBRMTIIR;

typedef struct _AXPB {
/* 0x0 */ u16 nextHi;
/* 0x2 */ u16 nextLo;
/* 0x4 */ u16 currHi;
/* 0x6 */ u16 currLo;
/* 0x8 */ u16 srcSelect;
/* 0xA */ u16 coefSelect;
/* 0xC */ u32 mixerCtrl;
/* 0x10 */ u16 state;
/* 0x12 */ u16 type;
/* 0x14 */ AXPBMIX mix;
/* 0x44 */ AXPBITD itd;
u8 pad1[0x9]; //! TODO: figure out this struct
/* 0x52 */ AXPBDPOP dpop;
/* 0x6A */ AXPBVE ve;
/* 0x6E */ AXPBADDR addr;
/* 0x7E */ AXPBADPCM adpcm;
/* 0xA6 */ AXPBSRC src;
/* 0xB4 */ AXPBADPCMLOOP adpcmLoop;
/* 0xBA */ AXPBLPF lpf;
/* 0xC2 */ AXPBBIQUAD biquad;
/* 0xD6 */ u16 remote;
/* 0xD8 */ u16 rmtMixerCtrl;
/* 0xDA */ AXPBRMTMIX rmtMix;
/* 0xFA */ AXPBRMTDPOP rmtDpop;
/* 0x000 */ u16 nextHi;
/* 0x002 */ u16 nextLo;
/* 0x004 */ u16 currHi;
/* 0x006 */ u16 currLo;
/* 0x008 */ u16 srcSelect;
/* 0x00A */ u16 coefSelect;
/* 0x00C */ u32 mixerCtrl;
/* 0x010 */ u16 state;
/* 0x012 */ u16 type;
/* 0x014 */ AXPBMIX mix;
/* 0x044 */ AXPBITD itd;
/* 0x052 */ u32 remote;
/* 0x054 */ u32 rmtMixerCtrl;
/* 0x056 */ AXPBDPOP dpop;
/* 0x06A */ AXPBVE ve;
/* 0x06E */ AXPBADDR addr;
/* 0x07E */ AXPBADPCM adpcm;
/* 0x0A6 */ AXPBSRC src;
/* 0x0B4 */ AXPBADPCMLOOP adpcmLoop;
/* 0x0C2 */ AXPBBIQUAD biquad;
/* 0x0DA */ AXPBRMTMIX rmtMix;
/* 0x0FA */ AXPBRMTDPOP rmtDpop;
/* 0x10A */ AXPBRMTSRC rmtSrc;
/* 0x114 */ AXPBRMTIIR rmtIIR;
u8 padding[0x140 - /* 0x128 */ 0x128];
/* 0x128 */ u8 padding[0x140 - 0x128];
} AXPB;

#ifdef __cplusplus
Expand Down
2 changes: 2 additions & 0 deletions include/revolution/ax/AXSPB.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ typedef struct _AXSTUDIO {

s32 Aux3;
s16 dAux3;

s64 pad;
} AXSTUDIO;
#pragma pack(pop)

Expand Down
27 changes: 27 additions & 0 deletions include/revolution/base/PPCWGPipe.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef _RVL_SDK_PPCWGPIPE_H
#define _RVL_SDK_PPCWGPIPE_H

#ifdef __cplusplus
extern "C" {
#endif

#include "revolution/types.h"

typedef union uPPCWGPipe {
/* 0x00 */ u8 u8;
/* 0x01 */ u16 u16;
/* 0x04 */ u32 u32;
/* 0x08 */ u64 u64;
/* 0x10 */ s8 s8;
/* 0x11 */ s16 s16;
/* 0x14 */ s32 s32;
/* 0x18 */ s64 s64;
/* 0x20 */ f32 f32;
/* 0x24 */ f64 f64;
} PPCWGPipe; // size = 0x28

#ifdef __cplusplus
}
#endif

#endif
3 changes: 3 additions & 0 deletions include/revolution/demo.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ typedef struct DEMODMPad {
/* 0x1C */ s16 substickDeltaY;
} DEMODMPad; // size = 0x1E

extern u32 DemoUseMEMHeap;
extern void* DemoCurrentBuffer;
extern void* DemoFrameBuffer2;
extern void* DemoFrameBuffer1;
extern struct MEMAllocator DemoAllocator1;
extern struct MEMAllocator DemoAllocator2;

extern DEMODMPad DemoPad[4];
extern u8 DemoStatEnable;
Expand Down
3 changes: 2 additions & 1 deletion include/revolution/dsp/dsp_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _RVL_SDK_DSP_TASK_H

#include "revolution/os/OSContext.h"
#include "revolution/os/OSInterrupt.h"
#include "revolution/types.h"
#include "stdint.h"

Expand Down Expand Up @@ -62,7 +63,7 @@ extern DSPTask* __DSP_last_task;
extern DSPTask* __DSP_first_task;
extern DSPTask* __DSP_curr_task;

void __DSPHandler(s16 intr, struct OSContext* ctx);
void __DSPHandler(__OSInterrupt intr, struct OSContext* ctx);
void __DSP_exec_task(DSPTask* task1, DSPTask* task2);
void __DSP_boot_task(DSPTask* task);
void __DSP_insert_task(DSPTask* task);
Expand Down
14 changes: 13 additions & 1 deletion include/revolution/dvd/dvd.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,24 @@ typedef struct DVDDriveInfo {
} DVDDriveInfo;

typedef struct DVDFileInfo {
/* 0x0 */ DVDCommandBlock block;
/* 0x00 */ DVDCommandBlock block;
/* 0x30 */ u32 offset;
/* 0x34 */ u32 size;
/* 0x38 */ DVDAsyncCallback callback;
} DVDFileInfo;

typedef struct DVDDir {
/* 0x00 */ u32 entryNum;
/* 0x04 */ u32 location;
/* 0x08 */ u32 next;
} DVDDir;

typedef struct DVDDirEntry {
/* 0x00 */ u32 entryNum;
/* 0x04 */ bool isDir;
/* 0x08 */ char* name;
} DVDDirEntry;

extern volatile u32 __DVDLayoutFormat;

void DVDInit(void);
Expand Down
1 change: 1 addition & 0 deletions include/revolution/dvd/dvdfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extern bool __DVDLongFileNameFlag;
void __DVDFSInit(void);
s32 DVDConvertPathToEntrynum(const char* path);
bool DVDFastOpen(s32 entrynum, DVDFileInfo* info);
bool DVDEntrynumIsDir(s32 entrynum);
bool DVDOpen(const char* path, DVDFileInfo* info);
bool DVDClose(DVDFileInfo* info);
bool DVDGetCurrentDir(char* buffer, u32 maxlen);
Expand Down
2 changes: 2 additions & 0 deletions include/revolution/esp/esp.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ typedef struct ESPTmd {
s32 ESP_ReadContentFile(s32 fd, void* dst, u32 len);
s32 ESP_SeekContentFile(s32 fd, s32 offset, s32 origin);

extern s32 __esFd;

#ifdef __cplusplus
}
#endif
Expand Down
1 change: 1 addition & 0 deletions include/revolution/gx.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ extern "C" {
#include "revolution/gx/GXLight.h"
#include "revolution/gx/GXMisc.h"
#include "revolution/gx/GXPixel.h"
#include "revolution/gx/GXRegs.h"
#include "revolution/gx/GXTev.h"
#include "revolution/gx/GXTexture.h"
#include "revolution/gx/GXTransform.h"
Expand Down
7 changes: 0 additions & 7 deletions include/revolution/gx/GXAttr.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,7 @@ void GXGetVtxDesc(GXAttr name, GXAttrType* type);
void GXGetVtxDescv(GXVtxDescList* list);
void GXClearVtxDesc(void);
void GXSetVtxAttrFmt(GXVtxFmt fmt, GXAttr attr, GXCompCnt compCnt, GXCompType compType, u8 shift);

// TODO: Please find a way to get rid of this
#ifdef GXATTR_MATCH_HACK
void GXSetVtxAttrFmtv(s16 fmt, const GXVtxAttrFmtList* list);
#else
void GXSetVtxAttrFmtv(GXVtxFmt fmt, const GXVtxAttrFmtList* list);
#endif

void GXGetVtxAttrFmt(GXVtxFmt fmt, GXAttr attr, GXCompCnt* compCnt, GXCompType* compType, u8* shift);
void GXGetVtxAttrFmtv(GXVtxFmt fmt, GXVtxAttrFmtList* list);
void GXSetArray(GXAttr attr, const void* base, u8 stride);
Expand Down
33 changes: 32 additions & 1 deletion include/revolution/gx/GXFifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,47 @@
extern "C" {
#endif

typedef void (*GXBreakPtCallback)(void);

GX_DECL_PUBLIC_STRUCT(GXFifoObj, 128);

typedef struct __GXFifoObj {
/* 0x00 */ u8* base;
/* 0x04 */ u8* top;
/* 0x08 */ u32 size;
/* 0x0C */ u32 hiWatermark;
/* 0x10 */ u32 loWatermark;
/* 0x14 */ void* rdPtr;
/* 0x18 */ void* wrPtr;
/* 0x1C */ s32 count;
/* 0x20 */ GXBool wrap;
/* 0x21 */ GXBool bind_cpu;
/* 0x22 */ GXBool bind_gp;
} __GXFifoObj; // size = 0x24

// Internal struct for FIFO access.
typedef struct _GXFifoObjPriv {
/* 0x00 */ void* base;
/* 0x04 */ void* end;
/* 0x08 */ u32 size;
/* 0x0C */ u32 highWatermark;
/* 0x10 */ u32 lowWatermark;
/* 0x14 */ void* readPtr;
/* 0x18 */ void* writePtr;
/* 0x1C */ s32 rwDistance;
/* 0x20 */ u8 _20[0x60];
} GXFifoObjPriv;

void GXGetGPStatus(u8*, u8*, u8*, u8*, u8*);

void GXSetCPUFifo(GXFifoObj*);
bool GXGetCPUFifo(GXFifoObj*);
bool GXGetCPUFifo(void);

u32 GXGetFifoCount(GXFifoObj*);
u8 GXGetFifoWrap(GXFifoObj*);

GXBool __GXIsGPFifoReady(void);

#ifdef __cplusplus
}
#endif
Expand Down
Loading

0 comments on commit 253983b

Please sign in to comment.