Author Topic: Checksum  (Read 8222 times)

Evil Peer

  • Guest
Checksum
« on: 2001-12-22 21:00:00 »
I'm interested in editing files for other Square games, and I was wondering if anyone knew if they all used a common checksum function.

I've looked at the source for both Griever and Jenova, but I don't know assembly well enough to make out what's going on in Griever, and Jenova's one letter variables are a little hard to follow.  I can sort of make out what's happening on each line, but I'm a little fuzzy on the bigger picture.

---Evil Peer

Ant

  • *
  • Posts: 402
    • View Profile
Checksum
« Reply #1 on: 2001-12-22 22:12:00 »
griever is written in c++ methinx

Sephiroth 3D

  • *
  • Posts: 1679
    • View Profile
    • ModCitizen 42
Checksum
« Reply #2 on: 2001-12-23 07:09:00 »
Ant's right. If you check Qhimm's Site, he even says they are built using "Visual Studio 6.0" which happens to have several languages, but it's generally known that Qhimm programs using C++.

Sephiroth 3D

"I don't understand..." "You don't have to understand." - Final Fantasy: The Spirits Within

Sephiroth 3D.com
[email protected]

Anonymous

  • Guest
Checksum
« Reply #3 on: 2001-12-23 10:37:00 »
Right, but the checksum routine is done in Assembler, or at least it looks to me like Assembler.

Evil Peer

  • Guest
Checksum
« Reply #4 on: 2001-12-23 15:26:00 »
The checksum part was (re)writen in assembler to opimize it, so it'd be faster.

---Evil Peer

ficedula

  • *
  • Posts: 2178
    • View Profile
    • http://www.ficedula.co.uk
Checksum
« Reply #5 on: 2001-12-23 19:41:00 »
Not as far as I can see...

Qhimm

  • Founder
  • *
  • Posts: 1996
    • View Profile
    • Qhimm.com
Checksum
« Reply #6 on: 2001-12-23 21:01:00 »
The checksum routine in Griever *is* made in assembler. There, should be no doubt about it now.

Darkness

  • *
  • Posts: 2181
    • View Profile
    • http://www.x0r.net
Checksum
« Reply #7 on: 2001-12-23 21:04:00 »
ohhhh you guys got told! :) can you program assembly in visual studio?

ficedula

  • *
  • Posts: 2178
    • View Profile
    • http://www.ficedula.co.uk
Checksum
« Reply #8 on: 2001-12-23 22:25:00 »
Really? Must've missed that.

And yes, of course you can program assembly in VS. Most powerful languages let you use inline assembler. It's hardly ever needed though; on modern CPU's there's *rarely* a need for it.

dagsverre

  • *
  • Posts: 323
    • View Profile
    • http://ffsf.cjb.net
Checksum
« Reply #9 on: 2001-12-24 08:47:00 »
In fact you'd be hard-pressed to optimize better than the compiler (except when using MMX and other extensions).

And about "powerful languages"...I guess you don't think C and C++ is powerful then because it does NOT allow it (except through compiler extensions that vary between compilers, and then you're not really dealing with C or C++ any longer). I think this is a good thing though.

(Going away for some days now so I won't reply more to this)

ficedula

  • *
  • Posts: 2178
    • View Profile
    • http://www.ficedula.co.uk
Checksum
« Reply #10 on: 2001-12-24 18:52:00 »
Well, so stuff varies between compilers; so do a lot of things in C++. I remember looking at the IOCCC entries, and some guys mentioned that their entries were specifically compiler-testers: they conformed perfectly to all the C++ specs but *no* compiler dealt with them properly, or sometimes even compiled them at all. So the fact that C++ has no "standard" way of using assembler doesn't mean it's not powerful ... no compiler conforms to the specs totally anyway, last time I heard. You often need compiler specific options with many languages, C++ included ... so what?

But yes, you often are hard pressed to optimise better than the compiler nowadays.

Evil Peer

  • Guest
Checksum
« Reply #11 on: 2001-12-28 18:13:00 »
It looks like both FF7 and FF8 use CRC-CCITT.  The polynomial corresponds to the 0x1021 you'll find in both Griever and Jenova.

Based on the assumption that all of their games use this polynomial, I am going to investigate some of their other games.

---Evil Peer

Qhimm

  • Founder
  • *
  • Posts: 1996
    • View Profile
    • Qhimm.com
Checksum
« Reply #12 on: 2001-12-29 22:06:00 »
There was something odd with FF8's checksum routine, something different from FF7. First I tried to use Jenova's checksum routine on FF8's save files, but with flawed results. Then I looked at FF8's code and made an updated version, but still nothing. In the end, I had to rewrite the routine from scratch to match FF8's system.

Now, the odd thing is that I ended up with the same routine I started with.  :-?

The SaiNt

  • *
  • Posts: 1300
    • View Profile
Checksum
« Reply #13 on: 2001-12-30 15:39:00 »
Strange...
In same did you mean same as in identical or alike?

Qhimm

  • Founder
  • *
  • Posts: 1996
    • View Profile
    • Qhimm.com
Checksum
« Reply #14 on: 2001-12-31 10:53:00 »
Very alike, as in I couldn't really find the difference from the one I started with, aside from the obvious fact that it worked.

Goku7

  • *
  • Posts: 1301
    • View Profile
Checksum
« Reply #15 on: 2002-01-01 03:15:00 »
Qhimm, I've got a wild guess.  Could it have something to do with the difference in file extensions?  I mean, when you tried using Jenova to open the FF8 save files, could the program have looked at the file extension, then said, "Uh, no, this won't work"?

Or would that even apply?  It sounds like you're mainly dealing with just the raw data, so I don't know if the file extension would have any influence on Jenova.

Qhimm

  • Founder
  • *
  • Posts: 1996
    • View Profile
    • Qhimm.com
Checksum
« Reply #16 on: 2002-01-02 20:56:00 »
I don't know how I should put this without being rude... I'm afraid the problem is at quite a higher level of technical thinking than you speak of.  :D

Joey

  • *
  • Posts: 1095
    • View Profile
Checksum
« Reply #17 on: 2002-01-02 22:53:00 »
Wild guess: Qhimm's savegame editor edits the savegames hexidecimally, right?

Evil Peer

  • Guest
Checksum
« Reply #18 on: 2002-01-02 23:28:00 »
Offhand, the only difference I can think of is which portions of the data are covered by the checksum.  FF7 and 8 checksumed different portions.

The game I'm currently investigating is Legend of Mana (I hate forging).  While I might be a bit off, my preliminary guess is that there are two (three?) checksums in the save file, but unlike FF8, they are different, covering different portions of data.

I might be wrong though, I'm still mapping all of the data to in game stats.  What's going to be really fun is trying to figure out if they checksum the data before they write it out to file, and then write it differently (most of the data is in reverse-byte-order).

--Evil Peer

Goku7

  • *
  • Posts: 1301
    • View Profile
Checksum
« Reply #19 on: 2002-01-03 01:05:00 »
Well, that would explain why Bleem! can't understand the way Legend of Mana and Final Fantasy IX saves the data to the "memory card" that it emulates.

It sounds like it's a "one size doesn't fit everybody" type of thing for Squaresoft games.

mirex

  • *
  • Posts: 1645
    • View Profile
    • http://mirex.mypage.sk
Checksum
« Reply #20 on: 2002-01-03 12:23:00 »
Hey guys, how do you create those checksum functions ? Do you trace through the game-code ?

Evil Peer

  • Guest
Checksum
« Reply #21 on: 2002-01-03 20:56:00 »
no, all checksum functions work pretty much the same.  They are all pretty much just binary division.  Its what you do with the results that can really mess things up.  That, or choosing a non-standard polynomial.

Do a search on google for checksum and tutorial, or something.  eventually, you'll come across a page that explains how it all works.

---Evil Peer

Evil Peer

  • Guest
Checksum
« Reply #22 on: 2002-01-04 16:28:00 »
I wrote a program that checks each possible window (of contiguous data) for a matching checksum value.  It completes a few thousand windows per second.  Of course, since each checksum value has several million windows (depending on the data size), it takes quite some time to check even one value.  Its checking 13 suspected values at home on my Athlon 1400 right now, I started it around 23:00 EST.  I'm hoping to have some sort of definitive answer when I get home tonight (on LoM).

---Evil Peer