Also Zoinkity has given loads of useful info regarding N64 translation on the http://romhacking.net forum, which was a great help in getting me started.
I thought I would write a step by step tutorial on how I am making my Kira to Kaiketsu! 64 Tanteidan Japanese to English translation as I feel it will help others try to translate other N64 games, & some of the tips might even help on other systems =D
You can find my translation here: https://github.com/PeterLemon/N64/tree/ ... 0Tanteidan
bass assembler - Required for Big-Endian 16-bit text character remaping & ROM injection http://byuu.org/programming/bass
cen64 N64 emulator - Required for accurate N64 emulation testing http://cen64.com
nemu64 N64 emulator - Required for N64 memory dumping & analysis
HxD Hex Editor - Required for binary file Hex searching, & can search for differences between 2 binary files http://mh-nexus.de/en/hxd
Google Translate - Required for me to translate the Japanese to English!! https://translate.google.com/
Japanese character recognition - Required for me to find harder Japanese characters. http://appsv.ocrgrid.org/nhocr
1. Find the Character Encoding & make our Character Tables:
Every game stores the text somewhere in the game code, either compressed or uncompressed. If the text is stored uncompressed it is really easy to inject new text code directly into the ROM.
The hard part is finding how each game encodes its text. The N64 makes things harder by using 16-Bit encoding of text, I found a great tip that worked for this game, which is why I decided to start to translate it.
A) Run the game using NEMU, & get upto the Player Name selection screen in the game.
Do not write anything & take a dump of the memory: Plugins/Debug Dump memory... Start 0, End 400000, Filename: NEMURAMDUMPNONE.bin Format: RAW - Big endian (n64)
You should have a file called NEMURAMDUMPNONE.bin that is 4194304 bytes in length.
B) Run the game again using NEMU, & get upto the Player Name selection screen in the game.
Type "ABCDEF" using the English font & take a dump of the memory: Plugins/Debug Dump memory... Start 0, End 400000, Filename: NEMURAMDUMPABCDEF.bin Format: RAW - Big endian (n64)
You should have a file called NEMURAMDUMPABCDEF.bin that is 4194304 bytes in length.
C) Compare the files NEMURAMDUMPNONE.bin & NEMURAMDUMPABCDEF.bin using a Hex editor & the 1st difference you will see is the point at which the game writes the English characters "ABCDEF" into N64 memory.
NEMURAMDUMPABCDEF.bin Offset $E1AC0: A3 C1 A3 C2 A3 C3 A3 C4 A3 C5 A3 C6
From this I could see A = $A3C1, B = $A3C2, C = $A3C3, D = $A3C4, E = $A3C5, F = $A3C6
D) Using NEMU, if you go back to the Player Name selection screen and type any Japanese or Special characters. You will be able to see how all the characters are encoded: Plugins/Debug Memory... Address: E1AC0 (Remember to press Refresh!!)
You will also see that the 1st byte of the character encoding designates the Font e.g English uses $A3, Japanese uses $A4 & $A5, and Special characters are at $A1 etc...
You can now make font tables that match every character from these font screens, and represent the exact text encoding, I have done this here:
English characters ($A3): https://raw.githubusercontent.com/Peter ... ableA3.txt
Japanese Characters ($A4 & $A5): https://raw.githubusercontent.com/Peter ... ableA4.txt & https://raw.githubusercontent.com/Peter ... ableA5.txt
Special Characters ($A1): https://raw.githubusercontent.com/Peter ... ableA1.txt
2. Translation & English Text Injection:
Using the character tables we created, we can create new tables of any Japanese text that use the exact same font we could see in the Player Name selection screen, I used Google Translate todo my translations, I just copy and paste the Japanese text.
Once you have some text translated, you can do a Hex search on the Japanese text in the ROM, I'll use the "Yes", "No" option from the Boot Screen as an example:
The Japanese for "Yes" is 2 characters long "はい", & the text encoding in my new table looks like this:
Code: Select all
Yes $0E1E20 (ROM Offset) A4 CF A4 A4 00 00 00 00 | Original Japanese Hex # は # い # # | Original Japanese Text # Y # e # s # | New English Text A3 D9 A3 E5 A3 F3 00 00 | New English Hex
Also we can see on every text string we search for it uses $00 as an end of string special character.
So to inject the English text into the ROM, we just need to use the Hex editor, and at that address write the characters for "Yes" shown above, and you should see it appear =D
Here is the full Text Table for that whole Boot Screen section: https://raw.githubusercontent.com/Peter ... Screen.txt
3. English Text Injection using bass assembler:
bass is really great for translation work as it allows you to easily remap the ASCII set to new Big-Endian 16-Bit encoded characters, allowing you to make simple text injection macros.
You can find the bass source of my latest translation patch using all these features here: https://raw.githubusercontent.com/Peter ... teidan.asm
4. Dealing with other Japanese Characters:
Sooner or later you will come across Japanese text characters that you do not recognize from the tables you have made, and when you search for the characters that you do recognize in a word that contains one of these, you will find that there are other new font tables we need to make.
Also to get the correct UTF-8 character for translation, can be hard... I recommend using a Japanese character recognition engine, where you can just send a square picture of the character, & it will give you the top 5 characters, with #1 being the most likely character.
Here is an example image I made from the game to use with the http://appsv.ocrgrid.org/nhocr website:
Sometimes the more complex characters are not recognised, so scale the image up using gimp, and use the brush blur to get it into a more recognisable form:
Make you new Character Tables accordingly: All the tables I have made are here https://github.com/PeterLemon/N64/tree/ ... CharTables
5. Changing the Default Player Name Selection Font:
I wanted to make the default font English on the Player Name selection screen, luckily I spotted that each font is $12C bytes of binary data in the ROM so I just swapped each one accordingly:
This is the end of Part 1 of this tutorial for Part 2 I will try to show GFX ROM Injection for all those pesky Japanese only GFX tiles =D
I hope this helps anyone who wants todo similar stuff here are some more before & after screenshots of my translation work: