diff options
author | DesperateProgrammer <Tim.seidel@rwth-Aachen.de> | 2021-07-13 15:01:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-13 15:01:42 +0200 |
commit | 3a9e07c0b1359669095e3c1079369419fd461e31 (patch) | |
tree | 918d0d12780c0865a4b5d6a2df3bb451bf494e5e /src | |
parent | e5240a688c54d07dd6d6b4994a920137d15bbad3 (diff) |
Fallback to backup DSi Footer in NAND Image (#1154)
* - added fallback to DSi footer copy at 000FF800h if reading footer at end of file failed. See https://problemkaputt.de/gbatek.htm#dsisdmmcimages
- changed output of ConsoleID to use PRIx64 to be consistent with all other tools working with the consoleID (readability/cosmetic improvement)
* Remove extra space
Co-authored-by: Tim Seidel <t.seidel@kts-systeme.de>
Co-authored-by: RSDuck <RSDuck@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/DSi.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/DSi.cpp b/src/DSi.cpp index 5954d4f..b55992c 100644 --- a/src/DSi.cpp +++ b/src/DSi.cpp @@ -457,15 +457,23 @@ bool LoadNAND() fread(nand_footer, 1, 16, SDMMCFile); if (memcmp(nand_footer, nand_footer_ref, 16)) { - printf("ERROR: NAND missing nocash footer\n"); - return false; + // There is another copy of the footer at 000FF800h for the case + // that by external tools the image was cut off + // See https://problemkaputt.de/gbatek.htm#dsisdmmcimages + fseek(SDMMCFile, 0x000FF800, SEEK_SET); + fread(nand_footer, 1, 16, SDMMCFile); + if (memcmp(nand_footer, nand_footer_ref, 16)) + { + printf("ERROR: NAND missing nocash footer\n"); + return false; + } } fread(eMMC_CID, 1, 16, SDMMCFile); fread(&ConsoleID, 1, 8, SDMMCFile); printf("eMMC CID: "); printhex(eMMC_CID, 16); - printf("Console ID: %" PRIu64 "\n", ConsoleID); + printf("Console ID: %" PRIx64 "\n", ConsoleID); } memset(ITCMInit, 0, 0x8000); |