Reverse engineering cheat codes in Batman Begins (Playstation 2)

11 hours ago 2

It’s been 20 years since Batman Begins, the video game adaptation of the Christopher Nolan film, was released. That’s as good a time as any to check whether it has any hidden secrets.

Good news: it does! I found an “unlock everything” cheat code that works on all three console versions. Details on how I found it and everything it does are below.

Many games implement cheat codes like this: (1) When you press a button on the controller, record it in a buffer. (2) When the buffer reaches a certain length, check the buffer contents to see whether they match any special sequences. When I’m hunting for cheats, I look for evidence of this process.

I had the PS2 version of this game at hand, so I started by examining it. I used the PCSX2 emulation with RALibretro Memory Inspector to do my initial analysis. I located the input buffer for Batman Begins like this:

  • Load the title screen and don’t press any controller buttons.

  • Hit the Filter Once button for = Last Value a bunch of times.

  • Press a controller button.

  • Hit the Filter Once button for != Last Value one time.

The idea is to filter out all of the things that stay the same before pressing the button, then isolate the things that change after hitting the button. You can see that there’s one result: the address at 033aab50.

I use Ghidra with the Emotion Engine extension to analyze PS2 memory snapshots. That lets me trace references to memory addresses. 003aab50 is used by the function at 00124558 (NTSC-U version), which implements the cheat code check described above. Here’s some pseudocode:

if buffer_length == code_length: match = True for i in range(code_length): if buffer_data[i] != code_data[i]: match = False break if match: return CHEAT_FOUND

The array I’m calling code_data starts at 003aab10, and has the contents [0x4, 0x4, 0x1, 0x4000, 0x4, 0x4, 0x1, 0x400]. These correspond to the bit patterns associated with the buttons in the cheat sequence (Left is 0x4; Up is 0x1; Square is 0x400).

When the cheat is found, the function at 001a7938 is called to write the unlock data to the area where the game stores progress.

Matching the cheat code bit patterns to buttons gives us this sequence, which is entered at the title screen (or any of the menu screens):

  • PlayStation 2: Left, Left, Up, Square, Left, Left, Up, Square

  • Gamecube: Left, Left, Up, X, Left, Left, Up, X

  • Xbox: Left, Left, Up, X, Left, Left, Up, X

You’ll hear a sound effect if you got it right. After that, all of the Bonus menu items will be available:

Normally you can’t even select the Batmobile Bonus without unlocking it, but with the code entered you can play either the Mission or Time Attack modes straight away:

All of the Movie Footage clips will be available:

As will all of the Alternate Batsuits:

The Gallery of Fear will also be populated with all of the rogues:

It’s never too late to find old cheat codes. And to quote my friend Grant:

Bruce Wayne didn’t become Batman until he was 30

It doesn’t matter how old you are

There’s still time for a full blown dramatic goth phase

Which other 20+ year old games might be harboring secrets like this? Tell me your ideas in the comments.

Discussion about this post

Read Entire Article