Avoid randomizer generation races with file select (#7136)

Fixes both starting file while generating,
& starting generation in file loading transition

Remove RandoGenerating cvar
This commit is contained in:
Philip Dubé
2026-08-31 14:04:50 +00:00
committed by GitHub
parent 2dd51f1288
commit a7cd6c8113
9 changed files with 40 additions and 30 deletions
@@ -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) {