diff options
| author | petrie911 <69443847+petrie911@users.noreply.github.com> | 2022-10-04 15:46:32 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-04 21:46:32 +0100 |
| commit | 2006a65ba62e7e848823cd1de009c9e16d6421eb (patch) | |
| tree | 90748c833b1620d1be9b9cbf1c19b18037626acf /include | |
| parent | 8cd48db087ed7527d376195736eb9d4714bdf862 (diff) | |
z_overlay and z_fbdemo_dlftbls (Transition overlay handling), clean up a lot of u32s used to store pointers (#1073)
* overlay matches
* prototypes
* fbdemo too
* virtual to physical
* names, cleanup, etc
* bss reordering
* uintptr stuff
* fixed now?
* one fix
* headers and such
* fixes'n'stuff
* XXX action
* docs of a sort
* useless error codes
* n
* format
* header? I barely know her!
Co-authored-by: petrie911 <petrie911@users.noreply.github.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/functions.h | 44 | ||||
| -rw-r--r-- | include/initvars.h | 8 | ||||
| -rw-r--r-- | include/os.h | 10 | ||||
| -rw-r--r-- | include/os_internal.h | 4 | ||||
| -rw-r--r-- | include/variables.h | 2 | ||||
| -rw-r--r-- | include/z64actor.h | 4 | ||||
| -rw-r--r-- | include/z64dma.h | 22 | ||||
| -rw-r--r-- | include/z64effect.h | 4 | ||||
| -rw-r--r-- | include/z64transition.h | 38 |
9 files changed, 85 insertions, 51 deletions
diff --git a/include/functions.h b/include/functions.h index 93b15c2c5..dbbcc07df 100644 --- a/include/functions.h +++ b/include/functions.h @@ -7,12 +7,12 @@ void bootproc(void); void Idle_ThreadEntry(void* arg); void ViConfig_UpdateVi(u32 mode); void ViConfig_UpdateBlack(void); -s32 DmaMgr_DmaRomToRam(u32 rom, void* ram, size_t size); +s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size); s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction); -DmaEntry* DmaMgr_FindDmaEntry(u32 vrom); -u32 DmaMgr_TranslateVromToRom(u32 vrom); -s32 DmaMgr_FindDmaIndex(u32 vrom); -const char* func_800809F4(u32 param_1); +DmaEntry* DmaMgr_FindDmaEntry(uintptr_t vrom); +u32 DmaMgr_TranslateVromToRom(uintptr_t vrom); +s32 DmaMgr_FindDmaIndex(uintptr_t vrom); +const char* func_800809F4(uintptr_t param_1); void DmaMgr_ProcessMsg(DmaRequest* req); void DmaMgr_ThreadEntry(void* arg); s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, uintptr_t vromStart, size_t size, UNK_TYPE4 unused, OSMesgQueue* queue, void* msg); @@ -22,7 +22,7 @@ void DmaMgr_Stop(void); void* Yaz0_FirstDMA(void); void* Yaz0_NextDMA(void* curSrcPos); s32 Yaz0_DecompressImpl(u8* src, u8* dst); -void Yaz0_Decompress(u32 romStart, void* dst, size_t size); +void Yaz0_Decompress(uintptr_t romStart, void* dst, size_t size); void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* client, OSMesgQueue* msgQueue); void IrqMgr_RemoveClient(IrqMgr* irqmgr, IrqMgrClient* remove); void IrqMgr_SendMesgForClient(IrqMgr* irqmgr, OSMesg msg); @@ -256,7 +256,7 @@ s32 __osSpRawStartDma(s32 direction, void* devAddr, void* dramAddr, size_t size) s32 __osSiRawStartDma(s32 direction, void* dramAddr); s32 osEPiLinkHandle(OSPiHandle* handle); void osViBlack(u8 active); -s32 __osSiRawReadIo(u32 devAddr, u32* data); +s32 __osSiRawReadIo(uintptr_t devAddr, u32* data); OSId osGetThreadId(OSThread* t); void osSpTaskYield(void); s32 __osPfsGetNextPage(OSPfs* pfs, u8* bank, __OSInode* inode, __OSInodeUnit* page); @@ -280,7 +280,7 @@ void __osPiGetAccess(void); void __osPiRelAccess(void); void __osDevMgrMain(void* arg); // void func_8008C640(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6, UNK_TYPE1 param_7, UNK_TYPE1 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11, UNK_TYPE4 param_12, UNK_TYPE4 param_13, UNK_TYPE4 param_14, UNK_TYPE4 param_15, UNK_TYPE4 param_16, UNK_TYPE4 param_17, UNK_TYPE4 param_18); -s32 __osPiRawStartDma(s32 direction, u32 devAddr, void* dramAddr, size_t size); +s32 __osPiRawStartDma(s32 direction, uintptr_t devAddr, void* dramAddr, size_t size); u16 __osSumcalc(u8* ptr, s32 length); s32 __osIdCheckSum(u16* ptr, u16* checkSum, u16* idSum); s32 __osRepairPackId(OSPfs* pfs, __OSPackId* badid, __OSPackId* newid); @@ -322,11 +322,11 @@ s32 __osSiDeviceBusy(void); s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag); void osSetThreadPri(OSThread* t, OSPri p); OSPri osGetThreadPri(OSThread* t); -s32 __osEPiRawReadIo(OSPiHandle* handle, u32 devAddr, u32* data); +s32 __osEPiRawReadIo(OSPiHandle* handle, uintptr_t devAddr, u32* data); void osViSwapBuffer(void* frameBufPtr); void guPositionF(float mf[4][4], f32 rot, f32 pitch, f32 yaw, f32 scale, f32 x, f32 y, f32 z); void guPosition(Mtx* m, f32 rot, f32 pitch, f32 yaw, f32 scale, f32 x, f32 y, f32 z); -s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dramAddr, size_t size); +s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, uintptr_t cartAddr, void* dramAddr, size_t size); OSYieldResult osSpTaskYielded(OSTask* task); s32 bcmp(void* __s1, void* __s2, size_t __n); OSTime osGetTime(void); @@ -359,7 +359,7 @@ void __osViInit(void); void __osViSwapContext(void); OSMesgQueue* osPiGetCmdQueue(void); f32 cosf(f32 __x); -s32 osEPiReadIo(OSPiHandle* handle, u32 devAddr, u32* data); +s32 osEPiReadIo(OSPiHandle* handle, uintptr_t devAddr, u32* data); void osViSetSpecialFeatures(u32 func); s16 coss(u16 x); void osSetTime(OSTime ticks); @@ -380,13 +380,13 @@ u32 __osGetFpcCsr(void); // void __osPfsCheckRamArea(void); // void osPfsChecker(void); u32 osAiGetLength(void); -s32 osEPiWriteIo(OSPiHandle* handle, u32 devAddr, u32 data); +s32 osEPiWriteIo(OSPiHandle* handle, uintptr_t devAddr, u32 data); void osMapTLBRdb(void); void osYieldThread(void); void guTranslate(Mtx* mtx, f32 x, f32 y, f32 z); u32 __osGetCause(void); s32 __osContRamWrite(OSMesgQueue* mq, s32 channel, u16 address, u8* buffer, s32 force); -s32 __osEPiRawWriteIo(OSPiHandle* handle, u32 devAddr, u32 data); +s32 __osEPiRawWriteIo(OSPiHandle* handle, uintptr_t devAddr, u32 data); s32 osSetTimer(OSTimer* t, OSTime value, OSTime interval, OSMesgQueue* mq, OSMesg msg); void _Ldtob(_Pft* args, u8 type); // void _Ldunscale(void); @@ -394,7 +394,7 @@ void _Genld(_Pft* px, u8 code, u8* p, s16 nsig, s16 xexp); ldiv_t ldiv(long numer, long denom); lldiv_t lldiv(long long numer, long long denom); void _Litob(_Pft* args, u8 type); -s32 __osSiRawWriteIo(u32 devAddr, u32 data); +s32 __osSiRawWriteIo(uintptr_t devAddr, u32 data); u32 __osSpGetStatus(void); void __osSpSetStatus(u32 data); void osCreateViManager(OSPri pri); @@ -1576,8 +1576,8 @@ f32 Math_Vec3f_StepTo(Vec3f* start, Vec3f* target, f32 speed); void Lib_Nop801004FC(void); void* Lib_SegmentedToVirtual(void* ptr); void* Lib_SegmentedToVirtualNull(void* ptr); +void* Lib_VirtualToPhysical(void* ptr); void* Lib_PhysicalToVirtual(void* ptr); -void* Lib_PhysicalToVirtualNull(void* ptr); void LifeMeter_Init(PlayState* play); void LifeMeter_UpdateColors(PlayState* play); s32 LifeMeter_SaveInterfaceHealth(PlayState* play); @@ -2401,8 +2401,8 @@ void KaleidoScopeCall_Init(PlayState* play); void KaleidoScopeCall_Destroy(PlayState* play); void KaleidoScopeCall_Update(PlayState* play); void KaleidoScopeCall_Draw(PlayState* play); -// void func_80163C90(void); -// void func_80163D80(void); +void Transition_Init(TransitionContext* transitionCtx); +void Transition_Destroy(TransitionContext* transitionCtx); // void func_80163DC0(void); // void func_8016418C(void); // void func_8016424C(void); @@ -2420,6 +2420,8 @@ void* TransitionFade_Init(void* param_1); // void TransitionFade_IsDone(void); // void TransitionFade_SetColor(void); // void TransitionFade_SetType(void); +void TransitionOverlay_ClearLoadInfo(TransitionOverlay *overlayEntry); +void TransitionOverlay_SetSegment(TransitionOverlay *overlayEntry, void* vramStart, void* vramEnd, uintptr_t vromStart, uintptr_t vromEnd); void TransitionCircle_Start(void* thisx); void* TransitionCircle_Init(void* thisx); void TransitionCircle_Destroy(void* thisx); @@ -2430,10 +2432,10 @@ void TransitionCircle_LoadAndSetTexture(Gfx** gfxp, TexturePtr texture, s32 fmt, f32 arg6); void TransitionCircle_Draw(void* thisx, Gfx** gfxp); s32 TransitionCircle_IsDone(void* thisx); -// void func_801651B0(void); -// void func_80165224(void); -// void func_80165288(void); -// void func_8016537C(void); +void* TransitionOverlay_VramToRam(TransitionOverlay *overlayEntry, void* vramAddr); +void TransitionOverlay_VramToRamArray(TransitionOverlay *overlayEntry, void** vramAddrs, s32 count); +s32 TransitionOverlay_Load(TransitionOverlay *overlayEntry); +s32 TransitionOverlay_Free(TransitionOverlay *overlayEntry); void func_80165438(UNK_PTR param_1); // void func_80165444(s32 param_1, UNK_TYPE4 param_2, UNK_TYPE4 param_3, UNK_TYPE4 param_4, UNK_TYPE4 param_5); // void func_80165460(void); diff --git a/include/initvars.h b/include/initvars.h index 11a6719e9..4de39757c 100644 --- a/include/initvars.h +++ b/include/initvars.h @@ -610,4 +610,12 @@ extern ActorInit Oceff_Wipe7_InitVars; extern ActorInit Shot_Sun_InitVars; extern ActorInit TG_Sw_InitVars; +extern TransitionInit TransitionFade_InitVars; +extern TransitionInit TransitionTriforce_InitVars; +extern TransitionInit TransitionWipe1_InitVars; +extern TransitionInit TransitionWipe3_InitVars; +extern TransitionInit TransitionWipe4_InitVars; +extern TransitionInit TransitionCircle_InitVars; +extern TransitionInit TransitionWipe5_InitVars; + #endif diff --git a/include/os.h b/include/os.h index 838d8234a..6e34bd428 100644 --- a/include/os.h +++ b/include/os.h @@ -47,7 +47,7 @@ typedef struct { /* 0x04 */ u16 transferMode; /* 0x06 */ u16 blockNum; /* 0x08 */ s32 sectorNum; - /* 0x0C */ u32 devAddr; + /* 0x0C */ uintptr_t devAddr; /* 0x10 */ u32 bmCtlShadow; /* 0x14 */ u32 seqCtlShadow; /* 0x18 */ __OSBlockInfo block[2]; @@ -62,7 +62,7 @@ typedef struct OSPiHandle { /* 0x07 */ u8 relDuration; /* 0x08 */ u8 pulse; /* 0x09 */ u8 domain; - /* 0x0C */ u32 baseAddress; + /* 0x0C */ uintptr_t baseAddress; /* 0x10 */ u32 speed; /* 0x14 */ __OSTranxInfo transferInfo; } OSPiHandle; // size = 0x74 @@ -70,7 +70,7 @@ typedef struct OSPiHandle { typedef struct { /* 0x0 */ u8 type; - /* 0x4 */ u32 address; + /* 0x4 */ uintptr_t address; } OSPiInfo; // size = 0x8 @@ -97,8 +97,8 @@ typedef struct { /* 0x08 */ OSMesgQueue* cmdQueue; /* 0x0C */ OSMesgQueue* evtQueue; /* 0x10 */ OSMesgQueue* acsQueue; - /* 0x14 */ s32 (*piDmaCallback)(s32, u32, void*, size_t); - /* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, u32, void*, size_t); + /* 0x14 */ s32 (*piDmaCallback)(s32, uintptr_t, void*, size_t); + /* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, uintptr_t, void*, size_t); } OSDevMgr; // size = 0x1C typedef u64 OSTime; diff --git a/include/os_internal.h b/include/os_internal.h index b4f98bffa..2d82b41a9 100644 --- a/include/os_internal.h +++ b/include/os_internal.h @@ -12,8 +12,8 @@ typedef struct { /* 0x08 */ OSMesgQueue* cmdQueue; /* 0x0C */ OSMesgQueue* eventQueue; /* 0x10 */ OSMesgQueue* accessQueue; - /* 0x14 */ s32 (*piDmaCallback)(s32, u32, void*, size_t); - /* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, u32, void*, size_t); + /* 0x14 */ s32 (*piDmaCallback)(s32, uintptr_t, void*, size_t); + /* 0x18 */ s32 (*epiDmaCallback)(OSPiHandle*, s32, uintptr_t, void*, size_t); } OSMgrArgs; // size = 0x1C #endif diff --git a/include/variables.h b/include/variables.h index dfe8ae715..e865f890e 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1471,9 +1471,7 @@ extern KaleidoMgrOverlay* gKaleidoMgrCurOvl; // extern UNK_TYPE4 D_801D0BB0; // extern UNK_TYPE1 D_801D0C80; // extern UNK_TYPE1 D_801D0CB0; -extern const TransitionInit TransitionFade_InitVars; extern Gfx D_801D0D00[]; -extern const TransitionInit TransitionCircle_InitVars; extern s32 gDbgCamEnabled; // extern UNK_TYPE1 D_801D0D54; // extern UNK_TYPE2 D_801D0D58; diff --git a/include/z64actor.h b/include/z64actor.h index b11078316..f1c33783a 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -105,8 +105,8 @@ typedef enum { } AllocType; typedef struct { - /* 0x00 */ u32 vromStart; - /* 0x04 */ u32 vromEnd; + /* 0x00 */ uintptr_t vromStart; + /* 0x04 */ uintptr_t vromEnd; /* 0x08 */ void* vramStart; /* 0x0C */ void* vramEnd; /* 0x10 */ void* loadedRamAddr; // original name: "allocp" diff --git a/include/z64dma.h b/include/z64dma.h index 3b17d04d0..92c0227f3 100644 --- a/include/z64dma.h +++ b/include/z64dma.h @@ -4,21 +4,21 @@ #include "ultra64.h" typedef struct { - /* 0x00 */ u32 vromAddr; // VROM address (source) - /* 0x04 */ void* dramAddr; // DRAM address (destination) - /* 0x08 */ u32 size; // File Transfer size - /* 0x0C */ char* filename; // Filename for debugging - /* 0x10 */ s32 line; // Line for debugging - /* 0x14 */ s32 unk14; + /* 0x00 */ uintptr_t vromAddr; // VROM address (source) + /* 0x04 */ void* dramAddr; // DRAM address (destination) + /* 0x08 */ u32 size; // File Transfer size + /* 0x0C */ char* filename; // Filename for debugging + /* 0x10 */ s32 line; // Line for debugging + /* 0x14 */ s32 unk14; /* 0x18 */ OSMesgQueue* notifyQueue; // Message queue for the notification message - /* 0x1C */ OSMesg notifyMsg; // Completion notification message + /* 0x1C */ OSMesg notifyMsg; // Completion notification message } DmaRequest; // size = 0x20 typedef struct { - /* 0x0 */ u32 vromStart; - /* 0x4 */ u32 vromEnd; - /* 0x8 */ u32 romStart; - /* 0xC */ u32 romEnd; + /* 0x0 */ uintptr_t vromStart; + /* 0x4 */ uintptr_t vromEnd; + /* 0x8 */ uintptr_t romStart; + /* 0xC */ uintptr_t romEnd; } DmaEntry; // size = 0x10 #endif diff --git a/include/z64effect.h b/include/z64effect.h index b4574592a..727bf04d2 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -248,8 +248,8 @@ typedef struct { } EffectSsInit; // size = 0x8 typedef struct { - /* 0x00 */ u32 vromStart; - /* 0x04 */ u32 vromEnd; + /* 0x00 */ uintptr_t vromStart; + /* 0x04 */ uintptr_t vromEnd; /* 0x08 */ void* vramStart; /* 0x0C */ void* vramEnd; /* 0x10 */ void* loadedRamAddr; diff --git a/include/z64transition.h b/include/z64transition.h index 3742291a6..45178ba8e 100644 --- a/include/z64transition.h +++ b/include/z64transition.h @@ -18,12 +18,41 @@ typedef struct { } TransitionInit; // size = 0x24 typedef struct { + union { + struct { + /* 0x00 */ u32 count : 8; + /* 0x00 */ uintptr_t addr : 24; + }; + /* 0x00 */ u32 word; + } loadInfo; + /* 0x04 */ void* vramStart; + /* 0x08 */ void* vramEnd; + /* 0x0C */ uintptr_t vromStart; + /* 0x10 */ uintptr_t vromEnd; + /* 0x14 */ TransitionInit* initInfo; + /* 0x18 */ size_t size; +} TransitionOverlay; + +typedef struct { + /* 0x000 */ s16 transitionType; + /* 0x002 */ s8 fbdemoType; + /* 0x003 */ char unk_003[0x22B]; + /* 0x230 */ void* (*init)(void* transition); + /* 0x234 */ void (*destroy)(void* transition); + /* 0x238 */ void (*update)(void* transition, s32 updateRate); + /* 0x23C */ void (*draw)(void* transition, Gfx** gfxP); + /* 0x240 */ void (*start)(void* transition); + /* 0x244 */ void (*setType)(void* transition, s32 type); + /* 0x248 */ void (*setColor)(void* transition, u32 color); + /* 0x24C */ void (*setEnvColor)(void* transition, u32 color); + /* 0x250 */ s32 (*isDone)(void* transition); + /* 0x254 */ char unk_254[0x4]; +} TransitionContext; // size = 0x258 + +typedef struct { /* 0x0 */ char unk_0[0xC]; } TransitionFade; // size = 0xC -extern const TransitionInit TransitionFade_InitVars; - - typedef enum { /* 0 */ TRANSITION_CIRCLE_IN, /* 1 */ TRANSITION_CIRCLE_OUT, @@ -40,7 +69,6 @@ typedef struct { /* 0x14 */ u8 direction; // Direction the circle is transitioning ( In / Out ) /* 0x15 */ u8 maskType; // Positive / Negative mask type. Value of 0 will create a black circle /* 0x16 */ u8 isDone; // Signals when Transition is done updating - /* 0x17 */ UNK_TYPE1 pad_17; // struct padding /* 0x18 */ TexturePtr texture; /* 0x1C */ u8 masks; /* 0x1D */ u8 maskt; @@ -48,6 +76,4 @@ typedef struct { /* 0x1F */ s8 unk_1F; // Set to 0 and never used } TransitionCircle; // size = 0x20 -extern const TransitionInit TransitionCircle_InitVars; - #endif |
