Skip to content

About

Diddy Kong Racing PC / Dreamcast Port.

Resources

Stars

10 stars

Watchers

2 watching

Forks

Latest commit

 

History

2,113 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Diddy Kong Racing

Overworld Whale Bay Walrus Cove Hot Top Volcano

tldr for dreamcast

Put your Diddy Kong Racing US 1.0 ROM (.z64) in baseroms/, source your KallistiOS environ.sh, then run:

dreamcast/build.sh (add --cdi for a disc image)

It checks what it needs first: a KallistiOS toolchain, KOS's pvrtex utility (make -C $KOS_BASE/utils/pvrtex), the sh4zam addon, Python 3.10 or newer, and mkdcdisc for --cdi. It then initialises the submodules and runs make setup, make extract, make build_assets and make -f Makefile.dc, and leaves bin/dkracing.elf (and bin/dkracing.cdi).

Arguments after --cdi go to make -f Makefile.dc. The build we test and record with runs at 60 fps with anti-aliasing:

dreamcast/build.sh --cdi FSAA=1 FRAME_FIELDS=1

Other options (all in Makefile.dc): SHOW_FPS=0 hides the frame rate in the corner, DEMO_RACES_ONLY=1 shows the title sequence once and then only the demo races, in a loop, SWIRL_ORANGE=1 makes the boot screen's swirl orange instead of blue. The boot screen's chime is a recording the repository does not hold; point SWIRL_CHIME_LEFT and SWIRL_CHIME_RIGHT at 44.1 kHz 16-bit WAVs of your own (the left take plays, then the right one 0.15 s later; with only the left, it plays alone), or leave them out and the boot screen is silent. After changing options, rebuild with make -f Makefile.dc clean first.

Run it on a console with dcload-ip or dcload-serial (dc-tool-ip -t <address> -x bin/dkracing.elf), or burn or emulate bin/dkracing.cdi.

The Dreamcast build uses enDjinn's build system (third_party/enDjinn): Makefile.dc holds DKR's options and asset pipeline and includes enDjinn's base_link.mk, which compiles, links and makes the disc image with the settings in local.cfg.mk. Everything the port adds (PVR textures, scene bundles, AICAflow sound and music) is generated from your ROM during the build; none of it is in the repository.

Dreamcast audio uses the pinned AICAflow runtime submodule.

for n64:

make -j8 COMPILER=gcc

make -j8 COMPILER=ido NM=1

Linux port:

make build_assets

make -f Makefile.pc -j8

This repo contains a work-in-progress decompilation of Diddy Kong Racing for the N64. You will need to have a original copy of the ROM to extract the game's assets.

All versions are supported, and the US 1.0 version (SHA1 = 0cb115d8716dbbc2922fda38e533b9fe63bb9670) of the game is the default if not specified.

As of June 21, 2026, this is our current score:

    Decomp progress [us.v77]: 97.75%

    Documentation progress: 65.69%


Setup

Dependencies

Ubuntu / Debian based Linux distros

sudo apt install build-essential pkg-config git python3 python3-pip binutils-mips-linux-gnu python3-venv libpcre2-dev libpcre2-8-0

  • build-essential / pkg-config are helper packages needed for make.
  • git is used for version control.
  • Python 3.10 or newer is needed to run the build scripts. make -f Makefile.dc automatically prefers a suitable interpreter; override it with PYTHON=/path/to/python3 when necessary.
  • libpcre2-dev and libpcre2-8-0 are not technically required, but will speedup extracting/building some assets significantly.
  • gcc-mips-linux-gnu is optionally used if compiling NON_MATCHING with COMPILER=gcc
Arch based Linux distros

sudo pacman -Syu --needed base-devel pkgconf git python python-pip python-virtualenv pcre2 yay

For binutils you should install this package from the AUR: https://aur.archlinux.org/packages/mips64-elf-binutils

  • base-devel / pkgconf are helper packages needed for make.
  • git is used for version control.
  • python is needed to run python scripts
  • pcre2 is not technically required, but will speedup extracting/building some assets significantly.
  • yay is not required, but is useful for installing packages from the AUR like the binutils.
    • yay -Syu mips64-elf-binutils
MacOS
  1. Install homebrew from here: https://brew.sh/
  2. Install make and pcre2 using homebrew: brew install make pcre2
  3. When running make, you MUST use gmake not make
    • For example, instead of doing make setup you would use gmake setup.
Windows

Windows is not natively supported. We recommend using a linux distro under the Windows Subsystem for Linux (WSL)

Notes

  • gcc needs to be version 8.0 or higher.
  • make needs to be version 4.2 or higher.

Building

  1. Install the dependencies above for your system. Click on the text to reveal the instructions.
  2. Place the ROM file within the baseroms directory.
    a. The name of the ROM file does not matter. It will be detected automatically from an sha1 checksum.
  3. Grab tools: git submodule update --init --recursive
  4. Run make setup to install the IDO compiler, python venv, and packages required.
  5. Run make extract to run splat to extract all required files from the baserom.
  6. Run make in the main directory.
    a. Use the -jN argument to use N number of threads to speed up building. For example, if you have a system with 4 cores / 4 threads, you should do make -j4.

Note: If you are on MacOS, remember to use gmake instead of make!


Building other versions

To build other versions of the ROM, just specifcy the region and version in the make command. All examples are below:

Baserom REGION VERSION Command
US 1.0 US v77 make REGION=us VERSION=v77
PAL 1.0 PAL v77 make REGION=pal VERSION=v77
JPN 1.0 JPN v79 make REGION=jpn VERSION=v79
US 1.1 US v80 make REGION=us VERSION=v80
PAL 1.1 PAL v80 make REGION=pal VERSION=v80

Modding

If you are modifying the code in the repo, then you should add NON_MATCHING=1 to the make command.
Example: make NON_MATCHING=1 -j4

The NON_MATCHING define will include the functions that don't exactly match one-to-one, but should be no different functionality-wise. If you do notice any bugs that occur in a NON_MATCHING build that are not in the vanilla game, then please file an issue describing the bug. It would be helpful if you can track down which function is causing the bug, but that is not required.

Style Guide

The style guide for the project can be found here: https://docs.google.com/document/d/1euQf8nwynGcCZL1MfoMaLs-XRvx3ejjj8fIfykUZ-NQ

If you see variables/functions/structs/etc. that doesn't follow these rules, then file an issue and we'll try to fix them.

Scripts

There are some useful scripts that should be kept in mind when working on this repo.


./extract.sh <version>

This script will extract all the assets from a DKR ROM and place them into /assets/ folder according to the config file within the /extract-ver/ folder. The version parameter should either be us_1.0, us_1.1, eu_1.0, eu_1.1, or jp.

Example: ./extract.sh us_1.0


./diff.sh <function_name>

Compares the assembly output of a function from a built ROM to the base ROM. Useful for decompiling.

Example: ./diff.sh menu_init


./rename.sh <old_name> <new_name>

This script will rename an existing symbol, file name, and/or folder name within the repo with a new one.

Example: ./rename.sh D_A4001000 SP_IMEM


./score.sh

Prints out the current completion percentage of the decomp. You do need to have an OK build for this to work properly.

The scoring is split into 2 sections:

  1. Assembly to C Decompilation (Adventure One)
  2. Cleanup and Documentation (Adventure Two)

Show scores for Adventure One & Adventure Two: ./score.sh
Show score for Adventure One only: ./score.sh -a 1
Show score for Adventure Two only: ./score.sh -a 2
Show score for another version (default: us.v77): ./score.sh -v VERSION
Show score percentage summary: ./score.sh -s
Show score without libultra progress in Adventure One: ./score.sh --nolib
Show top files remaining (default: 10): ./score.sh -t TOP
Show treemap view in a file (default: treemap.html): ./score.sh --treemap TREEMAP

To make progress in Adventure 2, a function must be properly named (must not start with func_) and also include a doxygen comment above it.

For example:

/**
 * Returns 1 if Drumstick is available to use, or 0 if not.
 */
s32 is_drumstick_unlocked(void) {
    return gActiveMagicCodes & 2;
}

As of June 21, 2026, this is our current score:

 ======================================================
    ADVENTURE ONE (ASM -> C Decompilation) [us.v77]
 ------- 97.75% Complete (98.35% NON_MATCHING) --------
              # Decompiled functions: 1847
            # Handwritten ASM functions: 85
               # GLOBAL_ASM remaining: 5
              # NON_MATCHING functions: 3
           # NON_EQUIVALENT WIP functions: 2
 -------------------- Game Status ---------------------
       Balloons: 47/47, Keys: 4/4, Trophies: 4/5
         T.T. Amulets: 4/4, Wizpig Amulets: 4/4
 ------------------------------------------------------
 We are racing in the rematch against Wizpig. (Lap 2/3)
 ======================================================
         ADVENTURE TWO (Cleanup & Documentation)
 ------------------ 65.69% Complete -------------------
              # Documented functions: 1280
             # Undocumented remaining: 278
            # Functions named `func_*`: 144
           # Functions without comments: 278
 -------------------- Game Status ---------------------
       Balloons: 31/47, Keys: 3/4, Trophies: 3/5
         T.T. Amulets: 3/4, Wizpig Amulets: 3/4
 ------------------------------------------------------
      We are racing in Windmill Plains. (Lap 2/3)
 ======================================================

About

Diddy Kong Racing PC / Dreamcast Port.

Resources

Stars

10 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages