Thysbelon / gbaconv-web

The Libretro VBA save to standard sav converter gbaconv compiled to WebAssembly.
https://thysbelon.github.io/gbaconv-web/
9 stars 1 forks source link

Tool seemingly not working for .4gz files #1

Closed danielhdz13 closed 1 year ago

danielhdz13 commented 1 year ago

I used the 44670 emulator's Dropbox integration to upload my save file, and it uploaded a .4gz file.

For the web version of the converter, I gave it the .4gz file and it spit out a copy of it. Then I tried it with the executable and hit a Cannot infer save type error. Can you reproduce?

I noticed that it specified 4gs file in the documentation and not 4gz. Is there a difference, if so what?

fyi the emulator version is 20230107

Thysbelon commented 1 year ago

4gs files are what the emulator produces when you click "Backup" under "Savegame Management". I had no idea that connecting to dropbox produced a different format.

I just created a dropbox account to investigate this. I was hoping that the 4gz files were just compressed 4gs files; but unfortunately, 7zip does not recognize them. It would take me a while to figure out this 4gz format.

For now, please use the "Backup" button under "Savegame Management" to obtain 4gs files compatible with gbaconv-web.

Thank you for your comment.

danielhdz13 commented 1 year ago

Thanks for the response. I see the .4gs file now. Btw, is there a spec for these .sav / .4gs files?

Thysbelon commented 1 year ago

I don't know if there is an official "spec". 4gs files are identical to libretro's srm files; and everything I know about srm files comes from this paragraph in Emulation General Wiki. Searching libretro's GitHub account for "srm" returns code, commits, issues, nothing that seems like it would contain a spec.

".sav" files are raw save data. I do not know if there is a spec for these either. Looking at the code of gbaconv (specifically the function dump_srm()), it seems the only difference between sav and srm is that srm files have a lot of 0xFF bytes added to the top and/or bottom of the file.

Thysbelon commented 1 year ago

gbaconv-web supports 4gz to sav conversion now (if you need an srm/4gs file, just put the outputted sav file in the webapp and it will convert to srm). Surprisingly, it wasn't actually that complicated. For the most part, 4gz files are gzip compressed 4gs files; but they have a tiny layer of encryption to them that makes 7zip not recognize them (every byte is raised to the power of 0xFB).