Save Format Toggle

Discuss anything about DraStic here.
Post Reply
User avatar
gaiaweylyn
Posts:1
Joined:Mon May 01, 2017 2:27 am
Contact:
Save Format Toggle

Post by gaiaweylyn » Mon May 01, 2017 2:55 am

I recently have started playing my physical game carts again. I can use TWLSaveTool on my console to import and export saves to/from the carts. These are in RAW .sav format.

DraStic, and DeSmuME, both use the .dsv format, which if I recall correctly, adds a header to the files, increasing the filesize by a small amount.

I was able to import the .savs from the cartridge directly into DraStic by copying them to the Backups directory and changing the extension to .dsv. However, once the game is loaded and I make another save, I notice the filesize increase as the header is added. I am uncomfortable with the idea of attempting to rename and put it back onto the cart with the header intact.

I would prefer not to have to use a converter tool, as all the ones I know of that support DeSmuME / .dsv saves run on windows, and my phone (that runs DraStic) is ARM-based, so cannot run the programs through Codeweavers Crossover or similar. Would it be possible to add a toggle somewhere in settings that allows one to change the format of the in-game saves? I know DraStic used to use headerless RAW saves with a DSV extension, so the code for it must still be archived somewhere. This way, I could transfer saves directly between my phone and my console.

If not, is there a converter tool for android / in a browser that does support DeSmuME / .dsv saves?

User avatar
Steak_Typhoon
Posts:38
Joined:Mon Feb 06, 2017 3:46 pm

Re: Save Format Toggle

Post by Steak_Typhoon » Mon May 01, 2017 11:23 am

I used to play around with homebrew on a flashcart and I would use this tool a lot:
https://shunyweb.info/convert.php

none of the options there are for DeSmuME, but one of them might be similar. I can do some testing for you if you send me one of your saves. (I might have the game)
Steak Typhoon: The most delicious natural disaster.

Exophase
Posts:1716
Joined:Mon Aug 05, 2013 9:08 pm

Re: Save Format Toggle

Post by Exophase » Sat May 06, 2017 4:09 pm

The .dsv has a footer rather than a header, meaning it comes at the end of the file. The save files created by DraStic also always have the entire save memory, which is always a power of two in size. So if you truncate the file size down to the nearest power of two it'll remove the footer.

Because of this you can truncate the file to the next lowest power of two in size to get rid of the footer.

It's possible to do this on a standard Android device using the builtin truncate command, but you need to have terminal access to do it. I did the following using an adb shell from a Linux PC:

Code: Select all

HWFRD:/ $ cd /sdcard/DraStic/backup
HWFRD:/sdcard/DraStic/backup $ ls -l Chrono_Trigger.dsv
-rw-rw---- 1 root sdcard_rw 65658 2017-05-06 16:05 Chrono_Trigger.dsv
HWFRD:/sdcard/DraStic/backup $ truncate -s 65536 Chrono_Trigger.dsv 
HWFRD:/sdcard/DraStic/backup $ ls -l Chrono_Trigger.dsv
-rw-rw---- 1 root sdcard_rw 65536 2017-05-06 16:06 Chrono_Trigger.dsv
This changed the file size of the dsv file from 65658 bytes to 65536 bytes (64KB), truncating the footer.

Although I did this using a Linux PC it's possible to do it on the Android device directly by using a terminal emulator app like Termex. It's pretty cumbersome to have to type the commands on your phone but it'll work in a pinch. There could be apps out there that can make this easier, I did a cursory search but couldn't find anything.

If I were you I'd try using the .dsv as-is with the flashcart; because it's a footer as opposed to a header it might just get ignored.

Post Reply