From 8368780f69c385aa5dc6dee24cef2a2278edf0f9 Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Sun, 24 Oct 2021 16:03:04 -0400 Subject: [PATCH] move cheat handling and error out on parsing errors --- src/main.c | 57 +++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/src/main.c b/src/main.c index 5e203b2..76d24c9 100644 --- a/src/main.c +++ b/src/main.c @@ -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);