Phantasy Star IV - Two-tile Font

Kilyle

New member
After a long absence, I'm toying with hacking again. And I started to pick through Phantasy Star IV. I forget how I found a table for it before (made it? downloaded it?), but the table gives me some lists of like spells and stuff. But I can't find the script, so I opened the thing with Tile Layer Pro and tried to hunt down the font.

The font was very odd, so I had to change the ROM from .smd to .bin to de-interlace it first, but once I did that, the font was there nice and clean. However, it's done with tall letters - two tiles per letter. Makes for a nice font, but difficult hack (to me, as a beginner, anyway).

So the font looks like this:

02468
13579

...where 0 and 1 make up A, 2 and 3 make up B, etc. For simplicity, I'll use this version instead:

ABCDE
abcde

...where Aa stack together to make the letter "A", Bb stack together to make "B", etc.

Using the test word "ready" (biggest word in the first sentence of the game), I can think of three ways the program might use these.

First, it might encode thusly: RrEeAaDdYy, having both halves of the letters right next to each other.

Secondly, it might encode thusly: READYready, doing all the tops then all the bottoms (even more difficult to work with if it does the top of a whole line of text before it gets to the bottom of that line).

Thirdly, it might have the pairs encoded in the word-handling code, such that you pass it the line "ready" and it adds the "READY" top portion when it prints the line.

So... I'm stuck. I tried relative searching, but though I "found" a few words in the first sentence, the others weren't in the file, which makes me think that they're not encoded in straightforward fashion. I tried finding the hex values of top and bottom together, but that didn't work. I'm not sure what to do next.

Advice? (And, yes, "Phantasy Star IV is way too advanced for a beginner to hack" is advice that I'm willing to take.)
 
I'm no ROM hacking expert, but my guess would be that the third possibility is the most likely, since the text would unnecessarilly take up twice the space in the ROM otherwise, and programmers were more concerned about space limitations back then.

Not sure what to suggest though, sorry. Perhaps someone with more experience in text searching might have some ideas...
inversesignal.jpg
 
I haven't dealt with 16x8 or 16x16 fonts much, but the one game I'm working on that utilizes a 16x16 font doesn't store the text any differently than if it were an 8x8 font. One byte still equaled one font character, with a table somewhere else in the ROM presumably telling the game which tiles corresponded with which values.

It's unlikely that the game would treat the top and bottom rows of the characters as separate objects, though nothing is impossible. If anything, it might use 2byte values (ie. 2021=A, 2022=B, etc) My suggestion would be to try a basic relative search. If that doesn't uncover anything, then try a second search using wildcards between each value, in case the game does use 2 byte values.

Do the lists you said you found use a different font than the dialogue text?
 
may I also add that it may also be MTE compressed, which would explain why you can only "decode" small parts of sentences. *looks around for a table*

Ah yes here we go. Lookie here. This is a partial table of Phantasy Star IV. You see the byte values at the top? That's MTE. See those values at the bottom? That's also MTE. Note that this table is incomplete. What you would need to do is do a bit of hacking to find out what the rest of the byte values are.
 
Will do

...a 16x16 font doesn't store the text any differently than if it were an 8x8 font. One byte still equaled one font character, with a table somewhere else in the ROM presumably telling the game which tiles corresponded with which values.

Makes sense.

My suggestion would be to try a basic relative search. If that doesn't uncover anything, then try a second search using wildcards between each value, in case the game does use 2 byte values.

Do the lists you said you found use a different font than the dialogue text?

A basic relative search for "haz" (from "Chaz") turns up tons of occurrences. A basic search for "ready" turns up one at 002A-A712 (A=19, a=39, 0=08), a set of values I've gotten for a couple other words too. A search for "work" grants four possibilities, but none match the one for "ready." Ergo, MTE seems likely. I'm up for that challenge.

I haven't played the game in a while (guess I should :) ) but I believe the menus have a one-tile font, and that's probably the font used for all the names of monsters and items and such - hence, the list I found. But I didn't find that font in Tile Layer Pro. I'll go back and look more thoroughly.

I'm hoping to locate, eventually, the gorgeous cut-scene panels that the game uses. It would be nice to see where these are stored and mess with them, see if I couldn't come up with another picture instead, or like, change the colors on their clothes or something.

Anyway, more work for me to see. Thanks for the info so far!
 
Last edited:
If you don't find it in NES Genesis format, try 1BPP format. It's not uncommon for a game to store it's fonts in different formats.
 
Last edited:
1BPP

Yeah, that's how I found the big font to begin with, in 1BPP. The Genesis format gives me a bunch of miscellaneous colors that currently don't make any sense to me (I'm still getting used to hunting for graphics in that static-y mess).

ETA: Well, this is hilarious. I just found out how to make simple hacks by beginners next to impossible.

Apparently text in this game borrows from nearby text. Change a bit here or there and it changes tons. Here's how my research went:

Firstly, I converted the .smd to a .bin so as to de-interlace it. So if any of this is caused by not converting back, well... let me know if that's likely. I checked the first error against a reconverted .smd copy and they both gave the same error, so after that I just stuck to the .bin files.

Now, I found a spot near the beginning, where the NPC's start talking to your character. One says "Are you a hunter? Are you here to exterminate the monsters?" It's interesting because some words are obvious, but others have "too many codes" - "you" for example has "33-29-FF-37-2F" followed by "00" (space), and I'm not sure what the FF-37 are doing but the other three work out to the letters "y" "o" "u" so at first I thought maybe it was spacing or something. The words "exterminate" and "monsters" likewise are kinda odd in the code.

So I changed the first NPC's line to include "ABCabc012" and then some of the MTE's. Loaded it up and, oddly, it changed Chaz's line ("Oops! I wandered around and now I've gotten separated from Alys. I've got to find her...") to just "Bj" or something. This is the line he speaks before you get to move him to even go talk to anyone. So I'm thinking: "Odd."

Talk to the guy, and he spits out "Are ABbc0 (spaces) .PIR.P" then some garbage and capital letters and stuff for multiple lines. I figured I broke the code and had it reading stuff it wasn't supposed to. Probably those codes I thought weren't doing anything. Anyway, a little talking to nearby NPC's got other errors: One guy says "Oh! Penguin feed is stolen!" (a line from much later in the game) and the other says a line he doesn't normally say, that I guess is also from later in the game.

So I drop this test and start over. Just change "hunter" to the first six MTE's. This makes Chaz say his line as "Oops! I wand" and the game just freezes. Ooookay....

So let's keep this simple. I switch "n" and "u" in the word "hunter". Load it up again, run through the intro scene, get to this stage. The guy asks "Are you a hnuter?" which is fine.

But now this other guy says "hnuter" too ("You're the hnuter commissioned by the principal?") even though I didn't touch his text. Hrm.

This makes things more interesting.

I switch "hunter" to "hunetr" and get a wealth of information about how sweepingly this affects everything around it:

Chaz's opening line: "Oops! I wandtred around and now I'vt gotetn separaetd from Alys. I'vt got to find htr..."

The guy whose line I changed: "Are you a hunetr? Are you htre to exetrminaet tht monsetrs?"

Alys, my partner, gives her line as: "Chaz, whtre havt you been? C'mon, lee's go!" then "We havt to set tht principal and gee tht deeails about this commission."

Another NPC reels off: "But recently, ht's been aceing serangely. I think ht's scared of someehing."

Another: "...etlescope. Ah! Juse once, I would lovt to go to Dezolis!" and Chaz responds "It sounds like a dream. Travtling to anothtr planet."

...I think I'm going to change a few vowels around and see how funny an accent I get.

Anyway, this brings me to the conclusion that, for whatever reason, and by whatever manner, these sentences are interdependent. They are not, however, interdependent with the cut-scene that follows; I didn't go beyond it to see how much got messed up after that.

So... it seems like any small change is going to have a major impact, and that I'll have to be messing with pointers and all sorts of things. Advice please?
 
Last edited:
My initial assumption based on your description was that the text was compressed (ie. something a lot more in depth than simply MTE compression.)

However, the last part, where all you did was change the TE to ET and it affected every word that uses those letters makes me assume that you weren't hacking the TEXT but that you were hacking the MTE TABLE, (ie. the table that specifies which byte corresponds with which set of letters.)

What you need to do is some more searching to find out where the actual text is.
 
Crazy Edits

However, the last part, where all you did was change the TE to ET and it affected every word that uses those letters makes me assume that you weren't hacking the TEXT but that you were hacking the MTE TABLE, (ie. the table that specifies which byte corresponds with which set of letters.)

I will indeed search around a little more to see if I can make edits elsewhere with greater ease and less craziness.

However, I do not see "Are yo__u a hunter?" and "Thank...v.y.uch..!" as likely elements of the MTE Table. The section I am working with starts around 001D-F600; can you take a look at it?

BTW, I find it interesting that the switching of "t" and "e" didn't switch every occurrence of those letters, as evidenced in the words "someehing" and "etlescope" that come up. This seems connected to the MTE, as "me" and "le" and "e (spacing information)" are all likely MTE entries, so they wouldn't be altered by the MTE shift.
 
You never can tell how these things might work. Theoretically, the game you're working on shouldn't be overly retarded, considering it's the 4th game in the series and at least slightly likely to have an experienced team working on it, but I once worked on a game who's MTE system simply used the characters in the order that they appeared in the text, thus resulting in a compression scheme that was larger than the uncompressed text would have been.

A very important thing that needs to be taken into consideration when working on older games is that drugs were much more prevalent in the 80s than they are today. When something doesn't make sense, ask yourself this question: Would this make sense if I were smoking crack? Quite often, you'll discover that it does.
 
Aeons old, but I just remembered something : The game was translated from Japanese, being almost identical in most stuff. Now, considering that some sloppy work was done, you don't suppose that the extra bytes were for japanese characters and were used in conjuction with previous or after bytes in order to point to a special character... ?
 
Aeons old, but I just remembered something : The game was translated from Japanese, being almost identical in most stuff. Now, considering that some sloppy work was done, you don't suppose that the extra bytes were for japanese characters and were used in conjuction with previous or after bytes in order to point to a special character... ?

Entirely possible, but it's likely that said Japanese characters were changed to latin counterparts and if you tried to use them they would render as garbage.

Only way to find out is to make the edits yourself and see what it does.
 
with enough skill you could in theory reprogram those bytes for better compression. ;)

Sounds like inviting disaster XD
I saw your trhead because I am making a remake of the game on RPG Maker VX Ace ( http://www.psalgo.com/boards/phantasy-star-iv-remake-in-rpgmaker-vx-ace-vt11280.html ) and will be tackling the font thing sometime :p I am thinking to just remake the font .ttf file from scratch most probably but I will mess with this bridge when I decide to reach it ;)
 
Back
Top Bottom