News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: SNES SRM Checksums  (Read 5293 times)

Sinthet

  • Jr. Member
  • **
  • Posts: 44
  • A line of code a day keeps insanity away.
    • View Profile
    • I write stuff here, sometimes.
SNES SRM Checksums
« on: December 28, 2011, 10:42:26 am »
So, I haven't really been into ROMhacking for awhile. To get back into the swing of things, I decided to map out the SRM of Final Fantasy V. I've managed to map out quite a bit of it, but its useless unless I can calculate the correct checksums.

So, Does anyone know which one is needed for the SNES? They are stored as a 2-byte number, so my guess is some flavor or other of crc16. My question is, which one? There are several according to wikipedia.

Extra-Super-Special bonus points if someone knows a program that will calculate it for me, that runs under Linux.

(I know it'll still take some playing around to find exactly what data it uses for the checksum, but I don't want to be using an incorrect version, because then I'll never find it!).

Thanks for your help guys!

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7067
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: SNES SRM Checksums
« Reply #1 on: December 28, 2011, 11:46:13 am »
SRAM checksums are usually game-specific.
Unless someone has already figured it out and posted the formula, you'd need to be able to trace the ASM code.
"My watch says 30 chickens" Google, 2018

Sinthet

  • Jr. Member
  • **
  • Posts: 44
  • A line of code a day keeps insanity away.
    • View Profile
    • I write stuff here, sometimes.
Re: SNES SRM Checksums
« Reply #2 on: December 28, 2011, 03:24:47 pm »
Ah... I've seen a couple of guides that specifically mention using the checksum 16 option in Hex Workshop, so I assumed it was ubiquitous. I was hoping not to have to dig through ASM code, but oh well.

Do you have any suggestions/recommendations for SNES debuggers? I'm probably going to go try to get Bsnes working, but if there's better ones that aren't available for Linux I can always use WINE or a virtual machine.

Thanks!

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7067
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: SNES SRM Checksums
« Reply #3 on: December 29, 2011, 11:20:45 am »
I use a tracer. Mostly I use Geiger/EvilPeer's SNES9X tracers. Turn on tracing just before the game reads the save files (such as right before opening the save/load screen) then turn it on after it becomes visible.
Then there should be a giant file with the logged code in the ROM's directory.
You'd need to look for where the game reads the SRAM (SRAM begins at address $70:000).
"My watch says 30 chickens" Google, 2018

Hiei-

  • Sr. Member
  • ****
  • Posts: 378
    • View Profile
Re: SNES SRM Checksums
« Reply #4 on: December 29, 2011, 06:44:26 pm »
A sram editor of Final Fantasy V already have high chances to exist, no?

At least, there are some save states editor (http://www.erick.guillen.com.mx/FFV_SS_Editor.htm) which might get you the same possibilites, then you just have to save the game with the in-game save method.

Except if you want to understand the way the srm works to do a srm editor for example, then my method won't be of any use.

Sinthet

  • Jr. Member
  • **
  • Posts: 44
  • A line of code a day keeps insanity away.
    • View Profile
    • I write stuff here, sometimes.
Re: SNES SRM Checksums
« Reply #5 on: December 29, 2011, 07:34:36 pm »
I don't think it exists, at least I couldn't find one with a couple of Google Searches. I'm also not particularly interested in actually editing stuff. I got into computers by doing some basic ROMhacking a long time ago, and recently it sparked my interest again. Mapping out FFV's SRAM and (hopefully) figuring out the checksum thing is my way of getting reacquainted, while also putting some new info out there.

@KingMike
Thanks, I can't get Bsnes to work no matter how hard I try (I've compiled multiple versions, no error messages, just refuses to start, I think its a problem with my laptop's configuration rather than bsnes). Amazingly, Geiger's Snes9x works almost flawlessly (and at full-speed!) despite being run non-natively.


samurai goroh

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
    • My page
Re: SNES SRM Checksums
« Reply #6 on: December 30, 2011, 11:19:29 am »
A sram editor of Final Fantasy V already have high chances to exist, no?

At least, there are some save states editor (http://www.erick.guillen.com.mx/FFV_SS_Editor.htm) which might get you the same possibilities, then you just have to save the game with the in-game save method.

Except if you want to understand the way the srm works to do a srm editor for example, then my method won't be of any use.
I would like to see more documents (or tools) for Final Fantasy V, as is one of my favorite RPG games.
BTW, the page you link (and the tool :P) is mine :)

I'm not sure if someone at slickness forum might help you out (never heard of anyone mentioning a thing about the SRAM), but at least they would be glad to see more people interested on hacking this game :)
I'm the best in the universe, remember that [F-zero X]

Sinthet

  • Jr. Member
  • **
  • Posts: 44
  • A line of code a day keeps insanity away.
    • View Profile
    • I write stuff here, sometimes.
Re: SNES SRM Checksums
« Reply #7 on: December 30, 2011, 02:05:21 pm »
Thanks for the link, I'll look around there.

I'm hoping I'll be able to reverse engineer the checksum algorithm without too much trouble, I'm fairly comfortable with x86 ASM, so hopefully it'll be more of a question of syntax moreso than anything else.

MottZilla

  • Jr. Member
  • **
  • Posts: 37
    • View Profile
Re: SNES SRM Checksums
« Reply #8 on: January 13, 2012, 01:25:51 pm »
Unfortunately I couldn't find the source code for my Final Fantasy 4 Wonderswan SRAM editor. CRC probably is not used. It is likely a 16bit checksum which may be byte or word related. The easiest way to determine is to just save two files in a row if it keeps track of the # of saves. This way all the data should be the same except that one field. You can compare the resulting data and use various checksum generators on them to quickly see if its just an 8bit checksum or 16bit. It might be slightly different just depending on their exact code so you might have to write something yourself. Too bad I don't have the source around since they may use the same method.

Edit:
I checked for you. It's a 16-bit checksum with carry. It's a function at $C2/F588. Holds the checksums in the upper part of SRAM too. Shouldn't be too hard to figure out generating your own checksums to modify data freely. Just change the data, $600 bytes, generate the 16bit LSB Adding Checksum with Carry, write it in the Checksum Storage at 1FF0,X.


January 19, 2012, 06:06:39 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
I compiled my notes into a document. Hopefully it will help you with whatever you are doing. http://www.romhacking.net/documents/627/
« Last Edit: January 19, 2012, 06:06:39 pm by MottZilla »