Add variable to track if we're in the title sequence.

This commit is contained in:
LT-Schmiddy 2024-11-30 16:29:59 -05:00
parent cdaae070d5
commit b2b13c5d77
3 changed files with 52 additions and 1 deletions

View File

@ -69,11 +69,16 @@ RECOMP_PATCH void FileSelect_RotateToOptions(GameState* thisx) {
recomp_exit(); recomp_exit();
} }
extern int recomp_in_title_sequence;
RECOMP_PATCH void FileSelect_Init(GameState* thisx) { RECOMP_PATCH void FileSelect_Init(GameState* thisx) {
s32 pad; s32 pad;
FileSelectState* this = (FileSelectState*)thisx; FileSelectState* this = (FileSelectState*)thisx;
size_t size; size_t size;
recomp_in_title_sequence = false;
recomp_printf("FileSelect_Init\n");
GameState_SetFramerateDivisor(&this->state, 1); GameState_SetFramerateDivisor(&this->state, 1);
Matrix_Init(&this->state); Matrix_Init(&this->state);
ShrinkWindow_Init(); ShrinkWindow_Init();

View File

@ -164,11 +164,13 @@ extern u8 D_80784600[];
// Non-relocatable references to the original addresses of these game state functions. // Non-relocatable references to the original addresses of these game state functions.
void DayTelop_Init_NORELOCATE(GameState*); void DayTelop_Init_NORELOCATE(GameState*);
void TitleSetup_Init_NORELOCATE(GameState*); void TitleSetup_Init_NORELOCATE(GameState*);
void TitleSetup_Init(GameState*);
RECOMP_DECLARE_EVENT(recomp_on_play_init(PlayState* this)); RECOMP_DECLARE_EVENT(recomp_on_play_init(PlayState* this));
RECOMP_DECLARE_EVENT(recomp_after_play_init(PlayState* this)); RECOMP_DECLARE_EVENT(recomp_after_play_init(PlayState* this));
bool allow_no_ocarina_tf = false; bool allow_no_ocarina_tf = false;
bool recomp_in_title_sequence = false;
// @recomp_export void recomp_set_allow_no_ocarina_tf(bool new_val): Set whether to force Termina Field to load normally even if Link has no ocarina. // @recomp_export void recomp_set_allow_no_ocarina_tf(bool new_val): Set whether to force Termina Field to load normally even if Link has no ocarina.
RECOMP_EXPORT void recomp_set_allow_no_ocarina_tf(bool new_val) { RECOMP_EXPORT void recomp_set_allow_no_ocarina_tf(bool new_val) {
@ -189,7 +191,10 @@ RECOMP_PATCH void Play_Init(GameState* thisx) {
// @recomp_event recomp_on_play_init(PlayState* this): A new PlayState is being initialized. // @recomp_event recomp_on_play_init(PlayState* this): A new PlayState is being initialized.
recomp_on_play_init(this); recomp_on_play_init(this);
if (!recomp_in_title_sequence) {
recomp_set_reset_button_visibility(1); recomp_set_reset_button_visibility(1);
}
if ((gSaveContext.respawnFlag == -4) || (gSaveContext.respawnFlag == -0x63)) { if ((gSaveContext.respawnFlag == -4) || (gSaveContext.respawnFlag == -0x63)) {

41
patches/title_patches.c Normal file
View File

@ -0,0 +1,41 @@
#include "patches.h"
#include "patch_helpers.h"
#include "global.h"
#include "z64save.h"
#include "z64shrink_window.h"
#include "z64view.h"
#include "regs.h"
DECLARE_FUNC(void, recomp_set_reset_button_visibility, u8 visibility);
typedef struct {
/* 0x000 */ GameState state;
/* 0x0A8 */ View view;
} TitleSetupState; // size = 0x210
extern int recomp_in_title_sequence;
void TitleSetup_Init(GameState* thisx);
void TitleSetup_Main(GameState* thisx);
void TitleSetup_Destroy(GameState* thisx);
RECOMP_PATCH void TitleSetup_Init(GameState* thisx) {
TitleSetupState* this = (TitleSetupState*)thisx;
GameState_SetFramerateDivisor(&this->state, 1);
Matrix_Init(&this->state);
ShrinkWindow_Init();
View_Init(&this->view, this->state.gfxCtx);
this->state.main = TitleSetup_Main;
this->state.destroy = TitleSetup_Destroy;
gSaveContext.respawnFlag = 0;
gSaveContext.respawn[RESPAWN_MODE_GORON].entrance = 0xFF;
gSaveContext.respawn[RESPAWN_MODE_ZORA].entrance = 0xFF;
gSaveContext.respawn[RESPAWN_MODE_DEKU].entrance = 0xFF;
gSaveContext.respawn[RESPAWN_MODE_HUMAN].entrance = 0xFF;
recomp_in_title_sequence = true;
recomp_printf("TitleSetup_Init\n");
}