2016-04-02

Borderlands: The Pre-Sequel's console: Adventures in frustration

I've spent the whole day with my face buried in a hex editor, silently cursing at nobody in particular.

All the Borderlands games so far have been built on top of UDK, which is basically just Unreal Engine 3. It's pretty outdated by this point, but the series' stylized aesthetic means that's not much of a problem. They're fun games, but that's not the point of this article.

We're trying to get the damn developer console working in Borderlands: The Pre-Sequel.

This is no easy task. This isn't something you can google and get an answer for. This is going to take hard work, determination, and a lot of swearing.

Part 1: Getting UDK's console to work🔗

This is the easiest part. All you need for this is internet access and basic google knowledge. Most games built on UDK don't bother making their own console, and just use UDK's built-in console for everything.

The de facto key to open a console in any game is the button to the left of 1 on your keyboard. It's different on nearly every keyboard layout so I won't even bother trying to list what it might be for you, but just know it's usually that one.

So, to begin our journey into this horrifying world, let's try pressing that button.

...Nothing happens. This is our first sample of the developers' distaste for people using their precious dev console. Luckily, this is a trivial fix, it's just changing a single config entry from unbound to Tilde:

[Engine.Console]:
ConsoleKey=Tilde

Restart the game, and try it again. Lo and behold, we have console access!

Part 2: Getting a useful console🔗

Yay! We have a dev console! Now we can do anything we want!

Nope. In our second great example of the Borderlands devs being huge jerks, it turns out any console command that isn't explicitly whitelisted (basically just stat fps, which shows your fps) gets prefixed with say before being run. So instead of getting cool stuff when you type cool commands, you just say it in the chat.

Oh well. At least now we can chat in singleplayer. Because that's useful. Yeah no okay let's fix this.

The way we fix this is... Okay, I'm going to make this explicit right here: I don't know. I have no idea how we stop this from happening. I have spent the entire day trying to figure this out. I'm just going to list out things I've been trying in hopes someone else will finish what I started.

Part 3: Wait, has someone managed to do this in Borderlands 2?🔗

When in doubt, try to build off of the work of others. After a bit of hunting around I managed to stumble across a post on the Borderlands 2 subreddit that seemed to be exactly what I want: A holy grail of information on the matter.

This is incredible. This is exactly what I needed. It doesn't work in Borderlands: The Pre-Sequel. sob

So, let's take a look at what works in BL2 and see if we can somehow translate it to BL:TPS.

The guide on reddit describes how to decompress various files, and how to hex edit the decompressed files. Here's what it instructs:

In order to stop say from being put in front of all commands, replace the hex values 1B E9 47 in Engine.upk with 1B A5 14. There are two occurrences that need to be replaced.

In order to grant "developer perks", replace the hex values 58 01 04 28 in WillowGame.upk with 58 01 04 27.

Huh. That actually works, for BL2 at least. It's a whole different story for The Pre-Sequel though. For starters there's no 1B E9 47 in Engine.upk.

But! There's good news! We have proof that, if The Pre-Sequel isn't wildly different from its seq-predecessor (heh), we can actually manage this! All we need is a few hexadecimal numbers!

Part 4: Oh god why are there so many numbers🔗

This is the part where we move out of the realm of google and neatness into something a lot messier. For example, I only found the first piece in the puzzle accidentally: Whilst writing out 1B E9 47 to search in my hex editor, I noticed that 1B E9 actually got a few results. In fact, there were two of the same match that stood out: 1B E9 41! Is this the magical first number we needed? If so, great!

So, now that we have our starting positions, we just have to figure out what we replace them with.

A few hours, and a lot of trial and error later🔗

NOTHING WORKS. Only the default value of 1B E9 41 lets you play the game. The rest just leave it crashing. 1B A5 14, the value used in the BL2 guide, doesn't work. Maybe transpose that by the same number that the starting value has been changed by? Nah, that doesn't work either. Just trying random numbers +-20 digits around it? Nope. I even had one moment where I thought I got the right value, but it turns out I just accidentally didn't save the hex editor.

Hm. Let's try a different approach: How many times does 1B A5 14 show up in BL2's Engine.upk?

Forty. Interesting. Hmm, let's search in The Pre-Sequel... Huh, barely any appearances of 1B A5 __. How about the numbers around it? A4... A6... A3... A2! Yes! There's a number in 1B A2 that shows up way more often than any other: 1B A2 14. That even has the same last byte as BL2's magic number! It shows up 38 times, which is close enough to 40 for me. Probably some things were added and removed.

Right, let's change all the occurrences of 1B E9 41 to our magic number and try loading the game again... Aaaand nothing. It just breaks again. Dammit.

Part 4: Subsection 5.2 Paragraph 8: [Internal screaming]🔗

Okay. Let's calm down. Maybe our assumptions were faulty; maybe 1B E9 41 isn't actually the number we need to replace, and the coincidence that led us to find it was just that, a coincidence.

Now what? Frankly, I have no idea. I don't even know how the author of that reddit post figured all this out; their account seems to be a throwaway and a google search of the various magic numbers they used only resulted in their reddit post. Looks like there'll be no chance of getting some help from whoever did this first.

This post is actually a minor bit of desperation. If anyone can help, I'd love to hear it.