Skip to content

Commit

Permalink
Merge pull request #222 from MechaResearch/emergency
Browse files Browse the repository at this point in the history
Emergency
  • Loading branch information
AKuHAK authored Jul 14, 2024
2 parents f0fc568 + 5d97967 commit 7f1e14e
Showing 1 changed file with 30 additions and 41 deletions.
71 changes: 30 additions & 41 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ char unlockNVM()

struct GSTEXTURE_holder *versionTextures = ui_printf(8, 8 + big_size + big_size / 2 + 0 * (reg_size + 4), reg_size, 0xFFFFFF, "Mecha version: %d.%02d\n", version[1], (version[2] | 1) - 1);
struct GSTEXTURE_holder *buildTextures = ui_printf(8, 8 + big_size + big_size / 2 + 1 * (reg_size + 4), reg_size, 0xFFFFFF, "Mecha build date: 20%02x/%02x/%02x %02x:%02x\n", build_date[0], build_date[1], build_date[2], build_date[3], build_date[4]);
struct GSTEXTURE_holder *exploitTextures = draw_text(8, 8 + big_size + big_size / 2 + 2 * (reg_size + 4), reg_size, 0xFFFFFF, "Press O to install exploit.\n");
struct GSTEXTURE_holder *exploitTextures = draw_text(8, 8 + big_size + big_size / 2 + 2 * (reg_size + 4), reg_size, 0xFFFFFF, "Press O to unlock nvram.\n");
struct GSTEXTURE_holder *exitTextures = draw_text(8, 8 + big_size + big_size / 2 + 3 * (reg_size + 4), reg_size, 0xFFFFFF, "Press X to exit.\n");

drawFrame();
Expand All @@ -95,7 +95,7 @@ char unlockNVM()
const uint8_t *patch = getPatch(build_date);
if (!installPatch(patch))
{
struct GSTEXTURE_holder *errorTextures = draw_text(8, 8 + big_size + big_size / 2 + 4 * (reg_size + 4), reg_size, 0xFFFFFF, "Failed to install the patch.\n");
struct GSTEXTURE_holder *errorTextures = draw_text(8, 8 + big_size + big_size / 2 + 4 * (reg_size + 4), reg_size, 0xFFFFFF, "Failed to install unlock patch.\n");

drawFrame();

Expand Down Expand Up @@ -1428,7 +1428,7 @@ void checkUnsupportedVersion()
sprintf(RealModelName, "SCPH-90010 CR");
else
{
errorTextures = draw_text(8, 8 + big_size + big_size / 2 + 5 * (reg_size + 4), reg_size, 0xFFFFFF, "Model ID unknown, please report!\n");
errorTextures = ui_printf(8, 8 + big_size + big_size / 2 + 5 * (reg_size + 4), reg_size, 0xFFFFFF, "Model ID unknown, please report!\n");
IsKnownconsole = 0;
}
modelnameTextures = ui_printf(8, 8 + big_size + big_size / 2 + 2 * (reg_size + 4), reg_size, 0xFFFFFF, "Real Model Name: %s\n", RealModelName);
Expand Down Expand Up @@ -1687,6 +1687,7 @@ int main()

drawLogo();

backupNVM();
checkUnsupportedVersion();
checkFMCB();

Expand All @@ -1697,64 +1698,52 @@ int main()
if (!IsNVMUnlocked())
{
rerun = 1;
if (!isPatchAlreadyInstalled())
{
if (backupNVM())
unlockNVM();
}
unlockNVM();
}
else
{
uint8_t build_date[5];
gsKit_clear(gsGlobal, Black);

struct MENU menu;
menu.title = "MechaPwn";
menu.x_text = "X Select";
menu.o_text = "O Exit";
menu.title = "MechaPwn";
menu.x_text = "X Select";
menu.o_text = "O Exit";

if ((getMechaBuildDate(build_date)) && IsKnownconsole)
{
menu.option_count = 2;
menu.options[0] = "Change region";
menu.options[1] = "Restore NVRAM backup";

selected = drawMenu(&menu);
menu.option_count = 2;
if (getMechaBuildDate(build_date) && IsKnownconsole)
menu.options[0] = "Change region";
else
menu.options[0] = "Exit";
menu.options[1] = "Restore NVRAM backup";

if (selected == -1)
{
ResetIOP();
Exit(0);
SleepThread();
}
else if (selected == 0)
selected = drawMenu(&menu);

if (selected == -1)
{
ResetIOP();
Exit(0);
SleepThread();
}
else if (selected == 0)
{
if (getMechaBuildDate(build_date) && IsKnownconsole)
{
char isDex = 0;
setRegion(&isDex);
applyPatches(isDex);
}
else if (selected == 1)
{
restoreBackup();
}
}
else
{
menu.option_count = 1;
menu.options[0] = "Restore NVRAM backup";

selected = drawMenu(&menu);

if (selected == -1)
else
{
ResetIOP();
Exit(0);
SleepThread();
}
else if (selected == 0)
{
restoreBackup();
}
}
else if (selected == 1)
{
restoreBackup();
}
}

Expand Down

0 comments on commit 7f1e14e

Please sign in to comment.