Mefiresu / RSDKv5-Decompilation

A complete decompilation of Retro Engine (v5) ported to the Wii
Other
49 stars 6 forks source link

[General] Can't import Mania/Encore saves #12

Open Mefiresu opened 1 year ago

Mefiresu commented 1 year ago

Achievements, medals and other stats load correctly, while Mania/Encore saves don't seem to be loaded at all. This could be an endianness issue when reading SaveData.bin, need to investigate and possibly upstream a fix.

Mefiresu commented 1 year ago

This is definitely an endianness issue since the save file is essentially a memory dump of the state of the game. However this means that little/big endian compatibility could only be ensured if the struct layouts are modified to mimic little endian layouts and alignments.

Doom32x1 commented 1 year ago

the savegames have minor very minor differences, it seems to be that in the mania pc/switch/ps4/xbox the saves are edited different than in the RSDKv5 saves. I created exactly the same savefile on pc and on wii and opened the files with "beyond compare Hex comparison editor" to see those differences (the savegame was: sonic and tails, green hill zone, 3 lives, quitted after entering the bonus):

[](url)

then i edited the PC save file with SonicMania-SaveEditor.exe and only choose 7 chaos emerald https://imgbox.com/LDSHjkbv

then I did the same comparison but with the file edited, you can see the differences, the data containing the slot savefile info is slighty different, look at the 03 located in the pc and in the wii savegame: https://imgbox.com/NMoPrBny

now you have to edit the same hex value 7F from the pc, i edited following the location of the 03 value from the pc save, just 11 spaces after, now you have the 7emerald on wii too :D (here is the savefile with the savegame on green hill with 7 chaos emerald for wii: https://www.mediafire.com/file/t17sm04h7ocyz3n/SaveData.bin1/file, rename it to SaveData.Bin)

And here is a zip with the savefiles i used to made this comparison. Maybe its useful for someone or maybe someone can update his sonic mania editor: https://www.mediafire.com/file/74jbtfn46f4p3q8/saves_for_comparision.zip/file

if you try to use any sonicmania save editor with the wii savefile, it will crash or will give you a buggy savefile, you have to do what i did

Mefiresu commented 1 year ago

the savegames have minor very minor differences, it seems to be that in the mania pc/switch/ps4/xbox the saves are edited different than in the RSDKv5 saves.

Do you mean that the official game savefiles are different compared to the decompilation?

My understanding was that there's just a mismatch between original vs. decomp game state struct (padding, big/little endian values, 32vs64bit pointers...), and that the saved data just corresponds to a raw dump of that struct, which could explain the differences.

Doom32x1 commented 1 year ago

the savegames have minor very minor differences, it seems to be that in the mania pc/switch/ps4/xbox the saves are edited different than in the RSDKv5 saves.

Do you mean that the official game savefiles are different compared to the decompilation?

My understanding was that there's just a mismatch between original vs. decomp game state struct (padding, big/little endian values, 32vs64bit pointers...), and that the saved data just corresponds to a raw dump of that struct, which could explain the differences.

yeah exactly, they are almost identical, but rdskv5 seems to add some blanck spaces or just 00 00 00 in a line, you can see the comparison in the images i attached, im not a developer but maybe this is usefull for someone to update one of those open source github sonic mania saves editors proyects, perhaps a programmer can make them compatible :)