Hardware Converting gsv or sps files to sav

shinji257

Well-Known Member
OP
Member
Joined
Apr 9, 2007
Messages
328
Trophies
1
Age
41
Website
www.elite-systems.org
XP
356
Country
United States
This is to the raw .sav format. I am trying to get a gameshark snapshot save file written onto my retail zelda: link to the past gba cartridge but I have been unsuccessful at this. It is apparent that the format is incorrect but I cannot figure out how to correct it. I am trying to use the utility cart_save.gba to read and write the save information for that game. I can read the information and the same information gets written back properly. However when I take a look at the gsv and sps files have a header of their own and the header for the save information is messed up. Looks like it was switched around a bit. The one I got from cart_save.gba does not look as neat as the one from the sps file and stuff. If you guys want to see what I mean then I can post them up...

P.S. - I already tried the G6 Save Converter. Fails with an out of bounds error and outputs a 128KB file full of null data on the sps file. Doesn't recognize the gsv file at all.

EDIT: It is also possible that it is scrambling the file a bit and unscrambling on write. Don't know. The export from VBA for SPS file gives the same result as to what I was doing manually.
wink.gif
 

shinji257

Well-Known Member
OP
Member
Joined
Apr 9, 2007
Messages
328
Trophies
1
Age
41
Website
www.elite-systems.org
XP
356
Country
United States
I think I figured out the sps format a bit.

Header: Contains the name of the game and some information including a timestamp. This can be any amount of characters. I'll show how you can visually identify the end point.

Battery Save: This will be 8KB, 32KB, 512KB, or 1024KB. The SPS files are 64KB for both EEPROM 8KB and SRAM 32KB saves. Not sure about the other 2. In both cases they are put in the file twice. The second time is redundant and is simply a repeat but can be used to identify the start point.

Identifying the start point....

It is even easier if you have a raw dump of that game's sram or eeprom like I did but it can be done without.

.... I'll come back when I have found a surefire method. I will reverse-engineer the file format a bit.
wink.gif


Hint: The game identifier - XXX-XXXX-XXX will help in finding it. Take the middle 4 and go 12 more bytes to find the start point... Removed the excess starting when it loops over.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,403
Country
United Kingdom
I applaud your ingenuity but it is often far simpler to grab the sps (gameshark) save and use the file -> import -> gameshark snapshot option followed by the export battery file option.
 

shinji257

Well-Known Member
OP
Member
Joined
Apr 9, 2007
Messages
328
Trophies
1
Age
41
Website
www.elite-systems.org
XP
356
Country
United States
Yea. But not everyone has the backup to the game available to them. For Legend of Zelda: Link to the Past it spits out a 64KB file instead of a 8KB file so you still have to trim whitespace from the end of the file. The game uses a 64Kbit EEPROM chip. Does a similar thing for Final Fantasy: Dawn of Souls where VBA also saves a 64KB file. The game uses a 256Kbit (32KB) SRAM chip.

P.S. I was doing this with intention of writing the file back to the original retail carts. Not for use in a flash cart even though I have one such item in my posession.

EDIT: Oh and there are 2 versions of the US Legend of Zelda: Link to the Past GBA cart. One has AZLP and the other has AZLE. Mine is AZLP. That is why when I was doing it manually it was not working at all.

I was using the GBA Game Save Backup Utility located here -- http://chishm.drunkencoders.com/SendSave/index.html
Just look close to the bottom of the page.
 

shinji257

Well-Known Member
OP
Member
Joined
Apr 9, 2007
Messages
328
Trophies
1
Age
41
Website
www.elite-systems.org
XP
356
Country
United States
Oh man. Didn't realize how correct about the fact that there are 2 versions of the game. The kicker is that my cart has AGB-AZLE-USA but it is definately AZLP and not AZLE. VBA would not accept the snapshot for the AZLP save and therefore made my manual method even more applicable in this scenario. Note that it was successful yet again and this version actually did work with my zelda retail cart. If someone knows of some dumping hardware then I will see about producing a dump of my cart. I think that it may actually be appropriate to just consider it version 1.1. I don't really know. I just know that it was compatible with only one of 2 of the sps files that I got off of gamefaqs.com and they each had a different game id in the file.

Edit: Found out what the AZLP bit was about.

Box had AZL P AZLE USA on it. P = Player's Choice
 

shinji257

Well-Known Member
OP
Member
Joined
Apr 9, 2007
Messages
328
Trophies
1
Age
41
Website
www.elite-systems.org
XP
356
Country
United States
This has been checked on 4 different sps files and has held out. Header space can vary but it's end markers were consistent for identifying section breaks. It always has a header identifier of "SharkPortSave". I have successfully restored 3 out of 4 of them to an actual retail cart (not a flashcart). The only reason I wasn't able to do the one is because it wasn't for the same version of the cart that I had... the Zelda one. The save format may of been the same so I might of been able to hack it to work but I'd rather not go that far with it.

Positions in hex
Address
$0 - $3 -- Null bytes (00 hex)
$4 - $10 -- SharkPortSave (type identifier)
$11 - $18 -- Unknown
$19 - ?? --
Description -- Ends with HEX identifier 01 (note one of my saves had 2 of them -- may not be end marker first hit)
Cart ID (had game cart name and 4 char id) -- Ends with HEX 30 01 then 7 null (00) bytes

Next byte is start of game save
Last 4 bytes -- Unknown

8KB = 8192
32KB = 32768
64KB = 65535
etc.

Game save may repeat in file. It is unknown if the file has a sequence that identifies the save type within the file so it is best to determine that before extracting the file.

Known save types

Legend of Zelda: Link to the Past -- 8KB EEPROM
Final Fantasy 1 & 2: Dawn of Souls -- 32KB SRAM
Final Fantasy Tactics Advance -- 64KB FLASH

If anyone can help in identifying how it is embedded in the file then that would be great. I know that this will help in determining the save type. Until then I actually have to do a save game dump using the utility I linked above prior to writing back the new save file to the unit. I checked 18 additional save files and that for Final Fantasy Tactics Advance and found nothing consistent and nothing that differed from the other saves.

In the cases where the save type is smaller than 64KB then the save is repeated. If it still does not add up to 64KB then null bytes (either FF or 00) is used and then is followed by 4 seemingly random bytes.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SnowStormAkikaze @ SnowStormAkikaze: Jennifer Lopez's new robot movie ! Atlas sound fun XD