diff options
| author | chandler <chandlerm2016@yahoo.com> | 2020-04-06 14:38:23 -0400 |
|---|---|---|
| committer | chandler <chandlerm2016@yahoo.com> | 2020-04-06 14:38:23 -0400 |
| commit | 0265ad21c0fbbe799b4dc9ad46bb9681f7490f9c (patch) | |
| tree | 6c2be5e8a3aad6937f200a9283256af5aef3397f /include | |
| parent | 78c65878ed809282cb1923419ee30d78323368d2 (diff) | |
| parent | ec5ba3ec987c826b018aec935d75bf7bddbd4a8d (diff) | |
merge with upstream
Diffstat (limited to 'include')
| -rw-r--r-- | include/alloca.h | 7 | ||||
| -rw-r--r-- | include/color.h | 9 | ||||
| -rw-r--r-- | include/fp.h | 34 | ||||
| -rw-r--r-- | include/functions.h | 574 | ||||
| -rw-r--r-- | include/ichain.h | 6 | ||||
| -rw-r--r-- | include/macros.h | 14 | ||||
| -rw-r--r-- | include/math.h | 1 | ||||
| -rw-r--r-- | include/padmgr.h | 11 | ||||
| -rw-r--r-- | include/regs.h | 7 | ||||
| -rw-r--r-- | include/sched.h | 27 | ||||
| -rw-r--r-- | include/segment_symbols.h | 10 | ||||
| -rw-r--r-- | include/stdbool.h | 8 | ||||
| -rw-r--r-- | include/stddef.h | 2 | ||||
| -rw-r--r-- | include/stdlib.h | 6 | ||||
| -rw-r--r-- | include/string.h | 6 | ||||
| -rw-r--r-- | include/ultra64/gbi.h | 14 | ||||
| -rw-r--r-- | include/ultra64/mbi.h | 8 | ||||
| -rw-r--r-- | include/ultra64/types.h | 6 | ||||
| -rw-r--r-- | include/variables.h | 191 | ||||
| -rw-r--r-- | include/vt.h | 4 | ||||
| -rw-r--r-- | include/z64.h | 621 | ||||
| -rw-r--r-- | include/z64actor.h | 287 | ||||
| -rwxr-xr-x | include/z64animation.h | 191 | ||||
| -rw-r--r-- | include/z64cutscene.h | 42 | ||||
| -rwxr-xr-x | include/z64dma.h | 23 | ||||
| -rw-r--r-- | include/z64effect.h | 9 | ||||
| -rw-r--r-- | include/z64item.h | 19 | ||||
| -rw-r--r-- | include/z64light.h | 27 | ||||
| -rw-r--r-- | include/z64object.h | 3 | ||||
| -rw-r--r-- | include/z64scene.h | 258 | ||||
| -rw-r--r-- | include/z64vec.h | 22 |
31 files changed, 1314 insertions, 1133 deletions
diff --git a/include/alloca.h b/include/alloca.h new file mode 100644 index 000000000..bb44ef0d2 --- /dev/null +++ b/include/alloca.h @@ -0,0 +1,7 @@ +#ifndef _ALLOCA_H_ +#define _ALLOCA_H_ + +void* alloca(unsigned int); +#define alloca __builtin_alloca + +#endif diff --git a/include/color.h b/include/color.h index c0b62c917..94c3a20d1 100644 --- a/include/color.h +++ b/include/color.h @@ -1,18 +1,15 @@ #ifndef _COLOR_H_ #define _COLOR_H_ -typedef struct -{ +typedef struct { u8 r, g, b; } Color_RGB8; -typedef struct -{ +typedef struct { u8 r, g, b, a; } Color_RGBA8; -typedef struct -{ +typedef struct { f32 r, g, b, a; } Color_RGBAf; diff --git a/include/fp.h b/include/fp.h new file mode 100644 index 000000000..7346d5e08 --- /dev/null +++ b/include/fp.h @@ -0,0 +1,34 @@ +#ifndef _FP_H_ +#define _FP_H_ +#include <ultra64.h> + +extern f32 qNaN0x3FFFFF; +extern f32 qNaN0x10000; +extern f32 sNaN0x3FFFFF; + +f32 floorf(f32 x); +f64 floor(f64 x); +s32 lfloorf(f32 x); +s32 lfloor(f64 x); + +f32 ceilf(f32 x); +f64 ceil(f64 x); +s32 lceilf(f32 x); +s32 lceil(f64 x); + +f32 truncf(f32 x); +f64 trunc(f64 x); +s32 ltruncf(f32 x); +s32 ltrunc(f64 x); + +f32 nearbyintf(f32 x); +f64 nearbyint(f64 x); +s32 lnearbyintf(f32 x); +s32 lnearbyint(f64 x); + +f32 roundf(f32 x); +f64 round(f64 x); +s32 lroundf(f32 x); +s32 lround(f64 x); + +#endif diff --git a/include/functions.h b/include/functions.h index a30733cd3..9dcdad1af 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1,7 +1,7 @@ #ifndef _FUNCTIONS_H_ #define _FUNCTIONS_H_ -#include <z64.h> +#include "z64.h" float fabsf(float f); #pragma intrinsic(fabsf) @@ -26,7 +26,8 @@ void DmaMgr_ThreadEntry(void* arg0); s32 DmaMgr_SendRequestImpl(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk, OSMesgQueue* queue, OSMesg msg); s32 DmaMgr_SendRequest0(u32 ram, u32 vrom, u32 size); void DmaMgr_Start(); -s32 DmaMgr_SendRequest2(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk5, OSMesgQueue* queue, OSMesg msg, const char* file, s32 line); +s32 DmaMgr_SendRequest2(DmaRequest* req, u32 ram, u32 vrom, u32 size, u32 unk5, OSMesgQueue* queue, OSMesg msg, + const char* file, s32 line); s32 DmaMgr_SendRequest1(void* ram0, u32 vrom, u32 size, const char* file, s32 line); void* Yaz0_FirstDMA(); void* Yaz0_NextDMA(void* curSrcPos); @@ -42,26 +43,29 @@ void isPrintfInit(); void osSyncPrintfUnused(const char* fmt, ...); void osSyncPrintf(const char* fmt, ...); void rmonPrintf(const char* fmt, ...); -u32 is_proutSyncPrintf(void* arg0, const char *str, s32 count); +u32 is_proutSyncPrintf(void* arg0, const char* str, s32 count); void func_80002384(const char* exp, const char* file, u32 line); OSPiHandle* osDriveRomInit(); void Yaz0_Old_DecompressImpl(Yaz0Header* hdr, u8* dst); -void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 initValue, s32 minSpace, const char* name); +void StackCheck_Init(StackEntry* entry, void* stackTop, void* stackBottom, u32 initValue, s32 minSpace, + const char* name); void StackCheck_Cleanup(StackEntry* entry); StackStatus StackCheck_GetState(StackEntry* entry); u32 StackCheck_CheckAll(); u32 StackCheck_Check(StackEntry* entry); -float LogUtils_CheckFloatRange(const char* exp, s32 arg1, const char* var1Name, float var1, const char* var2Name, float var2, const char* var3Name, float var3); -s32 LogUtils_CheckIntRange(const char* exp, s32 arg1, const char* var1Name, s32 var1, const char* var2Name, s32 var2, const char* var3Name, s32 var3); +float LogUtils_CheckFloatRange(const char* exp, s32 arg1, const char* var1Name, float var1, const char* var2Name, + float var2, const char* var3Name, float var3); +s32 LogUtils_CheckIntRange(const char* exp, s32 arg1, const char* var1Name, s32 var1, const char* var2Name, s32 var2, + const char* var3Name, s32 var3); void LogUtils_LogHexDump(void* ptr, s32 size0); -void LogUtils_LogPointer(s32 value, u32 max, void* ptr, const char *name, const char *file, s32 line); +void LogUtils_LogPointer(s32 value, u32 max, void* ptr, const char* name, const char* file, s32 line); void LogUtils_CheckBoundary(const char* name, s32 value, s32 unk, const char* file, s32 line); void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, s32 line); void LogUtils_CheckValidPointer(const char* exp, void* ptr0, const char* file, s32 line); void LogUtils_LogThreadId(const char* name, s32 line); void LogUtils_HungupThread(const char* name, s32 line); void LogUtils_ResetHungup(); -char* proutSprintf(char* dst, const char *fmt, size_t size); +char* proutSprintf(char* dst, const char* fmt, size_t size); s32 vsprintf(char* dst, const char* fmt, va_list args); s32 sprintf(char* dst, const char* fmt, ...); void __osPiCreateAccessQueue(void); @@ -88,55 +92,55 @@ void __osExceptionPreamble(); // ? __osException(?); void __osEnqueueAndYield(OSThread**); void __osEnqueueThread(OSThread**, OSThread*); -OSThread *__osPopThread(OSThread**); +OSThread* __osPopThread(OSThread**); // ? __osNop(?); void __osDispatchThread(); void __osCleanupThread(void); -void __osDequeueThread(OSThread **queue, OSThread *thread); -void osDestroyThread(OSThread *thread); -void bzero(void *__s, u32 __n); +void __osDequeueThread(OSThread** queue, OSThread* thread); +void osDestroyThread(OSThread* thread); +void bzero(void* __s, u32 __n); void osCreateThread(OSThread* thread, OSId id, void (*entry)(void*), void* arg, void* sp, OSPri pri); void __osSetSR(u32); u32 __osGetSR(); -void osWritebackDCache(void *vaddr, s32 nbytes); +void osWritebackDCache(void* vaddr, s32 nbytes); void* osViGetNextFramebuffer(); -void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt); +void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgCnt); void __osDevMgrMain(void* arg); -s32 __osPiRawStartDma(s32 dir, u32 cart_addr, void *dram_addr, size_t size); +s32 __osPiRawStartDma(s32 dir, u32 cart_addr, void* dram_addr, size_t size); u32 osVirtualToPhysical(void* vaddr); void osViBlack(u8 active); -s32 __osSiRawReadIo(void *a0, u32 *a1); +s32 __osSiRawReadIo(void* a0, u32* a1); OSId osGetThreadId(OSThread* thread); OSIntMask osSetIntMask(OSIntMask); -void osViSetMode(OSViMode *mode); -u32 __osProbeTLB(void *); +void osViSetMode(OSViMode* mode); +u32 __osProbeTLB(void*); u32 osGetMemSize(void); -void osSetEventMesg(OSEvent e, OSMesgQueue *mq, OSMesg msg); -s32 _Printf(char *(*pfn)(char *, const char *, size_t), char *arg, const char *fmt, va_list ap); +void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg msg); +s32 _Printf(char* (*pfn)(char*, const char*, size_t), char* arg, const char* fmt, va_list ap); void osUnmapTLBAll(void); s32 osEPiStartDma(OSPiHandle* handle, OSIoMesg* mb, s32 direction); -const u8 *strchr(const u8 *str, s32 ch); -size_t strlen(const u8 *str); -void *memcpy(void *dst, const void *src, size_t size); +const u8* strchr(const u8* str, s32 ch); +size_t strlen(const u8* str); +void* memcpy(void* dst, const void* src, size_t size); void osInvalICache(void* vaddr, s32 nbytes); void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msg, s32 count); void osInvalDCache(void* vaddr, s32 nbytes); u32 __osSiDeviceBusy(); void osSetThreadPri(OSThread* thread, OSPri pri); OSPri osGetThreadPri(OSThread* thread); -s32 __osEPiRawReadIo(OSPiHandle *handle, u32 devAddr, u32 *data); -void osViSwapBuffer(void *vaddr); -s32 __osEPiRawStartDma(OSPiHandle *handle, s32 direction, u32 cartAddr, void* dramAddr, size_t size); -u32 bcmp(void *__sl,void *__s2,u32 __n); +s32 __osEPiRawReadIo(OSPiHandle* handle, u32 devAddr, u32* data); +void osViSwapBuffer(void* vaddr); +s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dramAddr, size_t size); +u32 bcmp(void* __sl, void* __s2, u32 __n); OSTime osGetTime(void); void __osTimerServicesInit(); void __osTimerInterrupt(); void __osSetTimerIntr(OSTime tim); -OSTime __osInsertTimer(OSTimer *a0); +OSTime __osInsertTimer(OSTimer* a0); u32 osGetCount(void); void __osSetGlobalIntMask(u32 mask); void __osSetCompare(u32); -void* bcopy(void *__src,void *__dest,u32 __n); +void* bcopy(void* __src, void* __dest, u32 __n); void __osResetGlobalIntMask(u32 mask); s32 __osDisableInt(void); void __osRestoreInt(s32); @@ -151,9 +155,9 @@ u32 __osGetFpcCsr(); s32 osEPiWriteIo(OSPiHandle* handle, u32 devAddr, u32 data); void osMapTLBRdb(void); u32 __osGetCause(); -s32 __osEPiRawWriteIo(OSPiHandle *handle, u32 devAddr, u32 data); +s32 __osEPiRawWriteIo(OSPiHandle* handle, u32 devAddr, u32 data); void osCreateViManager(OSPri pri); -void viMgrMain(void *vargs); +void viMgrMain(void* vargs); OSViContext* __osViGetCurrentContext(); void osStartThread(OSThread* thread); void osViSetYScale(float scale); @@ -223,8 +227,8 @@ void func_80028B74(GlobalContext*, Vec3f*, UNK_PTR, UNK_PTR, Color_RGB8*, Color_ // ? func_80028FD8(?); // ? func_80029060(?); void Effect_SpawnFragment(GlobalContext* globalCtx, Vec3f* burstDepthY, Vec3f* burstDepthX, Vec3f* burstOrigin, - s16 gravityInfluence, s16 u0, s16 rotSpeed, s16 burstVel, u8 u1, s16 scale, u8 u2, - s16 jitter, s32 duration, s16 u3, s16 objNumber, u32 dList); + s16 gravityInfluence, s16 u0, s16 rotSpeed, s16 burstVel, u8 u1, s16 scale, u8 u2, s16 jitter, + s32 duration, s16 u3, s16 objNumber, u32 dList); // ? func_800292DC(?); // ? func_80029320(?); // ? func_80029444(?); @@ -238,7 +242,8 @@ void Effect_SpawnFragment(GlobalContext* globalCtx, Vec3f* burstDepthY, Vec3f* b // ? func_8002A32C(?); // ? func_8002A3C4(?); void func_8002A65C(GlobalContext* globalCtx, Actor* actor, Vec3f* pos, u32 arg3, u32 arg4); -void func_8002A6B8(GlobalContext* globalCtx, Vec3f* pos, Vec3f* arg2, Vec3f* arg3, u32 arg4, s32 arg5, u32 arg6, u32 arg7, u32 arg8, u32 arg9, u32 arg10, u32 arg11, u32 arg12, u32 arg13, u32 arg14, u32 arg15); +void func_8002A6B8(GlobalContext* globalCtx, Vec3f* pos, Vec3f* arg2, Vec3f* arg3, u32 arg4, s32 arg5, u32 arg6, + u32 arg7, u32 arg8, u32 arg9, u32 arg10, u32 arg11, u32 arg12, u32 arg13, u32 arg14, u32 arg15); // ? func_8002A894(?); // ? func_8002A95C(?); // ? func_8002A9F4(?); @@ -268,10 +273,10 @@ void Flags_SetTempClear(GlobalContext* globalCtx, s32 flag); void Flags_UnsetTempClear(GlobalContext* globalCtx, s32 flag); s32 Flags_GetCollectible(GlobalContext* globalCtx, s32 flag); void Flags_SetCollectible(GlobalContext* globalCtx, s32 flag); -void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx, u32 texture, - s16 arg3, s16 arg4, u8 arg5, u8 arg6); -void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCtx, u32 texture, - s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7); +void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx, u32 texture, s16 arg3, s16 arg4, + u8 arg5, u8 arg6); +void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCtx, u32 texture, s32 arg3, s32 arg4, + s32 arg5, s32 arg6, s32 arg7); s32 func_8002D53C(GlobalContext* globalCtx, TitleCardContext* titleCtx); void Actor_Kill(Actor* actor); void Actor_SetHeight(Actor* actor, f32 offset); @@ -357,18 +362,18 @@ void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx); s32 func_800314D4(GlobalContext* globalCtx, Actor* actorB, Vec3f* arg2, f32 arg3); void func_80031B14(GlobalContext* globalCtx, ActorContext* actorCtx); -Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId, - f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params); -Actor* Actor_SpawnAttached(ActorContext* actorCtx, Actor* attachedTo, GlobalContext* globalCtx, s16 actorId, - f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params); +Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId, f32 posX, f32 posY, f32 posZ, + s16 rotX, s16 rotY, s16 rotZ, s16 params); +Actor* Actor_SpawnAttached(ActorContext* actorCtx, Actor* attachedTo, GlobalContext* globalCtx, s16 actorId, f32 posX, + f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params); void Actor_SpawnTransitionActors(GlobalContext* globalCtx, ActorContext* actorCtx); Actor* Actor_SpawnEntry(ActorContext* actorCtx, ActorEntry* actorEntry, GlobalContext* globalCtx); Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalCtx); Actor* func_80032AF0(GlobalContext* globalCtx, ActorContext* actorCtx, Actor** actorPtr, Player* player); Actor* Actor_Find(ActorContext* actorCtx, s32 actorId, s32 actorType); void func_80032C7C(GlobalContext* globalCtx, Actor* actor); -void func_80033260(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3, - s32 arg4, f32 arg5, s16 arg6, s16 arg7, u8 arg8); +void func_80033260(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3, s32 arg4, f32 arg5, s16 arg6, + s16 arg7, u8 arg8); void func_80033480(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2, s32 arg3, s16 arg4, s16 arg5, u8 arg6); Actor* func_80033640(GlobalContext* globalCtx, Collider* collider); Actor* func_80033684(GlobalContext* globalCtx, Actor* explosiveActor); @@ -389,12 +394,17 @@ void func_8003424C(GlobalContext* globalCtx, Vec3f* arg1); void func_8003426C(Actor* actor, s16 arg1, s16 arg2, s16 arg3, s16 arg4); Hilite* func_800342EC(Vec3f* object, GlobalContext* globalCtx); Hilite* func_8003435C(Vec3f* object, GlobalContext* globalCtx); +s32 func_800343CC(GlobalContext* globalCtx, Actor* actor, s16* arg2, f32 arg3, u16 (*unkFunc1)(GlobalContext*, Actor*), + s16 (*unkFunc2)(GlobalContext*, Actor*)); s16 func_800347E8(s16 arg0); -void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc1, void* unkFunc2, Actor* actor, s16 alpha); -void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, void* unkFunc1, void* unkFunc2, Actor* actor, s16 alpha); +void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, SkelAnime_LimbUpdateMatrix2 unkFunc1, + SkelAnime_LimbAppendDlist2 unkFunc2, Actor* actor, s16 alpha); +void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, SkelAnime_LimbUpdateMatrix2 unkFunc1, + SkelAnime_LimbAppendDlist2 unkFunc2, Actor* actor, s16 alpha); +void func_80034EC0(SkelAnime* skelAnime, struct_80034EC0_Entry* arg1, s32 arg2); void Actor_Noop(Actor* actor, GlobalContext* globalCtx); -void Draw_DListOpa(GlobalContext* globalCtx, u32 dlist); -void Draw_DListXlu(GlobalContext* globalCtx, u32 dlist); +void Gfx_DrawDListOpa(GlobalContext* globalCtx, u32 dlist); +void Gfx_DrawDListXlu(GlobalContext* globalCtx, u32 dlist); Actor* Actor_FindNearby(GlobalContext* globalCtx, Actor* refActor, s16 actorId, u8 actorType, f32 range); s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5); void func_8003555C(GlobalContext* globalCtx, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3); @@ -637,6 +647,7 @@ f32 func_800437F0(f32, f32); // ? func_8005A7A8(?); // ? func_8005A8C4(?); s16 func_8005A970(u32 gl790); +s16 func_8005A9F4(Camera* camera); // ? func_8005AA90(?); // ? func_8005AC48(?); // ? func_8005AC60(?); @@ -646,7 +657,7 @@ s16 func_8005A970(u32 gl790); // ? func_8005AFB4(?); // ? func_8005B044(?); // ? func_8005B1A4(?); -s32 CollisionBtlTbl_Get(s32 index); +s32 CollisionBtlTbl_Get(s32 index); // ? func_8005B280(?); // ? func_8005B2AC(?); // ? func_8005B65C(?); @@ -679,13 +690,15 @@ s32 func_8005BA74(UNK_TYPE, UNK_TYPE); // ? func_8005BB8C(?); // ? func_8005BBB0(?); // ? func_8005BBD4(?); +void func_8005C050(GlobalContext* globalCtx, Collider* collision, Actor* actor, UNK_TYPE arg3, UNK_TYPE arg4); // ? func_8005C2BC(?); s32 func_8005C318(GlobalContext* globalCtx, ColliderDimensions* dim); s32 func_8005C328(GlobalContext* globalCtx, ColliderDimensions* dest, ColliderDimensions* src); s32 ActorCollider_AllocCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision); s32 ActorCollider_FreeCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision); s32 func_8005C3F4(GlobalContext* globalCtx, ColliderCylinderMain* collision, ColliderCylinderInit* arg2); -s32 ActorCollider_InitCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src); +s32 ActorCollider_InitCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, + ColliderCylinderInit* src); s32 func_8005C508(GlobalContext* globalCtx, ColliderCylinderMain* collision); s32 func_8005C540(GlobalContext* globalCtx, ColliderCylinderMain* collision); s32 func_8005C578(GlobalContext* globalCtx, ColliderCylinderMain* collision); @@ -718,9 +731,12 @@ void func_8005D400(UNK_TYPE, UNK_TYPE); // ? func_8005D40C(?); // ? func_8005D4DC(?); // ? func_8005D62C(?); -s32 Actor_CollisionCheck_SetAT(GlobalContext* globalCtx, SubGlobalContext11E60* simpleBodyGroups, ColliderCylinderMain* collision); -s32 Actor_CollisionCheck_SetAC(GlobalContext* globalCtx, SubGlobalContext11E60* simpleBodyGroups, ColliderCylinderMain* collision); -s32 Actor_CollisionCheck_SetOT(GlobalContext* globalCtx, SubGlobalContext11E60* simpleBodyGroups, ColliderCylinderMain* collision); +s32 Actor_CollisionCheck_SetAT(GlobalContext* globalCtx, SubGlobalContext11E60* simpleBodyGroups, + ColliderCylinderMain* collision); +s32 Actor_CollisionCheck_SetAC(GlobalContext* globalCtx, SubGlobalContext11E60* simpleBodyGroups, + ColliderCylinderMain* collision); +s32 Actor_CollisionCheck_SetOT(GlobalContext* globalCtx, SubGlobalContext11E60* simpleBodyGroups, + ColliderCylinderMain* collision); // ? func_8005DF2C(?); // ? func_8005DF50(?); // ? func_8005DF74(?); @@ -741,8 +757,8 @@ s32 Actor_CollisionCheck_SetOT(GlobalContext* globalCtx, SubGlobalContext11E60* // ? func_80061C98(?); // ? func_80061E48(?); // ? func_80061E8C(?); -void func_80061ED4(SubActorStruct98 *sub98, ActorDamageChart *damageChart, SubActor98Init *subActor98Init); -// ? func_80061EFC(?); +void func_80061ED4(SubActorStruct98* sub98, ActorDamageChart* damageChart, Sub98Init4* sub98Init); +void func_80061EFC(SubActorStruct98* sub98, ActorDamageChart* damageChart, Sub98Init4* sub98Init); // ? func_80061F64(?); // ? func_800622E4(?); // ? func_80062530(?); @@ -758,16 +774,16 @@ void func_80062D60(GlobalContext*, Vec3f*); s32 func_80062ECC(f32, f32, f32, Vec3f*, Vec3f*, Vec3f*, Vec3f*, Vec3f*); void SaveContext_Init(void); // ? func_800636C0(?); -void func_8006375C(UNK_TYPE, UNK_TYPE, UNK_TYPE); +void func_8006375C(s32 arg0, s32 arg1, float* d_80855320); // ? func_8006376C(?); // ? func_80063828(?); // ? func_8006390C(?); // ? func_80063C04(?); // ? func_80063D7C(?); void DebugDisplay_Init(void); -DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, - f32 scaleX, f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha, - s16 type, GraphicsContext* gfxCtx); +DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX, + f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha, s16 type, + GraphicsContext* gfxCtx); void DebugDisplay_DrawObjects(GlobalContext* globalCtx); void func_8006450C(GlobalContext* globalCtx, CutsceneContext* csCtx); void func_80064534(GlobalContext* globalCtx, CutsceneContext* csCtx); @@ -781,13 +797,13 @@ void func_800694A0(GlobalContext* globalCtx, s16 drawId); // ? func_8006BA00(?); // ? func_8006BA30(?); void Audio_PlaySoundAtPosition(GlobalContext* globalCtx, Vec3f* pos2, s32 radius, u16 sfxId); -// ? func_8006BBC0(?); -// ? func_8006BE88(?); -// ? func_8006BF1C(?); -// ? func_8006C0FC(?); +u16 ElfMessage_GetSariaText(GlobalContext* globalCtx); +u16 ElfMessage_GetCUpText(GlobalContext* globalCtx); +u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet); // ? func_8006C3A0(?); // ? func_8006C3D0(?); void func_8006C438(GlobalContext* globalCtx, s16 arg1); +s32 func_8006C4A4(GlobalContext*, s32); // ? func_8006C510(?); // ? func_8006C5A8(?); // ? func_8006CBAC(?); @@ -814,6 +830,7 @@ void func_8006EE48(UNK_TYPE); // ? func_8006F0FC(?); // ? func_8006F140(?); f32 func_8006F93C(u16, u16, u16); +f32 func_8006F9BC(u16, u16, u16, u16, u16); // ? func_8006FB94(?); // ? func_8006FC88(?); // ? func_80070600(?); @@ -839,12 +856,13 @@ f32 func_800746DC(); // ? func_800766C4(?); // ? func_8007672C(?); // ? func_80076934(?); +void func_800773A8(GlobalContext* globalCtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4); s32 func_800775CC(); void func_800775D8(); s32 func_800775E4(); void func_800775F0(u16); // ? func_80077600(?); -void Lib_MemSet(void* dest, size_t size, u8 val); +void Lib_MemSet(u8* dest, size_t size, u8 val); f32 Math_Coss(s16 angle); f32 Math_Sins(s16 angle); s32 Math_ApproxUpdateScaledS(s16* fp, s16 target, s16 step); @@ -879,9 +897,12 @@ void Health_InitData(GlobalContext* globalCtx); void Health_UpdateData(GlobalContext* globalCtx); void Interface_DrawHealth(GlobalContext* globalCtx); void Health_HandleCriticalAlarm(GlobalContext* globalCtx); -void Lights_InitPositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, s16 radius, u32 type); -void Lights_InitType0PositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, s16 radius); -void Lights_InitType2PositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, s16 radius); +void Lights_InitPositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, + s16 radius, u32 type); +void Lights_InitType0PositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, + s16 radius); +void Lights_InitType2PositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, + s16 radius); void Lights_SetPositionalLightColorAndRadius(LightInfoPositional* info, u8 red, u8 green, u8 blue, s16 radius); void Lights_InitDirectional(LightInfoDirectional* info, s8 dirX, s8 dirY, s8 dirZ, u8 red, u8 green, u8 blue); void Lights_MapperInit(LightMapper* mapper, u8 red, u8 green, u8 blue); @@ -919,10 +940,10 @@ u8 ZeldaArena_IsInitalized(); void MapMark_Init(GlobalContext* globalCtx); void MapMark_ClearPointers(GlobalContext* globalCtx); void MapMark_DrawConditionally(GlobalContext* globalCtx); -// ? func_8007BE60(?); -// ? func_8007BED4(?); -// ? func_8007BF08(?); -// ? func_8007BF10(?); +void PreNmiBuff_Init(PreNmiBuff* this); +void PreNmiBuff_SetReset(PreNmiBuff* this); +u32 PreNmiBuff_IsResetting(PreNmiBuff* this); +void MsgEvent_SendNullTask(); f32 func_8007BF90(Vec3f*, Vec3f*); // ? func_8007C028(?); // ? func_8007C058(?); @@ -985,6 +1006,9 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2); void func_80088B34(s16 arg0); void Interface_Draw(GlobalContext* globalCtx); void Interface_Update(GlobalContext* globalCtx); +Path* Path_GetByIndex(GlobalContext* globalCtx, s16 index, s16 max); +f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw); +void Path_CopyLastPoint(Path* path, Vec3f* dest); // ? func_8008E6A0(?); // ? func_8008E6AC(?); // ? func_8008E750(?); @@ -1031,54 +1055,65 @@ u8 func_80090480(GlobalContext* globalCtx, Collider* collider, UNK_PTR a2, Vec3f // ? func_80091880(?); // ? func_80091A24(?); void PreNMI_Init(PreNMIContext* prenmiCtx); -// ? func_80092500(?); -// ? func_80092584(?); -// ? func_80092AB8(?); -// ? func_80092B48(?); -// ? func_80092BFC(?); -// ? func_80092C20(?); -void func_80092DAC(s16, s16); -void func_80092DF0(s16, s16); -// ? func_80092E3C(?); -void func_80092E70(s16, s16, UNK_TYPE, UNK_TYPE, UNK_TYPE); -// ? func_80092F38(?); -s16 func_80092F88(Camera*, UNK_TYPE); -// ? func_80092FAC(?); -// ? func_80092FF0(?); -// ? func_80093370(?); -// ? func_80093708(?); -// ? func_8009373C(?); -Gfx* func_80093774(Gfx* a0, u32 a1); -// ? func_800937C0(?); -// ? func_80093808(?); -// ? func_800938B4(?); -// ? func_8009398C(?); -// ? func_80093AD0(?); +Vec3f* Quake_AddVec(Vec3f* dst, Vec3f* arg1, struct_80045714* arg2); +void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 y, f32 x); +s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake); +s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake); +s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake); +s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake); +s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake); +s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake); +s16 Quake_GetFreeIndex(); +QuakeRequest* Quake_AddImpl(Camera* cam, u32 callbackIdx); +void Quake_Remove(QuakeRequest* req); +QuakeRequest* Quake_GetRequest(s16 idx); +QuakeRequest* Quake_SetValue(s16 idx, s16 valueType, s16 value); +u32 Quake_SetSpeed(s16 idx, s16 value); +u32 Quake_SetCountdown(s16 idx, s16 value); +s16 Quake_GetCountdown(s16 idx); +u32 Quake_SetQuakeValues(s16 idx, s16 y, s16 x, s16 zoom, s16 rotZ); +u32 Quake_SetUnkValues(s16 idx, s16 arg1, SubQuakeRequest14 arg2); +void Quake_Init(); +s16 Quake_Add(Camera* cam, u32 callbackIdx); +u32 Quake_RemoveFromIdx(s16 idx); +s16 Quake_Calc(Camera* camera, UnkQuakeCalcStruct* camData); +Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f); +Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f); +Gfx* Gfx_SetFog2(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f); +Gfx* Gfx_CallSetupDL(Gfx* gfx, u32 i); +Gfx* func_800937C0(Gfx* gfx); +Gfx* func_80093808(Gfx* gfx); +void func_800938B4(GraphicsContext* gfxCtx); +void func_8009398C(GraphicsContext* gfxCtx); +void func_80093AD0(GraphicsContext* gfxCtx); void func_80093BA8(GraphicsContext* gfxCtx); -// ? func_80093C80(?); +void func_80093C80(GlobalContext* globalCtx); void func_80093D18(GraphicsContext* gfxCtx); void func_80093D84(GraphicsContext* gfxCtx); -// ? func_80093F34(?); -// ? func_80093F58(?); -void func_80094044(GraphicsContext *gfxCtx); -// ? func_800940B0(?); -// ? func_800942F0(?); -// ? func_8009435C(?); -// ? func_800944A0(?); -// ? func_80094520(?); -// ? func_8009457C(?); -// ? func_800945A0(?); -// ? func_80094678(?); -Gfx* func_800946E4(Gfx* a0); -// ? func_800947AC(?); -// ? func_80094A14(?); -// ? func_80094C50(?); -// ? func_80094DB8(?); +Gfx* func_80093F34(Gfx* gfx); +Gfx* func_80093F58(Gfx* gfx); +void func_80094044(GraphicsContext* gfxCtx); +void func_800940B0(GraphicsContext* gfxCtx); +void func_800942F0(GraphicsContext* gfxCtx); +void func_8009435C(GraphicsContext* gfxCtx); +Gfx* func_800944A0(Gfx* gfx); +void func_80094520(GraphicsContext* gfxCtx); +void func_8009457C(Gfx** gfxp); +void func_800945A0(GraphicsContext* gfxCtx); +void func_80094678(GraphicsContext* gfxCtx); +Gfx* func_800946E4(Gfx* gfx); +Gfx* func_800947AC(Gfx* gfx); +void func_80094A14(GraphicsContext* gfxCtx); +void func_80094C50(GraphicsContext* gfxCtx); +void Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height); Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y); -Gfx* Draw_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height); -Gfx* Draw_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2, u32 y2, s32 width2, s32 height2); -Gfx* Draw_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2, u32 y2, s32 width2, s32 height2, s32 red, s32 green, s32 blue, s32 alpha); -// ? func_80095248(?); +Gfx* Gfx_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height); +Gfx* Gfx_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2, + u32 y2, s32 width2, s32 height2); +Gfx* Gfx_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, + u32 x2, u32 y2, s32 width2, s32 height2, s32 r, s32 g, s32 b, s32 a); +void func_80095248(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b); +void func_80095974(GraphicsContext* gfxCtx); void func_80095AA0(GlobalContext* globalCtx, Room* room, UNK_TYPE arg2, UNK_TYPE arg3); // ? func_8009638C(?); void func_80096FD4(GlobalContext* globalCtx, Room* room); @@ -1087,12 +1122,13 @@ s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum); s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx); void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags); void func_80097534(GlobalContext* globalCtx, RoomContext* roomCtx); -// ? func_800975D0(?); -// ? func_80097604(?); -// ? func_80097820(?); -// ? func_80097848(?); -// ? func_80097850(?); -// ? func_80097904(?); +void Sample_Calc(SampleContext* this); +void Sample_Draw(SampleContext* this); +void Sample_Update(SampleContext* this); +void Sample_Destroy(SampleContext* this); +void Sample_SetupView(SampleContext* this); +void Sample_LoadTitleStatic(SampleContext* this); +void Sample_Init(SampleContext* this); void Inventory_ChangeEquipment(s16 equipment, u16 value); u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment); void Inventory_ChangeUpgrade(s16 upgrade, s16 value); @@ -1105,53 +1141,88 @@ s32 Scene_ExecuteCommands(GlobalContext* globalCtx, SceneCmd* sceneCmd); void func_80098CBC(GlobalContext* globalCtx, u8* nbTransitionActors); void func_800994A0(GlobalContext* globalCtx); void Scene_Draw(GlobalContext* globalCtx); -// ? func_800A08A0(?); -// ? func_800A0D94(?); -// ? func_800A106C(?); -// ? func_800A1344(?); -void SkelAnime_Draw(GlobalContext* globalCtx, u32 limbIndex, u32 adt, u8 limbDListCnt, void* internal0, void* internal1); -// ? func_800A180C(?); -void func_800A1AC8(GlobalContext *globalCtx, u32 limbIndex, u32 actorDrawTbl, u32 dListCount, void* posUpdateFunc, void *drawFunc, Actor* actor); -// ? func_800A1D8C(?); -// ? func_800A1FC8(?); -s32 SkelAnime_GetFrameCount(u32 animation); -// ? func_800A2044(?); -// ? func_800A24A0(?); -Gfx* func_800A273C(GlobalContext* globalCtx, u32 limbIndex, u32 adt, u8 limbDListCnt, void* internal0, void* internal1, Actor* actor, Gfx* gfx); -// ? func_800A2E70(?); -// ? func_800A32EC(?); -// ? func_800A3334(?); -// ? func_800A336C(?); -// ? func_800A3478(?); -// ? func_800A34DC(?); -// ? func_800A390C(?); -// ? func_800A39AC(?); -// ? func_800A3B8C(?); -// ? func_800A3BE4(?); -// ? func_800A3C9C(?); -// ? func_800A3F08(?); -// ? func_800A3D70(?); -// ? func_800A4478(?); -void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 skeleton, u32 animation, u8 unk0, u8 unk1, u8 unk2); -void func_800A46F8(GlobalContext* globalCtx, SkelAnime* skelAnime, u32 skeleton, u32 animation, u8 unk0, u16* unk1, u8 unk2); -// ? func_800A4A20(?); -// ? func_800A4AD8(?); -// ? func_800A4D9C(?); -// ? func_800A4EE0(?); -// ? func_800A487C(?); -// ? func_800A49B0(?); +void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* actorDrawTable, + SkelAnime_LimbUpdateMatrix updateMtxFunc, SkelAnime_LimbAppendDlist appendDlistFunc, + Actor* actor, s32 dListIndex); +void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* actorDrawTable, s32 dListCount, + SkelAnime_LimbUpdateMatrix updateMtxFunc, SkelAnime_LimbAppendDlist appendDlistFunc, + Actor* actor, s32 dListIndex); +void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* actorDrawTable, + SkelAnime_LimbUpdateMatrix updateMtxFunc, SkelAnime_LimbAppendDlist appendDlistFunc, Actor* actor); +void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* actorDrawTable, s32 dListCount, + SkelAnime_LimbUpdateMatrix updateMtxFunc, SkelAnime_LimbAppendDlist appendDlistFunc, + Actor* actor); +s16 SkelAnime_GetFrameCount(GenericAnimationHeader* animationSeg); +Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* actorDrawTable, + SkelAnime_LimbUpdateMatrix2 updateMtxFunc, SkelAnime_LimbAppendDlist2 appendDlistFunc, + Actor* actor, Gfx* gfx); +Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* actorDrawTable, s32 dListCount, + SkelAnime_LimbUpdateMatrix2 updateMtxFunc, SkelAnime_LimbAppendDlist2 appendDlistFunc, + Actor* actor, Gfx* gfx); +void SkelAnime_InterpolateVec3s(s32, Vec3s*, Vec3s*, Vec3s*, f32); +void SkelAnime_AnimationCtxReset(AnimationContext* animationCtx); +void func_800A32F4(GlobalContext* globalCtx); +void func_800A3310(GlobalContext* globalCtx); +void SkelAnime_LoadLinkAnimetion(GlobalContext* globalCtx, LinkAnimetionEntry* linkAnimetionSeg, s32 frame, + s32 limbCount, void* ram); +void SkelAnime_LoadAnimationType1(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src); +void SkelAnime_LoadAnimationType2(GlobalContext* globalCtx, s32 limbCount, Vec3s* arg2, Vec3s* arg3, f32 arg4); +void SkelAnime_LoadAnimationType3(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index); +void SkelAnime_LoadAnimationType4(GlobalContext* globalCtx, s32 vecCount, Vec3s* dst, Vec3s* src, u8* index); +void SkelAnime_LoadAnimationType5(GlobalContext* globalCtx, Actor* actor, SkelAnime* skelAnime, f32 arg3); +void func_800A390C(GlobalContext* globalCtx, AnimationContext* animationCtx); +void SkelAnime_InitLinkAnimetion(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, + LinkAnimetionEntry* linkAnimetionEntrySeg, s32 flags, Vec3s* actorDrawTbl, Vec3s* arg6, + s32 limbBufCount); +void func_800A3B8C(SkelAnime* skelAnime); +s32 func_800A3BC0(GlobalContext* globalCtx, SkelAnime* skelAnime); +void func_800A3C9C(GlobalContext* globalCtx, SkelAnime* skelAnime); +void SkelAnime_SetTransition(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 transitionRate); +void SkelAnime_ChangeLinkAnim(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, + f32 playbackSpeed, f32 frame, f32 frameCount, u8 arg6, f32 transitionRate); +void SkelAnime_ChangeLinkAnimDefaultStop(GlobalContext* globalCtx, SkelAnime* skelAnime, + LinkAnimetionEntry* linkAnimetionEntrySeg); +void SkelAnime_ChangeLinkAnimPlaybackStop(GlobalContext* globalCtx, SkelAnime* skelAnime, + LinkAnimetionEntry* linkAnimetionEntrySeg, f32 playbackSpeed); +void SkelAnime_ChangeLinkAnimDefaultRepeat(GlobalContext* globalCtx, SkelAnime* skelAnime, + LinkAnimetionEntry* linkAnimetionEntrySeg); +void SkelAnime_ChangeLinkAnimPlaybackRepeat(GlobalContext* globalCtx, SkelAnime* skelAnime, + LinkAnimetionEntry* linkAnimetionEntrySeg, f32 playbackSpeed); +void func_800A41FC(GlobalContext* globalCtx, SkelAnime* skelAnime); +void func_800A425C(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, + f32 frame); +void func_800A42A0(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, + f32 frame); +void func_800A42E4(GlobalContext* globalCtx, SkelAnime* skelAnime, f32 frame); +void func_800A431C(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, + f32 transitionFrame, LinkAnimetionEntry* linkAnimetionEntrySeg2, f32 frame, f32 transitionRate, + Vec3s* actorDrawTable); +void func_800A43B8(GlobalContext* globalCtx, SkelAnime* skelAnime, LinkAnimetionEntry* linkAnimetionEntrySeg, + f32 transitionFrame, LinkAnimetionEntry* linkAnimetionEntrySeg2, f32 frame, f32 transitionRate, + Vec3s* arg7); +s32 func_800A4530(SkelAnime* skelAnime, f32 arg1); +void SkelAnime_Init(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, + AnimationHeader* animationseg, Vec3s* actorDrawTable, Vec3s* arg5, s32 limbCount); +void SkelAnime_InitSV(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, + AnimationHeader* animationseg, Vec3s* actorDrawTable, Vec3s* arg5, s32 limbCount); +void SkelAnime_InitSkin(GlobalContext* globalCtx, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, + AnimationHeader* animationseg); s32 SkelAnime_FrameUpdateMatrix(SkelAnime* skelAnime); -// ? func_800A4C58(?); -// ? func_800A4FE4(?); -void SkelAnime_ChangeAnimation(SkelAnime* skelAnime, u32 animation, f32 playbackSpeed, f32 unk0, f32 frameCount, u8 unk1, f32 transitionRate); -void func_800A51E8(SkelAnime *skelAnime, u32 animation); -void func_800A5240(SkelAnime *skelAnime, u32 animation, f32 unk0); -void func_800A529C(SkelAnime *skelAnime, u32 animation, f32 unk0, Actor *actor); -// ? func_800A52F8(?); -// ? func_800A54FC(?); -UNK_TYPE func_800A56C8(SkelAnime* skelAnime, f32 arg1); -// ? func_800A56F0(?); -// ? func_800A5774(?); +void SkelAnime_ChangeAnimImpl(SkelAnime* skelAnime, AnimationHeader* animationseg, f32 playbackSpeed, f32 frame, + f32 frameCount, u8 unk1, f32 transitionRate, s8 unk2); +void SkelAnime_ChangeAnim(SkelAnime* skelAnime, AnimationHeader* animationseg, f32 playbackSpeed, f32 unk0, + f32 frameCount, u8 unk1, f32 transitionRate); +void SkelAnime_ChangeAnimDefaultStop(SkelAnime* skelAnime, AnimationHeader* animationseg); +void SkelAnime_ChangeAnimTransitionStop(SkelAnime* skelAnime, AnimationHeader* animationseg, f32 transitionRate); +void SkelAnime_ChangeAnimPlaybackStop(SkelAnime* skelAnime, AnimationHeader* animationseg, f32 playbackSpeed); +void SkelAnime_ChangeAnimDefaultRepeat(SkelAnime* skelAnime, AnimationHeader* animationseg); +void SkelAnime_ChangeAnimTransitionRepeat(SkelAnime* skelAnime, AnimationHeader* animationseg, f32 transitionRate); +void SkelAnime_ChangeAnimPlaybackRepeat(SkelAnime* skelAnime, AnimationHeader* animationseg, f32 playbackSpeed); +void SkelAnime_AnimReverse(SkelAnime* skelAnime); +void func_800A5428(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src, u8* index); +void func_800A54FC(SkelAnime* skelAnime, Vec3f* pos, s16 angle); +s32 func_800A56C8(SkelAnime* skelAnime, f32 arg1); +void SkelAnime_Free(SkelAnime* skelAnime, GlobalContext* globalCtx); // ? func_800A57C0(?); // ? func_800A598C(?); // ? func_800A5E28(?); @@ -1192,27 +1263,36 @@ u32 func_800AA148(); void func_800AA15C(); void func_800AA16C(); void func_800AA178(u32); -// ? func_800AA190(?); +void func_800AA190(UnkViewStruct* arg0, Viewport* viewport); +View* func_800AA1F8(GraphicsContext* gfxCtx); +void func_800AA250(View* view); void func_800AA278(View*, GraphicsContext*); -// ? func_800AA358(?); -// ? func_800AA43C(?); -void func_800AA460(View*, f32, f32, f32); -// ? func_800AA4FC(?); -// ? func_800AA550(?); -void func_800AA76C(View*, f32, f32, f32); -void func_800AA78C(View*, f32, f32, f32); -void func_800AA7AC(View*, f32); -// ? func_800AA7B8(?); -// ? func_800AA814(?); -// ? func_800AA890(?); -// ? func_800AAA50(?); -// ? func_800AAA9C(?); -// ? func_800AB0A8(?); -// ? func_800AB2C4(?); -// ? func_800AB560(?); -// ? func_800AB944(?); +void func_800AA358(View* view, Vec3f* vec1, Vec3f* vec2, Vec3f* vec3); +void func_800AA3F0(View* view, Vec3f* vec1, Vec3f* vec2, Vec3f* vec3); +void func_800AA43C(View* view, f32 arg1); +void func_800AA454(View* view, f32* arg1); +void func_800AA460(View* view, f32 fieldOfView, f32 fogDistance, f32 zDepth); +void func_800AA48C(View* view, f32* fieldOfView, f32* fogDistance, f32* zDepth); +void func_800AA4A8(View* view, f32 fieldOfView, f32 fogDistance, f32 zDepth); +void func_800AA4E0(View* view, f32* fieldOfView, f32* fogDistance, f32* zDepth); +void func_800AA4FC(View* view, Viewport* viewport); +void func_800AA52C(View* view, Viewport* viewport); +void func_800AA550(View* view); +void func_800AA76C(View* view, f32 arg1, f32 arg2, f32 arg3); +void func_800AA78C(View* view, f32 arg1, f32 arg2, f32 arg3); +void func_800AA7AC(View* view, f32 arg1); +void func_800AA7B8(View* view); +void func_800AA814(View* view); +void func_800AA840(View* view, Vec3f vec1, Vec3f vec2, f32 arg3); +s32 func_800AA890(View* view, Mtx* mtx); +void func_800AAA50(View* view, s32 arg1); +s32 func_800AAA9C(View* view); +s32 func_800AB0A8(View* view); +s32 func_800AB2C4(View* view); +s32 func_800AB560(View* view); +s32 func_800AB944(View* view); // ? func_800AB9EC(?); -void func_800ABE74(f32, f32, f32); +s32 func_800ABE74(f32 eyeX, f32 eyeY, f32 eyeZ); // ? func_800AC030(?); // ? func_800AC2F4(?); // ? func_800AC89C(?); @@ -1341,14 +1421,14 @@ void KaleidoScopeCall_LoadPlayer(); void KaleidoScopeCall_Init(GlobalContext* globalCtx); void KaleidoScopeCall_Destroy(GlobalContext* globalCtx); void KaleidoScopeCall_Update(GlobalContext* globalCtx); -void KaleidoScopeCall_Draw(GlobalContext *globalCtx); +void KaleidoScopeCall_Draw(GlobalContext* globalCtx); // ? func_800BC450(?); // ? func_800BC490(?); s32 func_800BC56C(GlobalContext*, s16); // ? func_800BC5E0(?); void func_800BC88C(GlobalContext*); Gfx* func_800BC8A0(GlobalContext* globalCtx, Gfx* a1); -// ? func_800BC8EC(?); +void func_800BC8EC(GlobalContext*); UNK_TYPE func_800BCA64(UNK_ARGS); // ? func_800BD314(?); // ? func_800BED40(?); @@ -1372,10 +1452,10 @@ void func_800C0704(GlobalContext*, s16, f32); // ? func_800C078C(?); // ? func_800C0808(?); // ? func_800C0874(?); -void func_800C0C88(GlobalContext *globalCtx); +void func_800C0C88(GlobalContext* globalCtx); // ? func_800C0A44(?); // ? func_800C0A88(?); -// ? func_800C0AF4(?); +void func_800C0AF4(GlobalContext*, s8, s16); void func_800C0B60(GlobalContext* globalCtx); void func_800C0BB4(GlobalContext* globalCtx); // ? func_800C0CB8(?); @@ -1458,22 +1538,23 @@ void* GameAlloc_Malloc(GameAlloc* this, u32 size); void GameAlloc_Free(GameAlloc* this, void* data); void GameAlloc_Cleanup(GameAlloc* this); void GameAlloc_Init(GameAlloc* this); -// ? func_800C5850(?); -// ? func_800C58BC(?); -// ? func_800C5AB0(?); -// ? func_800C5B14(?); -// ? func_800C5C2C(?); -// ? func_800C5D08(?); -// ? func_800C5D94(?); -// ? func_800C5DC0(?); -// ? func_800C61D8(?); +void Graph_FaultClient(); +void Graph_DisassembleUCode(void* arg0); +void Graph_UCodeFaultClient(void* arg0); +void* Graph_InitTHGA(GraphicsContext* gfxCtx); +GameStateOverlay* Graph_GetNextGameState(); +void Graph_Init(GraphicsContext* gfxCtx); +void Graph_Destroy(GraphicsContext* gfxCtx); +void Graph_TaskSet00(GraphicsContext* gfxCtx); +void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState); void Graph_ThreadEntry(void*); void* Graph_Alloc(GraphicsContext* gfxCtx, size_t size); -void func_800C6AC4(Gfx** a0, GraphicsContext* gfxCtx, char* file, s32 line); -void func_800C6B54(Gfx** a0, GraphicsContext* gfxCtx, char* file, s32 line); -Gfx* func_800C6C20(Gfx* a0); -// ? func_800C6C28(?); -// ? func_800C6C3C(?); +void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size); +void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line); +void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line); +Gfx* Graph_GfxPlusOne(Gfx* gfx); +Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst); +void* Graph_DlistAlloc(Gfx** gfx, u32 size); ListAlloc* ListAlloc_Init(ListAlloc* this); void* ListAlloc_Alloc(ListAlloc* this, u32 size); void ListAlloc_Free(ListAlloc* this, void* data); @@ -1492,7 +1573,7 @@ void Main(void*); // ? func_800C7C14(?); // ? func_800C7DD0(?); void func_800C7E08(Input*, u32); -//void PadMgr_Init(PadMgr* padmgr, OSMesg mesg, UNK_TYPE arg2, OSId id, OSPri priority, void* stack); +// void PadMgr_Init(PadMgr* padmgr, OSMesg mesg, UNK_TYPE arg2, OSId id, OSPri priority, void* stack); // ? func_800C82A0(?); // ? func_800C84E4(?); // ? func_800C8534(?); @@ -1611,8 +1692,8 @@ void Matrix_Scale(f32 x, f32 y, f32 z, u8 mode); void Matrix_RotateX(f32 x, u8 mode); void Matrix_RotateY(f32 y, u8 mode); void Matrix_RotateZ(f32 z, u8 mode); -void Matrix_RotateXYZ(s16 x, s16 y, s16 z, u8 mode); -void func_800D1340(Vec3f* arg0, Vec3s* arg1); +void Matrix_RotateZYX(s16 x, s16 y, s16 z, u8 mode); +void Matrix_TranslateThenRotateZYX(Vec3f* arg0, Vec3s* arg1); void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec); Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest); Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line); @@ -1629,10 +1710,10 @@ void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag); void func_800D23FC(f32 f, Vec3f* vec, u8 mode); MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line); void func_800D2CEC(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6); -// ? func_800D2DF0(?); -// ? func_800D2DFC(?); -// ? func_800D2E14(?); -// ? func_800D2E20(?); +// ? SysUcode_GetUCodeBoot(?); +// ? SysUcode_GetUcodeBootSize(?); +// ? SysUcode_GetUcode(?); +// ? SysUcode_GetUcodeData(?); // ? func_800D2E30(?); // ? func_800D3140(?); // ? func_800D3140(?); @@ -1642,7 +1723,7 @@ void IrqMgr_AddClient(IrqMgr* this, IrqMgrClient* c, OSMesgQueue* msgQ); void IrqMgr_RemoveClient(IrqMgr* this, IrqMgrClient* c); void IrqMgr_SendMesgForClient(IrqMgr* this, OSMesg msg); void IrqMgr_JamMesgForClient(IrqMgr* this, OSMesg msg); -void IrqMgr_HandlePreNMI(IrqMgr *this); +void IrqMgr_HandlePreNMI(IrqMgr* this); void IrqMgr_CheckStack(); void IrqMgr_HandlePRENMI450(IrqMgr* this); void IrqMgr_HandlePRENMI480(IrqMgr* this); @@ -1678,7 +1759,7 @@ u32 Fault_ConvertAddress(FaultAddrConvClient*); void Fault_Sleep(u32); void Fault_PadCallback(Input*); void Fault_UpdatePadImpl(); -bool Fault_WaitForInputImpl(); +u32 Fault_WaitForInputImpl(); void Fault_WaitForInput(); void Fault_DrawRec(s32, s32, s32, s32, u16); void Fault_FillScreenBlack(); @@ -1724,7 +1805,7 @@ void FaultDrawer_VPrintf(const char*, char*); void FaultDrawer_Printf(const char*, ...); void FaultDrawer_DrawText(s32, s32, const char*, ...); void FaultDrawer_SetDrawerFB(void*, u16, u16); -void FaultDrawer_SetInputCallback(void(*)()); +void FaultDrawer_SetInputCallback(void (*)()); void FaultDrawer_SetDefault(); // ? func_800D7CD0(?); // ? func_800D7D04(?); @@ -2132,7 +2213,7 @@ void GfxPrint_SetPosPx(GfxPrint*, s32, s32); void GfxPrint_SetPos(GfxPrint*, s32, s32); void GfxPrint_SetBasePosPx(GfxPrint*, s32, s32); void GfxPrint_PrintCharImpl(GfxPrint*, u8); -void GfxPrint_PrintChar(GfxPrint*, char); +void GfxPrint_PrintChar(GfxPrint*, u8); void GfxPrint_PrintStringWithSize(GfxPrint*, const void*, size_t, size_t); GfxPrint* GfxPrint_Callback(GfxPrint*, const char*, size_t); void GfxPrint_Ctor(GfxPrint*); @@ -2143,14 +2224,14 @@ void GfxPrint_VPrintf(GfxPrint*, const char*, va_list); void GfxPrint_Printf(GfxPrint*, const char*, ...); void func_800FBCE0(); void func_800FBFD8(); -void *Overlay_AllocateAndLoad(u32 vRomStart, u32 vRomEnd, void *vRamStart, void *vRamEnd); +void* Overlay_AllocateAndLoad(u32 vRomStart, u32 vRomEnd, void* vRamStart, void* vRamEnd); // ? func_800FC258(?); -void Overlay_DoRelocation(void *allocatedVRamAddress, OverlayRelocationSection *overlayInfo, void *vRamAddress); -s32 Overlay_Load(u32 vRomStart, u32 vRomEnd, void *vRamStart, void *vRamEnd, void *allocatedVRamAddress); +void Overlay_DoRelocation(void* allocatedVRamAddress, OverlayRelocationSection* overlayInfo, void* vRamAddress); +s32 Overlay_Load(u32 vRomStart, u32 vRomEnd, void* vRamStart, void* vRamEnd, void* allocatedVRamAddress); // ? func_800FC800(?); // ? func_800FC83C(?); // ? func_800FCAB4(?); -void SystemHeap_Init(void *start, u32 size); +void SystemHeap_Init(void* start, u32 size); // ? func_800FCC00(?); // ? func_800FCC08(?); // ? func_800FCC10(?); @@ -2158,19 +2239,19 @@ void SystemHeap_Init(void *start, u32 size); // ? func_800FCC24(?); // ? func_800FCC6C(?); // ? func_800FCD40(?); -// ? func_800FCE80(?); -// ? func_800FCF34(?); -// ? func_800FCF54(?); -// ? func_800FCFA0(?); -// ? func_800FD0C4(?); -// ? func_800FD210(?); -f32 func_800FD250(f32 f12, f32 f14); -// ? func_800FD338(?); -// ? func_800FD390(?); -// ? func_800FD3C8(?); -// ? func_800FD400(?); -// ? func_800FD438(?); -// ? func_800FD470(?); +f32 Math_tanf(f32 x); +f32 Math_nearbyintf(f32 x); +f32 Math_atanf_taylor_q(f32 x); +f32 Math_atanf_taylor(f32 x); +f32 Math_atanf_cfrac(f32 x); +f32 Math_atanf(f32 x); +f32 Math_atan2f(f32 y, f32 x); +f32 Math_asinf(f32 x); +f32 Math_acosf(f32 x); +f32 ceilf(f32 x); +f32 truncf(f32 x); +f32 roundf(f32 x); +f32 nearbyintf(f32 x); void SystemArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); void* SystemArena_Malloc(u32 size); void* SystemArena_MallocDebug(u32 size, const char* file, s32 line); @@ -2213,10 +2294,10 @@ u8 __osMallocIsInitalized(Arena* arena); void __osMalloc_FreeBlockTest(Arena* arena, ArenaNode* node); void* __osMalloc_NoLockDebug(Arena* arena, u32 size, const char* file, s32 line); void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line); -void* __osMallocRDebug(Arena *arena, u32 size, const char *file, s32 line); -void* __osMalloc_NoLock(Arena *arena, u32 size); +void* __osMallocRDebug(Arena* arena, u32 size, const char* file, s32 line); +void* __osMalloc_NoLock(Arena* arena, u32 size); void* __osMalloc(Arena* arena, u32 size); -void* __osMallocR(Arena *arena, u32 size); +void* __osMallocR(Arena* arena, u32 size); void __osFree_NoLock(Arena* arena, void* ptr); void __osFree(Arena* arena, void* ptr); void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, s32 line); @@ -2272,7 +2353,7 @@ s16 sins(u16); // ? func_80101AA4(?); // ? func_80101B40(?); // ? func_80101B90(?); -// ? func_80101E34(?); +void func_80101E34(MtxF*, f32, f32, f32, f32, f32, f32, f32, f32, f32); // ? func_80101EB0(?); // ? func_801021E4(?); // ? osStopTimer(?); @@ -2289,11 +2370,12 @@ s16 sins(u16); // ? func_80103210(?); // ? func_8010328C(?); // ? func_801032B0(?); -void func_80103A70(UNK_PTR, Gfx*, Hilite*, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, s32, s32); +void func_80103A70(UNK_PTR, Gfx*, Hilite*, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, + s32, s32); // ? func_80103B30(?); // ? func_80103B60(?); // ? func_80103BB0(?); -// ? func_80103D58(?); +void func_80103D58(Mtx*, f32, f32, f32, f32, f32, f32, f32); // ? func_80103DC0(?); // ? func_80103E20(?); // ? func_80103FA4(?); @@ -2305,7 +2387,7 @@ void osDpSetStatus(u32 status); // ? func_801041E0(?); // ? func_801043B8(?); // ? func_80104450(?); -// ? func_801045A4(?); +void func_801045A4(Mtx*, f32, f32, f32, f32, f32, f32, f32); f32 cosf(f32); s16 coss(u16); void osViSetEvent(OSMesgQueue* mq, OSMesg m, u32 retraceCount); @@ -2347,7 +2429,7 @@ f32 absf(f32); // ? func_801069B0(?); u8 func_80106BC8(GlobalContext* globalCtx); // ? func_80106C88(?); -// ? func_80106CCC(?); +void func_80106CCC(GlobalContext*); // ? func_80106D40(?); // ? func_80106F1C(?); // ? func_80107244(?); @@ -2361,7 +2443,7 @@ u8 func_80106BC8(GlobalContext* globalCtx); // ? func_80109968(?); // ? func_80109B3C(?); // ? func_8010B0C0(?); -// ? func_8010B680(?); +void func_8010B680(GlobalContext*, u16, s32); void func_8010B720(GlobalContext* globalCtx, u16 textId); // ? func_8010B820(?); // ? func_8010BD58(?); @@ -2382,5 +2464,13 @@ void func_801109B0(GlobalContext* globalCtx); void func_80110F68(GlobalContext* globalCtx); void func_80112098(GlobalContext* globalCtx); -void func_80800878(TitleContext*); +void Title_Init(TitleContext*); +void Title_Destroy(TitleContext* this); +void func_80801E44(GameState*); // Select_Init +void func_80801E0C(GameState*); // Select_Destroy +void Opening_Init(OpeningContext* this); +void Opening_Destroy(OpeningContext* this); +void func_80811A20(GameState*); // FileChoose_Init +void func_80811A18(GameState*); // FileChoose_Destroy + #endif diff --git a/include/ichain.h b/include/ichain.h index 21ede465c..8b1112191 100644 --- a/include/ichain.h +++ b/include/ichain.h @@ -1,8 +1,7 @@ #ifndef _ICHAIN_H_ #define _ICHAIN_H_ -typedef struct -{ +typedef struct { u32 cont: 1; u32 type: 4; u32 offset: 11; @@ -11,8 +10,7 @@ typedef struct #define OFFSETOF(structure, member) ((size_t)&(((structure*)0)->member)) -typedef enum -{ +typedef enum { /* 0x0 */ ICHAINTYPE_U8, // sets byte /* 0x1 */ ICHAINTYPE_S8, /* 0x2 */ ICHAINTYPE_U16, // sets short diff --git a/include/macros.h b/include/macros.h index ef435aca5..ecd8c5acf 100644 --- a/include/macros.h +++ b/include/macros.h @@ -13,6 +13,7 @@ #define SQ(x) ((x)*(x)) #define ABS(x) ((x) >= 0 ? (x) : -(x)) #define DECR(x) ((x) == 0 ? 0 : ((x) -= 1)) +#define CLAMP(x,min,max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x)) #define PLAYER ((Player*)globalCtx->actorCtx.actorList[ACTORTYPE_PLAYER].first) @@ -34,4 +35,17 @@ #define CAPACITY(upg, value) gUpgradeCapacities[upg][value] #define CUR_CAPACITY(upg) CAPACITY(upg, CUR_UPG_VALUE(upg)) +#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \ + (curState)->init = newInit; \ + (curState)->size = sizeof(newStruct); + +#define LOG(exp, value, format, file, line) \ + LogUtils_LogThreadId(file, line); \ + osSyncPrintf(exp " = " format "\n", value); + +#define LOG_ADDRESS(exp, value, file, line) LOG(exp, value, "%08x", file, line) +#define LOG_STRING(string, file, line) LOG(#string, string, "%s", file, line) +#define LOG_TIME(exp, value, file, line) LOG(exp, value, "%lld", file, line) +#define LOG_NUM(exp, value, file, line) LOG(exp, value, "%d", file, line) + #endif diff --git a/include/math.h b/include/math.h index a2648c335..1fbbe0ca7 100644 --- a/include/math.h +++ b/include/math.h @@ -2,6 +2,7 @@ #define _MATH_H_ #define M_PI 3.14159265358979323846f +#define M_SQRT2 1.41421356237309504880f #define FLT_MAX 340282346638528859811704183484516925440.0f float sinf(float); diff --git a/include/padmgr.h b/include/padmgr.h index ca5c7e42d..dda4b210f 100644 --- a/include/padmgr.h +++ b/include/padmgr.h @@ -6,8 +6,7 @@ #include <ultra64/controller.h> -typedef struct -{ +typedef struct { /* 0x0000 */ OSContStatus pad_status[4]; /* 0x0010 */ OSMesg msgbuf1[1]; /* 0x0014 */ OSMesg msgbuf2[1]; @@ -24,10 +23,10 @@ typedef struct /* 0x02A8 */ u8 unk_2A8; /* 0x02A9 */ u8 unk_2A9; /* 0x02AA */ u8 unk_2AA[4]; - /* 0x02AA */ u8 unk_2AE[4]; //Looks like 1 if vibration pack, 2 if (maybe controller pack)? + /* 0x02AA */ u8 unk_2AE[4]; // Looks like 1 if vibration pack, 2 if (maybe controller pack)? /* 0x02B2 */ u8 unk_2B2[4]; /* 0x02B6 */ u8 unk_2B6[4]; - /* 0x02BA */ char unk_2BA[0x02]; //probably padding + /* 0x02BA */ char unk_2BA[0x02]; // probably padding /* 0x02BC */ unk_controller_t unk_controller[4]; /* 0x045C */ u8 unk_45C; /* 0x045D */ u8 unk_45D; @@ -37,5 +36,5 @@ typedef struct /* 0x0464 */ s32 unk_464; } PadMgr; // size = 0x468 - -#endif //_PADMGR_H_ + +#endif diff --git a/include/regs.h b/include/regs.h index 4c3ad34cb..b76587458 100644 --- a/include/regs.h +++ b/include/regs.h @@ -1,7 +1,12 @@ #ifndef _REGS_H_ #define _REGS_H_ -#define BASE_REG(n, r) gGameInfo->data[n * 96 + r] +#define REG_GROUPS 29 // number of REG groups, i.e. REG, SREG, OREG, etc. +#define REG_PAGES 6 +#define REG_PER_PAGE 16 +#define REG_PER_GROUP REG_PAGES * REG_PER_PAGE + +#define BASE_REG(n, r) gGameInfo->data[n * REG_PER_GROUP + r] #define REG(r) BASE_REG(0, r) #define SREG(r) BASE_REG(1, r) diff --git a/include/sched.h b/include/sched.h index 423724d96..2873a310d 100644 --- a/include/sched.h +++ b/include/sched.h @@ -3,25 +3,22 @@ #include <global.h> -typedef struct OSScTask -{ - /* 0x00 */ struct OSScTask* next; - /* 0x04 */ u32 state; - /* 0x08 */ u32 flags; - /* 0x0C */ void* framebuffer; - /* 0x10 */ OSTask list; - /* 0x58 */ OSMesgQueue* msgQ; - /* 0x5C */ OSMesg msg; -} OSScTask; +#define OS_SC_NEEDS_RDP 0x0001 +#define OS_SC_NEEDS_RSP 0x0002 +#define OS_SC_DRAM_DLIST 0x0004 +#define OS_SC_PARALLEL_TASK 0x0010 +#define OS_SC_LAST_TASK 0x0020 +#define OS_SC_SWAPBUFFER 0x0040 -typedef struct -{ +#define OS_SC_RCP_MASK 0x0003 +#define OS_SC_TYPE_MASK 0x0007 + +typedef struct { /* 0x00 */ char unk_00[0x12]; /* 0x12 */ s8 unk_12; } struct_800C8BC4; -typedef struct -{ +typedef struct { /* 0x0000 */ OSMesgQueue interruptQ; /* 0x0018 */ OSMesg intBuf[8]; /* 0x0038 */ OSMesgQueue cmdQ; @@ -39,4 +36,6 @@ typedef struct /* 0x0220 */ char unk_254[0x04]; } SchedContext; // size = 0x258 +extern SchedContext gSchedContext; + #endif diff --git a/include/segment_symbols.h b/include/segment_symbols.h index 0be701c23..aed6d2f66 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -3,20 +3,20 @@ #include <z64.h> -#define DECLARE_SEGMENT(name) \ +#define DECLARE_SEGMENT(name) \ extern u8 _##name##SegmentStart[]; \ extern u8 _##name##SegmentEnd[]; -#define DECLARE_ROM_SEGMENT(name) \ +#define DECLARE_ROM_SEGMENT(name) \ extern u8 _##name##SegmentRomStart[]; \ extern u8 _##name##SegmentRomEnd[]; -#define DECLARE_BSS_SEGMENT(name) \ +#define DECLARE_BSS_SEGMENT(name) \ extern u8 _##name##SegmentBssStart[]; \ extern u8 _##name##SegmentBssEnd[]; #define DECLARE_OVERLAY_SEGMENT(name) \ - DECLARE_SEGMENT(ovl_##name) \ + DECLARE_SEGMENT(ovl_##name) \ DECLARE_ROM_SEGMENT(ovl_##name) DECLARE_SEGMENT(boot) @@ -921,6 +921,7 @@ DECLARE_ROM_SEGMENT(g_pn_55) DECLARE_ROM_SEGMENT(g_pn_56) DECLARE_ROM_SEGMENT(g_pn_57) +DECLARE_ROM_SEGMENT(nintendo_rogo_static) DECLARE_ROM_SEGMENT(title_static) DECLARE_ROM_SEGMENT(parameter_static) DECLARE_ROM_SEGMENT(vr_cloud2_static) @@ -1090,5 +1091,4 @@ DECLARE_ROM_SEGMENT(testroom_room_2) DECLARE_ROM_SEGMENT(testroom_room_3) DECLARE_ROM_SEGMENT(testroom_room_4) - #endif diff --git a/include/stdbool.h b/include/stdbool.h index 87f54e45b..519806b31 100644 --- a/include/stdbool.h +++ b/include/stdbool.h @@ -1,13 +1,13 @@ #ifndef _STDBOOL #define _STDBOOL -#define __bool_true_false_are_defined 1 +#define __bool_true_false_are_defined 1 #ifndef __cplusplus -#define bool u32 -#define false 0 -#define true 1 +#define bool u32 +#define false 0 +#define true 1 #endif /* __cplusplus */ diff --git a/include/stddef.h b/include/stddef.h index 8b4655774..16bd97a1d 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -1,7 +1,7 @@ #ifndef _STDDEF_H_ #define _STDDEF_H_ -#define NULL ((void *)0) +#define NULL ((void*)0) typedef unsigned long size_t; diff --git a/include/stdlib.h b/include/stdlib.h index 1c7666df8..81dc32757 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,14 +1,12 @@ #ifndef _STDLIB_H_ #define _STDLIB_H_ -typedef struct lldiv_t -{ +typedef struct lldiv_t { long long quot; long long rem; } lldiv_t; -typedef struct ldiv_t -{ +typedef struct ldiv_t { long quot; long rem; } ldiv_t; diff --git a/include/string.h b/include/string.h index 35b1ffa06..29ce60a57 100644 --- a/include/string.h +++ b/include/string.h @@ -1,8 +1,10 @@ #ifndef _STRING_H_ #define _STRING_H_ + #include <ultra64/types.h> + void* memcpy(void*, const void*, size_t); -size_t strlen(const u8 *str); -const u8 *strchr(const u8 *str, s32 ch); +size_t strlen(const u8* str); +const u8* strchr(const u8* str, s32 ch); #endif diff --git a/include/ultra64/gbi.h b/include/ultra64/gbi.h index 9bbb9c63c..f3f797e81 100644 --- a/include/ultra64/gbi.h +++ b/include/ultra64/gbi.h @@ -4201,7 +4201,7 @@ _DW({ \ #define gDPSetScissorFrac(pkt, mode, ulx, uly, lrx, lry) \ -{ \ +_DW({ \ Gfx *_g = (Gfx *)pkt; \ \ _g->words.w0 = _SHIFTL(G_SETSCISSOR, 24, 8) | \ @@ -4210,7 +4210,7 @@ _DW({ \ _g->words.w1 = _SHIFTL(mode, 24, 2) | \ _SHIFTL((int)((lrx)), 12, 12) | \ _SHIFTL((int)((lry)), 0, 12); \ -} +}) #define gsDPSetScissor(mode, ulx, uly, lrx, lry) \ { \ @@ -4482,6 +4482,16 @@ _DW({ \ #define gDPNoOpTag(pkt, tag) gDPParam(pkt, G_NOOP, tag) #define gsDPNoOpTag(tag) gsDPParam(G_NOOP, tag) +#define gDPNoOpHere(pkt, file, line) gDma1p(pkt, G_NOOP, file, line, 1) +#define gDPNoOpString(pkt, data, n) gDma1p(pkt, G_NOOP, data, n, 2) +#define gDPNoOpWord(pkt, data, n) gDma1p(pkt, G_NOOP, data, n, 3) +#define gDPNoOpFloat(pkt, data, n) gDma1p(pkt, G_NOOP, data, n, 4) +#define gDPNoOpQuiet(pkt) gDma1p(pkt, G_NOOP, 0, 0, 5) +#define gDPNoOpVerbose(pkt, n) gDma1p(pkt, G_NOOP, 0, n, 5) +#define gDPNoOpCallBack(pkt, callback) gDma1p(pkt, G_NOOP, callback, 0, 6) +#define gDPNoOpOpenDisp(pkt, file, line) gDma1p(pkt, G_NOOP, file, line, 7) +#define gDPNoOpCloseDisp(pkt, file, line) gDma1p(pkt, G_NOOP, file, line, 8) + #endif /* Private macro to wrap other macros in do {...} while (0) */ diff --git a/include/ultra64/mbi.h b/include/ultra64/mbi.h index 17213ea2b..00b113595 100644 --- a/include/ultra64/mbi.h +++ b/include/ultra64/mbi.h @@ -76,9 +76,11 @@ * **************************************************************************/ -#define M_GFXTASK 1 -#define M_AUDTASK 2 -#define M_VIDTASK 3 +#define M_NULTASK 0 +#define M_GFXTASK 1 +#define M_AUDTASK 2 +#define M_VIDTASK 3 +#define M_NJPEGTASK 4 #define M_HVQTASK 6 #define M_HVQMTASK 7 diff --git a/include/ultra64/types.h b/include/ultra64/types.h index 2f44e369f..c793f8010 100644 --- a/include/ultra64/types.h +++ b/include/ultra64/types.h @@ -24,15 +24,13 @@ typedef double f64; typedef long int Mtx_t[4][4]; -typedef union -{ +typedef union { Mtx_t m; long long int forc_structure_alignment; } Mtx; typedef float MtxF_t[4][4]; -typedef union -{ +typedef union { MtxF_t mf; struct { diff --git a/include/variables.h b/include/variables.h index a6d67c869..4b7c8d30a 100644 --- a/include/variables.h +++ b/include/variables.h @@ -54,7 +54,7 @@ extern u32 D_0403F070; extern u32 D_04042440; //extern ? D_04048160; extern u32 D_04048180; -extern u32 D_04049210; +extern Gfx D_04049210[]; extern u32 D_04049AD0; //extern ? D_0404D1C0; extern u32 D_0404D450; @@ -137,6 +137,7 @@ extern u32 __osTimerCounter; extern OSPiHandle __CartRomHandle; extern DmaEntry gDmaDataTable[0x60C]; //extern ? D_800D7288; +extern u8 D_801120C0[]; //extern ? D_80115440; //extern ? D_80115760; //extern ? D_80115770; @@ -185,7 +186,8 @@ extern EffectTableInfo EffectSS2Info; // 801158B0 //extern ? D_80115F68; //extern ? D_80115F6C; //extern ? D_80115F70; -extern ActorOverlay gActorOverlayTable[471]; // original name: "actor_dlftbls" +extern Gfx D_80116280[]; +extern ActorOverlay gActorOverlayTable[471]; // original name: "actor_dlftbls" 801162A0 extern s32 gMaxProfile; //extern ? D_80119E2C; //extern ? D_80119E52; @@ -259,17 +261,10 @@ extern s32 D_8011D3AC; //extern ? D_8011E096; //extern ? D_8011E098; //extern ? D_8011E09A; -//extern ? D_8011E0B0; -//extern ? D_8011E0B4; +extern s16 D_8011E0B0; +extern Color_RGBA8 D_8011E0B4[]; //extern ? D_8011E0D4; -//extern ? D_8011F3A0; -//extern ? D_8011F3D4; -//extern ? D_8011F830; -//extern ? D_8011F860; -//extern ? D_8011F890; -//extern ? D_8011F8C0; -//extern ? D_8011F8F0; -//extern ? D_8011F920; +extern GameStateOverlay gGameStateOverlayTable[6]; //extern ? D_8011FA60; //extern ? D_8011FA64; //extern ? D_8011FA68; @@ -480,54 +475,7 @@ extern s16 gSpoilingItemReverts[3]; //extern ? D_80126240; //extern ? D_80126250; //extern ? D_80126254; -//extern ? D_80126280; -//extern ? D_801262E0; -//extern ? D_80126340; -//extern ? D_80126640; -//extern ? D_80126730; -//extern ? D_80126760; -//extern ? D_80126790; -//extern ? D_801267C0; -//extern ? D_80126850; -//extern ? D_80126880; -//extern ? D_801268B0; -//extern ? D_801268E0; -//extern ? D_80126910; -//extern ? D_80126940; -//extern ? D_80126970; -//extern ? D_801269A0; -//extern ? D_801269D0; -//extern ? D_80126A00; -//extern ? D_80126A30; -//extern ? D_80126A60; -//extern ? D_80126A90; -//extern ? D_80126AC0; -//extern ? D_80126AF0; -//extern ? D_80126B20; -//extern ? D_80126B50; -//extern ? D_80126B80; -//extern ? D_80126BB0; -//extern ? D_80126BE0; -//extern ? D_80126C10; -//extern ? D_80126C40; -//extern ? D_80126C70; -//extern ? D_80126CA0; -//extern ? D_80126CD0; -//extern ? D_80126D00; -//extern ? D_80126D30; -//extern ? D_80126D60; -//extern ? D_80126D90; -//extern ? D_80126DC0; -//extern ? D_80126DF0; -//extern ? D_80126E80; -//extern ? D_80126EB0; -//extern ? D_80126EE0; -//extern ? D_80126F10; -//extern ? D_80126F40; -//extern ? D_80126F70; -//extern ? D_80126FA0; -//extern ? D_80126FD0; -extern Gfx D_80127098[]; +extern Gfx gEmptyDL[]; extern u32 gBitFlags[32]; extern u16 gEquipMasks[4]; extern u16 gEquipNegMasks[4]; @@ -544,8 +492,6 @@ extern u32 gObjectTableSize; extern RomFile gObjectTable[402]; extern EntranceInfo gEntranceTable[1556]; extern Scene gSceneTable[110]; -//extern ? D_8012A480; -//extern ? D_8012A484; //extern ? D_8012A4A0; //extern ? D_8012A4E0; //extern ? D_8012A4EC; @@ -565,10 +511,6 @@ extern Scene gSceneTable[110]; extern u8 gLetterTLUT[4][32]; // original name: "moji_tlut" extern u8 gFontFF[]; // original name: "font_ff" //extern ? D_8012ABF0; -//extern ? D_8012AC00; -//extern ? D_8012AC28; -//extern ? D_8012AC40; -//extern ? D_8012AC58; //extern ? D_8012AC90; //extern ? D_8012ACA0; //extern ? D_8012AD20; @@ -692,14 +634,12 @@ extern void* D_8012D1F0; extern u32 gScreenWidth; extern u32 gScreenHeight; extern u32 gSystemHeapSize; -extern s32 D_8012D280; -extern u32 D_8012D284; extern volatile u32 D_8012D290; //extern ? D_8012D2A0; extern Mtx gMtxClear; extern MtxF gMtxFClear; //extern ? D_8012DBB0; -//extern ? D_8012DBC0; +extern u32 D_8012DBC0; extern volatile u32 gIrqMgrResetStatus; extern u32 D_8012DBA0; extern u32 D_8012DBA4; @@ -1357,11 +1297,6 @@ extern f32 D_80136D44; //extern ? D_8013AC7C; //extern ? D_8013ACA0; //extern ? D_8013ACB8; -//extern ? D_8013AD40; -//extern ? D_8013AD50; -//extern ? D_8013AD54; -//extern ? D_8013AD60; -//extern ? D_8013AD70; //extern ? D_8013B830; //extern ? D_8013B844; //extern ? D_8013B858; @@ -2661,77 +2596,6 @@ extern char D_80141030[]; //extern ? D_8014575C; //extern ? D_80145780; //extern ? D_80145794; -extern char D_801457B0[]; -extern char D_801457F0[]; -extern char D_8014582C[]; -extern char D_80145860[]; -extern char D_80145894[]; -extern char D_8014589C[]; -extern char D_801458B0[]; -extern char D_801458CC[]; -extern char D_801458D0[]; -extern char D_801458D8[]; -extern char D_801458EC[]; -extern char D_80145914[]; -extern char D_80145918[]; -extern char D_80145920[]; -extern char D_80145934[]; -extern char D_80145944[]; -extern char D_80145948[]; -extern char D_80145950[]; -extern char D_80145964[]; -extern char D_8014598C[]; -extern char D_80145990[]; -extern char D_80145998[]; -extern char D_801459AC[]; -extern char D_801459CC[]; -extern char D_801459D0[]; -extern char D_801459D8[]; -extern char D_801459EC[]; -extern char D_80145A24[]; -extern char D_80145A28[]; -extern char D_80145A30[]; -extern char D_80145A44[]; -extern char D_80145A60[]; -extern char D_80145A64[]; -extern char D_80145A70[]; -extern char D_80145A80[]; -extern char D_80145A88[]; -extern char D_80145A9C[]; -extern char D_80145ABC[]; -extern char D_80145AC0[]; -extern char D_80145AC8[]; -extern char D_80145ADC[]; -extern char D_80145AEC[]; -//extern ? D_80145AF0; -//extern ? D_80145AF8; -//extern ? D_80145B0C; -//extern ? D_80145B1C; -//extern ? D_80145B20; -//extern ? D_80145B2C; -//extern ? D_80145B48; -//extern ? D_80145B50; -//extern ? D_80145B64; -//extern ? D_80145B80; -//extern ? D_80145B84; -//extern ? D_80145B8C; -//extern ? D_80145BA0; -//extern ? D_80145BB0; -//extern ? D_80145BB4; -//extern ? D_80145BC0; -//extern ? D_80145BD8; -//extern ? D_80145BE4; -//extern ? D_80145BF0; -//extern ? D_80145C10; -extern char D_80145C40[]; -extern char D_80145C58[]; -extern char D_80145C78[]; -extern char D_80145CA0[]; -extern char D_80145CA4[]; -extern char D_80145CB0[]; -extern char D_80145CD4[]; -extern char D_80145CF8[]; -extern char D_80145D18[]; //extern ? D_80145D40; //extern ? D_80145D54; //extern ? D_80145D60; @@ -3223,7 +3087,6 @@ extern char D_80146238[]; //extern ? D_8014AA38; //extern ? D_8014AA5C; //extern ? D_8014AA80; -//extern ? D_8014AAC0; //extern ? D_8014B210; //extern ? D_8014B280; //extern ? D_8014B2E0; @@ -3435,7 +3298,7 @@ extern char D_80146238[]; //extern ? D_80155500; //extern ? D_80155BF0; //extern ? D_80155C70; -//extern ? D_80155F50; +extern u8 D_80155F50[]; extern GlobalContext* D_80157DA0; //extern ? D_80157DA4; //extern ? D_80157DA8; @@ -3551,7 +3414,7 @@ extern GlobalContext* D_80157DA0; extern SaveContext gSaveContext; // 0x8015E660 extern u32 D_8015FA88; extern u32 D_8015FA8C; -extern GameInfo* gGameInfo; +extern GameInfo* gGameInfo; // 0x8015FA90 //extern ? D_8015FA98; //extern ? D_8015FA9B; //extern ? D_8015FC18; @@ -3589,7 +3452,6 @@ extern u8 D_8015FD70; //extern ? D_80160014; //extern ? D_80160018; //extern ? D_80160020; -//extern ? D_801600B0; //extern ? D_801600C0; extern u8 D_80161010; extern u8 D_801610D4; @@ -3630,7 +3492,7 @@ extern u8 D_801610DA; //extern ? D_80161360; //extern ? D_801613B0; //extern ? D_8016148C; -//extern ? D_80161490; +extern s32 D_80161490; //extern ? D_80161498; extern Color_RGBA8 D_801614B0; //extern ? D_801614B3; @@ -3651,13 +3513,12 @@ extern Color_RGBA8 D_801614B0; //extern ? D_801665E0; //extern ? D_801665F0; //extern ? D_80166648; -extern u8* gAppNmiBufferPtr; +extern PreNmiBuff* gAppNmiBufferPtr; //extern ? gSchedContext; //extern u8 gPadMgr[]; extern u8 D_80166B68; //extern ? D_80166D28; extern u32 gSegments[]; -extern u32 D_8016A4F0; //extern ? D_8016A500; //extern ? D_8016A504; //extern ? D_8016A508; @@ -3666,22 +3527,19 @@ extern u32 D_8016A4F0; //extern ? D_8016A514; //extern ? D_8016A518; //extern ? D_8016A51C; -//extern ? D_8016A520; -//extern ? D_8016A528; -//extern ? D_8016A530; -//extern ? D_8016A538; -//extern ? D_8016A540; -//extern ? D_8016A548; -//extern ? D_8016A550; -//extern ? D_8016A558; -//extern ? D_8016A55C; -//extern ? D_8016A560; -//extern ? D_8016A564; -//extern ? D_8016A568; -//extern ? D_8016A56C; +extern volatile OSTime D_8016A520; +extern volatile OSTime D_8016A528; +extern volatile OSTime D_8016A530; +extern volatile OSTime D_8016A538; +extern volatile OSTime D_8016A540; +extern volatile OSTime D_8016A548; +extern volatile OSTime D_8016A550; +extern volatile OSTime D_8016A558; +extern volatile OSTime D_8016A560; +extern volatile OSTime D_8016A568; //extern ? D_8016A570; //extern ? D_8016A574; -//extern ? D_8016A580; +extern volatile OSTime D_8016A580; //extern ? D_8016A588; //extern ? D_8016A590; //extern ? D_8016A594; @@ -3931,7 +3789,6 @@ extern u32 D_8016B5F5; //extern ? D_80174DBC; //extern ? D_80174DC0; //extern ? D_801755D0; -//extern ? D_80175600; extern u32 __osMalloc_FreeBlockTest_Enable; //extern ? D_80175640; //extern ? D_80175660; diff --git a/include/vt.h b/include/vt.h index c2d60246d..46cbf05e7 100644 --- a/include/vt.h +++ b/include/vt.h @@ -21,11 +21,11 @@ #define VT_ESC "\x1b" #define VT_CSI "[" -#define VT_CUP(x, y) VT_ESC VT_CSI #y ";" #x "H" +#define VT_CUP(x, y) VT_ESC VT_CSI y ";" x "H" #define VT_ED(n) VT_ESC VT_CSI #n "J" #define VT_SGR(n) VT_ESC VT_CSI n "m" -//Add more macros if necessary +// Add more macros if necessary #define VT_COL(back, fore) VT_SGR(VT_COLOR(BACKGROUND, back) ";" VT_COLOR(FOREGROUND, fore)) #define VT_FGCOL(color) VT_SGR(VT_COLOR(FOREGROUND, color)) #define VT_BGCOL(color) VT_SGR(VT_COLOR(BACKGROUND, color)) diff --git a/include/z64.h b/include/z64.h index 46215b89e..bb5569ffc 100644 --- a/include/z64.h +++ b/include/z64.h @@ -11,6 +11,9 @@ #include <z64scene.h> #include <z64effect.h> #include <z64item.h> +#include <z64animation.h> +#include <z64dma.h> +#include <z64vec.h> #include <bgm.h> #include <sfx.h> #include <color.h> @@ -31,21 +34,22 @@ // Game Info aka. Static Context (dbg ram start: 80210A10) // Data normally accessed through REG macros (see regs.h) -typedef struct -{ - /* 0x00 */ char unk_00[0x14]; - /* 0x14 */ s16 data[0xAE0]; +typedef struct { + /* 0x00 */ s32 regPage; // 1 is first page + /* 0x04 */ s32 regGroup; // "register" group (R, RS, RO, RP etc.) + /* 0x08 */ s32 regCur; // selected register within page + /* 0x0C */ s32 dpadLast; + /* 0x10 */ s32 repeat; + /* 0x14 */ s16 data[REG_GROUPS * REG_PER_GROUP]; // 0xAE0 bytes } GameInfo; // size = 0x15D4 -typedef struct -{ +typedef struct { /* 0x00 */ u8 button_items[4]; /* 0x04 */ u8 c_button_slots[3]; /* 0x08 */ u16 equipment; } ItemEquips; // size = 0x0A -typedef struct -{ +typedef struct { /* 0x00 */ u32 chest; /* 0x04 */ u32 swch; /* 0x08 */ u32 clear; @@ -55,15 +59,13 @@ typedef struct /* 0x18 */ u32 rooms_2; } SaveSceneFlags; // size = 0x1C -typedef struct -{ +typedef struct { /* 0x00 */ s16 scene; /* 0x02 */ Vec3s pos; /* 0x08 */ s16 angle; } HorseData; // size = 0x0A -typedef struct -{ +typedef struct { /* 0x00 */ Vec3f pos; /* 0x0C */ s16 yaw; /* 0x0E */ s16 player_params; @@ -74,22 +76,19 @@ typedef struct /* 0x18 */ u32 temp_collect_flags; } RespawnData; // size = 0x1C -typedef enum -{ +typedef enum { /* 0x00 */ RESPAWN_MODE_DOWN, /* Normal Void Outs */ /* 0x01 */ RESPAWN_MODE_RETURN, /* Grotto Returnpoints */ /* 0x02 */ RESPAWN_MODE_TOP /* Farore's Wind */ } RespawnMode; -typedef enum -{ +typedef enum { /* 0x00 */ BTN_ENABLED, /* 0xFF */ BTN_DISABLED = 0xFF } ButtonStatus; // Save Context (dbg ram start: 8015E660) -typedef struct -{ +typedef struct { /* 0x0000 */ s32 entrance_index; /* 0x0004 */ s32 link_age; // 0: Adult; 1: Child /* 0x0008 */ s32 cutscene_index; @@ -129,8 +128,7 @@ typedef struct /* 0x00CF */ s8 defense_hearts; /* 0x00D0 */ s16 gs_tokens; /* 0x00D4 */ SaveSceneFlags scene_flags[124]; - struct - { + struct { /* 0x0E64 */ s32 pos_x; /* 0x0E68 */ s32 pos_y; /* 0x0E6C */ s32 pos_z; @@ -159,7 +157,9 @@ typedef struct /* 0x1360 */ s32 scene_setup_index; /* 0x1364 */ s32 respawn_flag; // "restart_flag" /* 0x1368 */ RespawnData respawn[3]; // "restart_data" - /* 0x13BC */ char unk_13BC[0x000B]; + /* 0x13BC */ char unk_13BC[0x0008]; + /* 0x13C4 */ s16 dogParams; + /* 0x13C6 */ char unk_13C6[0x0001]; /* 0x13C7 */ u8 unk_13C7; /* 0x13C8 */ u16 nayrus_love_timer; /* 0x13CA */ char unk_13CA[0x0002]; @@ -203,7 +203,7 @@ typedef struct /* 0x1418 */ u8 fade_duration; /* 0x1419 */ u8 unk_1419; // transition related /* 0x141A */ u16 environment_time; - /* 0x141C */ u8 unk_141C; + /* 0x141C */ u8 dogIsLost; /* 0x141D */ u8 transition_type; /* 0x141E */ char unk_141E[0x0002]; /* 0x1420 */ s16 world_map_area; @@ -211,8 +211,7 @@ typedef struct /* 0x1424 */ s16 health_accumulator; } SaveContext; // size = 0x1428 -typedef struct -{ +typedef struct { /* 0x00000 */ u16 headMagic; // 1234 /* 0x00008 */ Gfx polyOpaBuffer[0x17E0]; /* 0x0BF08 */ Gfx polyXluBuffer[0x800]; @@ -222,38 +221,66 @@ typedef struct /* 0x12408 */ u16 tailMagic; // 5678 } GfxPool; // size = 0x12410 -typedef struct -{ +typedef struct { /* 0x0000 */ u32 size; /* 0x0004 */ u8* bufp; /* 0x0008 */ u8* head; /* 0x000C */ u8* tail; } TwoHeadArena; // size = 0x10 -typedef struct -{ +typedef struct { /* 0x0000 */ u32 size; /* 0x0004 */ Gfx* bufp; /* 0x0008 */ Gfx* p; /* 0x000C */ Gfx* d; } TwoHeadGfxArena; // size = 0x10 -typedef struct -{ - /* 0x0000 */ char unk_00[0x01B4]; +typedef struct OSScTask { + /* 0x00 */ struct OSScTask* next; + /* 0x04 */ u32 state; + /* 0x08 */ u32 flags; + /* 0x0C */ void* framebuffer; + /* 0x10 */ OSTask list; + /* 0x50 */ OSMesgQueue* msgQ; + /* 0x54 */ OSMesg msg; +} OSScTask; + +typedef struct GraphicsContext { + /* 0x0000 */ Gfx* polyOpaBuffer; + /* 0x0004 */ Gfx* polyXluBuffer; + /* 0x0008 */ char unk_008[0x08]; + /* 0x0010 */ Gfx* overlayBuffer; + /* 0x0014 */ u32 unk_014; + /* 0x0018 */ char unk_018[0x20]; + /* 0x0038 */ OSMesg msgBuff[0x08]; + /* 0x0058 */ OSMesgQueue* schedMsgQ; + /* 0x005C */ OSMesgQueue queue; + /* 0x0074 */ char unk_074[0x04]; + /* 0x0078 */ OSScTask task; // size of OSScTask might be wrong + /* 0x00D0 */ char unk_0D0[0xE0]; + /* 0x01B0 */ Gfx* workBuffer; /* 0x01B4 */ TwoHeadGfxArena work; - /* 0x01C4 */ char unk_1C4[0x00E4]; + /* 0x01C4 */ char unk_01C4[0xC0]; + /* 0x0284 */ OSViMode* viMode; + /* 0x0288 */ char unk_0288[0x20]; /* 0x02A8 */ TwoHeadGfxArena overlay; /* 0x02B8 */ TwoHeadGfxArena polyOpa; /* 0x02C8 */ TwoHeadGfxArena polyXlu; -} GraphicsContext; + /* 0x02D8 */ u32 gfxPoolIdx; + /* 0x02DC */ u16* curFrameBuffer; + /* 0x02E0 */ char unk_2E0[0x04]; + /* 0x02E4 */ u32 viFeatures; + /* 0x02E8 */ s32 fbIdx; + /* 0x02EC */ void (*callback)(struct GraphicsContext*, u32); + /* 0x02F0 */ u32 callbackParam; + /* 0x02F4 */ f32 xScale; + /* 0x02F8 */ f32 yScale; + /* 0x02FC */ char unk_2FC[0x04]; +} GraphicsContext; // size = 0x300 -typedef struct -{ - /* 0x00 */ union - { - struct - { +typedef struct { + /* 0x00 */ union { + struct { u16 a : 1; u16 b : 1; u16 z : 1; @@ -276,8 +303,7 @@ typedef struct /* 0x03 */ s8 y; } RawInput; // size = 0x4 -typedef struct -{ +typedef struct { /* 0x00 */ RawInput raw; /* 0x04 */ u16 status; /* 0x06 */ RawInput rawPrev; @@ -292,22 +318,59 @@ typedef struct /* 0x16 */ char unk_16[0x02]; } Input; // size = 0x18 -typedef struct -{ - /* 0x0000 */ char unk_00[0x28]; +typedef struct { + /* 0x0000 */ s16 unk_0; + /* 0x0002 */ s16 unk_2; + /* 0x0004 */ u16 unk_4; + /* 0x0004 */ u16 unk_6; + /* 0x0008 */ s16 unk_8; + /* 0x000A */ s16 unk_A; + /* 0x000C */ u16 unk_C; + /* 0x000E */ u16 unk_E; +} UnkViewStruct; // size = 0x10, probably a viewport in disguise + +typedef struct { + /* 0x0000 */ s32 topY; // uly (upper left y) + /* 0x0004 */ s32 bottomY; // lry (lower right y) + /* 0x0008 */ s32 leftX; // ulx (upper left x) + /* 0x000C */ s32 rightX; // lrx (lower right x) +} Viewport; // size = 0x10 + +typedef struct { + /* 0x0000 */ s32 magic; // string literal "VIEW" / 0x56494557 + /* 0x0004 */ GraphicsContext* gfxCtx; + /* 0x0008 */ Viewport viewport; + /* 0x0018 */ f32 fieldOfView; // fovy + /* 0x001C */ f32 fogDistance; // near + /* 0x0020 */ f32 zDepth; // far + /* 0x0024 */ f32 unk_24; // scale /* 0x0028 */ Vec3f eye; - /* 0x0034 */ char unk_34[0xF4]; + /* 0x0034 */ Vec3f unk_34; + /* 0x0040 */ Vec3f unk_40; + /* 0x004C */ char unk_4C[0x04]; + /* 0x0050 */ Viewport unk_50; + /* 0x0060 */ Mtx unk_60; + /* 0x00A0 */ MtxF unk_A0; + /* 0x00E0 */ Mtx* unk_E0; + /* 0x00E4 */ MtxF* unk_E4; + /* 0x00E8 */ Vec3f unk_E8; + /* 0x00F4 */ Vec3f unk_F4; + /* 0x0100 */ f32 unk_100; + /* 0x0104 */ Vec3f unk_104; + /* 0x0110 */ Vec3f unk_110; + /* 0x011C */ u16 unk_11C; // normal + /* 0x011E */ u16 unk_11E; + /* 0x0120 */ s32 unk_120; + /* 0x0124 */ s32 unk_124; } View; // size = 0x128 -typedef struct -{ +typedef struct { f32 unk_00; s16 unk_04; s16 unk_06; } struct_80045714; // used in z_camera.c and code_8007BF90 -typedef struct -{ +typedef struct { /* 0x0000 */ s32 unk_00; /* 0x0004 */ s16 unk_04; /* 0x0006 */ s16 unk_06; @@ -364,49 +427,42 @@ typedef struct /* 0x016A */ s16 unk_16A; // unknown if used } Camera; // size = 0x16C -typedef struct -{ +typedef struct { /* 0x0000 */ Camera activeCameras[4]; /* 0x05B0 */ Camera* activeCameraPtrs[4]; /* 0x05C0 */ s16 unk_5C0; /* 0x05C2 */ s16 unk_5C2; } CameraContext; // size = 0x5C4 -typedef struct -{ +typedef struct { /* 0x00 */ u8 musicSeq; /* 0x01 */ u8 nighttimeSFX; /* 0x02 */ char unk_02[0x2]; } SoundContext; // size = 0x4 -typedef struct -{ +typedef struct { /* 0x00 */ char unk_00[0x50]; } StaticCollisionContext; // size = 0x50 -typedef struct -{ +typedef struct { /* 0x0000 */ char unk_00[0x04]; /* 0x0004 */ ActorMesh actorMeshArr[50]; /* 0x138C */ u16 flags[50]; /* 0x13F0 */ char unk_13F0[0x24]; } DynaCollisionContext; // size = 0x1414 -typedef struct -{ +typedef struct { /* 0x0000 */ StaticCollisionContext stat; /* 0x0050 */ DynaCollisionContext dyna; } CollisionContext; // size = 0x1464 -typedef struct -{ +typedef struct { /* 0x00 */ Vec3f pos; /* 0x0C */ f32 unk_0C; // radius? /* 0x10 */ Color_RGB8 color; } TargetContextEntry; // size = 0x14 -typedef struct -{ +typedef struct { /* 0x00 */ Vec3f naviRefPos; // possibly wrong /* 0x0C */ Vec3f targetCenterPos; /* 0x18 */ Color_RGBAf naviInner; @@ -426,8 +482,7 @@ typedef struct /* 0x94 */ Actor* unk_94; } TargetContext; // size = 0x98 -typedef struct -{ +typedef struct { /* 0x00 */ u32 texture; /* 0x04 */ s16 unk_4; /* 0x06 */ s16 unk_6; @@ -439,14 +494,12 @@ typedef struct /* 0x0E */ s16 unk_E; } TitleCardContext; // size = 0x10 -typedef struct -{ +typedef struct { /* 0x00 */ u32 length; // number of actors loaded of this type /* 0x04 */ Actor* first; // pointer to first actor of this type } ActorListEntry; // size = 0x08 -typedef struct -{ +typedef struct { /* 0x0000 */ u8 unk_00; /* 0x0001 */ char unk_01[0x01]; /* 0x0002 */ u8 unk_02; @@ -456,8 +509,7 @@ typedef struct /* 0x0009 */ char unk_09[0x03]; /* 0x000C */ ActorListEntry actorList[12]; /* 0x006C */ TargetContext targetCtx; - struct - { + struct { /* 0x0104 */ u32 swch; /* 0x0108 */ u32 tempSwch; /* 0x010C */ u32 unk0; @@ -473,19 +525,16 @@ typedef struct /* 0x013C */ void* absoluteSpace; // Space used to allocate actor overlays of alloc type 1 } ActorContext; // size = 0x140 -typedef struct -{ +typedef struct { /* 0x00 */ char unk_00[0x4]; /* 0x04 */ void* segment; /* 0x08 */ u8 state; /* 0x0C */ f32 unk_0C; /* 0x10 */ u16 frames; /* 0x12 */ u16 unk_12; - union - { + union { /* 0x14 */ s32 unk_14_all; - struct - { + struct { s16 unk_14; s16 unk_16; }; @@ -499,8 +548,7 @@ typedef struct /* 0x28 */ CsCmdActorAction* actorActions[10]; } CutsceneContext; // size = 0x50 -typedef struct -{ +typedef struct { /* 0x0000 */ View view; /* 0x0128 */ char unk_128[0xE188]; /* 0xE2B0 */ void* textboxSegment; // "fukidashiSegment" @@ -526,20 +574,7 @@ typedef struct /* 0xE40E */ char unk_E40E[0x0A]; } MessageContext; // size = 0xE418 -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 unk_14; - /* 0x18 */ OSMesgQueue* notifyQueue; // Message queue for the notification message - /* 0x1C */ OSMesg notifyMsg; // Completion notification message -} DmaRequest; // size = 0x20 - -typedef struct -{ +typedef struct { /* 0x0000 */ View view; /* 0x0128 */ Vtx* vtx_128; /* 0x012C */ Vtx* vtx_12C; @@ -594,8 +629,7 @@ typedef struct /* 0x025E */ char unk_25E[0x002]; /* 0x0260 */ u8 unk_260; /* 0x0261 */ u8 unk_261; - struct - { + struct { /* 0x0262 */ u8 hGauge; // "h_gage"; unknown? /* 0x0263 */ u8 bButton; // "b_button" /* 0x0264 */ u8 aButton; // "a_button" @@ -611,8 +645,7 @@ typedef struct } restrictions; } InterfaceContext; // size = 0x270 -typedef struct -{ +typedef struct { /* 0x0000 */ View view; /* 0x0128 */ void* unk_128; /* 0x012C */ char unk_12C[0x03C]; @@ -637,8 +670,7 @@ typedef struct /* 0x025A */ char unk_25A[0x066]; } PauseContext; // size = 0x2C0 -typedef struct -{ +typedef struct { /* 0x00 */ s16 id; /* 0x04 */ void* segment; /* 0x08 */ DmaRequest dmaRequest; @@ -646,8 +678,7 @@ typedef struct /* 0x40 */ OSMesg loadMsg; } ObjectStatus; // size = 0x44 -typedef struct -{ +typedef struct { /* 0x0000 */ void* spaceStart; /* 0x0004 */ void* spaceEnd; // original name: "endSegment" /* 0x0008 */ u8 num; // number of objects in bank @@ -657,30 +688,26 @@ typedef struct /* 0x000C */ ObjectStatus status[OBJECT_EXCHANGE_BANK_MAX]; } ObjectContext; // size = 0x514 -typedef struct -{ +typedef struct { /* 0x00 */ Gfx* opa; /* 0x04 */ Gfx* xlu; } PolygonDlist; // size = 0x8 -typedef struct -{ +typedef struct { /* 0x00 */ u8 type; /* 0x01 */ u8 num; // number of dlist entries /* 0x04 */ void* start; /* 0x08 */ void* end; } Polygon; // size = 0xC -typedef struct -{ +typedef struct { /* 0x00 */ u8 type; /* 0x01 */ u8 num; // number of dlist entries /* 0x04 */ void* start; /* 0x08 */ void* end; } PolygonType0; // size = 0xC -typedef struct -{ +typedef struct { /* 0x00 */ u16 unk_00; /* 0x02 */ u8 id; /* 0x04 */ u32 source; @@ -694,15 +721,12 @@ typedef struct /* 0x18 */ u16 tlutCount; } BgImage; // size = 0x1C -typedef struct -{ +typedef struct { /* 0x00 */ u8 type; /* 0x01 */ u8 format; // 1 = single, 2 = multi /* 0x04 */ void* dlist; - union - { - struct - { + union { + struct { /* 0x08 */ u32 source; /* 0x0C */ u32 unk_0C; /* 0x10 */ u32 tlut; @@ -713,40 +737,35 @@ typedef struct /* 0x1A */ u16 mode0; /* 0x1C */ u16 tlutCount; } single; - struct - { + struct { /* 0x08 */ u8 count; /* 0x0C */ BgImage* list; } multi; }; } PolygonType1; -typedef struct -{ +typedef struct { /* 0x00 */ Vec3s pos; /* 0x06 */ s16 unk_06; /* 0x08 */ Gfx* opa; /* 0x0C */ Gfx* xlu; } PolygonDlist2; // size = 0x8 -typedef struct -{ +typedef struct { /* 0x00 */ u8 type; /* 0x01 */ u8 num; // number of dlist entries /* 0x04 */ void* start; /* 0x08 */ void* end; } PolygonType2; // size = 0xC -typedef union -{ +typedef union { Polygon polygon; PolygonType0 polygon0; PolygonType1 polygon1; PolygonType2 polygon2; } Mesh; // "Ground Shape" -typedef struct -{ +typedef struct { /* 0x00 */ s8 num; /* 0x01 */ u8 unk_01; /* 0x02 */ u8 unk_02; @@ -758,8 +777,7 @@ typedef struct /* 0x10 */ char unk_10[0x4]; } Room; // size = 0x14 -typedef struct -{ +typedef struct { /* 0x00 */ Room curRoom; /* 0x14 */ Room prevRoom; /* 0x28 */ void* bufPtrs[2]; @@ -771,21 +789,18 @@ typedef struct /* 0x70 */ OSMesg loadMsg; } RoomContext; // size = 0x74 -typedef struct -{ +typedef struct { /* 0x00 */ char unk_00[0x028C]; } SubGlobalContext11E60; // size = 0x28C -typedef struct -{ +typedef struct { /* 0x00 */ s16 id; /* 0x02 */ Vec3s pos; /* 0x08 */ Vec3s rot; /* 0x0E */ s16 params; } ActorEntry; // size = 0x10 -typedef struct -{ +typedef struct { /* 0x00 */ s8 frontRoom; // Room to switch to when triggered from the front of the object /* 0x01 */ s8 frontEffects; // How the camera reacts during the front transition /* 0x02 */ s8 backRoom; // Room to switch to when triggered from the back of the object @@ -796,34 +811,33 @@ typedef struct /* 0x0E */ s16 params; } TransitionActorEntry; // size = 0x10 -typedef struct -{ +typedef struct { /* 0x00 */ u8 spawn; /* 0x01 */ u8 room; } EntranceEntry; -typedef struct -{ +typedef struct { /* 0x00 */ u32 vromStart; /* 0x04 */ u32 vromEnd; } RomFile; // size = 0x8 -typedef struct GameAllocEntry -{ +typedef struct { + /* 0x00 */ void* read_buff; +} Sram; // size = 0x4 + +typedef struct GameAllocEntry { /* 0x00 */ struct GameAllocEntry* next; /* 0x04 */ struct GameAllocEntry* prev; /* 0x08 */ u32 size; /* 0x0C */ u32 unk_0C; -} GameAllocEntry; //size = 0x10 +} GameAllocEntry; // size = 0x10 -typedef struct -{ +typedef struct { /* 0x00 */ GameAllocEntry base; /* 0x10 */ GameAllocEntry* head; } GameAlloc; // size = 0x14 -typedef struct GameState -{ +typedef struct GameState { /* 0x00 */ GraphicsContext* gfxCtx; /* 0x04 */ void (*main)(struct GameState*); /* 0x08 */ void (*destroy)(struct GameState*); // "cleanup" @@ -837,19 +851,38 @@ typedef struct GameState /* 0xA0 */ u32 unk_A0; } GameState; // size = 0xA4 -typedef struct -{ +typedef struct { /* 0x0000 */ GameState state; - /* 0x00A4 */ char unk_A4[0x12C]; - /* 0x01D0 */ UNK_TYPE unk_1D0; - /* 0x01D4 */ char unk_1D4[0xD]; - /* 0x01E1 */ u8 unk_1E1; + /* 0x00A4 */ void* staticSegment; + /* 0x00A8 */ View view; + /* 0x01D0 */ Sram sram; + /* 0x01D4 */ u16 unk_1D4; // not used in mq dbg (some sort of timer that doesn't seem to affect anything) + /* 0x01D6 */ s16 coverAlpha; + /* 0x01D8 */ s16 addAlpha; // not used in mq dbg + /* 0x01DA */ u16 visibleDuration; // not used in mq dbg + /* 0x01DC */ s16 ult; + /* 0x01DE */ s16 uls; + /* 0x01E0 */ char unk_1E0; + /* 0x01E1 */ u8 exit; /* 0x01E2 */ char unk_1E2[6]; } TitleContext; // size = 0x1E8 -// Global Context (dbg ram start: 80212020) -typedef struct GlobalContext +typedef struct { + /* 0x0000 */ GameState state; + /* 0x00A4 */ void* staticSegment; + /* 0x00A8 */ View view; +} SampleContext; + +typedef struct { + /* 0x00 */ u8 byte0; + /* 0x01 */ u8 byte1; + /* 0x02 */ u8 byte2; + /* 0x03 */ u8 byte3; +} ElfMessage; // size = 0x4 + +// Global Context (dbg ram start: 80212020) +typedef struct GlobalContext { /* 0x00000 */ GameState state; /* 0x000A4 */ s16 sceneNum; /* 0x000A6 */ u8 sceneConfig; @@ -923,7 +956,8 @@ typedef struct GlobalContext /* 0x10B0B */ char unk_10B0B[0x7]; /* 0x10B12 */ u8 unk_10B12[4]; /* 0x10B16 */ u8 unk_10B16[4]; - /* 0x10B1A */ char unk_10B1A[0xC8A]; + /* 0x10B1A */ char unk_10B1A[0x6]; + /* 0x10B20 */ AnimationContext animationCtx; /* 0x117A4 */ ObjectContext objectCtx; /* 0x11CBC */ RoomContext roomCtx; /* 0x11D30 */ s16 unk_11D30[2]; @@ -947,8 +981,8 @@ typedef struct GlobalContext /* 0x11DFC */ UNK_PTR unk_11DFC; /* 0x11E00 */ EntranceEntry* setupEntranceList; /* 0x11E04 */ UNK_PTR setupExitList; - /* 0x11E08 */ UNK_PTR setupPathList; - /* 0x11E0C */ UNK_PTR naviMsgSegment; + /* 0x11E08 */ Path* setupPathList; + /* 0x11E0C */ ElfMessage* cUpElfMsgs; /* 0x11E10 */ char unk_11E10[0x4]; /* 0x11E14 */ u8 skyboxId; /* 0x11E15 */ s8 sceneLoadFlag; // "fade_direction" @@ -970,22 +1004,19 @@ typedef struct GlobalContext /* 0x12430 */ char unk_12430[0xE8]; } GlobalContext; // size = 0x12518 -typedef struct -{ +typedef struct { /* 0x0000 */ GameState state; /* 0x00A4 */ char unk_A4[4]; /* 0x00A8 */ View view; } OpeningContext; // size = 0x1D0 -typedef enum -{ +typedef enum { DPM_UNK = 0, DPM_PLAYER = 1, DPM_ENEMY = 2 } DynaPolyMoveFlag; -typedef struct LoadedParticleEntry -{ +typedef struct LoadedParticleEntry { /* 0x0000 */ Vec3f position; /* 0x000C */ Vec3f velocity; /* 0x0018 */ Vec3f acceleration; @@ -1003,38 +1034,22 @@ typedef struct LoadedParticleEntry /* 0x005F */ u8 type; } LoadedParticleEntry; // size = 0x60 -typedef struct -{ - /* 0x00 */ u8 limbCount; - /* 0x01 */ char unk_01[0x01]; - /* 0x02 */ u8 dListCount; - /* 0x03 */ char unk_03[0x01]; /* Probably Padding */ - /* 0x04 */ u32 limbIndex; - /* 0x08 */ u32 animCurrent; - /* 0x0C */ char unk_0C[0x04]; - /* 0x10 */ f32 animFrameCount; - /* 0x14 */ f32 unk_14; - /* 0x18 */ f32 animCurrentFrame; - /* 0x1C */ f32 animPlaybackSpeed; - /* 0x20 */ u32 actorDrawTbl; - /* 0x24 */ u32 unk_24; - /* 0x28 */ u32 unk_28; - /* 0x2C */ u32 unk_2C; - /* 0x30 */ void* funcUnk30; /* Some function pointer */ - /* 0x34 */ s32 unk_34; - /* 0x38 */ s32 unk_38; - /* 0x3C */ u16 unk_3C; - /* 0x3E */ u16 unk_3E; /* Probably Padding */ -} SkelAnime; // size = 0x40 +// Some animation related structure +typedef struct { + /* 0x00 */ AnimationHeader* animation; + /* 0x04 */ f32 playbackSpeed; + /* 0x08 */ f32 unk_08; + /* 0x0C */ f32 frameCount; + /* 0x10 */ u8 unk_10; + /* 0x14 */ f32 transitionRate; +} struct_80034EC0_Entry; // size = 0x18 -typedef struct -{ +typedef struct { /* 0x00 */ u32 unk_00; /* 0x04 */ u32(*init)(GlobalContext*, u32, LoadedParticleEntry*, void*); } ParticleOverlayInfo; -typedef struct -{ +typedef struct { /* 0x00 */ u32 vromStart; /* 0x04 */ u32 vromEnd; /* 0x0C */ void* vramStart; @@ -1044,15 +1059,13 @@ typedef struct /* 0x18 */ u32 unk_18; // Always 0x01000000? } ParticleOverlay; -typedef struct -{ +typedef struct { /* 0x00 */ LoadedParticleEntry* data_table; // Name from debug assert /* 0x04 */ s32 searchIndex; /* 0x08 */ s32 size; } EffectTableInfo; -typedef struct -{ +typedef struct { /* 0x00 */ s8 scene; /* 0x01 */ s8 spawn; /* 0x02 */ u16 continueBgm : 1; @@ -1061,8 +1074,7 @@ typedef struct /* 0x02 */ u16 fadeOutTransition : 7; } EntranceInfo; // size = 0x4 -typedef struct -{ +typedef struct { /* 0x00 */ void* loadedRamAddr; /* 0x04 */ u32 vromStart; // if applicable /* 0x08 */ u32 vromEnd; // if applicable @@ -1077,21 +1089,18 @@ typedef struct /* 0x2C */ u32 instanceSize; } GameStateOverlay; // size = 0x30 -typedef struct PreNMIContext -{ +typedef struct PreNMIContext { /* 0x00 */ GameState state; /* 0xA4 */ u32 timer; /* 0xA8 */ UNK_TYPE unk_A8; } PreNMIContext; // size = 0xAC -typedef struct -{ +typedef struct { /* 0x00 */ s8 chestFlag; // chest icon is only displayed if this flag is not set for the current room /* 0x01 */ u8 x, y; // coordinates to place the icon (top-left corner), relative to the minimap texture } MapMarkPoint; // size = 0x3 -typedef struct -{ +typedef struct { /* 0x00 */ s8 markType; // 0 for the chest icon, 1 for the boss skull icon, -1 for none /* 0x01 */ u8 count; // number of icons to display /* 0x02 */ MapMarkPoint points[12]; @@ -1099,8 +1108,7 @@ typedef struct typedef MapMarkData MapMarksData[3]; // size = 0x72 -typedef struct DebugDispObject -{ +typedef struct DebugDispObject { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3s rot; /* 0x14 */ Vec3f scale; @@ -1109,8 +1117,7 @@ typedef struct DebugDispObject /* 0x28 */ struct DebugDispObject* next; } DebugDispObject; // size = 0x2C -typedef struct -{ +typedef struct { /* 0x00 */ Vec3s colAbsMin; /* 0x06 */ Vec3s colAbsMax; /* 0x0C */ s16 nbVertices; @@ -1123,30 +1130,26 @@ typedef struct /* 0x28 */ void* waterBoxes; } CollisionHeader; -typedef enum -{ +typedef enum { MTXMODE_NEW, // generates a new matrix MTXMODE_APPLY // applies transformation to the current matrix } MatrixMode; -typedef struct FaultClient -{ +typedef struct FaultClient { struct FaultClient* next; u32 callback; u32 param1; u32 param2; } FaultClient; -typedef struct FaultAddrConvClient -{ +typedef struct FaultAddrConvClient { struct FaultAddrConvClient* next; u32 callback; u32 param; } FaultAddrConvClient; -typedef struct -{ +typedef struct { u32 (*callback)(u32, u32); u32 param0; u32 param1; @@ -1155,8 +1158,7 @@ typedef struct OSMesg msg; } FaultClientContext; -typedef struct FaultThreadStruct -{ +typedef struct FaultThreadStruct { OSThread thread; u8 unk_1B0[0x600]; OSMesgQueue queue; @@ -1177,8 +1179,7 @@ typedef struct FaultThreadStruct u8 unk_84C[4]; } FaultThreadStruct; -typedef struct -{ +typedef struct { u16* fb; u16 w; u16 h; @@ -1196,13 +1197,12 @@ typedef struct s8 charWPad; s8 charHPad; u16 printColors[10]; - u8 escCode; //bool + u8 escCode; // bool u8 osSyncPrintfEnabled; void(*inputCallback)(); } FaultDrawer; -typedef struct GfxPrint -{ +typedef struct GfxPrint { /* 0x00 */ struct GfxPrint*(*callback)(struct GfxPrint*, const char*, size_t); /* 0x04 */ Gfx* dlist; /* 0x08 */ u16 posX; @@ -1213,8 +1213,7 @@ typedef struct GfxPrint /* 0x10 */ Color_RGBA8 color; } GfxPrint; -typedef enum -{ +typedef enum { GFXPRINT_FLAG1 = 1, GFXPRINT_USE_RGBA16 = 2, GFXPRINT_FLAG4 = 4, @@ -1223,8 +1222,7 @@ typedef enum GFXPRINT_OPEN = 0x80 } GfxPrintFlag; -typedef struct StackEntry -{ +typedef struct StackEntry { /* 0x00 */ struct StackEntry* next; /* 0x04 */ struct StackEntry* prev; /* 0x08 */ u32 head; @@ -1234,16 +1232,14 @@ typedef struct StackEntry /* 0x18 */ const char* name; } StackEntry; -typedef enum -{ +typedef enum { STACK_STATUS_OK = 0, STACK_STATUS_WARNING = 1, STACK_STATUS_OVERFLOW = 2 } StackStatus; -typedef struct -{ - /* 0x00 */ u32 magic; //IS64 +typedef struct { + /* 0x00 */ u32 magic; // IS64 /* 0x04 */ u32 get; /* 0x08 */ u8 unk_08[0x14-0x08]; /* 0x14 */ u32 put; @@ -1251,22 +1247,11 @@ typedef struct /* 0x20 */ u8 data[0x10000-0x20]; } ISVDbg; -typedef struct -{ - /* 0x00 */ u32 vromStart; - /* 0x04 */ u32 vromEnd; - /* 0x08 */ u32 romStart; - /* 0x0C */ u32 romEnd; -} DmaEntry; - -typedef struct -{ +typedef struct { char name[0x18]; u32 mediaFormat; - union - { - struct - { + union { + struct { u16 cartId; u8 countryCode; u8 version; @@ -1275,18 +1260,17 @@ typedef struct }; } LocaleCartInfo; -typedef struct -{ - char magic[4]; //Yaz0 +typedef struct { + char magic[4]; // Yaz0 u32 decSize; - u32 compInfoOffset; //only used in yaz0_old.c - u32 uncompDataOffset; //only used in yaz0_old.c + u32 compInfoOffset; // only used in yaz0_old.c + u32 uncompDataOffset; // only used in yaz0_old.c u32 data[1]; } Yaz0Header; #define OS_SC_RETRACE_MSG 1 #define OS_SC_DONE_MSG 2 -#define OS_SC_NMI_MSG 3 //name is made up, 3 is OS_SC_RDP_DONE_MSG in the original sched.c +#define OS_SC_NMI_MSG 3 // name is made up, 3 is OS_SC_RDP_DONE_MSG in the original sched.c #define OS_SC_PRE_NMI_MSG 4 typedef struct { @@ -1294,16 +1278,14 @@ typedef struct { char misc[30]; } OSScMsg; -typedef struct IrqMgrClient -{ +typedef struct IrqMgrClient { struct IrqMgrClient* prev; OSMesgQueue* queue; } IrqMgrClient; -typedef struct -{ - /* 0x000 */ OSScMsg retraceMsg; //this apparently got moved from OSSched - /* 0x020 */ OSScMsg prenmiMsg; //this apparently got moved from OSSched +typedef struct { + /* 0x000 */ OSScMsg retraceMsg; // this apparently got moved from OSSched + /* 0x020 */ OSScMsg prenmiMsg; // this apparently got moved from OSSched /* 0x040 */ OSScMsg nmiMsg; /* 0x060 */ OSMesgQueue queue; /* 0x078 */ OSMesg msgBuf[8]; @@ -1313,22 +1295,20 @@ typedef struct /* 0x250 */ OSTime resetTime; /* 0x258 */ OSTimer timer; /* 0x278 */ OSTime retraceTime; -} IrqMgr; //size = 0x280 +} IrqMgr; // size = 0x280 struct ArenaNode; -typedef struct Arena -{ +typedef struct Arena { /* 0x00 */ struct ArenaNode* head; /* 0x04 */ void* start; /* 0x08 */ OSMesgQueue lock; /* 0x20 */ u8 unk_20; /* 0x21 */ u8 isInit; /* 0x22 */ u8 flag; -} Arena; //size = 0x24 +} Arena; // size = 0x24 -typedef struct ArenaNode -{ +typedef struct ArenaNode { /* 0x00 */ s16 magic; /* 0x02 */ s16 isFree; /* 0x04 */ u32 size; @@ -1339,8 +1319,8 @@ typedef struct ArenaNode /* 0x18 */ OSId threadId; /* 0x1C */ Arena* arena; /* 0x20 */ OSTime time; - /* 0x28 */ u8 unk_28[0x30-0x28]; //probably padding -} ArenaNode; //size = 0x30 + /* 0x28 */ u8 unk_28[0x30-0x28]; // probably padding +} ArenaNode; // size = 0x30 typedef struct OverlayRelocationSection { /* 0x00 */ u32 textSize; @@ -1349,41 +1329,114 @@ typedef struct OverlayRelocationSection { /* 0x0C */ u32 bssSize; /* 0x10 */ u32 nRelocations; /* 0x14 */ u32 relocations[1]; -} OverlayRelocationSection; /* size >= 0x18 */ - -#define VEC3_ADD( V3A0, V3A1 ) \ -{ \ - V3A0.x += V3A1.x; \ - V3A0.y += V3A1.y; \ - V3A0.z += V3A1.z; \ -} - -#define VEC3_SUB( V3DST, V3A0, V3A1 ) \ -{ \ - V3DST.x = V3A0.x - V3A1.x; \ - V3DST.y = V3A0.y - V3A1.y; \ - V3DST.z = V3A0.z - V3A1.z; \ -} +} OverlayRelocationSection; // size >= 0x18 -typedef struct -{ +typedef struct { /* 0x00 */ void* loadedRamAddr; /* 0x04 */ u32 vromStart; /* 0x08 */ u32 vromEnd; /* 0x0C */ u8* vramStart; /* 0x10 */ u8* vramEnd; - /* 0x14 */ u32 off; //loadedRamAddr - vram + /* 0x14 */ u32 off; // loadedRamAddr - vram /* 0x18 */ const char* name; -} KaleidoManagerOvl; //size = 0x1C +} KaleidoManagerOvl; // size = 0x1C #define KALEIDO_OVL_KALEIDO_SCOPE 0 #define KALEIDO_OVL_PLAYER_ACTOR 1 #define KALEIDO_OVL_COUNT 2 -typedef struct ListAlloc -{ +typedef struct ListAlloc { /* 0x00 */ struct ListAlloc* prev; /* 0x04 */ struct ListAlloc* next; -} ListAlloc; //size = 0x8 +} ListAlloc; // size = 0x8 + +typedef struct { + /* 0x00 */ u32 resetting; + /* 0x04 */ u32 resetCount; + /* 0x08 */ OSTime duration; + /* 0x10 */ OSTime resetTime; +} PreNmiBuff; // size = 0x18 (actually osAppNmiBuffer is 0x40 bytes large but the rest is unused) + +typedef struct { + /* 0x00 */ s16 unk_00; + /* 0x02 */ s16 unk_02; + /* 0x04 */ s16 unk_04; +} SubQuakeRequest14; + +typedef struct { + /* 0x00 */ s16 randIdx; + /* 0x02 */ s16 countdownMax; + /* 0x04 */ Camera* cam; + /* 0x08 */ u32 callbackIdx; + /* 0x0C */ s16 y; + /* 0x0E */ s16 x; + /* 0x10 */ s16 zoom; + /* 0x12 */ s16 rotZ; + /* 0x14 */ SubQuakeRequest14 unk_14; + /* 0x1A */ s16 speed; + /* 0x1C */ s16 unk_1C; + /* 0x1E */ s16 countdown; + /* 0x20 */ s16 camPtrIdx; +} QuakeRequest; // size = 0x24 + +typedef struct { + /* 0x00 */ Vec3f vec1; + /* 0x0C */ Vec3f vec2; + /* 0x18 */ s16 rotZ; + /* 0x1A */ s16 unk_1A; + /* 0x1C */ s16 zoom; +} ShakeInfo; // size = 0x1E + +typedef struct { + /* 0x00 */ Vec3f vec1; + /* 0x0C */ Vec3f vec2; + /* 0x18 */ s16 rotZ; + /* 0x1A */ s16 unk_1A; + /* 0x1C */ s16 zoom; + /* 0x20 */ f32 unk_20; +} UnkQuakeCalcStruct; // size = 0x24 + +typedef struct { + /* 0x00 */ u32 idx; + /* 0x04 */ void* ptr; +} UCodeInfo; // size = 0x8 + +typedef struct { + /* 0x00 */ u32 segments[NUM_SEGMENTS]; + /* 0x40 */ u32 dlStack[18]; + /* 0x88 */ u32 dlDepth; + /* 0x8C */ u32 dlCnt; + /* 0x90 */ u32 vtxCnt; + /* 0x94 */ u32 spvtxCnt; + /* 0x98 */ u32 tri1Cnt; + /* 0x9C */ u32 tri2Cnt; + /* 0xA0 */ u32 quadCnt; + /* 0xA4 */ u32 lineCnt; + /* 0xA8 */ u32 loaducodeCnt; + /* 0xAC */ u32 pipeSyncRequired; + /* 0xB0 */ u32 tileSyncRequired; + /* 0xB4 */ u32 loadSyncRequired; + /* 0xB8 */ u32 syncErr; + /* 0xBC */ u32 enableLog; + /* 0xC0 */ u32 ucodeInfoIdx; + /* 0xC4 */ u32 ucodeInfoCount; + /* 0xC8 */ UCodeInfo* ucodeInfo; + /* 0xCC */ u32 modeH; + /* 0xD0 */ u32 modeL; + /* 0xD4 */ u32 geometryMode; +} UCodeDisas; // size = 0xD8 + +typedef struct { + /* 0x00 */ u16* fb1; + /* 0x04 */ u16* swapbuffer; + /* 0x08 */ OSViMode* viMode; + /* 0x0C */ u32 features; + /* 0x10 */ u8 unk_10; + /* 0x11 */ u8 updateRate; + /* 0x12 */ u8 updateRate2; + /* 0x13 */ u8 unk_13; + /* 0x14 */ f32 xScale; + /* 0x18 */ f32 yScale; +} CfbInfo; // size = 0x1C #endif diff --git a/include/z64actor.h b/include/z64actor.h index 3a288d436..a1f08721d 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -1,6 +1,9 @@ #ifndef _Z64ACTOR_H_ #define _Z64ACTOR_H_ +#include <z64animation.h> +#include <z64vec.h> + #define ACTOR_DLF_MAX 471 #define ACTOR_NUMBER_MAX 200 #define INVISIBLE_ACTOR_MAX 20 @@ -13,34 +16,12 @@ struct GlobalContext; // From z64light.h struct LightMapper; -typedef struct -{ - f32 x, y, z; -} Vec3f; - -typedef struct -{ - s16 x, y, z; -} Vec3s; - -typedef struct -{ - f32 x, y; -} Vec2f; - -typedef struct -{ - u32 x, y; -} Vec2i; - -typedef struct -{ +typedef struct { Vec3f pos; Vec3s rot; } PosRot; // size = 0x14 -typedef struct -{ +typedef struct { /* 0x00 */ char unk_00[0x8]; /* 0x08 */ Vec3s norm; // Normal vector /* 0x0E */ s16 dist; // Plane distance from origin @@ -48,8 +29,7 @@ typedef struct typedef void (*ActorFunc)(struct Actor*, struct GlobalContext*); -typedef struct -{ +typedef struct { /* 0x00 */ s16 id; /* 0x02 */ u8 type; // Classifies actor and determines when actor will execute /* 0x03 */ u8 room; // Room instance was spawned in. If value set to FF in rom, instance does not despawn when swapping rooms @@ -62,15 +42,13 @@ typedef struct /* 0x1C */ ActorFunc draw; // Draw function } ActorInit; // size = 0x20 -typedef enum -{ +typedef enum { ALLOCTYPE_NORMAL, ALLOCTYPE_ABSOLUTE, ALLOCTYPE_PERMANENT } AllocType; -typedef struct -{ +typedef struct { /* 0x00 */ u32 vromStart; /* 0x04 */ u32 vromEnd; /* 0x08 */ void* vramStart; @@ -82,25 +60,14 @@ typedef struct /* 0x1E */ s8 nbLoaded; // original name: "clients" } ActorOverlay; // size = 0x20 -typedef struct -{ - struct - { +typedef struct { + struct { char damage : 4; char effect : 4; } attack[32]; } ActorDamageChart; -typedef struct -{ - /* 0x00 */ u8 health; - /* 0x02 */ s16 unk_02; - /* 0x04 */ s16 unk_04; - /* 0x06 */ u8 mass; -} SubActor98Init; - -typedef struct -{ +typedef struct { /* 0x00 */ ActorDamageChart* damageChart; // For actors which contain a damage chart (example: Stalfos)... /* 0x04 */ Vec3f displacement; // Amount to correct velocity (0x5C) by when colliding into a body /* 0x10 */ s16 unk_10; @@ -114,8 +81,7 @@ typedef struct /* 0x1B */ u8 unk_1B; } SubActorStruct98; // size = 0x1C -typedef struct -{ +typedef struct { /* 0x00 */ Vec3s rot; // Current actor shape rotation /* 0x06 */ u8 unk_06; /* 0x08 */ f32 unk_08; // Model y axis offset. Represents model space units. collision mesh related @@ -125,8 +91,7 @@ typedef struct /* 0x15 */ u8 unk_15; } ActorShape; // size = 0x18 -typedef struct Actor -{ +typedef struct Actor { /* 0x000 */ s16 id; // Actor Id /* 0x002 */ u8 type; // Actor Type. Refer to the corresponding enum for values /* 0x003 */ s8 room; // Room number the actor is part of. FF denotes that the actor won't despawn on a room change @@ -159,8 +124,7 @@ typedef struct Actor /* 0x094 */ f32 yDistanceFromLink; /* 0x098 */ SubActorStruct98 sub_98; /* 0x0B4 */ ActorShape shape; - /* 0x0CC */ Vec3f unk_CC; // Used in Link, not Deku Babas - /* 0x0D8 */ Vec3f unk_D8; // Used in Link, not Deku Babas + /* 0x0CC */ Vec3f unk_CC[2]; /* 0x0E4 */ Vec3f unk_E4; // Stores result of some vector transformation involving actor xyz vector, and a matrix at Global Context + 11D60 /* 0x0F0 */ f32 unk_F0; // Related to above /* 0x0F4 */ f32 unk_F4; @@ -198,16 +162,29 @@ typedef struct Actor /* From here on, the structure and size varies for each actor */ } Actor; // size = 0x14C -typedef enum -{ +typedef struct { + /* 0x00 */ u8 health; + /* 0x02 */ s16 unk_02; + /* 0x04 */ s16 unk_04; + /* 0x06 */ u8 mass; +} Sub98Init4; + +typedef struct { + /* 0x00 */ u8 health; + /* 0x02 */ s16 unk_10; + /* 0x04 */ s16 unk_12; + /* 0x06 */ u16 unk_14; + /* 0x08 */ u8 mass; +} Sub98Init5; + +typedef enum { COLTYPE_CYLINDER = 1, COLTYPE_CYLINDER_GROUP = 0, COLTYPE_QUAD = 3, COLTYPE_TRIANGLE_GROUP = 2 } ColliderType; -typedef struct -{ +typedef struct { /* 0x00 */ Actor* actor; /* 0x04 */ Actor* at; /* 0x08 */ Actor* ac; @@ -220,15 +197,13 @@ typedef struct /* 0x15 */ u8 type; /* Cylinder Collection, Cylinder, Triangle Collection, Quad */ } Collider; // size = 0x18 -typedef struct -{ +typedef struct { /* 0x00 */ s32 flags; /* Toucher Attack Identifier Flags */ /* 0x04 */ u8 unk_04; /* 0x05 */ u8 damage; /* Damage or Stun Timer */ } ColliderTouch; // size = 0x08 -typedef struct -{ +typedef struct { /* 0x00 */ s32 flags; /* Collision Exclusion Mask */ /* 0x04 */ u8 effect; /* Damage Effect (Knockback, Fire, etc.) */ /* 0x05 */ u8 unk_05; @@ -237,8 +212,7 @@ typedef struct /* 0x0A */ s16 unk_0A; } ColliderBump; // size = 0x0C -typedef struct ColliderBody -{ +typedef struct ColliderBody { /* 0x00 */ ColliderTouch toucher; /* 0x08 */ ColliderBump bumper; /* 0x14 */ u8 flags; @@ -251,14 +225,12 @@ typedef struct ColliderBody /* 0x24 */ struct ColliderBody* colliding; } ColliderBody; // size = 0x28 -typedef struct ColliderBodyEntry -{ +typedef struct ColliderBodyEntry { /* 0x00 */ ColliderBody c; /* 0x28 */ char unk_28[0x18]; } ColliderBodyEntry; // size = 0x40 -typedef struct -{ +typedef struct { /* 0x00 */ u8 bodyFlags; /* 0x01 */ u8 unk_09[0x3]; /* 000000 */ /* 0x04 */ s32 toucherMask; /* Attack Toucher Exclusion Mask */ @@ -273,8 +245,7 @@ typedef struct /* 0x17 */ u8 unk_1F; /* 00 */ } ColliderBodyInfoInner; // size = 0x1A -typedef struct -{ +typedef struct { /* 0x00 */ u8 unk_00; /* 0x01 */ u8 colliderFlags; /* Collider Flags */ /* 0x02 */ u8 collideFlags; /* Collide Flags */ @@ -284,30 +255,26 @@ typedef struct /* 0x06 */ u8 unk_06[0x2]; /* 0000 */ } ColliderBodyInfo; // size = 0x08 -typedef struct -{ +typedef struct { /* 0x00 */ s16 radius; /* Cylinder Radius */ /* 0x02 */ s16 height; /* Cylinder Height */ /* 0x04 */ s16 yShift; /* Shift Cylinder on Y Axis */ /* 0x06 */ Vec3s position; /* {X, Y, Z} position of Cylinder */ } ColliderDimensions; // size = 0xC -typedef struct -{ +typedef struct { /* 0x00 */ Collider base; /* 0x18 */ ColliderBody body; /* 0x40 */ ColliderDimensions dim; } ColliderCylinderMain; // size = 0x4C -typedef struct -{ +typedef struct { /* 0x00 */ ColliderBodyInfo body; - /* 0x06 */ ColliderBodyInfoInner inner; - /* 0x20 */ ColliderDimensions dim; -} ColliderCylinderInit; // size = 0x2C + /* 0x08 */ ColliderBodyInfoInner inner; + /* 0x22 */ ColliderDimensions dim; +} ColliderCylinderInit; // size = 0x2E -typedef struct -{ +typedef struct { /* 0x00 */ Actor* actor; /* 0x04 */ char unk_04[0x10]; /* 0x14 */ Vec3f scale1; @@ -319,8 +286,7 @@ typedef struct /* 0x54 */ char unk_54[0x10]; } ActorMesh; // size = 0x64 -typedef struct -{ +typedef struct { /* 0x000 */ Actor actor; /* 0x14C */ u32 dynaPolyId; /* 0x150 */ f32 unk_150; @@ -329,86 +295,90 @@ typedef struct /* 0x15A */ u16 unk_15A; /* 0x15C */ u32 unk_15C; /* 0x160 */ u8 unk_160; + /* 0x162 */ s16 unk_162; } DynaPolyActor; // size = 0x164 -typedef struct -{ - /* 0x0000 */ Actor actor; - /* 0x014C */ s8 currentTunic; - /* 0x014D */ s8 currentSword; - /* 0x014E */ s8 currentShield; - /* 0x014F */ s8 currentBoots; - /* 0x0150 */ s8 unk_150; - /* 0x0151 */ s8 unk_151; - /* 0x0152 */ s8 unk_152; - /* 0x0153 */ s8 unk_153; - /* 0x0154 */ s8 unk_154; - /* 0x0155 */ char unk_155[0x008]; - /* 0x015D */ u8 unk_15D; - /* 0x015E */ u8 unk_15E; - /* 0x015F */ u8 currentMask; - /* 0x0160 */ char unk_160[0x050]; - /* 0x01B0 */ u32 unk_1B0; - /* 0x01B4 */ char unk_1B4[0x1F8]; - /* 0x03AC */ Actor* heldActor; - /* 0x03B0 */ char unk_3B0[0x084]; - /* 0x0434 */ u8 getItemId; - /* 0x0436 */ u16 getItemDirection; - /* 0x0438 */ Actor* interactRangeActor; - /* 0x043C */ s8 unk_43C; - /* 0x0440 */ Actor* rideActor; - /* 0x0444 */ u8 action; - /* 0x0445 */ char unk_445[0x003]; - /* 0x0448 */ Actor* unk_448; - /* 0x0445 */ char unk_44C[0x01E]; - /* 0x046A */ u16 unk_46A; - /* 0x046C */ char unk_46C[0x6E]; - /* 0x04DA */ s16 unk_4DA; - /* 0x04DC */ char unk_4DC[0x188]; - /* 0x0664 */ Actor* unk_664; - /* 0x0668 */ char unk_668[0x004]; - /* 0x066C */ s32 unk_66C; - /* 0x0670 */ char unk_670[0x00C]; - /* 0x067C */ u32 stateFlags1; - /* 0x0680 */ u32 stateFlags2; - /* 0x0684 */ char unk_684[0x008]; - /* 0x068C */ Actor* unk_68C; - /* 0x0690 */ char unk_690[0x002]; - /* 0x0692 */ u8 unk_692; - /* 0x0693 */ s8 exchangeItemId; - /* 0x0694 */ Actor* unk_694; - /* 0x0698 */ f32 unk_698; - /* 0x069C */ char unk_69C[0x008]; - /* 0x06A4 */ f32 unk_6A4; - /* 0x06A8 */ char unk_6A8[0x5]; - /* 0x06AD */ u8 unk_6AD; - /* 0x06AE */ char unk_6AE[0x186]; - /* 0x0834 */ s16 unk_834; - /* 0x0836 */ char unk_836[0x006]; - /* 0x083C */ s16 unk_83C; - /* 0x083E */ char unk_83E[0x004]; - /* 0x0842 */ s8 swordAnimation; - /* 0x0843 */ s8 swordState; - /* 0x0844 */ u8 unk_844; - /* 0x0845 */ u8 unk_845; - /* 0x0846 */ u8 unk_846; - /* 0x0847 */ char unk_847[0x004]; - /* 0x084B */ s8 unk_84B[UNK_SIZE]; - /* 0x084C */ char unk_84C[0x054]; - /* 0x08A0 */ u8 unk_8A0; - /* 0x08A1 */ u8 unk_8A1; - /* 0x08A2 */ u16 unk_8A2; - /* 0x08A4 */ f32 unk_8A4; - /* 0x08A8 */ f32 unk_8A8; - /* 0x08AC */ char unk_8AC[0x174]; - /* 0x0A20 */ MtxF mf_A20; - /* 0x0A60 */ char unk_A60[0x18]; - /* 0x0A78 */ s8 unk_A78; - /* 0x0A79 */ char unk_A79[0x1B]; -} Player; //size = 0xA94 - -typedef enum -{ +typedef struct { + /* 0x0000 */ Actor actor; + /* 0x014C */ s8 currentTunic; + /* 0x014D */ s8 currentSword; + /* 0x014E */ s8 currentShield; + /* 0x014F */ s8 currentBoots; + /* 0x0150 */ s8 unk_150; + /* 0x0151 */ s8 unk_151; + /* 0x0152 */ s8 unk_152; + /* 0x0153 */ s8 unk_153; + /* 0x0154 */ s8 unk_154; + /* 0x0155 */ char unk_155[0x008]; + /* 0x015D */ u8 unk_15D; + /* 0x015E */ u8 unk_15E; + /* 0x015F */ u8 currentMask; + /* 0x0160 */ char unk_160[0x050]; + /* 0x01B0 */ u32 unk_1B0; + /* 0x01B4 */ SkelAnime skelAnime; + /* 0x01F8 */ char unk_1F8[0x1B4]; + /* 0x03AC */ Actor* heldActor; + /* 0x03B0 */ char unk_3B0[0x084]; + /* 0x0434 */ u8 getItemId; + /* 0x0436 */ u16 getItemDirection; + /* 0x0438 */ Actor* interactRangeActor; + /* 0x043C */ s8 unk_43C; + /* 0x0440 */ Actor* rideActor; + /* 0x0444 */ u8 action; + /* 0x0445 */ char unk_445[0x003]; + /* 0x0448 */ Actor* unk_448; + /* 0x0445 */ char unk_44C[0x01E]; + /* 0x046A */ u16 unk_46A; + /* 0x046C */ char unk_46C[0x6E]; + /* 0x04DA */ s16 unk_4DA; + /* 0x04DC */ char unk_4DC[0x188]; + /* 0x0664 */ Actor* unk_664; + /* 0x0668 */ char unk_668[0x004]; + /* 0x066C */ s32 unk_66C; + /* 0x0670 */ char unk_670[0x00C]; + /* 0x067C */ u32 stateFlags1; + /* 0x0680 */ u32 stateFlags2; + /* 0x0684 */ char unk_684[0x008]; + /* 0x068C */ Actor* unk_68C; + /* 0x0690 */ char unk_690[0x002]; + /* 0x0692 */ u8 unk_692; + /* 0x0693 */ s8 exchangeItemId; + /* 0x0694 */ Actor* unk_694; + /* 0x0698 */ f32 unk_698; + /* 0x069C */ char unk_69C[0x008]; + /* 0x06A4 */ f32 unk_6A4; + /* 0x06A8 */ char unk_6A8[0x5]; + /* 0x06AD */ u8 unk_6AD; + /* 0x06AE */ char unk_6AE[0x1A]; + /* 0x06C8 */ SkelAnime skelAnime2; + /* 0x070C */ char unk_70C[0x128]; + /* 0x0834 */ s16 unk_834; + /* 0x0836 */ char unk_836[0x006]; + /* 0x083C */ s16 unk_83C; + /* 0x083E */ char unk_83E[0x004]; + /* 0x0842 */ s8 swordAnimation; + /* 0x0843 */ s8 swordState; + /* 0x0844 */ u8 unk_844; + /* 0x0845 */ u8 unk_845; + /* 0x0846 */ u8 unk_846; + /* 0x0847 */ char unk_847[0x004]; + /* 0x084B */ s8 unk_84B[UNK_SIZE]; + /* 0x084C */ char unk_84C[0x003]; + /* 0x084F */ s8 unk_84F; + /* 0x0850 */ char unk_850[0x050]; + /* 0x08A0 */ u8 unk_8A0; + /* 0x08A1 */ u8 unk_8A1; + /* 0x08A2 */ u16 unk_8A2; + /* 0x08A4 */ f32 unk_8A4; + /* 0x08A8 */ f32 unk_8A8; + /* 0x08AC */ char unk_8AC[0x174]; + /* 0x0A20 */ MtxF mf_A20; + /* 0x0A60 */ char unk_A60[0x18]; + /* 0x0A78 */ s8 unk_A78; + /* 0x0A79 */ char unk_A79[0x1B]; +} Player; // size = 0xA94 + +typedef enum { /* 0x00 */ ACTORTYPE_SWITCH, /* 0x01 */ ACTORTYPE_BG, /* 0x02 */ ACTORTYPE_PLAYER, @@ -423,8 +393,7 @@ typedef enum /* 0x0B */ ACTORTYPE_CHEST } ActorType; -typedef enum -{ +typedef enum { /* 0x0000 */ ACTOR_PLAYER, /* 0x0001 */ ACTOR_UNSET_1, /* 0x0002 */ ACTOR_EN_TEST, diff --git a/include/z64animation.h b/include/z64animation.h new file mode 100755 index 000000000..598c25b36 --- /dev/null +++ b/include/z64animation.h @@ -0,0 +1,191 @@ +#ifndef _Z64_ANIMATION_H +#define _Z64_ANIMATION_H + +#include <ultra64.h> +#include <ultra64/gbi.h> +#include <z64dma.h> +#include <z64vec.h> + +#define LINK_ANIMETION_OFFSET(addr,offset) (((u32)&_link_animetionSegmentRomStart)+((u32)addr)-((u32)&link_animetion_segment)+((u32)offset)) +#define LIMB_DONE 0xFF +#define ANIMATION_ENTRY_MAX 50 + +#define ANIM_FLAG_UPDATEXZ 0x02 +#define ANIM_FLAG_UPDATEY 0x10 + +struct GlobalContext; +struct Actor; +typedef struct SkelAnime SkelAnime; + +typedef struct { + /* 0x000 */ Vec3s translation; // Translation relative to parent limb. root limb is a tranlation for entire model. + /* 0x006 */ u8 firstChildIndex; // The first child's index into the limb table. + /* 0x007 */ u8 nextLimbIndex; // The parent limb's next limb index into the limb table. + /* 0x008 */ Gfx* displayLists[1]; // Display lists for the limb. Index 0 is the normal display list, index 1 is the far model display list. +} SkelLimbEntry; // Size = 0xC or 0x10 + +typedef struct { + /* 0x000 */ SkelLimbEntry* limbs[1]; // One ore more limbs, index 0 is the root limb. +} Skeleton; // Size >= 4 + +typedef struct { + /* 0x000 */ Skeleton* skeletonSeg; // Segment address of SkelLimbIndex. + /* 0x004 */ u8 limbCount; // Number of limbs in the model. + /* 0x005 */ char unk_05[3]; // unknown, maybe padding? + /* 0x008 */ u8 dListCount; // Number of display lists in the model. +} SkeletonHeader; // Size = 0xC + +typedef s16 AnimationRotationValue; + +typedef struct { + /* 0x000 */ u16 x; + /* 0x002 */ u16 y; + /* 0x004 */ u16 z; +} AnimationRotationIndex; // size = 0x06 + +typedef struct { + s16 frameCount; + s16 unk_02; +} GenericAnimationHeader; + +typedef struct { + /* 0x000 */ GenericAnimationHeader genericHeader; + /* 0x004 */ u32 rotationValueSeg; // referenced as tbl + /* 0x008 */ u32 rotationIndexSeg; // referenced as ref_tbl + /* 0x00C */ u16 limit; +} AnimationHeader; // size = 0x10 + +typedef enum { + ANIMATION_LINKANIMETION, + ANIMATION_TYPE1, + ANIMATION_TYPE2, + ANIMATION_TYPE3, + ANIMATION_TYPE4, + ANIMATION_TYPE5 +} AnimationType; + +typedef struct { + /* 0x000 */ DmaRequest req; + /* 0x020 */ OSMesgQueue msgQueue; + /* 0x038 */ OSMesg msg; +} AnimationEntryType0; + +typedef struct { + /* 0x000 */ u8 unk_00; + /* 0x001 */ u8 vecCount; + /* 0x004 */ Vec3s* dst; + /* 0x008 */ Vec3s* src; +} AnimationEntryType1; + +typedef struct { + /* 0x000 */ u8 unk_00; + /* 0x001 */ u8 limbCount; + /* 0x004 */ Vec3s* unk_04; + /* 0x008 */ Vec3s* unk_08; + /* 0x00C */ f32 unk_0C; +} AnimationEntryType2; + +typedef struct { + /* 0x000 */ u8 unk_00; + /* 0x001 */ u8 vecCount; + /* 0x004 */ Vec3s* dst; + /* 0x008 */ Vec3s* src; + /* 0x00C */ u8* index; +} AnimationEntryType3; + +typedef struct { + /* 0x000 */ u8 unk_00; + /* 0x001 */ u8 vecCount; + /* 0x002 */ char unk_02[0x2]; + /* 0x004 */ Vec3s* dst; + /* 0x008 */ Vec3s* src; + /* 0x00C */ u8* index; +} AnimationEntryType4; + +typedef struct { + /* 0x000 */ struct Actor* actor; + /* 0x004 */ SkelAnime* skelAnime; + /* 0x008 */ f32 unk_08; +} AnimationEntryType5; + +typedef struct { + /* 0x000 */ u8 raw[0x3C]; +} AnimationEntryRaw; + +typedef union { + AnimationEntryRaw raw; + AnimationEntryType0 type0; + AnimationEntryType1 type1; + AnimationEntryType2 type2; + AnimationEntryType3 type3; + AnimationEntryType4 type4; + AnimationEntryType5 type5; +} AnimationEntryType; + +typedef struct { + /* 0x000 */ u8 type; + /* 0x001 */ u8 unk_01; + /* 0x004 */ AnimationEntryType types; +} AnimationEntry; // size = 0x40 + +typedef struct AnimationContext { + s16 animationCount; + char unk_02[2]; + AnimationEntry entries[ANIMATION_ENTRY_MAX]; +} AnimationContext; + +typedef struct { + GenericAnimationHeader genericHeader; + u32 animationSegAddress; +} LinkAnimetionEntry; + +struct SkelAnime { + /* 0x00 */ u8 limbCount; // joint_Num + /* modes 0 and 1 repeat the animation indefinitely + * modes 2 and 3 play the animaton once then stop + * modes >= 4 play the animation once, and always start at frame 0. + */ + /* 0x01 */ u8 mode; + /* 0x02 */ u8 dListCount; + /* 0x03 */ s8 unk_03; + /* 0x04 */ Skeleton* skeleton; + /* 0x08 */ + union { + AnimationHeader* animCurrentSeg; + LinkAnimetionEntry* linkAnimetionSeg; + GenericAnimationHeader* genericSeg; + }; + /* 0x0C */ f32 initialFrame; + /* 0x10 */ f32 animFrameCount; + /* 0x14 */ f32 totalFrames; + /* 0x18 */ f32 animCurrentFrame; + /* 0x1C */ f32 animPlaybackSpeed; + /* 0x20 */ Vec3s* actorDrawTbl; // now_joint + /* 0x24 */ Vec3s* transitionDrawTbl; // morf_joint + /* 0x28 */ f32 transCurrentFrame; + /* 0x2C */ f32 transitionStep; + /* 0x30 */ s32 (*animUpdate)(); + /* 0x34 */ s8 initFlags; + /* 0x35 */ u8 flags; + /* 0x36 */ s16 prevFrameRot; + /* 0x38 */ Vec3s prevFramePos; + /* 0x3E */ Vec3s unk_3E; +}; // size = 0x44 + +typedef s32 (*SkelAnime_LimbUpdateMatrix)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, + Vec3f* pos, Vec3s* rot, struct Actor* actor); + +typedef void (*SkelAnime_LimbAppendDlist)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, + Vec3s* rot, struct Actor* actor); + +typedef s32 (*SkelAnime_LimbUpdateMatrix2)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, + Vec3f* pos, Vec3s* rot, struct Actor* actor, Gfx** gfx); + +typedef void (*SkelAnime_LimbAppendDlist2)(struct GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, + Vec3s* rot, struct Actor* actor, Gfx** gfx); + +typedef void (*AnimationEntryCallback)(struct GlobalContext*, AnimationEntryType*); + +extern u32 link_animetion_segment; + +#endif diff --git a/include/z64cutscene.h b/include/z64cutscene.h index 97abc805e..91be35f82 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -1,16 +1,14 @@ #ifndef _Z64CUTSCENE_H_ #define _Z64CUTSCENE_H_ -typedef struct -{ +typedef struct { /* 0x00 */ u16 entrance; // entrance index upon which the cutscene should trigger /* 0x02 */ u8 ageRestriction; // 0 for adult only, 1 for child only, 2 for both ages /* 0x03 */ u8 flag; // event_chk_inf flag bound to the entrance cutscene /* 0x04 */ u32 segAddr; // segment offset location of the cutscene } EntranceCutscene; // size = 0x8 -typedef struct -{ +typedef struct { /* 0x00 */ s8 continueFlag; /* 0x01 */ s8 cameraRoll; /* 0x02 */ s16 nextPointFrame; @@ -18,38 +16,33 @@ typedef struct /* 0x08 */ Vec3s pos; } CutsceneCameraPoint; // size = 0x10 -typedef struct -{ +typedef struct { /* 0x00 */ u16 base; /* 0x02 */ u16 startFrame; /* 0x04 */ u16 endFrame; } CsCmdBase; -typedef struct -{ +typedef struct { /* 0x00 */ u8 unk_00; /* 0x01 */ u8 setting; /* 0x02 */ u16 startFrame; /* 0x04 */ u16 endFrame; } CsCmdEnvLighting; -typedef struct -{ +typedef struct { /* 0x00 */ u8 unk_00; /* 0x01 */ u8 sequence; /* 0x02 */ u16 startFrame; /* 0x04 */ u16 endFrame; } CsCmdMusicChange; -typedef struct -{ +typedef struct { /* 0x00 */ u16 type; /* 0x02 */ u16 startFrame; /* 0x04 */ u16 endFrame; } CsCmdMusicFade; -typedef struct -{ +typedef struct { /* 0x00 */ u16 unk_00; /* 0x02 */ u16 startFrame; /* 0x04 */ u16 endFrame; @@ -58,8 +51,7 @@ typedef struct /* 0x08 */ u8 unk_08; } CsCmdUnknown9; -typedef struct -{ +typedef struct { /* 0x00 */ u16 unk_00; /* 0x02 */ u16 startFrame; /* 0x04 */ u16 endFrame; @@ -67,8 +59,7 @@ typedef struct /* 0x07 */ u8 minute; } CsCmdDayTime; -typedef struct -{ +typedef struct { /* 0x00 */ u16 base; /* 0x02 */ u16 startFrame; /* 0x04 */ u16 endFrame; @@ -77,19 +68,17 @@ typedef struct /* 0x0A */ u16 textId2; } CsCmdTextbox; // size = 0xC -typedef struct -{ +typedef struct { /* 0x00 */ u16 action; /* 0x02 */ u16 startFrame; /* 0x04 */ u16 endFrame; /* 0x06 */ Vec3s rot; - /* 0x0C */ Vec3f startPos; - /* 0x18 */ Vec3f endPos; - /* 0x24 */ Vec3f normal; + /* 0x0C */ Vec3i startPos; + /* 0x18 */ Vec3i endPos; + /* 0x24 */ Vec3i normal; } CsCmdActorAction; // size = 0x30 -typedef enum -{ +typedef enum { CS_STATE_IDLE, CS_STATE_SKIPPABLE_INIT, CS_STATE_SKIPPABLE_EXEC, @@ -97,8 +86,7 @@ typedef enum CS_STATE_UNSKIPPABLE_EXEC } CutsceneState; -typedef enum -{ +typedef enum { CS_CMD_00 = 0x0000, CS_CMD_CAMERA_POS = 0x0001, CS_CMD_CAMERA_FOCUS = 0x0002, diff --git a/include/z64dma.h b/include/z64dma.h new file mode 100755 index 000000000..b4e4607f6 --- /dev/null +++ b/include/z64dma.h @@ -0,0 +1,23 @@ +#ifndef _Z64_DMA_H_ +#define _Z64_DMA_H_ + +#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 unk_14; + /* 0x18 */ OSMesgQueue* notifyQueue; // Message queue for the notification message + /* 0x1C */ OSMesg notifyMsg; // Completion notification message +} DmaRequest; // size = 0x20 + +typedef struct { + /* 0x00 */ u32 vromStart; + /* 0x04 */ u32 vromEnd; + /* 0x08 */ u32 romStart; + /* 0x0C */ u32 romEnd; +} DmaEntry; +#endif diff --git a/include/z64effect.h b/include/z64effect.h index b7d11270e..4f83f2e88 100644 --- a/include/z64effect.h +++ b/include/z64effect.h @@ -2,18 +2,17 @@ #define _Z64EFFECT_H_ #include <color.h> -/* gz has trail related structs but they seem to be different in dbg*/ -typedef struct -{ +// gz has trail related structs but they seem to be different in dbg +typedef struct { /* 0x0000 */ char unk_00[0x184]; /* 0x0184 */ Color_RGBA8 p1Start; /* 0x0188 */ Color_RGBA8 p2Start; /* 0x018C */ Color_RGBA8 p1End; /* 0x0190 */ Color_RGBA8 p2End; - /* 0x0194 */ u32 unk_194; //these are proably bytes + /* 0x0194 */ u32 unk_194; // these are proably bytes /* 0x0198 */ u32 unk_198; /* 0x019C */ u32 unk_19C; /* 0x01A0 */ -} TrailEffect; //size = unk +} TrailEffect; // size = unk #endif diff --git a/include/z64item.h b/include/z64item.h index 1c8e84705..39a70b803 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -1,16 +1,14 @@ #ifndef _Z64ITEM_H_ #define _Z64ITEM_H_ -typedef enum -{ +typedef enum { /* 0x00 */ EQUIP_SWORD, /* 0x01 */ EQUIP_SHIELD, /* 0x02 */ EQUIP_TUNIC, /* 0x03 */ EQUIP_BOOTS } EquipmentType; -typedef enum -{ +typedef enum { /* 0x00 */ UPG_QUIVER, /* 0x01 */ UPG_BOMB_BAG, /* 0x02 */ UPG_STRENGTH, @@ -21,8 +19,7 @@ typedef enum /* 0x07 */ UPG_NUTS } UpgradeType; -typedef enum -{ +typedef enum { /* 0x00 */ SLOT_STICK, /* 0x01 */ SLOT_NUT, /* 0x02 */ SLOT_BOMB, @@ -50,8 +47,7 @@ typedef enum /* 0xFF */ SLOT_NONE = 0xFF } InventorySlot; -typedef enum -{ +typedef enum { /* 0x00 */ ITEM_STICK, /* 0x01 */ ITEM_NUT, /* 0x02 */ ITEM_BOMB, @@ -212,8 +208,7 @@ typedef enum } ItemID; // Get Item result may vary depending on context (chest/shop/scrub/drop) -typedef enum -{ +typedef enum { /* 0x00 */ GI_INVALID, // Link picks up chest and it sends him flying upwards /* 0x01 */ GI_BOMBS_5, /* 0x02 */ GI_NUTS_5, @@ -258,8 +253,8 @@ typedef enum /* 0x29 */ GI_SHIELD_DEKU, // or blue rupee if you have the shield /* 0x2A */ GI_SHIELD_HYLIAN, // or blue rupee if you have the shield /* 0x2B */ GI_SHIELD_MIRROR, - /* 0x2C */ GI_TUNIC_GORON, // or blue rupee if you have the tunic - /* 0x2D */ GI_TUNIC_ZORA, // or blue rupee if you have the tunic + /* 0x2C */ GI_TUNIC_GORON, // or blue rupee if you have the tunic + /* 0x2D */ GI_TUNIC_ZORA, // or blue rupee if you have the tunic /* 0x2E */ GI_BOOTS_IRON, /* 0x2F */ GI_BOOTS_HOVER, /* 0x30 */ GI_QUIVER_40, diff --git a/include/z64light.h b/include/z64light.h index 35e0bf818..68a2e6394 100644 --- a/include/z64light.h +++ b/include/z64light.h @@ -4,15 +4,13 @@ #include <ultra64.h> #include <ultra64/gbi.h> -typedef struct z_Light_t -{ +typedef struct z_Light_t { /* 0x0 */ struct LightInfo* info; /* 0x4 */ struct z_Light_t* prev; /* 0x8 */ struct z_Light_t* next; } z_Light; -typedef struct -{ +typedef struct { /* 0x0 */ z_Light* lightsHead; /* 0x4 */ u8 ambientRed; /* 0x5 */ u8 ambientGreen; @@ -24,21 +22,18 @@ typedef struct /* 0xC */ s16 unk_0C; } LightingContext; -typedef struct -{ +typedef struct { /* 0x000 */ int numOccupied; /* 0x004 */ int nextFree; /* 0x008 */ z_Light lights[32]; } LightsList; -typedef struct -{ +typedef struct { /* 0x0 */ u8 type; /* 0x2 */ u16 params[6]; } LightInfo; -typedef struct -{ +typedef struct { /* 0x0 */ s8 dirX; /* 0x1 */ s8 dirY; /* 0x2 */ s8 dirZ; @@ -48,8 +43,7 @@ typedef struct /* 0x6 */ u16 pad[3]; } LightInfoDirectionalParams; -typedef struct -{ +typedef struct { /* 0x0 */ s16 posX; /* 0x2 */ s16 posY; /* 0x4 */ s16 posZ; @@ -60,8 +54,7 @@ typedef struct /* 0xA */ s16 radius; } LightInfoPositionalParams; -typedef struct -{ +typedef struct { /* 0x00 */ u8 numLights; /* 0x01 */ u8 enablePosLights; /* 0x02 */ UNK_TYPE1 pad2[6]; @@ -69,14 +62,12 @@ typedef struct /* 0x10 */ Light lights[7]; } LightMapper; -typedef struct -{ +typedef struct { /* 0x0 */ u8 type; /* 0x2 */ LightInfoDirectionalParams params; } LightInfoDirectional; -typedef struct -{ +typedef struct { /* 0x0 */ u8 type; /* 0x2 */ LightInfoPositionalParams params; } LightInfoPositional; diff --git a/include/z64object.h b/include/z64object.h index 102190fe4..54271d82f 100644 --- a/include/z64object.h +++ b/include/z64object.h @@ -3,8 +3,7 @@ #define OBJECT_EXCHANGE_BANK_MAX 19 -typedef enum -{ +typedef enum { /* 0x0000 */ OBJECT_UNSET_0, /* 0x0001 */ OBJECT_GAMEPLAY_KEEP, /* 0x0002 */ OBJECT_GAMEPLAY_FIELD_KEEP, diff --git a/include/z64scene.h b/include/z64scene.h index 313565444..c80839587 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -1,8 +1,7 @@ #ifndef _Z64SCENE_H_ #define _Z64SCENE_H_ -typedef struct -{ +typedef struct { /* 0x00 */ u32 sceneVromStart; /* 0x04 */ u32 sceneVromEnd; /* 0x08 */ u32 titleVromStart; @@ -13,50 +12,43 @@ typedef struct /* 0x13 */ u8 unk_13; } Scene; // size = 0x14 -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ u32 data2; } SCmdBase; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ u32 segment; } SCmdSpawnList; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 num; /* 0x04 */ u32 segment; } SCmdActorList; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ u32 segment; } SCmdCsCameraList; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ u32 segment; } SCmdColHeader; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 num; /* 0x04 */ u32 segment; } SCmdRoomList; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x02 */ char pad[2]; @@ -66,71 +58,61 @@ typedef struct /* 0x07 */ u8 unk_07; } SCmdWindSettings; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ u32 segment; } SCmdEntranceList; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; - /* 0x01 */ u8 naviMsgNum; + /* 0x01 */ u8 cUpElfMsgNum; /* 0x04 */ u32 keepObjectId; } SCmdSpecialFiles; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 gpFlag1; /* 0x04 */ u32 gpFlag2; } SCmdRoomBehavior; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ u32 segment; } SCmdMesh; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 num; /* 0x04 */ u32 segment; } SCmdObjectList; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 num; /* 0x04 */ u32 segment; } SCmdLightList; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ u32 segment; } SCmdPathList; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 num; /* 0x04 */ u32 segment; } SCmdTransiActorList; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 num; /* 0x04 */ u32 segment; } SCmdLightSettingList; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x02 */ char pad[2]; @@ -139,8 +121,7 @@ typedef struct /* 0x06 */ u8 unk_06; } SCmdTimeSettings; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x02 */ char pad[2]; @@ -149,8 +130,7 @@ typedef struct /* 0x06 */ u8 unk_06; } SCmdSkyboxSettings; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x02 */ char pad[2]; @@ -158,22 +138,19 @@ typedef struct /* 0x05 */ u8 unk_05; } SCmdSkyboxDisables; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ u32 data2; } SCmdEndMarker; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ u32 segment; } SCmdExitList; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 bgmId; /* 0x02 */ char pad[4]; @@ -181,42 +158,36 @@ typedef struct /* 0x07 */ u8 musicSeq; } SCmdSoundSettings; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x02 */ char pad[5]; /* 0x07 */ u8 echo; } SCmdEchoSettings; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ u32 segment; } SCmdCutsceneData; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 data1; /* 0x04 */ u32 segment; } SCmdAltHeaders; -typedef struct -{ +typedef struct { /* 0x00 */ u8 code; /* 0x01 */ u8 cameraMovement; /* 0x04 */ u32 area; } SCmdMiscSettings; -typedef struct -{ +typedef struct { u8 headerType; } MeshHeaderBase; -typedef struct -{ +typedef struct { MeshHeaderBase base; u8 numEntries; @@ -224,174 +195,144 @@ typedef struct u32 dListEnd; } MeshHeader0; -typedef struct -{ +typedef struct { u32 opaqueDList; - u32 translucentDList; + u32 translucentDList; } MeshEntry0; -typedef struct -{ +typedef struct { MeshHeaderBase base; - u8 format; u32 entryRecord; } MeshHeader1Base; -typedef struct -{ +typedef struct { MeshHeader1Base base; - u32 imagePtr; // 0x08 - - u32 unknown; // 0x0C - u32 unknown2; // 0x10 - - u16 bgWidth; // 0x14 - u16 bgHeight; // 0x16 - - u8 imageFormat; // 0x18 - u8 imageSize; // 0x19 - u16 imagePal; // 0x1A - u16 imageFlip; // 0x1C - + u32 unknown; // 0x0C + u32 unknown2; // 0x10 + u16 bgWidth; // 0x14 + u16 bgHeight; // 0x16 + u8 imageFormat; // 0x18 + u8 imageSize; // 0x19 + u16 imagePal; // 0x1A + u16 imageFlip; // 0x1C } MeshHeader1Single; -typedef struct -{ +typedef struct { MeshHeader1Base base; - u8 bgCnt; u32 bgRecordPtr; - } MeshHeader1Multi; -typedef struct -{ +typedef struct { u16 unknown; // 0x00 - s8 bgID; // 0x02 - - u32 imagePtr; // 0x04 - u32 unknown2; // 0x08 - u32 unknown3; // 0x0C - - u16 bgWidth; // 0x10 - u16 bgHeight; // 0x12 - - u8 imageFmt; // 0x14 - u8 imageSize; // 0x15 - u16 imagePal; // 0x16 - u16 imageFlip; // 0x18 + s8 bgID; // 0x02 + u32 imagePtr; // 0x04 + u32 unknown2; // 0x08 + u32 unknown3; // 0x0C + u16 bgWidth; // 0x10 + u16 bgHeight; // 0x12 + u8 imageFmt; // 0x14 + u8 imageSize; // 0x15 + u16 imagePal; // 0x16 + u16 imageFlip; // 0x18 } BackgroundRecord; -typedef struct -{ - s16 playerXMax, playerZMax; - s16 playerXMin, playerZMin; - - u32 opaqueDList; - u32 translucentDList; +typedef struct { + s16 playerXMax, playerZMax; + s16 playerXMin, playerZMin; + u32 opaqueDList; + u32 translucentDList; } MeshEntry2; -typedef struct -{ +typedef struct { MeshHeaderBase base; - u8 numEntries; - u32 dListStart; - u32 dListEnd; + u32 dListStart; + u32 dListEnd; } MeshHeader2; -typedef struct -{ +typedef struct { u8 ambientClrR, ambientClrG, ambientClrB; - u8 diffuseClrA_R, diffuseClrA_G, diffuseClrA_B; u8 diffuseDirA_X, diffuseDirA_Y, diffuseDirA_Z; u8 diffuseClrB_R, diffuseClrB_G, diffuseClrB_B; u8 diffuseDirB_X, diffuseDirB_Y, diffuseDirB_Z; - u8 fogClrR, fogClrG, fogClrB; u16 unk; u16 drawDistance; } LightSettings; -typedef struct -{ +typedef struct { s16 absMinX, absMinY, absMinZ; s16 absMaxX, absMaxY, absMaxZ; - s16 numVerts; - s32 vtxSegmentOffset; - s16 numPolygons; - s32 polySegmentOffset; - s32 polyTypeDefSegmentOffset; - s32 camDataSegmentOffset; - - s16 numWaterBoxes; - s32 waterBoxSegmentOffset; + s16 numVerts; + s32 vtxSegmentOffset; + s16 numPolygons; + s32 polySegmentOffset; + s32 polyTypeDefSegmentOffset; + s32 camDataSegmentOffset; + s16 numWaterBoxes; + s32 waterBoxSegmentOffset; } ColHeader; -typedef struct -{ +typedef struct { s16 cameraSType; // 0x00 - s16 numCameras; // 0x02 - s32 camPosDataSeg; // 0x04 + s16 numCameras; // 0x02 + s32 camPosDataSeg; // 0x04 } CamData; -typedef struct -{ +typedef struct { u32 unknown; u32 camPosDataSeg; } CamPosDataEntry; /* -typedef union -{ +typedef union { _CamData data; long long int forceStructAlignment; } CamData; */ -typedef struct -{ +typedef struct { s16 posX, posY, posZ; - s16 rotX, rotY, rotZ; - s16 fov; - s16 jfifId; - s16 unk; - //s16 unk2; - //s32 unk; + s16 rotX, rotY, rotZ; + s16 fov; + s16 jfifId; + s16 unk; } CamPosData; /* -typedef union -{ +typedef union { _CamPosData data; long long int forceStructAlignment; } CamPosData; */ -typedef struct -{ +typedef struct { s16 type; - s16 vtxA, vtxB, vtxC; - s16 a, b, c, d; + s16 vtxA, vtxB, vtxC; + s16 a, b, c, d; } RoomPoly; -typedef struct -{ +typedef struct { s16 xMin; - s16 ySurface; - s16 zMin; - s16 xLength; - s16 zLength; - s32 properties; + s16 ySurface; + s16 zMin; + s16 xLength; + s16 zLength; + s32 properties; } WaterBoxHeader; -typedef union -{ +typedef struct { + /* 0x00 */ u8 count; // number of points in the path + /* 0x04 */ Vec3s* points; // Segment Address to the array of points +} Path; // size = 0x8 + +typedef union { SCmdBase base; SCmdSpawnList spawnList; SCmdActorList actorList; @@ -420,8 +361,7 @@ typedef union SCmdAltHeaders altHeaders; } SceneCmd; // size = 0x8 -typedef enum -{ +typedef enum { /* 0x00 */ SCENE_YDAN, /* 0x01 */ SCENE_DDAN, /* 0x02 */ SCENE_BDAN, diff --git a/include/z64vec.h b/include/z64vec.h new file mode 100644 index 000000000..cd703f9f0 --- /dev/null +++ b/include/z64vec.h @@ -0,0 +1,22 @@ +#ifndef _Z64VEC_H_ +#define _Z64VEC_H_ + +#include <ultra64.h> + +typedef struct { + f32 x, y; +} Vec2f; + +typedef struct { + f32 x, y, z; +} Vec3f; + +typedef struct { + s16 x, y, z; +} Vec3s; + +typedef struct { + s32 x, y, z; +} Vec3i; + +#endif |
