diff options
55 files changed, 1451 insertions, 262 deletions
diff --git a/include/67D890.h b/include/67D890.h index e8af38e..1006d41 100644 --- a/include/67D890.h +++ b/include/67D890.h @@ -3,12 +3,14 @@ #include "ultra64.h" -// void func_80059BF0_jp(); -// void func_80059C24_jp(); +struct PlayState; + +void func_80059BF0_jp(void); +void banti_move(struct PlayState* play); // void func_80059EC0_jp(); // void func_8005A070_jp(); // void func_8005A154_jp(); // void func_8005A238_jp(); -// void func_8005A2FC_jp(); +void banti_draw(struct PlayState* play); #endif diff --git a/include/67E840.h b/include/67E840.h index cefd38d..aa2316c 100644 --- a/include/67E840.h +++ b/include/67E840.h @@ -3,6 +3,7 @@ #include "ultra64.h" +struct PlayState; struct GameState; // void func_8005ABA0_jp(); @@ -108,7 +109,7 @@ struct GameState; // void func_8005DCCC_jp(); // void mBGMPsComp_make_ps_lost_fanfare(); // void func_8005DD5C_jp(); -// void func_8005DDE4_jp(); +void mBGMPsComp_make_ps_wipe(s32 arg0, struct PlayState* play); // void func_8005DE0C_jp(); // void func_8005DE60_jp(); // void func_8005DE88_jp(); diff --git a/include/683030.h b/include/683030.h index c68b512..7cda1e9 100644 --- a/include/683030.h +++ b/include/683030.h @@ -3,6 +3,8 @@ #include "ultra64.h" +struct PlayState; + // void func_8005F390_jp(); // void func_8005F3DC_jp(); // void func_8005F4E4_jp(); @@ -41,7 +43,7 @@ // void func_80060970_jp(); // void func_80060A6C_jp(); // void func_80060B18_jp(); -// void Camera2_ClearActorTalking_Cull(); +void Camera2_ClearActorTalking_Cull(struct PlayState* play); // void func_80060D1C_jp(); // void func_80060D58_jp(); // void func_80060D6C_jp(); @@ -154,9 +156,9 @@ // void func_80064EF0_jp(); // void func_80064F08_jp(); // void func_80064F28_jp(); -// void func_80064F48_jp(); +void func_80064F48_jp(struct PlayState* play); // void func_80064F84_jp(); -// void func_80064FD8_jp(); -// void func_80065028_jp(); +void Camera2_process(struct PlayState* play); +void Camera2_draw(struct PlayState* play); #endif diff --git a/include/69E2C0.h b/include/69E2C0.h index f95158e..43d6d41 100644 --- a/include/69E2C0.h +++ b/include/69E2C0.h @@ -5,6 +5,7 @@ struct Input; struct GraphicsContext; +struct PlayState; // void func_8007A620_jp(); // void func_8007A630_jp(); @@ -70,14 +71,14 @@ void Debug_mode_output(struct GraphicsContext* gfxCtx); // void func_8007CB50_jp(); // void func_8007CBEC_jp(); // void func_8007CC9C_jp(); -// void func_8007CDB8_jp(); +void mDemo_stock_clear(void); // void func_8007CDD8_jp(); // void func_8007CF00_jp(); // void func_8007CF34_jp(); // void func_8007CF44_jp(); // void func_8007CF84_jp(); -// void func_8007CFB4_jp(); -// void func_8007CFD8_jp(); +void mDemo_Main(struct PlayState* play); +void func_8007CFD8_jp(struct PlayState* play); // void func_8007D030_jp(); // void func_8007D048_jp(); // void func_8007D080_jp(); diff --git a/include/6A6E80.h b/include/6A6E80.h index 8dd65ce..8d49ac7 100644 --- a/include/6A6E80.h +++ b/include/6A6E80.h @@ -3,22 +3,28 @@ #include "ultra64.h" +struct PlayState; + +typedef struct Play80804480 { + /* 0x00 */ char unk00[0xDC]; +} Play80804480; // size = 0xDC + // void func_800831E0_jp(); // void func_800835AC_jp(); -// void func_8008366C_jp(); -// void func_800836F8_jp(); +void fbdemo_cleanup(Play80804480* arg0); +s32 fbdemo_init(Play80804480* arg0, s32 arg1, s32 arg2, struct PlayState* play); // void func_80083870_jp(); -// void func_80083984_jp(); +void fbdemo_draw(Play80804480* arg0, Gfx** gfx); // void func_80083AB0_jp(); -// void func_80083BE4_jp(); +void fbdemo_move(Play80804480* arg0); // void func_80083BF0_jp(); -// void func_80083C00_jp(); -// void func_80083CBC_jp(); +void fbdemo_triforce_startup(void*); +void fbdemo_triforce_init(void*); // void func_80083CE8_jp(); -// void func_80083D14_jp(); -// void func_80083E08_jp(); -// void func_8008400C_jp(); -// void func_80084018_jp(); -// void func_80084068_jp(); +void fbdemo_triforce_move(void*, u8); +void fbdemo_triforce_draw(void*, Gfx**); +s32 fbdemo_triforce_is_finish(void*, PlayState* play); +void fbdemo_triforce_settype(void*, s32); +void fbdemo_triforce_setcolor_rgba8888(void*, s32); #endif diff --git a/include/6A7D20.h b/include/6A7D20.h index 4949f31..ec6e456 100644 --- a/include/6A7D20.h +++ b/include/6A7D20.h @@ -3,13 +3,13 @@ #include "ultra64.h" -// void func_80084080_jp(); -// void func_800840AC_jp(); -// void func_8008418C_jp(); -// void func_800843C8_jp(); -// void func_80084480_jp(); -// void func_800844B0_jp(); +void fbdemo_wipe1_init(void*); +void fbdemo_wipe1_move(void*, u8); +void fbdemo_wipe1_draw(void*, Gfx**); +void fbdemo_wipe1_startup(void*); +void fbdemo_wipe1_settype(void*, s32); +void fbdemo_wipe1_setcolor_rgba8888(void*, s32); // void func_800844BC_jp(); -// void func_800844C8_jp(); +s32 fbdemo_wipe1_is_finish(void*, PlayState* play); #endif diff --git a/include/6A8180.h b/include/6A8180.h index db13b7f..8b9ecd5 100644 --- a/include/6A8180.h +++ b/include/6A8180.h @@ -3,12 +3,18 @@ #include "ultra64.h" -// void func_800844E0_jp(); -// void func_8008450C_jp(); -// void func_800845EC_jp(); -// void func_8008468C_jp(); -// void func_800846D4_jp(); -// void func_800846E0_jp(); -// void func_800846EC_jp(); +struct PlayState; + +typedef struct PlayState2128 { + /* 0x00 */ char unk00[0x10]; +} PlayState2128; // size = 0x10 + +void fbdemo_fade_init(void* arg0); +void fbdemo_fade_move(void* arg0, u8 arg1); +void fbdemo_fade_draw(void* arg0, Gfx** gfx); +void fbdemo_fade_startup(void* arg0); +void fbdemo_fade_settype(void* arg0, s32 arg1); +void fbdemo_fade_setcolor_rgba8888(void* arg0, s32 arg1); +s32 fbdemo_fade_is_finish(void* arg0, struct PlayState* play); #endif diff --git a/include/6C97F0.h b/include/6C97F0.h index be30080..ce7d044 100644 --- a/include/6C97F0.h +++ b/include/6C97F0.h @@ -15,6 +15,6 @@ // void func_800A63F8_jp(); // void func_800A6450_jp(); // void func_800A6548_jp(); -// void func_800A65C4_jp(); +void func_800A65C4_jp(void); #endif diff --git a/include/6D2720.h b/include/6D2720.h index f271c77..b70cc3f 100644 --- a/include/6D2720.h +++ b/include/6D2720.h @@ -32,6 +32,6 @@ // void func_800AFCAC_jp(); // void func_800AFCD8_jp(); // void func_800AFDA8_jp(); -// void func_800B0010_jp(); +void func_800B0010_jp(void); #endif diff --git a/include/6DA460.h b/include/6DA460.h index 9665029..0bcd63e 100644 --- a/include/6DA460.h +++ b/include/6DA460.h @@ -3,6 +3,8 @@ #include "ultra64.h" +struct PlayState; + // void func_800B67C0_jp(); // void func_800B6838_jp(); // void func_800B68E8_jp(); @@ -28,7 +30,7 @@ // void func_800B7468_jp(); // void func_800B74E8_jp(); // void func_800B7560_jp(); -// void func_800B7624_jp(); +void mPO_business_proc(struct PlayState* play); // void func_800B7680_jp(); // void func_800B7700_jp(); diff --git a/include/6E0F50.h b/include/6E0F50.h index 888d213..1e28acb 100644 --- a/include/6E0F50.h +++ b/include/6E0F50.h @@ -3,8 +3,10 @@ #include "ultra64.h" +struct PlayState; + // void func_800BD2B0_jp(); -// void func_800BD37C_jp(); +Gfx* gfx_set_fog_nosync(Gfx* gfx, u8 arg1, u8 arg2, u8 arg3, s32 arg4, s16 arg5, s16 arg6); // void func_800BD3EC_jp(); // void func_800BD428_jp(); // void func_800BD448_jp(); @@ -21,7 +23,7 @@ // void func_800BD68C_jp(); // void func_800BD6D0_jp(); // void func_800BD6F8_jp(); -// void func_800BD720_jp(); +Gfx* func_800BD720_jp(Gfx* gfx); // void func_800BD748_jp(); // void func_800BD770_jp(); // void func_800BD798_jp(); @@ -32,8 +34,8 @@ // void func_800BD9FC_jp(); // void func_800BDA20_jp(); // void two_tex_scroll(); -// void DisplayList_initialize(); -// void func_800BDF90_jp(); +void DisplayList_initialize(GraphicsContext* gfxCtx, u8 arg1, u8 arg2, u8 arg3, struct PlayState* play); +void fade_rgba8888_draw(Gfx** gfx, s32 arg1); // void func_800BE030_jp(); // void fade_black_draw(); // void func_800BE094_jp(); diff --git a/include/6E30B0.h b/include/6E30B0.h index 3cfb0fa..16c9ede 100644 --- a/include/6E30B0.h +++ b/include/6E30B0.h @@ -77,6 +77,6 @@ // void func_800C2D8C_jp(); // void func_800C2DF0_jp(); // void func_800C2E80_jp(); -// void func_800C2EE0_jp(); +void func_800C2EE0_jp(void); #endif diff --git a/include/6E80C0.h b/include/6E80C0.h index e43d6ae..9c90a9f 100644 --- a/include/6E80C0.h +++ b/include/6E80C0.h @@ -3,6 +3,15 @@ #include "ultra64.h" +struct PlayState; + +typedef struct PlayState1CBC { + /* 0x00 */ s32 unk_00; + /* 0x04 */ char unk04[0x8]; + /* 0x0C */ s32 unk_0C; + /* 0x10 */ char unk10[0xE0]; +} PlayState1CBC; // size = 0xF0 + // void func_800C4420_jp(); // void func_800C4440_jp(); // void func_800C453C_jp(); @@ -11,24 +20,24 @@ // void mSM_ovlptr_dllcnv(); // void func_800C47B4_jp(); // void func_800C497C_jp(); -// void func_800C49D4_jp(); -// void func_800C4C60_jp(); +void func_800C49D4_jp(struct PlayState* play); +void mSM_submenu_ovlptr_cleanup(PlayState1CBC* arg0); // void load_player(); -// void func_800C4D1C_jp(); -// void func_800C4D80_jp(); +void mSM_submenu_ct(PlayState1CBC* arg0); +void mSM_submenu_dt(PlayState1CBC* arg0); // void func_800C4D8C_jp(); // void func_800C4DB0_jp(); // void func_800C4DD8_jp(); // void func_800C4DFC_jp(); // void func_800C4E2C_jp(); -// void func_800C4E58_jp(); +void mSM_submenu_ctrl(struct PlayState* play); // void func_800C50C4_jp(); // void func_800C50EC_jp(); // void func_800C510C_jp(); // void func_800C5228_jp(); // void func_800C524C_jp(); -// void func_800C5328_jp(); -// void func_800C535C_jp(); +void mSM_submenu_move(PlayState1CBC* arg0); +void mSM_submenu_draw(PlayState1CBC* arg0, struct PlayState* play); // void func_800C53B8_jp(); // void func_800C543C_jp(); // void func_800C54A8_jp(); diff --git a/include/6E9650.h b/include/6E9650.h index 86db5f5..29faf70 100644 --- a/include/6E9650.h +++ b/include/6E9650.h @@ -19,22 +19,22 @@ struct PlayState_unk_0110; // void func_800C5E10_jp(); // void func_800C5EA0_jp(); // void func_800C5F0C_jp(); -// void func_800C5F64_jp(); +void mSc_dmacopy_data_bank(struct PlayState_unk_0110* arg0); s32 mSc_bank_regist_check(struct PlayState_unk_0110* arg0, s16 arg1); void func_800C6144_jp(struct PlayState_unk_0110* arg0, s16 arg1); void mSc_regist_initial_exchange_bank(struct PlayState* play); // void func_800C62C4_jp(); // void func_800C639C_jp(); -// void mSc_data_bank_ct(); -// void mSc_decide_exchange_bank(); +void mSc_data_bank_ct(struct PlayState* play, struct PlayState_unk_0110* arg1); +void mSc_decide_exchange_bank(struct PlayState_unk_0110* arg0); // void func_800C6690_jp(); -// void Scene_ct(); +void Scene_ct(struct PlayState* play, void* arg1); // void func_800C6960_jp(); // void func_800C69F4_jp(); // void func_800C6A28_jp(); // void func_800C6A5C_jp(); // void func_800C6A90_jp(); -// void Door_info_ct(); +void Door_info_ct(s32* arg0); // void func_800C6AD0_jp(); // void func_800C6AE0_jp(); // void func_800C6B50_jp(); diff --git a/include/6EC9E0.h b/include/6EC9E0.h index ddf1095..642e2ff 100644 --- a/include/6EC9E0.h +++ b/include/6EC9E0.h @@ -3,15 +3,17 @@ #include "ultra64.h" +struct PlayState; + // void func_800C8D40_jp(); // void func_800C8D98_jp(); // void func_800C8E08_jp(); -// void func_800C8E50_jp(); +void mTD_player_keydata_init(struct PlayState* play); // void func_800C8ECC_jp(); // void func_800C8F5C_jp(); // void func_800C8F84_jp(); -// void func_800C8FB8_jp(); -// void func_800C9010_jp(); +void title_demo_move(struct PlayState* play); +void func_800C9010_jp(void); // void func_800C9088_jp(); // void mTD_get_titledemo_no(); // void func_800C90BC_jp(); diff --git a/include/6ECD90.h b/include/6ECD90.h index f068a5d..c980f3d 100644 --- a/include/6ECD90.h +++ b/include/6ECD90.h @@ -3,6 +3,8 @@ #include "ultra64.h" +struct PlayState; + // void func_800C90F0_jp(); // void func_800C91E0_jp(); // void func_800C92FC_jp(); @@ -18,6 +20,6 @@ // void func_800C98A0_jp(); // void func_800C9D38_jp(); // void func_800C9F88_jp(); -// void func_800CA008_jp(); +void mTRC_move(struct PlayState* play); #endif diff --git a/include/6EDD10.h b/include/6EDD10.h index 087c3af..62b33c5 100644 --- a/include/6EDD10.h +++ b/include/6EDD10.h @@ -4,7 +4,7 @@ #include "ultra64.h" // void func_800CA070_jp(); -// void mTM_set_season(); +void mTM_set_season(void); // void func_800CA230_jp(); // void func_800CA240_jp(); // void func_800CA278_jp(); diff --git a/include/6EFC20.h b/include/6EFC20.h index 0651fdd..8e7c3d4 100644 --- a/include/6EFC20.h +++ b/include/6EFC20.h @@ -3,9 +3,11 @@ #include "ultra64.h" -// void func_800CBF80_jp(); -// void func_800CBFBC_jp(); -// void func_800CC3EC_jp(); +struct PlayState; + +void func_800CBF80_jp(void); +void watch_my_step_move(struct PlayState* play); +void watch_my_step_draw(struct PlayState* play); // void func_800CC9C4_jp(); // void func_800CC9EC_jp(); // void func_800CCB44_jp(); diff --git a/include/6F5550.h b/include/6F5550.h index 8ab3fd3..5468036 100644 --- a/include/6F5550.h +++ b/include/6F5550.h @@ -3,6 +3,9 @@ #include "ultra64.h" +struct PlayState; +struct PlayState_Unk_1EE8; + // void func_800D18B0_jp(); // void func_800D195C_jp(); // void func_800D197C_jp(); @@ -61,18 +64,18 @@ // void func_800D22A4_jp(); // void func_800D22CC_jp(); // void func_800D22F4_jp(); -// void func_800D2314_jp(); -// void func_800D2334_jp(); +s32 sAdo_BgmFadeoutCheck(void); +s32 func_800D2334_jp(struct PlayState_Unk_1EE8* arg0, struct PlayState* play); // void func_800D2354_jp(); // void func_800D2360_jp(); -// void sAdo_RoomType(); +void sAdo_RoomType(u8 arg0); // void func_800D2394_jp(); // void func_800D23B4_jp(); // void func_800D2438_jp(); // void func_800D24C4_jp(); // void func_800D24EC_jp(); // void func_800D252C_jp(); -// void func_800D2568_jp(); +void func_800D2568_jp(s32 arg0); // void func_800D2578_jp(); #endif diff --git a/include/PreRender.h b/include/PreRender.h index 5d38fba..a681087 100644 --- a/include/PreRender.h +++ b/include/PreRender.h @@ -3,13 +3,26 @@ #include "ultra64.h" +typedef struct ListAlloc { + /* 0x0 */ struct ListAlloc* prev; + /* 0x4 */ struct ListAlloc* next; +} ListAlloc; // size = 0x8 + +typedef struct { + /* 0x00 */ char unk00[0x10]; + /* 0x10 */ UNK_PTR unk_10; + /* 0x14 */ UNK_PTR unk_14; + /* 0x18 */ UNK_PTR unk_18; + /* 0x1C */ char unk1C[0x34]; +} PreRender; // size = 0x50 + // void wallpaper_draw1(); // void wallpaper_draw(); // void gfx_SetUpCFB(); -// void PreRender_setup_savebuf(); -// void PreRender_init(); -// void PreRender_setup_renderbuf(); -// void PreRender_cleanup(); +void PreRender_setup_savebuf(PreRender* render, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5); +void PreRender_init(PreRender* render); +void PreRender_setup_renderbuf(PreRender* render, s32 arg1, s32 arg2, void* arg3, void* arg4); +void PreRender_cleanup(PreRender* render); // void PreRender_TransBufferCopy(); // void PreRender_TransBuffer(); // void PreRender_TransBuffer1_env(); @@ -18,15 +31,15 @@ // void PreRender_ShowCoveredge(); // void PreRender_CopyRGBC(); // void PreRender_saveZBuffer(); -// void PreRender_saveFrameBuffer(); -// void PreRender_saveCVG(); +void PreRender_saveFrameBuffer(PreRender* render, Gfx** gfx); +void PreRender_saveCVG(PreRender* render, Gfx** gfx); // void PreRender_loadZBuffer(); // void PreRender_loadFrameBuffer(); // void PreRender_loadFrameBufferAlpha(); -// void PreRender_loadFrameBufferCopy(); +void PreRender_loadFrameBufferCopy(PreRender* render, Gfx** gfx); // void ASAlgorithm(); // void AntiAliasFilter(); -// void PreRender_ConvertFrameBuffer_fg(); +void PreRender_ConvertFrameBuffer_fg(PreRender* render); // void PreRender_ConvertFrameBuffer(); #endif diff --git a/include/build.h b/include/build.h deleted file mode 100644 index 2b51e7b..0000000 --- a/include/build.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef BUILD_H -#define BUILD_H - -extern const char gBuildTeam[]; -extern const char gBuildDate[]; -extern const char gBuildMakeOption[]; - -#endif diff --git a/include/color.h b/include/color.h new file mode 100644 index 0000000..def50ca --- /dev/null +++ b/include/color.h @@ -0,0 +1,80 @@ +#ifndef _COLOR_H_ +#define _COLOR_H_ + +#include "PR/ultratypes.h" + +// For checking the alpha bit in an RGBA16 pixel +#define RGBA16_PIXEL_OPAQUE 1 + +typedef struct { + /* 0x0 */ u8 r; + /* 0x1 */ u8 g; + /* 0x2 */ u8 b; +} Color_RGB8; // size = 0x3 + +typedef struct { + /* 0x0 */ u8 r; + /* 0x1 */ u8 g; + /* 0x2 */ u8 b; + /* 0x3 */ u8 a; +} Color_RGBA8; // size = 0x4 + +typedef struct { + /* 0x0 */ s16 r; + /* 0x2 */ s16 g; + /* 0x4 */ s16 b; +} Color_RGB16; // size = 0x6 + +// only use when necessary for alignment purposes +typedef union { + struct { + u8 r, g, b, a; + }; + u32 rgba; +} Color_RGBA8_u32; + +typedef struct { + f32 r, g, b, a; +} Color_RGBAf; + +typedef struct { + u32 r, g, b, a; +} Color_RGBAu32; + +typedef union { + struct { + u16 r : 5; + u16 g : 5; + u16 b : 5; + u16 a : 1; + }; + u16 rgba; +} Color_RGBA16; + +typedef union { + struct { + u32 r : 5; + u32 g : 5; + u32 b : 5; + u32 a : 1; + }; + u16 rgba; +} Color_RGBA16_2; + +typedef union{ + struct { + u32 r : 3; + u32 g : 3; + u32 b : 3; + u32 a : 5; + }; + u16 rgba; +} Color_RGBA14; + +#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0)) + +#define RGBA16_GET_R(pixel) (((pixel) >> 11) & 0x1F) +#define RGBA16_GET_G(pixel) (((pixel) >> 6) & 0x1F) +#define RGBA16_GET_B(pixel) (((pixel) >> 1) & 0x1F) + +#endif diff --git a/include/game.h b/include/game.h index 46edae3..2af1c10 100644 --- a/include/game.h +++ b/include/game.h @@ -55,7 +55,7 @@ typedef struct GameState { /* 0x88 */ GameAlloc alloc; /* 0x9C */ u8 unk_9C; /* 0x9D */ u8 unk_9D; - /* 0x9E */ UNK_TYPE1 unk_9E[0x1]; + /* 0x9E */ UNK_TYPE1 unk9E[0x1]; /* 0x9F */ u8 running; /* 0xA0 */ s32 unk_A0; /* 0xA4 */ UNK_TYPE1 unk_A4[0x4]; diff --git a/include/gfx.h b/include/gfx.h index bda4a82..fb89873 100644 --- a/include/gfx.h +++ b/include/gfx.h @@ -22,14 +22,15 @@ typedef struct GraphicsContext { /* 0x2C0 */ TwoHeadGfxArena unk_2C0; /* 0x2D0 */ TwoHeadGfxArena light; /* 0x2E0 */ UNK_TYPE1 unk_2E0[0x4]; - /* 0x2E4 */ s32 unk_2E4; + /* 0x2E4 */ UNK_PTR unk_2E4; /* 0x2E8 */ UNK_TYPE1 unk_2E8[0x4]; /* 0x2EC */ s32 unk_2EC; /* 0x2F0 */ u8 unk_2F0; /* 0x2F1 */ UNK_TYPE1 unk_2F1[0x1]; /* 0x2F2 */ u8 unk_2F2; /* 0x2F3 */ UNK_TYPE1 unk_2F3[0x1]; - /* 0x2F4 */ UNK_TYPE1 unk_2F4[0x8]; + /* 0x2F4 */ s32 unk_2F4; + /* 0x2F8 */ s32 unk_2F8; /* 0x2FC */ f32 unk_2FC; /* 0x300 */ f32 unk_300; } GraphicsContext; // size >= 0x304 diff --git a/include/gfxalloc.h b/include/gfxalloc.h index dab0fb6..81177a9 100644 --- a/include/gfxalloc.h +++ b/include/gfxalloc.h @@ -4,7 +4,7 @@ #include "ultra64.h" Gfx* gfxopen(Gfx* gfxHead); -void gfxclose(Gfx* gfxHead, Gfx* gfx); +Gfx* gfxclose(Gfx* gfxHead, Gfx* gfx); // void gfxalloc(); #endif diff --git a/include/libc/alloca.h b/include/libc/alloca.h new file mode 100644 index 0000000..4e8720f --- /dev/null +++ b/include/libc/alloca.h @@ -0,0 +1,7 @@ +#ifndef ALLOCA_H +#define ALLOCA_H + +void* alloca(u32); +#define alloca __builtin_alloca + +#endif diff --git a/include/libc64/qrand.h b/include/libc64/qrand.h index 0e6ee34..e589b24 100644 --- a/include/libc64/qrand.h +++ b/include/libc64/qrand.h @@ -5,7 +5,7 @@ // void qrand(); // void sqrand(); -// void fqrand(); +f32 fqrand(void); // void fqrand2(); // void sqrand_r(); // void qrand_r(); diff --git a/include/libu64/gfxprint.h b/include/libu64/gfxprint.h index 8391b4b..7db3fef 100644 --- a/include/libu64/gfxprint.h +++ b/include/libu64/gfxprint.h @@ -2,23 +2,28 @@ #define LIBU64_GFX_PRINT_H #include "ultra64.h" +#include "color.h" + +typedef struct gfxprint { + /* 0x00 */ char unk00[0x30]; +} gfxprint; // size = 0x30 // void gfxprint_setup(); -// void gfxprint_color(); +void gfxprint_color(gfxprint* this, u8 r, u8 g, u8 b, u8 a); // void gfxprint_locate(); -// void gfxprint_locate8x8(); +void gfxprint_locate8x8(gfxprint* this, s32 arg1, s32 arg2); // void gfxprint_setoffset(); // void gfxprint_putc1(); // void gfxprint_putc(); // void gfxprint_write(); // void gfxprint_puts(); // void gfxprint_prout(); -// void gfxprint_init(); -// void gfxprint_cleanup(); -// void gfxprint_open(); -// void gfxprint_close(); +void gfxprint_init(gfxprint* this); +void gfxprint_cleanup(gfxprint* this); +void gfxprint_open(gfxprint* this, Gfx* gfx); +Gfx* gfxprint_close(gfxprint* this); // void gfxprint_vprintf(); -// void gfxprint_printf(); +void gfxprint_printf(gfxprint* this, const char* fmt, ...); // extern UNK_TYPE gfxprint_moji_tlut; // extern UNK_TYPE gfxprint_rainbow_tlut; diff --git a/include/m_collision_bg.h b/include/m_collision_bg.h index d7bdf4d..a95a36c 100644 --- a/include/m_collision_bg.h +++ b/include/m_collision_bg.h @@ -92,7 +92,7 @@ // void func_8006B97C_jp(); // void func_8006BAA8_jp(); // void func_8006BAE4_jp(); -// void func_8006BB64_jp(); +void func_8006BB64_jp(void); // void func_8006BB9C_jp(); // void func_8006BBE8_jp(); // void func_8006BBF8_jp(); @@ -105,9 +105,9 @@ // void func_8006C4B4_jp(); // void func_8006C5A8_jp(); // void func_8006C634_jp(); -// void func_8006C740_jp(); +void mCoBG_CalcTimerDecalCircle(void); // void func_8006C7B4_jp(); -// void func_8006C8D0_jp(); +void func_8006C8D0_jp(void); // void func_8006C910_jp(); // void func_8006C980_jp(); // void func_8006D3B0_jp(); diff --git a/include/m_collision_obj.h b/include/m_collision_obj.h index e4335e2..547eee1 100644 --- a/include/m_collision_obj.h +++ b/include/m_collision_obj.h @@ -12,6 +12,12 @@ typedef struct CollisionCheck_Status { } CollisionCheck_Status; // size >= 0x18 +typedef struct PlayState2138 { + /* 0x00 */ char unk00[0xD0]; +} PlayState2138; // size = 0xD0 + +struct PlayState; + // void func_80076B40_jp(); // void func_80076BA4_jp(); // void func_80076BD4_jp(); @@ -49,9 +55,9 @@ typedef struct CollisionCheck_Status { // void func_80077410_jp(); // void func_800774B4_jp(); // void func_80077580_jp(); -// void func_80077620_jp(); -// void func_80077640_jp(); -// void func_80077650_jp(); +void func_80077620_jp(struct PlayState* play, PlayState2138* arg1); +void CollisionCheck_dt(struct PlayState* play, PlayState2138* arg1); +void CollisionCheck_clear(struct PlayState* play, PlayState2138* arg1); // void CollisionCheck_setOC(); // void func_80077794_jp(); // void func_800777D0_jp(); @@ -61,7 +67,7 @@ typedef struct CollisionCheck_Status { // void func_80077F20_jp(); // void func_80077FF0_jp(); // void func_80078014_jp(); -// void func_80078070_jp(); +void CollisionCheck_OC(struct PlayState* play, PlayState2138* arg1); // void func_80078214_jp(); // void func_80078258_jp(); // void func_8007841C_jp(); diff --git a/include/m_common_data.h b/include/m_common_data.h index 719f850..ef1950e 100644 --- a/include/m_common_data.h +++ b/include/m_common_data.h @@ -9,7 +9,7 @@ struct ActorOverlay; struct struct_801161E8_jp; struct PlayState_unk_0110; struct CommonData_unk_1004C_unk_14_arg0; - +struct PlayState; typedef UNK_RET (*CommonData_unk_1004C_unk_04)(struct ActorOverlay*, const struct struct_801161E8_jp*, size_t, s32); typedef UNK_RET (*CommonData_unk_1004C_unk_08)(void); @@ -53,25 +53,58 @@ typedef struct CommonData_unk_10098 { /* 0x10 */ CommonData_unk_10098_unk_10 unk_10; } CommonData_unk_10098; // size >= 0x10 +typedef struct CommonData10138_Sub { + /* 0x00 */ char unk00[0x3]; + /* 0x03 */ u8 unk_03; + /* 0x04 */ char unk04[0x1]; + /* 0x05 */ u8 unk_05; + /* 0x06 */ u16 unk_06; + /* 0x08 */ u8 unk_08; +} CommonData10138_Sub; // size >= 0xC + +typedef struct CommonData10138 { + /* 0x000 */ char unk000[0xA86]; + /* 0xA86 */ CommonData10138_Sub unk_A86; +} CommonData10138; // size >= 0xA90 + +typedef void (*CommonData_100E4_Func)(struct PlayState*); typedef struct CommonData { - /* 0x00000 */ UNK_TYPE1 unk_00000[0x10000]; + /* 0x00000 */ u8 unk00000[0x14]; + /* 0x00014 */ s32 unk_00014; + /* 0x00018 */ u8 unk00018[0xFFE8]; /* 0x10000 */ u8 unk_10000; // named "game_started" in AC GCN decomp - /* 0x10001 */ UNK_TYPE1 unk_10001[0x3]; + /* 0x10001 */ u8 unk_10001; + /* 0x10002 */ u8 unk10002[0x1]; + /* 0x10003 */ u8 unk_10003; /* 0x10004 */ s32 unk_10004; // named "last_scene_no" in AC GCN decomp /* 0x10008 */ UNK_TYPE1 unk_10008[0x44]; /* 0x1004C */ CommonData_unk_1004C *unk_1004C; /* 0x10050 */ UNK_TYPE1 unk_10050[0x48]; /* 0x10098 */ CommonData_unk_10098 *unk_10098; - /* 0x1009C */ UNK_TYPE1 unk_1009C[0xAC]; - /* 0x10148 */ UNK_TYPE1 unk_10148[0x3]; + /* 0x1009C */ UNK_TYPE1 unk_1009C[0x48]; + /* 0x100E4 */ CommonData_100E4_Func* unk_100E4; + /* 0x100E8 */ u8 unk100E8[0x37]; + /* 0x1011F */ u8 unk_1011F; + /* 0x10120 */ u8 unk10120[0x1]; + /* 0x10121 */ u8 unk_10121; + /* 0x10122 */ u16 unk_10122; + /* 0x10124 */ u8 unk10124[0x14]; + /* 0x10138 */ CommonData10138* unk_10138; + /* 0x1013C */ u8 unk1013C[0xD]; + /* 0x10149 */ u8 unk_10149; + /* 0x1014A */ u8 unk_1014A; /* 0x1014B */ u8 unk_1014B; // named "wipeType" in AC GCN decomp /* 0x1014C */ UNK_TYPE1 unk_1014C[0x2]; /* 0x1014E */ s16 unk_1014E; /* 0x10150 */ UNK_TYPE1 unk_10150[0x664]; /* 0x107B4 */ UNK_TYPE1 unk_107B4[0x2]; /* 0x107B6 */ s16 unk_107B6; // named "demo_profile" in AC GCN decomp (though it's an array of two s16s in that game) - /* 0x107B8 */ UNK_TYPE1 unk_107B8[0x2F8]; + /* 0x107B8 */ u8 unk107B8[0x2C]; + /* 0x107E4 */ s16 unk_107E4; + /* 0x107E6 */ u8 unk107E6[0x29C]; + /* 0x10A82 */ s16 unk_10A82; + /* 0x10A84 */ u8 unk10A84[0x2C]; /* 0x10AB0 */ u8 unk_10AB0; // named "pad_connected" in AC GCN decomp /* 0x10AB1 */ UNK_TYPE1 unk_10AB1[0x7]; } CommonData; // size = 0x10AB8 diff --git a/include/m_debug_display.h b/include/m_debug_display.h index 9c978dc..b566f07 100644 --- a/include/m_debug_display.h +++ b/include/m_debug_display.h @@ -3,9 +3,11 @@ #include "ultra64.h" -// void Debug_Display_init(); +struct PlayState; + +void Debug_Display_init(void); // void Debug_Display_new(); -// void Debug_Display_output(); +void Debug_Display_output(struct PlayState* play); // void debug_display_output_sprite_16x16_I8(); // void debug_display_output_polygon(); diff --git a/include/m_event.h b/include/m_event.h index 78de237..9dafb1f 100644 --- a/include/m_event.h +++ b/include/m_event.h @@ -3,6 +3,17 @@ #include "ultra64.h" +typedef struct PlayState1EBC { + /* 0x00 */ u8 unk_00; + /* 0x01 */ u8 unk_01; + /* 0x02 */ u8 unk_02; + /* 0x03 */ u8 unk_03; + /* 0x04 */ s16 unk_04; + /* 0x06 */ s16 unk_06; + /* 0x08 */ s32 unk_08; + /* 0x0C */ s32 unk_0C; +} PlayState1EBC; // size = 0x10 + // void func_8007D140_jp(); // void func_8007D180_jp(); // void func_8007D1A8_jp(); @@ -81,12 +92,12 @@ s32 mEv_CheckTitleDemo(void); // void func_8007F358_jp(); // void func_8007F6A0_jp(); // void func_8007F764_jp(); -// void func_8007F858_jp(); +void func_8007F858_jp(PlayState1EBC* arg0); // void func_8007F8A4_jp(); -// void func_8007F8DC_jp(); +void mEv_2nd_init(PlayState1EBC* arg0); // void func_8007F950_jp(); -// void func_8007F988_jp(); -// void func_8007FB44_jp(); +void mEv_run(PlayState1EBC* arg0); +void mEv_finish(PlayState1EBC* arg0); // void func_8007FCB8_jp(); // void func_8007FD40_jp(); // void func_8007FDA8_jp(); diff --git a/include/m_field_make.h b/include/m_field_make.h index 114dd24..e983efb 100644 --- a/include/m_field_make.h +++ b/include/m_field_make.h @@ -34,8 +34,8 @@ // void func_80086F08_jp(); // void func_80086FA8_jp(); // void func_80086FEC_jp(); -// void func_80087004_jp(); -// void func_80087280_jp(); +void func_80087004_jp(void); +void func_80087280_jp(void); // void func_80087380_jp(); // void func_80087420_jp(); // void func_800874CC_jp(); diff --git a/include/m_handbill.h b/include/m_handbill.h index 2308263..a62b610 100644 --- a/include/m_handbill.h +++ b/include/m_handbill.h @@ -3,13 +3,15 @@ #include "ultra64.h" -// void func_800928C0_jp(); -// void func_800928E8_jp(); +struct PlayState; + +void Balloon_init(struct PlayState* play); +void Balloon_move(struct PlayState* play); // void func_80092B7C_jp(); // void func_80092B8C_jp(); // void func_80092BA0_jp(); // void func_80092BE8_jp(); -// void func_80092C2C_jp(); +void mHsRm_GetHuusuiRoom(s32 arg0, u8 arg1); // void func_80092D10_jp(); // void func_80092E14_jp(); // void func_80092E80_jp(); diff --git a/include/m_kankyo.h b/include/m_kankyo.h index 490796e..61b14a4 100644 --- a/include/m_kankyo.h +++ b/include/m_kankyo.h @@ -5,6 +5,7 @@ #include "unk.h" struct Actor; +struct LightContext; typedef void (*Kankyo_unk_C0)(struct Actor*); @@ -14,7 +15,11 @@ typedef struct Kankyo { /* 0x03 */ s8 unk_03; /* 0x04 */ s8 unk_04; /* 0x05 */ UNK_TYPE1 unk_05[0x3]; - /* 0x08 */ UNK_TYPE1 unk_08[0xB8]; + /* 0x08 */ UNK_TYPE1 unk_08[0xA6]; + /* 0xAE */ u8 unk_AE; + /* 0xAF */ u8 unk_AF; + /* 0xB0 */ u8 unk_B0; + /* 0xB1 */ UNK_TYPE1 unk_B1[0xF]; /* 0xC0 */ Kankyo_unk_C0 unk_C0; /* 0xC4 */ UNK_TYPE1 unk_C4[0x4]; } Kankyo; // size = 0xC8 @@ -26,7 +31,7 @@ typedef struct Kankyo { // void func_80096F5C_jp(); // void func_80097048_jp(); // void mEnv_RoomTypeLightSet(); -// void Global_kankyo_ct(); +void Global_kankyo_ct(struct PlayState* play, struct Kankyo* kankyo); // void mEnv_MakeShadowInfo(); // void mEnv_set_time(); // void func_800976BC_jp(); @@ -44,7 +49,7 @@ typedef struct Kankyo { // void func_800981B8_jp(); // void func_8009836C_jp(); // void func_800983F0_jp(); -// void func_800984CC_jp(); +void Global_kankyo_set(struct PlayState* play, struct Kankyo* kankyo, struct LightContext* arg2); // void func_80098558_jp(); // void func_8009867C_jp(); // void func_80098794_jp(); @@ -52,7 +57,7 @@ typedef struct Kankyo { // void func_80098980_jp(); // void func_80098990_jp(); // void func_80098A90_jp(); -// void func_80098B50_jp(); +void mEnv_WindMove(void); // void func_80098CCC_jp(); // void func_80098D88_jp(); // void func_80098DE0_jp(); diff --git a/include/m_lib.h b/include/m_lib.h index 3747eca..4666270 100644 --- a/include/m_lib.h +++ b/include/m_lib.h @@ -53,7 +53,7 @@ s16 search_position_angleY(Vec3f* arg0, Vec3f* arg1); // void add_calc_short_angle3(); // void adds(); // void rgba_t_move(); -// void none_proc1(); +UNK_RET none_proc1(void); // void none_proc2(); // void Cheap_gfx_display(); // void Cheap_gfx_display_xlu(); diff --git a/include/m_lights.h b/include/m_lights.h index 4b71bfa..fe7f898 100644 --- a/include/m_lights.h +++ b/include/m_lights.h @@ -4,6 +4,7 @@ #include "ultra64.h" #include "z64math.h" #include "unk.h" +#include "color.h" struct GraphicsContext; struct PlayState; @@ -12,9 +13,17 @@ typedef struct Lights { /* 0x00 */ UNK_TYPE1 unk_00[0x80]; } Lights; // size = 0x80 +typedef struct LightNode { + /* 0x00 */ char unk00[0xC]; +} LightNode; // size = 0xC + typedef struct LightContext { - /* 0x0 */ UNK_TYPE4 unk_0; -} LightContext; // size >= 0x4 + /* 0x0 */ LightNode* listHead; + /* 0x4 */ Color_RGB8 ambient; + /* 0x7 */ Color_RGB8 fogColor; + /* 0xA */ s16 fogNear; // how close until fog starts taking effect. range 0 - 996 + /* 0xC */ s16 zFar; // draw distance. range 0 - 12800 +} LightContext; // size = 0x10 // void func_8009B1E0_jp(); // void func_8009B23C_jp(); @@ -27,10 +36,10 @@ void LightsN_disp(Lights* light, struct GraphicsContext* gfxCtx); // void func_8009B534_jp(); // void func_8009B72C_jp(); // void func_8009B81C_jp(); -void LightsN_list_check(Lights* light, UNK_TYPE4 arg1, Vec3f* arg2); +void LightsN_list_check(Lights* light, LightNode* lightNode, Vec3f* arg2); // void func_8009B954_jp(); // void func_8009B9E0_jp(); -// void Global_light_ct(); +void Global_light_ct(LightContext* arg0); // void func_8009BA94_jp(); // void func_8009BAC0_jp(); Lights* Global_light_read(LightContext* lightCtx, struct GraphicsContext* gfxCtx); diff --git a/include/m_msg_main.h b/include/m_msg_main.h index 0472dda..84d62bc 100644 --- a/include/m_msg_main.h +++ b/include/m_msg_main.h @@ -3,6 +3,8 @@ #include "ultra64.h" +struct PlayState; + // void func_8009D1F0_jp(); // void func_8009D200_jp(); // void func_8009D210_jp(); @@ -281,11 +283,11 @@ // void func_800A3190_jp(); // void func_800A31D8_jp(); // void func_800A3220_jp(); -// void func_800A32D0_jp(); -// void func_800A3304_jp(); +void mMsg_ct(struct PlayState* play); +void func_800A3304_jp(struct PlayState* play); // void func_800A332C_jp(); -// void func_800A339C_jp(); -// void func_800A33D8_jp(); +void mMsg_Main(struct PlayState* play); +void mMsg_Draw(struct PlayState* play); // void func_800A3400_jp(); // void func_800A3420_jp(); // void func_800A345C_jp(); diff --git a/include/m_npc.h b/include/m_npc.h index 9e5ece4..6ed8cae 100644 --- a/include/m_npc.h +++ b/include/m_npc.h @@ -103,7 +103,7 @@ typedef struct Npc { // void func_800A9F9C_jp(); // void func_800AA028_jp(); // void func_800AA0B8_jp(); -// void func_800AA124_jp(); +void func_800AA124_jp(void); // void func_800AA14C_jp(); // void mNpc_GetLooks(); // void func_800AA218_jp(); diff --git a/include/m_pause.h b/include/m_pause.h index c44070e..eb2ce76 100644 --- a/include/m_pause.h +++ b/include/m_pause.h @@ -4,7 +4,7 @@ #include "ultra64.h" #include "libu64/pad.h" -typedef struct Pause{ +typedef struct Pause { /* 0x0 */ s32 enabled; /* 0x4 */ s32 timer; } Pause; // size = 0x8 diff --git a/include/m_player_lib.h b/include/m_player_lib.h index ccbf3e2..70b153d 100644 --- a/include/m_player_lib.h +++ b/include/m_player_lib.h @@ -6,7 +6,6 @@ struct Player; struct PlayState; - // void func_800B1160_jp(); // void func_800B11B0_jp(); // void func_800B11F8_jp(); @@ -34,7 +33,7 @@ struct PlayState; // void func_800B19C4_jp(); // void func_800B1A28_jp(); // void func_800B1A60_jp(); -// void func_800B1AA0_jp(); +void mPlib_Object_Exchange_keep_Player_dt(struct PlayState* play); // void func_800B1AE0_jp(); // void func_800B1B3C_jp(); // void func_800B1B6C_jp(); @@ -159,7 +158,7 @@ struct Player* get_player_actor_withoutCheck(struct PlayState* play); // void func_800B58C4_jp(); // void func_800B5910_jp(); // void func_800B593C_jp(); -// void func_800B594C_jp(); +void func_800B594C_jp(void); // void func_800B5980_jp(); // void func_800B5AA0_jp(); // void func_800B5AB8_jp(); diff --git a/include/m_scene_table.h b/include/m_scene_table.h new file mode 100644 index 0000000..aa21a3e --- /dev/null +++ b/include/m_scene_table.h @@ -0,0 +1,9 @@ +#ifndef M_SCENE_TABLE_H +#define M_SCENE_TABLE_H + +#include "ultra64.h" +#include "z64math.h" + +extern Struct_8010EAA0 scene_data_status[]; + +#endif diff --git a/include/m_view.h b/include/m_view.h index 966ca38..19a4a4e 100644 --- a/include/m_view.h +++ b/include/m_view.h @@ -3,27 +3,48 @@ #include "ultra64.h" +struct PlayState; +struct GraphicsContext; + +typedef struct PlayState1938 { + /* 0x000 */ char unk000[0x28]; + /* 0x028 */ Vec3f unk_028; + /* 0x034 */ char unk034[0x2C]; + /* 0x060 */ Mtx unk_060; + /* 0x0A0 */ Mtx unk_0A0; + /* 0x0E0 */ char unk0E0[0x40]; + /* 0x120 */ s32 unk_120; + /* 0x124 */ char unk124[0x4]; +} PlayState1938; // size = 0x128 + +typedef struct ScissorViewArg1 { + /* 0x00 */ s32 unk_00; + /* 0x04 */ s32 unk_04; + /* 0x08 */ s32 unk_08; + /* 0x0C */ s32 unk_0C; +} ScissorViewArg1; // size = 0x10 + // void set_viewport(); -// void initView(); +void initView(PlayState1938* arg0, struct GraphicsContext* gfxCtx); // void setLookAtView(); // void getLookAtView(); // void setScaleView(); // void getScaleView(); // void setPerspectiveView(); // void getPerspectiveView(); -// void setScissorView(); +void setScissorView(PlayState1938* arg0, ScissorViewArg1* arg1); // void getScissorView(); // void setScissorX(); // void setScissorOvl(); // void setScissor(); // void stretchViewInit(); // void do_stretch_view(); -// void showView(); +void showView(PlayState1938* arg0, s32 arg1, struct PlayState* play); // void showPerspectiveView(); // void showOrthoView(); // void showOverLayView(); // void showPerspectiveOverLayView(); // void showOrthoView1(); -// void showView1(); +void showView1(PlayState1938* arg0, s32 arg1, Gfx** gfx); #endif diff --git a/include/unknown_structs.h b/include/unknown_structs.h index 9b9403c..492de3f 100644 --- a/include/unknown_structs.h +++ b/include/unknown_structs.h @@ -5,6 +5,14 @@ #include "libc/stdint.h" #include "libc/stdbool.h" #include "unk.h" +#include "other_types.h" + +typedef struct Struct_8010EAA0 { + /* 0x00 */ RomOffset unk_00; + /* 0x04 */ RomOffset unk_04; + /* 0x08 */ char unk08[0xB]; + /* 0x13 */ u8 unk_13; +} Struct_8010EAA0; // size = 0x14 typedef struct struct_801161E8_jp { /* 0x0 */ UNK_TYPE1 unk_0[0x8]; diff --git a/include/version.h b/include/version.h new file mode 100644 index 0000000..5161084 --- /dev/null +++ b/include/version.h @@ -0,0 +1,8 @@ +#ifndef BUILD_H +#define BUILD_H + +extern const char __Creator__[]; +extern const char __DateTime__[]; +extern const char __MakeOption__[]; + +#endif diff --git a/linker_scripts/jp/symbol_addrs_boot.txt b/linker_scripts/jp/symbol_addrs_boot.txt index bc9b690..1d97817 100644 --- a/linker_scripts/jp/symbol_addrs_boot.txt +++ b/linker_scripts/jp/symbol_addrs_boot.txt @@ -507,9 +507,9 @@ RO_DBL_8003E8E8_jp = 0x8003E8E8; // type:f64 RO_8003E8F0_jp = 0x8003E8F0; // type:s64 RO_8003E8F8_jp = 0x8003E8F8; // type:s64 -gBuildTeam = 0x8003E900; // type:asciz -gBuildDate = 0x8003E924; // type:asciz -gBuildMakeOption = 0x8003E938; // type:asciz +__Creator__ = 0x8003E900; // type:asciz +__DateTime__ = 0x8003E924; // type:asciz +__MakeOption__ = 0x8003E938; // type:asciz // .bss diff --git a/linker_scripts/jp/symbol_addrs_code.txt b/linker_scripts/jp/symbol_addrs_code.txt index 60c0d72..51f9e9c 100644 --- a/linker_scripts/jp/symbol_addrs_code.txt +++ b/linker_scripts/jp/symbol_addrs_code.txt @@ -163,12 +163,12 @@ mAc_UnagiActorShadow = 0x80059AE0; // type:func mAc_ActorShadowCircle = 0x80059B34; // type:func mAc_ActorShadowEllipse = 0x80059B90; // type:func func_80059BF0_jp = 0x80059BF0; // type:func -func_80059C24_jp = 0x80059C24; // type:func +banti_move = 0x80059C24; // type:func func_80059EC0_jp = 0x80059EC0; // type:func func_8005A070_jp = 0x8005A070; // type:func func_8005A154_jp = 0x8005A154; // type:func func_8005A238_jp = 0x8005A238; // type:func -func_8005A2FC_jp = 0x8005A2FC; // type:func +banti_draw = 0x8005A2FC; // type:func func_8005ABA0_jp = 0x8005ABA0; // type:func func_8005ABE0_jp = 0x8005ABE0; // type:func func_8005ACA8_jp = 0x8005ACA8; // type:func @@ -272,7 +272,7 @@ func_8005DC9C_jp = 0x8005DC9C; // type:func func_8005DCCC_jp = 0x8005DCCC; // type:func mBGMPsComp_make_ps_lost_fanfare = 0x8005DD2C; // type:func func_8005DD5C_jp = 0x8005DD5C; // type:func -func_8005DDE4_jp = 0x8005DDE4; // type:func +mBGMPsComp_make_ps_wipe = 0x8005DDE4; // type:func func_8005DE0C_jp = 0x8005DE0C; // type:func func_8005DE60_jp = 0x8005DE60; // type:func func_8005DE88_jp = 0x8005DE88; // type:func @@ -500,8 +500,8 @@ func_80064F08_jp = 0x80064F08; // type:func func_80064F28_jp = 0x80064F28; // type:func func_80064F48_jp = 0x80064F48; // type:func func_80064F84_jp = 0x80064F84; // type:func -func_80064FD8_jp = 0x80064FD8; // type:func -func_80065028_jp = 0x80065028; // type:func +Camera2_process = 0x80064FD8; // type:func +Camera2_draw = 0x80065028; // type:func func_80065040_jp = 0x80065040; // type:func func_80065064_jp = 0x80065064; // type:func func_80065158_jp = 0x80065158; // type:func @@ -705,7 +705,7 @@ func_8006BF0C_jp = 0x8006BF0C; // type:func func_8006C4B4_jp = 0x8006C4B4; // type:func func_8006C5A8_jp = 0x8006C5A8; // type:func func_8006C634_jp = 0x8006C634; // type:func -func_8006C740_jp = 0x8006C740; // type:func +mCoBG_CalcTimerDecalCircle = 0x8006C740; // type:func func_8006C7B4_jp = 0x8006C7B4; // type:func func_8006C8D0_jp = 0x8006C8D0; // type:func func_8006C910_jp = 0x8006C910; // type:func @@ -892,8 +892,8 @@ func_80077410_jp = 0x80077410; // type:func func_800774B4_jp = 0x800774B4; // type:func func_80077580_jp = 0x80077580; // type:func func_80077620_jp = 0x80077620; // type:func -func_80077640_jp = 0x80077640; // type:func -func_80077650_jp = 0x80077650; // type:func +CollisionCheck_dt = 0x80077640; // type:func +CollisionCheck_clear = 0x80077650; // type:func CollisionCheck_setOC = 0x800776B4; // type:func func_80077794_jp = 0x80077794; // type:func func_800777D0_jp = 0x800777D0; // type:func @@ -903,7 +903,7 @@ func_80077EF4_jp = 0x80077EF4; // type:func func_80077F20_jp = 0x80077F20; // type:func func_80077FF0_jp = 0x80077FF0; // type:func func_80078014_jp = 0x80078014; // type:func -func_80078070_jp = 0x80078070; // type:func +CollisionCheck_OC = 0x80078070; // type:func func_80078214_jp = 0x80078214; // type:func func_80078258_jp = 0x80078258; // type:func func_8007841C_jp = 0x8007841C; // type:func @@ -1037,13 +1037,13 @@ func_8007CB28_jp = 0x8007CB28; // type:func func_8007CB50_jp = 0x8007CB50; // type:func func_8007CBEC_jp = 0x8007CBEC; // type:func func_8007CC9C_jp = 0x8007CC9C; // type:func -func_8007CDB8_jp = 0x8007CDB8; // type:func +mDemo_stock_clear = 0x8007CDB8; // type:func func_8007CDD8_jp = 0x8007CDD8; // type:func func_8007CF00_jp = 0x8007CF00; // type:func func_8007CF34_jp = 0x8007CF34; // type:func func_8007CF44_jp = 0x8007CF44; // type:func func_8007CF84_jp = 0x8007CF84; // type:func -func_8007CFB4_jp = 0x8007CFB4; // type:func +mDemo_Main = 0x8007CFB4; // type:func func_8007CFD8_jp = 0x8007CFD8; // type:func func_8007D030_jp = 0x8007D030; // type:func func_8007D048_jp = 0x8007D048; // type:func @@ -1135,10 +1135,10 @@ func_8007F6A0_jp = 0x8007F6A0; // type:func func_8007F764_jp = 0x8007F764; // type:func func_8007F858_jp = 0x8007F858; // type:func func_8007F8A4_jp = 0x8007F8A4; // type:func -func_8007F8DC_jp = 0x8007F8DC; // type:func +mEv_2nd_init = 0x8007F8DC; // type:func func_8007F950_jp = 0x8007F950; // type:func -func_8007F988_jp = 0x8007F988; // type:func -func_8007FB44_jp = 0x8007FB44; // type:func +mEv_run = 0x8007F988; // type:func +mEv_finish = 0x8007FB44; // type:func func_8007FCB8_jp = 0x8007FCB8; // type:func func_8007FD40_jp = 0x8007FD40; // type:func func_8007FDA8_jp = 0x8007FDA8; // type:func @@ -1208,36 +1208,36 @@ func_80082FA0_jp = 0x80082FA0; // type:func func_80083038_jp = 0x80083038; // type:func func_800831E0_jp = 0x800831E0; // type:func func_800835AC_jp = 0x800835AC; // type:func -func_8008366C_jp = 0x8008366C; // type:func -func_800836F8_jp = 0x800836F8; // type:func +fbdemo_cleanup = 0x8008366C; // type:func +fbdemo_init = 0x800836F8; // type:func func_80083870_jp = 0x80083870; // type:func -func_80083984_jp = 0x80083984; // type:func +fbdemo_draw = 0x80083984; // type:func func_80083AB0_jp = 0x80083AB0; // type:func -func_80083BE4_jp = 0x80083BE4; // type:func +fbdemo_move = 0x80083BE4; // type:func func_80083BF0_jp = 0x80083BF0; // type:func -func_80083C00_jp = 0x80083C00; // type:func -func_80083CBC_jp = 0x80083CBC; // type:func +fbdemo_triforce_startup = 0x80083C00; // type:func +fbdemo_triforce_init = 0x80083CBC; // type:func func_80083CE8_jp = 0x80083CE8; // type:func -func_80083D14_jp = 0x80083D14; // type:func -func_80083E08_jp = 0x80083E08; // type:func -func_8008400C_jp = 0x8008400C; // type:func -func_80084018_jp = 0x80084018; // type:func -func_80084068_jp = 0x80084068; // type:func -func_80084080_jp = 0x80084080; // type:func -func_800840AC_jp = 0x800840AC; // type:func -func_8008418C_jp = 0x8008418C; // type:func -func_800843C8_jp = 0x800843C8; // type:func -func_80084480_jp = 0x80084480; // type:func -func_800844B0_jp = 0x800844B0; // type:func +fbdemo_triforce_move = 0x80083D14; // type:func +fbdemo_triforce_draw = 0x80083E08; // type:func +fbdemo_triforce_is_finish = 0x8008400C; // type:func +fbdemo_triforce_settype = 0x80084018; // type:func +fbdemo_triforce_setcolor_rgba8888 = 0x80084068; // type:func +fbdemo_wipe1_init = 0x80084080; // type:func +fbdemo_wipe1_move = 0x800840AC; // type:func +fbdemo_wipe1_draw = 0x8008418C; // type:func +fbdemo_wipe1_startup = 0x800843C8; // type:func +fbdemo_wipe1_settype = 0x80084480; // type:func +fbdemo_wipe1_setcolor_rgba8888 = 0x800844B0; // type:func func_800844BC_jp = 0x800844BC; // type:func -func_800844C8_jp = 0x800844C8; // type:func -func_800844E0_jp = 0x800844E0; // type:func -func_8008450C_jp = 0x8008450C; // type:func -func_800845EC_jp = 0x800845EC; // type:func -func_8008468C_jp = 0x8008468C; // type:func -func_800846D4_jp = 0x800846D4; // type:func -func_800846E0_jp = 0x800846E0; // type:func -func_800846EC_jp = 0x800846EC; // type:func +fbdemo_wipe1_is_finish = 0x800844C8; // type:func +fbdemo_fade_init = 0x800844E0; // type:func +fbdemo_fade_move = 0x8008450C; // type:func +fbdemo_fade_draw = 0x800845EC; // type:func +fbdemo_fade_startup = 0x8008468C; // type:func +fbdemo_fade_settype = 0x800846D4; // type:func +fbdemo_fade_setcolor_rgba8888 = 0x800846E0; // type:func +fbdemo_fade_is_finish = 0x800846EC; // type:func func_80084700_jp = 0x80084700; // type:func func_80084748_jp = 0x80084748; // type:func func_800848AC_jp = 0x800848AC; // type:func @@ -1588,13 +1588,13 @@ func_80092468_jp = 0x80092468; // type:func func_800924CC_jp = 0x800924CC; // type:func func_80092538_jp = 0x80092538; // type:func func_8009264C_jp = 0x8009264C; // type:func -func_800928C0_jp = 0x800928C0; // type:func -func_800928E8_jp = 0x800928E8; // type:func +Balloon_init = 0x800928C0; // type:func +Balloon_move = 0x800928E8; // type:func func_80092B7C_jp = 0x80092B7C; // type:func func_80092B8C_jp = 0x80092B8C; // type:func func_80092BA0_jp = 0x80092BA0; // type:func func_80092BE8_jp = 0x80092BE8; // type:func -func_80092C2C_jp = 0x80092C2C; // type:func +mHsRm_GetHuusuiRoom = 0x80092C2C; // type:func func_80092D10_jp = 0x80092D10; // type:func func_80092E14_jp = 0x80092E14; // type:func func_80092E80_jp = 0x80092E80; // type:func @@ -1735,7 +1735,7 @@ func_80098158_jp = 0x80098158; // type:func func_800981B8_jp = 0x800981B8; // type:func func_8009836C_jp = 0x8009836C; // type:func func_800983F0_jp = 0x800983F0; // type:func -func_800984CC_jp = 0x800984CC; // type:func +Global_kankyo_set = 0x800984CC; // type:func func_80098558_jp = 0x80098558; // type:func func_8009867C_jp = 0x8009867C; // type:func func_80098794_jp = 0x80098794; // type:func @@ -1743,7 +1743,7 @@ func_8009895C_jp = 0x8009895C; // type:func func_80098980_jp = 0x80098980; // type:func func_80098990_jp = 0x80098990; // type:func func_80098A90_jp = 0x80098A90; // type:func -func_80098B50_jp = 0x80098B50; // type:func +mEnv_WindMove = 0x80098B50; // type:func func_80098CCC_jp = 0x80098CCC; // type:func func_80098D88_jp = 0x80098D88; // type:func func_80098DE0_jp = 0x80098DE0; // type:func @@ -2179,11 +2179,11 @@ func_800A2EAC_jp = 0x800A2EAC; // type:func func_800A3190_jp = 0x800A3190; // type:func func_800A31D8_jp = 0x800A31D8; // type:func func_800A3220_jp = 0x800A3220; // type:func -func_800A32D0_jp = 0x800A32D0; // type:func +mMsg_ct = 0x800A32D0; // type:func func_800A3304_jp = 0x800A3304; // type:func func_800A332C_jp = 0x800A332C; // type:func -func_800A339C_jp = 0x800A339C; // type:func -func_800A33D8_jp = 0x800A33D8; // type:func +mMsg_Main = 0x800A339C; // type:func +mMsg_Draw = 0x800A33D8; // type:func func_800A3400_jp = 0x800A3400; // type:func func_800A3420_jp = 0x800A3420; // type:func func_800A345C_jp = 0x800A345C; // type:func @@ -2529,7 +2529,7 @@ func_800B1960_jp = 0x800B1960; // type:func func_800B19C4_jp = 0x800B19C4; // type:func func_800B1A28_jp = 0x800B1A28; // type:func func_800B1A60_jp = 0x800B1A60; // type:func -func_800B1AA0_jp = 0x800B1AA0; // type:func +mPlib_Object_Exchange_keep_Player_dt = 0x800B1AA0; // type:func func_800B1AE0_jp = 0x800B1AE0; // type:func func_800B1B3C_jp = 0x800B1B3C; // type:func func_800B1B6C_jp = 0x800B1B6C; // type:func @@ -2708,7 +2708,7 @@ func_800B7350_jp = 0x800B7350; // type:func func_800B7468_jp = 0x800B7468; // type:func func_800B74E8_jp = 0x800B74E8; // type:func func_800B7560_jp = 0x800B7560; // type:func -func_800B7624_jp = 0x800B7624; // type:func +mPO_business_proc = 0x800B7624; // type:func func_800B7680_jp = 0x800B7680; // type:func func_800B7700_jp = 0x800B7700; // type:func func_800B7780_jp = 0x800B7780; // type:func @@ -2873,7 +2873,7 @@ func_800BCFC8_jp = 0x800BCFC8; // type:func func_800BD02C_jp = 0x800BD02C; // type:func func_800BD1E4_jp = 0x800BD1E4; // type:func func_800BD2B0_jp = 0x800BD2B0; // type:func -func_800BD37C_jp = 0x800BD37C; // type:func +gfx_set_fog_nosync = 0x800BD37C; // type:func func_800BD3EC_jp = 0x800BD3EC; // type:func func_800BD428_jp = 0x800BD428; // type:func func_800BD448_jp = 0x800BD448; // type:func @@ -2902,7 +2902,7 @@ func_800BD9FC_jp = 0x800BD9FC; // type:func func_800BDA20_jp = 0x800BDA20; // type:func two_tex_scroll = 0x800BDAA8; // type:func DisplayList_initialize = 0x800BDBB4; // type:func -func_800BDF90_jp = 0x800BDF90; // type:func +fade_rgba8888_draw = 0x800BDF90; // type:func func_800BE030_jp = 0x800BE030; // type:func fade_black_draw = 0x800BE070; // type:func func_800BE094_jp = 0x800BE094; // type:func @@ -3043,23 +3043,23 @@ mSM_ovlptr_dllcnv = 0x800C4728; // type:func func_800C47B4_jp = 0x800C47B4; // type:func func_800C497C_jp = 0x800C497C; // type:func func_800C49D4_jp = 0x800C49D4; // type:func -func_800C4C60_jp = 0x800C4C60; // type:func +mSM_submenu_ovlptr_cleanup = 0x800C4C60; // type:func load_player = 0x800C4CC4; // type:func -func_800C4D1C_jp = 0x800C4D1C; // type:func -func_800C4D80_jp = 0x800C4D80; // type:func +mSM_submenu_ct = 0x800C4D1C; // type:func +mSM_submenu_dt = 0x800C4D80; // type:func func_800C4D8C_jp = 0x800C4D8C; // type:func func_800C4DB0_jp = 0x800C4DB0; // type:func func_800C4DD8_jp = 0x800C4DD8; // type:func func_800C4DFC_jp = 0x800C4DFC; // type:func func_800C4E2C_jp = 0x800C4E2C; // type:func -func_800C4E58_jp = 0x800C4E58; // type:func +mSM_submenu_ctrl = 0x800C4E58; // type:func func_800C50C4_jp = 0x800C50C4; // type:func func_800C50EC_jp = 0x800C50EC; // type:func func_800C510C_jp = 0x800C510C; // type:func func_800C5228_jp = 0x800C5228; // type:func func_800C524C_jp = 0x800C524C; // type:func -func_800C5328_jp = 0x800C5328; // type:func -func_800C535C_jp = 0x800C535C; // type:func +mSM_submenu_move = 0x800C5328; // type:func +mSM_submenu_draw = 0x800C535C; // type:func func_800C53B8_jp = 0x800C53B8; // type:func func_800C543C_jp = 0x800C543C; // type:func func_800C54A8_jp = 0x800C54A8; // type:func @@ -3087,7 +3087,7 @@ func_800C5D68_jp = 0x800C5D68; // type:func func_800C5E10_jp = 0x800C5E10; // type:func func_800C5EA0_jp = 0x800C5EA0; // type:func func_800C5F0C_jp = 0x800C5F0C; // type:func -func_800C5F64_jp = 0x800C5F64; // type:func +mSc_dmacopy_data_bank = 0x800C5F64; // type:func mSc_bank_regist_check = 0x800C60EC; // type:func func_800C6144_jp = 0x800C6144; // type:func mSc_regist_initial_exchange_bank = 0x800C61CC; // type:func @@ -3150,11 +3150,11 @@ mSN_snowman_init = 0x800C8D04; // type:func func_800C8D40_jp = 0x800C8D40; // type:func func_800C8D98_jp = 0x800C8D98; // type:func func_800C8E08_jp = 0x800C8E08; // type:func -func_800C8E50_jp = 0x800C8E50; // type:func +mTD_player_keydata_init = 0x800C8E50; // type:func func_800C8ECC_jp = 0x800C8ECC; // type:func func_800C8F5C_jp = 0x800C8F5C; // type:func func_800C8F84_jp = 0x800C8F84; // type:func -func_800C8FB8_jp = 0x800C8FB8; // type:func +title_demo_move = 0x800C8FB8; // type:func func_800C9010_jp = 0x800C9010; // type:func func_800C9088_jp = 0x800C9088; // type:func mTD_get_titledemo_no = 0x800C909C; // type:func @@ -3174,7 +3174,7 @@ func_800C9728_jp = 0x800C9728; // type:func func_800C98A0_jp = 0x800C98A0; // type:func func_800C9D38_jp = 0x800C9D38; // type:func func_800C9F88_jp = 0x800C9F88; // type:func -func_800CA008_jp = 0x800CA008; // type:func +mTRC_move = 0x800CA008; // type:func func_800CA070_jp = 0x800CA070; // type:func mTM_set_season = 0x800CA1DC; // type:func func_800CA230_jp = 0x800CA230; // type:func @@ -3209,8 +3209,8 @@ showPerspectiveOverLayView = 0x800CB7B0; // type:func showOrthoView1 = 0x800CBA70; // type:func showView1 = 0x800CBC00; // type:func func_800CBF80_jp = 0x800CBF80; // type:func -func_800CBFBC_jp = 0x800CBFBC; // type:func -func_800CC3EC_jp = 0x800CC3EC; // type:func +watch_my_step_move = 0x800CBFBC; // type:func +watch_my_step_draw = 0x800CC3EC; // type:func func_800CC9C4_jp = 0x800CC9C4; // type:func func_800CC9EC_jp = 0x800CC9EC; // type:func func_800CCB44_jp = 0x800CCB44; // type:func @@ -3374,7 +3374,7 @@ func_800D227C_jp = 0x800D227C; // type:func func_800D22A4_jp = 0x800D22A4; // type:func func_800D22CC_jp = 0x800D22CC; // type:func func_800D22F4_jp = 0x800D22F4; // type:func -func_800D2314_jp = 0x800D2314; // type:func +sAdo_BgmFadeoutCheck = 0x800D2314; // type:func func_800D2334_jp = 0x800D2334; // type:func func_800D2354_jp = 0x800D2354; // type:func func_800D2360_jp = 0x800D2360; // type:func diff --git a/linker_scripts/jp/symbol_addrs_overlays.txt b/linker_scripts/jp/symbol_addrs_overlays.txt index 4596d7f..475cc3a 100644 --- a/linker_scripts/jp/symbol_addrs_overlays.txt +++ b/linker_scripts/jp/symbol_addrs_overlays.txt @@ -181,34 +181,34 @@ func_808029D0_jp = 0x808029D0; // type:func first_game_cleanup = 0x80802A20; // type:func first_game_init = 0x80802A2C; // type:func func_80802A60_jp = 0x80802A60; // type:func -func_80802AE0_jp = 0x80802AE0; // type:func -func_80802B40_jp = 0x80802B40; // type:func -func_80802B64_jp = 0x80802B64; // type:func -func_80802B8C_jp = 0x80802B8C; // type:func -func_80802BB8_jp = 0x80802BB8; // type:func -func_80802BF4_jp = 0x80802BF4; // type:func -func_80802C90_jp = 0x80802C90; // type:func -func_80802CBC_jp = 0x80802CBC; // type:func -func_80802D9C_jp = 0x80802D9C; // type:func -func_80802DF0_jp = 0x80802DF0; // type:func -func_80802E10_jp = 0x80802E10; // type:func -func_80802E34_jp = 0x80802E34; // type:func -func_80802E74_jp = 0x80802E74; // type:func -func_808030D0_jp = 0x808030D0; // type:func -func_80803124_jp = 0x80803124; // type:func -func_80803174_jp = 0x80803174; // type:func +Game_play_Reset_destiny = 0x80802AE0; // type:func +event_title_flag_on = 0x80802B40; // type:func +event_title_flag_off = 0x80802B64; // type:func +Game_play_camera_proc = 0x80802B8C; // type:func +Game_play_fbdemo_wipe_destroy = 0x80802BB8; // type:func +Game_play_fbdemo_wipe_create_sub = 0x80802BF4; // type:func +Game_play_fbdemo_wipe_create = 0x80802C90; // type:func +Game_play_fbdemo_wipe_init = 0x80802CBC; // type:func +Game_play_fbdemo_fade_in_move_end = 0x80802D9C; // type:func +Game_play_fbdemo_fade_out_start_emu_move_end = 0x80802DF0; // type:func +Game_play_fbdemo_fade_out_game_end_move_end = 0x80802E10; // type:func +Game_play_change_scene_move_end = 0x80802E34; // type:func +Game_play_fbdemo_wipe_move = 0x80802E74; // type:func +Game_play_fbdemo_wipe_proc = 0x808030D0; // type:func +game_play_set_fog = 0x80803124; // type:func +Game_play_fbdemo_proc = 0x80803174; // type:func play_cleanup = 0x80803210; // type:func play_init = 0x808032F8; // type:func -func_80803544_jp = 0x80803544; // type:func -func_8080367C_jp = 0x8080367C; // type:func +Game_play_move_fbdemo_not_move = 0x80803544; // type:func +Game_play_move = 0x8080367C; // type:func func_80803810_jp = 0x80803810; // type:func -func_808039D0_jp = 0x808039D0; // type:func -func_80803A18_jp = 0x80803A18; // type:func -func_80803A40_jp = 0x80803A40; // type:func -func_80803B08_jp = 0x80803B08; // type:func -func_80803E40_jp = 0x80803E40; // type:func -func_80803F48_jp = 0x80803F48; // type:func -func_8080407C_jp = 0x8080407C; // type:func +setupFog = 0x808039D0; // type:func +setupViewer = 0x80803A18; // type:func +setupViewMatrix = 0x80803A40; // type:func +makeBumpTexture = 0x80803B08; // type:func +draw_version = 0x80803E40; // type:func +Game_play_draw = 0x80803F48; // type:func +play_main = 0x8080407C; // type:func func_80804138_jp = 0x80804138; // type:func func_808041A4_jp = 0x808041A4; // type:func Gameplay_Scene_Init = 0x808041C4; // type:func @@ -233,10 +233,10 @@ jtbl_80804410_jp = 0x80804410; // type:jtbl // .bss -B_80804480_jp = 0x80804480; // +fbdemo = 0x80804480; // B_8080455C_jp = 0x8080455C; // -B_80804560_jp = 0x80804560; // type:s16 -B_80804562_jp = 0x80804562; // type:s16 +S_back_title_timer = 0x80804560; // type:s16 +S_se_endcheck_timeout = 0x80804562; // type:s16 // .text diff --git a/src/code/game.c b/src/code/game.c index 1c634ba..03677a8 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -107,6 +107,9 @@ void game_debug_draw_last(GameState* gameState, GraphicsContext* gfxCtx) { gfxclose(gfxHead, gfx); POLY_OPA_DISP = gfx; + do { + } while (0); + CLOSE_DISPS(gfxCtx); } diff --git a/src/code/m_actor.c b/src/code/m_actor.c index f5c2091..6419d42 100644 --- a/src/code/m_actor.c +++ b/src/code/m_actor.c @@ -264,7 +264,7 @@ void Actor_draw(PlayState* play, Actor* actor) { OPEN_DISPS(play->state.gfxCtx); light = Global_light_read(&play->lightCtx, play->state.gfxCtx); - LightsN_list_check(light, play->lightCtx.unk_0, (actor->flags & ACTOR_FLAG_400000) ? NULL : &actor->world.pos); + LightsN_list_check(light, play->lightCtx.listHead, (actor->flags & ACTOR_FLAG_400000) ? NULL : &actor->world.pos); LightsN_disp(light, play->state.gfxCtx); Matrix_softcv3_load(actor->world.pos.x, actor->world.pos.y + actor->shape.unk_08 * actor->scale.y, @@ -1121,7 +1121,7 @@ Hilite* Setpos_HiliteReflect_init(Vec3f* object, PlayState* play) { sp24.x = play->kankyo.unk_02; sp24.y = play->kankyo.unk_03; sp24.z = play->kankyo.unk_04; - return HiliteReflect_init(object, &play->unk_1960, &sp24, play->state.gfxCtx); + return HiliteReflect_init(object, &play->unk_1938.unk_028, &sp24, play->state.gfxCtx); } Hilite* Setpos_HiliteReflect_xlu_init(Vec3f* object, PlayState* play) { @@ -1130,7 +1130,7 @@ Hilite* Setpos_HiliteReflect_xlu_init(Vec3f* object, PlayState* play) { sp24.x = play->kankyo.unk_02; sp24.y = play->kankyo.unk_03; sp24.z = play->kankyo.unk_04; - return HiliteReflect_xlu_init(object, &play->unk_1960, &sp24, play->state.gfxCtx); + return HiliteReflect_xlu_init(object, &play->unk_1938.unk_028, &sp24, play->state.gfxCtx); } Hilite* Setpos_HiliteReflect_light_init(Vec3f* object, PlayState* play) { @@ -1139,5 +1139,5 @@ Hilite* Setpos_HiliteReflect_light_init(Vec3f* object, PlayState* play) { sp24.x = play->kankyo.unk_02; sp24.y = play->kankyo.unk_03; sp24.z = play->kankyo.unk_04; - return HiliteReflect_xlu_init(object, &play->unk_1960, &sp24, play->state.gfxCtx); + return HiliteReflect_xlu_init(object, &play->unk_1938.unk_028, &sp24, play->state.gfxCtx); } diff --git a/src/overlays/gamestates/ovl_play/m_play.c b/src/overlays/gamestates/ovl_play/m_play.c new file mode 100644 index 0000000..7c9e851 --- /dev/null +++ b/src/overlays/gamestates/ovl_play/m_play.c @@ -0,0 +1,871 @@ +#include "global.h" +#include "m_play.h" +#include "6A6E80.h" +#include "m_npc.h" +#include "m_handbill.h" +#include "m_field_make.h" +#include "m_malloc.h" +#include "m_msg_main.h" +#include "m_debug.h" +#include "m_player_lib.h" +#include "6F5550.h" +#include "6EC9E0.h" +#include "6EDD10.h" +#include "69E2C0.h" +#include "683030.h" +#include "6E30B0.h" +#include "6C97F0.h" +#include "6EFC20.h" +#include "67D890.h" +#include "6DA460.h" +#include "6ECD90.h" +#include "6BA500.h" +#include "libc64/qrand.h" +#include "m_controller.h" +#include "m_debug_display.h" +#include "6E0F50.h" +#include "6D2720.h" +#include "m_lights.h" +#include "m_skin_matrix.h" +#include "gfxalloc.h" +#include "version.h" +#include "libu64/gfxprint.h" +#include "libc/alloca.h" +#include "z_std_dma.h" +#include "67E840.h" +#include "overlays/gamestates/ovl_famicom_emu/famicom_emu.h" +#include "overlays/gamestates/ovl_trademark/m_trademark.h" +#include "6A7D20.h" +#include "m_scene_table.h" + +void play_main(GameState* gameState); +void Gameplay_Scene_Read(PlayState* play, s16 arg1); +void Game_play_fbdemo_wipe_create(PlayState* play); +void Game_play_fbdemo_wipe_init(PlayState* play); +void Game_play_fbdemo_wipe_move(PlayState* play); + +PlayStateUnkFuncsStruct D_80804320_jp = { + fbdemo_wipe1_init, + (void*)none_proc1, + fbdemo_wipe1_move, + fbdemo_wipe1_draw, + fbdemo_wipe1_startup, + fbdemo_wipe1_settype, + fbdemo_wipe1_setcolor_rgba8888, + NULL, + fbdemo_wipe1_is_finish, +}; + +PlayStateUnkFuncsStruct D_80804344_jp = { + fbdemo_triforce_init, + (void*)none_proc1, + fbdemo_triforce_move, + fbdemo_triforce_draw, + fbdemo_triforce_startup, + fbdemo_triforce_settype, + fbdemo_triforce_setcolor_rgba8888, + NULL, + fbdemo_triforce_is_finish, +}; + +PlayStateUnkFuncsStruct D_80804368_jp = { + fbdemo_fade_init, + (void*)none_proc1, + fbdemo_fade_move, + fbdemo_fade_draw, + fbdemo_fade_startup, + fbdemo_fade_settype, + fbdemo_fade_setcolor_rgba8888, + NULL, + fbdemo_fade_is_finish, +}; + +PlayStateUnkFuncsStruct* D_8080438C_jp[] = { + &D_80804320_jp, &D_80804344_jp, &D_80804368_jp, &D_80804368_jp, &D_80804344_jp, &D_80804344_jp, &D_80804368_jp, +}; + +typedef void (*PlayStateUnkFunc)(PlayState* play); +PlayStateUnkFunc D_808043A8_jp[] = { + (void*)none_proc1, + Game_play_fbdemo_wipe_create, + Game_play_fbdemo_wipe_init, + Game_play_fbdemo_wipe_move, +}; + +static Play80804480 fbdemo; +static void* B_8080455C_jp; +static u16 S_back_title_timer; +static u16 S_se_endcheck_timeout; + +void Game_play_Reset_destiny(void) { + CommonData10138_Sub* temp = &common_data.unk_10138->unk_A86; + u8* one = &common_data.unk_1011F; + u8* two = &common_data.unk_10121; + + if ((temp->unk_08 != 0) && + ((common_data.unk_10122 != temp->unk_06) || (*two != temp->unk_05) || (*one != temp->unk_03))) { + temp->unk_08 = 0; + } +} + +void event_title_flag_on(void) { + if (common_data.unk_107E4 != 0) { + common_data.unk_10A82 = 1; + } +} + +void event_title_flag_off(void) { + if (common_data.unk_107E4 == 2) { + common_data.unk_107E4 = 0; + common_data.unk_10A82 = 0; + } +} + +void Game_play_camera_proc(PlayState* play) { + Camera2_ClearActorTalking_Cull(play); + Camera2_process(play); +} + +void Game_play_fbdemo_wipe_destroy(PlayState* play) { + play->unk_1EE8.unk_21C.unk_04(&play->unk_1EE8, play); + play->unk_1EE3 = 0; + play->unk_1EE8.unk_218 = -1; +} + +void Game_play_fbdemo_wipe_create_sub(PlayState* play) { + s32 sp1C = play->unk_1EE1; + + bzero(&play->unk_1EE8, sizeof(PlayState_Unk_1EE8)); + if (sp1C >= 7) { + sp1C = 1; + } + play->unk_1EE8.unk_218 = sp1C; + + { + PlayStateUnkFuncsStruct* temp_v0 = D_8080438C_jp[sp1C]; + + play->unk_1EE8.unk_21C.unk_00 = temp_v0->unk_00; + play->unk_1EE8.unk_21C.unk_04 = temp_v0->unk_04; + play->unk_1EE8.unk_21C.unk_08 = temp_v0->unk_08; + play->unk_1EE8.unk_21C.unk_0C = temp_v0->unk_0C; + play->unk_1EE8.unk_21C.unk_10 = temp_v0->unk_10; + play->unk_1EE8.unk_21C.unk_14 = temp_v0->unk_14; + play->unk_1EE8.unk_21C.unk_18 = temp_v0->unk_18; + play->unk_1EE8.unk_21C.unk_20 = temp_v0->unk_20; + } +} + +void Game_play_fbdemo_wipe_create(PlayState* play) { + Game_play_fbdemo_wipe_create_sub(play); + Game_play_fbdemo_wipe_init(play); +} + +void Game_play_fbdemo_wipe_init(PlayState* play) { + PlayState_Unk_1EE8* temp_s0 = &play->unk_1EE8; + u8 var_v0; + + play->unk_1EE8.unk_21C.unk_00(temp_s0); + + common_data.unk_1014A = 14; + common_data.unk_10149 = 30; + + temp_s0->unk_21C.unk_18(temp_s0, 0); + + var_v0 = play->unk_1EE0; + if (temp_s0->unk_218 == 4) { + var_v0 |= 0x80; + } else if (temp_s0->unk_218 == 5) { + var_v0 |= 0x40; + } + + temp_s0->unk_21C.unk_14(temp_s0, var_v0); + temp_s0->unk_21C.unk_10(temp_s0); + + play->unk_1EE3 = 3; + S_back_title_timer = 300; + S_se_endcheck_timeout = 300; +} + +void Game_play_fbdemo_fade_in_move_end(PlayState* play) { + Game_play_fbdemo_wipe_destroy(play); + if (play->unk_1EE2 == 3) { + fbdemo_cleanup(&fbdemo); + play->unk_1EE2 = 0; + SetGameFrame(3); + } +} + +void Game_play_fbdemo_fade_out_start_emu_move_end(PlayState* play) { + STOP_GAMESTATE(&play->state); + SET_NEXT_GAMESTATE(&play->state, famicom_emu_init, sizeof(FamicomEmuState)); +} + +void Game_play_fbdemo_fade_out_game_end_move_end(PlayState* play) { + STOP_GAMESTATE(&play->state); + SET_NEXT_GAMESTATE(&play->state, trademark_init, sizeof(TrademarkState)); +} + +void Game_play_change_scene_move_end(PlayState* play) { + game_goto_next_game_play(&play->state); + common_data.unk_10004 = common_data.unk_00014; + common_data.unk_00014 = play->unk_1E18; +} + +void Game_play_fbdemo_wipe_move(PlayState* play) { + UNUSED s32 pad[2]; + s16 sp26 = 0; + s32 sp20 = 1; + PlayState_Unk_1EE8* sp18 = &play->unk_1EE8; + + if (play->unk_1EE8.unk_21C.unk_20(sp18, play) != 0) { + if ((play->unk_1EE0 != 1) && (play->unk_1EE0 != 11)) { + if (S_se_endcheck_timeout != 0) { + S_se_endcheck_timeout--; + } + + if ((func_800D2334_jp(sp18, play) == 0) && (S_se_endcheck_timeout != 0)) { + sp20 = 0; + } else { + func_800D2568_jp(1); + } + } + + if (play->unk_1EE0 == 11) { + func_800D2568_jp(2); + } + + if (sp20 == 1) { + switch (play->unk_1EE0) { + case 1: + Game_play_fbdemo_fade_in_move_end(play); + break; + + case 3: + //! FAKE + if (1) {} + if (1) {} + Game_play_fbdemo_fade_out_start_emu_move_end(play); + break; + + case 4: + case 6: + if (S_back_title_timer == 300) { + mBGMPsComp_make_ps_wipe(0x168, play); + } + + case 5: + case 10: + if (S_back_title_timer != 0) { + S_back_title_timer--; + } + + if ((sAdo_BgmFadeoutCheck() == 1) || (S_back_title_timer == 0)) { + Game_play_fbdemo_fade_out_game_end_move_end(play); + } else { + sp26 = 1; + } + break; + + case 8: + if (common_data.unk_100E4 != NULL) { + if (*common_data.unk_100E4 != NULL) { + (*common_data.unk_100E4)(play); + Game_play_change_scene_move_end(play); + } + } + break; + + case 9: + if (S_back_title_timer != 0) { + S_back_title_timer--; + } + + if ((sAdo_BgmFadeoutCheck() == 1) || (S_back_title_timer == 0)) { + Game_play_change_scene_move_end(play); + } else { + sp26 = 1; + } + break; + + default: + Game_play_change_scene_move_end(play); + break; + } + + if (sp26 == 0) { + play->unk_1EE0 = 0; + } + } + } else { + sp18->unk_21C.unk_08(sp18, game_GameFrame); + } +} + +void Game_play_fbdemo_wipe_proc(PlayState* play) { + if ((play->unk_1EE3 == 0) && (play->unk_1EE0 != 0)) { + play->unk_1EE3 = 1; + } + D_808043A8_jp[play->unk_1EE3](play); +} + +Gfx* game_play_set_fog(PlayState* play, Gfx* gfx) { + return gfx_set_fog_nosync(gfx, play->lightCtx.fogColor.r, play->lightCtx.fogColor.g, play->lightCtx.fogColor.b, 0, + play->lightCtx.fogNear, play->lightCtx.zFar); +} + +void Game_play_fbdemo_proc(PlayState* play) { + UNUSED s32 pad; + GraphicsContext* gfxCtx = play->state.gfxCtx; + + switch (play->unk_1EE2) { + case 2: + if (fbdemo_init(&fbdemo, 10, 7, play) == 0) { + play->unk_1EE2 = 0; + } else { + B_8080455C_jp = gfxCtx->unk_008; + play->unk_1EE2 = 3; + SetGameFrame(1); + } + break; + case 3: + fbdemo_move(&fbdemo); + break; + } +} + +void play_cleanup(GameState* gameState) { + PlayState* play = (PlayState*)gameState; + + func_800A3304_jp(play); + play->state.gfxCtx->unk_2F4 = 0; + play->state.gfxCtx->unk_2F8 = 0; + play->unk_1CBC.unk_00 = 0; + PreRender_cleanup(&play->unk_1DC0); + CollisionCheck_dt(play, &play->unk_2138); + + if (play->unk_1EE2 == 3) { + fbdemo_cleanup(&fbdemo); + play->unk_1EE2 = 0; + } + + if (play->unk_1EE3 == 3) { + Game_play_fbdemo_wipe_destroy(play); + } + + Actor_info_dt(&play->actorInfo, play); + mEv_finish(&play->unk_1EBC); + func_800AA124_jp(); + mSM_submenu_dt(&play->unk_1CBC); + play->unk_1DAC = -1; + mSM_submenu_ovlptr_cleanup(&play->unk_1CBC); + mPlib_Object_Exchange_keep_Player_dt(play); + mHsRm_GetHuusuiRoom(0, common_data.unk_10003); + func_80087280_jp(); + zelda_CleanupArena(); +} + +void play_init(GameState* gameState) { + PlayState* play = (PlayState*)gameState; + GraphicsContext* gfxCtx = play->state.gfxCtx; + u32 temp_v1; + u32 temp_v0_2; + UNUSED s32 pad[2]; + u8 temp; + s32 sp30; + + //! FAKE + if (play && play && play) {} + + game_resize_hyral(&play->state, 0x7D0000); + func_800D2568_jp(0); + event_title_flag_on(); + func_800C9010_jp(); + mTM_set_season(); + func_800B594C_jp(); + func_800C49D4_jp(play); + func_8007CFD8_jp(play); + func_8007F858_jp(&play->unk_1EBC); + initView(&play->unk_1938, gfxCtx); + func_80064F48_jp(play); + func_80077620_jp(play, &play->unk_2138); + func_8006BB64_jp(); + func_8006C8D0_jp(); + play->unk_1DAC = -1; + Gameplay_Scene_Read(play, common_data.unk_00014); + mSM_submenu_ct(&play->unk_1CBC); + play->unk_1CBC.unk_00 = 0; + PreRender_init(&play->unk_1DC0); + PreRender_setup_savebuf(&play->unk_1DC0, 0x140, 0xF0, 0, 0, 0); + PreRender_setup_renderbuf(&play->unk_1DC0, 0x140, 0xF0, NULL, NULL); + + //! FAKE + if (1) {} + play->unk_1EE2 = 0; + play->unk_1EE3 = 0; + play->unk_1EE0 = 1; + + temp = 1; + if (common_data.unk_1014B != 0xFF) { + temp = common_data.unk_1014B; + common_data.unk_1014B = 0xFF; + } + play->unk_1EE1 = temp; + + Pause_ct(&play->pause); + new_Matrix(&play->state); + play->state.main = play_main; + play->state.destroy = play_cleanup; + fbdemo_fade_init(&play->unk_2128); + fbdemo_fade_settype(&play->unk_2128, 7); + fbdemo_fade_setcolor_rgba8888(&play->unk_2128, 0xA0A0A0FF); + fbdemo_fade_startup(&play->unk_2128); + play->unk_220C = 0; + sp30 = THA_getFreeBytes(&play->state.heap); + temp_v0_2 = (u32)THA_alloc16(&play->state.heap, sp30); + temp_v1 = ALIGN16(temp_v0_2); + //! FAKE + zelda_InitArena((void*)(temp_v1 & 0xFFFFFFFF), (sp30 - temp_v1) + temp_v0_2); + func_800C2EE0_jp(); + func_80087004_jp(); + Actor_info_ct(play, &play->actorInfo, play->unk_1EA8); + play->unk_2208 = (void*)none_proc1; + mMsg_ct(play); + mEv_2nd_init(&play->unk_1EBC); + mTD_player_keydata_init(play); + Balloon_init(play); + func_800A65C4_jp(); + func_80059BF0_jp(); + func_800CBF80_jp(); + event_title_flag_off(); +} + +void Game_play_move_fbdemo_not_move(PlayState* play) { + UNUSED s32 pad[2]; + + play->state.unk_9D = 0x8F; + play->state.unk_9C = 1; + mSM_submenu_ctrl(play); + if (play->unk_1CBC.unk_0C == 0) { + play->state.unk_9C = 2; + mDemo_Main(play); + play->state.unk_9C = 3; + mEv_run(&play->unk_1EBC); + } + play->state.unk_9C = 4; + mDemo_stock_clear(); + play->state.unk_9C = 5; + mSc_dmacopy_data_bank(play->unk_0110); + play->state.unk_9C = 6; + mSM_submenu_move(&play->unk_1CBC); + if ((play->unk_1CBC.unk_0C == 0) && (REGADDR(IREG, 0x48) == 0)) { + play->unk_1EA0++; + play->state.unk_9C = 7; + CollisionCheck_OC(play, &play->unk_2138); + play->state.unk_9C = 8; + CollisionCheck_clear(play, &play->unk_2138); + play->state.unk_9D = 0x90; + play->state.unk_9C = 0; + Actor_info_call_actor(play, &play->actorInfo); + play->state.unk_9D = 0x91; + play->state.unk_9C = 1; + mCoBG_CalcTimerDecalCircle(); + play->state.unk_9C = 2; + mMsg_Main(play); + } + fbdemo_fade_move(&play->unk_2128, game_GameFrame); +} + +void Game_play_move(PlayState* play) { + PlayState_unk_0110* p = play->unk_0110; + s32 var_v1; + + play->state.unk_9D = 0x8D; + play->state.unk_9C = 1; + Game_play_Reset_destiny(); + gSegments[4] = (uintptr_t)OS_K0_TO_PHYSICAL(p->segment); + gSegments[2] = (uintptr_t)OS_K0_TO_PHYSICAL(play->unk_010C); + play->state.unk_9C = 2; + + if (zurumode_flag >= 2) { + var_v1 = Pause_proc(&play->pause, CONTROLLER2(&play->state)) == 0; + } else { + var_v1 = 0; + } + + play->state.unk_9D = 0x8E; + play->state.unk_9C = 0; + + if (var_v1 == 0) { + play->state.unk_9C = 1; + Game_play_fbdemo_wipe_proc(play); + play->state.unk_9C = 2; + Game_play_fbdemo_proc(play); + play->state.unk_9C = 3; + if (play->unk_1EE2 != 3) { + Game_play_move_fbdemo_not_move(play); + } + } + + if (play->unk_1CBC.unk_0C == 0) { + play->state.unk_9D = 0x92; + play->state.unk_9C = 1; + Game_play_camera_proc(play); + play->state.unk_9C = 2; + mPO_business_proc(play); + play->state.unk_9C = 3; + mTRC_move(play); + play->state.unk_9C = 4; + Balloon_move(play); + } + + play->state.unk_9D = 0x93; + play->state.unk_9C = 1; + Global_kankyo_set(play, &play->kankyo, &play->lightCtx); + play->state.unk_9C = 2; + mEnv_WindMove(); + play->state.unk_9C = 3; + watch_my_step_move(play); + play->state.unk_9C = 4; + banti_move(play); + play->state.unk_9C = 5; + title_demo_move(play); + play->state.unk_9D = 0x95; + play->state.unk_9C = 0; +} + +void func_80803810_jp(PlayState* play, GraphicsContext* gfxCtx) { + void* temp_v0 = play->unk_0110[0].segment; + + gSegments[4] = (uintptr_t)OS_K0_TO_PHYSICAL(temp_v0); + gSegments[2] = (uintptr_t)OS_K0_TO_PHYSICAL(play->unk_010C); + + OPEN_DISPS(gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x00, NULL); + gSPSegment(POLY_XLU_DISP++, 0x00, NULL); + gSPSegment(OVERLAY_DISP++, 0x00, NULL); + gSPSegment(UNK_2B0_DISP++, 0x00, NULL); + gSPSegment(UNK_2C0_DISP++, 0x00, NULL); + gSPSegment(LIGHT_DISP++, 0x00, NULL); + + gSPSegment(POLY_OPA_DISP++, 0x04, temp_v0); + gSPSegment(POLY_XLU_DISP++, 0x04, temp_v0); + gSPSegment(OVERLAY_DISP++, 0x04, temp_v0); + gSPSegment(UNK_2B0_DISP++, 0x04, temp_v0); + gSPSegment(UNK_2C0_DISP++, 0x04, temp_v0); + gSPSegment(LIGHT_DISP++, 0x04, temp_v0); + + gSPSegment(POLY_OPA_DISP++, 0x02, play->unk_010C); + gSPSegment(POLY_XLU_DISP++, 0x02, play->unk_010C); + gSPSegment(OVERLAY_DISP++, 0x02, play->unk_010C); + gSPSegment(UNK_2B0_DISP++, 0x02, play->unk_010C); + gSPSegment(UNK_2C0_DISP++, 0x02, play->unk_010C); + gSPSegment(LIGHT_DISP++, 0x02, play->unk_010C); + + CLOSE_DISPS(gfxCtx); +} + +void setupFog(PlayState* play, GraphicsContext* gfxCtx) { + OPEN_DISPS(gfxCtx); + + POLY_OPA_DISP = game_play_set_fog(play, POLY_OPA_DISP); + POLY_XLU_DISP = game_play_set_fog(play, POLY_XLU_DISP); + + CLOSE_DISPS(gfxCtx); +} + +void setupViewer(PlayState* play) { + showView(&play->unk_1938, 0xF, play); +} + +void setupViewMatrix(PlayState* play, GraphicsContext* __gfxCtx, GraphicsContext* gfxCtx2) { + // TODO: A way to fit OPEN_DISPS/CLOSE_DISPS on the stack + Matrix_MtxtoMtxF(&play->unk_1938.unk_0A0, &play->billboardMtxF); + Matrix_MtxtoMtxF(&play->unk_1938.unk_060, &play->viewProjectionMtxF); + Skin_Matrix_MulMatrix(&play->viewProjectionMtxF, &play->billboardMtxF, &play->viewProjectionMtxF); + + play->billboardMtxF.mf[0][3] = 0.0f; + play->billboardMtxF.mf[1][3] = 0.0f; + play->billboardMtxF.mf[2][3] = 0.0f; + play->billboardMtxF.mf[3][0] = 0.0f; + play->billboardMtxF.mf[3][1] = 0.0f; + play->billboardMtxF.mf[3][2] = 0.0f; + + Matrix_reverse(&play->billboardMtxF); + + play->unk_1E9C = _MtxF_to_Mtx(&play->billboardMtxF, GRAPH_ALLOC(gfxCtx2, sizeof(MtxF) * 1)); + + gSPSegment(POLY_OPA_DISP++, 0x01, play->unk_1E9C); +} + +s32 makeBumpTexture(PlayState* play, GraphicsContext* __gfxCtx, GraphicsContext* gfxCtx2) { + // TODO: A way to fit OPEN_DISPS/CLOSE_DISPS on the stack + { + Gfx* sp194; + Gfx* sp190; + sp190 = POLY_OPA_DISP; + sp194 = gfxopen(sp190); + + gSPDisplayList(OVERLAY_DISP++, sp194); + + if (play->unk_1EE3 == 3) { + PlayState1938 sp60; + ScissorViewArg1 sp50; + + initView(&sp60, gfxCtx2); + { + sp60.unk_120 = 10; + //! FAKE + label2:; + } + sp50.unk_04 = 0xF0, sp50.unk_0C = 0x140; + sp50.unk_00 = 0; + sp50.unk_08 = 0; + setScissorView(&sp60, &sp50); + showView1(&sp60, 0xF, &sp194); + play->unk_1EE8.unk_21C.unk_0C(&play->unk_1EE8, &sp194); + } + + fbdemo_fade_draw(&play->unk_2128, &sp194); + fade_rgba8888_draw(&sp194, play->unk_220C); + + gSPEndDisplayList(sp194++); + + gfxclose(sp190, sp194); + POLY_OPA_DISP = sp194; + } + + if (play->unk_1EE2 == 3) { + Gfx* sp48 = POLY_OPA_DISP; + + fbdemo_draw(&fbdemo, &sp48); + POLY_OPA_DISP = sp48; + return 1; + } + + PreRender_setup_renderbuf(&play->unk_1DC0, 0x140, 0xF0, gfxCtx2->unk_2E4, gfxCtx2->unk_008); + if (play->unk_1CBC.unk_00 == 2) { + func_800B0010_jp(); + PreRender_ConvertFrameBuffer_fg(&play->unk_1DC0); + play->unk_1CBC.unk_00 = 3; + } else if (play->unk_1CBC.unk_00 >= 5) { + play->unk_1CBC.unk_00 = 0; + } + + if (play->unk_1CBC.unk_00 == 3) { + Gfx* sp44 = POLY_OPA_DISP; + + PreRender_loadFrameBufferCopy(&play->unk_1DC0, &sp44); + POLY_OPA_DISP = sp44; + return 1; + } + + { + Lights* sp40 = Global_light_read(&play->lightCtx, gfxCtx2); + + LightsN_list_check(sp40, play->lightCtx.listHead, NULL); + LightsN_disp(sp40, gfxCtx2); + } + + Actor_info_draw_actor(play, &play->actorInfo); + Camera2_draw(play); + mMsg_Draw(play); + Debug_Display_output(play); + + if ((play->unk_1CBC.unk_00 == 1) || (play->unk_1EE2 == 1)) { + Gfx* sp3C; + Gfx* sp38; + + sp38 = POLY_OPA_DISP; + sp3C = gfxopen(sp38); + + gSPDisplayList(OVERLAY_DISP++, sp3C); + + play->unk_1DC0.unk_10 = gfxCtx2->unk_2E4; + play->unk_1DC0.unk_14 = gfxCtx2->unk_008; + PreRender_saveFrameBuffer(&play->unk_1DC0, &sp3C); + + if (play->unk_1CBC.unk_00 == 1) { + play->unk_1DC0.unk_18 = gfxCtx2->unk_2E4; + PreRender_saveCVG(&play->unk_1DC0, &sp3C); + play->unk_1CBC.unk_00 = 2; + } else { + play->unk_1EE2 = 2; + } + + gSPEndDisplayList(sp3C++); + + gfxclose(sp38, sp3C); + POLY_OPA_DISP = sp3C; + + REGADDR(SREG, 0x21) |= 1; + return 0; + } + return 1; +} + +void draw_version(GraphicsContext* gfxCtx) { + Gfx* temp_s0; + gfxprint* printer; + + OPEN_DISPS(gfxCtx); + + temp_s0 = func_800BD720_jp(OVERLAY_DISP); + printer = alloca(sizeof(gfxprint)); + + gfxprint_init(printer); + gfxprint_open(printer, temp_s0); + gfxprint_color(printer, 255, 155, 255, 255); + gfxprint_color(printer, 255, 255, 255, 255); + if (temp_s0 && temp_s0 && temp_s0) {} + gfxprint_locate8x8(printer, 7, 0x1A); + gfxprint_printf(printer, "[Creator:%s]", __Creator__); + gfxprint_locate8x8(printer, 7, 0x1B); + gfxprint_printf(printer, "[Date:%s]", __DateTime__); + temp_s0 = gfxprint_close(printer); + gfxprint_cleanup(printer); + OVERLAY_DISP = temp_s0; + + CLOSE_DISPS(gfxCtx); +} + +void Game_play_draw(PlayState* play) { + GraphicsContext* gfxCtx = play->state.gfxCtx; + u8 sp2B = 0; + u8 sp2A = 0; + u8 sp29 = 0; + + //! FAKE +label:; + func_80803810_jp(play, gfxCtx); + if (common_data.unk_10001 == 0) { + if (mEv_CheckTitleDemo() != -9) { + sp2B = play->kankyo.unk_AE; + sp2A = play->kankyo.unk_AF; + sp29 = play->kankyo.unk_B0; + } + } + + DisplayList_initialize(gfxCtx, sp2B, sp2A, sp29, play); + setupFog(play, gfxCtx); + setupViewer(play); + setupViewMatrix(play, gfxCtx, gfxCtx); + + //! FAKE + if (1) {} + if (1) {} + if (1) {} + + if (makeBumpTexture(play, gfxCtx, gfxCtx) == 1) { + watch_my_step_draw(play); + banti_draw(play); + mSM_submenu_draw(&play->unk_1CBC, play); + } + + if (zurumode_flag != 0) { + switch (mEv_CheckTitleDemo()) { + case -9: + case -1: + default: + draw_version(gfxCtx); + break; + + case 0: + break; + } + } +} + +void play_main(GameState* gameState) { + PlayState* play = (PlayState*)gameState; + + play->state.unk_9D = 0x6E; + play->state.unk_9C = 0; + fqrand(); + play->state.unk_9D = 0x78; + play->state.unk_9C = 0; + mCon_main(&play->state); + play->state.unk_9D = 0x82; + play->state.unk_9C = 0; + Debug_Display_init(); + play->state.unk_9D = 0x8C; + play->state.unk_9C = 0; + Game_play_move(play); + play->state.unk_9D = 0xAA; + play->state.unk_9C = 0; + Game_play_draw(play); + play->state.unk_9D = 0xB4; + play->state.unk_9C = 0; + if (play->unk_1CBC.unk_00 != 2) { + GraphicsContext* gfxCtx = play->state.gfxCtx; + + game_debug_draw_last(&play->state, gfxCtx); + game_draw_last(gfxCtx); + play->state.unk_9C = 0; + } + play->state.unk_9D = 0xBE; +} + +void* func_80804138_jp(PlayState* play, Struct_8010EAA0* arg1) { + u32 sp24 = arg1->unk_04 - arg1->unk_00; + void* sp20 = THA_alloc16(&play->state.heap, sp24); + + func_80026E10_jp(sp20, arg1->unk_00, sp24, "../m_play.c", 2302); + return sp20; +} + +void func_808041A4_jp(PlayState* play) { + Global_kankyo_ct(play, &play->kankyo); +} + +void Gameplay_Scene_Init(PlayState* play) { + play->unk_1EA8 = NULL; + play->unk_1EA5 = 0; + play->unk_1EA6 = 0; + play->unk_1EA7 = 0; + play->unk_1EB8 = 0; + mSc_data_bank_ct(play, play->unk_0110); + Global_light_ct(&play->lightCtx); + Door_info_ct(&play->unk_1E10); + common_data_clear(); + Scene_ct(play, play->unk_010C); + mSc_decide_exchange_bank(play->unk_0110); + func_808041A4_jp(play); +} + +s32 mPl_SceneNo2SoundRoomType(s32 arg0) { + switch (arg0) { + case 20: + return 1; + case 6: + case 9: + case 12: + case 14: + case 18: + case 21: + case 31: + return 2; + case 17: + case 22: + case 23: + case 24: + case 25: + case 29: + return 3; + default: + return 0; + } +} + +void Gameplay_Scene_Read(PlayState* play, s16 arg1) { + Struct_8010EAA0* sp1C = &scene_data_status[arg1]; + + sp1C->unk_13 = 0; + play->unk_2210 = sp1C; + play->unk_00E0 = arg1; + play->unk_010C = func_80804138_jp(play, sp1C); + sp1C->unk_13 = 0; + gSegments[2] = (uintptr_t)OS_K0_TO_PHYSICAL(play->unk_010C); + Gameplay_Scene_Init(play); + sAdo_RoomType(mPl_SceneNo2SoundRoomType(common_data.unk_00014)); +} diff --git a/src/overlays/gamestates/ovl_play/m_play.h b/src/overlays/gamestates/ovl_play/m_play.h index 4b2545e..b199f0f 100644 --- a/src/overlays/gamestates/ovl_play/m_play.h +++ b/src/overlays/gamestates/ovl_play/m_play.h @@ -1,14 +1,26 @@ #ifndef M_PLAY_H #define M_PLAY_H +#include "m_collision_obj.h" +#include "m_event.h" +#include "6E80C0.h" #include "ultra64.h" #include "game.h" +#include "gfx.h" #include "m_actor.h" #include "m_kankyo.h" -#include "m_lights.h" -#include "z64math.h" +#include "PreRender.h" #include "unknown_structs.h" +#include "sys_matrix.h" #include "unk.h" +#include "m_common_data.h" +#include "m_lib.h" +#include "m_view.h" +#include "m_lights.h" +#include "m_collision_bg.h" +#include "m_pause.h" +#include "6A8180.h" +#include "6E9650.h" struct Actor; struct ActorEntry; @@ -17,6 +29,34 @@ struct PlayState; typedef void (*PlayState_unk_1C58)(struct Actor*); typedef UNK_RET (*PlayState_unk_2208)(struct Actor*, struct PlayState*); +typedef void (*PlayStateUnkFunc_00)(void*); +typedef void (*PlayStateUnkFunc_04)(void*, struct PlayState*); +typedef void (*PlayStateUnkFunc_08)(void*, u8); +typedef void (*PlayStateUnkFunc_0C)(void*, Gfx**); +typedef void (*PlayStateUnkFunc_10)(void*); +typedef void (*PlayStateUnkFunc_14)(void*, s32); +typedef void (*PlayStateUnkFunc_18)(void*, s32); +typedef void (*PlayStateUnkFunc_1C)(void); +typedef s32 (*PlayStateUnkFunc_20)(void*, struct PlayState*); + +typedef struct PlayStateUnkFuncsStruct { + /* 0x00 */ PlayStateUnkFunc_00 unk_00; + /* 0x04 */ PlayStateUnkFunc_04 unk_04; + /* 0x08 */ PlayStateUnkFunc_08 unk_08; + /* 0x0C */ PlayStateUnkFunc_0C unk_0C; + /* 0x10 */ PlayStateUnkFunc_10 unk_10; + /* 0x14 */ PlayStateUnkFunc_14 unk_14; + /* 0x18 */ PlayStateUnkFunc_18 unk_18; + /* 0x1C */ PlayStateUnkFunc_1C unk_1C; + /* 0x20 */ PlayStateUnkFunc_20 unk_20; +} PlayStateUnkFuncsStruct; // size = 0x24 + +typedef struct PlayState_Unk_1EE8 { + /* 0x000 */ char unk000[0x218]; + /* 0x218 */ s32 unk_218; + /* 0x21C */ PlayStateUnkFuncsStruct unk_21C; +} PlayState_Unk_1EE8; // size = 0x240 + typedef struct PlayState { /* 0x0000 */ GameState state; /* 0x00E0 */ s16 unk_00E0; @@ -24,34 +64,56 @@ typedef struct PlayState { /* 0x00E4 */ s8 unk_00E4; /* 0x00E5 */ s8 unk_00E5; /* 0x00E6 */ UNK_TYPE1 unk_00E6[0x2]; - /* 0x00E8 */ UNK_TYPE1 unk_00E8[0x28]; + /* 0x00E8 */ UNK_TYPE1 unk_00E8[0x24]; + /* 0x010C */ void* unk_010C; /* 0x0110 */ PlayState_unk_0110 unk_0110[UNK_SIZE]; /* 0x0164 */ UNK_TYPE1 unk_0164[0x17A8]; /* 0x190C */ s32 unk_190C; - /* 0x1910 */ UNK_TYPE1 unk_1910[0x50]; - /* 0x1960 */ Vec3f unk_1960; - /* 0x196C */ UNK_TYPE1 unk_196C[0x22C]; + /* 0x1910 */ UNK_TYPE1 unk_1910[0x28]; + /* 0x1938 */ PlayState1938 unk_1938; + /* 0x1A60 */ UNK_TYPE1 unk_1A60[0x138]; /* 0x1B98 */ Kankyo kankyo; /* 0x1C60 */ LightContext lightCtx; - /* 0x1C64 */ UNK_TYPE1 unk_1C64[0x14]; + /* 0x1C70 */ Pause pause; /* 0x1C78 */ ActorInfo actorInfo; - /* 0x1CBC */ UNK_TYPE1 unk_1CBC[0x160]; + /* 0x1CBC */ PlayState1CBC unk_1CBC; + /* 0x1DAC */ s8 unk_1DAC; + /* 0x1DAD */ UNK_TYPE1 unk_1DAD[0x3]; + /* 0x1DB0 */ UNK_TYPE1 unk_1DB0[0x10]; + /* 0x1DC0 */ PreRender unk_1DC0; + /* 0x1E10 */ s32 unk_1E10; + /* 0x1E14 */ char unk_1E14[0x4]; + /* 0x1E18 */ s32 unk_1E18; /* 0x1E1C */ MtxF viewProjectionMtxF; /* 0x1E5C */ MtxF billboardMtxF; - /* 0x1E9C */ UNK_TYPE1 unk_1E9C[0x8]; + /* 0x1E9C */ Mtx* unk_1E9C; + /* 0x1EA0 */ s32 unk_1EA0; /* 0x1EA4 */ UNK_TYPE1 unk_1EA4[0x1]; /* 0x1EA5 */ u8 unk_1EA5; /* 0x1EA6 */ u8 unk_1EA6; - /* 0x1EA7 */ UNK_TYPE1 unk_1EA7[0x1]; - /* 0x1EA8 */ UNK_TYPE1 unk_1EA8[0x4]; - /* 0x1EAC */ struct ActorEntry *unk_1EAC; + /* 0x1EA7 */ u8 unk_1EA7; + /* 0x1EA8 */ struct ActorEntry* unk_1EA8; + /* 0x1EAC */ struct ActorEntry* unk_1EAC; /* 0x1EB0 */ s16 *unk_1EB0; - /* 0x1EB4 */ UNK_TYPE1 unk_1EB4[0x354]; + /* 0x1EB4 */ UNK_TYPE1 unk_1EB4[0x4]; + /* 0x1EB8 */ s32 unk_1EB8; + /* 0x1EBC */ PlayState1EBC unk_1EBC; + /* 0x1ECC */ UNK_TYPE1 unk_1ECC[0x14]; + /* 0x1EE0 */ u8 unk_1EE0; + /* 0x1EE1 */ u8 unk_1EE1; + /* 0x1EE2 */ u8 unk_1EE2; + /* 0x1EE3 */ u8 unk_1EE3; + /* 0x1EE4 */ UNK_TYPE1 unk_1EE4[0x4]; + /* 0x1EE8 */ PlayState_Unk_1EE8 unk_1EE8; + /* 0x2128 */ PlayState2128 unk_2128; + /* 0x2138 */ PlayState2138 unk_2138; /* 0x2208 */ PlayState_unk_2208 unk_2208; - /* 0x220C */ UNK_TYPE1 unk_220C[0x204]; + /* 0x220C */ s32 unk_220C; + /* 0x2210 */ Struct_8010EAA0* unk_2210; + /* 0x2214 */ UNK_TYPE1 unk_2214[0x1FC]; } PlayState; // size = 0x2410 -void play_init(GameState *thisx); -void play_cleanup(GameState *thisx); +void play_init(GameState* gameState); +void play_cleanup(GameState* gameState); #endif diff --git a/yamls/jp/boot.yaml b/yamls/jp/boot.yaml index 6cdba29..2225bcf 100644 --- a/yamls/jp/boot.yaml +++ b/yamls/jp/boot.yaml @@ -283,7 +283,7 @@ - [0x019C90, .rodata, ../lib/ultralib/src/libc/xldtob] - [0x019CF0, .rodata, ../lib/ultralib/src/libc/llcvt] - - [0x019D00, rodata, boot/build] + - [0x019D00, rodata, boot/version] - { start: 0x019D40, type: .bss, vram: 0x8003E940, name: boot/boot_main } - { start: 0x019D40, type: .bss, vram: 0x8003F330, name: boot/idle } diff --git a/yamls/jp/overlays.yaml b/yamls/jp/overlays.yaml index 6fc9c6a..ae15eb1 100644 --- a/yamls/jp/overlays.yaml +++ b/yamls/jp/overlays.yaml @@ -43,10 +43,10 @@ compress: True bss_size: 0xF0 subsegments: - - [0x741FB0, asm, overlays/gamestates/ovl_play/m_play] - - [0x7437F0, data, overlays/gamestates/ovl_play/m_play] - - [0x743890, rodata, overlays/gamestates/ovl_play/m_play] - - { start: 0x743950, type: bss, vram: 0x80804480, name: overlays/gamestates/ovl_play/m_play } + - [0x741FB0, c, overlays/gamestates/ovl_play/m_play] + - [0x7437F0, .data, overlays/gamestates/ovl_play/m_play] + - [0x743890, .rodata, overlays/gamestates/ovl_play/m_play] + - { start: 0x743950, type: .bss, vram: 0x80804480, name: overlays/gamestates/ovl_play/m_play } - name: ovl_play_reloc type: code start: 0x743950 |
