r0 for example is always zero, even if you try to set it to something else. If you've done any computer programming, registers are the - and this is really glossing over shit - assembly programming equivalent of variables. Registers are tiny bits of onboard storage. pSX even lets you modify stuff right in there if you want - though I found it easier to modify the savestate file and load it to see if my changes took effect - it's taking snapshots of memory directly, so things can change very fast in the running game.ģ. It's RAM, and it looks exactly like your savestate file. In the middle, we see a window marked Memory.
For budding computer programmers, this is what happens to your code when a compiler is done with it.Ģ. We can use that to determine - at a very low level - just what this thing is actually doing at given points in time.
Soon, it's going to be full of code (instructions) that the Playstation has in memory. On your left you see a blank disassembly window.
First of all, your mileage may vary on this screen shot but the menu marked "Window" will let you open or close these windows if you don't see them.ġ. Starting up the debugger reveals the following: If this seems like magic tech speak, just take it on faith for now and know that even though I can't speak very intelligently about the Playstation 1's innards, I still managed to ROM hack the stupid game. There's actually a lot of options in the pSX debugger that I didn't use - either because I didn't need them or because they crashed - but that's okay because we only want r3000: the Playstation's main CPU. As of pSX v1.13, it'll usually crash the program. R5900, vu0, or vu1 are all options for the Playstation 2. Again, PCSXTrace is apparently the way to go, but I couldn't get Policenauts working with it, so I used pSX with a debugger. But that's not our concern right now - we just want to know how the game stores the text when you're actually playing the stupid thing. "But I thought Policenauts stored English like that? We found it before in the cutscene." Yeah, but the problem is that it's such a big game, it actually stores the text in multiple formats for different scenes. that meant it wasn't being stored the same way in the actual ROM. But if BEYOND wasn't anywhere else in memory - except for when the game was ready to draw with it - what did that mean? The text had to be in memory somewhere.
Changing BEYOND in the savestate file didn't affect anything - because the game had already used that text to draw with I'd caught it when the game was done with it. The bad news is I can't find that anywhere else in memory, even with a savestate beforehand. Since it starts at 86418 in the file, I do some hex subtraction and find it's at 86168.
The header in this savestate is 2B0 long. Since I know that English is ASCII prepended with hex 80, it's an easy search. Sure enough, if I take a savestate with BEYOND onscreen, I can find it in the savestate file. We've even seen the exact same string before. The good news is that there's some English in the in-game text, right at the beginning - in the Prologue. So, last chapter, I showed you how Policenauts stores its English in general via one of the FMV cutscenes, but Marc had wanted some in-game text hacking, so let's do that. We're also gonna be taking a look at some assembly.
To be 100% honest, I don't really know how accurate that "first and last tool" business is, but I can say it's probably the most important piece of software you can employ on this ridiculous endeavor. In this chapter we're going introduce the first and last tool in your romhacking arsenal: the debugger, or "the debugging emulator".