From 79a3bfc9e1596ecab2bd846946334f8136144ba5 Mon Sep 17 00:00:00 2001 From: d0k3 Date: Wed, 7 Feb 2018 02:16:31 +0100 Subject: [PATCH] Don't verify ExeFS for Process9 --- arm9/source/utils/gameutil.c | 7 ++++--- data/testbug.gm9 | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 data/testbug.gm9 diff --git a/arm9/source/utils/gameutil.c b/arm9/source/utils/gameutil.c index ce35d7c..52ade7b 100644 --- a/arm9/source/utils/gameutil.c +++ b/arm9/source/utils/gameutil.c @@ -302,6 +302,7 @@ u32 VerifyTmdContent(const char* path, u64 offset, TmdContentChunk* chunk, const u32 VerifyNcchFile(const char* path, u32 offset, u32 size) { NcchHeader ncch; + NcchExtHeader exthdr; ExeFsHeader exefs; FIL file; @@ -313,7 +314,7 @@ u32 VerifyNcchFile(const char* path, u32 offset, u32 size) { return 1; fvx_lseek(&file, offset); - if (GetNcchHeaders(&ncch, NULL, NULL, &file) != 0) { + if (GetNcchHeaders(&ncch, &exthdr, NULL, &file) != 0) { if (!offset) ShowPrompt(false, "%s\nError: Not a NCCH file", pathstr); fvx_close(&file); return 1; @@ -363,8 +364,8 @@ u32 VerifyNcchFile(const char* path, u32 offset, u32 size) { ver_romfs = CheckNcchHash(ncch.hash_romfs, &file, ncch.size_romfs_hash * NCCH_MEDIA_UNIT, offset, &ncch, NULL); } - // thorough exefs verification - if (ncch.size_exefs > 0) { + // thorough exefs verification (workaround for Process9) + if ((ncch.size_exefs > 0) && (memcmp(exthdr.name, "Process9", 8) != 0)) { for (u32 i = 0; !ver_exefs && (i < 10); i++) { ExeFsFileHeader* exefile = exefs.files + i; u8* hash = exefs.hashes[9 - i]; diff --git a/data/testbug.gm9 b/data/testbug.gm9 new file mode 100644 index 0000000..2801477 --- /dev/null +++ b/data/testbug.gm9 @@ -0,0 +1,29 @@ +@MainMenu +labelsel -s -o "Main Menu" MainMenu_* +goto MainMenu + +@MainMenu_Option1 +labelsel -s -o "Option 1 Sub-Menu" MainMenu_Option1_* +goto MainMenu + +@MainMenu_Option1_A +echo "This is Option 1 A" +goto MainMenu_Option1 + +@MainMenu_Option1_B +echo "This is Option 1 B" +goto MainMenu_Option1 + +@MainMenu_Option2 +echo "This is Option 2" +goto MainMenu + +@MainMenu_Option3 +echo "This is Option 3" +goto MainMenu + +@MainMenu_Reboot +reboot + +@MainMenu_Shutdown +poweroff