diff options
| author | Philip Dubé <159546+serprex@users.noreply.github.com> | 2026-08-31 14:04:50 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-31 14:04:50 +0000 |
| commit | a7cd6c8113e1f7dddfa70697ed0644837dd2c19d (patch) | |
| tree | 50aa23e2e829f1b401542b6d3945e88becdf8b77 /soh/src/overlays | |
| parent | 2dd51f1288e8d9d1aa55dfec18c24797646132ed (diff) | |
Avoid randomizer generation races with file select (#7136)
Fixes both starting file while generating,
& starting generation in file loading transition
Remove RandoGenerating cvar
Diffstat (limited to 'soh/src/overlays')
| -rw-r--r-- | soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 1795e7db7..190442a17 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -389,11 +389,11 @@ int retries = 0; bool fileSelectSpoilerFileLoaded = false; void FileChoose_UpdateRandomizer() { - if (CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) != 0 && generating == 0) { + if (Randomizer_IsGenerating() && generating == 0) { generating = 1; Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, NA_BGM_HORSE, 0, 7, 1); return; - } else if (CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) == 0 && generating) { + } else if (!Randomizer_IsGenerating() && generating) { if (Randomizer_IsSeedGenerated()) { Audio_PlayFanfare(NA_BGM_HORSE_GOAL); retries = 0; @@ -463,6 +463,9 @@ void FileChoose_UpdateMainMenu(GameState* thisx) { u8 isDefaultNameOptionSet; FileChoose_UpdateRandomizer(); + if (generating) { + return; + } if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_A)) { if (this->buttonIndex <= FS_BTN_MAIN_FILE_3) { @@ -2544,6 +2547,7 @@ void FileChoose_LoadGame(GameState* thisx) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); gSaveContext.fileNum = this->buttonIndex; gSaveContext.gameMode = GAMEMODE_NORMAL; + Randomizer_WaitForGeneration(); if ((this->buttonIndex == FS_BTN_SELECT_FILE_1 && CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0)) || this->buttonIndex == 0xFF) { |
