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>
This commit is contained in:
DesperateProgrammer 2021-07-13 15:01:42 +02:00 committed by GitHub
parent e5240a688c
commit 3a9e07c0b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -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);