Fix menu prompt directly after launch

This commit is contained in:
Maschell 2022-09-05 23:10:44 +02:00
parent 4b734f7b74
commit aa09753b44
2 changed files with 22 additions and 13 deletions

View File

@ -127,32 +127,35 @@ void bootStuff() {
if (real_product_area_valid && (regionFromXML & real_product_area) == real_product_area) { if (real_product_area_valid && (regionFromXML & real_product_area) == real_product_area) {
gCurrentProductArea = real_product_area; gCurrentProductArea = real_product_area;
} else { } else {
if (OSGetTitleID() == 0x0005001010040000L || acpMetaXml->region == 1) { auto curTitleId = OSGetTitleID();
if (curTitleId == 0x0005001010040000L || curTitleId == 0x0005001001004E000L || acpMetaXml->region == 1) {
DEBUG_FUNCTION_LINE("Set default to JAPAN"); DEBUG_FUNCTION_LINE("Set default to JAPAN");
gDefaultProductArea = MCP_REGION_JAPAN; gDefaultProductArea = MCP_REGION_JAPAN;
gDefaultLanguage = gDefaultLangForJPN; gDefaultLanguage = gDefaultLangForJPN;
gDefaultCountry = gDefaultCountryForJPN; gDefaultCountry = gDefaultCountryForJPN;
} else if (OSGetTitleID() == 0x0005001010040100L || acpMetaXml->region == 2) { } else if (curTitleId == 0x0005001010040100L || curTitleId == 0x0005001001004E100L || acpMetaXml->region == 2) {
DEBUG_FUNCTION_LINE("Set default to USA"); DEBUG_FUNCTION_LINE("Set default to USA");
gDefaultProductArea = MCP_REGION_USA; gDefaultProductArea = MCP_REGION_USA;
gDefaultLanguage = gDefaultLangForUSA; gDefaultLanguage = gDefaultLangForUSA;
gDefaultCountry = gDefaultCountryForUSA; gDefaultCountry = gDefaultCountryForUSA;
} else if (OSGetTitleID() == 0x0005001010040200L || acpMetaXml->region == 4) { } else if (curTitleId == 0x0005001010040200L || curTitleId == 0x0005001001004E200L || acpMetaXml->region == 4) {
DEBUG_FUNCTION_LINE("Set default to EUR"); DEBUG_FUNCTION_LINE("Set default to EUR");
gDefaultProductArea = MCP_REGION_EUROPE; gDefaultProductArea = MCP_REGION_EUROPE;
gDefaultLanguage = gDefaultLangForEUR; gDefaultLanguage = gDefaultLangForEUR;
gDefaultCountry = gDefaultCountryForEUR; gDefaultCountry = gDefaultCountryForEUR;
} else { } else {
DEBUG_FUNCTION_LINE("Unknown area %08X, forcing language will be disabled", acpMetaXml->region); DEBUG_FUNCTION_LINE_ERR("Unknown area %08X, forcing language will be disabled", acpMetaXml->region);
forceConfigMenu = true; forceConfigMenu = true;
} }
} }
} else { } else {
DEBUG_FUNCTION_LINE_ERR("real_ACPGetLaunchMetaXml failed");
forceConfigMenu = true; forceConfigMenu = true;
} }
ACPFinalize(); ACPFinalize();
free(acpMetaXml); free(acpMetaXml);
} else { } else {
DEBUG_FUNCTION_LINE_ERR("failed to allocate acpMetaXml");
forceConfigMenu = true; forceConfigMenu = true;
} }
@ -181,11 +184,11 @@ void bootStuff() {
gCurrentLanguage = static_cast<Lanuages>(*(uint32_t *) sysConfig.data); gCurrentLanguage = static_cast<Lanuages>(*(uint32_t *) sysConfig.data);
gDefaultLanguage = static_cast<Lanuages>(*(uint32_t *) sysConfig.data); gDefaultLanguage = static_cast<Lanuages>(*(uint32_t *) sysConfig.data);
} else { } else {
DEBUG_FUNCTION_LINE("UCReadSysConfig failed"); DEBUG_FUNCTION_LINE_ERR("UCReadSysConfig failed");
} }
UCClose(ucHandle); UCClose(ucHandle);
} else { } else {
DEBUG_FUNCTION_LINE("UCOpen failed"); DEBUG_FUNCTION_LINE_ERR("UCOpen failed");
} }
} }
} }
@ -193,14 +196,14 @@ void bootStuff() {
wups_storage_item_t *root = nullptr; wups_storage_item_t *root = nullptr;
auto resa = WUPS_GetSubItem(nullptr, CAT_GENERAL_ROOT, &root); auto resa = WUPS_GetSubItem(nullptr, CAT_GENERAL_ROOT, &root);
if (resa != WUPS_STORAGE_ERROR_SUCCESS) { if (resa != WUPS_STORAGE_ERROR_SUCCESS) {
DEBUG_FUNCTION_LINE("Failed to read %s subitem", CAT_GENERAL_ROOT); DEBUG_FUNCTION_LINE_ERR("Failed to read %s subitem", CAT_GENERAL_ROOT);
return; return;
} }
wups_storage_item_t *title_settings; wups_storage_item_t *title_settings;
if (WUPS_GetSubItem(root, CAT_TITLE_SETTINGS, &title_settings) != WUPS_STORAGE_ERROR_SUCCESS) { if (WUPS_GetSubItem(root, CAT_TITLE_SETTINGS, &title_settings) != WUPS_STORAGE_ERROR_SUCCESS) {
if (WUPS_CreateSubItem(root, CAT_TITLE_SETTINGS, &title_settings) != WUPS_STORAGE_ERROR_SUCCESS) { if (WUPS_CreateSubItem(root, CAT_TITLE_SETTINGS, &title_settings) != WUPS_STORAGE_ERROR_SUCCESS) {
DEBUG_FUNCTION_LINE("WUPS_CreateSubItem %s failed", CAT_TITLE_SETTINGS); DEBUG_FUNCTION_LINE_ERR("WUPS_CreateSubItem %s failed", CAT_TITLE_SETTINGS);
return; return;
} }
} }
@ -211,7 +214,7 @@ void bootStuff() {
wups_storage_item_t *curTitleItem; wups_storage_item_t *curTitleItem;
if (WUPS_GetSubItem(title_settings, buffer, &curTitleItem) != WUPS_STORAGE_ERROR_SUCCESS) { if (WUPS_GetSubItem(title_settings, buffer, &curTitleItem) != WUPS_STORAGE_ERROR_SUCCESS) {
if (WUPS_CreateSubItem(title_settings, buffer, &curTitleItem) != WUPS_STORAGE_ERROR_SUCCESS) { if (WUPS_CreateSubItem(title_settings, buffer, &curTitleItem) != WUPS_STORAGE_ERROR_SUCCESS) {
DEBUG_FUNCTION_LINE("WUPS_CreateSubItem %s failed", buffer); DEBUG_FUNCTION_LINE_ERR("WUPS_CreateSubItem %s failed", buffer);
return; return;
} }
} }
@ -324,7 +327,6 @@ ON_APPLICATION_START() {
OSGetTitleID() == 0x0005001010040200L) { // Wii U Menu EUR OSGetTitleID() == 0x0005001010040200L) { // Wii U Menu EUR
gForceSettingsEnabled = 0; gForceSettingsEnabled = 0;
} }
DEBUG_FUNCTION_LINE("Start done");
bootStuff(); bootStuff();

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <coreinit/debug.h>
#include <string.h> #include <string.h>
#include <whb/log.h> #include <whb/log.h>
@ -7,11 +8,11 @@
extern "C" { extern "C" {
#endif #endif
#ifdef DEBUG
#define __FILENAME_X__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__) #define __FILENAME_X__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILENAME_X__) #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILENAME_X__)
#ifdef DEBUG
#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) while (0) #define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) while (0)
#define DEBUG_FUNCTION_LINE(FMT, ARGS...) \ #define DEBUG_FUNCTION_LINE(FMT, ARGS...) \
@ -24,6 +25,7 @@ extern "C" {
WHBLogWritef("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \ WHBLogWritef("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
} while (0) } while (0)
#else #else
#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) while (0) #define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) while (0)
@ -34,6 +36,11 @@ extern "C" {
#endif #endif
#define DEBUG_FUNCTION_LINE_ERR(FMT, ARGS...) \
do { \
OSReport("[%23s]%30s@L%04d: ##ERROR## " FMT "\n", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
} while (0)
void initLogging(); void initLogging();
void deinitLogging(); void deinitLogging();