Add Konami code to skip certain wad safety checks, so region changing is possible

This commit is contained in:
Peter0x44 2022-05-08 17:52:17 +01:00
parent ac7ce067d6
commit 5a4bbc9800
No known key found for this signature in database
GPG Key ID: A8DEAD1A4BB82440
2 changed files with 31 additions and 3 deletions

View File

@ -322,6 +322,12 @@ void Menu_FatDevice(void)
//Fat_Unmount(fdev);
//if (((fdevList[selected].mount[0] == 's') && (ndev->name[0] == 'S')))
//selected++;
static const u16 konamiCode[] = {
WPAD_BUTTON_UP, WPAD_BUTTON_UP, WPAD_BUTTON_DOWN, WPAD_BUTTON_DOWN, WPAD_BUTTON_LEFT,
WPAD_BUTTON_RIGHT, WPAD_BUTTON_LEFT, WPAD_BUTTON_RIGHT, WPAD_BUTTON_B, WPAD_BUTTON_A
};
int codePosition = 0;
/* Select source device */
if (gConfig.fatDeviceIndex < 0)
@ -342,6 +348,13 @@ void Menu_FatDevice(void)
u32 buttons = WaitButtons();
if (buttons & (WPAD_BUTTON_UP | WPAD_BUTTON_DOWN | WPAD_BUTTON_RIGHT | WPAD_BUTTON_LEFT | WPAD_BUTTON_A | WPAD_BUTTON_B)) {
if (buttons & konamiCode[codePosition])
++codePosition;
else
codePosition = 0;
}
/* LEFT/RIGHT buttons */
if (buttons & WPAD_BUTTON_LEFT) {
if ((--selected) <= -1)
@ -367,10 +380,17 @@ void Menu_FatDevice(void)
Restart();
/* A button */
if (buttons & WPAD_BUTTON_A)
if (buttons & WPAD_BUTTON_A) {
if (codePosition == sizeof(konamiCode) / sizeof(konamiCode[0])) {
extern bool skipRegionSafetyCheck;
skipRegionSafetyCheck = true;
printf("[+] Disabled SM region checks\n");
sleep(2);
}
break;
}
}
}
else
{
sleep(5);

View File

@ -257,6 +257,11 @@ void __Wad_FixTicket(signed_blob *p_tik)
Title_FakesignTik(p_tik);
}
// Some of the safety checks can block region changing
// Entering the Konami code turns this true, so it will
// skip the problematic checks for region changing.
bool skipRegionSafetyCheck = false;
s32 Wad_Install(FILE *fp)
{
wadHeader *header = NULL;
@ -379,6 +384,8 @@ s32 Wad_Install(FILE *fp)
if (tid == TITLE_ID(1, 2))
{
if (skipRegionSafetyCheck) goto skipChecks;
if(get_sm_region_basic() == 0)
{
printf("\n Can't get the SM region\n Please check the site for updates\n");
@ -406,6 +413,7 @@ s32 Wad_Install(FILE *fp)
ret = -999;
goto err;
}
skipChecks:
if(tmd_data->title_version < 416)
{
if(boot2version == 4)