Unverified Commit 3a9e07c0 authored by DesperateProgrammer's avatar DesperateProgrammer Committed by GitHub
Browse files

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: default avatarTim Seidel <t.seidel@kts-systeme.de>
Co-authored-by: default avatarRSDuck <RSDuck@users.noreply.github.com>
parent e5240a68
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment