# Conker's Bad Fur Day decompilation > **Native Miyoo Mini Plus port of Conker's Bad Fur Day.** The game runs as a native ARM program on the > Miyoo Mini Plus (Onion / RedOnion), built from this decompilation: the N64's code is compiled for the > device, and the RSP's graphics and sound are done in software. It needs your own US ROM. > [How to install it](#how-to-install) is below. The decompilation is > [sholdee/conker-decomp](https://github.com/sholdee/conker-decomp) (MIT; see [LICENSE](LICENSE) and > [THIRD_PARTY.md](THIRD_PARTY.md)); parts come from [mkst/conker](https://github.com/mkst/conker), which > was published without a licence. This repository contains no ROM and nothing extracted from one. A decompilation of the CPU code of *Conker's Bad Fur Day* (Nintendo 64, US release). The build reproduces the original US ROM byte for byte, and it is fully linked: code and data can move. You need your own copy of the game to build it. This repository contains no ROM, no game assets and no game text. ## How to install **You need:** a Miyoo Mini Plus with Onion (RedOnion works too), and your own ROM of the **US version** of Conker's Bad Fur Day: one file of 64 MB whose name ends in `.z64`, `.v64` or `.n64`, with the SHA-1 `4cbadd3c4e0729dec46af64ad018050eada4f47a` (the program checks it and runs no other version). Nothing from the game is in the download; the port reads your ROM. **1. Download the game.** Get `Conker-miyoo.zip` from [Releases](../../releases) and unzip it. Inside are two folders, `App` and `Roms`, as in the miyoo64 games' downloads. **2. Copy it to your SD card.** Put the card in your computer and open it. Then: - drag the folder `ConkerNative` (in the zip's `App` folder) into the card's `App` folder; - drag the file `Conker's Bad Fur Day.port` (in the zip's `Roms/PORTS/Shortcuts` folder) into the card's `Roms/PORTS/Shortcuts` folder, where the other ports' shortcuts are. Nothing asks to replace anything, because both are new on the card. (Never replace the card's whole `App` or `Roms` folder: on a Mac, Finder's **Replace** would delete it with your other games and apps.) No `PORTS` folder in `Roms`? See "Don't see Ports?" below; until then the game starts from Apps. (Onion and RedOnion both list Ports from `Roms/PORTS/Shortcuts`.) **3. Add your ROM.** Copy your ROM file into the game's folder on the card, `App/ConkerNative`, next to `launch.sh`. Any file name works. (If you keep N64 ROMs in `Roms/N64` for the miyoo64 games, the game finds it there too.) **4. Play.** Put the card back in the Miyoo and turn it on. Open **Games > Ports**. Onion keeps its Ports list cached, so the new game is not listed yet: press **SELECT**, choose **Refresh roms**, and **Conker's Bad Fur Day** appears. Start it (it is under **Apps** as **Conker (native)** too, with no refresh needed; both start the same game). It checks your ROM first (a few seconds), then the game begins. Your save goes to `Conker/conker.eep` on the card. If a message comes up instead of the game, it found no ROM where it looks, or the ROM is not the US version: its SHA-1 must be `4cbadd3c4e0729dec46af64ad018050eada4f47a`. The message names the file it checked and where the ROM goes, and stays until you press a button (or for 10 seconds); then you are back in the menu. The same text, with more detail, is in `App/ConkerNative/conker.log` on the card, which also says why if the game ever goes back to the menu without a message. (The `._` files a Mac leaves beside the copied files do no harm; the game and Onion ignore them.) ## Controls The Mini Plus has no stick, so the d-pad is the N64 stick. | Miyoo | N64 | |---|---| | d-pad | stick, full push | | MENU held + d-pad | stick, half push (walking, careful steps) | | A | A | | B | B | | X | C-up | | Y | C-down | | L1 / R1 | C-left / C-right | | L2 | Z | | R2 | R | | SELECT | L | | START | START | | MENU, a tap | the in-game menu: RESUME, EXIT GAME (the save is written first) | ## Common questions **Don't see Ports?** In Onion, Ports is a package: open **Apps > Package Manager**, go to the **Verified** tab and switch on **Ports Collection**. That makes the `Roms/PORTS/Shortcuts` folder and the Ports entry in Games; then do the second drag of step 2. Or just start the game from **Apps**. **Ports only?** Delete `App/ConkerNative/config.json` to take the game out of Apps; it stays in Ports. Copying the download again brings it back. **Apps only?** Delete `Roms/PORTS/Shortcuts/Conker's Bad Fur Day.port`. **Updating.** Open the new `ConkerNative` folder and drag the five files inside it into the card's `App/ConkerNative`, replacing the old ones. Your ROM in that folder and your save in `Conker` stay. (Don't drag the folder itself over the old one: on a Mac, Finder's **Replace** would delete the old folder with your ROM in it.) **Speed and battery.** The CPU clock follows the scene, 800 to 1800 MHz: about 30 fps in nearly every scene, and about 4 hours on a full battery. A file `cpu-mhz` in `App/ConkerNative` fixes the clock instead (`1200`, `1800`, or `auto 1400` for a lower cap). `App/ConkerNative/launch.sh` documents the other files and the sound setup; the logs are in `App/ConkerNative`. **Building the port.** `tools/miyoo/port-build.sh` builds the program with the toolchain image from `tools/miyoo/toolchain/Containerfile.miyoo` (the renderer uses the profile in `port/gfx/pgo`, made by `tools/miyoo/pgo.sh`); `tools/miyoo/pack.sh` makes the app folder and checks that nothing from the ROM is in it; `tools/miyoo/gate.sh` replays the recorded sessions in `tools/miyoo/replays` without a screen and checks the pictures and the saves against reference runs (made with the maintainer's reference build, which is not included). ## Status (US only) - **Code: 100% decompiled and byte-matching.** All CPU code in the init, game and debugger segments is matched. As in other N64 decomps, a small part is hand-written assembly: 2.8% of the code, in 289 labelled pieces. Examples are the exception handler and the 64-bit math helpers. 281 pieces have a recorded proof that they were never C. The other 8 (592 bytes) are accepted as hand-written because no compiler search reproduced them. [ACCOUNTING.md](ACCOUNTING.md) gives the proofs and the evidence. - **Fully linked.** No address is pinned: every reference goes through a symbol, so the code and the data can move. `tools/linkcheck.py` fails on a pinned address, a pointer written as a number, or a jump without a relocation. Emulator tests added code to each segment (init, game, debugger) and data to each `.data`, `.rodata` and `.bss`. The shifted ROMs still ran the boot and attract sequence. `tools/shifttest/shift_test.sh` repeats the code test for the init and game segments ([CONTRIBUTING.md](CONTRIBUTING.md)). A few fixed sizes remain, for example the 0x1FC000 bytes of game code that the page-fault handler maps (room for about 7.9 KB more). The build stops with a message before one of them breaks the game. [CONTRIBUTING.md](CONTRIBUTING.md) lists them. - **Data in source.** The game's `.data`, `.rodata` and `.bss` are defined in C (or in the hand-written `.s` file that owns them), except for a few small pieces whose owner the evidence does not show. Assets and game text (microcode, fonts, the resource manifest with its names) stay data that the build extracts from your ROM. - **Names.** About 85% of the functions have names. The rest keep address names (`func_XXXXXXXX`) because no evidence makes their meaning clear yet. Names follow [tools/RENAMING.md](tools/RENAMING.md): original names first (Rare's debug struct viewer, source paths in ROM strings), then SDK names, then descriptive names. - **Source layout.** The files follow the pattern of the source paths in the game's own strings, for example `src/game/Effects/PipeExplode/pipeexplode.c`. Only nine paths are known: five from the US ROM and four from the prerelease builds (`tools/RENAMING.md` lists them). Those files are at Rare's paths. The other directory and file names are descriptive. - **Clean C.** Each function and global is declared in the subsystem header of the file that defines it. Each C file includes the headers that it uses: there are no umbrella headers. About 70 local declarations remain in C files. Each is there because IDO needs it to reproduce the original code, and a `/* matching: */` comment says why. Most are callers that saw a different prototype than the definition, or block-scope declarations that shape the generated code. The number of compiler type warnings can only go down. `tools/warnings_max.txt` holds the limit, and `tools/warncheck.py` fails above it. - **Other versions.** Splat configurations for the EU, debug and ECTS ROMs exist, but those versions are not decompiled and their builds are not verified. ## Building You need: - An x86-64 Linux host, or a Linux VM. The toolchain image installs the x86-64 Linux build of the IDO compiler. - [Podman](https://podman.io/) or Docker. [tools/toolchain/Containerfile](tools/toolchain/Containerfile) defines the toolchain image. It has Ubuntu 24.04, MIPS binutils and pinned Python packages (`tools/toolchain/constraints.txt`). It also has the IDO 5.3 compiler from a pinned ido-static-recomp release, and a gzip with Rare's compression behaviour, built from source. - A US ROM of the game in big-endian `.z64` format, with sha1 `4cbadd3c4e0729dec46af64ad018050eada4f47a`. ```sh git clone --recursive https://github.com/imaccept2/conker-miyoo-native.git cd conker-decomp cp /path/to/your/rom.z64 baserom.us.z64 sha1sum baserom.us.z64 # must print 4cbadd3c4e0729dec46af64ad018050eada4f47a podman build -t conker -f tools/toolchain/Containerfile . podman run --rm --userns=keep-id --security-opt label=disable -v "$PWD":/conker -w /conker conker \ bash -c 'python3 tools/toolchain/patch_splat.py && make extract && make -C conker extract && make -C conker -j"$(nproc)" && make -C conker replace && make -j"$(nproc)"' ``` With Docker, use `docker build` with the same arguments. For `docker run`, pass `--user "$(id -u):$(id -g)"` in place of `--userns=keep-id --security-opt label=disable`. What the steps do: | Step | Result | |------|--------| | `tools/toolchain/patch_splat.py` | Patches the splat submodule. It is idempotent. Run it again after each `git submodule update` | | `make extract` | Checks the ROM's sha1, splits the ROM into `assets/`, decompresses the game code segment and joins the code segments into `conker/conker.us.bin` | | `make -C conker extract` | Checks `conker/conker.us.bin` and splits it with splat into `conker/asm/` (the extracted data, and the assembly the build includes) | | `make -C conker` | Compiles the C (IDO 5.3 via asm-processor), assembles the `.s` files and data, links, and checks `conker/build/conker.us.bin` | | `make -C conker replace` | Recompresses the game segment and puts the rebuilt code back into the ROM layout | | `make` | Links the ROM and checks it | A successful build ends with: ``` build/conker.us.bin: OK # conker/build/conker.us.bin, sha1 842e3d348e3c8ae0039e2ab367ad492f9b5266d8 build/conker.us.z64: OK # the rebuilt ROM, sha1 4cbadd3c4e0729dec46af64ad018050eada4f47a ``` `git status` does not show changes inside `tools/n64splat`, because `.gitmodules` sets `ignore = dirty` for it. In the submodule itself, `git status` shows the files that `patch_splat.py` changes, and `src/splat/segtypes/n64/i1.py` even in a fresh clone. The pinned upstream commit stores `i1.py` with CRLF line endings, but its `.gitattributes` asks for LF, so Git reports a change. The content is the same. After you edit a source file, run the last three steps again (`make -C conker`, `make -C conker replace`, `make`). Everything the build writes (`assets/`, `rzip/`, `build/`, `conker/asm/`, `conker/build/`) is gitignored and must never be committed. ## Layout | Path | Contents | |------|----------| | `port/` | The Miyoo port: the platform layer (`platform/`), the renderer (`gfx/`), the sound (`audio/`), the kit (`kit/`), the app folder (`miyoo/app/`), its tests and tools | | `tools/miyoo/` | The port's build, pack, gate, bench and device scripts, the toolchain images and the recorded sessions (`replays/`) | | `conker/src/game///` | The game segment: C files and hand-written `.s` files, in Rare's layout | | `conker/src/init///` | The init segment (boot, audio, OS and controller code) | | `conker/src/debugger/` | The debugger segment | | `conker/src/libultra/` | libultra (SDK) files, some built from [ultralib](https://github.com/decompals/ultralib) source | | `conker/src/*.c` | A few files whose purpose is not clear yet. They keep address names | | `conker/include/conker/.h` | One header for each subsystem: the declarations of its functions and globals | | `conker/include/` | Shared types (`structs.h`, `effects.h`), the umbrella headers and the SDK 2.0L headers | | `conker/conker.us.yaml` | The splat configuration of the code segments. `conker.us.yaml` at the top splits the ROM | | `tools/` | Build tools, checks (`accounting.py`, `linkcheck.py`, `warncheck.py`) and contributor tooling | ## How it was made Most of the matching, naming and cleanup was done by fleets of AI agents (Claude), directed and reviewed by the maintainer. They followed the runbooks in [AGENTS.md](AGENTS.md) and `tools/*.md`. Each agent worked in its own workspace (`tools/mw.py`, `tools/cw.py`). Before a change landed, the whole ROM had to build byte-identically. The project relies on mechanical checks rather than on the agents' word. The gate rebuilds the ROM before every change lands (`mw.py land`, `cw.py land` and `rename.py` run it), with these checks: - Every function is compiled C or hand-written assembly with a recorded proof (or, for 8 pieces, search evidence). - No address is pinned, and no pointer or address is written as a number, in data or in code. - The committed accounting manifest agrees with the build. - The number of compiler warnings does not rise. Independent AI audits tried to defeat these checks and to disprove the claims in this README. Each round found ways past the checks, and each was closed. The checks are strong evidence, not a proof: if you find a way past one, please open an issue. ## Contributing See [CONTRIBUTING.md](CONTRIBUTING.md). It gives the checks that every change must pass, and the rules for names, types and data. It also explains why no assets or game text go into the repository. ## Licence The project's own code is released under the [MIT licence](LICENSE). Material from other projects keeps its own terms. [THIRD_PARTY.md](THIRD_PARTY.md) lists it with the required notices, including the original mkst/conker code, the Nintendo SDK headers and sources, the bundled tools and the port's third-party parts; the port's sound code (`port/audio/rsp_hle`, from mupen64plus) is GPL-2.0, so the released program is distributed under the GPL's terms, with this repository as its source. *Conker's Bad Fur Day* is the property of its owners, and this project is not affiliated with them. ## Credits - [mkst/conker](https://github.com/mkst/conker) by Mark Street and contributors: the original project this repository grew from. It worked out the ROM layout, the compressed sections and the build, and matched the first functions. - [DevOldSchool/conkers-bfd-decomp](https://github.com/DevOldSchool/conkers-bfd-decomp): an independent decompilation of the game. Its translation-unit boundaries and many struct, field and function names were adopted here by address, and its data-layout notes informed the data work. It is also the place to go for assets. - The decompilations of Rare's other N64 games, which share the modified audio library: [Perfect Dark](https://github.com/n64decomp/perfect_dark) by Ryan Dwyer, [Donkey Kong 64](https://gitlab.com/dk64_decomp/dk64), [Diddy Kong Racing](https://github.com/DavidSM64/Diddy-Kong-Racing) and [Banjo-Kazooie](https://github.com/n64decomp/banjo-kazooie). Byte matches with their code gave the SDK names of many audio functions and the file layout of `src/libultra/audio/`. - [ultralib](https://github.com/decompals/ultralib) (decompiled libultra), [splat](https://github.com/ethteck/splat) and [spimdisasm](https://github.com/Decompollaborate/spimdisasm), [asm-processor](https://github.com/simonlindholm/asm-processor), [asm-differ](https://github.com/simonlindholm/asm-differ), [m2c](https://github.com/matt-kempster/m2c), [decomp-permuter](https://github.com/simonlindholm/decomp-permuter), [ido-static-recomp](https://github.com/decompals/ido-static-recomp), and [gzip](https://github.com/mkst/gzip) patched for pre-1.5 compression output.