Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Peter0x44
Copy link

@Peter0x44 Peter0x44 commented Jan 26, 2021

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 Peter0x44 force-pushed the fix-eepromsize-detection branch from e96e8c7 to e63e99f Compare January 26, 2021 09:18
@Peter0x44
Copy link
Author

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

@Peter0x44 Peter0x44 force-pushed the fix-eepromsize-detection branch from e63e99f to 2479054 Compare May 20, 2021 06:11
Before, 128k saves (like those present in Pokemon Mystery Dungeon: Explorers of Sky would be detected incorrectly as 8k saves.
Also, the first byte read from them would always be 0xFF
@Peter0x44
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant