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); //Fat_Unmount(fdev);
//if (((fdevList[selected].mount[0] == 's') && (ndev->name[0] == 'S'))) //if (((fdevList[selected].mount[0] == 's') && (ndev->name[0] == 'S')))
//selected++; //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 */ /* Select source device */
if (gConfig.fatDeviceIndex < 0) if (gConfig.fatDeviceIndex < 0)
@ -342,6 +348,13 @@ void Menu_FatDevice(void)
u32 buttons = WaitButtons(); 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 */ /* LEFT/RIGHT buttons */
if (buttons & WPAD_BUTTON_LEFT) { if (buttons & WPAD_BUTTON_LEFT) {
if ((--selected) <= -1) if ((--selected) <= -1)
@ -367,8 +380,15 @@ void Menu_FatDevice(void)
Restart(); Restart();
/* A button */ /* 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; break;
}
} }
} }
else else

View File

@ -257,6 +257,11 @@ void __Wad_FixTicket(signed_blob *p_tik)
Title_FakesignTik(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) s32 Wad_Install(FILE *fp)
{ {
wadHeader *header = NULL; wadHeader *header = NULL;
@ -287,7 +292,7 @@ s32 Wad_Install(FILE *fp)
goto out; goto out;
} }
/* WAD certificates */ /* WAD certificates */
ret = __Wad_ReadAlloc(fp, (void *)&p_certs, offset, header->certs_len); ret = __Wad_ReadAlloc(fp, (void *)&p_certs, offset, header->certs_len);
if (ret >= 0) if (ret >= 0)
offset += round_up(header->certs_len, 64); offset += round_up(header->certs_len, 64);
@ -379,6 +384,8 @@ s32 Wad_Install(FILE *fp)
if (tid == TITLE_ID(1, 2)) if (tid == TITLE_ID(1, 2))
{ {
if (skipRegionSafetyCheck) goto skipChecks;
if(get_sm_region_basic() == 0) if(get_sm_region_basic() == 0)
{ {
printf("\n Can't get the SM region\n Please check the site for updates\n"); printf("\n Can't get the SM region\n Please check the site for updates\n");
@ -400,12 +407,13 @@ s32 Wad_Install(FILE *fp)
ret = -999; ret = -999;
goto err; goto err;
} }
if( get_sm_region_basic() != regionlist[i].region) if(get_sm_region_basic() != regionlist[i].region)
{ {
printf("\n I won't install the wrong regions SM\n"); printf("\n I won't install the wrong regions SM\n");
ret = -999; ret = -999;
goto err; goto err;
} }
skipChecks:
if(tmd_data->title_version < 416) if(tmd_data->title_version < 416)
{ {
if(boot2version == 4) if(boot2version == 4)