diff --git a/config/rel_slices.yml b/config/rel_slices.yml index be3ac3d3..bb60a7a1 100644 --- a/config/rel_slices.yml +++ b/config/rel_slices.yml @@ -127,6 +127,10 @@ m_random_field/mRF_MakePerfectBit.c: .text: [0x8050B1AC, 0x8050B1D4] m_random_field/mRF_GetRandomStepMode.c: .text: [0x8050B284, 0x8050B2C0] +first_game.c: + .text: [0x80629CA8, 0x80629D4C] +sys_romcheck.c: + .text: [0x80629D4C, 0x80629D8C] second_game.c: .text: [0x8062B630, 0x8062B848] .bss: [0x8148DA60, 0x8148DA68] diff --git a/include/Famicom/famicom.h b/include/Famicom/famicom.h new file mode 100644 index 00000000..c0795e2a --- /dev/null +++ b/include/Famicom/famicom.h @@ -0,0 +1,18 @@ +#ifndef FAMICOM_H +#define FAMICOM_H + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef u8 (*FAMICOM_GETSAVECHAN_PROC)(int* player_no, int* slot_card_result); + +extern void famicom_setCallback_getSaveChan(FAMICOM_GETSAVECHAN_PROC getSaveChan_proc); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/first_game.h b/include/first_game.h index 014968a1..67822f7d 100644 --- a/include/first_game.h +++ b/include/first_game.h @@ -13,8 +13,8 @@ typedef struct game_first_s { /* 0x00 */ GAME game; } GAME_FIRST; -extern void first_game_cleanup(GAME_FIRST* first_game); -extern void first_game_init(GAME_FIRST* first_game); +extern void first_game_cleanup(GAME* game); +extern void first_game_init(GAME* game); #ifdef __cplusplus } diff --git a/include/m_bgm.h b/include/m_bgm.h index 392f40d1..3c783e86 100644 --- a/include/m_bgm.h +++ b/include/m_bgm.h @@ -7,6 +7,7 @@ extern "C" { #endif +extern void mBGM_ct(); extern void mBGM_reset(); extern void mBGMPsComp_make_ps_lost_fanfare(u8 bgm_no, u16 unk); extern void mBGMPsComp_scene_mode(int scene_mode); diff --git a/include/m_card.h b/include/m_card.h index 44c393cf..738fb6b8 100644 --- a/include/m_card.h +++ b/include/m_card.h @@ -8,6 +8,9 @@ extern "C" { #endif +extern u8 mCD_GetThisLandSlotNo_code(int* player_no, int* slot_card_results); +extern void mCD_save_data_aram_malloc(); + extern void mCD_PrintErrInfo(gfxprint_t* gfxprint); extern void mCD_InitAll(); diff --git a/include/m_common_data.h b/include/m_common_data.h index 329c4752..6d7b3b43 100644 --- a/include/m_common_data.h +++ b/include/m_common_data.h @@ -216,6 +216,7 @@ extern common_data_t common_data; #define Save_GetPointer(name) (Common_GetPointer(save.save.name)) #define Save_Set(name, value) (Common_Set(save.save.name, value)) +extern void common_data_init(); extern void common_data_reinit(); #ifdef __cplusplus diff --git a/include/m_vibctl.h b/include/m_vibctl.h index 73625700..874bf34f 100644 --- a/include/m_vibctl.h +++ b/include/m_vibctl.h @@ -7,6 +7,7 @@ extern "C" { #endif +extern void mVibctl_ct(); extern void mVibctl_reset(); extern void mVibctl_init0(); diff --git a/include/sys_romcheck.h b/include/sys_romcheck.h new file mode 100644 index 00000000..cdc5be4d --- /dev/null +++ b/include/sys_romcheck.h @@ -0,0 +1,18 @@ +#ifndef SYS_ROMCHECK_H +#define SYS_ROMCHECK_H + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define SYS_ROMCHECK_DEBUG_ROM_VERSION 0x90 + +extern void sys_romcheck(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/rel/first_game.c b/rel/first_game.c new file mode 100644 index 00000000..0f45e49a --- /dev/null +++ b/rel/first_game.c @@ -0,0 +1,26 @@ +#include "first_game.h" + +#include "sys_romcheck.h" +#include "m_vibctl.h" +#include "m_bgm.h" +#include "m_card.h" +#include "m_common_data.h" +#include "second_game.h" +#include "Famicom/famicom.h" + +static void exit_game(GAME* game) { + famicom_setCallback_getSaveChan(&mCD_GetThisLandSlotNo_code); + mBGM_ct(); + mVibctl_ct(); + common_data_init(); + GAME_GOTO_NEXT(game, second_game, SECOND); +} + +extern void first_game_cleanup(GAME* game) { } + +extern void first_game_init(GAME* game) { + game->cleanup = &first_game_cleanup; + sys_romcheck(); + mCD_save_data_aram_malloc(); + exit_game(game); +} diff --git a/rel/sys_romcheck.c b/rel/sys_romcheck.c new file mode 100644 index 00000000..67642335 --- /dev/null +++ b/rel/sys_romcheck.c @@ -0,0 +1,10 @@ +#include "sys_romcheck.h" + +#include "dolphin/dvd.h" +#include "m_nmibuf.h" + +extern void sys_romcheck() { + if (DVDGetCurrentDiskID()->gameVersion >= SYS_ROMCHECK_DEBUG_ROM_VERSION) { + APPNMI_ZURUMODE2_SET(); + } +}