diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h b/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h index ecd970b31..62490bbaf 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h @@ -62,6 +62,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(OnSetGameLanguage, ()); diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp index 5e52bed71..8f3a1cf27 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp @@ -276,6 +276,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 b1f9195b4..9d67665f7 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h @@ -69,6 +69,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); // MARK: - Game diff --git a/soh/soh/Enhancements/tts/tts.cpp b/soh/soh/Enhancements/tts/tts.cpp index 77df9983d..bbc75097d 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" { @@ -844,6 +845,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 6dae312ac..53f56526c 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 @@ -1526,6 +1526,8 @@ void FileChoose_UpdateRandomizerMenu(GameState* thisx) { } } + GameInteractor_ExecuteOnUpdateFileRandomizerOptionSelection(this->randomizerIndex); + Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); }