-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
638 additions
and
566 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#include "utils/SettingsUtils.h" | ||
#include "utils/logger.h" | ||
#include <coreinit/debug.h> | ||
#include <coreinit/userconfig.h> | ||
#include <nn/acp/title.h> | ||
#include <string_view> | ||
#include <sysapp/switch.h> | ||
#include <sysapp/title.h> | ||
#include <wups/function_patching.h> | ||
|
||
DECL_FUNCTION(int32_t, ACPGetTitleMetaXmlByDevice, uint64_t titleid, ACPMetaXml *metaxml, uint32_t device) { | ||
int result = real_ACPGetTitleMetaXmlByDevice(titleid, metaxml, device); | ||
if (metaxml != nullptr) { | ||
metaxml->region = 0xFFFFFFFF; | ||
} | ||
return result; | ||
} | ||
|
||
DECL_FUNCTION(int32_t, ACPGetLaunchMetaXml, ACPMetaXml *metaxml) { | ||
int result = real_ACPGetLaunchMetaXml(metaxml); | ||
if (metaxml != nullptr) { | ||
metaxml->region = 0xFFFFFFFF; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
DECL_FUNCTION(int, UCReadSysConfig, int IOHandle, int count, UCSysConfig *settings) { | ||
int result = real_UCReadSysConfig(IOHandle, count, settings); | ||
auto upid = OSGetUPID(); | ||
|
||
if (!gRegionFreeValuesSetupDone || result != 0 || (upid != SYSAPP_PFID_WII_U_MENU && upid != SYSAPP_PFID_DOWNLOAD_GAME && upid != SYSAPP_PFID_EMANUAL)) { | ||
return result; | ||
} | ||
|
||
if (std::string_view("cafe.language") == settings->name) { | ||
DEBUG_FUNCTION_LINE_VERBOSE("UCReadSysConfig: cafe.language found!"); | ||
DEBUG_FUNCTION_LINE_VERBOSE("UCReadSysConfig: forcing language..."); | ||
DEBUG_FUNCTION_LINE("UCReadSysConfig: original lang %d, new %d", *((int *) settings->data), gCurrentLanguage); | ||
*((int *) settings->data) = gCurrentLanguage; | ||
} else if (std::string_view("cafe.cntry_reg") == settings->name) { | ||
DEBUG_FUNCTION_LINE_VERBOSE("UCReadSysConfig: cafe.cntry_reg found!"); | ||
DEBUG_FUNCTION_LINE_VERBOSE("UCReadSysConfig: forcing cntry_reg..."); | ||
DEBUG_FUNCTION_LINE("UCReadSysConfig: original cntry_reg %d, new %d", *((int *) settings->data), gCurrentCountry); | ||
*((int *) settings->data) = gCurrentCountry; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
DECL_FUNCTION(int, MCP_GetSysProdSettings, int IOHandle, MCPSysProdSettings *settings) { | ||
int result = real_MCP_GetSysProdSettings(IOHandle, settings); | ||
auto upid = OSGetUPID(); | ||
if (!gRegionFreeValuesSetupDone || result != 0 || (upid != SYSAPP_PFID_WII_U_MENU && upid != SYSAPP_PFID_DOWNLOAD_GAME && upid != SYSAPP_PFID_EMANUAL)) { | ||
return result; | ||
} | ||
|
||
DEBUG_FUNCTION_LINE_VERBOSE("MCP_GetSysProdSettings: forcing platform region..."); | ||
DEBUG_FUNCTION_LINE("MCP_GetSysProdSettings: original region %d, new %d...", settings->product_area, gCurrentProductArea); | ||
settings->product_area = gCurrentProductArea; | ||
|
||
return result; | ||
} | ||
|
||
WUPS_MUST_REPLACE(ACPGetTitleMetaXmlByDevice, WUPS_LOADER_LIBRARY_NN_ACP, ACPGetTitleMetaXmlByDevice); | ||
WUPS_MUST_REPLACE(ACPGetLaunchMetaXml, WUPS_LOADER_LIBRARY_NN_ACP, ACPGetLaunchMetaXml); | ||
WUPS_MUST_REPLACE_FOR_PROCESS(MCP_GetSysProdSettings, WUPS_LOADER_LIBRARY_COREINIT, MCP_GetSysProdSettings, WUPS_FP_TARGET_PROCESS_ALL); | ||
WUPS_MUST_REPLACE_FOR_PROCESS(UCReadSysConfig, WUPS_LOADER_LIBRARY_COREINIT, UCReadSysConfig, WUPS_FP_TARGET_PROCESS_ALL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
|
||
#include <coreinit/mcp.h> | ||
#include <coreinit/userconfig.h> | ||
|
||
extern "C" int (*real_UCReadSysConfig)(int IOHandle, int count, UCSysConfig *settings) __attribute__((section(".data"))); | ||
extern "C" int (*real_MCP_GetSysProdSettings)(int IOHandle, MCPSysProdSettings *settings) __attribute__((section(".data"))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
#include "globals.h" | ||
|
||
std::optional<MCPRegion> gRealRegionOpt = {}; | ||
std::optional<int32_t> gRealCountryOpt = {}; | ||
std::optional<Languages> gRealLanguageOpt = {}; | ||
|
||
bool gRegionFreeValuesSetupDone = false; | ||
|
||
bool gPreferSystemSettings = DEFAULT_PREFER_SYSTEM_SETTINGS; | ||
bool gSkipOwnRegion = DEFAULT_SKIP_OWN_REGION; | ||
bool gAutoDetection = DEFAULT_AUTO_DETECTION_VALUE; | ||
|
||
int gForceSettingsEnabled = 0; | ||
Lanuages gDefaultLanguage = LANG_ENGLISH; | ||
int32_t gDefaultCountry = 78; | ||
MCPRegion gDefaultProductArea = MCP_REGION_EUROPE; | ||
|
||
Lanuages gCurrentLanguage = gDefaultLanguage; | ||
int32_t gCurrentCountry = gDefaultCountry; | ||
MCPRegion gCurrentProductArea = gDefaultProductArea; | ||
Languages gCurrentLanguage = LANG_ENGLISH; | ||
int32_t gCurrentCountry = 0; | ||
MCPRegion gCurrentProductArea = MCP_REGION_USA; | ||
|
||
Lanuages gDefaultLangForEUR = DEFAULT_LANG_FOR_EUR; | ||
Languages gDefaultLangForEUR = DEFAULT_LANG_FOR_EUR; | ||
int32_t gDefaultCountryForEUR = DEFAULT_COUNTRY_FOR_EUR; | ||
Lanuages gDefaultLangForUSA = DEFAULT_LANG_FOR_USA; | ||
Languages gDefaultLangForUSA = DEFAULT_LANG_FOR_USA; | ||
int32_t gDefaultCountryForUSA = DEFAULT_COUNTRY_FOR_USA; | ||
Lanuages gDefaultLangForJPN = DEFAULT_LANG_FOR_JPN; | ||
Languages gDefaultLangForJPN = DEFAULT_LANG_FOR_JPN; | ||
int32_t gDefaultCountryForJPN = DEFAULT_COUNTRY_FOR_JPN; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.