suloku / gcmm

A gamecube/wii memory card manager
GNU General Public License v3.0
254 stars 24 forks source link

Restore Error #33

Closed Zephiles closed 3 years ago

Zephiles commented 5 years ago

This error occurs with some custom save files that have been made, and will be provided.

Specifically, the error occurs when trying to restore G8ME_rel_PracticeCodes to the memory card when 01-G8ME-rel_settings is already present. When doing so, GCMM will ask to overwrite the file as normal, but will then do so once again. Regardless of the options chosen at this point, the practice codes file will be deleted from the memory card. If you try to overwrite the file on the 2nd prompt, GCMM reports MemCard Error : MCDel - -4 No File. The only way around this error is to delete the settings file, restore the practice codes file, and then restore the settings file afterwards.

Both files have been tested to work in the game without issues, and this error does not occur with Dolphin's memcard manager, so I assume it's some sort of issue with GCMM itself.

SaveFiles.zip

suloku commented 4 years ago

How are this files custom? Which gsme are we talking about? For what you say it seems to be detecting the files as being the same one...

Zephiles commented 4 years ago

To keep the explanation short, G8ME_rel_PracticeCodes is created in a project that creates a rel file and then places that into the save file, which then gets loaded in the game at boot via a gecko code. The specific game here is Paper Mario: The Thousand-Year Door.

G8ME-rel_settings is created in the same project, in which it creates a new file to save some settings.

The name used for G8ME_rel_PracticeCodes is rel, and the name used for G8ME-rel_settings is rel_settings.

suloku commented 3 years ago

I think I know what the problem is. My implementation of deleting only erases the actual file from the memory card, it doesn't delete the directory table entry. I should actually just delete the directory entry, there's actually no need to delete the actual file. I've been looking at card.c and I think card_delete should update the table upon calling the function, maybe there's some bug there. If I can get time I'll try to test deleting the directory entry instead of the file, I think that would fix the behaviour you describe and hopefully delete/overwrite won't break because of it...

Zephiles commented 3 years ago

Alright, I'm looking forward to this fix if it works out, as these files are used a lot in the TTYD speedrunning community, so it's a pain to have to work around this bug.

suloku commented 3 years ago

Turns out the error was in libogc's card.c all along, I reported the error and fix here: https://github.com/devkitPro/libogc/issues/113 I need to do some more testing though, but seems this was the problem.

suloku commented 3 years ago

https://github.com/suloku/gcmm/releases/tag/1.5