For the spritelist script, which metaphorically represents the eyes of the AI, requires precise information about all sprites in the game. In the game’s files, a sprite is referenced by a so-called pointer. To make the spritelist I need the pointers of all important sprites – and to do so, I am using tools made and used by ROM hackers.
In this blog, I will go over all important information on pointers, graphics editing methods and its respective tools.
Pointers
„A pointer is a string of hexadecimal numbers (usually 2 bytes) that tells the ROM to jump to a different place in the code. It is sort of like the GoTo command in Visual Basic, except not as easy as that. By changing the value of a pointer, you can change where the ROM looks for information, which can be very useful in hacking and translating games.“ – https://wiki.superfamicom.org/pointers
Simply put, a pointer does not execute code, it redirects the code’s flow.
Pointer tables
Old consoles had great limitations in terms of memory. To keep everything clean and small-sized, Nintendo used pointer tables in their games, which followed the main idea that any kind of data is only stored once. In that way, everything has an address and can be found / pointed at / referenced easily.
As shown in Figure 1, pointer tables can get very large and might look confusing at first glance – especially because the symbols on the right side often run into decoding problems. In this example table, which contains text information of the game Wizardry, we can see an example of these decoding problems in the very first line on the right side.
Also, obviously, the whole table contains only hexadecimal numbers. The main reason for that is again to save memory, since 2 hex symbols result in 1 byte of used memory.
Just in case, a quick explanation of the hexadecimal system: in decimal, we have 10 numbers while in hexadecimal, we have 16. The system is commonly used in the IT space, when binary (which is based on 2 numbers) becomes too hard to maintain. A quick overview of the three systems is shown in the table below.
Hexadecimal | Decimal | Binary |
00 | 0 | 0000 |
01 | 1 | 0001 |
02 | 2 | 0010 |
03 | 3 | 0011 |
04 | 4 | 0100 |
05 | 5 | 0101 |
06 | 6 | 0110 |
07 | 7 | 0111 |
08 | 8 | 1000 |
09 | 9 | 1001 |
0A | 10 | 1010 |
0B | 11 | 1011 |
0C | 12 | 1100 |
0D | 13 | 1101 |
0E | 14 | 1110 |
0F | 15 | 1111 |
11 | 16 | 0001 0000 |
… | … | … |
FF | 255 | 1111 1111 |
Sprite Editor
The first tool I tried for determining the graphics hex codes is a tool simply named ‚Sprite Editor‘. The program lists all sprites in the rom, but barely offers utilities for navigation. The main scoring point here is the direct editing of graphics, which does not fit my use case.
HxD + Lunar Address
HxD is a very popular ROM hacking tool. Once a ROM is opened, a pointer table is displayed, with detailed information about every piece of data, as shown in Figure 4. The program even offers utility features for analysis tasks.
Lunar Address is a supporting tool to HxD that helps with converting PC addresses into SNES LoROM addresses, which helps a lot with finding the right pointers within a table.
The tool is mainly used for text editing and also does not work for my use case.
YY-CHR
YY-CHR is a recommended tool for editing graphics, so I naturally tried it.
Right of the bat, I spotted a minor problem – the program was originally developed
in Japanese, so the menues run into decoding issues, as shown in Figure 6.
I managed to fix the issue by installing a locale emulator that simulates changes to my PC locale settings, rendering my PC setup Japanese and therefore change the decoding pattern of Windows (In summary; the real behind-the-scenes-magic is far more complicated). After doing so, the application is much easier to read, as shown in Figure 7.
After opening the Super Metroid ROM, I quickly found what I was looking for, as shown in Figure 8.
… Later I found that the YY-CHR tool also has an English version. I will take a closer look on that and other tools next time.