dwgx@blog:~$dwgx
> cd ../posts

Bolting Multiplayer onto Imperishable Night (TH08)

// created

TH08-Platform adds multiplayer to Touhou 8: Imperishable Night (东方永夜抄). The base game is a 32-bit relic ZUN built with VS2002 + DX8 over twenty years ago, and it officially has no such feature. This project doesn’t touch the base game; it bolts two-player versus straight into memory via DLL injection.

The real hard part isn’t the networking, it’s first figuring out what the game looks like internally: where the frame loop lives, how the player-state struct is laid out, where each frame’s input gets read. The original binary has no symbols, so everything is dug out by hand. That’s why the repo is a monorepo of two lines twisted together.

One line is game/, the th08 decompilation project, forked from GensokyoClub/th08 (AGPL-3.0). Not original work, just pushing further on top of someone else’s. Treat it as a “dictionary of the original’s memory layout and function addresses.” Right now 399+ of 722 tracked functions match, 55% coverage. Per-function comparison runs through reccmp:

reccmp-reccmp --target th08 --json

The other line, dll/, is the actual point: the multiplayer DLL plus a loader. th08.exe isn’t changed by a single byte; the DLL is injected at process startup and hooks in with MinHook. The on-disk base game stays a clean original forever, and every change happens in memory.

Progress is still very early. Phase 0 is a hello world that can hook in, hooking GameManager::OnUpdate (0x43aa03) and writing the frame counter to the log every frame. Phases 1-5 are laid out in docs/DLL_PLAN.md: state capture and the rollback foundation, input hook, UDP lockstep, rollback netcode, and a second player character with a shared HUD. Not a single line of lobby matchmaking is written yet.

Rollback mainly takes after Giuroll, and the decomp-to-multiplayer path is already proven viable by th06_multi_net. There’s a barrier to actually running it: you have to supply th08.exe v1.00d yourself, the repo will never contain it since that’s ZUN’s copyrighted material; you also need VS2022, IDA Pro 9.x with ida-pro-mcp, and reccmp. The whole project is AGPL-3.0, a private repo, and distributes no modified copy of the base game.