[Game Interactor] Add LoadGame and ExitGame hooks (#2542)

* add loadgame/exitgame GI hooks

* implement loadgame/exitgame hooks in game code

* move entrance tracker data lifecycle to hooks

* update cosmetic editor to update onloadgame hook
This commit is contained in:
Adam Bird 2023-02-26 23:04:57 -05:00 committed by GitHub
parent 17aeec4b13
commit f7bb807940
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 47 additions and 21 deletions

View file

@ -7,6 +7,7 @@
#include <ImGuiImpl.h>
#include "soh/frame_interpolation.h"
#include "soh/Enhancements/debugconsole.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/randomizer/randomizer_entrance.h"
#include <overlays/actors/ovl_En_Niw/z_en_niw.h>
@ -427,10 +428,12 @@ void Play_Init(GameState* thisx) {
}
}
// Invalid entrance, so immediately exit the game to opening title
if (gSaveContext.entranceIndex == -1) {
gSaveContext.entranceIndex = 0;
play->state.running = false;
SET_NEXT_GAMESTATE(&play->state, Opening_Init, OpeningContext);
GameInteractor_ExecuteOnExitGame(gSaveContext.fileNum);
return;
}