Modding => PSX FFT Hacking => Topic started by: BigManStan on April 19, 2016, 08:06:18 pm
Title: Status Effect Text
Post by: BigManStan on April 19, 2016, 08:06:18 pm
Hi all,
I was watching some Jot5 playthrough videos and saw a few neat things, such as the 'Defending' text when a character goes into Defend status, as well as new 'Doom' text instead of Death Sentence.
I was interested in implementing my own new status in place of Wall with status text to display. I was wondering if any of you could point me in the correct direction for making this display work. It looks like the text is stored in FRAME.BIN...but is there any area in the code responsible for loading particular slices out of FRAME.BIN? Did you Jot5 devs need to free up space in FRAME.BIN or is there unused areas in there that one could store new text?
Title: Re: Status Effect Text
Post by: 3lric on April 19, 2016, 09:49:15 pm
http://ffhacktics.com/wiki/EVENT/FRAME.BIN
We just changed Death Sentence to Doom and something else to Defending.
Title: Re: Status Effect Text
Post by: Choto on April 19, 2016, 10:59:41 pm
I don't think anybody's found the code for loading different parts of Frame.bin (maybe secondadvent?). However, if you look at 0xb7308 (referred to as misc. unit data), at offset 0x346 I think... there are a several sections for sprite display. These sections handle things like items a unit holds up, status bubbles, I think status text, the main sprite, weapon sprites. So you could maybe set a breakpoint in that section and backtrack to find where it refers to the VRAM or spritesheet load locations.
Lots of work and Frame.bin is already pretty packed unfortunately.
Title: Re: Status Effect Text
Post by: BigManStan on April 20, 2016, 02:52:28 am
Ok gotcha, I get how the Death Sentence -> Doom change would just be a swap in FRAME.BIN. But when you 'changed something else to Defending', then how did you get the game to display the new 'Defending' text from FRAME.BIN when a unit goes into Defend? AFAIK there is no text displayed when a unit Defends, so there's more at play here.
Title: Re: Status Effect Text
Post by: BigManStan on April 20, 2016, 08:06:41 pm
I am getting closer to figuring it out.
This looks promising:
8014cf68 - Status Image Data (4 bytes each, 0xc4 total) 0x00 - X Load Location 0x01 - Y Load Location 0x02 - Image Width 0x03 - Image Height
In battle, these seem to correspond to locations in FRAME.BIN. The offsets in game memory correspond to those on the FRAME.BIN if I just rip the image off of the wiki:
x offset in memory = bitmap x-offset x2 y-offset in memory is more tricky. I think for status images (ie not HP, MP,...) the top corner pixel of 'Poison' in FRAME.BIN corresponds to (0,0), so the y offset uses that as zero.
Edit: Ignore the stuff about y-offset. I'll post back when I actually have this all figured out.
Title: Re: Status Effect Text
Post by: BigManStan on April 26, 2016, 02:28:01 am
Ok, (if anyone cares), I've figured out how to manage status text images.
For displaying status images in the pre-attack display (targeting), there is a table that is to my knowledge undocumented, that relates all inflicted statuses to a position in the already documented Status Image Data table:
Status Image Table (ALREADY DOCUMENTED)
8014cf68 - Status Image Data (4 bytes each, 0xc4 total)
0x00 - X Load Location 0x01 - Y Load Location 0x02 - Image Width 0x03 - Image Height
Position
Offset
Image Data
0
0x00
"Dead"
1
0x04
"Undead"
2
0x08
"Petrify"
3
0x0c
"Invite"
4
0x10
"Darkness"
5
0x14
"Confusion"
6
0x18
"Silence"
7
0x1c
"Blood Suck"
8
0x20
"Oil"
9
0x24
"Float"
A
0x28
"Reraise"
B
0x2c
"Transparent"
C
0x30
"Berserk"
D
0x34
"Poison"
E
0x38
"Regen"
F
0x3c
"Protect"
10
0x40
"Shell"
11
0x44
"Haste"
12
0x48
"Slow"
13
0x4c
"Stop"
14
0x50
"Faith"
15
0x54
"Innocent"
16
0x58
"Charm"
17
0x5c
"Sleep"
18
0x60
"Don't Move"
19
0x64
"Don't Act"
1A
0x68
"Reflect"
1B
0x6c
"Death Sentence"
1C
0x70
"Stolen"
1D
0x74
"Broken"
1E
0x78
*Unused*
1F
0x7c
*Unused*
20
0x80
*Unused*
21
0x84
*Unused*
22
0x88
*Unused*
23
0x8c
*Unused*
24
0x90
"Quick"
25
0x94
"HP"
26
0x98
"MP"
27
0x9c
"CT"
28
0xa0
"Speed"
29
0xa4
"Brave"
2A
0xa8
"Faith"
2B
0xac
Sword Icon (PA)
2C
0xb0
Rod Icon (MA)
2D
0xb4
"Lv."
2E
0xb8
"GIL"
2F
0xbc
"Exp."
30
0xc0
"Frog"
Status link table, pre-attack display (UNDOCUMENTED)
RAM: 0x167920 BATTLE.BIN: 0x100920
Image data position 0xFF = No display (charging, jump, etc...)
Entry length: 1 byte each Total length: 0x30 bytes
The undocumented table relates all inflictable statuses to the image data. The statuses are organized by their order in the status bytes that appear in Battle Status data (and often elsewhere)
Position
Status
Position in Image Data Table
0
Blank
0xFF
1
Crystal
0xFF
2
Dead
0x00
3
Undead
0x01
4
Charging
0xFF
5
Jump
0xFF
6
Defending
0xFF
7
Performing
0xFF
8
Petrify
0x02
9
Invite
0x03
A
Darkness
0x04
B
Confusion
0x05
C
Silence
0x06
D
Blood Suck
0x07
E
Cursed
0xFF
F
Treasure
0xFF
10
Oil
0x08
11
Float
0x09
12
Reraise
0x0A
13
Transparent
0x0B
14
Berserk
0x0C
15
Chicken
0xFF
16
Frog
0x30
17
Critical
0xFF
18
Poison
0x0D
19
Regen
0x0E
1A
Protect
0x0F
1B
Shell
0x10
1C
Haste
0x11
1D
Slow
0x12
1E
Stop
0x13
1F
Wall
0xFF
20
Faith
0x14
21
Innocent
0x15
22
Charm
0x16
23
Sleep
0x17
24
Don't Move
0x18
25
Don't Act
0x19
26
Reflect
0x1A
27
Death Sentence
0x1B
The undocumented table is very similar to the next table. It relates all inflictable status to image data, but for post-action display on units affected by the status.
This table is documented, but wasn't 100% explained.
Status link table, post-attack display (PARTIALLY DOCUMENTED)
RAM: 0x93D18 BATTLE.BIN: 0x2CD18
Image data position 0x00 = No display (charging, jump, etc...)
Entry length: 1 byte each Total length: 0x30 bytes
This table relates all inflictable statuses to the image data. The statuses are organized by their order in the status bytes that appear in Battle Status data (and often elsewhere)
Position
Status
Position in Image Data Table
0
Blank
0x00
1
Crystal
0x00
2
Dead
0x00
3
Undead
0x01
4
Charging
0x00
5
Jump
0x00
6
Defending
0x00
7
Performing
0x00
8
Petrify
0x02
9
Invite
0x03
A
Darkness
0x04
B
Confusion
0x05
C
Silence
0x06
D
Blood Suck
0x07
E
Cursed
0x00
F
Treasure
0x00
10
Oil
0x08
11
Float
0x09
12
Reraise
0x0A
13
Transparent
0x0B
14
Berserk
0x0C
15
Chicken
0x00
16
Frog
0x00
17
Critical
0x00
18
Poison
0x0D
19
Regen
0x0E
1A
Protect
0x0F
1B
Shell
0x10
1C
Haste
0x11
1D
Slow
0x12
1E
Stop
0x13
1F
Wall
0x00
20
Faith
0x14
21
Innocent
0x15
22
Charm
0x16
23
Sleep
0x17
24
Don't Move
0x18
25
Don't Act
0x19
26
Reflect
0x1A
27
Death Sentence
0x1B
So by using these tables one can dictate what images a given status will display pre and post-attack.
Some of the justifications for using 2 different tables can be seen by examining the data, such as the 'Dead' status being displayed pre-attack, but not shown post-attack, as the unit falling to the ground is indication enough that it's dead!
EXAMPLE:
The game doesn't display the 'Frog' text when the status hits. (I never noticed until working on this) To get it to display, change the byte in the post attack table from 0x00 to the Frog image ID, 0x30.
Frog Text On-Hit Display Hack
<Patch name="Frog Text On-Hit Display"> <Description> Display "Frog" text image when a unit receives or loses Frog status. </Description>
Similarly, one can co-opt the Wall or Blank display status to display text by activating its bytes in both display link tables. To get it to display something new, set the Wall bytes to one of the Unused image IDs (0x1E-0x23), then edit that image ID's data to point to an edited section of FRAME.BIN of your choosing. (Coming Soon)
Title: Re: Status Effect Text
Post by: Xifanie on April 26, 2016, 03:13:57 am
Nice job! And no, I care; it's refreshing to see someone else than me discover stuff again. :p
Title: Re: Status Effect Text
Post by: BigManStan on April 27, 2016, 08:42:47 pm
Thanks, Xifanie! :) I figured out how to edit FRAME.BIN, so:
Putting it all together...
In order to generate some value, I tried to demo this against some stuff that is already in the community. I saw that Emmy and Pride have a 'Mist' hack that uses the Wall status, and that it is in use in the Monster Tactics mod. So as proof of concept I want to make the 'Mist' status also display 'Mist' text images.
1) Editing FRAME.BIN:
- http://ffhacktics.com/smf/index.php?topic=9584.msg186581#msg186581 -> This, this, this is the thread with accurate instructions on how to edit FRAME.BIN. A lot of fruitless searching finally led me to this page.
As per the previous posts, I am going to have one of the unused image data sections point at my new 'Mist' image in my modified FRAME.BIN. Instructions on how to get the proper values for the image data should be explained via these images:
Original FRAME.BIN: (https://docs.google.com/uc?id=0B37qM6R5jdhJQWZKclh2RDNRMWc)
2) Set status pointers to load our modified section of FRAME.BIN.
a) So, given the modified FRAME.BIN, we need to set an image data pointer to the bytes DB 48 11 08. We will use the first unused pointer in the table, at index 1E. b) We want the Wall status to load the 'Mist' image, so we need to modify the Wall byte in the 2 link tables from the previous post, setting its value to 1E. This will enable Mist display in both ability targeting and effect.
The following patch accomplishes this; it is simple and alters a grand total of 6(!) bytes.
<Patch name="Wall -> 'Mist' image status display"> <Description> Display "Mist" text images when targeting / inflicting Wall status. Requires modifications to FRAME.BIN. </Description>
<Location file="BATTLE_BIN" offset="2CD37"> 1E </Location>
<Location file="BATTLE_BIN" offset="10093F"> 1E </Location>
Attached is the modified copy of FRAME.BIN I used + patch file.
Title: Re: Status Effect Text
Post by: 3lric on April 27, 2016, 09:15:08 pm
Well done! I'm glad you got it figured out. I'll put this in the tutorial index after work tonight, so we can make sure it's easier for other people who wish to do the same.
Title: Re: Status Effect Text
Post by: Choto on April 28, 2016, 08:28:52 pm
Nice work BigStan, and thanks!
Title: Re: Status Effect Text
Post by: Emmy on April 28, 2016, 11:07:26 pm
Thank you for this. :) Your image and hack works in my mod. :)
Unfortunately wasn't able to successfully edit the image on my own for the other statuses. :( Tile Molester wasn't importing/exporting from bmp properly, and so it ended up offsetting by a few pixels always. Is there a trick to using Tile Molester?
Title: Re: Status Effect Text
Post by: BigManStan on May 02, 2016, 04:31:21 pm
Great; glad it worked!
For editing, I used Paint as well; the import and export BMP functions worked great for me. I did my editing in Paint, I selected existing letters in the exported .bmp and copied/pasted them into the free space, trying to make the overlap between individual letters look the same as elsewhere in the file (adjacent letters usually share a border, 1px wide, and different letter combinations tend to share different amounts of border).
A few things that may help:
1) I followed Celdia's tutorial to the letter except for the palette offset and size, which I found a better set of inputs from another thread:
Palette Offset: 37056 Palette Size: 256
This gives the full range of palettes in FRAME.BIN; you can navigate between palettes using the triangle arrows at the bottom of the screen.
2) I am wondering if you were using the correct palette for export? If I interpreted the threads right, this is the only palette good for editing:
Hint: this is the only palette that has the brick background intact in the lower part of the image. The rest of the palettes will have this section garbled up.
I would switch to this palette in tilemolester, export it, edit it and reimport it. Switching between palettes would show my new text behaving same as the other text.
If it helps, I've attached the before and after exported .bmps that I used to modify FRAME.BIN in the 'Mist' hack.
**Note: none of the images displayed in these posts are good for editing; they are blown up 2x for readability. Only the stuff in the attachments are what I actually used to develop this hack.