fix init event to not be terrible

This commit is contained in:
LittleCube 2024-09-25 21:29:03 -04:00
parent 946fbb1fa2
commit be789d40c9
2 changed files with 4 additions and 8 deletions

View File

@ -4,7 +4,6 @@
extern Input D_801F6C18; extern Input D_801F6C18;
RECOMP_DECLARE_EVENT(recomp_on_init(PlayState* play));
RECOMP_DECLARE_EVENT(recomp_on_play_main(PlayState* play)); RECOMP_DECLARE_EVENT(recomp_on_play_main(PlayState* play));
RECOMP_DECLARE_EVENT(recomp_before_play_update(PlayState* play)); RECOMP_DECLARE_EVENT(recomp_before_play_update(PlayState* play));
RECOMP_DECLARE_EVENT(recomp_after_play_update(PlayState* play)); RECOMP_DECLARE_EVENT(recomp_after_play_update(PlayState* play));
@ -13,18 +12,11 @@ void controls_play_update(PlayState* play) {
gSaveContext.options.zTargetSetting = recomp_get_targeting_mode(); gSaveContext.options.zTargetSetting = recomp_get_targeting_mode();
} }
bool inited = false;
// @recomp Patched to add hooks for various added functionality. // @recomp Patched to add hooks for various added functionality.
RECOMP_PATCH void Play_Main(GameState* thisx) { RECOMP_PATCH void Play_Main(GameState* thisx) {
static Input* prevInput = NULL; static Input* prevInput = NULL;
PlayState* this = (PlayState*)thisx; PlayState* this = (PlayState*)thisx;
if (!inited) {
recomp_on_init(this);
inited = true;
}
recomp_on_play_main(this); recomp_on_play_main(this);
// @recomp // @recomp

View File

@ -7,6 +7,8 @@ void Main_InitMemory(void);
void Main_InitScreen(void); void Main_InitScreen(void);
RECOMP_DECLARE_EVENT(recomp_on_init());
// @recomp Patched to load the code segment in the recomp runtime. // @recomp Patched to load the code segment in the recomp runtime.
RECOMP_PATCH void Main_Init(void) { RECOMP_PATCH void Main_Init(void) {
DmaRequest dmaReq; DmaRequest dmaReq;
@ -14,6 +16,8 @@ RECOMP_PATCH void Main_Init(void) {
OSMesg msg[1]; OSMesg msg[1];
size_t prevSize; size_t prevSize;
recomp_on_init();
osCreateMesgQueue(&mq, msg, ARRAY_COUNT(msg)); osCreateMesgQueue(&mq, msg, ARRAY_COUNT(msg));
prevSize = gDmaMgrDmaBuffSize; prevSize = gDmaMgrDmaBuffSize;