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

Author Topic: SquareSoft continues to give me the finger.  (Read 1697 times)

NERV Agent

  • Restricted Access
  • Sr. Member
  • *
  • Posts: 497
  • Eva Unit 01
    • View Profile
    • Watch my anime shitposts on YouTube! Smell them, too!
SquareSoft continues to give me the finger.
« on: March 18, 2017, 11:12:46 pm »
Thanks to luksy at Qhimm.com, I was finally able to "edit" the PSX FF7 hand cursor, but not with total success.

I used Tile Molester to flood fill the area surrounding the field hand cursor (the one that points at the player's head), so I could see the box where the hand is located in.



Here is the ".TIM" file I modified:

https://www.mediafire.com/?a78wacii38dibir

I generated a new "WINDOW.BIN" using luksy's program.

The good part, the game no longer freezes (to my knowledge).

The bad part?



The hand cursors in the menu and field seem to be shifted. Also not seen in the picture, all the text is garbled in game.

The original “WINDOW.BIN” is 13,266 bytes. This “offset” version is 13,244 bytes. This is a 22 byte difference. (CDMage pads out the difference with zeroes.)

In the original version, the header entries are:
00 00 1F 8B 08
00 00 1F 8B 08
01 00 1F 8B 08

I made 2 edited versions. One has 22 bytes of 0s at the end of the first header. The other has 22 bytes of 0s before the second header--which is just adding zeroes to the end of the first compressed file.

The one with the 0s after the first header doesn’t even load after "Sony Computer Entertainment Presents". The one with the 0s before the second header end doesn’t load, either.

So I tried to make a ".ips" file (using Lunar IPS) that was supposed to repair this, but to no success.

A re-encoded "WINDOW.BIN" containing no changes somehow turns out to 13,187 bytes, but still seems to work in game as far as I know (I only got as far as getting off the train).

I decoded and re-encoded “WINDOW.BIN” with luksy’s program, to get the smaller yet functional version of that file.

Then, I made an “.ips” file that is supposed to restore the file to its normal state. The “.ips” file’s intent is to restore a smaller file back to its normal size.

“ORIGINAL UNMODIFIED” (target): Re-encoded “WINDOW.BIN”
“NEW MODIFIED” (containing desired changes): Original “WINDOW.BIN”

“WINDOW.BIN” just gets reverted to its original state after applying the patch, which is weird because the patch was only supposed contain the differences between the 2 files. My modifications should of remained, but that didn't happen.

What seemed like a supposedly simply edit has become a convoluted headache thanks to all this compression. I really want to figure this out, but admittedly this is infuriating to some degree. I'd give up, but you know....

"I mustn't run away. I mustn't run away. I mustn't run away. I mustn't run away. I mustn't run away."

March 19, 2017, 12:00:08 am - (Auto Merged - “FFFFFFUUUUUUUUUU-”)
UPDATE: I tried making the patch again, but with accounting for the padded zeroes that CDMage adds to the re-encoded file.

Same result as before.
« Last Edit: March 19, 2017, 12:58:23 am by NERV Agent »

NERV Agent

  • Restricted Access
  • Sr. Member
  • *
  • Posts: 497
  • Eva Unit 01
    • View Profile
    • Watch my anime shitposts on YouTube! Smell them, too!
Re: SquareSoft continues to give me the finger.
« Reply #1 on: April 08, 2017, 11:37:31 pm »
I think I might owe Bregalad an apology for ripping at him for that FF6 cursor hack. I had no idea that changing a cursor could be such a convoluted mess.

Anyway, I think I solved this shifting problem!

When Tile Molester loads a file, it makes ALL THE RAW DATA viewable and EDITABLE.



You see that "TV static" at the top of the image? I believe that is the header and CLUT data. So when I used the flood fill tool, I must of unwittingly altered this data.

What I did to fix this was create an “.ips” file that is supposed to restore headers back to their normal state.

I researched the header info and came across the following resources:

http://rveach.romhack.org/PSXInfo/tim.html

http://www.romhacking.net/documents/timgfx.txt

The headers and CLUTs are organized like this:

1.) 1st Header Block
2.) CLUT data
3.) 2nd Image Header Block

The CLUT data is "sandwiched" in-between 2 blocks of header data.

I intend to edit the CLUT at some point, so my ".ips" file should only revert the 1st and 2nd Header Blocks.

I extracted the ".TIM" file from "WINDOW.BIN" using lasyan's Tool Hack7. Then, I zeroed out portions of the header data in this file. I specifically zeroed out data as such:

The 1st Header Block is 20 bytes, so I zeroed out the first 20 bytes of the file.

Then I had to account for the CLUT. This ".TIM" file has 16 CLUTS, each with 16 colors each, so the CLUT data here is 512 bytes. I identify the 512 bytes after the first 20 bytes, as this is the CLUT data I wish to retain.

Right after the CLUT data is the 2nd Header Image Block, which is 12 bytes. I zero out those 12 bytes, and save this zeroed out file.

Then, I use Lunar IPS to make an ".ips" patch as such:

“ORIGINAL UNMODIFIED” (target): 0ed “.TIM” file.
“NEW MODIFIED” (containing desired changes): Original “.TIM” file.

Here it is: https://www.mediafire.com/?31svwkz7z1ppzbe

I applied it to that corrupted ".TIM" from my initial post. Here is the result: