No description
  • C 88.9%
  • Python 7%
  • Assembly 2.2%
  • OMNeT++ MSG 1.1%
  • Makefile 0.6%
  • Other 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Zach Bacon f41d4b424c
Some checks failed
Build / Build repo (cn) (push) Failing after 0s
Build / Build repo (gw) (push) Failing after 0s
Build / Build repo (us) (push) Failing after 0s
Check format / Check format cn (push) Failing after 3s
Check format / Check format gw (push) Failing after 3s
Check format / Check format us (push) Failing after 3s
Milestone 4: synchronous scheduler/Fast3D wiring, full exe links end-to-end
Implements the synchronous (no real OS threads) design for graphic.c/
nnsched.c under PC_PORT, per the threading-model fork found last commit.
nnScCreateScheduler no longer spawns schedulerThread/audioThread/
graphicsThread; gfxCreateGraphicThread calls a new gfxproc_pcPortInit()
directly instead. gfxTaskStart() calls func_8002A3F4() (which calls
PcPort_DrawGfx synchronously) directly instead of enqueueing to
sched_gfxMQ. A new gfxPcPortPumpFrame(sc) is the actual per-frame driver:
simulates one VI retrace tick (nnScEventBroadcast) then drains gfx_msgQ
non-blocking (gfxproc_pcPortPump, same dispatch gfxproc()'s real thread
body uses) -- messages posted mid-dispatch (e.g. gfxTaskStart posting
NN_SC_DONE_MSG while handling NN_SC_RETRACE_MSG) are picked up on the
same loop's next iteration, so the existing message-passing shape didn't
need restructuring, just how it's driven.

Added port/milestone4_test.c/.h: a self-contained smoke test that builds
a green-fill display list by hand and pushes it through gfxTaskStart,
wired into port/main.cpp's loop.

Getting this to actually link (not just compile) surfaced several real,
previously-hidden gaps, each found by a real LNK2019 rather than
guessed at:
- gSPDisplayList/gSPSegment don't exist in libultraship (only the
  double-underscore internal __gSPDisplayList/__gSPSegment do) -- added
  a two-line alias to libultra.h.
- osSetIntMask is declared but never implemented -- added a correct
  no-op stub (port/os_stubs.c), since everything scheduler-related is
  synchronous on one thread now, there's nothing real to guard.
- osSpTaskYield/osSpTaskYielded/osSpTaskLoad/osSpTaskStartGo don't exist
  at all -- all four are only used in nnScExecuteAudio, which nothing
  calls under PC_PORT anymore; wrapped its body in #if !defined(PC_PORT)
  rather than inventing stubs for N64-RSP-specific, Milestone-7 scope.
- gFramebuffers, and the F3*/S2* static RSP/RDP-init display lists
  (src/buffers/framebuffer.c, src/main_segment/graphics/static.c) were
  real, portable, already-written code that just hadn't been added to
  the CMake target yet.
- Main_StopThread/MusStop (gfxproc_onPreNMI, the NMI/reset-button
  handler) are real-OS-thread boot code and real audio-engine code
  respectively -- wrapped both calls out; unreachable anyway since
  nothing sends PRE_NMI under PC_PORT.
- 8 screen-module graphic functions gfxproc_onRetrace's graphic_no
  switch references are real dead code at runtime (nothing sets
  graphic_no away from GRAPHIC_NO_0 yet) but still need to link --
  added temporary empty stubs (port/milestone4_screen_stubs.c),
  explicitly marked for deletion once the real files are ported.

Result: the full drmario64pc executable now builds and links with exit
0, wiring scheduler init, synchronous graphics-thread init, a hand-built
display list, and the real gfxTaskStart -> func_8002A3F4 ->
PcPort_DrawGfx -> Fast3dWindow::DrawAndRunGraphicsCommands chain
together for the first time.

Runtime verification is blocked by this session's sandboxed shell, not
by the code: running the exe crashes with STATUS_STACK_BUFFER_OVERRUN
inside Context::CreateDefaultInstance() itself, before any Milestone 4
(or even pre-existing Milestone 3) code runs. Confirmed via an A/B test
that this isn't a regression: rebuilding the exact previously-pushed
Phase 6 commit in this same environment doesn't crash, it hangs
indefinitely at the same point instead -- both broken, just differently,
consistent with no real GPU/display access here rather than a logic bug
in the new code. See the plan file for the full trace. Needs a real
desktop with a GPU to complete the visual confirmation.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-20 10:12:43 -04:00
.github/workflows Rework CI to remove all secrets and use a private docker container instead (#19) 2026-04-14 09:08:46 -04:00
.vscode Move NN_SC_PERF definition to makefile 2025-10-16 11:32:11 -03:00
config Match 055C40.s 2026-05-19 22:14:58 -04:00
include Milestone 4: synchronous scheduler/Fast3D wiring, full exe links end-to-end 2026-09-20 10:12:43 -04:00
lib Compile vr_init.c and msgwnd.c for the PC port 2026-09-19 13:44:37 -04:00
libultraship@a0b6e26257 Add PC port scaffolding via libultraship (Milestone 1) 2026-09-19 12:41:15 -04:00
linker_scripts Move many files to a config folder 2024-08-17 10:12:23 -04:00
port Milestone 4: synchronous scheduler/Fast3D wiring, full exe links end-to-end 2026-09-20 10:12:43 -04:00
src Milestone 4: synchronous scheduler/Fast3D wiring, full exe links end-to-end 2026-09-20 10:12:43 -04:00
tools Update slinky and use plf extension for segments in partial linking 2026-04-26 14:34:45 -04:00
Torch@72960ca16f Add Torch, prove the asset export pipeline on one texture 2026-09-19 14:38:34 -04:00
.clang-format enums for menu_common textures 2026-01-03 12:28:48 -03:00
.clang-tidy dwarf msgwnd 2025-11-16 16:39:32 -03:00
.gitignore Wire anime_a.c's 34 textures to Torch's __OTR__ mechanism (Phase 5) 2026-09-19 17:16:57 -04:00
.gitmodules Add Torch, prove the asset export pipeline on one texture 2026-09-19 14:38:34 -04:00
.python-version Use uv 2026-01-14 08:07:37 -03:00
CMakeLists.txt Milestone 4: synchronous scheduler/Fast3D wiring, full exe links end-to-end 2026-09-20 10:12:43 -04:00
decomp.yaml Generate objdiff progress reports (#17) 2025-05-25 13:23:11 -04:00
diff.py diff.py symlink 2022-09-22 14:52:10 -03:00
diff_settings.py us: match aifRensaCheck 2024-02-15 14:27:47 -03:00
LICENSE License (#5) 2023-03-23 22:50:53 -03:00
Makefile Update slinky and use plf extension for segments in partial linking 2026-04-26 14:34:45 -04:00
pyproject.toml Use uv 2026-01-14 08:07:37 -03:00
README.md Remove legacy progress site 2026-08-13 19:21:13 -04:00
uv.lock Use uv 2026-01-14 08:07:37 -03:00
vcpkg.json Add PC port scaffolding via libultraship (Milestone 1) 2026-09-19 12:41:15 -04:00

Dr. Mario 64

Build Status Code us Progress Code cn Progress Code gw Progress

Matching decomp of Dr. Mario 64

Progress graph 📈

Dependencies

All the instructions assume the user is using a Debian/Ubuntu based Linux distro. If you are a Windows user then it is recommended to use WSL2 with Ubuntu.

System packages

The build process has the following package requirements:

  • make
  • git
  • build-essential
  • wget
  • clang
  • binutils-mips-linux-gnu
  • gcc-mips-linux-gnu
  • uv

Under Debian / Ubuntu (which we recommend using), you can install most of them with the following commands:

sudo apt update
sudo apt install make git build-essential wget clang binutils-mips-linux-gnu gcc-mips-linux-gnu

uv

We use uv to manage Python and its dependencies.

See the official uv docs to install it: https://docs.astral.sh/uv/getting-started/installation/

Then run uv sync to install and update Python and any dependency needed.

If you need to run any Python script directly you can use either uv run ./script.py or enable the venv in your shell.

Building

Copy your big-endian Dr Mario 64 ROM into the repository's config/us directory and rename it to baserom.us.z64. Then run the following commands to download the appropriate compiler versions, extract ROM data using splat, and build the files back into a rom.

You can pass -j N, where N is the number of cores your processor has (you can know this value by using nproc), to speedup the build by parallelizing.

make setup
make extract
make

If successful, the last line of output should say:

build/us/drmario64.us.z64: OK

Other versions

This repository has support for the iQue and the Gateway versions of this game.

To build any of those versions place the corresponding ROM in the config/cn/ or config/gw directories of the repo and rename the rom to either baserom.cn.z64 or baserom.gw.z64, cn corresponding to the iQue version, while gw corresponds to the Gateway one. Run the above make commands but pass either VERSION=cn or VERSION=gw to build each version respectively.

Contributing

TODO: write some contributing guidelines.

Smaller efforts are appreciated. Just open a PR and try to address any review comments left by other contributors c:

This repository takes some heavy inspiration from the DWARF debug information dumped from the Gamecube release. You can access the DWARF dump in this repository: https://github.com/AngheloAlf/puzzle_collection_dwarf

Important note

This matching decomp effort is being done leak-free. If you have looked/worked with leaked materials (i.e. gigaleak) then it's a shame but you can't contribute to this project.

License

This repository is licensed under the MIT license, except for

  • files which declare a different license, and
  • folders that have their own LICENSE file.

In such cases that license takes precedence.

In particular, the src/ folder is licensed under the CC0 license.

N.B.

The intention of this project is to understand the inner workings of this game better, and to make it easier to modify its behaviour.

As such, over and above the actual licensing of the repo, the decomp team requests that this codebase not be used to build binaries targeting non-MIPS machines ("porting").