Tamagotchi ROM Hacking
Did I ever use the Sega Saturn? Nope. Never owned one. Don’t know anyone who owns one. What on gods green earth possessed me to make a ROM hack of a Saturn game to English? In short, a very cute sonic tamagotchi and the impossibility of finding info about how to get it.
I knew it was possible to have a sega Saturn rom hack because I had seen a translation done for the revolutionary girl Utena dating sim. My experience with this game is also what first introduced me to the Saturn.
I decided to try the sega Saturn tamagotchi game out myself. I was intrigued by how little text there was. I knew some Japanese. I wondered if it would be easy to translate. There wasn’t a lot of dialogue. Most of it was really just menu text with images. I decided to give it a go.
Challenges
Step 1 was learning how to rom hack. I had done some work on the GameCube with TTYD, but that game was much more advanced. It was actually quite easy to hack the text because it had a file directory structure and the script was in text. You can open it in notepad++ and edit it yourself then repackage the game. It required little technical knowledge to make a text hack.
The sega Saturn game is not quite so forgiving. There are directories, but each one contains just compiled code with the text scattered throughout. You have to use a hexadecimal editor to make changes. This means that you have to figure out WHERE the text is to change it, and you have a very hard limit on how long it is.
And the text won’t appear nice and clear as おはよう. You need to determine what encoding is being used. If you are lucky it is shift jis. If not… god help you.
So how did it go?
Encoding
So yeah, not quite shift JIS.
I had no luck importing a shift jis table into a hex editor. This suggested a custom encoding was being used. But there was a chicken and egg question- how do I know where to look in the code without the table, and how do I find the table without finding text?
Salvation came in the form of repetition and memory dumps. This game has named characters. I named my character AAAAA and then dumped the memory at the time of name creation. I searched the dump for a repeated 5 byte sequence. And I got my first hand hold - it corresponded to shift jis.
Through this time consuming method, I was able to figure out the table used. The biggest difference to shift jis was that it did not use a 4 byte sequence for katakana. Instead it had a control code (40) that signaled “start and end katakana “. It was like parentheses for katakana. There was also an extra voicing character for characters like ご.
I had to struggle with hxd to have my table visible but once it worked, it was way easier to see what was going on.
I wrote a tool to translate text to and from the alternate encoding to make it easy to copy paste.
I also had to keep in mind a control code used for empty space and a control code that seemed to be the delimiter for strings. The latter puts a hard limit on how long the string can be since the game looks to where an address STARTS to get the text. So I can’t just scoot the delimiter over to get extra space because that messes up the next string. And of course removing the delimiter leads to text overflowing.
There were other codes I did not understand yet , especially ones related to color.
Step 1 was complete- get encoding.
Text Updating
Step 2 - find some text to alter.
ImHex has a search function but as mentioned above there were multiple files where text lived. Searching each one was tedious. A user told me of an incredible utility called byte search that could search the whole directory and return the file name and address of hits. Nice!
I found something - who knows what - and tested changing it to AAAA. I then had to learn how to repackage the game into an iso. Once I did that, I loaded the game and had success - AAAA!
I then took a step back. I wanted my translations to be consistent across the game. I also needed to take into account the space I had. I wanted to keep track of addresses in case I needed to return later for some reason.
I made a copy of the game into unedited state as a backup.
I then made a spreadsheet with the columns address, file, Japanese text, and translation. I played as much of the game as I could and noted where text appeared. I then Looked for the text in the files and filled the spreadsheet. This way I knew what the translations would be ahead of time.
I then began the tedious work of replacing the Japanese with English. Because Japanese text occupies fewer characters than English, I was very limited. For example, how do you say “discipline” in a 3 letter word? I was luckiest when something was in katakana or had lots of voicing marks because the control codes gave me a little more space to work with.
When a translation was complete, I would check the game to see it worked correctly. If it did, I checked it off in the spreadsheet.
The biggest challenge so far is the formatted text. There are color codes that are not quite clear to me. There are also control codes that seem to repeat text from earlier in the code. These are a challenge because I want to keep the original color but I cannot understand how color works yet. And the repeated ones I apparently cannot remove! Some other code forces it even if I remove what I think are the control codes. Understanding this behavior is critical to making a version of the game that looks good. Right now I have the English text squeezed in but it looks really stretched out and hard to see.
Once all the text is translated, the final challenge is replacing images that have Japanese text in them. This will be hard since my art programs are limited, but not a huge deal.
As such, my biggest issue right now is understanding the control codes for color and repetition.
This game is pretty easy to hack, all things considered. It was an excellent first project
I hope to release a patch for this game so it can become better documented and both tamagotchi and sonic fans can enjoy a new game.
Tools used
imhex - Hex editor
Yaba Sanshiro - emulator for testing
Sega Saturn Patcher - for putting the game back together and making the patch
Bytesearch