[Feature] talk.c allow Invalid voice files for selected language

(if it exists)

Change-Id: I3aacfc31e3e8a9cac7c9dae0e99c234e43da953a
This commit is contained in:
William Wilgus 2024-06-20 15:19:06 -04:00 committed by William Wilgus
parent b4668e2bd6
commit 8cb8a30f9d

View file

@ -1587,7 +1587,21 @@ void talk_announce_voice_invalid(void)
int buf_handle;
struct queue_entry qe;
const char talkfile[] = LANG_DIR "/InvalidVoice_" DEFAULT_VOICE_LANG ".talk";
char talkfile[MAX_PATH];
const char* const p_lang_def = DEFAULT_VOICE_LANG; /* default */
const char* p_lang = p_lang_def;
/* attempt to load Invalid voice clip in proper lang otherwise use default */
if (global_settings.lang_file[0] && global_settings.lang_file[0] != 0xff)
p_lang = global_settings.lang_file;
while(1)
{
snprintf(talkfile, sizeof(talkfile), LANG_DIR "/InvalidVoice_%s.talk", p_lang);
if (file_exists(talkfile) || p_lang == p_lang_def)
break; /* if it exists or default talk file doesn't exist give up */
p_lang = p_lang_def;
}
if (global_settings.talk_menu && talk_status != TALK_STATUS_OK)
{