diff --git a/config/rel_slices.yml b/config/rel_slices.yml index adb99012..c4ce9410 100644 --- a/config/rel_slices.yml +++ b/config/rel_slices.yml @@ -18,6 +18,8 @@ m_actor_dlftbls.c: .bss: [0x8125A828, 0x8125A830] m_cockroach.c: .text: [0x80385430, 0x80385A80] +m_common_data.c: + .text: [0x80395B24, 0x80395BE8] m_controller.c: .text: [0x80395BE8, 0x80396120] .rodata: [0x80641D20, 0x80641D50] diff --git a/include/m_clip.h b/include/m_clip.h index 86ecbb71..020a3aaa 100644 --- a/include/m_clip.h +++ b/include/m_clip.h @@ -36,6 +36,8 @@ typedef struct clip_s { /* 0x0E0 */ void* _0E0[(0x104 - 0x0E0) / sizeof(void*)]; } Clip_c; +extern void clip_clear(); + #ifdef __cplusplus } #endif diff --git a/include/m_common_data.h b/include/m_common_data.h index 32d9cb65..f536adb3 100644 --- a/include/m_common_data.h +++ b/include/m_common_data.h @@ -176,7 +176,9 @@ typedef struct common_data_s { /* 0x02852E */ s16 goods_power; /* 0x028530 */ Door_data_c door_data; /* misc door data */ /* 0x028544 */ Door_data_c structure_exit_door_data; /* door data for when exiting a building */ - /* 0x028558 */ u8 tmp1[0x0285C0 - 0x028558]; + /* 0x028558 */ u8 tmp1[0x028592 - 0x028558]; + /* 0x028592 */ mActor_name_t demo_profiles[2]; + /* 0x028596 */ u8 _28596[0x285C0 - 0x28596]; /* 0x0285C0 */ s8 player_decoy_flag; /* 0x0285C1 */ u8 _285C1[0x028838 - 0x0285C1]; /* 0x028838 */ s8 player_bee_swell_flag; @@ -253,8 +255,9 @@ extern common_data_t common_data; /* Useful for returning fg item data as a pointer to mActor_name_t */ #define Save_GetFG() Save_Get(fg[0][0].items[0]) -extern void common_data_init(); extern void common_data_reinit(); +extern void common_data_init(); +extern void common_data_clear(); #ifdef __cplusplus } diff --git a/rel/m_common_data.c b/rel/m_common_data.c new file mode 100644 index 00000000..b80ab4fc --- /dev/null +++ b/rel/m_common_data.c @@ -0,0 +1,29 @@ +#include "m_common_data.h" + +#include "libultra/libultra.h" + + +extern void common_data_reinit(){ + + u8 state; + + state = Common_Get(pad_connected); + + bzero(&common_data, sizeof(common_data)); + Common_Set(wipeType, 255); + Common_Set(game_started,1); + Common_Set(last_scene_no, -1); + Common_Set(demo_profiles[0], 246); + Common_Set(demo_profiles[1], 246); + Common_Set(pad_connected, state); + + mFRm_ClearSaveCheckData(Save_GetPointer(save_check)); +} + +extern void common_data_init(){ + common_data_reinit(); +} + +extern void common_data_clear(){ + clip_clear(); +} \ No newline at end of file