diff --git a/soh/soh/Enhancements/audio/AudioEditor.cpp b/soh/soh/Enhancements/audio/AudioEditor.cpp index ad549e60c..f7aaa7fc3 100644 --- a/soh/soh/Enhancements/audio/AudioEditor.cpp +++ b/soh/soh/Enhancements/audio/AudioEditor.cpp @@ -459,8 +459,8 @@ void AudioEditorRegisterOnSceneInitHook() { }); } -void AudioEditorRegisterOnRandomizerGenerationHook() { - GameInteractor::Instance->RegisterGameHook([]() { +void AudioEditorRegisterOnGenerationCompletionHook() { + GameInteractor::Instance->RegisterGameHook([]() { if (CVarGetInteger(CVAR_AUDIO("RandomizeAllOnRandoGen"), 0)) { AudioEditor_RandomizeAll(); } @@ -469,7 +469,7 @@ void AudioEditorRegisterOnRandomizerGenerationHook() { void AudioEditor::InitElement() { AudioEditorRegisterOnSceneInitHook(); - AudioEditorRegisterOnRandomizerGenerationHook(); + AudioEditorRegisterOnGenerationCompletionHook(); } void AudioEditor::DrawElement() { diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index 8894b3327..8eb09d07b 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -2585,8 +2585,8 @@ void Cosmetics_RegisterOnSceneInitHook() { }); } -void CosmeticsEditorRegisterOnRandomizerGenerationHook() { - GameInteractor::Instance->RegisterGameHook([]() { +void CosmeticsEditorRegisterOnGenerationCompletionHook() { + GameInteractor::Instance->RegisterGameHook([]() { if (CVarGetInteger(CVAR_COSMETIC("RandomizeAllOnRandoGen"), 0)) { CosmeticsEditor_RandomizeAll(); } @@ -2612,7 +2612,7 @@ void CosmeticsEditorWindow::InitElement() { RegisterOnLoadGameHook(); RegisterOnGameFrameUpdateHook(); Cosmetics_RegisterOnSceneInitHook(); - CosmeticsEditorRegisterOnRandomizerGenerationHook(); + CosmeticsEditorRegisterOnGenerationCompletionHook(); } void CosmeticsEditor_RandomizeAll() { diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h b/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h index 0f0d1c8be..9e1ffe3df 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h @@ -62,7 +62,7 @@ DEFINE_HOOK(OnUpdateFileLanguageSelection, (uint8_t optionIndex)); DEFINE_HOOK(OnUpdateFileQuestSelection, (uint8_t questIndex)); DEFINE_HOOK(OnUpdateFileBossRushOptionSelection, (uint8_t optionIndex, uint8_t optionValue)); DEFINE_HOOK(OnUpdateFileNameSelection, (int16_t charCode)); -DEFINE_HOOK(OnRandomizerGeneration, ()); +DEFINE_HOOK(OnGenerationCompletion, ()); DEFINE_HOOK(OnSetGameLanguage, ()); DEFINE_HOOK(OnFileDropped, (std::string filePath)); diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp index b1446e58b..5bf861785 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp @@ -274,8 +274,8 @@ void GameInteractor_ExecuteOnUpdateFileNameSelection(int16_t charCode) { GameInteractor::Instance->ExecuteHooks(charCode); } -void GameInteractor_ExecuteOnRandomizerGeneration() { - GameInteractor::Instance->ExecuteHooks(); +void GameInteractor_ExecuteOnGenerationCompletion() { + GameInteractor::Instance->ExecuteHooks(); } // MARK: - Game diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h index 3d05f509f..7f60f9415 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h @@ -69,7 +69,7 @@ void GameInteractor_ExecuteOnUpdateFileLanguageSelection(uint8_t optionIndex); void GameInteractor_ExecuteOnUpdateFileQuestSelection(uint8_t questIndex); void GameInteractor_ExecuteOnUpdateFileBossRushOptionSelection(uint8_t optionIndex, uint8_t optionValue); void GameInteractor_ExecuteOnUpdateFileNameSelection(int16_t charCode); -void GameInteractor_ExecuteOnRandomizerGeneration(); +void GameInteractor_ExecuteOnGenerationCompletion(); // MARK: - Game void GameInteractor_ExecuteOnSetGameLanguage(); diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 3616aad4f..c0f897669 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3602,6 +3602,8 @@ void GenerateRandomizerImgui(std::string seed = "") { Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); generated = 1; + + GameInteractor_ExecuteOnGenerationCompletion(); } bool GenerateRandomizer(std::string seed /*= ""*/) { @@ -3612,8 +3614,6 @@ bool GenerateRandomizer(std::string seed /*= ""*/) { if (CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) == 0) { randoThread = std::thread(&GenerateRandomizerImgui, seed); - GameInteractor_ExecuteOnRandomizerGeneration(); - return true; } return false;