Reburn 3: The Game Plan

A place to discuss reverse engineering and modding Burnout 3: Takedown.
Post Reply
User avatar
MattKC
Site Admin
Posts: 323
Joined: Mon Aug 22, 2022 1:05 am
Contact:

Reburn 3: The Game Plan

Post by MattKC »

I've wanted a PC port of Burnout 3 for years.

Literally years. Ever since I replayed it as an adult in 2020, it's been on my mind. I can't think of any racing games that scratch that itch like Burnout 3. And if you suggest Burnout Paradise, I will permaban you from life in a video game.

Unfortunately Burnout Paradise seems to be all that EA want to give us, so it seems like to get what I want, we'll have to take this into our own hands.


But that raises the million dollar question... what can be done about it? Back in 2017, I remember wishing another game (Midnight Club III) had a PC port because I was travelling and PCSX2 ran like shit on my laptop, but at the time I couldn't think of any way to do it without a source code leak. It seemed like there was nothing that could be done. How can you make code for one system run on another?

Of course, since then, many decompilations and other reverse engineering efforts have taken center stage, and I now realize that code is much more malleable than I originally thought. So let's take a look at the possible approaches for doing what I want to do:
  • Decompilation - This is the big one. It's the sexiest approach, but also the most time-consuming by far. Decompilations take years, even for teams of reverse engineers, let alone a single person. But the end result is undeniable, a full recompilable source tree that you can do anything you want with. Arguably the most famous decompilation today, Super Mario 64, has brought us a ton of ports to everything from PC to PlayStation 3, and it's also brought us comprehensive mods like heavy optimizations that mean the game can achieve 60 FPS on the original N64 hardware, injections into other engines like Sonic Generations', and many more that I've probably forgotten about. If you have the source code, there's almost nothing you can't do. But what if you don't have years of time to commit to pulling a decompilation off?
  • Source Code Leak - Decompilations take years, but you know what doesn't take years? Just having the original source code EZ Clap

    ...Okay yeah, that was a joke. I am not suggesting we break into EA headquarters, grab the source, and run - and there are definitely legal concerns with using copyrighted source code (though, contrary to popular belief, concerns that also exist with decompilations in general).

    So if we don't want to spend years on a decomp or bet on the off chance the original code will get leaked (and worry about the potential legal complications of using it), what other options do we have?
  • Injection - This one's a little more abstract. Injection is a way of modifying compiled machine code at runtime by "injecting" or replacing parts of it with your own custom compiled machine code. Most of the time, you can write this custom code in a high level language like C/C++, and thanks to standardized calling conventions amongst compilers, the original executable can be made to call your code without skipping a beat or needing to be recompiled.

    Generally, injection doesn't help us with porting because the injected code has to be for the same processor architecture. Injecting compiled MIPS code into an N64 game just produces... more MIPS code, it's still not going to run on PC. But Burnout 3 (and Midnight Club III) are in a unique position because they were released on the original Xbox, a console that shares the x86 processor architecture common on PCs. The majority of that code will run just fine on a PC, and if we inject over the calls to Xbox-specific functions, in theory the whole game could be made to run on a regular PC.

    This is actually the main concept behind the Xbox "emulator" Cxbx, and is also an approach being used in a lot of upcoming PlayStation 4 emulators (a console that's also x86_64 based). It's also how some games have been ported from Android to the PS Vita (both of which share the ARM architecture). Unfortunately, Cxbx is known for having somewhat low overall compatibility, but in some ways that seems to be because they're trying to find code injections that are compatible with the entire Xbox library. If your focus is only on one single game (like the aforemention PS Vita wrappers/ports), you can inject whatever you want in order to make it work without worrying about breaking any other games.
With these approaches in mind, I think injection is going to be the fastest way to get us to a Burnout 3 PC port. In fact, injection can actually gradually lead into decompilation, as it's possible to just keep reverse engineering and injecting functions until the whole game is being injected, at which point you've made a decompilation (arguably, injection actually makes decompilation easier, because you can just decompile one function at a time and slot it back into the existing machine code rather than having to decompile the whole project in one go). So this may start as a simple PC port, but end up eventually with a full source tree.

So now that I've provided some background, here's what I'm calling "the game plan":
  1. Using Cxbx-Reloaded as a base, start injecting new functions to get the game working. Currently Cxbx-Reloaded can boot the game and run the menus, however no 3D graphics will display, which is, you know, kind of a problem with a 3D game. Using all the resources at my disposal, I will try to get these 3D graphics working. This code I write will likely be very specific to Burnout 3 and thus not re-mergeable into Cxbx's codebase, but I'll make all of this open source nonetheless.
  2. At that point, arguably the job will be done - the game will be running largely natively on a PC, with its Xbox system calls replaced with Windows equivalents. At this point we can start looking into modding; stuff like resolution patches, custom textures/tracks/vehicles, etc.
  3. Long-term, I also want to take the wrapper/injector approach a little further. The Xbox uses a variant of DirectX 8, which should be generally compatible with Windows XP. In recent years, Cxbx-Reloaded has been updated in a way that means it'll only run on WoW64 (i.e. 32-bit apps running on 64-bit Windows) so XP is more or less off the table. I'd like to get it running on there again.

    I also, as someone who's primarily a Linux user, would like to find a way to get the game running natively on Linux. At first, it'll probably be straightforward to get it to run through Wine, but it'd be nice to eventually not need Wine. It's quite likely the changes required to do this will deviate heavily from Cxbx's goals and codebase long-term, and of course that may happen anyway if we do end up producing a decompilation. I guess the point is, that's a long-term goal of mine through whichever means manage to happen first (decomp or custom injector rewrite).
I anticipate this to be a long process, but as far as step one goes, not super long, at least not compared to a full blown decompilation. I'm thinking months rather than years, and I think I'm ready to invest that kind of time into this.

I also have some tricks up my sleeve to speed up this process that I'll write about further down the line. If you're interested, stay tuned on the forum and on my live streams because I'll be posting all kinds of updates along the way!

And if you're interested in helping, likewise feel free to post about it somewhere on here.
User avatar
CrabHead
Posts: 198
Joined: Tue Dec 27, 2022 11:10 pm
Location: Poland
Contact:

Re: The Game Plan

Post by CrabHead »

You're doing god's work man. Since ages i wanted burnout 3 on PC. While i can't be a dev, (only a tester if so) i wish you all the luck on your journey.
KEKW Goin' Flipmode!
User avatar
Gordinator
Posts: 26
Joined: Wed Dec 28, 2022 2:04 pm
Location: Peshtonshire, United Kingdom
Contact:

Re: The Game Plan

Post by Gordinator »

I wish you luck. I don't have an OG Xbox and I would like to try Burnout 3 without an emulator. If an open-source Burnout 3 is released or something, I imagine adding intuitive PC controls would not be an issue. Again, good luck!
Signed, Gordinator.
User avatar
DrScoop
Posts: 7
Joined: Tue Mar 28, 2023 1:04 am

Re: The Game Plan

Post by DrScoop »

This is so wicked to hear. I don't have experience with C nor C++, but I know how to code from a high level point and would be down to help in whatever way I can on this project.
Post Reply