diff --git a/arm9/source/fs.c b/arm9/source/fs.c index cf5f364..ea359e6 100644 --- a/arm9/source/fs.c +++ b/arm9/source/fs.c @@ -398,6 +398,16 @@ void findDumpFile(const char *folderPath, char *fileName) static u8 fileCopyBuffer[0x10000]; +static const u8 boot9Sha256[32] = { + 0x2F, 0x88, 0x74, 0x4F, 0xEE, 0xD7, 0x17, 0x85, 0x63, 0x86, 0x40, 0x0A, 0x44, 0xBB, 0xA4, 0xB9, + 0xCA, 0x62, 0xE7, 0x6A, 0x32, 0xC7, 0x15, 0xD4, 0xF3, 0x09, 0xC3, 0x99, 0xBF, 0x28, 0x16, 0x6F +}; + +static const u8 boot11Sha256[32] = { + 0x74, 0xDA, 0xAC, 0xE1, 0xF8, 0x06, 0x7B, 0x66, 0xCC, 0x81, 0xFC, 0x30, 0x7A, 0x3F, 0xDB, 0x50, + 0x9C, 0xBE, 0xDC, 0x32, 0xF9, 0x03, 0xAE, 0xBE, 0x90, 0x61, 0x44, 0xDE, 0xA7, 0xA0, 0x75, 0x12 +}; + static bool backupEssentialFiles(void) { size_t sz = sizeof(fileCopyBuffer); @@ -430,6 +440,15 @@ static bool backupEssentialFiles(void) ok = ok && fileWrite(fileCopyBuffer, "backups/HWCAL_01_EEPROM.dat", 0x1000); } + // B9S bootrom backups + u32 hash[32/4]; + sha(hash, (const void *)0x08080000, 0x10000, SHA_256_MODE); + if (memcmp(hash, boot9Sha256, 32) == 0 && getFileSize("backups/boot9.bin") != 0x10000) + ok = ok && fileWrite((const void *)0x08080000, "backups/boot9.bin", 0x10000); + sha(hash, (const void *)0x08090000, 0x10000, SHA_256_MODE); + if (memcmp(hash, boot11Sha256, 32) == 0 && getFileSize("backups/boot11.bin") != 0x10000) + ok = ok && fileWrite((const void *)0x08090000, "backups/boot11.bin", 0x10000); + return ok; }