Author Topic: A little (but not a whole lot of) progress with changing the PSX FF7 hand cursor  (Read 1201 times)

NERV Agent

  • Cool newbie
  • *
  • Posts: 88
  • Karma: 3
  • GOD'S IN HIS HEAVEN. ALL'S RIGHT WITH THE WORLD.
    • View Profile
Thanks to luksy, 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.

What's going on? How do I go about fixing this? Has anyone else modified the PSX hand cursor before, or am I the first one?

Anyway, it's late and I gotta sleep soon.

NERV Agent

  • Cool newbie
  • *
  • Posts: 88
  • Karma: 3
  • GOD'S IN HIS HEAVEN. ALL'S RIGHT WITH THE WORLD.
    • View Profile
I still haven't found a solution to this, but I thought I'd update the thread in the hopes that someone out there does know a solution.

The original “WINDOW.BIN” is 13,266 bytes. This “offset” version is 13,244 bytes. This is a 22 byte difference.

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.

Some help in figuring this out would be appreciated.

NERV Agent

  • Cool newbie
  • *
  • Posts: 88
  • Karma: 3
  • GOD'S IN HIS HEAVEN. ALL'S RIGHT WITH THE WORLD.
    • View Profile
Okay, 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). CDMage pads out the difference with zeroes.

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.

I'd really like to solve this confusing problem.

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: 2017-03-19 04:00:17 by NERV Agent »

Tsunamix

  • Freak
  • *
  • Posts: 614
  • Karma: 13
  • Check out my work - https://goo.gl/m4NFlm
    • View Profile
    • The home of Tsunamods
Is it not just a case of making the blue part transparent?  Never really worked with PS version but I have a lot of knowledge with textures and transparency in models for PC. It may be similar

On a side note whilst messing with these do you think its possible to change the menu aooeatence with that Tim file?
« Last Edit: 2017-03-19 04:43:25 by Tsunamix »

NERV Agent

  • Cool newbie
  • *
  • Posts: 88
  • Karma: 3
  • GOD'S IN HIS HEAVEN. ALL'S RIGHT WITH THE WORLD.
    • View Profile
You mean alter the CLUT so that "blue" becomes transparency? If that's the case, then I would not be able to see the "box" where the hand is located. I am trying to determine the exact pixel locations of the hand cursor graphics. Another way of saying it is, I am trying to find the exact "coordinate range" where the cursor graphics are in the ".TIM" file. I figure that doing a "flood fill" around the hand cursors will let me see the exact "box" that it is contained in when it loads up in the game.

"Aooeatence"? Do you mean "appearance"? I've been told that "WINDOW.BIN" is where the cursor graphics are stored along with other UI elements, and the other two subfiles contain the whole font and width tables.
« Last Edit: 2017-03-19 04:54:34 by NERV Agent »

Tsunamix

  • Freak
  • *
  • Posts: 614
  • Karma: 13
  • Check out my work - https://goo.gl/m4NFlm
    • View Profile
    • The home of Tsunamods
Would you not be able to leave the cursor where it is and remove the blue from around it using Photoshop or gimp?

Yeah the menu style blue design. I'd love to be able to customise that.

NERV Agent

  • Cool newbie
  • *
  • Posts: 88
  • Karma: 3
  • GOD'S IN HIS HEAVEN. ALL'S RIGHT WITH THE WORLD.
    • View Profile
The issue is not the blue color. I want to leave the blue color in to see where exactly that cursor sprite is located.

The issue is that the cursor is shifted over to one side. You should notice that the right side of the hand cursor is cutoff, and that cutoff side carries over to the left side.

Tsunamix

  • Freak
  • *
  • Posts: 614
  • Karma: 13
  • Check out my work - https://goo.gl/m4NFlm
    • View Profile
    • The home of Tsunamods
Aha. I get you now. Well from I know they work as tilemaps. There is a program you can get that will show you what uses what. Unsure of the name and how it works I just know toy can.

NERV Agent

  • Cool newbie
  • *
  • Posts: 88
  • Karma: 3
  • GOD'S IN HIS HEAVEN. ALL'S RIGHT WITH THE WORLD.
    • View Profile
Even if a tilemap program shows me the coordinates or what not, if I wanted to change the hand cursor in the future it would still be shifted over.

I'm guessing the shifting over is a side effect of the compression?

I'm starting to think that hacking the hand cursor might actually be impossible.

Kranmer

  • Freak
  • *
  • Posts: 767
  • Karma: 9
    • View Profile
OK so you just want to replace the Hand icon above your head with something else ? As long as what you are trying to replace it with is in the same colour palette it should work but the .TIM you posted seems corrupt (at least no normal TIM viewer or editor will open it so i recommend you try editing the TIM with something else) so i cant really look at it but i spent 5mins trying a few things and i replaced the cursor above clouds head with the buster sword icon as shown in this picture

seems easy enough with a working TIM file, but with your TIM file it was really messed up.
Also i read through some of your old posts and you really seem to be making a mountain out of a mole hill when inserting the graphics into WINDOW.BIN there is a MUCH MUCH easier way to do it, lasyan's Tool Hack7 has a WINDOW.BIN tool that allows it to extract and reinsert the Graphics from WINDOW.BIN and also put it right back into a ISO for you so you don't have to mess around it does all the work for you, i really recommend it since you wont have to mess around with cdmage and stuff, you just open hack7 click Manage WINDOW.BIN then tell it where your ISO is (or extracted WINDOW.BIN if you don't want it editing your ISO) then click Extract Graphics and it will extract the TIM, and after editing click Insert Graphics and it will put it right back into the ISO for you, all the hard work done (I'm actually surprised no one else here mentioned this).

DLPB

  • No life
  • *
  • Posts: 8611
  • Karma: 235
  • This rose will never die This rose will never die
    • View Profile
I had no idea about that at all :P  Seems without you, we're all lost around here when it comes to certain modifications haha.

NERV Agent

  • Cool newbie
  • *
  • Posts: 88
  • Karma: 3
  • GOD'S IN HIS HEAVEN. ALL'S RIGHT WITH THE WORLD.
    • View Profile
This reply is way late because I've been inundated with IRL issues as of late and have had zero free time for hobbies.

OK so you just want to replace the Hand icon above your head with something else ? As long as what you are trying to replace it with is in the same colour palette it should work but the .TIM you posted seems corrupt (at least no normal TIM viewer or editor will open it so i recommend you try editing the TIM with something else) so i cant really look at it but i spent 5mins trying a few things and i replaced the cursor above clouds head with the buster sword icon as shown in this picture

seems easy enough with a working TIM file, but with your TIM file it was really messed up.

I use Tile Molester because it allows me to specify which sub-palette I want to load from the CLUT.

I know there is an Adobe Photoshop plugin that can handle ".TIM" files, but I don't have Photoshop.

I do know that GIMP has a plugin that can handle ".TIM" files, but I am not too familiar with using GIMP. Is there a way to specify which sub-palette to load from the CLUT in GIMP?

NERV Agent

  • Cool newbie
  • *
  • Posts: 88
  • Karma: 3
  • GOD'S IN HIS HEAVEN. ALL'S RIGHT WITH THE WORLD.
    • View Profile
I seem to have a streak of bad luck, as lasyan's Tool Hack7 has been giving me errors and BSoDs. I was able to extract the graphics from "WINDOW.BIN" with it though, but I can't put it back in since it gives me errors and blue screens. So I reinserted it using luksy's program and CDMage.

Anyway, I think I solved this shifting problem!

Tile Molester is primarily used for ROM hacking, not general graphics editing. 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 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:

« Last Edit: 2017-04-09 03:45:56 by NERV Agent »

NERV Agent

  • Cool newbie
  • *
  • Posts: 88
  • Karma: 3
  • GOD'S IN HIS HEAVEN. ALL'S RIGHT WITH THE WORLD.
    • View Profile
I am making this post for documentation purposes, in case this information can be useful for someone out there.

I've made some progress in analyzing the hand cursors, and discovered a few oddities.

However, first I need to get out of the way the issue of compression before proceeding.

Making seemingly simple changes to the ".TIM" file results in a larger "WINDOW.BIN" after compression (which is bad).

I couldn't figure out how to properly resize the CD image, but came up with a rudimentary MacGyver solution.

If my understanding is correct, the compression in FF7 works by "compacting" redundant data. So if there is a chunk of data that is pretty much a repetitive sequence, it can be "compacted".

Here is the US tile map, ripped with Tim2View with CLUT [02/16] loaded:



Here is the Japanese tile map, ripped with Tim2View with CLUT [02/16] loaded:



Notice how there are graphics in the US version that are not present in the Japanese version? And where the additional graphics in the US version are present, chunks of "gray blocks" are in the same place in the Japanese version instead. With the idea of redundant data being "compacted", I figure I can just "gray out" graphics in the US version that are not in the Japanese version. If Japanese gamers can play the game without these additional graphics, why can't we?

Here is the US tile map with the "grayed out" areas, ripped with Tim2View with CLUT [02/16] loaded:



After compressing into a new "WINDOW.BIN", the result is a smaller "WINDOW.BIN" which gives me some room to make edits.

I made a ".IPS" file that creates these blanks to save time for future work here.

And with that out of the way, here is the US tile map with the exact locations of the hand cursors marked, ripped with Tim2View with CLUT [02/16] loaded:



You can get my copy of this ".TIM" here, although I haven't tested this recently "cleaned up" version in game yet.

While analyzing these hand cursors, I noticed some strange things.

The field cursor seems normal.

The menu cursors are weird.

First off, I noticed that the cursors are not fully rendered all the time. For example, the hand cursor "pointing right" is 24 x 16 pixels, but at the opening "NEW GAME / Continue?" screen it is rendered as 21 x 16. But elsewhere in the game the full 24 x 16 pixels is rendered in the game, and sometimes it is rendered in a completely different resolution. The "jail cell bars" you see in that cursor mark columns of pixels that are omitted at the opening "NEW GAME / Continue?" screen, when I first noticed this oddity.

The next set of oddities are confusing and can be problematic for anyone who wants to completely change the graphics on this tile map.

The CLUT data observed in programs like Tim2View and Tile Molester are inconsistent with what is rendered.

In the hand cursors that are pointing left and right near the top right corner, I have replaced the transparency with blue. However, when this is rendered in game the blue color doesn't appear, but a transparent red tint in its place instead.

Here is a screenshot using an older ".TIM" I made (this one is "messy" so please excuse other messed up menu stuff) while analyzing this:



A similar discrepancy is present with the "red X" hand cursor.

Here is the US tile map with the exact locations of the hand cursors marked, ripped with Tim2View with CLUT [08/16] loaded:



I have replaced the transparency with gray, but when this is rendered in game it comes out as black. Here is a screenshot using the same ".TIM" from the gameplay screenshot from before:



I guess my next mission is to experiment with the CLUT.