Final Fantasy Hacktics

Modding => Tutorials and Learning => Topic started by: Vanya on July 28, 2008, 04:43:10 pm

Title: Hex editing Stuff & Basic Tutorial
Post by: Vanya on July 28, 2008, 04:43:10 pm
Some hex editing tools and files.

If anyone has any general questions about hex editing I guess you can ask them here. I may post a tutorial in the future as well.
Title:
Post by: Vanya on July 28, 2008, 04:45:45 pm
Some prelim stuff:

OK. The very first thing you'd need to know is how hexadecimal numbers work.

Decimal is the 10 digit system we normally use. (#1-9 and 0) "Hexa-" means 6. Therefore, a hexadecimal system used 10 + 6 digits to count.

These are the hexa decimal digits:
0 1 2 3 4 5 6 7 8 9 a b c d e f

This means that when you count in hex instead of going from 09 to 10 you'd count 09, 0a, 0b, 0c, 0d, 0e, 0f, and then would come 10. It's a little hard to count this way at first, but you get used to it. Some people can even do math in hex. For those of us that can't there's the windows calculator.

What this means to you for hex editing and programming is that the largest number you can fit into a single byte of info is FF. FF = 255. The first thing you'll notice about the data in a hex editor is that all the bytes are arranged in pairs of digits. Each pair is one byte. And for most simple hex editing you'll only be changing a byte or two.

For example, in the Super Mario World ROM, if you go to a certain address you can change the speed of the fireballs he throws when he gets a fire flower. This is a single byte that is normally like 05, but if you change it to 0a it'll go twice as fast. This is because 5x2=10, but 10 in hexadecimal is 0a.

The bin file is a file extracted from FFT. It contains a lot of data and text for the game's main menu. You can open any kind of file in a hex editor, this one just happens to be a binary file.

The table file is needed for text editing. The one I included is specifically for FFT. Different files will have different tables depending on how the text is encoded. What it does is tell the hex editor to represent certain values as a certain character. Open the table file in a text editor to see the format.

Important Things to Remember
> When you hex edit text remember that there could be several duplicate blocks of text in the file you're editing.

> Unless you're having problems with it, use FFTacText to make your changes. It's much easier.

> The 2 *problem* files in FFTacText are 'Battle.BIN' and 'World.BIN'. Until FFTacText is perfected you're better off hex editing these. EDIT: The newest version of FFTacText seems to have these problems solved.

More details
Quote
Quote00000000 || 88880680888806808888068088880680 || ................
00000010 || 94880680948806809488068094880680 || ................

The numbers all the way on the left, "00000000" and "00000010", are the starting addresses of those two lines.

Like in any number system the leading 0's don't have to be typed. Thus, the offset of the first byte of each of those lines is "0x0" & "0x10". The "0x" tells you that we're talking about an offset. OK?
Also, it can be written without the first 0 as in "x0" & "x10", but that isn't proper.

The value stored at 0x0 is "$88". The value stored at 0x1 is also "$88".
When writing a hex value you put a "$" in front of it or an "h" after it. Thus, $88 is the same as 88h, OK?

So when I tell you that the skill animation at 0x2ce13 is 012c00. It means that the three bytes at that address are 01, 2c, and 00.

In WinHex, you load battle.bin.
Click on the 'Search' menu.
Go down to 'Go To Offset' and click on it.
The dialogue box that pops up has a space marked 'File Position'. In that space type "2ce13" and press enter.
It will jump down to line '0002ce10' which will be highlighted, and the cursor will be on the number '01'.
Next to it will be '2c', and next to that is '00'.
Those 3 numbers are the skill animation value. If you change it to "$070000" the cure spell will make the caster use their weapon instead of the normal spellcast animation.
Try it and see.
Title:
Post by: trickstardude7 on July 29, 2008, 11:22:50 pm
Edit-

nevermind this is easy thank you for the links and table :D
Title:
Post by: Cheetah on July 29, 2008, 11:41:52 pm
Good info, thanks, I will hopefully use this in the future.
Title:
Post by: trickstardude7 on July 30, 2008, 12:16:07 am
hm im going to try to find a method for psp i have nitepr and can search text but i need some way to implement the fft table in or else everything looks weird and no text im going to keep messing around with it
Title:
Post by: Vanya on July 30, 2008, 12:27:26 am
The PSP files should be using the same character encoding as the PSX version. If not I have a program you can use to build a table file. I'll post it tomorrow.
Title:
Post by: trickstardude7 on July 30, 2008, 01:41:07 am
Quote from: "Vanya"The PSP files should be using the same character encoding as the PSX version. If not I have a program you can use to build a table file. I'll post it tomorrow.
o im dumb i was trying to edit in game i forgot to extract world.bin
Title:
Post by: Kenshin72 on July 30, 2008, 02:20:31 am
So using this I can change the 3 things I've always wanted to on the PSP?............*suspenseful pause*........................Skills Names, Job Names, and Skillset Names?
Title:
Post by: Vanya on July 30, 2008, 10:23:09 am
As long as the relevant files aren't compressed, you should be able to edit anything you want. Just remember that the text block has to remain the same length or shorter. Padding with zeros is fine, but don't spill over into the next section.

It is possible to use empty space to put in more text, BUT you'd have to mess with pointers. And messing with pointers isn't easy or fun.
Title:
Post by: Nagafen on July 30, 2008, 10:25:03 am
Heh... Thanks Vanya. I've pretty much edited all the Prologue text, and now I'm moving on to Chapter One. Thanks again.
Title:
Post by: Vanya on July 30, 2008, 10:28:50 am
:D
Title:
Post by: Nagafen on July 30, 2008, 10:33:40 am
By the by.. how do I edit the White text that says "Orbonne Monastry" at the beggining, just before Ovelia's "God" bit? Is their any known way?
Title:
Post by: Vanya on July 30, 2008, 10:41:40 am
I *think* those are actually graphics. Don't know where they are, though. I think there was some thread somewhere about it. do a search for it. =)
Title:
Post by: BeoulveBlack on July 30, 2008, 10:42:34 am
wow this is useful....thanks! now i can see my spelling errors as i go!

one more thing: how do i edit the fft table, so that when i edit text, i can see the punctuation?
Title:
Post by: Vanya on July 30, 2008, 10:49:03 am
Just use a text editor to open it. The format is simple.

if 0A is the value used to represent the number 2 you type an entry that reads:

0A=2

Each entry has to be on it's own line. You'll see how it's done when you open the file. Check out this site for info on the character mapping: http://gomtuu.org/fft/trans/

I suppose you could contact Gomtuu with more specific questions about the info on this site as he is a registered user here.

Also, I'm attaching a table file utility you guys might find useful.
Title:
Post by: Nagafen on July 30, 2008, 10:51:03 am
Ahh.. that's good. I was wondering why I coudn't see any of the punctuation.
Title:
Post by: Kenshin72 on July 30, 2008, 11:01:41 am
So Im trying to change a job name. Ramza's chapter two Squire class.
Um... How do I know which hex digit is which letter?
Title:
Post by: Vanya on July 30, 2008, 11:09:32 am
You have to load the table file above along with the file you want to edit. =)
Title:
Post by: Kenshin72 on July 30, 2008, 11:28:53 am
O!
Thats the one you provided in the first post?
Title:
Post by: Nagafen on July 30, 2008, 11:30:57 am
Yep. It helps a lot. Trsut me, it got me through most of the Story Text in the Prologue/Chapter One.
Title:
Post by: Kenshin72 on July 30, 2008, 11:49:00 am
I don't understand any of this...
I used the table to make sure I was typing the correct letters.
And I can't get Ramza's Chp2 Squire class to change.
I'm editing ATTACK.OUT which is prebattle screen text.
How am I screwing up?
Title:
Post by: Nagafen on July 30, 2008, 11:50:38 am
ATTACK.OUT? I'm sure I used WORLD.BIN.... Well, I'm sure if you just wanna edit Class text's couldn't you just use FFTactext?
Title:
Post by: Kenshin72 on July 30, 2008, 11:52:48 am
FFTacText doesn't work well on the PSP.
I think I might have figured out what I did wrong.... Not sure though.
Title:
Post by: Nagafen on July 30, 2008, 11:53:52 am
Oh, okay. I was using the PSX version, so my full apoligies, I didn't know you were using the PSP version.

Good Luck.
Title:
Post by: Vanya on July 30, 2008, 12:19:32 pm
Plus, don't forget that text for names and descriptions usually have to be edited in several different files and sometime in several locations within a file.
Title:
Post by: Kenshin72 on July 30, 2008, 12:27:14 pm
How do I tell what hex address is which thing?
Where in WORLD.BIN is Ramza's Chp2 Squire class? This is the PSP version.
Title:
Post by: Nagafen on July 30, 2008, 01:09:36 pm
Hmm.. that's tricky, seeing as how so many of the Classes of Squire exist... do they have descriptions? Seeing as how the descriptions of Squire for Ramza differentiate from chapter to chapter.
Title:
Post by: Kenshin72 on July 30, 2008, 01:22:37 pm
Should I be able to read letters in the program?
this is what mine looks like.
00000000I34 0C 5F 21 2AI ...O@^

The third column is always gibberish unless I type it in.
Title:
Post by: Nagafen on July 30, 2008, 01:29:32 pm
So you've tried text search?
Title:
Post by: Kenshin72 on July 30, 2008, 01:30:33 pm
Tried, don't understand it
Title:
Post by: Nagafen on July 30, 2008, 01:40:35 pm
So, what do you not understand? I might have an idea..
Title:
Post by: Kenshin72 on July 30, 2008, 01:46:31 pm
In this photo I've wrote Hero, I text search Hero and it brings me to the H on it. But whenever I search for Squire it says nothing matches.

And is that how the table supposed to look?
Title:
Post by: Nagafen on July 30, 2008, 01:55:46 pm
Woah. The table didn't look like that with the PSX version... I'll check ATTACK.OUT in a sec, after I've watched SentinalBades UNIT.editor...
Title:
Post by: Kenshin72 on July 30, 2008, 01:58:24 pm
This is PSP WORLD.BIN file
Title:
Post by: Nagafen on July 30, 2008, 02:05:41 pm
Ah that makes sense. It must be structured far differently. Sorry if I haven't been any help.
Title:
Post by: Vanya on July 30, 2008, 02:07:56 pm
Hold on Kenshin, I'll look into it.
Title:
Post by: Nagafen on July 30, 2008, 02:12:22 pm
See, he has an idea about it. I only have the PSX version.
Title:
Post by: Kenshin72 on July 30, 2008, 02:14:43 pm
Okay Okay, I looked at that link Vanya provided on page 1 about gomtuu's translation. I found where the Squire job is held in WORLD.BIN, can i search 4 0006F026 because I cant find it manually
Title:
Post by: Vanya on July 30, 2008, 02:19:02 pm
You can do that.

In the PSX version that text is at that address and is duplicated at AE930, but I don't find the right data at either of those addresses in the PSP version.
So, either the character encoding for the PSP is different, or the text doesn't exist in the file. Also, the file sizes are different for the two versions.

An interesting thing I found is that when I loaded the PSP's world.bin it displayed some text at the beginning while the standard ascii table was loaded.
Title:
Post by: Kenshin72 on July 30, 2008, 02:20:44 pm
What search function do i use
Title:
Post by: Vanya on July 30, 2008, 02:27:41 pm
I just did a basic text search, and then I used the 'Go to offset' thingy.
In most hex editors address = offset. So whenever you see something like 0x00025ad6 that's an offset. If you see something like h15, that is referring to a hex value.
Title:
Post by: Kenshin72 on July 31, 2008, 12:47:15 am
I can't find 0006F026, seems to skip right over it
Title:
Post by: Vanya on July 31, 2008, 01:53:40 am
It should take you to the line marked 6F020 and place the cursor on 6F026. If it isn't doing that then that's really strange.
Title:
Post by: Kenshin72 on July 31, 2008, 01:14:54 pm
Huzzah! Found it! PSP keeps it in WORLD.LZW!!!!!! Once I loaded that up all the 3rd column things were completely readable.
Now I have to edit it and see if it works!
Title:
Post by: Nagafen on July 31, 2008, 01:45:05 pm
Yay! Well done!
Title:
Post by: Kenshin72 on July 31, 2008, 02:33:39 pm
Its not working dammit
Title:
Post by: Vanya on July 31, 2008, 04:44:28 pm
Are you sure you're editing all instances in all files? Remember almost all the names and descriptions are duplicated at least once or more in multiple files.
Title:
Post by: Vanya on August 02, 2008, 08:51:17 am
Added some useful info under 'things to remember' on the second post.

If anyone needs any additional help feel free to ask! =)
Title:
Post by: Kenshin72 on August 17, 2008, 09:11:58 pm
I am using the PSX version.
I change every instance of Agrias to Beatrix but in-game it still says Agrias.
I extracted every file according to FFTacText that has Unit Names, and text searched for Agrias and changed them all, but still getting Agrias.

Help?
Title:
Post by: Vanya on August 18, 2008, 12:32:20 am
I haven't actually tried changing any character names yet, but I'll give it a try. I'll let you know what I find.
Title:
Post by: Lydyn on October 22, 2008, 03:37:06 pm
So, just to clarify here ... you can only edit BATTLE.BIN through Hex Editing? 'Cause I don't see it in FFTacText.
Title:
Post by: Vanya on October 22, 2008, 04:03:04 pm
It doesn't come up directly. If a certain text has duplicates in multiple files it will display them on the bottom of the window. this is the only place where you'll ever see Battle.bin. The most reliable way to edit it and world.bin is via hex. That is for the time being. =)
Title:
Post by: Lydyn on October 22, 2008, 05:29:03 pm
Didn't SentialBlade say you can edit WORLD.BIN as long as you keep the exact byte size, per section? I was going to try that, but then I noticed BATTLE.BIN didn't appear anywhere in FFTacText.
Title:
Post by: Vanya on October 22, 2008, 07:17:55 pm
Yeah, he did say that, but I've had it fail on me. I'm hard-headed, so I'll stick to hex. I'm comfy with it anyway. =)
Title:
Post by: BeoulveBlack on October 25, 2008, 01:25:15 pm
now i can do the final draft on my text w/o the job names and skill text being off by one job/skill
Title:
Post by: Zozma on October 25, 2008, 05:33:14 pm
(i think ill use the text editor for everything thats not involved with world.bin)

i tried keeping the same byte size and it still fucked up the world shops...
Title:
Post by: philsov on October 20, 2009, 04:34:12 pm
can the effect of some reactions/supports/movements be modified with the hex editor?  Or should I try and dive into ASM-world for those?  Primarily concerned with tweaking -- like Br up now granting 7 brave, for example, or Regenerator triggering a different status effect.

also, happy belated birthday topic!
Title:
Post by: LastingDawn on October 20, 2009, 05:27:11 pm
There has not been much research on these. Any eye openers on the subject is indeed welcome though.
Title:
Post by: philsov on October 20, 2009, 05:41:28 pm
personally speaking, my biggest obstacle is just getting my bearings.  would that level of info even BE in world.bin?
Title:
Post by: Cheetah on October 20, 2009, 06:44:19 pm
If you are looking at reaction abilities and such Philsov start with the asm hacks already done. Look at where they are and the surrounding code.
Title:
Post by: LastingDawn on October 20, 2009, 07:23:53 pm
More than likely not anywhere in World.bin, these are all matters of battle so almost definitely Battle.bin
Title:
Post by: philsov on October 21, 2009, 09:33:56 am
Quote from: "LastingDawn"More than likely not anywhere in World.bin, these are all matters of battle so almost definitely Battle.bin

Indeed.  Upon cheetah's suggestion all the support modifications are there, figure the reactions shouldn't be too far off...
Title:
Post by: Pickle Girl Fanboy on October 21, 2009, 06:41:39 pm
http://www.zophar.net/forums/showthread.php?t=13521 (http://www.zophar.net/forums/showthread.php?t=13521)

Look what I found.

http://mh-nexus.de/en/hxd/ (http://mh-nexus.de/en/hxd/)
This is the best free hex editor I have ever seen.