summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2023-10-03 13:49:14 -0300
committerGitHub <noreply@github.com>2023-10-03 09:49:14 -0700
commit87081138ac2bada878f5139fcd747f08196d6b3f (patch)
tree7522d2ee47f7cb7820503725a4399dcec42501e9 /src
parente6e8999c34c5459cff4162a6b3be8d3537a480ce (diff)
`ovl_first_game` OK (#108)
* c file * match 3 funcs * update * rename sys_romcheck * sys_romcheck NON_MATCHING * match sys_romcheck * notes * fix * review
Diffstat (limited to 'src')
-rw-r--r--src/overlays/gamestates/ovl_first_game/first_game.c27
-rw-r--r--src/overlays/gamestates/ovl_first_game/sys_romcheck.c22
2 files changed, 49 insertions, 0 deletions
diff --git a/src/overlays/gamestates/ovl_first_game/first_game.c b/src/overlays/gamestates/ovl_first_game/first_game.c
new file mode 100644
index 0000000..cf01443
--- /dev/null
+++ b/src/overlays/gamestates/ovl_first_game/first_game.c
@@ -0,0 +1,27 @@
+#include "first_game.h"
+#include "m_common_data.h"
+#include "67E840.h"
+#include "attributes.h"
+#include "overlays/gamestates/ovl_second_game/second_game.h"
+
+void exit_game(Game_FirstGame* this);
+void sys_romcheck(void);
+
+void exit_game(Game_FirstGame* this) {
+ sys_romcheck();
+ mBGM_ct();
+ common_data_init();
+
+ STOP_GAMESTATE(&this->state);
+ SET_NEXT_GAMESTATE(&this->state, second_game_init, sizeof(Game_SecondGame));
+}
+
+void first_game_cleanup(Game* thisx UNUSED) {
+}
+
+void first_game_init(Game* thisx) {
+ Game_FirstGame* this = (Game_FirstGame*)thisx;
+
+ thisx->destroy = first_game_cleanup;
+ exit_game(this);
+}
diff --git a/src/overlays/gamestates/ovl_first_game/sys_romcheck.c b/src/overlays/gamestates/ovl_first_game/sys_romcheck.c
new file mode 100644
index 0000000..684bf9c
--- /dev/null
+++ b/src/overlays/gamestates/ovl_first_game/sys_romcheck.c
@@ -0,0 +1,22 @@
+#include "first_game.h"
+#include "carthandle.h"
+#include "m_nmi_buf.h"
+#include "attributes.h"
+
+#define DEBUG_ROM_VERSION 0x23
+
+void sys_romcheck(void) {
+ u32 sp24;
+ u8 version;
+ UNUSED s32 pad;
+
+ // Read the last 4 bytes from the ROM header
+ osEPiReadIo(carthandle, 0x3C, &sp24);
+
+ version = sp24;
+ sp24 = DEBUG_ROM_VERSION;
+ // Check if the version byte is equal to DEBUG_ROM_VERSION
+ if (version == sp24) {
+ APPNMI_ZURUMODE2_SET();
+ }
+}