diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h b/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h index 2c94d27a4..51a6ab5a8 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h @@ -65,6 +65,7 @@ DEFINE_HOOK(OnUpdateFileTargetSelection, (uint8_t optionIndex)); DEFINE_HOOK(OnUpdateFileLanguageSelection, (uint8_t optionIndex)); DEFINE_HOOK(OnUpdateFileQuestSelection, (uint8_t questIndex)); DEFINE_HOOK(OnUpdateFileBossRushOptionSelection, (uint8_t optionIndex, uint8_t optionValue)); +DEFINE_HOOK(OnUpdateFileRandomizerOptionSelection, (uint8_t optionIndex)); DEFINE_HOOK(OnUpdateFileNameSelection, (int16_t charCode)); DEFINE_HOOK(OnFileChooseMain, (void* gameState)); diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp index 21f1a9c09..f69cc29af 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp @@ -294,6 +294,10 @@ void GameInteractor_ExecuteOnUpdateFileBossRushOptionSelection(uint8_t optionInd optionValue); } +void GameInteractor_ExecuteOnUpdateFileRandomizerOptionSelection(uint8_t optionIndex) { + GameInteractor::Instance->ExecuteHooks(optionIndex); +} + void GameInteractor_ExecuteOnUpdateFileNameSelection(int16_t charCode) { GameInteractor::Instance->ExecuteHooks(charCode); } diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h index b32dada61..a6f1563f2 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h @@ -72,6 +72,7 @@ void GameInteractor_ExecuteOnUpdateFileTargetSelection(uint8_t optionIndex); void GameInteractor_ExecuteOnUpdateFileLanguageSelection(uint8_t optionIndex); void GameInteractor_ExecuteOnUpdateFileQuestSelection(uint8_t questIndex); void GameInteractor_ExecuteOnUpdateFileBossRushOptionSelection(uint8_t optionIndex, uint8_t optionValue); +void GameInteractor_ExecuteOnUpdateFileRandomizerOptionSelection(uint8_t optionIndex); void GameInteractor_ExecuteOnUpdateFileNameSelection(int16_t charCode); void GameInteractor_ExecuteOnFileChooseMain(void* gameState); diff --git a/soh/soh/Enhancements/tts/tts.cpp b/soh/soh/Enhancements/tts/tts.cpp index 978e5ca24..13dd9f183 100644 --- a/soh/soh/Enhancements/tts/tts.cpp +++ b/soh/soh/Enhancements/tts/tts.cpp @@ -12,6 +12,7 @@ #include "message_data_static.h" #include "overlays/gamestates/ovl_file_choose/file_choose.h" #include "soh/Enhancements/boss-rush/BossRush.h" +#include "soh/Enhancements/FileSelectEnhancements.h" #include "soh/resource/type/SohResourceType.h" extern "C" { @@ -839,6 +840,16 @@ void RegisterOnUpdateMainMenuSelection() { SpeechSynthesizer::Instance->Speak(translation.c_str(), GetLanguageCode()); }); + GameInteractor::Instance->RegisterGameHook( + [](uint8_t optionIndex) { + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) + return; + uint8_t language = (gSaveContext.language == LANGUAGE_JPN) ? LANGUAGE_ENG : gSaveContext.language; + + auto optionName = SohFileSelect_GetSettingText(optionIndex, language); + SpeechSynthesizer::Instance->Speak(optionName, GetLanguageCode()); + }); + GameInteractor::Instance->RegisterGameHook([](int16_t charCode) { if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; 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 736616fc9..a212085ae 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 @@ -1540,6 +1540,8 @@ void FileChoose_UpdateRandomizerMenu(GameState* thisx) { } } + GameInteractor_ExecuteOnUpdateFileRandomizerOptionSelection(this->randomizerIndex); + Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); }