summaryrefslogtreecommitdiff
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
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
-rw-r--r--include/67E840.h2
-rw-r--r--include/game.h3
-rw-r--r--linker_scripts/jp/symbol_addrs_overlays.txt4
-rw-r--r--src/overlays/gamestates/ovl_first_game/first_game.c27
-rw-r--r--src/overlays/gamestates/ovl_first_game/sys_romcheck.c22
-rw-r--r--yamls/jp/overlays.yaml3
6 files changed, 56 insertions, 5 deletions
diff --git a/include/67E840.h b/include/67E840.h
index bbb05ed..17f4c6e 100644
--- a/include/67E840.h
+++ b/include/67E840.h
@@ -180,7 +180,7 @@ void mBGMPsComp_make_ps_wipe(s32 arg0, struct Game_Play* game_play);
// void func_8005EE20_jp();
// void func_8005EEA0_jp();
void mBGM_main(struct Game* game);
-// void mBGM_ct();
+void mBGM_ct(void);
void func_8005F020_jp(void);
void mBGM_cleanup(void);
// void func_8005F250_jp();
diff --git a/include/game.h b/include/game.h
index faa526a..7627ec0 100644
--- a/include/game.h
+++ b/include/game.h
@@ -2,12 +2,13 @@
#define GAME_H
#include "ultra64.h"
+#include "libc/stdbool.h"
#include "TwoHeadArena.h"
#include "other_types.h"
#include "gamealloc.h"
#include "libu64/pad.h"
-#include "unk.h"
#include "m_controller.h"
+#include "unk.h"
struct Game;
struct GraphicsContext;
diff --git a/linker_scripts/jp/symbol_addrs_overlays.txt b/linker_scripts/jp/symbol_addrs_overlays.txt
index 6f7430b..818d28c 100644
--- a/linker_scripts/jp/symbol_addrs_overlays.txt
+++ b/linker_scripts/jp/symbol_addrs_overlays.txt
@@ -177,10 +177,10 @@ jtbl_80802550_jp = 0x80802550; // type:jtbl
// .text
-func_808029D0_jp = 0x808029D0; // type:func
+exit_game = 0x808029D0; // type:func
first_game_cleanup = 0x80802A20; // type:func
first_game_init = 0x80802A2C; // type:func
-func_80802A60_jp = 0x80802A60; // type:func
+sys_romcheck = 0x80802A60; // type:func
Game_play_Reset_destiny = 0x80802AE0; // type:func
event_title_flag_on = 0x80802B40; // type:func
event_title_flag_off = 0x80802B64; // type:func
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();
+ }
+}
diff --git a/yamls/jp/overlays.yaml b/yamls/jp/overlays.yaml
index 02f0483..f8f2d56 100644
--- a/yamls/jp/overlays.yaml
+++ b/yamls/jp/overlays.yaml
@@ -25,7 +25,8 @@
compress: True
bss_size: 0x0
subsegments:
- - [0x741EA0, asm, overlays/gamestates/ovl_first_game/first_game]
+ - [0x741EA0, c, overlays/gamestates/ovl_first_game/first_game]
+ - [0x741F30, c, overlays/gamestates/ovl_first_game/sys_romcheck]
- name: ovl_first_game_reloc
type: code
start: 0x741F80