diff --git a/include/functions.h b/include/functions.h index 16cb75b151..87c84dd307 100644 --- a/include/functions.h +++ b/include/functions.h @@ -7,6 +7,9 @@ #include #include #include +#include +#include +#include UNK_RET start(void); // func_80080060 void Init_ClearMemory(UNK_PTR, UNK_PTR); // func_80080150 @@ -21,13 +24,13 @@ UNK_RET func_800805E0(UNK_TYPE); // func_800805E0 UNK_RET func_80080748(void); // func_80080748 s32 Dmamgr_DoDmaTransfer(void*, void*, s32); // func_80080790 void Dmamgr_osEPiStartDmaWrapper(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction); // func_800808D4 -DmadataEntry* Dmamgr_FindDmaEntry(u32); // func_800808F4 +z_DmadataEntry* Dmamgr_FindDmaEntry(u32); // func_800808F4 s32 Dmamgr_TranslateVromToRom(u32); // func_80080950 s32 Dmamgr_FindDmaIndex(u32); // func_800809BC UNK_TYPE* func_800809F4(u32); // func_800809F4 -void Dmamgr_HandleRequest(s80080A08*); // func_80080A08 +void Dmamgr_HandleRequest(z_DmaRequest*); // func_80080A08 void Dmamgr_ThreadEntry(void*); // func_80080B84 -s32 Dmamgr_SendRequest(s80080A08*, UNK_FUN_ARG, UNK_PTR, UNK_TYPE, UNK_TYPE, OSMesgQueue*, UNK_TYPE); // func_80080C04 +s32 Dmamgr_SendRequest(z_DmaRequest*, UNK_FUN_ARG, UNK_PTR, UNK_TYPE, UNK_TYPE, OSMesgQueue*, UNK_TYPE); // func_80080C04 s32 Dmamgr_SendRequestAndWait(UNK_TYPE, UNK_PTR, UNK_TYPE); // func_80080C90 void Dmamgr_Start(void); // func_80080D0C void Dmamgr_Stop(void); // func_80080E00 @@ -46,7 +49,7 @@ UNK_RET Irqmgr_HandlePrenmi3(UNK_ARGS); // func_80081550 UNK_RET Irqmgr_CheckThreadStatus(UNK_ARGS); // func_800815A8 UNK_RET Irqmgr_HandleFrame(UNK_ARGS); // func_800815CC UNK_RET Irqmgr_ThreadEntry(UNK_ARGS); // func_80081684 -UNK_RET Irqmgr_Start(UNK_PTR, s80085320*, UNK_TYPE, UNK_TYPE); // func_80081754 +UNK_RET Irqmgr_Start(UNK_PTR, z_ThreadInfo*, UNK_TYPE, UNK_TYPE); // func_80081754 void nop_80081820(void); // func_80081820 void nop_80081828(void); // func_80081828 void func_80081830(void); // func_80081830 @@ -139,11 +142,11 @@ UNK_RET func_80085204(UNK_ARGS); // func_80085204 UNK_RET func_8008520C(UNK_ARGS); // func_8008520C UNK_RET func_8008522C(UNK_ARGS); // func_8008522C UNK_RET func_8008524C(UNK_ARGS); // func_8008524C -void thread_info_init(s80085320*, UNK_PTR, UNK_PTR, UNK_TYPE, UNK_TYPE, UNK_PTR); // func_80085320 -UNK_RET func_800853F8(s80085320*); // func_800853F8 -UNK_TYPE get_thread_stack_status(s80085320*); // func_80085468 +void thread_info_init(z_ThreadInfo*, UNK_PTR, UNK_PTR, UNK_TYPE, UNK_TYPE, UNK_PTR); // func_80085320 +UNK_RET func_800853F8(z_ThreadInfo*); // func_800853F8 +UNK_TYPE get_thread_stack_status(z_ThreadInfo*); // func_80085468 UNK_TYPE check_all_thread_status(UNK_ARGS); // func_800854E0 -UNK_RET check_thread_status(s80085320*); // func_80085538 +UNK_RET check_thread_status(z_ThreadInfo*); // func_80085538 UNK_RET func_80085570(UNK_ARGS); // func_80085570 UNK_RET func_800859BC(UNK_ARGS); // func_800859BC UNK_RET func_80085A08(UNK_ARGS); // func_80085A08 @@ -493,11 +496,11 @@ UNK_RET func_80096880(UNK_ARGS); // func_80096880 u32 func_800968B0(const u8*, const u8*); // func_800968B0 UNK_RET func_80096930(UNK_ARGS); // func_80096930 UNK_RET EnAObj_Init(void*, UNK_TYPE); // func_800A5AC0 -UNK_RET EnAObj_Fini(s800A5AC0*, z_GlobalContext*); // func_800A5B6C -UNK_RET EnAObj_Update1(s800A5AC0*, UNK_TYPE); // func_800A5B98 -UNK_RET EnAObj_Update2(s800A5AC0*); // func_800A5C28 -UNK_RET EnAObj_Main(s800A5AC0*, UNK_TYPE); // func_800A5C60 -UNK_RET EnAObj_Draw(s800A5AC0*, UNK_TYPE); // func_800A5CB8 +UNK_RET EnAObj_Fini(z_ActorEnAObj*, z_GlobalContext*); // func_800A5B6C +UNK_RET EnAObj_Update1(z_ActorEnAObj*, UNK_TYPE); // func_800A5B98 +UNK_RET EnAObj_Update2(z_ActorEnAObj*); // func_800A5C28 +UNK_RET EnAObj_Main(z_ActorEnAObj*, UNK_TYPE); // func_800A5C60 +UNK_RET EnAObj_Draw(z_ActorEnAObj*, UNK_TYPE); // func_800A5CB8 UNK_RET EnItem00_UpdateForNewObjectId(UNK_ARGS); // func_800A5D00 UNK_RET EnItem00_Init(UNK_ARGS); // func_800A5D70 UNK_RET EnItem00_Fini(UNK_ARGS); // func_800A637C @@ -605,7 +608,7 @@ UNK_RET func_800B13D8(UNK_ARGS); // func_800B13D8 UNK_RET func_800B14D4(UNK_ARGS); // func_800B14D4 UNK_RET func_800B1598(UNK_ARGS); // func_800B1598 UNK_RET func_800B165C(UNK_ARGS); // func_800B165C -UNK_RET func_800B16B8(z_GlobalContext*, z_Vector3D*, UNK_PTR, UNK_PTR, UNK_PTR, UNK_PTR); // func_800B16B8 +UNK_RET func_800B16B8(z_GlobalContext*, z_Vector3f*, UNK_PTR, UNK_PTR, UNK_PTR, UNK_PTR); // func_800B16B8 UNK_RET EffectSS_LoadSparkle(UNK_ARGS); // func_800B16F4 UNK_RET func_800B1830(UNK_ARGS); // func_800B1830 UNK_RET EffectSS_LoadBomb2(UNK_ARGS); // func_800B1908 @@ -714,7 +717,7 @@ UNK_RET func_800B6608(UNK_ARGS); // func_800B6608 UNK_RET func_800B6680(UNK_ARGS); // func_800B6680 UNK_RET Actor_MarkForDeath(z_Actor*); // func_800B670C UNK_RET func_800B672C(UNK_ARGS); // func_800B672C -UNK_RET func_800B675C(s800A5AC0*, UNK_TYPE); // func_800B675C +UNK_RET func_800B675C(z_ActorEnAObj*, UNK_TYPE); // func_800B675C UNK_RET func_800B67A0(UNK_ARGS); // func_800B67A0 UNK_RET func_800B67C0(UNK_ARGS); // func_800B67C0 UNK_RET Actor_SetScale(z_Actor*, f32); // func_800B67E0 @@ -778,12 +781,12 @@ UNK_RET func_800B8248(UNK_ARGS); // func_800B8248 UNK_RET func_800B82EC(UNK_ARGS); // func_800B82EC UNK_RET func_800B83BC(UNK_ARGS); // func_800B83BC UNK_RET func_800B83F8(UNK_ARGS); // func_800B83F8 -UNK_TYPE func_800B84D0(s800A5AC0*, UNK_TYPE); // func_800B84D0 +UNK_TYPE func_800B84D0(z_ActorEnAObj*, UNK_TYPE); // func_800B84D0 UNK_RET func_800B8500(UNK_ARGS); // func_800B8500 UNK_RET func_800B85E0(UNK_ARGS); // func_800B85E0 UNK_RET func_800B8614(UNK_ARGS); // func_800B8614 -UNK_RET func_800B863C(s800A5AC0*, UNK_TYPE); // func_800B863C -UNK_TYPE func_800B867C(s800A5AC0*); // func_800B867C +UNK_RET func_800B863C(z_ActorEnAObj*, UNK_TYPE); // func_800B863C +UNK_TYPE func_800B867C(z_ActorEnAObj*); // func_800B867C UNK_RET func_800B86C8(UNK_ARGS); // func_800B86C8 UNK_RET func_800B8708(UNK_ARGS); // func_800B8708 UNK_RET func_800B8718(UNK_ARGS); // func_800B8718 @@ -888,7 +891,7 @@ UNK_RET func_800BDB6C(UNK_ARGS); // func_800BDB6C UNK_RET func_800BDC5C(UNK_ARGS); // func_800BDC5C UNK_RET func_800BDCF4(UNK_ARGS); // func_800BDCF4 UNK_RET func_800BDFB0(UNK_ARGS); // func_800BDFB0 -UNK_RET func_800BDFC0(UNK_TYPE, UNK_TYPE, UNK_TYPE, s800A5AC0*); // func_800BDFC0 +UNK_RET func_800BDFC0(UNK_TYPE, UNK_TYPE, UNK_TYPE, z_ActorEnAObj*); // func_800BDFC0 void func_800BE03C(z_GlobalContext*, UNK_TYPE); // func_800BE03C UNK_RET func_800BE0B8(UNK_ARGS); // func_800BE0B8 UNK_RET func_800BE184(UNK_ARGS); // func_800BE184 @@ -1620,7 +1623,7 @@ UNK_RET func_800F01C8(UNK_ARGS); // func_800F01C8 UNK_RET func_800F0390(UNK_ARGS); // func_800F0390 UNK_RET func_800F03C0(UNK_ARGS); // func_800F03C0 UNK_RET func_800F048C(UNK_ARGS); // func_800F048C -UNK_RET func_800F0568(z_GlobalContext*, z_Vector3D*, UNK_TYPE, UNK_TYPE); // func_800F0568 +UNK_RET func_800F0568(z_GlobalContext*, z_Vector3f*, UNK_TYPE, UNK_TYPE); // func_800F0568 UNK_RET func_800F0590(UNK_ARGS); // func_800F0590 UNK_RET func_800F05C0(UNK_ARGS); // func_800F05C0 UNK_RET func_800F07C0(UNK_ARGS); // func_800F07C0 @@ -1812,27 +1815,27 @@ UNK_RET func_800FF2F8(UNK_ARGS); // func_800FF2F8 UNK_RET func_800FF3A0(UNK_ARGS); // func_800FF3A0 s16 Lib_rand_s(s16 a0, s16 a1); // func_800FF450 s16 Lib_randStride_s(s16 a0, s16 a1, s16 a2); // func_800FF4A4 -UNK_RET Lib_CopyVec3f(z_Vector3D* dst, z_Vector3D* src); // func_800FF50C -UNK_RET Lib_CopyVec3s(z_Vector3Ds16* dst, z_Vector3Ds16* src); // func_800FF52C -UNK_RET Lib_ToVec3f(z_Vector3D* dst, z_Vector3Ds16* src); // func_800FF54C -UNK_RET Lib_ToVec3s(z_Vector3Ds16* dst, z_Vector3D* src); // func_800FF584 -UNK_RET Lib_AddVec3f(z_Vector3D* a0, z_Vector3D* a1, z_Vector3D* a2); // func_800FF5BC -UNK_RET Lib_SubVec3f(z_Vector3D* a0, z_Vector3D* a1, z_Vector3D* a2); // func_800FF5F4 -UNK_RET Lib_SubVec3sToVec3f(z_Vector3D* a0, z_Vector3Ds16* a1, z_Vector3Ds16* a2); // func_800FF62C -UNK_RET Lib_ScaleInPlaceVec3f(z_Vector3D* a0, f32 a1); // func_800FF688 -UNK_RET Lib_ScaleVec3f(z_Vector3D* a0, f32 a1, z_Vector3D* a2); // func_800FF6C4 -UNK_RET Lib_LerpVec3f(z_Vector3D* a0, z_Vector3D* a1, f32 a2, z_Vector3D* a3); // func_800FF6F8 -UNK_RET Lib_AddScaledVec3f(z_Vector3D* a0, z_Vector3D* a1, f32 a2, z_Vector3D* a3); // func_800FF750 -UNK_RET Lib_ModifyRandScaled(z_Vector3D* a0, f32 a1, z_Vector3D* a2); // func_800FF79C -UNK_RET Lib_ScaledNormalizedDifferenceVec3f(z_Vector3D* a0, z_Vector3D* a1, f32 a2, z_Vector3D* a3); // func_800FF810 -f32 Lib_DistanceVec3f(z_Vector3D* a0, z_Vector3D* a1); // func_800FF884 -f32 Lib_DistanceAndDifferenceVec3f(z_Vector3D* a0, z_Vector3D* a1, z_Vector3D* a2); // func_800FF8D4 -f32 Lib_DistanceXZVec3f(z_Vector3D* a0, z_Vector3D* a1); // func_800FF92C -f32 Lib_DistanceAndDifferenceXZVec3f(z_Vector3D* a0, z_Vector3D* a1, f32* a2, f32* a3); // func_800FF960 -UNK_RET Lib_PushAwayXZVec3f(z_Vector3D* a0, z_Vector3D* a1, f32 a2); // func_800FF9A4 -f32 Lib_DistanceYVec3f(z_Vector3D* a0, z_Vector3D* a1); // func_800FFA4C -UNK_TYPE Lib_YawVec3f(z_Vector3D* a0, z_Vector3D* a1); // func_800FFA60 -UNK_TYPE Lib_PitchVec3f(z_Vector3D* a0, z_Vector3D* a1); // func_800FFA94 +UNK_RET Lib_CopyVec3f(z_Vector3f* dst, z_Vector3f* src); // func_800FF50C +UNK_RET Lib_CopyVec3s(z_Vector3s* dst, z_Vector3s* src); // func_800FF52C +UNK_RET Lib_ToVec3f(z_Vector3f* dst, z_Vector3s* src); // func_800FF54C +UNK_RET Lib_ToVec3s(z_Vector3s* dst, z_Vector3f* src); // func_800FF584 +UNK_RET Lib_AddVec3f(z_Vector3f* a0, z_Vector3f* a1, z_Vector3f* a2); // func_800FF5BC +UNK_RET Lib_SubVec3f(z_Vector3f* a0, z_Vector3f* a1, z_Vector3f* a2); // func_800FF5F4 +UNK_RET Lib_SubVec3sToVec3f(z_Vector3f* a0, z_Vector3s* a1, z_Vector3s* a2); // func_800FF62C +UNK_RET Lib_ScaleInPlaceVec3f(z_Vector3f* a0, f32 a1); // func_800FF688 +UNK_RET Lib_ScaleVec3f(z_Vector3f* a0, f32 a1, z_Vector3f* a2); // func_800FF6C4 +UNK_RET Lib_LerpVec3f(z_Vector3f* a0, z_Vector3f* a1, f32 a2, z_Vector3f* a3); // func_800FF6F8 +UNK_RET Lib_AddScaledVec3f(z_Vector3f* a0, z_Vector3f* a1, f32 a2, z_Vector3f* a3); // func_800FF750 +UNK_RET Lib_ModifyRandScaled(z_Vector3f* a0, f32 a1, z_Vector3f* a2); // func_800FF79C +UNK_RET Lib_ScaledNormalizedDifferenceVec3f(z_Vector3f* a0, z_Vector3f* a1, f32 a2, z_Vector3f* a3); // func_800FF810 +f32 Lib_DistanceVec3f(z_Vector3f* a0, z_Vector3f* a1); // func_800FF884 +f32 Lib_DistanceAndDifferenceVec3f(z_Vector3f* a0, z_Vector3f* a1, z_Vector3f* a2); // func_800FF8D4 +f32 Lib_DistanceXZVec3f(z_Vector3f* a0, z_Vector3f* a1); // func_800FF92C +f32 Lib_DistanceAndDifferenceXZVec3f(z_Vector3f* a0, z_Vector3f* a1, f32* a2, f32* a3); // func_800FF960 +UNK_RET Lib_PushAwayXZVec3f(z_Vector3f* a0, z_Vector3f* a1, f32 a2); // func_800FF9A4 +f32 Lib_DistanceYVec3f(z_Vector3f* a0, z_Vector3f* a1); // func_800FFA4C +UNK_TYPE Lib_YawVec3f(z_Vector3f* a0, z_Vector3f* a1); // func_800FFA60 +UNK_TYPE Lib_PitchVec3f(z_Vector3f* a0, z_Vector3f* a1); // func_800FFA94 void Lib_ApplyActorInitVars(z_Actor*, z_ActorCompInitEntry*); // func_800FFADC UNK_RET Lib_ApplyActorInitVarByte1(u8* a0, z_ActorCompInitEntry* a1); // func_800FFB54 UNK_RET Lib_ApplyActorInitVarByte2(u8* a0, z_ActorCompInitEntry* a1); // func_800FFB70 @@ -1854,9 +1857,9 @@ UNK_RET Lib_CopyColor(u8* a0, u8* a1); // func_8010007C UNK_RET func_801000A4(u16 a0); // func_801000A4 UNK_RET func_801000CC(u16 a0); // func_801000CC UNK_RET func_801000F4(UNK_TYPE a0, u16 a1); // func_801000F4 -UNK_RET Lib_TranslateAndRotateYVec3f(z_Vector3D* a0, s16 a1, z_Vector3D* a2, z_Vector3D* a3); // func_8010011C +UNK_RET Lib_TranslateAndRotateYVec3f(z_Vector3f* a0, s16 a1, z_Vector3f* a2, z_Vector3f* a3); // func_8010011C UNK_RET Lib_LerpRGB(u8* a0, u8* a1, f32 a2, u8* a3); // func_801001B8 -f32 Lib_PushAwayVec3f(z_Vector3D* a0, z_Vector3D* a1, f32 a2); // func_80100448 +f32 Lib_PushAwayVec3f(z_Vector3f* a0, z_Vector3f* a1, f32 a2); // func_80100448 UNK_RET Lib_Nop801004FC(void); // func_801004FC UNK_TYPE Lib_PtrSegToPhys(u32 a0); // func_80100504 UNK_TYPE Lib_PtrSegToPhysNull(u32 a0); // func_8010053C @@ -1882,13 +1885,13 @@ UNK_RET Lights_MapperGetNextFreeSlot(UNK_ARGS); // func_80101D0C UNK_RET Lights_MapPositionalWithReference(UNK_ARGS); // func_80101D3C UNK_RET Lights_MapPositional(UNK_ARGS); // func_801020A0 UNK_RET Lights_MapDirectional(UNK_ARGS); // func_80102284 -UNK_RET Lights_MapLights(UNK_TYPE, UNK_TYPE, UNK_TYPE, z_GlobalContext*); // func_801022F0 +UNK_RET Lights_MapLights(UNK_TYPE, z_Light*, UNK_TYPE, z_GlobalContext*); // func_801022F0 UNK_RET Lights_FindFreeSlot(UNK_ARGS); // func_801023D8 UNK_RET Lights_Free(UNK_ARGS); // func_80102464 UNK_RET Lights_Init(UNK_ARGS); // func_801024AC UNK_RET Lights_SetAmbientColor(UNK_ARGS); // func_80102518 UNK_RET func_80102544(UNK_ARGS); // func_80102544 -UNK_TYPE Lights_CreateMapper(UNK_PTR, z_GraphicsContext*); // func_80102580 +UNK_TYPE Lights_CreateMapper(z_LightingContext*, z_GraphicsContext*); // func_80102580 UNK_RET Lights_ClearHead(UNK_ARGS); // func_801025B8 UNK_RET Lights_RemoveAll(UNK_ARGS); // func_801025C8 UNK_RET Lights_Insert(UNK_ARGS); // func_80102624 @@ -3250,7 +3253,7 @@ UNK_RET Math3D_XZLength(UNK_ARGS); // func_8017A610 UNK_RET Math3D_XZDistanceSquared(UNK_ARGS); // func_8017A634 UNK_RET Math3D_XZDistance(UNK_ARGS); // func_8017A678 UNK_RET Math3D_LengthSquared(UNK_ARGS); // func_8017A6A8 -f32 Math3D_Length(z_Vector3D*); // func_8017A6D4 +f32 Math3D_Length(z_Vector3f*); // func_8017A6D4 UNK_RET Math3D_DistanceSquared(UNK_ARGS); // func_8017A6F8 UNK_RET Math3D_Distance(UNK_ARGS); // func_8017A720 UNK_RET Math3D_DistanceS(UNK_ARGS); // func_8017A740 diff --git a/include/stdlib.h b/include/stdlib.h new file mode 100644 index 0000000000..f10cfef4ba --- /dev/null +++ b/include/stdlib.h @@ -0,0 +1,27 @@ +#ifndef _STDLIB_H_ +#define _STDLIB_H_ + +typedef struct { + /* 0x0 */ int quot; + /* 0x4 */ int rem; +} div_t; + + +typedef struct { + /* 0x0 */ long quot; + /* 0x4 */ long rem; +} ldiv_t; + + +typedef struct { + /* 0x0 */ long long quot; + /* 0x8 */ long long rem; +} lldiv_t; + +typedef unsigned int size_t; + +typedef int ssize_t; + +typedef long wchar_t; + +#endif diff --git a/include/structs.h b/include/structs.h index 39a3fa6098..b348d8914e 100644 --- a/include/structs.h +++ b/include/structs.h @@ -6,357 +6,1559 @@ #include #include -typedef struct s80085320_s { -/* 0x00 */ struct s80085320_s* next; -/* 0x04 */ struct s80085320_s* prev; -/* 0x08 */ UNK_TYPE* unk8; -/* 0x0C */ UNK_TYPE* unkC; -/* 0x10 */ UNK_TYPE unk10; -/* 0x14 */ UNK_TYPE unk14; -/* 0x18 */ UNK_TYPE* unk18; -} s80085320; +enum EffectSSType { + EFFECT_SS2_TYPE_DUST = 0x0, + EFFECT_SS2_TYPE_SPARKLE = 0x1, + EFFECT_SS2_TYPE_DELETED_2 = 0x2, + EFFECT_SS2_TYPE_BOMB2 = 0x3, + EFFECT_SS2_TYPE_BLAST = 0x4, + EFFECT_SS2_TYPE_G_SPARK = 0x5, + EFFECT_SS2_TYPE_DODONGO_FIRE = 0x6, + EFFECT_SS2_TYPE_BUBBLE = 0x7, + EFFECT_SS2_TYPE_DELETED_8 = 0x8, + EFFECT_SS2_TYPE_G_RIPPLE = 0x9, + EFFECT_SS2_TYPE_G_SPLASH = 0xA, + EFFECT_SS2_TYPE_DELETED_B = 0xB, + EFFECT_SS2_TYPE_G_FIRE = 0xC, + EFFECT_SS2_TYPE_LIGHTNING = 0xD, + EFFECT_SS2_TYPE_BIG_OCTO_BUBBLE = 0xE, + EFFECT_SS2_TYPE_FRAGMENT = 0xF, + EFFECT_SS2_TYPE_STICK = 0x10, + EFFECT_SS2_TYPE_SPLASH = 0x11, + EFFECT_SS2_TYPE_DELETED_12 = 0x12, + EFFECT_SS2_TYPE_DELETED_13 = 0x13, + EFFECT_SS2_TYPE_STONE1 = 0x14, + EFFECT_SS2_TYPE_HIT_MARK = 0x15, + EFFECT_SS2_TYPE_PHANTOM_GANON_FLASH = 0x16, + EFFECT_SS2_TYPE_KAKARIKO_FIRE = 0x17, + EFFECT_SS2_TYPE_SOLDIER_SEARCH_BALL = 0x18, + EFFECT_SS2_TYPE_SHARD = 0x19, + EFFECT_SS2_TYPE_ICE_PIECE = 0x1A, + EFFECT_SS2_TYPE_ENEMY_ICE = 0x1B, + EFFECT_SS2_TYPE_FIRE_TAIL = 0x1C, + EFFECT_SS2_TYPE_ENEMY_FIRE = 0x1D, + EFFECT_SS2_TYPE_EXTRA = 0x1E, + EFFECT_SS2_TYPE_DELETED_1F = 0x1F, + EFFECT_SS2_TYPE_DEAD_DEKU_BABA = 0x20, + EFFECT_SS2_TYPE_DEAD_DODONGO = 0x21, + EFFECT_SS2_TYPE_DEAD_DEKU_SCRUB = 0x22, + EFFECT_SS2_TYPE_DELETED_23 = 0x23, + EFFECT_SS2_TYPE_ICE_SMOKE = 0x24, + EFFECT_SS2_TYPE_ICE_BLOCK = 0x25, + EFFECT_SS2_TYPE_SBN = 0x26, + EFFECT_SS2_TYPE_LAST_LABEL = 0x27 +}; + +enum IRQ_MSG_TYPE { + IRQ_VERTICAL_RETRACE_MSG = 0x1, + IRQ_PRENMI_2_MSG = 0x3, + IRQ_PRENMI_1_MSG = 0x4 +}; + +enum IRQ_TYPE { + IRQ_VERTICAL_RETRACE = 0x29A, + IRQ_SP = 0x29B, + IRQ_DP = 0x29C, + IRQ_PRENMI_1 = 0x29D, + IRQ_PRENMI_2 = 0x29F, + IRQ_PRENMI_3 = 0x2A0, + IRQ_PRENMI_4 = 0x2A1 +}; + +enum THREAD_STACK_STATUS { + THREAD_STACK_STATUS_GOOD = 0x0, + THREAD_STACK_STATUS_WARNING = 0x1, + THREAD_STACK_STATUS_FULL = 0x2 +}; typedef struct { -/* 0x0 */ UNK_TYPE unk0; -/* 0x4 */ UNK_TYPE unk4; -/* 0x8 */ UNK_TYPE unk8; -/* 0xC */ UNK_TYPE unkC; -} s8008A6FC; +/* 0x0 */ unsigned int inst1; +/* 0x4 */ unsigned int inst2; +/* 0x8 */ unsigned int inst3; +/* 0xC */ unsigned int inst4; +} __osExceptionVector; -// TODO this should extend from z_Actor -typedef struct s800A5AC0_s { - /* 0x000 */ u8 pad0[0x1C]; - /* 0x01C */ s16 unk1C; - /* 0x01E */ u8 pad1[0x74]; - /* 0x092 */ s16 unk92; - /* 0x094 */ u8 pad2[0x22]; - /* 0x0B6 */ u8 unkB6; - /* 0x0B7 */ u8 pad4[5]; - /* 0x0BC */ u16 unkBC; // or char - /* 0x0BE */ s16 unkBE; - /* 0x0C0 */ u8 pad5[0x56]; - /* 0x116 */ u16 unk116; - /* 0x118 */ u8 pad6[0x2C]; - /* 0x144 */ void(*unk144)(struct s800A5AC0_s*, UNK_TYPE); - /* 0x148 */ UNK_TYPE unk148; -} s800A5AC0; +typedef void(*func_ptr)(void); + +typedef void(*osCreateThread_func)(void*); typedef struct { - /* 0x00 */ u8 pad0[8]; - /* 0x08 */ UNK_TYPE unk8; - /* 0x0C */ UNK_TYPE unkC; - /* 0x10 */ u32 unk10; - /* 0x14 */ u8 pad1[0xA]; - /* 0x1E */ s8 unk1E; - /* 0x1F */ u8 pad2[1]; -} s800BF9A0; +/* 0x000 */ OSThread unk0; +/* 0x1B0 */ UNK_TYPE1 pad1B0[1536]; +/* 0x7B0 */ OSMesgQueue unk7B0; +/* 0x7C8 */ UNK_TYPE4 unk7C8; +/* 0x7CC */ u8 unk7CC; +/* 0x7CD */ u8 unk7CD; +/* 0x7CE */ u8 unk7CE; +/* 0x7CF */ u8 unk7CF; +/* 0x7D0 */ UNK_TYPE4 unk7D0; +/* 0x7D4 */ func_ptr unk7D4; +/* 0x7D8 */ UNK_TYPE4 unk7D8; +/* 0x7DC */ UNK_TYPE1 pad7DC[108]; +} s80083BC4; typedef struct { - /* 0x00 */ UNK_TYPE unk0; - /* 0x04 */ UNK_TYPE unk4; - /* 0x08 */ UNK_TYPE unk8; - /* 0x12 */ u8 pad0[0x5C]; - /* 0x68 */ UNK_TYPE unk68; - /* 0x6C */ UNK_TYPE unk6C; - /* 0x70 */ UNK_TYPE unk70; - /* 0x72 */ u16 unk72; - /* 0x74 */ u16 unk74; - /* 0x76 */ u16 unk76; - /* 0x78 */ u8 pad1[2]; - /* 0x7C */ f32 unk7C; - /* 0x80 */ f32 unk80; - /* 0x84 */ f32 unk84; - /* 0x88 */ UNK_TYPE unk88; - /* 0x8C */ UNK_TYPE unk8C; - /* 0x90 */ UNK_TYPE unk90; - /* 0x94 */ u16 unk94; - /* 0x96 */ u16 unk96; - /* 0x98 */ u16 unk98; - /* 0x9A */ u8 pad2[2]; - /* 0x9C */ f32 unk9C; - /* 0xA0 */ f32 unkA0; - /* 0xA4 */ f32 unkA4; +/* 0x00 */ UNK_TYPE4 unk0; +/* 0x04 */ UNK_TYPE4 unk4; +/* 0x08 */ UNK_TYPE4 unk8; +/* 0x0C */ UNK_TYPE1 padC[92]; +/* 0x68 */ f32 unk68; +/* 0x6C */ f32 unk6C; +/* 0x70 */ f32 unk70; +/* 0x74 */ u16 unk74; +/* 0x76 */ u16 unk76; +/* 0x78 */ u16 unk78; +/* 0x7A */ UNK_TYPE1 pad7A[2]; +/* 0x7C */ f32 unk7C; +/* 0x80 */ f32 unk80; +/* 0x84 */ f32 unk84; +/* 0x88 */ f32 unk88; +/* 0x8C */ f32 unk8C; +/* 0x90 */ f32 unk90; +/* 0x94 */ u16 unk94; +/* 0x96 */ u16 unk96; +/* 0x98 */ u16 unk98; +/* 0x9A */ UNK_TYPE1 pad9A[2]; +/* 0x9C */ f32 unk9C; +/* 0xA0 */ f32 unkA0; +/* 0xA4 */ f32 unkA4; } s800CAAD0; typedef struct { - /* 0x00 */ u8 pad[0x20]; +/* 0x00 */ UNK_TYPE1 pad0[32]; } s800E03A0; -// Entries in dmadata typedef struct { - /* 0x0 */ u32 vromStart; - /* 0x4 */ u32 vromEnd; - /* 0x8 */ u32 romStart; - /* 0xC */ u32 romEnd; -} DmadataEntry; +/* 0x000 */ OSThread unk0; +/* 0x1B0 */ s8 argCount; +/* 0x1B1 */ s8 unk1B1; +/* 0x1B2 */ UNK_TYPE1 pad1B2[2]; +/* 0x1B4 */ UNK_TYPE1 func; +/* 0x1B5 */ UNK_TYPE1 pad1B5[3]; +/* 0x1B8 */ s32 arg0; +/* 0x1BC */ s32 arg1; +} s8018571C; typedef struct { - /* 0x00 */ UNK_PTR unk0; - /* 0x04 */ UNK_FUN_PTR(unk4); - /* 0x08 */ UNK_TYPE unk8; - /* 0x0C */ u8 pad1[8]; - /* 0x14 */ UNK_TYPE unk14; - /* 0x18 */ OSMesgQueue* unk18; - /* 0x1C */ UNK_TYPE unk1C; -} s80080A08; - -// This struct is huge! Global context? -typedef struct { - /* 0x00000 */ u8 pad[0x167F8]; - /* 0x167F8 */ u8 unk167F8; -} s800F4F54; +/* 0x00 */ int unk0; +/* 0x04 */ void* unk4; +/* 0x08 */ int unk8; +/* 0x0C */ int unkC; +/* 0x10 */ int unk10; +/* 0x14 */ OSMesgQueue unk14; +} s80185D40; typedef struct { - /* 0x0 */ f32 x; - /* 0x4 */ f32 y; - /* 0x8 */ f32 z; -} z_Vector3D; - -// Rotation? -// 3D Vector of s16? -typedef struct { - /* 0x0 */ s16 x; - /* 0x2 */ s16 y; - /* 0x4 */ s16 z; -} z_Vector3Ds16; - -struct z_Actor; - -typedef void(*z_ActorFunc)(struct z_Actor*, void*); +/* 0x00 */ UNK_TYPE1 pad0[20]; +} s801FE7C0; typedef struct { - /* 0x000 */ u8 pad0[4]; - /* 0x004 */ UNK_TYPE unk4; - /* 0x008 */ z_Vector3D unk8; // Pos1? - /* 0x014 */ u8 pad1[0x8]; - /* 0x01C */ s16 unk1C; - /* 0x01E */ u8 pad2[0x6]; - /* 0x024 */ z_Vector3D unk24; // Pos2? - /* 0x030 */ u8 pad3[0x28]; - /* 0x058 */ z_Vector3D unk58; // scale? - /* 0x064 */ u8 pad4[0x2E]; - /* 0x092 */ s16 unk92; - /* 0x094 */ u8 pad5[0x22]; - /* 0x0B6 */ u8 unkB6; - /* 0x0B7 */ u8 pad6[5]; - /* 0x0BC */ u16 unkBC; // or char - /* 0x0BE */ s16 unkBE; - /* 0x0C0 */ u8 pad7[0x2C]; - /* 0x0EC */ UNK_TYPE unkEC; - /* 0x0F0 */ u8 pad8[0xC]; - /* 0x0FC */ f32 unkFC; // start of z_Vector3D? - /* 0x100 */ f32 unk100; - /* 0x104 */ f32 unk104; - /* 0x108 */ u8 pad9[0xE]; - /* 0x116 */ u16 unk116; - /* 0x118 */ u8 pad10[0x24]; - /* 0x13C */ z_ActorFunc drawFunc; - /* 0x140 */ u8 pad11[4]; - // TODO figure out what size this is -} z_Actor; +/* 0x00 */ u8 unk0[32]; +} z_ActorDamageChart; typedef struct { - /* 0x000 */ u8 pad0[0x2B0]; - /* 0x2B0 */ Gfx* unk2B0; // OVERLAY_DISP append address - /* 0x2B4 */ u8 pad1[0xC]; - /* 0x2C0 */ Gfx* unk2C0; // POLY_OPA_DISP append address +/* 0x00 */ s32 unk0; +/* 0x04 */ s32 unk4; +/* 0x08 */ f32 unk8; +/* 0x0C */ f32 unkC; +/* 0x10 */ f32 unk10; +/* 0x14 */ f32 unk14; +/* 0x18 */ f32 unk18; +/* 0x1C */ f32 unk1C; +/* 0x20 */ f32 unk20; +/* 0x24 */ f32 unk24; +/* 0x28 */ f32 unk28; +/* 0x2C */ f32 unk2C; +/* 0x30 */ s16 unk30; +/* 0x32 */ s16 unk32; +/* 0x34 */ s16 unk34; +/* 0x36 */ s16 unk36; +/* 0x38 */ s16 unk38; +/* 0x3A */ s16 unk3A; +} z_ActorEnTest20C; + +typedef struct { +/* 0x0 */ u16 info; // bitfield: 0-10: offset, 11-14: type, 15: more +/* 0x2 */ s16 value; +} z_ActorInitVar; + +typedef struct { +/* 0x0 */ u32 unk0; +/* 0x4 */ u8 unk4; +/* 0x5 */ u8 unk5; +} z_ColBumpInit; + +typedef struct { +/* 0x0 */ u8 unk0; +/* 0x1 */ u8 unk1; +/* 0x2 */ u8 unk2; +/* 0x3 */ u8 unk3; +/* 0x4 */ u8 unk4; +/* 0x5 */ u8 type; +} z_ColCommonInit; + +typedef struct { +/* 0x0 */ u32 collidesWith; +/* 0x4 */ u8 unk4; +/* 0x5 */ u8 unk5; +} z_ColTouch; + +typedef struct { +/* 0x0 */ u32 unk0; +/* 0x4 */ u8 unk4; +/* 0x5 */ u8 unk5; +} z_ColTouchInit; + +typedef struct { +/* 0x0 */ u8 red; +/* 0x1 */ u8 green; +/* 0x2 */ u8 blue; +/* 0x3 */ u8 alpha; +} z_Color; + +typedef struct { +/* 0x00 */ u8 cutsceneCount; +/* 0x01 */ UNK_TYPE1 pad1[3]; +/* 0x04 */ u16* currentCutsceneData; +/* 0x08 */ u8 state; +/* 0x09 */ UNK_TYPE1 pad9[3]; +/* 0x0C */ f32 unkC; +/* 0x10 */ u16 currentFrame; +/* 0x12 */ UNK_TYPE1 pad12[22]; +/* 0x28 */ UNK_TYPE4 unk28[10]; +} z_CutsceneContext; + +typedef struct { +/* 0x0 */ u32 data; +/* 0x4 */ UNK_TYPE1 pad4[4]; +} z_CutsceneEntry; + +typedef struct { +/* 0x0 */ u32 size; +/* 0x4 */ void* unk4; +/* 0x8 */ Gfx* append; +/* 0xC */ void* appendEnd; +} z_DisplayList; + +typedef struct { +/* 0x00 */ u32 vromStart; +/* 0x04 */ u32 vramStart; +/* 0x08 */ u32 size; +/* 0x0C */ UNK_TYPE1 padC[8]; +/* 0x14 */ UNK_TYPE4 unk14; +/* 0x18 */ OSMesgQueue* callback; +/* 0x1C */ void* callbackMesg; +} z_DmaRequest; + +typedef struct { +/* 0x0 */ u32 vromStart; +/* 0x4 */ u32 vromEnd; +/* 0x8 */ u32 romStart; +/* 0xC */ u32 romEnd; +} z_DmadataEntry; + +typedef struct { +/* 0x0 */ s16 x; +/* 0x2 */ s16 y; +/* 0x4 */ s16 z; +/* 0x6 */ s16 reserved; +/* 0x8 */ s16 s; +/* 0xA */ s16 t; +/* 0xC */ s8 r; +/* 0xD */ s8 g; +/* 0xE */ s8 b; +/* 0xF */ s8 a; +} z_F3DVertexColor; + +typedef struct { +/* 0x0 */ s16 x; +/* 0x2 */ s16 y; +/* 0x4 */ s16 z; +/* 0x6 */ s16 reserved; +/* 0x8 */ s16 s; +/* 0xA */ s16 t; +/* 0xC */ s8 normalX; +/* 0xD */ s8 normalY; +/* 0xE */ s8 normalZ; +/* 0xF */ s8 a; +} z_F3DVertexNormal; + +typedef struct { +/* 0x0 */ UNK_TYPE4 size; +/* 0x4 */ void* heapStart; +/* 0x8 */ void* heapAppendStart; +/* 0xC */ void* heapAppendEnd; +} z_GameStateHeap; + +typedef struct { +/* 0x00 */ u32 ramLocation; +/* 0x04 */ u32 vromStart; +/* 0x08 */ u32 vromEnd; +/* 0x0C */ u32 vramStart; +/* 0x10 */ u32 vramEnd; +/* 0x14 */ UNK_TYPE4 unk14; +/* 0x18 */ func_ptr init; +/* 0x1C */ func_ptr fini; +/* 0x20 */ UNK_TYPE4 unk20; +/* 0x24 */ UNK_TYPE4 unk24; +/* 0x28 */ UNK_TYPE4 unk28; +/* 0x2C */ u32 size; +} z_GameStateMetaInfo; + +typedef struct { +/* 0x00 */ s32 unk0; +/* 0x04 */ UNK_TYPE1 pad4[64]; +} z_GlobalContext17d98; + +typedef struct { +/* 0x000 */ UNK_TYPE1 pad0[104]; +/* 0x068 */ f32 unk68; +/* 0x06C */ f32 unk6C; +/* 0x070 */ f32 unk70; +/* 0x074 */ UNK_TYPE1 pad74[12]; +/* 0x080 */ f32 unk80; +/* 0x084 */ f32 unk84; +/* 0x088 */ f32 unk88; +/* 0x08C */ UNK_TYPE1 pad8C[52]; +/* 0x0C0 */ f32 unkC0; +/* 0x0C4 */ f32 unkC4; +/* 0x0C8 */ f32 unkC8; +/* 0x0CC */ f32 unkCC; +/* 0x0D0 */ f32 unkD0; +/* 0x0D4 */ f32 unkD4; +/* 0x0D8 */ UNK_TYPE1 padD8[36]; +/* 0x0FC */ f32 unkFC; +/* 0x100 */ f32 unk100; +/* 0x104 */ UNK_TYPE1 pad104[52]; +/* 0x138 */ u16 unk138; +/* 0x13A */ UNK_TYPE1 pad13A[4]; +/* 0x13E */ u16 unk13E; +/* 0x140 */ s16 unk140; +/* 0x142 */ s16 unk142; +/* 0x144 */ UNK_TYPE1 pad144[4]; +/* 0x148 */ s16 unk148; +/* 0x14A */ UNK_TYPE1 pad14A[2]; +/* 0x14C */ s16 unk14C; +/* 0x14E */ UNK_TYPE1 pad14E[6]; +/* 0x154 */ s16 unk154; +/* 0x156 */ UNK_TYPE1 pad156[16]; +/* 0x166 */ s16 unk166; +/* 0x168 */ UNK_TYPE1 pad168[16]; +} z_GlobalContext220; + +// Font textures are loaded into here +typedef struct { +/* 0x0000 */ u8 unk0[128][120][2]; +/* 0x7800 */ u8 unk7800[128][93]; +} z_GlobalContext4A70; + +typedef struct { +/* 0x000 */ Gfx* polyOpaBuffer; +/* 0x004 */ Gfx* polyXluBuffer; +/* 0x008 */ UNK_TYPE1 pad8[8]; +/* 0x010 */ Gfx* overlayBuffer; +/* 0x014 */ UNK_TYPE1 pad14[36]; +/* 0x038 */ UNK_TYPE4 unk38[8]; +/* 0x058 */ UNK_TYPE1 pad58[4]; +/* 0x05C */ OSMesgQueue unk5C; +/* 0x074 */ UNK_TYPE1 pad74[300]; +/* 0x1A0 */ Gfx* unk1A0; +/* 0x1A4 */ z_DisplayList unk1A4; +/* 0x1B4 */ Gfx* unk1B4; +/* 0x1B8 */ z_DisplayList unk1B8; +/* 0x1C8 */ UNK_TYPE1 pad1C8[172]; +/* 0x274 */ OSViMode* unk274; +/* 0x278 */ UNK_TYPE1 pad278[32]; +/* 0x298 */ z_DisplayList overlay; +/* 0x2A8 */ z_DisplayList polyOpa; +/* 0x2B8 */ z_DisplayList polyXlu; +/* 0x2C8 */ s32 displaylistCounter; +/* 0x2CC */ void* framebuffer; +/* 0x2D0 */ UNK_TYPE1 pad2D0[11]; +/* 0x2DB */ u8 framebufferCounter; +/* 0x2DC */ UNK_TYPE1 pad2DC[8]; +/* 0x2E4 */ f32 unk2E4; +/* 0x2E8 */ f32 unk2E8; +/* 0x2EC */ UNK_TYPE1 pad2EC[4]; } z_GraphicsContext; -// Some structure pointed to by Global Context + 0x1CCC; typedef struct { - /* 0x000 */ u8 pad0[0x24]; - /* 0x024 */ z_Vector3D unk24; - /* 0x030 */ u8 pad1[0xA44]; - /* 0xA74 */ UNK_TYPE unkA74; -} sGlobalContext1CCC; +/* 0x0 */ u16 buttons; +/* 0x2 */ s8 xAxis; +/* 0x3 */ s8 yAxis; +/* 0x4 */ s16 unk4; +} z_InputInfo; typedef struct { - /* 0x00000 */ z_GraphicsContext* unk0; - /* 0x00004 */ u8 pad0[0x70]; - /* 0x00074 */ UNK_TYPE unk74; - /* 0x00078 */ u8 pad1[0x07A0]; - /* 0x00818 */ UNK_TYPE unk818; - /* 0x0081C */ u8 pad2[0x64]; - /* 0x00880 */ UNK_TYPE unk880; - /* 0x00884 */ u8 pad3[0x141C]; - /* 0x01CA0 */ UNK_TYPE unk1CA0; - /* 0x01CA4 */ u8 pad4[0x28]; - /* 0x01CCC */ sGlobalContext1CCC* unk1CCC; - /* 0x01CD0 */ u8 pad5[0x15330]; - /* 0x17000 */ u16 unk17000; - /* 0x17002 */ u8 pad6[0xD86]; - /* 0x17D88 */ UNK_TYPE unk17D88; - /* 0x17D8C */ u8 pad7[0xAB4]; - /* 0x18840 */ UNK_TYPE unk18840; - /* 0x18844 */ u8 pad8[0x40]; - /* 0x18884 */ UNK_TYPE unk18884; -} z_GlobalContext; +/* 0x00 */ z_InputInfo current; +/* 0x06 */ z_InputInfo last; +/* 0x0C */ z_InputInfo pressEdge; +/* 0x12 */ z_InputInfo releaseEdge; +} z_InputStruct; typedef struct { - u32 cont : 1; - u32 type : 4; - u32 offset : 11; - s32 value : 16; -} z_ActorCompInitEntry; +/* 0x0 */ u8 type; +/* 0x2 */ u16 params[6]; +} z_LightInfo; 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 - /* 0x04 */ s32 flags; // unknown - /* 0x08 */ s16 objectId; // Possibly it's primary object dependency - /* 0x0A */ // Padding - /* 0x0C */ u32 instanceSize; - /* 0x10 */ z_ActorFunc init; // Constructor - /* 0x14 */ z_ActorFunc fini; // Destructor - /* 0x18 */ z_ActorFunc main; // Main Update Function - /* 0x1C */ z_ActorFunc draw; // Draw function -} z_ActorInit; - -// TODO probably an actor? -typedef struct { - /* 0x000 */ u8 pad0[3]; - /* 0x003 */ s8 unk3; - /* 0x004 */ UNK_TYPE unk4; - /* 0x008 */ u8 pad1[0x10]; - /* 0x018 */ s16 unk18; - /* 0x01A */ u8 pad2[2]; - /* 0x01C */ volatile s16 unk1C; //! ...is this volatile??? It makes func_800A5D70 match :/ - /* 0x01E */ u8 unk1E; - /* 0x01F */ u8 pad3[0x05]; - /* 0x024 */ z_Vector3D unk24; - /* 0x030 */ s16 unk30; - /* 0x032 */ s16 unk32; - /* 0x034 */ u8 pad4[8]; - /* 0x03C */ z_Vector3D unk3C; - /* 0x048 */ u8 pad5[0x10]; - /* 0x058 */ f32 unk58; - /* 0x05C */ f32 unk5C; - /* 0x060 */ f32 unk60; - /* 0x064 */ u8 pad6[4]; - /* 0x068 */ f32 unk68; - /* 0x06C */ u8 pad7[4]; - /* 0x070 */ f32 unk70; - /* 0x074 */ f32 unk74; - /* 0x078 */ u8 pad8[0x10]; - /* 0x088 */ f32 unk88; - /* 0x08C */ u8 pad9[4]; - /* 0x090 */ u16 unk90; - /* 0x092 */ u16 unk92; - /* 0x094 */ u8 pad10[4]; - /* 0x098 */ f32 unk98; - /* 0x09C */ f32 unk9C; - /* 0x0A0 */ u8 pad11[0x1C]; - /* 0x0BC */ s16 unkBC; - /* 0x0BE */ s16 unkBE; - /* 0x0C0 */ s16 unkC0; - /* 0x0C2 */ u8 pad12[2]; - /* 0x0C4 */ f32 unkC4; - /* 0x0C8 */ u8 pad13[8]; - /* 0x0D0 */ u8 unkD0; - /* 0x0D1 */ u8 pad14[0x4D]; - /* 0x11E */ u8 unk11E; - /* 0x11F */ u8 pad15[0x25]; - /* 0x144 */ UNK_FUN_PTR(unk144); - /* 0x148 */ s16 unk148; - /* 0x14A */ s16 unk14A; - /* 0x14C */ s16 unk14C; - /* 0x14E */ s16 unk14E; - /* 0x150 */ s16 unk150; - /* 0x152 */ s16 unk152; - /* 0x154 */ f32 unk154; - /* 0x158 */ UNK_TYPE unk158; - /* 0x15C */ u8 pad16[0x48]; - /* 0x1A4 */ u8 unk1A4; -} s800A5D00; +/* 0x0 */ s8 dirX; +/* 0x1 */ s8 dirY; +/* 0x2 */ s8 dirZ; +/* 0x3 */ u8 red; +/* 0x4 */ u8 green; +/* 0x5 */ u8 blue; +/* 0x6 */ u16 pad[3]; +} z_LightInfoDirectionalParams; typedef struct { - /* 0x00 */ z_Vector3D position; - /* 0x0C */ z_Vector3D velocity; - /* 0x18 */ z_Vector3D acceleration; - /* 0x24 */ void(*update)(z_GlobalContext*); - /* 0x28 */ void(*draw)(z_GlobalContext*); - /* 0x2C */ f32 unk2C; // Probaly a z_Vector3D - /* 0x30 */ f32 unk30; - /* 0x34 */ f32 unk34; - /* 0x38 */ u32 unk38; - /* 0x3C */ u32 unk3C; - /* 0x42 */ u16 unk40[13]; - /* 0x5A */ u16 flags; // bit 0: set if this entry is not considered free on a priority tie bit 1: ? bit 2: ? - /* 0x5C */ s16 life; // -1 means this entry is free - /* 0x5E */ u8 priority; // Lower value means higher priority - /* 0x5F */ u8 type; -} z_LoadedParticleEntry; +/* 0x0 */ s16 posX; +/* 0x2 */ s16 posY; +/* 0x4 */ s16 posZ; +/* 0x6 */ u8 red; +/* 0x7 */ u8 green; +/* 0x8 */ u8 blue; +/* 0x9 */ u8 unk9; // func_80102880 sets this only for type 2, func_80102A64 draws something if this is set +/* 0xA */ s16 radius; +} z_LightInfoPositionalParams; typedef struct { - /* 0x0 */ u32 unk0; - /* 0x4 */ u32(*init)(z_GlobalContext*, u32, z_LoadedParticleEntry*, void*); +/* 0x00 */ u8 enablePosLights; +/* 0x01 */ u8 numLights; +/* 0x02 */ UNK_TYPE1 pad2[6]; +/* 0x08 */ Ambient ambient; +/* 0x10 */ Light lights[7]; +} z_LightMapper; + +typedef struct { +/* 0x00 */ f32 x[4]; +/* 0x10 */ f32 y[4]; +/* 0x20 */ f32 z[4]; +/* 0x30 */ f32 w[4]; +} z_Matrix; + +typedef struct { +/* 0x0 */ u32 vromStart; +/* 0x4 */ u32 vromEnd; +} z_ObjectFileTableEntry; + +typedef struct { +/* 0x00 */ u32 textSize; +/* 0x04 */ u32 dataSize; +/* 0x08 */ u32 rodataSize; +/* 0x0C */ u32 bssSize; +/* 0x10 */ u32 amountOfRelocations; +} z_OverlayBlockSizes; + +typedef struct { +/* 0x0 */ u8 red; +/* 0x1 */ u8 green; +/* 0x2 */ u8 blue; +} z_RGB; + +typedef struct { +/* 0x00 */ s16 intPart[16]; +/* 0x20 */ u16 fracPart[16]; +} z_RSPMatrix; + +typedef struct { +/* 0x0 */ u32 vromStart; +/* 0x4 */ u32 vromEnd; +} z_RoomFileLocation; + +typedef struct { +/* 0x00 */ u8 zelda[6]; // Will always be "ZELDA3" for a valid save +/* 0x06 */ UNK_TYPE1 pad6[34]; +} z_SaveContext_struct1; + +typedef struct { +/* 0x00 */ UNK_TYPE1 pad0[34]; +} z_SaveContext_struct2; + +typedef struct { +/* 0x00 */ UNK_TYPE1 pad0[136]; +} z_SaveContext_struct3; + +typedef struct { +/* 0x0 */ UNK_TYPE1 pad0[16]; +} z_SceneActorInit; + +typedef struct { +/* 0x0 */ u8 command; +/* 0x1 */ u8 unk1; +/* 0x2 */ UNK_TYPE1 pad2[2]; +/* 0x4 */ u32 unk4; +} z_SceneHeaderEntry; + +typedef struct { +/* 0x00 */ s16 scenes[27]; +} z_SceneIdList; + +typedef struct { +/* 0x00 */ s16 id; // Negative ids mean that the object is unloaded +/* 0x02 */ UNK_TYPE1 pad2[2]; +/* 0x04 */ void* vramAddr; +/* 0x08 */ z_DmaRequest unk8; +/* 0x28 */ OSMesgQueue unk28; +/* 0x40 */ UNK_TYPE1 pad40[4]; +} z_SceneObject; + +typedef struct { +/* 0x0 */ u32 romStart; +/* 0x4 */ u32 romEnd; +/* 0x8 */ UNK_TYPE1 pad8[3]; +/* 0xB */ u8 unkB; +/* 0xC */ UNK_TYPE1 padC[1]; +/* 0xD */ u8 unkD; +/* 0xE */ UNK_TYPE1 padE[2]; +} z_SceneTableEntry; + +typedef struct { +/* 0x0000 */ u8 unk0; +/* 0x0001 */ u8 unk1; +/* 0x0002 */ u8 unk2; +/* 0x0003 */ u8 unk3; +/* 0x0004 */ u32 unk4; +/* 0x0008 */ UNK_TYPE1 pad8[204]; +/* 0x00D4 */ u16 unkD4; +/* 0x00D6 */ UNK_TYPE1 padD6[38]; +/* 0x00FC */ s16 unkFC; +/* 0x00FE */ UNK_TYPE1 padFE[24]; +/* 0x0116 */ s16 unk116; +/* 0x0118 */ UNK_TYPE1 pad118[2398]; +/* 0x0A76 */ s16 unkA76; +/* 0x0A78 */ UNK_TYPE1 padA78[2]; +/* 0x0A7A */ s16 unkA7A; +/* 0x0A7C */ s16 unkA7C; +/* 0x0A7E */ UNK_TYPE1 padA7E[2902]; +} z_StaticContext; + +typedef struct { +/* 0x0 */ s8 unk0; +/* 0x1 */ UNK_TYPE1 pad1[1]; +/* 0x2 */ s8 unk2; +/* 0x3 */ UNK_TYPE1 pad3[1]; +/* 0x4 */ s16 actorIndex; // negative means already loaded? +/* 0x6 */ s16 x; +/* 0x8 */ s16 y; +/* 0xA */ s16 z; +/* 0xC */ s16 yRot; +/* 0xE */ u16 variable; +} z_TransitionActorInit; + +typedef struct { +/* 0x0 */ f32 x; +/* 0x4 */ f32 y; +/* 0x8 */ f32 z; +} z_Vector3f; + +typedef struct { +/* 0x0 */ s16 x; +/* 0x2 */ s16 y; +/* 0x4 */ s16 z; +} z_Vector3s; + +typedef struct { +/* 0x000 */ u32 magic; // always 0x56494557, "VIEW" +/* 0x004 */ z_GraphicsContext* graphics; +/* 0x008 */ UNK_TYPE1 pad8[16]; +/* 0x018 */ f32 unk18; +/* 0x01C */ f32 unk1C; +/* 0x020 */ f32 unk20; +/* 0x024 */ f32 unk24; +/* 0x028 */ z_Vector3f unk28; +/* 0x034 */ z_Vector3f unk34; +/* 0x040 */ z_Vector3f unk40; +/* 0x04C */ UNK_TYPE1 pad4C[220]; +/* 0x128 */ f32 unk128; +/* 0x12C */ f32 unk12C; +/* 0x130 */ f32 unk130; +/* 0x134 */ f32 unk134; +/* 0x138 */ f32 unk138; +/* 0x13C */ f32 unk13C; +/* 0x140 */ f32 unk140; +/* 0x144 */ f32 unk144; +/* 0x148 */ f32 unk148; +/* 0x14C */ f32 unk14C; +/* 0x150 */ f32 unk150; +/* 0x154 */ f32 unk154; +/* 0x158 */ f32 unk158; +/* 0x15C */ UNK_TYPE1 pad15C[12]; +} z_View; + +typedef struct { +/* 0x00 */ void* bufferEnd; +/* 0x04 */ u32 romReadHead; +/* 0x08 */ u32 amountLeftToRead; +/* 0x0C */ u32 loadNextChunkBoundary; +/* 0x10 */ u32 destBufferEnd; +} z_Yaz0DecompState; + +typedef void(*light_map_directional_func)(z_LightMapper* mapper, void* params, z_Vector3f* pos); + +typedef void(*light_map_positional_func)(z_LightMapper* mapper, void* params); + +typedef struct { +/* 0x00 */ z_Vector3f unk0; +/* 0x0C */ z_Vector3f unkC; +/* 0x18 */ s16 unk18; +/* 0x1A */ s16 unk1A; +} s80874650; + +// Related to collision? +typedef struct { +/* 0x00 */ z_ActorDamageChart* damageChart; +/* 0x04 */ z_Vector3f displacement; +/* 0x10 */ s16 unk10; +/* 0x12 */ s16 unk12; +/* 0x14 */ s16 unk14; +/* 0x16 */ u8 unk16; +/* 0x17 */ u8 unk17; +} z_ActorA0; + +typedef struct { +/* 0x00 */ z_Vector3s rotation; +/* 0x08 */ f32 yDisplacement; +/* 0x0C */ func_ptr postDrawFunc; // TODO params (z_Actor*, UNK*, z_GlobalContext*) +/* 0x10 */ f32 unk10; +/* 0x14 */ s8 unk14; +} z_ActorBC; + +typedef struct { +/* 0x00 */ u8 unk0; +/* 0x04 */ z_ColTouchInit unk4; +/* 0x0C */ z_ColBumpInit unkC; +/* 0x14 */ u8 unk14; +/* 0x15 */ u8 unk15; +/* 0x16 */ u8 unk16; +} z_ColBodyInfoInit; + +typedef struct { +/* 0x0 */ u32 collidesWith; +/* 0x4 */ u8 unk4; +/* 0x5 */ u8 unk5; +/* 0x6 */ z_Vector3s unk6; +} z_ColBump; + +typedef struct { +/* 0x0 */ s16 radius; +/* 0x2 */ s16 height; +/* 0x4 */ s16 yOffset; +/* 0x6 */ z_Vector3s loc; +} z_ColCylinderParams; + +typedef struct { +/* 0x00 */ z_Vector3f pointA; +/* 0x0C */ z_Vector3f pointB; +/* 0x18 */ z_Vector3f pointC; +/* 0x24 */ z_Vector3f pointD; +/* 0x30 */ z_Vector3s unk30; +/* 0x36 */ z_Vector3s unk36; +/* 0x3C */ f32 unk3C; +} z_ColQuadParams; + +typedef struct { +/* 0x0 */ z_Vector3s loc; +/* 0x6 */ s16 radius; +} z_ColSphereCollisionInfo; + +typedef struct { +/* 0x00 */ z_Vector3s unk0; +/* 0x06 */ s16 unk6; +/* 0x08 */ z_ColSphereCollisionInfo colInfo; +/* 0x10 */ f32 unk10; +/* 0x14 */ u8 unk14; +/* 0x15 */ UNK_TYPE1 pad15[3]; +} z_ColSphereParams; + +typedef struct { +/* 0x0 */ u8 unk0; +/* 0x1 */ z_ColSphereCollisionInfo unk1; +/* 0xA */ s16 unkA; +} z_ColSphereParamsInit; + +typedef struct { +/* 0x00 */ z_Vector3f pointA; +/* 0x0C */ z_Vector3f pointB; +/* 0x18 */ z_Vector3f pointC; +/* 0x24 */ z_Vector3f unitNormal; +/* 0x30 */ f32 unk30; +} z_ColTriParams; + +typedef struct { +/* 0x00 */ z_Vector3f unk0; +/* 0x0C */ z_Vector3f unkC; +/* 0x18 */ z_Vector3f unk18; +} z_ColTriParamsInit; + +typedef struct { +/* 0x00 */ z_Vector3f position; +/* 0x0C */ z_Vector3f velocity; +/* 0x18 */ z_Vector3f acceleration; +/* 0x24 */ z_Color color1; +/* 0x28 */ z_Color color2; +/* 0x2C */ s16 scale; +/* 0x2E */ s16 scaleChangePerFrame; +/* 0x30 */ s16 life; +/* 0x32 */ u16 flags; // bit0: ? bit1: ? bit2: randomize colors +/* 0x34 */ u8 type; // type0: start small, get big, fade away type1: start big, fade away +} z_EffectDustInit; + +typedef union { +/* 0x0 */ z_F3DVertexColor color; +/* 0x0 */ z_F3DVertexNormal normal; +} z_F3DVertex; + +typedef struct { +/* 0x000 */ z_View unk0; +/* 0x168 */ UNK_TYPE1 pad168[194]; +/* 0x22A */ s16 unk22A; +/* 0x22C */ s16 unk22C; +/* 0x22E */ s16 unk22E; +/* 0x230 */ s16 unk230; +/* 0x232 */ s16 unk232; +/* 0x234 */ s16 unk234; +/* 0x236 */ s16 unk236; +/* 0x238 */ s16 unk238; +/* 0x23A */ s16 unk23A; +/* 0x23C */ s16 unk23C; +/* 0x23E */ s16 unk23E; +/* 0x240 */ s16 unk240; +/* 0x242 */ s16 unk242; +/* 0x244 */ s16 unk244; +/* 0x246 */ s16 unk246; +/* 0x248 */ s16 unk248; +/* 0x24A */ s16 unk24A; +/* 0x24C */ s16 unk24C; +/* 0x24E */ s16 unk24E; +/* 0x250 */ s16 unk250; +/* 0x252 */ s16 unk252; +/* 0x254 */ s16 unk254; +/* 0x256 */ UNK_TYPE1 pad256[26]; +/* 0x270 */ s16 unk270; +/* 0x272 */ UNK_TYPE1 pad272[214]; +} z_GlobalContext169E8; + +typedef struct { +/* 0x00000 */ z_View unk0; +/* 0x00168 */ z_GlobalContext4A70 unk168; +/* 0x0A7E8 */ UNK_TYPE1 padA7E8[30960]; +} z_GlobalContext4908; + +typedef struct { +/* 0x0 */ u8 type; +/* 0x2 */ z_LightInfoDirectionalParams params; +} z_LightInfoDirectional; + +typedef struct { +/* 0x0 */ u8 type; +/* 0x2 */ z_LightInfoPositionalParams params; +} z_LightInfoPositional; + +typedef struct { +/* 0x00 */ z_Vector3f a; +/* 0x0C */ z_Vector3f b; +} z_LineSegment; + +typedef struct { +/* 0x0000 */ UNK_TYPE1 pad0[12]; +/* 0x000C */ u16 time; +/* 0x000E */ UNK_TYPE1 padE[22]; +/* 0x0024 */ z_SaveContext_struct1 unk24; +/* 0x004C */ z_SaveContext_struct2 unk4C; +/* 0x006E */ UNK_TYPE1 pad6E[2]; +/* 0x0070 */ z_SaveContext_struct3 unk70; +/* 0x00F8 */ UNK_TYPE1 padF8[3684]; +/* 0x0F5C */ u32 mapsVisited; +/* 0x0F60 */ UNK_TYPE1 padF60[170]; +/* 0x100A */ u16 checksum; +} z_SaveContext; + +typedef struct { +/* 0x000 */ void* objectVramStart; +/* 0x004 */ void* objectVramEnd; +/* 0x008 */ u8 unk8; +/* 0x009 */ u8 unk9; +/* 0x00A */ u8 unkA; +/* 0x00B */ u8 keepObjectId; +/* 0x00C */ z_SceneObject objects[35]; +} z_SceneContext; + +typedef struct { +/* 0x00 */ z_ColCommonInit base; +/* 0x08 */ z_ColBodyInfoInit body; +/* 0x20 */ z_ColCylinderParams info; +} z_ColCylinderInit; + +typedef struct { +/* 0x00 */ z_ColCommonInit base; +/* 0x08 */ z_ColBodyInfoInit body; +/* 0x20 */ z_ColQuadParams params; +} z_ColQuadInit; + +typedef struct { +/* 0x00 */ z_ColBodyInfoInit body; +/* 0x18 */ z_ColSphereParamsInit params; +} z_ColSphereGroupElementInit; + +typedef struct { +/* 0x0 */ z_ColCommonInit base; +/* 0x6 */ UNK_TYPE1 pad6[2]; +/* 0x8 */ u32 count; +/* 0xC */ z_ColSphereGroupElementInit* init; +} z_ColSphereGroupInit; + +typedef struct { +/* 0x00 */ z_ColCommonInit base; +/* 0x08 */ z_ColBodyInfoInit body; +/* 0x20 */ z_ColSphereParamsInit info; +} z_ColSphereInit; + +typedef struct { +/* 0x00 */ z_ColBodyInfoInit body; +/* 0x18 */ z_ColTriParamsInit params; +} z_ColTriInit; + +typedef struct { +/* 0x00 */ UNK_TYPE1 pad0[4]; +/* 0x04 */ f32 unk4; +/* 0x08 */ f32 unk8; +/* 0x0C */ f32 unkC; +/* 0x10 */ UNK_TYPE1 pad10[7]; +/* 0x17 */ u8 unk17; +/* 0x18 */ u8 unk18; +/* 0x19 */ UNK_TYPE1 pad19[5]; +/* 0x1E */ u8 unk1E; +/* 0x1F */ u8 unk1F; +/* 0x20 */ u8 unk20; +/* 0x21 */ u8 unk21; +/* 0x22 */ u16 unk22; +/* 0x24 */ u16 unk24; +/* 0x26 */ UNK_TYPE1 pad26[2]; +/* 0x28 */ z_LightInfoDirectional unk28; +/* 0x36 */ z_LightInfoDirectional unk36; +/* 0x44 */ UNK_TYPE1 pad44[72]; +/* 0x8C */ z_Vector3s unk8C; +/* 0x92 */ z_Vector3s unk92; +/* 0x98 */ z_Vector3s unk98; +/* 0x9E */ z_Vector3s unk9E; +/* 0xA4 */ s16 unkA4; +/* 0xA6 */ s16 unkA6; +/* 0xA8 */ UNK_TYPE1 padA8[12]; +/* 0xB4 */ f32 unkB4; +/* 0xB8 */ u8 environmentSettingsCount; +/* 0xB9 */ UNK_TYPE1 padB9[3]; +/* 0xBC */ void* environmentSettingsList; +/* 0xC0 */ UNK_TYPE1 padC0[1]; +/* 0xC1 */ u8 unkC1; +/* 0xC2 */ u8 unkC2; +/* 0xC3 */ UNK_TYPE1 padC3[1]; +/* 0xC4 */ z_RGB unkC4; +/* 0xC7 */ s8 unkC7; +/* 0xC8 */ s8 unkC8; +/* 0xC9 */ s8 unkC9; +/* 0xCA */ z_RGB unkCA; +/* 0xCD */ s8 unkCD; +/* 0xCE */ s8 unkCE; +/* 0xCF */ s8 unkCF; +/* 0xD0 */ z_RGB unkD0; +/* 0xD3 */ z_RGB unkD3; +/* 0xD6 */ s16 unkD6; +/* 0xD8 */ s16 unkD8; +/* 0xDA */ UNK_TYPE1 padDA[2]; +/* 0xDC */ f32 unkDC; +/* 0xE0 */ u8 unkE0; +/* 0xE1 */ UNK_TYPE1 padE1[17]; +} z_KankyoContext; + +typedef struct { +/* 0x0 */ z_ColCommonInit base; +/* 0x8 */ u32 count; +/* 0xC */ z_ColTriInit* elemInit; +} z_ColTriGroupInit; + +typedef struct z_ActorBgMbarChair z_ActorBgMbarChair; + +typedef struct z_ActorEnBji01 z_ActorEnBji01; + +typedef struct z_ActorEnTest z_ActorEnTest; + +typedef struct z_ActorInitData z_ActorInitData; + +typedef struct { +/* 0x00 */ u32 vromStart; +/* 0x04 */ u32 vromEnd; +/* 0x08 */ u32 vramStart; +/* 0x0C */ u32 vramEnd; +/* 0x10 */ u32 ramAddr; +/* 0x14 */ z_ActorInitData* initValues; +/* 0x18 */ s8* name; +/* 0x1C */ s16 flags; // bit 0: don't allocate memory, use actorContext->0x250? bit 1: Always keep loaded? +/* 0x1E */ s8 clients; +/* 0x1F */ UNK_TYPE1 pad1F[1]; +} z_ActorOverlayTableEntry; + +typedef struct z_ActorPlayer z_ActorPlayer; + +typedef struct z_ActorTypeList z_ActorTypeList; + +typedef struct z_ActorContext z_ActorContext; + +typedef struct z_ColCommon z_ColCommon; + +typedef struct { +/* 0x000 */ s16 ATgroupLength; +/* 0x002 */ u16 flags; // bit 0: collision bodies can't be added or removed, only swapped out +/* 0x004 */ z_ColCommon* ATgroup[50]; +/* 0x0CC */ s32 ACgroupLength; +/* 0x0D0 */ z_ColCommon* ACgroup[60]; +/* 0x1C0 */ s32 OTgroupLength; +/* 0x1C4 */ z_ColCommon* OTgroup[50]; +/* 0x28C */ s32 group4Length; +/* 0x290 */ z_ColCommon* group4[3]; +} z_CollisionContext; + +typedef struct z_ColBodyInfo z_ColBodyInfo; + +struct z_ColBodyInfo { +/* 0x00 */ z_ColTouch toucher; +/* 0x08 */ z_ColBump bumper; +/* 0x14 */ u8 unk14; +/* 0x15 */ u8 unk15; // bit 0: can be toucher in AT-AC collision +/* 0x16 */ u8 unk16; // bit 0: can be bumper in AT-AC collision +/* 0x17 */ u8 unk17; +/* 0x18 */ z_ColCommon* unk18; +/* 0x1C */ z_ColCommon* unk1C; +/* 0x20 */ z_ColBodyInfo* unk20; +/* 0x24 */ z_ColBodyInfo* unk24; +}; + +typedef struct { +/* 0x00 */ z_ColBodyInfo body; +/* 0x28 */ z_ColSphereParams params; +} z_ColSphereGroupElement; + +typedef struct { +/* 0x00 */ z_ColBodyInfo body; +/* 0x28 */ z_ColTriParams params; +} z_ColTri; + +typedef struct z_ColCylinder z_ColCylinder; + +typedef struct z_ColQuad z_ColQuad; + +typedef struct z_ColSphere z_ColSphere; + +typedef struct z_ColSphereGroup z_ColSphereGroup; + +typedef struct z_ColTriGroup z_ColTriGroup; + +typedef struct z_ActorEnBom z_ActorEnBom; + +typedef struct z_ActorEnFirefly z_ActorEnFirefly; + +typedef struct z_ActorObjBell z_ActorObjBell; + +typedef struct z_ContextCommon z_ContextCommon; + +typedef struct z_OpeningContext z_OpeningContext; + +typedef struct z_TitleContext z_TitleContext; + +typedef struct z_EffectTableInfo z_EffectTableInfo; + +typedef struct z_GameAllocNode z_GameAllocNode; + +struct z_GameAllocNode { +/* 0x00 */ z_GameAllocNode* unk0; +/* 0x04 */ z_GameAllocNode* unk4; +/* 0x08 */ u32 size; +/* 0x0C */ UNK_TYPE1 padC[4]; +/* 0x10 */ z_GameAllocNode* unk10; +}; + +struct z_ContextCommon { +/* 0x00 */ z_GraphicsContext* graphicsContext; +/* 0x04 */ func_ptr update; +/* 0x08 */ func_ptr fini; +/* 0x0C */ func_ptr nextGameStateInit; +/* 0x10 */ u32 nextGameStateSize; +/* 0x14 */ z_InputStruct controllers[4]; +/* 0x74 */ z_GameStateHeap heap; +/* 0x84 */ z_GameAllocNode gamealloc; +/* 0x98 */ UNK_TYPE1 pad98[3]; +/* 0x9B */ u8 shouldContinue; // If 0, switch to next game state +/* 0x9C */ s32 frameCount; +/* 0xA0 */ UNK_TYPE1 padA0[2]; +/* 0xA2 */ u8 unkA2; // game speed? +/* 0xA3 */ UNK_TYPE1 padA3[1]; +}; + +struct z_OpeningContext { +/* 0x000 */ z_ContextCommon common; +/* 0x0A4 */ UNK_TYPE1 padA4[4]; +/* 0x0A8 */ z_View unkA8; +}; + +struct z_TitleContext { +/* 0x000 */ z_ContextCommon common; +/* 0x0A4 */ u8* nintendo_logo_data; +/* 0x0A8 */ z_View unkA8; +/* 0x210 */ UNK_TYPE1 pad210[40]; +/* 0x238 */ s16 unk238; +/* 0x23A */ s16 logoCoverAlpha; +/* 0x23C */ s16 logoCoverAlphaChangePerFrame; +/* 0x23E */ s16 logoFullVisibilityDuration; +/* 0x240 */ s16 frameCounter; +/* 0x242 */ UNK_TYPE2 frameCounterMod0x80; +/* 0x244 */ u8 switchToNextGameState; +/* 0x245 */ UNK_TYPE1 pad245[3]; +}; + +typedef struct z_GlobalContext z_GlobalContext; + +typedef void(*collision_func)(z_GlobalContext*, z_CollisionContext*, z_ColCommon*, z_ColCommon*); + +typedef void(*cutscene_update_func)(z_GlobalContext* ctxt, z_CutsceneContext* cCtxt); + +typedef void(*global_context_func)(z_GlobalContext*); + +typedef void(*scene_header_func)(z_GlobalContext* ctxt, z_SceneHeaderEntry* entry); + +typedef struct z_Heap z_Heap; + +typedef struct z_HeapNode z_HeapNode; + +struct z_Heap { +/* 0x00 */ z_HeapNode* head; +/* 0x04 */ u32 base; +/* 0x08 */ OSMesgQueue lock; +/* 0x20 */ UNK_TYPE1 pad20[1]; +/* 0x21 */ u8 initialized; +/* 0x22 */ UNK_TYPE1 pad22[2]; +}; + +struct z_HeapNode { +/* 0x0 */ s16 magic; // Should always be 0x7373 +/* 0x2 */ s16 free; +/* 0x4 */ u32 size; +/* 0x8 */ z_HeapNode* next; +/* 0xC */ z_HeapNode* prev; +}; + +typedef struct z_Irqmgr z_Irqmgr; + +typedef struct z_AudioThreadStruct z_AudioThreadStruct; + +typedef struct z_Light z_Light; + +struct z_Light { +/* 0x0 */ z_LightInfo* info; +/* 0x4 */ z_Light* prev; +/* 0x8 */ z_Light* next; +}; + +typedef struct { +/* 0x0 */ z_Light* lightsHead; +/* 0x4 */ u8 ambientRed; +/* 0x5 */ u8 ambientGreen; +/* 0x6 */ u8 ambientBlue; +/* 0x7 */ UNK_TYPE1 pad7[3]; +/* 0xA */ s16 unkA; +/* 0xC */ s16 unkC; +} z_LightingContext; + +typedef struct { +/* 0x000 */ int numOccupied; +/* 0x004 */ int nextFree; +/* 0x008 */ z_Light lights[32]; +} z_LightsList; + +typedef struct z_LoadedParticleEntry z_LoadedParticleEntry; + +typedef void(*effect_func)(z_GlobalContext* ctxt, u32 index, z_LoadedParticleEntry* particle); + +typedef void(*effect_init_func)(z_GlobalContext* ctxt, u32 index, z_LoadedParticleEntry* particle, void* init); + +struct z_EffectTableInfo { +/* 0x0 */ z_LoadedParticleEntry* data_table; // Name from debug assert +/* 0x4 */ s32 searchIndex; +/* 0x8 */ s32 size; +}; + +struct z_LoadedParticleEntry { +/* 0x00 */ z_Vector3f position; +/* 0x0C */ z_Vector3f velocity; +/* 0x18 */ z_Vector3f acceleration; +/* 0x24 */ effect_func update; +/* 0x28 */ global_context_func draw; +/* 0x2C */ f32 unk2C; +/* 0x30 */ f32 unk30; +/* 0x34 */ f32 unk34; +/* 0x38 */ u32 displayList; +/* 0x3C */ UNK_TYPE4 unk3C; +/* 0x40 */ s16 regs[13]; // These are particle-specific +/* 0x5A */ u16 flags; // bit 0: set if this entry is not considered free on a priority tie bit 1: ? bit 2: ? +/* 0x5C */ s16 life; // -1 means this entry is free +/* 0x5E */ u8 priority; // Lower number mean higher priority +/* 0x5F */ u8 type; +}; + +typedef struct { +/* 0x0 */ UNK_TYPE4 unk0; +/* 0x4 */ effect_init_func init; } z_ParticleOverlayInfo; typedef struct { - /* 0x00 */ u32 vromStart; - /* 0x04 */ u32 vromEnd; - /* 0x08 */ u32 vramStart; - /* 0x0C */ u32 vramEnd; - /* 0x10 */ u32 loadedRamAddr; - /* 0x14 */ z_ParticleOverlayInfo* overlayInfo; - /* 0x18 */ u32 unk18; // Always 0x01000000? +/* 0x00 */ u32 vromStart; +/* 0x04 */ u32 vromEnd; +/* 0x08 */ u32 vramStart; +/* 0x0C */ u32 vramEnd; +/* 0x10 */ u32 loadedRamAddr; +/* 0x14 */ z_ParticleOverlayInfo* overlayInfo; +/* 0x18 */ u32 unk18; // Always 0x01000000? } z_ParticleOverlayTableEntry; -typedef struct { - z_LoadedParticleEntry* data_table; // Name from debug assert - s32 searchIndex; - s32 size; -} z_EffectTableInfo; +typedef struct z_OSMesgQueueListNode z_OSMesgQueueListNode; + +struct z_Irqmgr { +/* 0x000 */ s16 verticalRetraceMesg; +/* 0x002 */ UNK_TYPE1 pad2[30]; +/* 0x020 */ s16 prenmi1Msg; +/* 0x022 */ UNK_TYPE1 pad22[30]; +/* 0x040 */ s16 prenmi2Msg; +/* 0x042 */ UNK_TYPE1 pad42[30]; +/* 0x060 */ OSMesgQueue irqQueue; +/* 0x078 */ UNK_TYPE4 irqBuffer[8]; +/* 0x098 */ OSThread thread; +/* 0x248 */ z_OSMesgQueueListNode* callbacks; +/* 0x24C */ s8 prenmiStage; +/* 0x24D */ UNK_TYPE1 pad24D[3]; +/* 0x250 */ OSTime lastPrenmiTime; +/* 0x258 */ OSTimer unk258; +/* 0x278 */ OSTime lastFrameTime; +}; + +struct z_OSMesgQueueListNode { +/* 0x0 */ z_OSMesgQueueListNode* next; +/* 0x4 */ OSMesgQueue* queue; +}; typedef struct { - /* 0x0000 */ u8 pad0[0xD4]; - /* 0x00D4 */ u16 unkD4; - /* 0x00D6 */ u8 pad1[0x14FE]; -} z_StaticContext; - -// TODO everything past here should be placed in an appropiate libultra header - +/* 0x000 */ u8 controllers; // bit 0 is set if controller 1 is plugged in, etc. +/* 0x001 */ UNK_TYPE1 pad1[19]; +/* 0x014 */ OSContStatus statuses[4]; +/* 0x024 */ UNK_TYPE4 unk24; +/* 0x028 */ UNK_TYPE4 unk28; +/* 0x02C */ UNK_TYPE4 interrupts[8]; +/* 0x04C */ OSMesgQueue siEventCallbackQueue; +/* 0x064 */ OSMesgQueue unk64; +/* 0x07C */ OSMesgQueue irqmgrCallbackQueue; +/* 0x094 */ z_OSMesgQueueListNode irqmgrCallbackQueueNode; +/* 0x09C */ z_Irqmgr* irqmgr; +/* 0x0A0 */ OSThread thread; +/* 0x250 */ UNK_TYPE1 pad250[96]; +/* 0x2B0 */ OSContPad controllerState1[4]; +/* 0x2C8 */ u8 maxNumControllers; +/* 0x2C9 */ UNK_TYPE1 pad2C9[435]; +/* 0x47C */ u8 unk47C; +/* 0x47D */ u8 unk47D; +/* 0x47E */ u8 unk47E; +/* 0x47F */ UNK_TYPE1 pad47F[1]; +} z_PadmgrThreadStruct; typedef struct { - /* 0x0 */ int quot; - /* 0x4 */ int rem; -} div_t; +/* 0x000 */ OSMesgQueue unk0; +/* 0x018 */ UNK_TYPE4 unk18[64]; +/* 0x118 */ OSMesgQueue unk118; +/* 0x130 */ UNK_TYPE4 unk130[8]; +/* 0x150 */ OSThread thread; +/* 0x300 */ UNK_TYPE4 unk300; +/* 0x304 */ UNK_TYPE4 unk304; +/* 0x308 */ UNK_TYPE4 unk308; +/* 0x30C */ UNK_TYPE4 unk30C; +/* 0x310 */ UNK_TYPE4 unk310; +/* 0x314 */ UNK_TYPE4 unk314; +/* 0x318 */ s32 unk318; +/* 0x31C */ UNK_TYPE1 pad31C[4]; +/* 0x320 */ UNK_TYPE4 unk320; +/* 0x324 */ UNK_TYPE4 unk324; +/* 0x328 */ UNK_TYPE1 pad328[7]; +/* 0x32F */ s8 unk32F; +/* 0x330 */ z_OSMesgQueueListNode unk330; +} z_SchedThreadStruct; +struct z_AudioThreadStruct { +/* 0x000 */ z_Irqmgr* irqmgr; +/* 0x004 */ z_SchedThreadStruct* unk4; +/* 0x008 */ UNK_TYPE1 pad8[88]; +/* 0x060 */ UNK_TYPE4 unk60; +/* 0x064 */ OSMesgQueue unk64; +/* 0x07C */ UNK_TYPE4 unk7C[30]; +/* 0x0F4 */ OSMesgQueue unkF4; +/* 0x10C */ UNK_TYPE4 unk10C; +/* 0x110 */ OSMesgQueue initDoneCallback; +/* 0x128 */ UNK_TYPE4 initDoneCallbackMsgBuffer; +/* 0x12C */ UNK_TYPE1 pad12C[4]; +/* 0x130 */ OSThread unk130; +}; + +typedef struct z_ThreadInfo z_ThreadInfo; + +struct z_ThreadInfo { +/* 0x00 */ z_ThreadInfo* next; +/* 0x04 */ z_ThreadInfo* prev; +/* 0x08 */ s32* stackBegin; +/* 0x0C */ s32* stackEnd; +/* 0x10 */ s32 initStackValue; +/* 0x14 */ s32 stackWarningThreshold; +/* 0x18 */ s8* name; +}; + +typedef struct z_Actor z_Actor; + +typedef void(*actor_func)(z_Actor* this, z_GlobalContext* ctxt); + +typedef void(*actor_init_var_func)(z_Actor*, z_ActorInitVar*); + +struct z_Actor { +/* 0x000 */ s16 id; +/* 0x002 */ UNK_TYPE1 type; +/* 0x003 */ s8 room; +/* 0x004 */ UNK_TYPE4 flags; // bit 22: disable positional lights if bit 28 is not set; bit 28: enable positional lights on actor +/* 0x008 */ z_Vector3f initPos; +/* 0x014 */ z_Vector3s initRot; +/* 0x01A */ UNK_TYPE1 pad1A[2]; +/* 0x01C */ s16 variable; +/* 0x01E */ s8 objectIndex; +/* 0x01F */ UNK_TYPE1 pad1F[1]; +/* 0x020 */ s16 unk20; +/* 0x022 */ UNK_TYPE1 pad22[2]; +/* 0x024 */ z_Vector3f pos; +/* 0x030 */ z_Vector3s speedRot; +/* 0x036 */ UNK_TYPE1 pad36[2]; +/* 0x038 */ s8 unk38; +/* 0x039 */ u8 unk39; +/* 0x03A */ UNK_TYPE1 pad3A[2]; +/* 0x03C */ z_Vector3f unk3C; +/* 0x048 */ z_Vector3s unk48; +/* 0x04E */ UNK_TYPE1 pad4E[2]; +/* 0x050 */ u16 unk50; +/* 0x052 */ UNK_TYPE1 pad52[2]; +/* 0x054 */ f32 unk54; +/* 0x058 */ z_Vector3f scale; +/* 0x064 */ z_Vector3f velocity; +/* 0x070 */ f32 speed; +/* 0x074 */ f32 gravity; +/* 0x078 */ f32 minYVelocity; +/* 0x07C */ UNK_TYPE1 pad7C[12]; +/* 0x088 */ f32 unk88; +/* 0x08C */ f32 unk8C; +/* 0x090 */ u16 unk90; +/* 0x092 */ s16 unk92; +/* 0x094 */ UNK_TYPE1 pad94[4]; +/* 0x098 */ f32 unk98; +/* 0x09C */ f32 unk9C; +/* 0x0A0 */ z_ActorA0 unkA0; +/* 0x0B8 */ UNK_TYPE1 padB8[1]; +/* 0x0B9 */ u8 unkB9; +/* 0x0BA */ UNK_TYPE1 padBA[2]; +/* 0x0BC */ z_ActorBC unkBC; +/* 0x0D4 */ UNK_TYPE1 padD4[24]; +/* 0x0EC */ z_Vector3f unkEC; +/* 0x0F8 */ f32 unkF8; +/* 0x0FC */ f32 unkFC; +/* 0x100 */ f32 unk100; +/* 0x104 */ f32 unk104; +/* 0x108 */ z_Vector3f unk108; +/* 0x114 */ u8 unk114; +/* 0x115 */ UNK_TYPE1 pad115[1]; +/* 0x116 */ s16 textId; +/* 0x118 */ UNK_TYPE1 pad118[2]; +/* 0x11A */ u16 hitEffectParams; // TODO make into bitfield +/* 0x11C */ u8 hitEffectIntensity; +/* 0x11D */ u8 unk11D; +/* 0x11E */ UNK_TYPE1 pad11E[1]; +/* 0x11F */ u8 naviMsgId; +/* 0x120 */ z_Actor* parent; +/* 0x124 */ z_Actor* child; +/* 0x128 */ z_Actor* prev; +/* 0x12C */ z_Actor* next; +/* 0x130 */ actor_func init; +/* 0x134 */ actor_func fini; +/* 0x138 */ actor_func main; +/* 0x13C */ actor_func draw; +/* 0x140 */ z_ActorOverlayTableEntry* tableEntry; +}; typedef struct { - /* 0x0 */ long quot; - /* 0x4 */ long rem; -} ldiv_t; +/* 0x000 */ z_Actor base; +/* 0x144 */ UNK_TYPE1 pad144[100]; +/* 0x1A8 */ u32 displayListAddr; +/* 0x1AC */ actor_func updateFunc; +} z_ActorBgIknvObj; +struct z_ActorBgMbarChair { +/* 0x000 */ z_Actor base; +/* 0x144 */ UNK_TYPE1 pad144[24]; +}; + +struct z_ActorEnBji01 { +/* 0x000 */ z_Actor base; +/* 0x144 */ UNK_TYPE1 pad144[368]; +}; + +struct z_ActorEnTest { +/* 0x000 */ z_Actor base; +/* 0x144 */ UNK_TYPE1 pad144[16]; +/* 0x154 */ f32 unk154; +/* 0x158 */ UNK_TYPE1 pad158[176]; +/* 0x208 */ u8 unk208; +/* 0x209 */ UNK_TYPE1 pad209[1]; +/* 0x20A */ u8 unk20A; +/* 0x20B */ UNK_TYPE1 pad20B[1]; +/* 0x20C */ z_ActorEnTest20C unk20C[20]; +}; + +struct z_ActorInitData { +/* 0x00 */ s16 id; +/* 0x02 */ u8 type; +/* 0x03 */ UNK_TYPE1 pad3[1]; +/* 0x04 */ s32 flags; +/* 0x08 */ s16 objectDependency; +/* 0x0A */ UNK_TYPE1 padA[2]; +/* 0x0C */ u32 instanceSize; +/* 0x10 */ actor_func init; +/* 0x14 */ actor_func fini; +/* 0x18 */ actor_func main; +/* 0x1C */ actor_func draw; +}; + +struct z_ActorPlayer { +/* 0x000 */ z_Actor base; +/* 0x144 */ UNK_TYPE1 pad144[3124]; +}; + +struct z_ActorTypeList { +/* 0x0 */ s32 length; +/* 0x4 */ z_Actor* head; +/* 0x8 */ UNK_TYPE1 pad8[4]; +}; + +struct z_ColCommon { +/* 0x00 */ z_Actor* actor; +/* 0x04 */ z_Actor* unk4; +/* 0x08 */ z_Actor* unk8; +/* 0x0C */ z_Actor* unkC; +/* 0x10 */ u8 unk10; +/* 0x11 */ u8 unk11; +/* 0x12 */ u8 unk12; +/* 0x13 */ u8 unk13; +/* 0x14 */ u8 unk14; +/* 0x15 */ u8 type; +/* 0x16 */ UNK_TYPE1 pad16[2]; +}; + +struct z_ColCylinder { +/* 0x00 */ z_ColCommon base; +/* 0x18 */ z_ColBodyInfo body; +/* 0x40 */ z_ColCylinderParams params; +}; + +struct z_ColQuad { +/* 0x00 */ z_ColCommon base; +/* 0x18 */ z_ColBodyInfo body; +/* 0x40 */ z_ColQuadParams params; +}; + +struct z_ColSphere { +/* 0x00 */ z_ColCommon base; +/* 0x18 */ z_ColBodyInfo body; +/* 0x40 */ z_ColSphereParams params; +}; + +struct z_ColSphereGroup { +/* 0x00 */ z_ColCommon base; +/* 0x18 */ u32 count; +/* 0x1C */ z_ColSphereGroupElement* spheres; +}; + +struct z_ColTriGroup { +/* 0x00 */ z_ColCommon base; +/* 0x18 */ u32 count; +/* 0x1C */ z_ColTri* tris; +}; typedef struct { - /* 0x0 */ long long quot; - /* 0x8 */ long long rem; -} lldiv_t; +/* 0x000 */ z_Actor base; +/* 0x144 */ z_ColQuad unk144; +/* 0x1C4 */ z_ColQuad unk1C4; +/* 0x244 */ z_Vector3f unk244; +/* 0x250 */ f32 unk250; +/* 0x254 */ f32 unk254; +/* 0x258 */ actor_func update; +/* 0x25C */ s16 unk25C; +/* 0x25E */ u16 unk25E; +/* 0x260 */ u8 unk260; +/* 0x261 */ UNK_TYPE1 pad261[3]; +} z_ActorArrowFire; -typedef unsigned int size_t; - -typedef double ldouble; +struct z_ActorContext { +/* 0x000 */ UNK_TYPE1 pad0[2]; +/* 0x002 */ u8 unk2; +/* 0x003 */ UNK_TYPE1 pad3[1]; +/* 0x004 */ s8 unk4; +/* 0x005 */ UNK_TYPE1 pad5[7]; +/* 0x00C */ s16 unkC; +/* 0x00E */ u8 totalLoadedActors; +/* 0x00F */ u8 unkF; +/* 0x010 */ z_ActorTypeList actorTypeLists[12]; +/* 0x0A0 */ z_Actor* unkA0; +/* 0x0A4 */ UNK_TYPE1 padA4[180]; +/* 0x158 */ z_Actor* unk158; +/* 0x15C */ UNK_TYPE1 pad15C[80]; +/* 0x1AC */ z_Actor* unk1AC; +/* 0x1B0 */ z_Actor* unk1B0; +/* 0x1B4 */ UNK_TYPE1 pad1B4[24]; +/* 0x1CC */ u32 unk1CC; +/* 0x1D0 */ u32 clearedRooms; +/* 0x1D4 */ u32 collectibleFlags[4]; // bitfield of 128 bits +/* 0x1E4 */ UNK_TYPE1 pad1E4[17]; +/* 0x1F5 */ u8 unk1F5; +/* 0x1F6 */ UNK_TYPE1 pad1F6[90]; +/* 0x250 */ void* unk250; // allocation of 0x20f0 bytes? +/* 0x254 */ UNK_TYPE1 pad254[48]; +}; typedef struct { - /* 0x0 */ union { - /* 0x0 */ long long ll; - /* 0x0 */ ldouble ld; - } v; - /* 0x8 */ unsigned char* s; - /* 0xC */ int n0; - /* 0x10 */ int nz0; - /* 0x14 */ int n1; - /* 0x18 */ int nz1; - /* 0x1C */ int n2; - /* 0x20 */ int nz2; - /* 0x24 */ int prec; - /* 0x28 */ int width; - /* 0x2C */ size_t nchar; - /* 0x30 */ unsigned int flags; - /* 0x34 */ unsigned char qual; -} _Pft; +/* 0x000 */ z_Actor base; +/* 0x144 */ actor_func update; +/* 0x148 */ z_ColCylinder collision; +/* 0x194 */ UNK_TYPE1 pad194[20]; +} z_ActorEnAObj; + +struct z_ActorEnBom { +/* 0x000 */ z_Actor base; +/* 0x144 */ z_ColCylinder unk144; +/* 0x190 */ z_ColSphereGroup unk190; +/* 0x1B0 */ z_ColSphereGroupElement unk1B0[1]; +/* 0x1F0 */ s16 unk1F0; +/* 0x1F2 */ UNK_TYPE1 pad1F2[6]; +/* 0x1F8 */ u8 unk1F8; +/* 0x1F9 */ u8 unk1F9; +/* 0x1FA */ UNK_TYPE1 pad1FA[2]; +/* 0x1FC */ u8 unk1FC; +/* 0x1FD */ UNK_TYPE1 pad1FD[3]; +/* 0x200 */ func_ptr unk200; +}; + +struct z_ActorEnFirefly { +/* 0x000 */ z_Actor base; +/* 0x144 */ UNK_TYPE1 pad144[28]; +/* 0x160 */ f32 unk160; +/* 0x164 */ UNK_TYPE1 pad164[36]; +/* 0x188 */ func_ptr updateFunc; +/* 0x18C */ UNK_TYPE1 type; +/* 0x18D */ u8 unk18D; +/* 0x18E */ u8 unk18E; +/* 0x18F */ u8 unk18F; +/* 0x190 */ s16 unk190; +/* 0x192 */ UNK_TYPE1 pad192[338]; +/* 0x2E4 */ f32 unk2E4; +/* 0x2E8 */ f32 unk2E8; +/* 0x2EC */ f32 unk2EC; +/* 0x2F0 */ f32 unk2F0; +/* 0x2F4 */ UNK_TYPE1 pad2F4[40]; +/* 0x31C */ z_ColSphere collision; +}; + +typedef struct { +/* 0x000 */ z_Actor base; +/* 0x144 */ actor_func update; +/* 0x148 */ s16 unk148; +/* 0x14A */ UNK_TYPE1 pad14A[2]; +/* 0x14C */ s16 unk14C; +/* 0x14E */ s16 unk14E; +/* 0x150 */ s16 unk150; +/* 0x152 */ s16 unk152; +/* 0x154 */ f32 unk154; +/* 0x158 */ z_ColCylinder collision; +/* 0x1A4 */ UNK_TYPE1 pad1A4[4]; +} z_ActorEnItem00; + +struct z_ActorObjBell { +/* 0x000 */ z_Actor base; +/* 0x144 */ UNK_TYPE1 pad144[24]; +/* 0x15C */ z_ColSphere unk15C; +/* 0x1B4 */ z_ColSphere unk1B4; +/* 0x20C */ UNK_TYPE1 pad20C[2]; +/* 0x20E */ s16 unk20E; +/* 0x210 */ UNK_TYPE1 pad210[4]; +/* 0x214 */ s16 unk214; +/* 0x216 */ UNK_TYPE1 pad216[18]; +}; + +struct z_GlobalContext { +/* 0x00000 */ z_ContextCommon commonVars; +/* 0x000A4 */ s16 currentScene; +/* 0x000A6 */ u8 unkA6; +/* 0x000A7 */ UNK_TYPE1 padA7[9]; +/* 0x000B0 */ void* currentSceneVram; +/* 0x000B4 */ UNK_TYPE1 padB4[4]; +/* 0x000B8 */ z_View unkB8; +/* 0x00220 */ z_GlobalContext220 unk220[4]; +/* 0x00800 */ UNK_TYPE1 pad800[24]; +/* 0x00818 */ z_LightingContext lightsContext; +/* 0x00826 */ UNK_TYPE1 pad826[2]; +/* 0x00828 */ u32 unk828; +/* 0x0082C */ UNK_TYPE1 pad82C[5236]; +/* 0x01CA0 */ z_ActorContext actorContext; +/* 0x01F24 */ z_CutsceneContext cutsceneContext; +/* 0x01F74 */ z_CutsceneEntry* cutsceneList; +/* 0x01F78 */ UNK_TYPE1 pad1F78[10640]; +/* 0x04908 */ z_GlobalContext4908 unk4908; +/* 0x169E0 */ UNK_TYPE1 pad169E0[8]; +/* 0x169E8 */ z_GlobalContext169E8 unk169E8; +/* 0x16D30 */ UNK_TYPE1 pad16D30[492]; +/* 0x16F1C */ u16 unk16F1C; +/* 0x16F1E */ UNK_TYPE1 pad16F1E[226]; +/* 0x17000 */ u16 unk17000; +/* 0x17002 */ UNK_TYPE1 pad17002[2]; +/* 0x17004 */ z_KankyoContext kankyoContext; +/* 0x170F6 */ UNK_TYPE1 pad170F6[3218]; +/* 0x17D88 */ z_SceneContext sceneContext; +/* 0x186E0 */ s8 currentRoom; +/* 0x186E1 */ UNK_TYPE1 pad186E1[5]; +/* 0x186E6 */ u8 enablePosLights; +/* 0x186E7 */ UNK_TYPE1 pad186E7[1]; +/* 0x186E8 */ u32* meshHeader; +/* 0x186EC */ UNK_TYPE1 pad186EC[116]; +/* 0x18760 */ u8 transitionActorCount; +/* 0x18761 */ UNK_TYPE1 pad18761[3]; +/* 0x18764 */ z_TransitionActorInit* transitionActorList; +/* 0x18768 */ UNK_TYPE1 pad18768[72]; +/* 0x187B0 */ z_Matrix unk187B0; +/* 0x187F0 */ UNK_TYPE1 pad187F0[86]; +/* 0x18846 */ u16 sceneNumActorsToLoad; +/* 0x18848 */ u8 numRooms; +/* 0x18849 */ UNK_TYPE1 pad18849[3]; +/* 0x1884C */ z_RoomFileLocation* roomAddrs; +/* 0x18850 */ UNK_TYPE1 pad18850[4]; +/* 0x18854 */ z_SceneActorInit* sceneActorList; +/* 0x18858 */ UNK_TYPE1 pad18858[4]; +/* 0x1885C */ u8* entranceList; +/* 0x18860 */ void* exitList; +/* 0x18864 */ void* pathList; +/* 0x18868 */ UNK_TYPE1 pad18868[4]; +/* 0x1886C */ void* textureAnimations; +/* 0x18870 */ UNK_TYPE1 pad18870[4]; +/* 0x18874 */ u8 unk18874; +/* 0x18875 */ UNK_TYPE1 pad18875[15]; +/* 0x18884 */ z_CollisionContext collisionContext; +/* 0x18B20 */ UNK_TYPE1 pad18B20[820]; +/* 0x18E54 */ z_SceneTableEntry* currentSceneTableEntry; +/* 0x18E58 */ UNK_TYPE1 pad18E58[1024]; +}; + #endif diff --git a/include/structs_bitfields.h b/include/structs_bitfields.h new file mode 100644 index 0000000000..8b7be701d8 --- /dev/null +++ b/include/structs_bitfields.h @@ -0,0 +1,13 @@ +#ifndef _STRUCTS_BITFIELDS_H_ +#define _STRUCTS_BITFIELDS_H_ + +#include + +typedef struct { + u32 cont : 1; + u32 type : 4; + u32 offset : 11; + s32 value : 16; +} z_ActorCompInitEntry; + +#endif diff --git a/include/unk.h b/include/unk.h index 439697e7e8..0b1b1515c4 100644 --- a/include/unk.h +++ b/include/unk.h @@ -4,6 +4,9 @@ #include #define UNK_TYPE s32 +#define UNK_TYPE1 s8 +#define UNK_TYPE2 s16 +#define UNK_TYPE4 s32 #define UNK_PTR void* #define UNK_RET void #define UNK_FUN_ARG void(*)(void) diff --git a/include/variables.h b/include/variables.h index 4c72dffa7e..84f8cae83d 100644 --- a/include/variables.h +++ b/include/variables.h @@ -7,6 +7,9 @@ #include #include #include +#include +#include +#include //extern UNK_TYPE D_0000AB44; //extern UNK_TYPE D_0000ABD4; @@ -556,8 +559,8 @@ extern UNK_TYPE* D_80096B60; // D_80096B60 //extern UNK_TYPE D_80096BE4; //extern UNK_TYPE D_80096C20; //extern UNK_TYPE D_80096C30; -extern s80085320* g_s80085320_ListHead; // D_80096C40 -extern s80085320* g_s80085320_ListTail; // D_80096C44 +extern z_ThreadInfo* g_s80085320_ListHead; // D_80096C40 +extern z_ThreadInfo* g_s80085320_ListTail; // D_80096C44 //extern UNK_TYPE D_80096C50; //extern UNK_TYPE D_80096CD0; //extern UNK_TYPE D_80096CF0; @@ -788,22 +791,22 @@ extern float __libm_qnan_f; // D_80099450 //extern UNK_TYPE D_800994C8; extern UNK_TYPE D_800994D0; // D_800994D0 extern UNK_TYPE D_800994DC; // D_800994DC -extern s80085320 D_80099500; // D_80099500 +extern z_ThreadInfo D_80099500; // D_80099500 extern OSThread D_80099520; // D_80099520 extern UNK_TYPE D_800996D0; // D_800996D0 -extern s80085320 D_80099AD0; // D_80099AD0 +extern z_ThreadInfo D_80099AD0; // D_80099AD0 extern UNK_TYPE D_80099AF0; // D_80099AF0 extern UNK_TYPE D_80099EF0; // D_80099EF0 extern UNK_TYPE D_8009A170; // D_8009A170 -extern s80085320 D_8009A670; // D_8009A670 +extern z_ThreadInfo D_8009A670; // D_8009A670 extern UNK_TYPE D_8009A690; // D_8009A690 extern UNK_TYPE D_8009A840; // D_8009A840 -extern s80085320 D_8009B140; // D_8009B140 +extern z_ThreadInfo D_8009B140; // D_8009B140 extern UNK_TYPE D_8009B160; // D_8009B160 extern UNK_TYPE D_8009B228; // D_8009B228 extern u32* D_8009B240; // D_8009B240 extern u8 D_8009B290; // D_8009B290 -extern s80085320 D_8009B2A0; // D_8009B2A0 +extern z_ThreadInfo D_8009B2A0; // D_8009B2A0 extern u16 D_8009B2BC; // D_8009B2BC extern OSMesgQueue D_8009B2C0; // D_8009B2C0 extern UNK_TYPE D_8009B2D8; // D_8009B2D8 @@ -881,7 +884,7 @@ extern UNK_TYPE D_8009E624; // D_8009E624 //extern UNK_TYPE D_8009F870; //extern UNK_TYPE D_8009F888; //extern UNK_TYPE D_8009F8A0; -extern DmadataEntry dmadata[]; // D_8009F8B0 +extern z_DmadataEntry dmadata[]; // D_8009F8B0 //extern UNK_TYPE D_800A0004; //extern UNK_TYPE D_80186028; //extern UNK_TYPE D_801AAAB0; @@ -977,7 +980,7 @@ extern z_ParticleOverlayTableEntry particleOverlayTable[]; // D_801AE4A0 //extern UNK_TYPE D_801AEFB8; //extern UNK_TYPE D_801AEFBC; //extern UNK_TYPE D_801AEFC0; -extern s800BF9A0 D_801AEFD0; // D_801AEFD0 +extern z_ActorOverlayTableEntry D_801AEFD0; // D_801AEFD0 //extern UNK_TYPE D_801AEFE0; //extern UNK_TYPE D_801AEFE4; //extern UNK_TYPE D_801AEFEE; @@ -16022,7 +16025,7 @@ extern f32 D_80ACB650; // D_80ACB650 //extern UNK_TYPE D_80BD52F4; //extern UNK_TYPE D_80BD52F8; //extern UNK_TYPE D_80BD52FC; -extern z_ActorInit bgIkanaRayInitVar; // D_80BD55D0 +extern z_ActorInitData bgIkanaRayInitVar; // D_80BD55D0 extern UNK_TYPE D_80BD55F0; // D_80BD55F0 extern z_ActorCompInitEntry bgIkanaRayCompInit[]; // D_80BD561C extern UNK_TYPE D_80BD562C; // D_80BD562C diff --git a/include/xstdio.h b/include/xstdio.h new file mode 100644 index 0000000000..4b13ecdffe --- /dev/null +++ b/include/xstdio.h @@ -0,0 +1,26 @@ +#ifndef _XSTDIO_H_ +#define _XSTDIO_H_ + +typedef double ldouble; + + +typedef struct { + /* 0x0 */ union { + /* 0x0 */ long long ll; + /* 0x0 */ ldouble ld; + } v; + /* 0x8 */ unsigned char* s; + /* 0xC */ int n0; + /* 0x10 */ int nz0; + /* 0x14 */ int n1; + /* 0x18 */ int nz1; + /* 0x1C */ int n2; + /* 0x20 */ int nz2; + /* 0x24 */ int prec; + /* 0x28 */ int width; + /* 0x2C */ size_t nchar; + /* 0x30 */ unsigned int flags; + /* 0x34 */ unsigned char qual; +} _Pft; + +#endif diff --git a/src/actors/ovl_Bg_Fu_Kaiten_0x80ACB400/ovl_Bg_Fu_Kaiten_0x80ACB400.c b/src/actors/ovl_Bg_Fu_Kaiten_0x80ACB400/ovl_Bg_Fu_Kaiten_0x80ACB400.c index 46055f37e8..4be0b88579 100644 --- a/src/actors/ovl_Bg_Fu_Kaiten_0x80ACB400/ovl_Bg_Fu_Kaiten_0x80ACB400.c +++ b/src/actors/ovl_Bg_Fu_Kaiten_0x80ACB400/ovl_Bg_Fu_Kaiten_0x80ACB400.c @@ -20,17 +20,17 @@ UNK_RET func_80ACB50C(z_ActorBgFuKaiten* this); void z_bg_fu_kaiten_main(z_ActorBgFuKaiten* this, z_GlobalContext* ctxt); void func_80ACB5A0(z_ActorBgFuKaiten* this, z_GlobalContext* ctxt); -z_ActorInit bgBgFuKaitenInitVar = { +z_ActorInitData bgBgFuKaitenInitVar = { 0x01AE, 1, 0, 0x30, 0x01A0, sizeof(z_ActorBgFuKaiten), - (z_ActorFunc)z_bg_fu_kaiten_init, - (z_ActorFunc)z_bg_fu_kaiten_fini, - (z_ActorFunc)z_bg_fu_kaiten_main, - (z_ActorFunc)func_80ACB5A0 + (actor_func)z_bg_fu_kaiten_init, + (actor_func)z_bg_fu_kaiten_fini, + (actor_func)z_bg_fu_kaiten_main, + (actor_func)func_80ACB5A0 }; f32 D_80ACB650 = 0.002; diff --git a/src/actors/ovl_Bg_Ikana_Ray_0x80BD53C0/ovl_Bg_Ikana_Ray_0x80BD53C0.c b/src/actors/ovl_Bg_Ikana_Ray_0x80BD53C0/ovl_Bg_Ikana_Ray_0x80BD53C0.c index 7a13b51c47..ee9b30a082 100644 --- a/src/actors/ovl_Bg_Ikana_Ray_0x80BD53C0/ovl_Bg_Ikana_Ray_0x80BD53C0.c +++ b/src/actors/ovl_Bg_Ikana_Ray_0x80BD53C0/ovl_Bg_Ikana_Ray_0x80BD53C0.c @@ -18,17 +18,17 @@ void func_80BD54BC(z_ActorBgIkanaRay* this, z_GlobalContext* ctxt); void func_80BD5500(z_ActorBgIkanaRay* this); void func_80BD5530(z_ActorBgIkanaRay* this, z_GlobalContext* ctxt); -z_ActorInit bgIkanaRayInitVar = { +z_ActorInitData bgIkanaRayInitVar = { 0x0256, 6, 0, 0, 0x0203, sizeof(z_ActorBgIkanaRay), - (z_ActorFunc)z_bg_ikana_ray_init, - (z_ActorFunc)z_bg_ikana_ray_fini, - (z_ActorFunc)z_bg_ikana_ray_main, - (z_ActorFunc)z_bg_ikana_ray_draw + (actor_func)z_bg_ikana_ray_init, + (actor_func)z_bg_ikana_ray_fini, + (actor_func)z_bg_ikana_ray_main, + (actor_func)z_bg_ikana_ray_draw }; GLOBAL_ASM( @@ -119,7 +119,7 @@ void func_80BD54BC(z_ActorBgIkanaRay* this, z_GlobalContext* ctxt) { } void func_80BD5500(z_ActorBgIkanaRay* this) { - this->baseActor.drawFunc = (z_ActorFunc)z_bg_ikana_ray_draw; + this->baseActor.drawFunc = (actor_func)z_bg_ikana_ray_draw; this->baseActor.unk4 &= 0xFFFFFFEF; this->unk404 = func_80BD5530; } diff --git a/src/boot/boot_0x80080180.c b/src/boot/boot_0x80080180.c index 175e6a8e7a..acf8ede508 100644 --- a/src/boot/boot_0x80080180.c +++ b/src/boot/boot_0x80080180.c @@ -43,7 +43,7 @@ UNK_RET func_80080250(void) { sp28 = *v0; *v0 = 0; - func_80080C04((s80080A08*)&sp48, (UNK_FUN_ARG)func_800A5AC0, v1, (u32)t7 - (u32)v1, 0, &sp30, 0); + func_80080C04((z_DmaRequest*)&sp48, (UNK_FUN_ARG)func_800A5AC0, v1, (u32)t7 - (u32)v1, 0, &sp30, 0); func_8008019C(); func_800801EC(); osRecvMesg(&sp30, 0, 1); diff --git a/src/boot/boot_0x80085320.c b/src/boot/boot_0x80085320.c index 191a67cb89..0bc8a1066a 100644 --- a/src/boot/boot_0x80085320.c +++ b/src/boot/boot_0x80085320.c @@ -1,9 +1,9 @@ #include #include -void func_80085320(s80085320* a0, UNK_PTR a1, UNK_PTR a2, UNK_TYPE a3, UNK_TYPE sp10, UNK_PTR sp14) { +void func_80085320(z_ThreadInfo* a0, UNK_PTR a1, UNK_PTR a2, UNK_TYPE a3, UNK_TYPE sp10, UNK_PTR sp14) { UNK_TYPE* i; - s80085320* v0; + z_ThreadInfo* v0; if (a0 == NULL) { g_s80085320_ListHead = NULL; @@ -42,7 +42,7 @@ void func_80085320(s80085320* a0, UNK_PTR a1, UNK_PTR a2, UNK_TYPE a3, UNK_TYPE } } -UNK_RET func_800853F8(s80085320* a0) { +UNK_RET func_800853F8(z_ThreadInfo* a0) { if (a0->prev == NULL) { if (g_s80085320_ListHead == a0) { g_s80085320_ListHead = a0->next; @@ -58,7 +58,7 @@ UNK_RET func_800853F8(s80085320* a0) { } } -UNK_TYPE func_80085468(s80085320* a0) { +UNK_TYPE func_80085468(z_ThreadInfo* a0) { UNK_TYPE* v1 = a0->unk8; UNK_TYPE* a1 = a0->unkC; UNK_TYPE* v0 = v1; @@ -83,7 +83,7 @@ UNK_TYPE func_80085468(s80085320* a0) { } UNK_TYPE func_800854E0(UNK_ARGS) { - s80085320* s0 = g_s80085320_ListHead; + z_ThreadInfo* s0 = g_s80085320_ListHead; UNK_TYPE ret = 0; while (s0 != NULL) { if (func_80085468(s0) != 0) { @@ -95,7 +95,7 @@ UNK_TYPE func_800854E0(UNK_ARGS) { return ret; } -UNK_RET func_80085538(s80085320* a0) { +UNK_RET func_80085538(z_ThreadInfo* a0) { if (a0 == NULL) { func_800854E0(); } else { diff --git a/src/boot_O2_g3/z_std_dma.c b/src/boot_O2_g3/z_std_dma.c index 0777296b74..f7a598de3b 100644 --- a/src/boot_O2_g3/z_std_dma.c +++ b/src/boot_O2_g3/z_std_dma.c @@ -48,8 +48,8 @@ void Dmamgr_osEPiStartDmaWrapper(OSPiHandle* pihandle, OSIoMesg* mb, s32 directi osEPiStartDma(pihandle, mb, direction); } -DmadataEntry* Dmamgr_FindDmaEntry(u32 a0) { - DmadataEntry* curr; +z_DmadataEntry* Dmamgr_FindDmaEntry(u32 a0) { + z_DmadataEntry* curr; for (curr = dmadata; curr->vromEnd != 0; curr++) { if (a0 < curr->vromStart) continue; @@ -62,7 +62,7 @@ DmadataEntry* Dmamgr_FindDmaEntry(u32 a0) { } s32 Dmamgr_TranslateVromToRom(u32 a0) { - DmadataEntry* v0 = Dmamgr_FindDmaEntry(a0); + z_DmadataEntry* v0 = Dmamgr_FindDmaEntry(a0); if (v0 != NULL) { if (v0->romEnd == 0) { @@ -80,7 +80,7 @@ s32 Dmamgr_TranslateVromToRom(u32 a0) { } s32 Dmamgr_FindDmaIndex(u32 a0) { - DmadataEntry* v0 = Dmamgr_FindDmaEntry(a0); + z_DmadataEntry* v0 = Dmamgr_FindDmaEntry(a0); if (v0 != NULL) { return v0 - dmadata; @@ -95,7 +95,7 @@ UNK_TYPE* func_800809F4(u32 a0) { #ifdef NONMATCHING -void Dmamgr_HandleRequest(s80080A08* a0) { +void Dmamgr_HandleRequest(z_DmaRequest* a0) { UNK_TYPE sp34; UNK_TYPE sp30; UNK_TYPE sp2C; @@ -149,9 +149,9 @@ GLOBAL_ASM("./asm/nonmatching/z_std_dma/Dmamgr_HandleRequest.asm") #ifdef NONMATCHING void Dmamgr_ThreadEntry(void* a0) { - s80080A08* sp34; + z_DmaRequest* sp34; UNK_TYPE pad; - s80080A08* s0; + z_DmaRequest* s0; for (;;) { osRecvMesg(&D_8009B2C0, (OSMesg)&sp34, 1); @@ -172,7 +172,7 @@ GLOBAL_ASM("./asm/nonmatching/z_std_dma/Dmamgr_ThreadEntry.asm") #ifdef NONMATCHING -s32 Dmamgr_SendRequest(s80080A08* a0, UNK_FUN_PTR(a1), UNK_PTR a2, UNK_TYPE a3, UNK_TYPE sp30, OSMesgQueue* sp34, UNK_TYPE sp38) { +s32 Dmamgr_SendRequest(z_DmaRequest* a0, UNK_FUN_PTR(a1), UNK_PTR a2, UNK_TYPE a3, UNK_TYPE sp30, OSMesgQueue* sp34, UNK_TYPE sp38) { // TODO this isn't correct, it uses a lui, addiu to get the address of D_80096B60, then loads it, // meaning that this is likely just "if (*D_80096B60 >= 2)". However, I can not get it to not // produce the usual lui, lw combo to load from an address :/ @@ -199,7 +199,7 @@ GLOBAL_ASM("./asm/nonmatching/z_std_dma/Dmamgr_SendRequest.asm") #endif s32 Dmamgr_SendRequestAndWait(UNK_TYPE a0, UNK_PTR a1, UNK_TYPE a2) { - s80080A08 sp48; + z_DmaRequest sp48; OSMesgQueue sp30; OSMesg sp2C; s32 ret; @@ -220,7 +220,7 @@ s32 Dmamgr_SendRequestAndWait(UNK_TYPE a0, UNK_PTR a1, UNK_TYPE a2) { #ifdef NONMATCHING void Dmamgr_Start() { - DmadataEntry* v0; + z_DmadataEntry* v0; u32 v1; // TODO register load ordering is wrong Dmamgr_DoDmaTransfer(&dmadataRomStart, dmadata, (u8*)&dmadataRomEnd - (u8*)&dmadataRomStart); diff --git a/src/code/code_0x800A5AC0.c b/src/code/code_0x800A5AC0.c index b1b3c0245a..dfbe0f8d9f 100644 --- a/src/code/code_0x800A5AC0.c +++ b/src/code/code_0x800A5AC0.c @@ -6,48 +6,48 @@ // This file is most likely En_A_Obj UNK_RET EnAObj_Init(void* a0, UNK_TYPE a1) { - s800A5AC0* s0 = (s800A5AC0*)a0; - s0->unk116 = ((s0->unk1C >> 8) & 0xFF) | 0x300; - s0->unk1C = (s0->unk1C & 0xFF) - 9; + z_ActorEnAObj* s0 = (z_ActorEnAObj*)a0; + s0->base.textId = ((s0->base.variable >> 8) & 0xFF) | 0x300; + s0->base.variable = (s0->base.variable & 0xFF) - 9; Lib_ApplyActorInitVars((z_Actor*)s0, (z_ActorCompInitEntry*)&D_801ADEAC); - func_800B3BA4(&s0->unkBC, 0, (UNK_PTR)&func_800B3FC0, 12); - Collision_InitCylinder(a1, &s0->unk148, (z_Actor*)s0, &D_801ADE80); - Collision_CylinderMoveToActor((z_Actor*)s0, &s0->unk148); - s0->unkB6 = 255; - s0->unk144 = EnAObj_Update1; + func_800B3BA4(&s0->base.unkBC, 0, (UNK_PTR)&func_800B3FC0, 12); + Collision_InitCylinder(a1, &s0->collision, (z_Actor*)s0, &D_801ADE80); + Collision_CylinderMoveToActor((z_Actor*)s0, &s0->collision); + s0->base.unkA0.unk16 = 255; + s0->update = (actor_func)EnAObj_Update1; } -UNK_RET EnAObj_Fini(s800A5AC0* a0, z_GlobalContext* a1) { - UNK_TYPE* a2 = &a0->unk148; +UNK_RET EnAObj_Fini(z_ActorEnAObj* a0, z_GlobalContext* a1) { + z_ColCylinder* a2 = &a0->collision; Collision_FiniCylinder(a1, a2); } -UNK_RET EnAObj_Update1(s800A5AC0* a0, UNK_TYPE a1) { +UNK_RET EnAObj_Update1(z_ActorEnAObj* a0, UNK_TYPE a1) { s16 v0; s32 v1; if (func_800B84D0(a0, a1) != 0) { - a0->unk144 = (void(*)(s800A5AC0*, UNK_TYPE))EnAObj_Update2; //! Is this cast correct? + a0->update = (actor_func)EnAObj_Update2; } else { - v0 = a0->unk92 - a0->unkBE; + v0 = a0->base.unk92 - a0->base.unkBC.rotation.y; v1 = (v0 < 0)? -v0 : v0; - if ((v1 < 10240) || ((a0->unk1C == 1) && (v1 > 22528))) { + if ((v1 < 10240) || ((a0->base.variable == 1) && (v1 > 22528))) { func_800B863C(a0, a1); } } } -UNK_RET EnAObj_Update2(s800A5AC0* a0) { +UNK_RET EnAObj_Update2(z_ActorEnAObj* a0) { if (func_800B867C(a0) != 0) { - a0->unk144 = EnAObj_Update1; + a0->update = (actor_func)EnAObj_Update1; } } -UNK_RET EnAObj_Main(s800A5AC0* a0, UNK_TYPE a1) { - (a0->unk144)(a0, a1); +UNK_RET EnAObj_Main(z_ActorEnAObj* a0, UNK_TYPE a1) { + (a0->update)((z_Actor*)a0, (z_GlobalContext*)a1); func_800B675C(a0, 0x42340000); - Collision_AddOT(a1, a1 + 0x18884, &a0->unk148); + Collision_AddOT(a1, a1 + 0x18884, &a0->collision); } -UNK_RET EnAObj_Draw(s800A5AC0* a0, UNK_TYPE a1) { - func_800BDFC0(a1, D_801ADEB0[a0->unk1C], a1, a0); +UNK_RET EnAObj_Draw(z_ActorEnAObj* a0, UNK_TYPE a1) { + func_800BDFC0(a1, D_801ADEB0[a0->base.variable], a1, a0); } diff --git a/src/code/code_0x800BF9A0.c b/src/code/code_0x800BF9A0.c index 4617d11b63..f0ee6166ff 100644 --- a/src/code/code_0x800BF9A0.c +++ b/src/code/code_0x800BF9A0.c @@ -3,7 +3,7 @@ UNK_RET func_800BF9A0(UNK_TYPE a0, UNK_TYPE a1) { s32 i; - s800BF9A0* s0; + z_ActorOverlayTableEntry* s0; UNK_TYPE v1; func_8008439C(-2, 0); @@ -11,27 +11,27 @@ UNK_RET func_800BF9A0(UNK_TYPE a0, UNK_TYPE a1) { func_800847CC(&D_801DCBC4); for (i = 0, s0 = &D_801AEFD0; i < D_801B4610; i++, s0++) { - v1 = s0->unkC - s0->unk8; - if (s0->unk10 == 0) continue; - func_800847CC(&D_801DCBE4, i, s0->unk10, s0->unk10 + v1, s0->unk1E, &D_801DCBFC); + v1 = s0->vramEnd - s0->vramStart; + if (s0->ramAddr == 0) continue; + func_800847CC(&D_801DCBE4, i, s0->ramAddr, s0->ramAddr + v1, s0->clients, &D_801DCBFC); } } UNK_TYPE func_800BFA78(UNK_TYPE a0, UNK_TYPE a1) { s32 i; - s800BF9A0* v0 = &D_801AEFD0; + z_ActorOverlayTableEntry* v0 = &D_801AEFD0; UNK_TYPE t1; UNK_TYPE a2; UNK_TYPE a0_2 = a0; for (i = 0; i < D_801B4610; i++, v0++) { - t1 = v0->unk8 - v0->unk10; - a2 = v0->unkC - v0->unk8; + t1 = v0->vramStart - v0->ramAddr; + a2 = v0->vramEnd - v0->vramStart; - if (v0->unk10 == 0) continue; - if (a0_2 < v0->unk10) continue; + if (v0->ramAddr == 0) continue; + if (a0_2 < v0->ramAddr) continue; - if (a0_2 < (v0->unk10 + a2)) { + if (a0_2 < (v0->ramAddr + a2)) { return a0_2 + t1; } } diff --git a/src/code/code_0x800CAAD0.c b/src/code/code_0x800CAAD0.c index 748b162abc..de931d94e1 100644 --- a/src/code/code_0x800CAAD0.c +++ b/src/code/code_0x800CAAD0.c @@ -15,8 +15,8 @@ UNK_RET func_800CAAD0(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { v1 = (s800CAAD0*)(a0 + a1 * 100); - func_80139894(&spD0, v1->unk68, v1->unk6C, v1->unk70, v1->unk72, v1->unk74, - v1->unk76, v1->unk7C, v1->unk80, v1->unk84); + func_80139894(&spD0, v1->unk68, v1->unk6C, v1->unk70, v1->unk74, v1->unk76, + v1->unk78, v1->unk7C, v1->unk80, v1->unk84); if (func_80139188(&spD0, &sp90) == 2) return; diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 643b6a99e9..bb14519825 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -6,7 +6,7 @@ void EffectSS_Init(z_GlobalContext* ctxt, s32 numEntries) { z_LoadedParticleEntry* iter; z_ParticleOverlayTableEntry* iter2; - EffectSS2Info.data_table = (z_LoadedParticleEntry*)GameStateHeap_AllocFromEnd(&ctxt->unk74, numEntries * sizeof(z_LoadedParticleEntry)); + EffectSS2Info.data_table = (z_LoadedParticleEntry*)GameStateHeap_AllocFromEnd(&ctxt->commonVars.heap, numEntries * sizeof(z_LoadedParticleEntry)); EffectSS2Info.searchIndex = 0; EffectSS2Info.size = numEntries; @@ -81,11 +81,11 @@ void EffectSS_ResetLoadedParticleEntry(z_LoadedParticleEntry* particle) { particle->priority = 128; particle->draw = NULL; particle->update = NULL; - particle->unk38 = 0; + particle->displayList = 0; particle->unk3C = 0; for (i = 0; i != 13; i++) { - particle->unk40[i] = 0; + particle->regs[i] = 0; } } @@ -282,9 +282,9 @@ void EffectSS_DrawAllParticles(z_GlobalContext* ctxt) { UNK_TYPE s0; s32 i; - s0 = Lights_CreateMapper(&ctxt->unk818, ctxt->unk0); - Lights_MapLights(s0, ctxt->unk818, 0, ctxt); - Lights_UploadLights(s0, ctxt->unk0); + s0 = Lights_CreateMapper(&ctxt->lightsContext, ctxt->commonVars.graphicsContext); + Lights_MapLights(s0, ctxt->lightsContext.lightsHead, 0, ctxt); + Lights_UploadLights(s0, ctxt->commonVars.graphicsContext); for (i = 0; i < EffectSS2Info.size; i++) { if (EffectSS2Info.data_table[i].life > -1) { diff --git a/src/code/z_lib.c b/src/code/z_lib.c index 8bef86d076..23ba6a0cf4 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -255,7 +255,7 @@ s16 Lib_randStride_s(s16 a0, s16 a1, s16 a2) { return (s16)(randZeroOne() * a2) * a1 + a0; } -UNK_RET Lib_CopyVec3f(z_Vector3D* dst, z_Vector3D* src) { +UNK_RET Lib_CopyVec3f(z_Vector3f* dst, z_Vector3f* src) { f32 x = src->x; f32 y = src->y; f32 z = src->z; @@ -265,7 +265,7 @@ UNK_RET Lib_CopyVec3f(z_Vector3D* dst, z_Vector3D* src) { dst->z = z; } -UNK_RET Lib_CopyVec3s(z_Vector3Ds16* dst, z_Vector3Ds16* src) { +UNK_RET Lib_CopyVec3s(z_Vector3s* dst, z_Vector3s* src) { s16 x = src->x; s16 y = src->y; s16 z = src->z; @@ -275,7 +275,7 @@ UNK_RET Lib_CopyVec3s(z_Vector3Ds16* dst, z_Vector3Ds16* src) { dst->z = z; } -UNK_RET Lib_ToVec3f(z_Vector3D* dst, z_Vector3Ds16* src) { +UNK_RET Lib_ToVec3f(z_Vector3f* dst, z_Vector3s* src) { f32 x = src->x; f32 y = src->y; f32 z = src->z; @@ -285,7 +285,7 @@ UNK_RET Lib_ToVec3f(z_Vector3D* dst, z_Vector3Ds16* src) { dst->z = z; } -UNK_RET Lib_ToVec3s(z_Vector3Ds16* dst, z_Vector3D* src) { +UNK_RET Lib_ToVec3s(z_Vector3s* dst, z_Vector3f* src) { f32 x = src->x; f32 y = src->y; f32 z = src->z; @@ -295,55 +295,55 @@ UNK_RET Lib_ToVec3s(z_Vector3Ds16* dst, z_Vector3D* src) { dst->z = z; } -UNK_RET Lib_AddVec3f(z_Vector3D* a0, z_Vector3D* a1, z_Vector3D* a2) { +UNK_RET Lib_AddVec3f(z_Vector3f* a0, z_Vector3f* a1, z_Vector3f* a2) { a2->x = a0->x + a1->x; a2->y = a0->y + a1->y; a2->z = a0->z + a1->z; } -UNK_RET Lib_SubVec3f(z_Vector3D* a0, z_Vector3D* a1, z_Vector3D* a2) { +UNK_RET Lib_SubVec3f(z_Vector3f* a0, z_Vector3f* a1, z_Vector3f* a2) { a2->x = a0->x - a1->x; a2->y = a0->y - a1->y; a2->z = a0->z - a1->z; } -UNK_RET Lib_SubVec3sToVec3f(z_Vector3D* a0, z_Vector3Ds16* a1, z_Vector3Ds16* a2) { +UNK_RET Lib_SubVec3sToVec3f(z_Vector3f* a0, z_Vector3s* a1, z_Vector3s* a2) { a0->x = a1->x - a2->x; a0->y = a1->y - a2->y; a0->z = a1->z - a2->z; } -UNK_RET Lib_ScaleInPlaceVec3f(z_Vector3D* a0, f32 a1) { +UNK_RET Lib_ScaleInPlaceVec3f(z_Vector3f* a0, f32 a1) { a0->x *= a1; a0->y *= a1; a0->z *= a1; } -UNK_RET Lib_ScaleVec3f(z_Vector3D* a0, f32 a1, z_Vector3D* a2) { +UNK_RET Lib_ScaleVec3f(z_Vector3f* a0, f32 a1, z_Vector3f* a2) { a2->x = a0->x * a1; a2->y = a0->y * a1; a2->z = a0->z * a1; } -UNK_RET Lib_LerpVec3f(z_Vector3D* a0, z_Vector3D* a1, f32 a2, z_Vector3D* a3) { +UNK_RET Lib_LerpVec3f(z_Vector3f* a0, z_Vector3f* a1, f32 a2, z_Vector3f* a3) { a3->x = (a1->x - a0->x) * a2 + a0->x; a3->y = (a1->y - a0->y) * a2 + a0->y; a3->z = (a1->z - a0->z) * a2 + a0->z; } -UNK_RET Lib_AddScaledVec3f(z_Vector3D* a0, z_Vector3D* a1, f32 a2, z_Vector3D* a3) { +UNK_RET Lib_AddScaledVec3f(z_Vector3f* a0, z_Vector3f* a1, f32 a2, z_Vector3f* a3) { a3->x = a1->x * a2 + a0->x; a3->y = a1->y * a2 + a0->y; a3->z = a1->z * a2 + a0->z; } -UNK_RET Lib_ModifyRandScaled(z_Vector3D* a0, f32 a1, z_Vector3D* a2) { +UNK_RET Lib_ModifyRandScaled(z_Vector3f* a0, f32 a1, z_Vector3f* a2) { a2->x = randPlusMinusPoint5Scaled(a1) + a0->x; a2->y = randPlusMinusPoint5Scaled(a1) + a0->y; a2->z = randPlusMinusPoint5Scaled(a1) + a0->z; } -void Lib_ScaledNormalizedDifferenceVec3f(z_Vector3D* a0, z_Vector3D* a1, f32 a2, z_Vector3D* a3) { +void Lib_ScaledNormalizedDifferenceVec3f(z_Vector3f* a0, z_Vector3f* a1, f32 a2, z_Vector3f* a3) { f32 f0 = Lib_DistanceAndDifferenceVec3f(a0, a1, a3); f32 f2; @@ -358,24 +358,24 @@ void Lib_ScaledNormalizedDifferenceVec3f(z_Vector3D* a0, z_Vector3D* a1, f32 a2, a3->z *= f2; } -f32 Lib_DistanceVec3f(z_Vector3D* a0, z_Vector3D* a1) { - z_Vector3D sp1C; +f32 Lib_DistanceVec3f(z_Vector3f* a0, z_Vector3f* a1) { + z_Vector3f sp1C; Lib_SubVec3f(a1, a0, &sp1C); return sqrtf((sp1C.x * sp1C.x) + (sp1C.y * sp1C.y) + (sp1C.z * sp1C.z)); } -f32 Lib_DistanceAndDifferenceVec3f(z_Vector3D* a0, z_Vector3D* a1, z_Vector3D* a2) { +f32 Lib_DistanceAndDifferenceVec3f(z_Vector3f* a0, z_Vector3f* a1, z_Vector3f* a2) { Lib_SubVec3f(a1, a0, a2); return sqrtf((a2->x * a2->x) + (a2->y * a2->y) + (a2->z * a2->z)); } -f32 Lib_DistanceXZVec3f(z_Vector3D* a0, z_Vector3D* a1) { +f32 Lib_DistanceXZVec3f(z_Vector3f* a0, z_Vector3f* a1) { f32 dx = a1->x - a0->x; f32 dz = a1->z - a0->z; return sqrtf((dx * dx) + (dz * dz)); } -f32 Lib_DistanceAndDifferenceXZVec3f(z_Vector3D* a0, z_Vector3D* a1, f32* a2, f32* a3) { +f32 Lib_DistanceAndDifferenceXZVec3f(z_Vector3f* a0, z_Vector3f* a1, f32* a2, f32* a3) { *a2 = a1->x - a0->x; *a3 = a1->z - a0->z; return sqrtf((*a2 * *a2) + (*a3 * *a3)); @@ -383,7 +383,7 @@ f32 Lib_DistanceAndDifferenceXZVec3f(z_Vector3D* a0, z_Vector3D* a1, f32* a2, f3 #ifdef NONMATCHING -UNK_RET Lib_PushAwayXZVec3f(z_Vector3D* a0, z_Vector3D* a1, f32 a2) { +UNK_RET Lib_PushAwayXZVec3f(z_Vector3f* a0, z_Vector3f* a1, f32 a2) { f32 sp24; f32 sp20; f32 f0 = Lib_DistanceAndDifferenceXZVec3f(a1, a0, &sp24, &sp20); @@ -405,17 +405,17 @@ GLOBAL_ASM("./asm/nonmatching/z_lib/Lib_PushAwayXZVec3f.asm") #endif -f32 Lib_DistanceYVec3f(z_Vector3D* a0, z_Vector3D* a1) { +f32 Lib_DistanceYVec3f(z_Vector3f* a0, z_Vector3f* a1) { return a1->y - a0->y; } -UNK_TYPE Lib_YawVec3f(z_Vector3D* a0, z_Vector3D* a1) { +UNK_TYPE Lib_YawVec3f(z_Vector3f* a0, z_Vector3f* a1) { f32 f14 = a1->x - a0->x; f32 f12 = a1->z - a0->z; return atans_flip(f12, f14); } -UNK_TYPE Lib_PitchVec3f(z_Vector3D* a0, z_Vector3D* a1) { +UNK_TYPE Lib_PitchVec3f(z_Vector3f* a0, z_Vector3f* a1) { return atans_flip(Lib_DistanceXZVec3f(a0, a1), a0->y - a1->y); } @@ -458,7 +458,7 @@ UNK_RET Lib_ApplyActorInitVarFloat1000th(u8* a0, z_ActorCompInitEntry* a1) { } UNK_RET Lib_ApplyActorInitVarVector3f(u8* a0, z_ActorCompInitEntry* a1) { - z_Vector3D* v0 = (z_Vector3D*)(a0 + a1->offset); + z_Vector3f* v0 = (z_Vector3f*)(a0 + a1->offset); f32 f0 = (f32)(a1->value); v0->z = f0; @@ -467,7 +467,7 @@ UNK_RET Lib_ApplyActorInitVarVector3f(u8* a0, z_ActorCompInitEntry* a1) { } UNK_RET Lib_ApplyActorInitVarVector3f1000th(u8* a0, z_ActorCompInitEntry* a1) { - z_Vector3D* v0 = (z_Vector3D*)(a0 + a1->offset); + z_Vector3f* v0 = (z_Vector3f*)(a0 + a1->offset); f32 f0 = (f32)(a1->value) / 1000; v0->z = f0; @@ -476,7 +476,7 @@ UNK_RET Lib_ApplyActorInitVarVector3f1000th(u8* a0, z_ActorCompInitEntry* a1) { } UNK_RET Lib_ApplyActorInitVarVector3s(u8* a0, z_ActorCompInitEntry* a1) { - z_Vector3Ds16* v0 = (z_Vector3Ds16*)(a0 + a1->offset); + z_Vector3s* v0 = (z_Vector3s*)(a0 + a1->offset); s16 v1 = (s16)(a1->value); v0->z = v1; @@ -600,7 +600,7 @@ UNK_RET func_801000F4(UNK_TYPE a0, u16 a1) { func_8019F1C0(a0, a1); } -void Lib_TranslateAndRotateYVec3f(z_Vector3D* a0, s16 a1, z_Vector3D* a2, z_Vector3D* a3) { +void Lib_TranslateAndRotateYVec3f(z_Vector3f* a0, s16 a1, z_Vector3f* a2, z_Vector3f* a3) { f32 sp1C; f32 f0; @@ -626,8 +626,8 @@ GLOBAL_ASM("./asm/nonmatching/z_lib/Lib_LerpRGB.asm") #endif -f32 Lib_PushAwayVec3f(z_Vector3D* a0, z_Vector3D* a1, f32 a2) { - z_Vector3D sp24; +f32 Lib_PushAwayVec3f(z_Vector3f* a0, z_Vector3f* a1, f32 a2) { + z_Vector3f sp24; f32 f2; f32 f0; diff --git a/src/libultra/os/initialize.c b/src/libultra/os/initialize.c index 88ae0dd3ca..37bdf7274a 100644 --- a/src/libultra/os/initialize.c +++ b/src/libultra/os/initialize.c @@ -30,10 +30,10 @@ void osInitialize(void) { while (__osSiRawReadIo(0x1FC007FC, &pifdata) != 0); while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8) != 0); - *(s8008A6FC*)0x80000000 = *((s8008A6FC*)__osExceptionPreamble); - *(s8008A6FC*)0x80000080 = *((s8008A6FC*)__osExceptionPreamble); - *(s8008A6FC*)0x80000100 = *((s8008A6FC*)__osExceptionPreamble); - *(s8008A6FC*)0x80000180 = *((s8008A6FC*)__osExceptionPreamble); + *(__osExceptionVector*)0x80000000 = *((__osExceptionVector*)__osExceptionPreamble); + *(__osExceptionVector*)0x80000080 = *((__osExceptionVector*)__osExceptionPreamble); + *(__osExceptionVector*)0x80000100 = *((__osExceptionVector*)__osExceptionPreamble); + *(__osExceptionVector*)0x80000180 = *((__osExceptionVector*)__osExceptionPreamble); osWritebackDCache((void*)0x80000000, 400); osInvalICache((void*)0x80000000, 400); diff --git a/tables/functions.py b/tables/functions.py index 9c391738a7..2f8282e706 100644 --- a/tables/functions.py +++ b/tables/functions.py @@ -13,13 +13,13 @@ 0x80080748:("func_80080748","UNK_RET","void"), 0x80080790:("Dmamgr_DoDmaTransfer","s32","void*, void*, s32"), 0x800808D4:("Dmamgr_osEPiStartDmaWrapper","void","OSPiHandle* pihandle, OSIoMesg* mb, s32 direction"), - 0x800808F4:("Dmamgr_FindDmaEntry","DmadataEntry*","u32"), + 0x800808F4:("Dmamgr_FindDmaEntry","z_DmadataEntry*","u32"), 0x80080950:("Dmamgr_TranslateVromToRom","s32","u32"), 0x800809BC:("Dmamgr_FindDmaIndex","s32","u32"), 0x800809F4:("func_800809F4","UNK_TYPE*","u32"), - 0x80080A08:("Dmamgr_HandleRequest","void","s80080A08*"), + 0x80080A08:("Dmamgr_HandleRequest","void","z_DmaRequest*"), 0x80080B84:("Dmamgr_ThreadEntry","void","void*"), - 0x80080C04:("Dmamgr_SendRequest","s32","s80080A08*, UNK_FUN_ARG, UNK_PTR, UNK_TYPE, UNK_TYPE, OSMesgQueue*, UNK_TYPE"), + 0x80080C04:("Dmamgr_SendRequest","s32","z_DmaRequest*, UNK_FUN_ARG, UNK_PTR, UNK_TYPE, UNK_TYPE, OSMesgQueue*, UNK_TYPE"), 0x80080C90:("Dmamgr_SendRequestAndWait","s32","UNK_TYPE, UNK_PTR, UNK_TYPE"), 0x80080D0C:("Dmamgr_Start","void","void"), 0x80080E00:("Dmamgr_Stop","void","void"), @@ -38,7 +38,7 @@ 0x800815A8:("Irqmgr_CheckThreadStatus","UNK_RET","UNK_ARGS"), 0x800815CC:("Irqmgr_HandleFrame","UNK_RET","UNK_ARGS"), 0x80081684:("Irqmgr_ThreadEntry","UNK_RET","UNK_ARGS"), - 0x80081754:("Irqmgr_Start","UNK_RET","UNK_PTR, s80085320*, UNK_TYPE, UNK_TYPE"), + 0x80081754:("Irqmgr_Start","UNK_RET","UNK_PTR, z_ThreadInfo*, UNK_TYPE, UNK_TYPE"), 0x80081820:("nop_80081820","void","void"), 0x80081828:("nop_80081828","void","void"), 0x80081830:("func_80081830","void","void"), @@ -131,11 +131,11 @@ 0x8008520C:("func_8008520C","UNK_RET","UNK_ARGS"), 0x8008522C:("func_8008522C","UNK_RET","UNK_ARGS"), 0x8008524C:("func_8008524C","UNK_RET","UNK_ARGS"), - 0x80085320:("thread_info_init","void","s80085320*, UNK_PTR, UNK_PTR, UNK_TYPE, UNK_TYPE, UNK_PTR"), - 0x800853F8:("func_800853F8","UNK_RET","s80085320*"), - 0x80085468:("get_thread_stack_status","UNK_TYPE","s80085320*"), + 0x80085320:("thread_info_init","void","z_ThreadInfo*, UNK_PTR, UNK_PTR, UNK_TYPE, UNK_TYPE, UNK_PTR"), + 0x800853F8:("func_800853F8","UNK_RET","z_ThreadInfo*"), + 0x80085468:("get_thread_stack_status","UNK_TYPE","z_ThreadInfo*"), 0x800854E0:("check_all_thread_status","UNK_TYPE","UNK_ARGS"), - 0x80085538:("check_thread_status","UNK_RET","s80085320*"), + 0x80085538:("check_thread_status","UNK_RET","z_ThreadInfo*"), 0x80085570:("func_80085570","UNK_RET","UNK_ARGS"), 0x800859BC:("func_800859BC","UNK_RET","UNK_ARGS"), 0x80085A08:("func_80085A08","UNK_RET","UNK_ARGS"), @@ -485,11 +485,11 @@ 0x800968B0:("func_800968B0","u32","const u8*, const u8*"), 0x80096930:("func_80096930","UNK_RET","UNK_ARGS"), 0x800A5AC0:("EnAObj_Init","UNK_RET","void*, UNK_TYPE"), - 0x800A5B6C:("EnAObj_Fini","UNK_RET","s800A5AC0*, z_GlobalContext*"), - 0x800A5B98:("EnAObj_Update1","UNK_RET","s800A5AC0*, UNK_TYPE"), - 0x800A5C28:("EnAObj_Update2","UNK_RET","s800A5AC0*"), - 0x800A5C60:("EnAObj_Main","UNK_RET","s800A5AC0*, UNK_TYPE"), - 0x800A5CB8:("EnAObj_Draw","UNK_RET","s800A5AC0*, UNK_TYPE"), + 0x800A5B6C:("EnAObj_Fini","UNK_RET","z_ActorEnAObj*, z_GlobalContext*"), + 0x800A5B98:("EnAObj_Update1","UNK_RET","z_ActorEnAObj*, UNK_TYPE"), + 0x800A5C28:("EnAObj_Update2","UNK_RET","z_ActorEnAObj*"), + 0x800A5C60:("EnAObj_Main","UNK_RET","z_ActorEnAObj*, UNK_TYPE"), + 0x800A5CB8:("EnAObj_Draw","UNK_RET","z_ActorEnAObj*, UNK_TYPE"), 0x800A5D00:("EnItem00_UpdateForNewObjectId","UNK_RET","UNK_ARGS"), 0x800A5D70:("EnItem00_Init","UNK_RET","UNK_ARGS"), 0x800A637C:("EnItem00_Fini","UNK_RET","UNK_ARGS"), @@ -597,7 +597,7 @@ 0x800B14D4:("func_800B14D4","UNK_RET","UNK_ARGS"), 0x800B1598:("func_800B1598","UNK_RET","UNK_ARGS"), 0x800B165C:("func_800B165C","UNK_RET","UNK_ARGS"), - 0x800B16B8:("func_800B16B8","UNK_RET","z_GlobalContext*, z_Vector3D*, UNK_PTR, UNK_PTR, UNK_PTR, UNK_PTR"), + 0x800B16B8:("func_800B16B8","UNK_RET","z_GlobalContext*, z_Vector3f*, UNK_PTR, UNK_PTR, UNK_PTR, UNK_PTR"), 0x800B16F4:("EffectSS_LoadSparkle","UNK_RET","UNK_ARGS"), 0x800B1830:("func_800B1830","UNK_RET","UNK_ARGS"), 0x800B1908:("EffectSS_LoadBomb2","UNK_RET","UNK_ARGS"), @@ -706,7 +706,7 @@ 0x800B6680:("func_800B6680","UNK_RET","UNK_ARGS"), 0x800B670C:("Actor_MarkForDeath","UNK_RET","z_Actor*"), 0x800B672C:("func_800B672C","UNK_RET","UNK_ARGS"), - 0x800B675C:("func_800B675C","UNK_RET","s800A5AC0*, UNK_TYPE"), + 0x800B675C:("func_800B675C","UNK_RET","z_ActorEnAObj*, UNK_TYPE"), 0x800B67A0:("func_800B67A0","UNK_RET","UNK_ARGS"), 0x800B67C0:("func_800B67C0","UNK_RET","UNK_ARGS"), 0x800B67E0:("Actor_SetScale","UNK_RET","z_Actor*, f32"), @@ -770,12 +770,12 @@ 0x800B82EC:("func_800B82EC","UNK_RET","UNK_ARGS"), 0x800B83BC:("func_800B83BC","UNK_RET","UNK_ARGS"), 0x800B83F8:("func_800B83F8","UNK_RET","UNK_ARGS"), - 0x800B84D0:("func_800B84D0","UNK_TYPE","s800A5AC0*, UNK_TYPE"), + 0x800B84D0:("func_800B84D0","UNK_TYPE","z_ActorEnAObj*, UNK_TYPE"), 0x800B8500:("func_800B8500","UNK_RET","UNK_ARGS"), 0x800B85E0:("func_800B85E0","UNK_RET","UNK_ARGS"), 0x800B8614:("func_800B8614","UNK_RET","UNK_ARGS"), - 0x800B863C:("func_800B863C","UNK_RET","s800A5AC0*, UNK_TYPE"), - 0x800B867C:("func_800B867C","UNK_TYPE","s800A5AC0*"), + 0x800B863C:("func_800B863C","UNK_RET","z_ActorEnAObj*, UNK_TYPE"), + 0x800B867C:("func_800B867C","UNK_TYPE","z_ActorEnAObj*"), 0x800B86C8:("func_800B86C8","UNK_RET","UNK_ARGS"), 0x800B8708:("func_800B8708","UNK_RET","UNK_ARGS"), 0x800B8718:("func_800B8718","UNK_RET","UNK_ARGS"), @@ -880,7 +880,7 @@ 0x800BDC5C:("func_800BDC5C","UNK_RET","UNK_ARGS"), 0x800BDCF4:("func_800BDCF4","UNK_RET","UNK_ARGS"), 0x800BDFB0:("func_800BDFB0","UNK_RET","UNK_ARGS"), - 0x800BDFC0:("func_800BDFC0","UNK_RET","UNK_TYPE, UNK_TYPE, UNK_TYPE, s800A5AC0*"), + 0x800BDFC0:("func_800BDFC0","UNK_RET","UNK_TYPE, UNK_TYPE, UNK_TYPE, z_ActorEnAObj*"), 0x800BE03C:("func_800BE03C","void","z_GlobalContext*, UNK_TYPE"), 0x800BE0B8:("func_800BE0B8","UNK_RET","UNK_ARGS"), 0x800BE184:("func_800BE184","UNK_RET","UNK_ARGS"), @@ -1612,7 +1612,7 @@ 0x800F0390:("func_800F0390","UNK_RET","UNK_ARGS"), 0x800F03C0:("func_800F03C0","UNK_RET","UNK_ARGS"), 0x800F048C:("func_800F048C","UNK_RET","UNK_ARGS"), - 0x800F0568:("func_800F0568","UNK_RET","z_GlobalContext*, z_Vector3D*, UNK_TYPE, UNK_TYPE"), + 0x800F0568:("func_800F0568","UNK_RET","z_GlobalContext*, z_Vector3f*, UNK_TYPE, UNK_TYPE"), 0x800F0590:("func_800F0590","UNK_RET","UNK_ARGS"), 0x800F05C0:("func_800F05C0","UNK_RET","UNK_ARGS"), 0x800F07C0:("func_800F07C0","UNK_RET","UNK_ARGS"), @@ -1804,27 +1804,27 @@ 0x800FF3A0:("func_800FF3A0","UNK_RET","UNK_ARGS"), 0x800FF450:("Lib_rand_s","s16","s16 a0, s16 a1"), 0x800FF4A4:("Lib_randStride_s","s16","s16 a0, s16 a1, s16 a2"), - 0x800FF50C:("Lib_CopyVec3f","UNK_RET","z_Vector3D* dst, z_Vector3D* src"), - 0x800FF52C:("Lib_CopyVec3s","UNK_RET","z_Vector3Ds16* dst, z_Vector3Ds16* src"), - 0x800FF54C:("Lib_ToVec3f","UNK_RET","z_Vector3D* dst, z_Vector3Ds16* src"), - 0x800FF584:("Lib_ToVec3s","UNK_RET","z_Vector3Ds16* dst, z_Vector3D* src"), - 0x800FF5BC:("Lib_AddVec3f","UNK_RET","z_Vector3D* a0, z_Vector3D* a1, z_Vector3D* a2"), - 0x800FF5F4:("Lib_SubVec3f","UNK_RET","z_Vector3D* a0, z_Vector3D* a1, z_Vector3D* a2"), - 0x800FF62C:("Lib_SubVec3sToVec3f","UNK_RET","z_Vector3D* a0, z_Vector3Ds16* a1, z_Vector3Ds16* a2"), - 0x800FF688:("Lib_ScaleInPlaceVec3f","UNK_RET","z_Vector3D* a0, f32 a1"), - 0x800FF6C4:("Lib_ScaleVec3f","UNK_RET","z_Vector3D* a0, f32 a1, z_Vector3D* a2"), - 0x800FF6F8:("Lib_LerpVec3f","UNK_RET","z_Vector3D* a0, z_Vector3D* a1, f32 a2, z_Vector3D* a3"), - 0x800FF750:("Lib_AddScaledVec3f","UNK_RET","z_Vector3D* a0, z_Vector3D* a1, f32 a2, z_Vector3D* a3"), - 0x800FF79C:("Lib_ModifyRandScaled","UNK_RET","z_Vector3D* a0, f32 a1, z_Vector3D* a2"), - 0x800FF810:("Lib_ScaledNormalizedDifferenceVec3f","UNK_RET","z_Vector3D* a0, z_Vector3D* a1, f32 a2, z_Vector3D* a3"), - 0x800FF884:("Lib_DistanceVec3f","f32","z_Vector3D* a0, z_Vector3D* a1"), - 0x800FF8D4:("Lib_DistanceAndDifferenceVec3f","f32","z_Vector3D* a0, z_Vector3D* a1, z_Vector3D* a2"), - 0x800FF92C:("Lib_DistanceXZVec3f","f32","z_Vector3D* a0, z_Vector3D* a1"), - 0x800FF960:("Lib_DistanceAndDifferenceXZVec3f","f32","z_Vector3D* a0, z_Vector3D* a1, f32* a2, f32* a3"), - 0x800FF9A4:("Lib_PushAwayXZVec3f","UNK_RET","z_Vector3D* a0, z_Vector3D* a1, f32 a2"), - 0x800FFA4C:("Lib_DistanceYVec3f","f32","z_Vector3D* a0, z_Vector3D* a1"), - 0x800FFA60:("Lib_YawVec3f","UNK_TYPE","z_Vector3D* a0, z_Vector3D* a1"), - 0x800FFA94:("Lib_PitchVec3f","UNK_TYPE","z_Vector3D* a0, z_Vector3D* a1"), + 0x800FF50C:("Lib_CopyVec3f","UNK_RET","z_Vector3f* dst, z_Vector3f* src"), + 0x800FF52C:("Lib_CopyVec3s","UNK_RET","z_Vector3s* dst, z_Vector3s* src"), + 0x800FF54C:("Lib_ToVec3f","UNK_RET","z_Vector3f* dst, z_Vector3s* src"), + 0x800FF584:("Lib_ToVec3s","UNK_RET","z_Vector3s* dst, z_Vector3f* src"), + 0x800FF5BC:("Lib_AddVec3f","UNK_RET","z_Vector3f* a0, z_Vector3f* a1, z_Vector3f* a2"), + 0x800FF5F4:("Lib_SubVec3f","UNK_RET","z_Vector3f* a0, z_Vector3f* a1, z_Vector3f* a2"), + 0x800FF62C:("Lib_SubVec3sToVec3f","UNK_RET","z_Vector3f* a0, z_Vector3s* a1, z_Vector3s* a2"), + 0x800FF688:("Lib_ScaleInPlaceVec3f","UNK_RET","z_Vector3f* a0, f32 a1"), + 0x800FF6C4:("Lib_ScaleVec3f","UNK_RET","z_Vector3f* a0, f32 a1, z_Vector3f* a2"), + 0x800FF6F8:("Lib_LerpVec3f","UNK_RET","z_Vector3f* a0, z_Vector3f* a1, f32 a2, z_Vector3f* a3"), + 0x800FF750:("Lib_AddScaledVec3f","UNK_RET","z_Vector3f* a0, z_Vector3f* a1, f32 a2, z_Vector3f* a3"), + 0x800FF79C:("Lib_ModifyRandScaled","UNK_RET","z_Vector3f* a0, f32 a1, z_Vector3f* a2"), + 0x800FF810:("Lib_ScaledNormalizedDifferenceVec3f","UNK_RET","z_Vector3f* a0, z_Vector3f* a1, f32 a2, z_Vector3f* a3"), + 0x800FF884:("Lib_DistanceVec3f","f32","z_Vector3f* a0, z_Vector3f* a1"), + 0x800FF8D4:("Lib_DistanceAndDifferenceVec3f","f32","z_Vector3f* a0, z_Vector3f* a1, z_Vector3f* a2"), + 0x800FF92C:("Lib_DistanceXZVec3f","f32","z_Vector3f* a0, z_Vector3f* a1"), + 0x800FF960:("Lib_DistanceAndDifferenceXZVec3f","f32","z_Vector3f* a0, z_Vector3f* a1, f32* a2, f32* a3"), + 0x800FF9A4:("Lib_PushAwayXZVec3f","UNK_RET","z_Vector3f* a0, z_Vector3f* a1, f32 a2"), + 0x800FFA4C:("Lib_DistanceYVec3f","f32","z_Vector3f* a0, z_Vector3f* a1"), + 0x800FFA60:("Lib_YawVec3f","UNK_TYPE","z_Vector3f* a0, z_Vector3f* a1"), + 0x800FFA94:("Lib_PitchVec3f","UNK_TYPE","z_Vector3f* a0, z_Vector3f* a1"), 0x800FFADC:("Lib_ApplyActorInitVars","void","z_Actor*, z_ActorCompInitEntry*"), 0x800FFB54:("Lib_ApplyActorInitVarByte1","UNK_RET","u8* a0, z_ActorCompInitEntry* a1"), 0x800FFB70:("Lib_ApplyActorInitVarByte2","UNK_RET","u8* a0, z_ActorCompInitEntry* a1"), @@ -1846,9 +1846,9 @@ 0x801000A4:("func_801000A4","UNK_RET","u16 a0"), 0x801000CC:("func_801000CC","UNK_RET","u16 a0"), 0x801000F4:("func_801000F4","UNK_RET","UNK_TYPE a0, u16 a1"), - 0x8010011C:("Lib_TranslateAndRotateYVec3f","UNK_RET","z_Vector3D* a0, s16 a1, z_Vector3D* a2, z_Vector3D* a3"), + 0x8010011C:("Lib_TranslateAndRotateYVec3f","UNK_RET","z_Vector3f* a0, s16 a1, z_Vector3f* a2, z_Vector3f* a3"), 0x801001B8:("Lib_LerpRGB","UNK_RET","u8* a0, u8* a1, f32 a2, u8* a3"), - 0x80100448:("Lib_PushAwayVec3f","f32","z_Vector3D* a0, z_Vector3D* a1, f32 a2"), + 0x80100448:("Lib_PushAwayVec3f","f32","z_Vector3f* a0, z_Vector3f* a1, f32 a2"), 0x801004FC:("Lib_Nop801004FC","UNK_RET","void"), 0x80100504:("Lib_PtrSegToPhys","UNK_TYPE","u32 a0"), 0x8010053C:("Lib_PtrSegToPhysNull","UNK_TYPE","u32 a0"), @@ -1874,13 +1874,13 @@ 0x80101D3C:("Lights_MapPositionalWithReference","UNK_RET","UNK_ARGS"), 0x801020A0:("Lights_MapPositional","UNK_RET","UNK_ARGS"), 0x80102284:("Lights_MapDirectional","UNK_RET","UNK_ARGS"), - 0x801022F0:("Lights_MapLights","UNK_RET","UNK_TYPE, UNK_TYPE, UNK_TYPE, z_GlobalContext*"), + 0x801022F0:("Lights_MapLights","UNK_RET","UNK_TYPE, z_Light*, UNK_TYPE, z_GlobalContext*"), 0x801023D8:("Lights_FindFreeSlot","UNK_RET","UNK_ARGS"), 0x80102464:("Lights_Free","UNK_RET","UNK_ARGS"), 0x801024AC:("Lights_Init","UNK_RET","UNK_ARGS"), 0x80102518:("Lights_SetAmbientColor","UNK_RET","UNK_ARGS"), 0x80102544:("func_80102544","UNK_RET","UNK_ARGS"), - 0x80102580:("Lights_CreateMapper","UNK_TYPE","UNK_PTR, z_GraphicsContext*"), + 0x80102580:("Lights_CreateMapper","UNK_TYPE","z_LightingContext*, z_GraphicsContext*"), 0x801025B8:("Lights_ClearHead","UNK_RET","UNK_ARGS"), 0x801025C8:("Lights_RemoveAll","UNK_RET","UNK_ARGS"), 0x80102624:("Lights_Insert","UNK_RET","UNK_ARGS"), @@ -3242,7 +3242,7 @@ 0x8017A634:("Math3D_XZDistanceSquared","UNK_RET","UNK_ARGS"), 0x8017A678:("Math3D_XZDistance","UNK_RET","UNK_ARGS"), 0x8017A6A8:("Math3D_LengthSquared","UNK_RET","UNK_ARGS"), - 0x8017A6D4:("Math3D_Length","f32","z_Vector3D*"), + 0x8017A6D4:("Math3D_Length","f32","z_Vector3f*"), 0x8017A6F8:("Math3D_DistanceSquared","UNK_RET","UNK_ARGS"), 0x8017A720:("Math3D_Distance","UNK_RET","UNK_ARGS"), 0x8017A740:("Math3D_DistanceS","UNK_RET","UNK_ARGS"), diff --git a/tables/variables.py b/tables/variables.py index f5da1a7f88..ecb0467600 100644 --- a/tables/variables.py +++ b/tables/variables.py @@ -29,8 +29,8 @@ 0x80096B40:("","OSPiHandle*",False), 0x80096B50:("","UNK_TYPE",False), 0x80096B60:("","UNK_TYPE*",False), - 0x80096C40:("g_s80085320_ListHead","s80085320*",False), # TODO rename? - 0x80096C44:("g_s80085320_ListTail","s80085320*",False), # TODO rename? + 0x80096C40:("g_s80085320_ListHead","z_ThreadInfo*",False), # TODO rename? + 0x80096C44:("g_s80085320_ListTail","z_ThreadInfo*",False), # TODO rename? 0x80097590:("","UNK_TYPE",False), 0x80097E10:("__osThreadTail","OSThread*",False), 0x80097E18:("__osRunQueue","OSThread*",False), @@ -82,24 +82,24 @@ 0x80099450:("__libm_qnan_f", "float",False), 0x800994D0:("","UNK_TYPE",False), 0x800994DC:("","UNK_TYPE",False), - 0x80099500:("","s80085320",False), + 0x80099500:("","z_ThreadInfo",False), 0x80099520:("","OSThread",False), 0x800996D0:("","UNK_TYPE",False), 0x800975E0:("sintable","short",True), # 0x80097DDE:("sintable","short",True), # NOTE this is just the end of sintable - 0x80099AD0:("","s80085320",False), + 0x80099AD0:("","z_ThreadInfo",False), 0x80099AF0:("","UNK_TYPE",False), 0x80099EF0:("","UNK_TYPE",False), 0x8009A170:("","UNK_TYPE",False), - 0x8009A670:("","s80085320",False), + 0x8009A670:("","z_ThreadInfo",False), 0x8009A690:("","UNK_TYPE",False), 0x8009A840:("","UNK_TYPE",False), - 0x8009B140:("","s80085320",False), + 0x8009B140:("","z_ThreadInfo",False), 0x8009B160:("","UNK_TYPE",False), 0x8009B228:("","UNK_TYPE",False), 0x8009B240:("","u32*",False), 0x8009B290:("","u8",False), - 0x8009B2A0:("","s80085320",False), + 0x8009B2A0:("","z_ThreadInfo",False), 0x8009B2BC:("","u16",False), # Count of entries in dmadata 0x8009B2C0:("","OSMesgQueue",False), 0x8009B2D8:("","UNK_TYPE",False), @@ -135,7 +135,7 @@ 0x8009E5C0:("__osTimerCounter","UNK_TYPE",False), 0x8009E610:("","OSPiHandle",False), 0x8009E624:("","UNK_TYPE",False), - 0x8009F8B0:("dmadata","DmadataEntry",True), # RAM copy of dmadata + 0x8009F8B0:("dmadata","z_DmadataEntry",True), # RAM copy of dmadata 0x801ADE80:("","UNK_TYPE",False), 0x801ADEAC:("","UNK_TYPE",False), 0x801ADEB0:("D_801ADEB0","int",True), # TODO better array representation @@ -153,7 +153,7 @@ 0x801AE214:("D_801AE214","u8",True), # length 32 0x801AE3A0:("EffectSS2Info","z_EffectTableInfo",False), 0x801AE4A0:("particleOverlayTable","z_ParticleOverlayTableEntry",True), # length 0x28 - 0x801AEFD0:("","s800BF9A0",False), + 0x801AEFD0:("","z_ActorOverlayTableEntry",False), 0x801B4610:("","UNK_TYPE",False), 0x801B9F20:("","s800E03A0",False), # actually an array of size 23? 0x801BDB30:("","u8",True), @@ -209,9 +209,9 @@ # En_Test 0x808637D0:("","f32",False), - 0x80ACB650:("bgBgFuKaitenInitVar","z_ActorInit",False), + 0x80ACB650:("bgBgFuKaitenInitVar","z_ActorInitData",False), 0x80ACB650:("","f32",False), - 0x80BD55D0:("bgIkanaRayInitVar","z_ActorInit",False), + 0x80BD55D0:("bgIkanaRayInitVar","z_ActorInitData",False), 0x80BD55F0:("","UNK_TYPE",False), 0x80BD561C:("bgIkanaRayCompInit","z_ActorCompInitEntry",True), 0x80BD562C:("","UNK_TYPE",False) diff --git a/tools/disasm.py b/tools/disasm.py index 1b68bd4851..d2274a556b 100644 --- a/tools/disasm.py +++ b/tools/disasm.py @@ -642,7 +642,7 @@ class Disassembler: with open(path + "/functions.h", 'w', newline='\n') as f: f.write("#ifndef _FUNCTIONS_H_\n#define _FUNCTIONS_H_\n\n"); - f.write('#include \n#include \n#include \n#include \n#include \n#include \n\n'); + f.write('#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n'); for addr in sorted(self.functions): if addr in known_funcs: @@ -655,7 +655,7 @@ class Disassembler: with open(path + "/variables.h", 'w', newline='\n') as f: f.write("#ifndef _VARIABLES_H_\n#define _VARIABLES_H_\n\n"); - f.write('#include \n#include \n#include \n#include \n#include \n#include \n\n'); + f.write('#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n'); for addr in sorted(self.vars): if addr in known_vars: