From 89974e786d92a83058b073e214506b19107eccf8 Mon Sep 17 00:00:00 2001 From: fgsfds Date: Tue, 23 Jun 2020 04:10:38 +0300 Subject: [PATCH] eu: check if language value is correct --- src/game/save_file.c | 3 +++ src/game/save_file.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/game/save_file.c b/src/game/save_file.c index ad700a18..fea9b514 100644 --- a/src/game/save_file.c +++ b/src/game/save_file.c @@ -702,6 +702,9 @@ void eu_set_language(u16 language) { } u16 eu_get_language(void) { + // check if the language is in range, in case we loaded a US save with garbage padding or something + if (gSaveBuffer.menuData[0].language >= LANGUAGE_MAX) + eu_set_language(LANGUAGE_ENGLISH); // reset it to english if not return gSaveBuffer.menuData[0].language; } #endif diff --git a/src/game/save_file.h b/src/game/save_file.h index 3ee5a19a..c292a156 100644 --- a/src/game/save_file.h +++ b/src/game/save_file.h @@ -153,7 +153,8 @@ s32 check_warp_checkpoint(struct WarpNode *warpNode); enum EuLanguages { LANGUAGE_ENGLISH, LANGUAGE_FRENCH, - LANGUAGE_GERMAN + LANGUAGE_GERMAN, + LANGUAGE_MAX }; void eu_set_language(u16 language);