Author Topic: Hard Coding FF7 PSX  (Read 4729 times)

SymphoniC

  • *
  • Posts: 46
  • Mind hack.
    • View Profile
Hard Coding FF7 PSX
« on: 2011-07-27 03:02:53 »
What is the preferred method of hardcoding changes made to FF7's engine over to the actual files on disc for PSX? This is the first time I've tried assembly hacks on games in general, so I'm learning as I go. The Playstation doc was too vague about how to do this. So I figured I'd ask and get a quick answer. What tools will I need to assist me in accomplishing this?

Gemini

  • *
  • Posts: 260
  • Not learner's Guru
    • View Profile
    • Devil Hackers
Re: Hard Coding FF7 PSX
« Reply #1 on: 2011-07-27 06:43:14 »
The standard kit is supposed to be: LZSS and GZip compressors, armips (for assembly changes), and CDMage (for file replacement).

SymphoniC

  • *
  • Posts: 46
  • Mind hack.
    • View Profile
Re: Hard Coding FF7 PSX
« Reply #2 on: 2011-07-27 11:08:11 »
Thank you for your help, that's actually all I needed to know.

SymphoniC

  • *
  • Posts: 46
  • Mind hack.
    • View Profile
Re: Hard Coding FF7 PSX
« Reply #3 on: 2011-07-28 05:32:30 »
Does anyone have any information on the .X file format for FF7 PSX? The information I've found on these forums about those files are very limited. They aren't compressed are they? Is there a header? I'm pretty sure I've zero'd in on what needs to be done here. To be more specific, I'm looking for the instructions that dictate limits on HP/MP damage, and must do some calculations to find them (unless there's an easier way), I've already found them in the debugger, now I'm ready to modify the actual files to make the changes. I sure wish assembly hacking with PSX games was better documented.
« Last Edit: 2011-07-28 05:46:36 by SymphoniC »

Gemini

  • *
  • Posts: 260
  • Not learner's Guru
    • View Profile
    • Devil Hackers
Re: Hard Coding FF7 PSX
« Reply #4 on: 2011-07-28 06:49:28 »
The X format is a simple gzip file containing overlay code and with an 8 byte header. The first 4 bytes are used for decompression size, the last 4 indicate the decompression size+bss segment (which is an area used for zero-initialized values, so it's just a bunch of zeroes). Cut those 8 bytes, rename .x to .gz and decompress. When recompressing add again those 8 bytes using identical values and it will work.

As for locating the HP limit value: debugger, debugger, debugger.

SymphoniC

  • *
  • Posts: 46
  • Mind hack.
    • View Profile
Re: Hard Coding FF7 PSX
« Reply #5 on: 2011-07-28 07:45:26 »
I can't give you the kind of thanks more deserving for your reputation. If I would've known the stupid files were compressed, I would've had this taken care of a while ago. As far as finding the limits, I've found em on the game, I assume after I decompress the .x files, I can disassemble them and search for the instructions I'm looking for, then patch em, recompress, and reinsert with CDMAGE?

800ac03c ORI v1, zr, 0x270f       * HP Damage cap
800ac040 ORI a1, zr, 0x03e7     * MP Damage cap

8001b314 ORI v0, zr, 0x270f     *  HP Menu cap
8001b32c ORI v0, zr, 0x03e7    *  MP Menu cap

This is fun stuff for me, and quite addicting I must add. Thanks again Gemini.

Update : Yup, you were right (obviously). I found the codes (some of them anyways) I listed above earlier in batini.X.

I also tried gzip... we use gzip itself for this task right? But when I use gzip to recompress and depending on which version I use, the file turns out 7-10 bytes larger than the original (batini.x) and that's after I reinsert the 8 byte header. This is a problem. Is the compression algorithm to blame? I think it would change from version to version. I really would rather not mess with the LBA tables to get this working. I used the gzip that came with FF7dec.exe also in case anyone was going to end up suggesting that to me. Help would be greatly appreciated. As soon as I can get this patch recompressed the Battle damage part of it will be complete and I will upload this patch for everyone that uses PAL SCES-00867. I just need to know what to use to recompress this stuff.

UPDATE : HA forget it... problem solved! I guess most compression utilities by default add in the filename and a time stamp when compressing and stuff like that. Anyways the patch works great, the game runs with it fine and I want to release it now, but the digits do not display properly... ugh.
« Last Edit: 2011-07-28 13:22:58 by SymphoniC »