satiator / satiator-menu

Menu for the Satiator cartridge for Sega Saturn
Mozilla Public License 2.0
95 stars 6 forks source link

Issue With File Writes >= 2048 #6

Closed slinga-homebrew closed 4 years ago

slinga-homebrew commented 4 years ago

EmeraldNova and I are pretty stumped. Please test out this SGC ISO when you get a chance: https://github.com/slinga-homebrew/Save-Game-Copier/releases/tag/3.0.8. I made a test case with files of all A's of differing length. Please make a "SAVES" directory on your root drive of your Satiator.

After booting SGC, if you go to the "CD Memory" option, please copy TEST2047, TEST2048, and TEST__2049 to internal memory. From there go to Internal memory and copy them to the Satiator. On my machine these are the hashes I get:

5972cf2ae2e853d61a6fa4cea47817cf /tmp/satisfier/SAVES/TEST2047 ef4ec7e7b54da951a91e8d10c85ca394 /tmp/satisfier/SAVES/TEST2048 c3501f191a4a16b3f6bdef03c4beb26c /tmp/satisfier/SAVES/TEST___2049

Once you have copied the files to the Satiator with SGC, please copy the files to your PC and check the hashes. On my end everything works. On EmeraldNova's end the hashes are correct in SGC, but when he copies the files to his PC the files greater than 2047 are corrupted. The weird thing is that the file contents contain filesystem info. I saw names of other ISOs on his Satiator embedded within one of the saves. Again the files should be 2047, 2048, and 2049 'A's.

abrasive commented 4 years ago

Good catch, thank you! Fixed in Satiator firmware build 149. I had put a cmp/hi where a cmp/hs was required, in one of the most obscure corners of the SH2<->SD data path. Have forwarded a build to EmeraldNova to test before closing the ticket.

abrasive commented 4 years ago

Sorry, I didn't actually say what the bug was! Any write of exactly 2048 bytes was being executed, but the data itself wasn't being copied from the SH2 to the SH1, so you'd get the old contents of the SH1's copy buffer.

slinga-homebrew commented 4 years ago

It looks like it's working now. I'll re-open if EmeralNova sees any issues, but so far so good. Thanks.