move cheat handling and error out on parsing errors

This commit is contained in:
Travis Burtrum 2021-10-24 16:03:04 -04:00
parent 18295c5e7b
commit 8368780f69
1 changed files with 31 additions and 26 deletions

View File

@ -2241,6 +2241,37 @@ void bootRom(display_context_t disp, int silent)
{
if (boot_cic != 0)
{
// first load cheats if enabled, and error out if we can't
u32 *cheat_lists[2] = {NULL, NULL};
if (cheats_on)
{
gCheats = 1;
printText("try to load cheat-file...", 3, -1, disp);
char cheat_filename[64];
sprintf(cheat_filename, "/"ED64_FIRMWARE_PATH"/CHEATS/%s.yml", rom_filename);
int ok = readCheatFile(cheat_filename, cheat_lists);
if (ok == 0)
{
printText("cheats found...", 3, -1, disp);
}
else
{
printText("cheats not found", 3, -1, disp);
printText("or parsing failed", 3, -1, disp);
printText("reset console...", 3, -1, disp);
gCheats = 0;
while(true) {
sleep(20000);
}
}
}
else
{
gCheats = 0;
}
if (boot_save != 0)
{
TCHAR cfg_file[MAX_SUPPORTED_PATH_LEN];
@ -2284,32 +2315,6 @@ void bootRom(display_context_t disp, int silent)
cart = info >> 16;
country = (info >> 8) & 0xFF;
u32 *cheat_lists[2] = {NULL, NULL};
if (cheats_on)
{
gCheats = 1;
printText("try to load cheat-file...", 3, -1, disp);
char cheat_filename[64];
sprintf(cheat_filename, "/"ED64_FIRMWARE_PATH"/CHEATS/%s.yml", rom_filename);
int ok = readCheatFile(cheat_filename, cheat_lists);
if (ok == 0)
{
printText("cheats found...", 3, -1, disp);
}
else
{
printText("cheats not found...", 3, -1, disp);
sleep(2000);
gCheats = 0;
}
}
else
{
gCheats = 0;
}
disable_interrupts();
int bios_cic = getCicType(1);