Relative Searcher 2.4 Tutorial by Griffin Knodle, a.k.a. Jair, 10/13/98 gknodle@trinity.edu http://fly.to/vale Contents -------- Getting Started Finding Text -- Simple Search Finding Text -- Search with an Unknown Value Finding Pointer Tables Terms of Use Disclaimer Getting Started --------------- You'll need: -a Zelda II: The Adventure of Link ROM * -Relative Searcher Put Relative Searcher (RS) and the ROM in the same directory. Run RS. When it asks for the name of the file to search, type "zelda2.nes" (or whatever it's called) and push return. Now bear with me, because this is tricky to explain. * I'm not willing to take the legal risk of providing ROMs on my site. If you go to http://www.altavista.digital.com/ and search for "nes rom zelda", you should find it without any trouble. Finding Text -- Simple Search ----------------------------- The old woman in the first town says, "RETURN THE CRYSTAL TO THE PALACE IN PARAPA." We're going to find that phrase in the ROM. So, all we have to do is search for the ASCII values, right? Nope. ROMs don't use the ASCII system to represent text. Capital A doesn't have to be represented by 65 -- it can be 112, 255, 0, or whatever. An ordinary search won't work, because we don't know the values. This is where a relative search comes in. No matter what value represents letter A, letters will relate to each other in the same way. That is, B is one greater than A, F is two greater than D, I is four less than M, etc. So no matter what value represents A in Zelda 2, the changes from one byte (letter) to the next will be the same. Here's a handy table to refer to when you're entering relative values: 1 A 2 B 3 C 4 D 5 E 6 F 7 G 8 H 9 I 10 J 11 K 12 L 13 M 14 N 15 O 16 P 17 Q 18 R 19 S 20 T 21 U 22 V 23 W 24 X 25 Y 26 Z So let's get back to Zelda 2. RS can search for the relative changes between each letter in "RETURN". When RS asks you to start entering values, enter "18" (R), "5" (E), and so on. R E T U R N 18 5 20 21 18 14 After you're done entering those six values, just hit return to indicate that you're done. RS will print out the five relative changes it's looking for (so we can check what's going on) and search the file. Each time it finds a match, it will print out that address in the file (in decimal and hexadecimal), so you can go there later in your favorite hex editor, Necrosaro's Thingy, or whatever you use to look at ROMs. What's this? We found two matches? That's OK, it just means that "RETURN" occurs twice in the script. (The other time is "RETURN OF GANON", if you're wondering.) But let's see if we can narrow it down. Finding Text -- Search with an Unknown Value -------------------------------------------- Let's search for "RETURN THE". There's one problem here: We don't know how a space relates to the letters. But RS can handle that -- we just have to tell it to skip a byte when it's searching. If you type an asterisk ("*"), RS will know to skip that byte. So you're going to enter values for each letter, like you did before. But when you get to the space, just type a "*". You don't have to hit return after it. R E T U R N T H E 18 5 20 21 18 14 * 20 8 5 Ta-da! Only one match. Notice that RS searched for a change of +6 from byte 6 to byte 8 ("N" to "T"), skipping byte 7. We now know that "RETURN THE" is located at 59244 (E76C hex) in the ROM. This means two things. You can open the ROM in a hex editor, go to that location, and find out the exact values for each letter. Then you can use Necrosaro's Thingy, or another script editor, to change the game's text. ("GO AWAY! I LIKE GANON BETTER!") Finding Pointer Tables ---------------------- Now a much tougher problem. In some games, you can change lengths of messages however you like, and as long as you put the message-end character (varies from game to game) after each one, it'll work fine. However, other games (such as Zelda II) have pointer tables, which tell the ROM where each message begins. In those games, to change message lengths, you'll need to edit the pointer table. To find a pointer table, you need to know where each message starts. You'll need to spend some time looking at the ROM to figure out what the end-of-message character is. (In Zelda II, it's 255 (FF hex).) Now go through four or five messages in a row and copy down the starting address of each one. In Zelda II, the text block starts at E390, with "PLEASE LET ME HELP YOU. COME INSIDE." The next message starts at E3B5, the third at E3CE, the fourth at E3E2. Now, here's the tricky part. Each entry in the pointer table takes up two bytes. We only know every other byte. (Well, we could convert the file offsets to NES memory addresses, but that's annoying.) So we're going to search like this: 90h * B5 * CE * E2 Ta-da! There's your pointer table, at EFCE hex. Test it: Change byte EFCE from 80 hex to 81 hex. Now that one lady says "LEASE LET ME HELP YOU. COME INSIDE." Fun, huh? Hope this helped ya. Feel free to make additions or send me comments, suggestions, or further questions. TERMS OF USE ------------------- You may use, distribute, and modify this document freely. Only one restriction: These terms of use must stay the same. Oh, and I'd appreciate it if you credit me as the original author. DISCLAIMER ------------------- All games and systems mentioned are copyright their respective companies. I am not responsible for any damage you may cause to your computer or software by using this document. Owning a ROM is illegal unless you already own the cartridge. If there are runners on first and second and fewer than two outs, a fly ball hit to an infielder shall be ruled "caught" even if the infielder drops it. I think that about covers everything.