mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-04-28 13:17:58 +03:00
a11y: tts integration with randomizer start menu
This commit is contained in:
parent
52a3058926
commit
d88a7a8271
5 changed files with 19 additions and 0 deletions
|
@ -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, ());
|
||||
|
|
|
@ -276,6 +276,10 @@ void GameInteractor_ExecuteOnUpdateFileBossRushOptionSelection(uint8_t optionInd
|
|||
optionValue);
|
||||
}
|
||||
|
||||
void GameInteractor_ExecuteOnUpdateFileRandomizerOptionSelection(uint8_t optionIndex) {
|
||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnUpdateFileRandomizerOptionSelection>(optionIndex);
|
||||
}
|
||||
|
||||
void GameInteractor_ExecuteOnUpdateFileNameSelection(int16_t charCode) {
|
||||
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnUpdateFileNameSelection>(charCode);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<GameInteractor::OnUpdateFileRandomizerOptionSelection>(
|
||||
[](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<GameInteractor::OnUpdateFileNameSelection>([](int16_t charCode) {
|
||||
if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0))
|
||||
return;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue