Edit Text

Required:

Files:

  • Windhex
  • Super Mario Bros (Nes) rom

In this tutorial:

I'm going to assume that you already know what a hexadecimal is by now, and that you know how to replace one hexadecimal with another. This chapter will cover the basics behind finding and editing uncompressed text, and uncompressed text only. Games sometimes uses compression in order to save space (for example), and this usually makes it impossible to edit the text unless you decompress it first. An exeption is DTE which is quite easy to work with, but we still won't talk about it here.

Before we begin, let me point out that there's really no difference between editing text and "ordinary" hex code. Every character in a rom (no matter if it's the latin alphabet or japanese kana/kanji) is assigned to a specific hexadecimal. Thus, if you for example wanted to display the string "Hello" on screen, you'd have to insert the hexadecimals for H, e, l (twice) and o in the rom. Also, we will only type the text into space where the rom already go to locate text data. Outside the text-data area, these hexadecimals will function just like ordinary code.

This also means that for the reminder of this tutorial, we will only change the text that is already present in our rom. In other words, the text we input MUST be equal the lenght (or shorter) than the text we're replacing (i.e editing).

Of course, that's not to say that there isn't any way of fixing this problem. Pointers makes it possible to effectively utilize the limited space that has been given to us, but that isn't described here. You also have the option of writing your own compression schematics, or to expand the rom (but since this in no way can be defined as suitable for beginners, we won't cover it here).

Let us begin by editing some text in our Super Mario Bros rom. We shall attempt to edit Mario's name, displayed in the upper left corner.

Note that even though we're only working with stand-alone words and phrases for now, the same technique applies for menus, dialogue in RPGs etc. But since we've gotten used to editing our SMB rom by now, we'll stick with it for a little longer.

First of all, open up SMB in Windhex.

Using what you've learned in the hex-chapter, go to offset 765. To do so (in case you've forgotten), simply press Ctrl+G (or Search > Go to offset) and type 765 in the window that comes up (top field). This will bring you to a line of code looking like this:

Believe it or not, but the hexadecimals on this line, starting with 16 and ending with 18, actually says "MARIO". In case you don't understand, here's another picture showing what I mean:

In other words, "16" outputs "M" on screen, "0A" outputs an "A" and so on. Programmers sometimes assign the latin characters to a "matching" hexadecimal (0A=A, 0B=B, 0C=C etc), but this is in no way required.

Now that we have found the word MARIO (this game only uses the upper alphabet) it's time to change it. Since we don't know the hexadecimals that goes with the rest of the alphabet, we'll only use the five letters M, A, R, I and O for now. Of course, guessing the remaining characters won't be too difficult, but let's save this until it's time to create tablefiles.

For now, let's swap places with A and O. Put the flashing cursor on "0A", make sure that you do NOT have "Hex / Text Edit Mode" checked (and thus can type regular hexadecimals), and insert the hexadecimal "18" (i.e, type "18" on your keyboard) .

When you have done this, move forward to the "18" representing the "O" in "MARIO" and insert the hexadecimal "0A" there instead. When you're done, save your rom and load it in an emulator. If you did it right, our hero should now have a slightly different name.

PS. I know this is lame, but it's about the easiest example I can think of.

As you probably can imagine, typing text using hexadecimals only can be a royal pain, especially when you're translating/editing RPG's and other text-heavy titles. For that reason, some Hex editors (Windhex for example) support tablefiles as a means to assign given hexadecimal values to your keyboard rather then forcing you to type them in by hand.

From here on, we'll use tablefiles to simplify the text editing process. Because of that, you can now jump to the tablefiles section and come back later.

Edit text using table files

Finally back from the table-area are we? If that's not the case, let me point out that you'll need a working tablefile for Super mario Bros before continuing.

This is the final part of text editing, using the tablefile we created in the tablefiles-section. Let's close all the programs and windows up until now, and start from the beginning.

First, open Windhex, and load your Super Mario Bros rom.

Then load your table file.

Search for the word "MARIO", but do a regular search this time. This is done by clicking "Search > Text Search (Ctrl+F)". Type "MARIO" in the window that comes up, and click "Find".

This once agin bring us to the section of text we have been at before, but this time, all we had to do in order to find it was searching for the word "MARIO". And unlike a relative search, this time we only searched for the hexadecimals 16, 0A, 1B, 12, 18.

We won't edit "MARIO" any more, instead we'll change "GAME OVER" into something else. First, make sure that Hex / Edit-mode IS checked this time.

When it is, place the cursor on "G" in GAME OVER. Then, using only the upper part of the alphabet (Caps Lock recommended), type "OH CRAP!!" instead (note that I'm not surpassing the original amount of letters).

Then load your rom in an emulator, and start a new game. Run straight into the goomba three times (thus killing yourself). When you get a Game Over, it should now look something like this:

Congrats, you have managed to edit some text in Super Mario bros, only by typing on your keyboard withouth having to calculate every single hexadecimal. Feel free to go ahead and change the rest of the text as well. Typing "OH CRAP" in Super Mario Bros is no different from editing entire sentances in games like Dragonwarrior and the likes. Just remember to keep yourself within the original size of the text you're editing.

Back to Top

Copyright © 2007 Romhacks.net
Code, Layout and tutorials are Copyright © by Aeris130. Other material, such as programs, are copyright to their respective authors. We do NOT claim copyright regarding the actual information described in the tutorials, as the author didn't play any part in discovering them in the first place.