DoujinStars
hilltopworks
hilltopworks

patreon


Reverse Engineering 1: Discovering a game's text storage

The first challenge in reverse engineering for a translation patch is finding out how a game is storing its text. Already, there are several different approaches to tackling this problem and your intuition as a programmer is really key here, as well as your luck. 

My first instinct was to check out the PlayStation's VRAM, the place where it stores all of its graphics. After all, the graphics that are being used to draw letters on screen must be in there somewhere, perhaps it can offer us some sort of hint? Luckily a tool exists that can visualize all of the graphics stored inside of a PlayStation save state, and here is what it gives us: 

https://i.imgur.com/DwusgFV.png 

Oh dear, what a mess.  On the left you can see what looks like the game, that's the image buffer. It's where the game assembles the image that it'll eventually output to the TV. Looking to the right you can see various textures and 2D graphics that the game will paint over the 3D polygons. But what's that to the upper right? It looks like it might be text. Enhance and zoom!:

https://i.imgur.com/yBONNUz.png 

Hey look, text! So here is where the game is pulling the graphics for all of its text. You can see a whole capitalized English alphabet as well as half the Japanese characters that the game uses, along with a bunch of icons and punctuation. You can also see what look like a set of darker characters behind them, but we'll get to that later. Now there's something very telling about this table of letters. Can you guess what it is? 

WARNING: SOMEWHAT TECHNICAL JARGON INCOMING

It's that the entire table has exactly 16 rows and 16 columns. That should set off any programmer's radar. Why? Well long story short, the game could be plugging in just 2 hexadecimal numbers (the X and Y coordinates of the letter it wants to find) for each letter it wants to find and saving as much storage space as possible. So in our table, for example, the letter "Z" would be found by using the number '32', because it is in the 4th column from the left and in the 3rd row from the top (hexadecimal digits start from 0, so you have to add 1 to each digit to get the column/row).

Well now I have a guess as to how text is being stored, but how do I test it? By converting text that's on screen to this binary format I've hypothesized, and searching the PlayStation's memory for it. Did I find any results? It turns out I was actually very, very close with my hypothesis, but very, VERY far away from being able to translate the game. We will get into all that and more in the next part of this series.

Reverse Engineering 1: Discovering a game's text storage

More Creators