EDITING TEXT IN A ROM

K

Kevin Logan

NEET
Sep 22, 2021
3,402
In this tutorial I will explain the methods and limitations of hacking text in a ROM. If you ever wanted to change the dialogue in a ROM to contain naughty words that would have prevented the game from being sold on shelves, then read on. Also, this will be the perfect opportunity to put your newfound knowledge of hex to “good” use.

The most important thing to keep in mind with text hacking (apart from remembering to back up your ROM before every change of course) is that there is no law governing how text is represented in a ROM. The way text is stored varies from game to game, which can make your life just a little more difficult. Sometimes you will get lucky, and the ROM you want to hack will have its text readily viewable in Translhextion’s ASCII panel. Other times, it will be obscured but easily viewable through some trickery by using “table files.” And, sadly, sometimes the text will be encrypted in such a way as to require a stratum of programming knowledge that is out of grasp for most of us. I will provide examples of each of these scenarios as well as some grief counseling.

It seems worth pointing out ahead of time, before any preconceptions fully take root, that typically you will not be able to replace a string of text with something longer than what was originally there. I know there are probably a few rare exceptions to this rule (the enemy names in the SNES version of Final Fight comes to mind) but for the most part you will have to work in the confines that the game’s programmers have set. Remember that almost nothing in these ROMs was intended to be edited after the fact by nerds in their underpants.

“Whatever. Tell me what the fuck to do.”

Fine.

Part 1: Editing Pure ASCII​

First I will give an example of hacking pure ASCII text in a ROM. This is the easiest kind of text hack you can do, but don’t always expect it to be possible. There are not a lot of NES games that have all of their text readily viewable in ASCII. I will explain how to work around this in part 2, but for now, let’s hack a ROM with some regular old ASCII.

Open up The Simpsons – Bart VS The Space Mutants in Translhextion.

“Dude, are you shitting me? That game fucking SUCKS! Can’t we hack a good game instead?”
Well, yeah, we could hack a more popular title, but for these examples I am trying to use ROMs that have not been done to death. The reason is because there is already a plethora of information out there on specifically how to hack text in Legend of Zelda and Mario Bros 3, or someone has probably already made a program that does it for you. Since the goal of these tutorials is to provide you with the toolset to hack other ROMs without relying on someone else’s dirty work, I will try to use unpopular examples whenever possible. You can thank me later when you decide you want to hack T&C Surf Design or something.

“Cut to the chase already! CHRIST!”

Alright!

bart01.png

We will start with something simple. In this game Bart can cycle through inventory items with the Select button and use them with the Start button. Let’s try changing the names of some of these items. The first item that appears in the menu is X-RAY SPECS. Go to Translhextion and search for “SPECS” in the Find window (hit Ctrl+F). Make sure the radio button for “Data Type” is set to “Text” if for some reason it is not already.

findspecs.jpg


Unless something fucked up, you should have found the location of the X-RAY SPECS text, as well as the names of the rest of the items available in the game.
foundspecs.gif


“Hey, just wait one cotton pickin’ minute here. Why is the hyphen in X-RAY shown as a dollar sign in Translhextion?”
I’m glad you asked! This is because while this game’s program can recognize the letters on their own, it has a different set of rules as to what bytes will represent punctuation such as the hyphen in “X-RAY.”

Take a look at the hex panel in conjunction with the ASCII panel.
dollarsign.gif


So it appears that when drawing text data on-screen, the game considers a byte with a value of 24 to be a hyphen symbol. The fact that it shows up as a dollar sign in the ASCII panel is irrelevant, as it is actually possible to change how Translhextion will represent bytes in ASCII. But that will be covered in Part 2 of this tutorial, so let’s stay focused on the task at hand.

Now we just have to replace the text “X-RAY SPECS” with something of equal or shorter length, taking care not to type too far and overwrite something that could be important to the game’s functionality. Maybe you should back your work up before fucking around with it too much! We have 11 characters to work with here. The X-RAY SPECS item has an effect that makes the screen look all brown and poo-like when you use it, so let’s act like five year olds and call it “FART-VISION”. In the ASCII panel, click on the first letter of “X-RAY SPECS” and type in “FART-VISION”. It will overwrite the old text automatically, because it would otherwise shift all of the data that comes after it over by a few bytes and break everything. This is why you have to work within the lengths of the original text. If you want to replace it with something shorter than the original, you can usually just make up for the unused characters with spaces, which is typically the byte 20.

fartvision1.gif


Great! Save your ROM (I hope you backed up your ROM before editing it) and load it up in an emulator, and we will see that…
bart02.png

…UH OH! We are forgetting something! The hyphen will not show up in game the way we want it to, because we are not playing by the game’s rules! When we hit the hyphen key, Translhextion inserted the byte 2D, which the game’s program interprets as an underscore. Let’s fix this mistake.

Click on the byte for the hyphen in the hex panel and manually type in 24. Make sure you are entering 24 into the hex panel and not the ASCII panel.
fartvision2.gif


Save and reload your ROM. Note that simply hitting the “reset” button in most emulators will not reflect changes you have made, as the emulator has whichever version of the ROM you told it to open stored in memory. When you make changes to the same ROM file you will have to open the ROM again.
bart03.png


Success! We have changed X-RAY SPECS into FART-VISION!

“Hang on, why didn’t we just type a dollar sign right into the ASCII panel? Are you just messing with our heads here?”
Because when entering special characters, the only reliable way to guarantee you will get what you want is to go with what the hex panel says. Yeah, I know, if you type a $ into the ASCII panel you wind up getting a 24 in the hex panel anyway, but this is a lazy way of going about it and will just result in bad habits. For the most part, you can trust what the hex panel says more than what the ASCII panel is telling you. Notice how many different kinds of bytes are represented in Translhextion as periods? Remember: the ASCII panel should mainly be used as a visual aid in conjunction with the hex panel. Type into it with extreme caution.

Before we segue into Part 2 of this tutorial, I want to use Bart VS The Space Mutants to demonstrate another aspect of text hacking. Sometimes you will come across text that will use line breaks, and perhaps you will want to enter your own text that does not fit into the confines of these lines breaks. Sometimes the location of these line breaks are fixed, and other times they can be moved to your liking. Thankfully, Bart VS The Space Mutants contains text with modifiable line breaks! Let’s check it out.

Near the start of the game, Bart can use a payphone to prank call Moe. He does this by jumping onto the payphone’s stool and using the “COIN” item. A lame little exchange of dialogue happens.
bart04.png

Find this text by searching for the word “TAVERN” in Translhextion. If you have been working along with this tutorial and it doesn’t find anything right away, you might have to select the “Up” radio button in the Find window, as this text is stored earlier in the ROM than the item names are.
tavern1.gif


Take a good look at the text and how it appears in the hex panel. Notice that after the period in “MOE’S TAVERN.” is the byte 0D (which is represented in ASCII as another period. This is what I mean by only trusting the hex panel!). Because this byte appears directly between the two lines of text we see in-game, we can probably assume it is the byte that the game takes to mean “put a line break here” when drawing the text on screen. Remember that we still cannot type more than what was originally there. In this case we have 27 characters to work with, so let’s try typing “LINE BREAKS ARE COOL SHIT!!” over this text. While this ROM is finnicky about hyphens, you can type exclamation points into it with no problems. Then, in the hex panel, replace the bytes for the spaces between “LINE” and “BREAKS” and again for “COOL” and “SHIT” with the line break byte 0D.
tavern2.gif


I hope to fuck you backed up your work. Now save, reload your ROM in the emulator, and try prank calling Moe again.
bart05.png


And there we have it! The indentation of the first line is the game’s own doing, so our work here was a success. Now let’s move on to the fabled Part 2 of this tutorial.
 
Haruhi Suzumiya

Haruhi Suzumiya

I am a cute cat, you are not :3
Jan 26, 2021
9,881
I have an irl friend who is into that, he used to change sprites and button inputs in smb.
very cool tutorial, i remember he was inspired from Super Mario Bros. Crossover
Super-Mario-Crossover-ArquivosdoWoo.jpg

that tutorial is great for rpg's and adventure games ig.
cool thread :cool:
 
Magonia

Magonia

Rapism cures Racism
Jan 2, 2022
7,133
In this tutorial I will explain the methods and limitations of hacking text in a ROM. If you ever wanted to change the dialogue in a ROM to contain naughty words that would have prevented the game from being sold on shelves, then read on. Also, this will be the perfect opportunity to put your newfound knowledge of hex to “good” use.

The most important thing to keep in mind with text hacking (apart from remembering to back up your ROM before every change of course) is that there is no law governing how text is represented in a ROM. The way text is stored varies from game to game, which can make your life just a little more difficult. Sometimes you will get lucky, and the ROM you want to hack will have its text readily viewable in Translhextion’s ASCII panel. Other times, it will be obscured but easily viewable through some trickery by using “table files.” And, sadly, sometimes the text will be encrypted in such a way as to require a stratum of programming knowledge that is out of grasp for most of us. I will provide examples of each of these scenarios as well as some grief counseling.

It seems worth pointing out ahead of time, before any preconceptions fully take root, that typically you will not be able to replace a string of text with something longer than what was originally there. I know there are probably a few rare exceptions to this rule (the enemy names in the SNES version of Final Fight comes to mind) but for the most part you will have to work in the confines that the game’s programmers have set. Remember that almost nothing in these ROMs was intended to be edited after the fact by nerds in their underpants.

“Whatever. Tell me what the fuck to do.”

Fine.

Part 1: Editing Pure ASCII​

First I will give an example of hacking pure ASCII text in a ROM. This is the easiest kind of text hack you can do, but don’t always expect it to be possible. There are not a lot of NES games that have all of their text readily viewable in ASCII. I will explain how to work around this in part 2, but for now, let’s hack a ROM with some regular old ASCII.

Open up The Simpsons – Bart VS The Space Mutants in Translhextion.

“Dude, are you shitting me? That game fucking SUCKS! Can’t we hack a good game instead?”
Well, yeah, we could hack a more popular title, but for these examples I am trying to use ROMs that have not been done to death. The reason is because there is already a plethora of information out there on specifically how to hack text in Legend of Zelda and Mario Bros 3, or someone has probably already made a program that does it for you. Since the goal of these tutorials is to provide you with the toolset to hack other ROMs without relying on someone else’s dirty work, I will try to use unpopular examples whenever possible. You can thank me later when you decide you want to hack T&C Surf Design or something.

“Cut to the chase already! CHRIST!”

Alright!

bart01.png

We will start with something simple. In this game Bart can cycle through inventory items with the Select button and use them with the Start button. Let’s try changing the names of some of these items. The first item that appears in the menu is X-RAY SPECS. Go to Translhextion and search for “SPECS” in the Find window (hit Ctrl+F). Make sure the radio button for “Data Type” is set to “Text” if for some reason it is not already.

findspecs.jpg


Unless something fucked up, you should have found the location of the X-RAY SPECS text, as well as the names of the rest of the items available in the game.
foundspecs.gif


“Hey, just wait one cotton pickin’ minute here. Why is the hyphen in X-RAY shown as a dollar sign in Translhextion?”
I’m glad you asked! This is because while this game’s program can recognize the letters on their own, it has a different set of rules as to what bytes will represent punctuation such as the hyphen in “X-RAY.”

Take a look at the hex panel in conjunction with the ASCII panel.
dollarsign.gif


So it appears that when drawing text data on-screen, the game considers a byte with a value of 24 to be a hyphen symbol. The fact that it shows up as a dollar sign in the ASCII panel is irrelevant, as it is actually possible to change how Translhextion will represent bytes in ASCII. But that will be covered in Part 2 of this tutorial, so let’s stay focused on the task at hand.

Now we just have to replace the text “X-RAY SPECS” with something of equal or shorter length, taking care not to type too far and overwrite something that could be important to the game’s functionality. Maybe you should back your work up before fucking around with it too much! We have 11 characters to work with here. The X-RAY SPECS item has an effect that makes the screen look all brown and poo-like when you use it, so let’s act like five year olds and call it “FART-VISION”. In the ASCII panel, click on the first letter of “X-RAY SPECS” and type in “FART-VISION”. It will overwrite the old text automatically, because it would otherwise shift all of the data that comes after it over by a few bytes and break everything. This is why you have to work within the lengths of the original text. If you want to replace it with something shorter than the original, you can usually just make up for the unused characters with spaces, which is typically the byte 20.

fartvision1.gif


Great! Save your ROM (I hope you backed up your ROM before editing it) and load it up in an emulator, and we will see that…
bart02.png

…UH OH! We are forgetting something! The hyphen will not show up in game the way we want it to, because we are not playing by the game’s rules! When we hit the hyphen key, Translhextion inserted the byte 2D, which the game’s program interprets as an underscore. Let’s fix this mistake.

Click on the byte for the hyphen in the hex panel and manually type in 24. Make sure you are entering 24 into the hex panel and not the ASCII panel.
fartvision2.gif


Save and reload your ROM. Note that simply hitting the “reset” button in most emulators will not reflect changes you have made, as the emulator has whichever version of the ROM you told it to open stored in memory. When you make changes to the same ROM file you will have to open the ROM again.
bart03.png


Success! We have changed X-RAY SPECS into FART-VISION!

“Hang on, why didn’t we just type a dollar sign right into the ASCII panel? Are you just messing with our heads here?”
Because when entering special characters, the only reliable way to guarantee you will get what you want is to go with what the hex panel says. Yeah, I know, if you type a $ into the ASCII panel you wind up getting a 24 in the hex panel anyway, but this is a lazy way of going about it and will just result in bad habits. For the most part, you can trust what the hex panel says more than what the ASCII panel is telling you. Notice how many different kinds of bytes are represented in Translhextion as periods? Remember: the ASCII panel should mainly be used as a visual aid in conjunction with the hex panel. Type into it with extreme caution.

Before we segue into Part 2 of this tutorial, I want to use Bart VS The Space Mutants to demonstrate another aspect of text hacking. Sometimes you will come across text that will use line breaks, and perhaps you will want to enter your own text that does not fit into the confines of these lines breaks. Sometimes the location of these line breaks are fixed, and other times they can be moved to your liking. Thankfully, Bart VS The Space Mutants contains text with modifiable line breaks! Let’s check it out.

Near the start of the game, Bart can use a payphone to prank call Moe. He does this by jumping onto the payphone’s stool and using the “COIN” item. A lame little exchange of dialogue happens.
bart04.png

Find this text by searching for the word “TAVERN” in Translhextion. If you have been working along with this tutorial and it doesn’t find anything right away, you might have to select the “Up” radio button in the Find window, as this text is stored earlier in the ROM than the item names are.
tavern1.gif


Take a good look at the text and how it appears in the hex panel. Notice that after the period in “MOE’S TAVERN.” is the byte 0D (which is represented in ASCII as another period. This is what I mean by only trusting the hex panel!). Because this byte appears directly between the two lines of text we see in-game, we can probably assume it is the byte that the game takes to mean “put a line break here” when drawing the text on screen. Remember that we still cannot type more than what was originally there. In this case we have 27 characters to work with, so let’s try typing “LINE BREAKS ARE COOL SHIT!!” over this text. While this ROM is finnicky about hyphens, you can type exclamation points into it with no problems. Then, in the hex panel, replace the bytes for the spaces between “LINE” and “BREAKS” and again for “COOL” and “SHIT” with the line break byte 0D.
tavern2.gif


I hope to fuck you backed up your work. Now save, reload your ROM in the emulator, and try prank calling Moe again.
bart05.png


And there we have it! The indentation of the first line is the game’s own doing, so our work here was a success. Now let’s move on to the fabled Part 2 of this tutorial.
holy mother of god I had that game
 
K

Kevin Logan

NEET
Sep 22, 2021
3,402

Part 2: Creating and Using Table Files​

You might come across a ROM where searching for a bit of text will turn up nothing. In such cases, you may need to create what is called a table file. Do not panic, because after reading this section of the tutorial, you will have another ace up your sleeve. Although this solution may not necessarily always work, it is worth attempting in most cases.

Load up the American version of Golgo 13 – Top Secret Episode in Translhextion, and again in your favorite NES emulator. Fast forward to the introduction screen.
goglo01.png

If you attempt to search for the word “LIBERTY” Translhextion will not be able to find anything.

“Well what fucking good is that?”

There is another kind of search that is possible in Translhextion. Do a relative search by pressing Ctrl+K or by selecting “Search Relative” from the Search menu. Type in “LIBERTY” again and see what comes up!
relative1.gif

Ah HAH! We have found the location of the word “LIBERTY” in the ROM!

“Hold up. How the fuck does that say “LIBERTY”? It just looks like a bunch of periods and an apostrophe!”

Good question. The reason that we were successful in doing a relative search for “LIBERTY” is because a relative search will try to find bytes that follow the relative sequence of whatever it is you are searching for.

“Huh? You lost me, dude.”
Fine, here’s a better explanation. Let’s take the first and last letters of LIBERTY. L is the 12th letter of the alphabet, and Y is the 25th. In the string of bytes that our relative search turned up (forget about the ASCII panel) we have 8B at the start start and 98 at the end. The difference between 12 and 25 is 13 (decimal), and the difference between 8B and 98 is 0D (hexadecimal for 13). If you remember how to count in hexadecimal, you will see what I mean. These bytes that we found follow the sequence of the alphabet, but we cannot search for them as plain text because our ASCII panel is not trained to think of 8B as being the letter L and 98 as the letter Y, unlike the program in Golgo 13.

“So what the hell do we do about that?”

We have to create a table file. This will force Translhextion to represent these bytes in the ASCII window in a way that us English speakers can understand. And it’s not even that hard to create, assuming you can count in hex!

A table file is simply a text file created in Notepad (or whatever equivalent you feel like using, but it must be a plain text file at any rate) with each line dedicated to deciphering one byte in hex. Start by typing in “8B=L” and working your way forward and backward from there. Make sure that you only have one equal sign per line, so the next line would be “8C=M” and then “8D=N” “8E=O” “8F=P” “90=Q” and so on. When you have worked your way to A and Z, your table file should look like this:
tbl1.gif

Save your table file with the extension .tbl (give it a descriptive name like golgo13.tbl) and load it into Translhextion by pressing Ctrl+T or by selecting Open Thingy Table from the Script menu. A small window called Table Toolbar will open up. Check the box that says “Thingy View Active.” Now look at the bytes that our relative search found.
relative2.gif

It looks like we have cracked the code! All of the letters in the game will now be visible and searchable by doing a normal search. That’s all well and good, but wouldn’t it be swell if it could decipher the spaces and numbers and other punctuation in the game? Look at your hex window again, and notice that where the space between each word should logically be is the byte FF. It is safe to assume that this is the space byte. Add “FF= ” to your table file (that is a blank space after the equal sign, to be clear).
relative3.gif

Now let’s experiment with getting the punctuation to work. By looking at how the intro text appears in-game, we can assume that the byte immediately after “LIBERTY” causes a comma to appear, and that the bytes after the word “MYSTERIOUSLY” make a period appear. The comma byte appears to be 9B and the period byte looks to be 9E. Hmm… Those two bytes are pretty close together. This is a clue. Looking at the table file we have created so far, the alphabet ends at 99. It wouldn’t be a stretch to guess that the bytes that follow 99 are reserved for punctuation.

“How the hell can we know for sure?”
We will have to do a little experiment! Select the byte that begins the line “OVER THE STATUE OF LIBERTY” and replace it with 9A 9B 9C 9D 9E 9F. You know what, take it a step further, and throw in all the bytes from A0 to AF and see what happens. It’s just an experiment after all. This should all fit on the first line of text with some room to spare, so just slap those bytes in there and see what happens. Oh, and if you care about any work you may have done to your ROM so far, back it up!

golgo02.png

Well, look at that! Looks like we found the rest of the punctuation and all of the numbers! Take the bytes we just discovered and add them to your table file.

Also for completion sake, the byte B0 creates the character Ü in Golgo 13. Here’s what the finished table file should look like:
tbl2.gif

Loading this finished table file will allow you to freely change all the dialogue you want in Golgo 13. However, you should take note at where the bytes for line breaks appear. We can deduce that the bytes FE 03 indicate where a line begins and ends. I can tell you ahead of time that unlike Bart VS The Space Mutants, you CANNOT control line breaks in this text by merely changing where FE 03 appears. Writing over those bytes will cause errors that will prevent text from appearing. So, work within those confines when you are editing text in this particular ROM. And as always, back up your work!
 
K

Kevin Logan

NEET
Sep 22, 2021
3,402

Part 3: When All Else Fails​

Sometimes, sadly, neither of the above methods will work. Every so often you will find a ROM you want to hack that will have some text that is nigh-impossible to hack. If I may, I would like to go back to the example of Bart VS The Space Mutants. While some text in that ROM, such as the item names, Moe’s dialogue, and the menu text can be edited without any special tricks, all of the opening credits text and the storyline text was impossible to determine even with the creation of a table file.

“Well that fucking bites, even though it IS a terrible game. What do you do in this situation?”

Sadly there is no single solution to this kind of road block, as no two games are entirely alike. In the case of the Bart VS The Space Mutants credits/story text, the programmers at Acclaim must have been smoking some serious crack. Dr. Floppy and I joined forces to solve this groovy mystery and it turns out that there is an entire text draw routine involved in the problem. To explain how we came to this conclusion would be worth a whole article in itself and would not be immediately helpful for the beginner level of hacking we are at in this tutorial. To make a long story short, the ROM was using a bizarre type of text compression that worked with nybbles, rather than whole bytes like in the hacking methods we just covered above. Acclaim had assigned 1 through D (excluding 3 which was used for spaces) to the more commonly used letters of the alphabet, which they determined to be EATNOIRHSLMC, and the E0-FC would be used for the rest of the letters and a handful of punctuation and numbers (with the exception of E3 which was used for line breaks). The compressed text itself was also stored in the graphics data, making it even more unintuitive to hunt down. So, if I wanted to say “FUCK THIS SHIT” I would have to enter “EAE1DEC3497A3A974” into the ROM. Pretty retarded.
 
Activity
So far there's no one here

Similar threads

Lord_hierophantūs
Replies
3
Views
294
Lord_hierophantūs
Lord_hierophantūs
クーロ
Replies
16
Views
159
RageSpike
RageSpike
parzurnacs
Replies
28
Views
1K
Unemployed
Unemployed
bigantennaemay1
Replies
8
Views
438
bigantennaemay1
bigantennaemay1
Top