Creating a table file (THT) for FCEUX Text Hooker

Before you begin, you need to make sure your operating system is capable of displaying and typing japanese text. (For win7, put the system locale to Japanese and have the Japanese Keyboard installed under the Region and Language section of Control Panel).

Next you will need a table creation utility or a text editor capable of Shift-JIS encoding, such as Notepad++. Several table generation programs like TaBuLar, NihilTBL, but I had trouble trying to get them to run on a modern OS. The one I used here is called Oriton, which I downloaded from romhacking.net.

Table files are just text files containing a list of hexadecimal numbers and the symbols they correspond to. The symbols can be a single character or a string of characters, it makes no difference. For our purposes, the hex codes will correspond to the background tile in the NES memory that holds the graphics for a particular character.

For example, a table file for the FDS boot screen, which starts with alphanumerics, would contain something like this (ellipses denote lines omitted for brevity):

"00=0
01=1
02=2
...
0A=A
0B=B
...
0F=F
10=G
11=H
..."

Not all codes need to be mapped. How do we determine which codes map to which characters? We use the PPU Viewer. Open the rom in FCEUX and get to a screen with the text we want to grab. Under the Debug menu, open PPU Viewer and you will see two Pattern Tables, at least one of which should hold the background tiles for the text. If the table appears all black, try right clicking a couple times to cycle through the palettes until you can see it. Once you can see the tiles, hover over the character and below the table it will say "Tile: $xx", where xx is the hex code of the tile.

Using Time Twist as an example, after pressing START at the title screen we are presented with a text menu with three options in hiragana. Looking at the PPU Viewer, we can see that the text tiles begin at $B0, starting with punctuation and numbers and then hiragana from $C0 to $FA. It might also be helpful to map the blank peach tile used as a space at $AC. You can then plug the characters into those slots in your table generator or start typing out the table file manually.

B0=”
B1=-
B2=「
B3=」
B4=..
B5=.
B6=1
B7=2
B8=3
B9=4
BA=5
BB=6
BC=7
BD=8
BE=9
BF=0
C0=あ
C1=い
C2=う
...

What makes FCEUX's THT file special is that it looks for codes matched to two specific strings, "tenten" and "maru". For Time Twist, these would be:

EE=tenten
EF=maru

These correspond to the ゙ and ゚ symbols, respectively, which Japanese uses to modify the pronunciation of certain characters. To save space, rather than storing separate tiles for は, ば, ぱ, etc. games will often store one tile for は, and a standalone tile for ゙ and display it either above or immediately following the character. FCEUX's text hooker will check the surrounding tiles and automatically combine them into a single character in the output.

Once you have all tiles mapped, save the table file with the extension.tht and it is ready to be loaded with FCEUX's Text Hooker.