From 9ab8cbfd497960caa495929677a839df8784bb52 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 18 Sep 2022 11:54:43 +0200 Subject: [PATCH] Fix country detection for in-region titles --- src/main.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 6df2417..0bac1e7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -180,12 +180,28 @@ void bootStuff() { int ucRes = real_UCReadSysConfig(ucHandle, 1, &sysConfig); if (ucRes >= 0) { - DEBUG_FUNCTION_LINE("Force default language to system title for own region"); + DEBUG_FUNCTION_LINE("Force default language to system language for own region"); gCurrentLanguage = static_cast(*(uint32_t *) sysConfig.data); gDefaultLanguage = static_cast(*(uint32_t *) sysConfig.data); } else { DEBUG_FUNCTION_LINE_ERR("UCReadSysConfig failed"); } + + memset((void *) &sysConfig, 0, sizeof(sysConfig)); + data = 0xFFFFFFFF; + sysConfig.dataType = UC_DATATYPE_UNSIGNED_INT; + sysConfig.dataSize = 4; + sysConfig.data = &data; + strncpy(sysConfig.name, "cafe.cntry_reg", 64); + ucRes = real_UCReadSysConfig(ucHandle, 1, &sysConfig); + + if (ucRes >= 0) { + DEBUG_FUNCTION_LINE("Force default country to system country for own region"); + gCurrentCountry = (int32_t) * (uint32_t *) sysConfig.data; + gDefaultCountry = (int32_t) * (uint32_t *) sysConfig.data; + } else { + DEBUG_FUNCTION_LINE_ERR("UCReadSysConfig failed"); + } UCClose(ucHandle); } else { DEBUG_FUNCTION_LINE_ERR("UCOpen failed");