libnds icon indicating copy to clipboard operation
libnds copied to clipboard

fix bug where save size could be detected incorrectly, if multiple bytes in the save are identical

Open Peter0x44 opened this issue 4 years ago • 2 comments

Recently, a user of GodMode9i reported that it was always dumping only the first 8192 bytes of save, as the function cardEepromGetSize was reporting the wrong value, instead of the 64k which the save should have been.

Flashing this save to another cartridge also caused the size to be detected incorrectly, so it was nothing with the flash type itself

What causes this here is that both the first and 8192nd words are 0, so it just stops looping early By writing TeST (a very unlikely value to appear later on) and restoring it after finishing the loop, the size is now detected correctly.

SCRIBLENAUT2_BH2EWR_0.zip

Peter0x44 avatar Jan 26 '21 09:01 Peter0x44

I force pushed to change some formatting - I accidentally used spaces instead of tabs in some places

Peter0x44 avatar Jan 26 '21 09:01 Peter0x44

Another user ran in to a different issue with dumping saves - the code didn't handle 128k eeprom properly It would get detected as 8k, and the dump would contain a single erroneous 0xFF byte at that start.

I'm going to throw that change in here, hopefully someone can get around to reviewing it soon.

Peter0x44 avatar May 20 '21 06:05 Peter0x44