th08-re: reverse engineering Touhou 08 Imperishable Night
th08-re is a reverse engineering project for Touhou 08: Imperishable Night. It takes this bullet-hell game that ZUN wrote in C over a decade ago and, working from the source-less binary, pulls it back piece by piece into readable C. This repo is a fork of GensokyoClub/th08-re; I pulled it into my own space as a local playground and backup, not as original work of mine.
Touhou was written in C by ZUN alone: it’s old, small, and dense, with bullet movement, hit detection, the RNG, and replays all packed into the binary. The original behavior is reproducible and the community is willing to dig into it together, which makes it a far cleaner RE target than picking some random commercial packer.
The most interesting part is the replay and RNG code. A bullet-pattern replay can reproduce a run frame for frame because it’s fully deterministic: the same input plus the same RNG seed inevitably yields the same bullets. Reversing down to this layer shows how a plain pseudorandom generator carried the sense of randomness across a whole run, and it also explains why replays break across versions.
While I was at it, I worked out the collision detection and coordinate system too. How big the grazing hitbox is, when a miss actually counts: things that feel like black magic to players turn out to be pretty straightforward once they land in the code.
It’s just a fork, so it may fall behind upstream; treat GensokyoClub/th08-re upstream as the source of truth for full docs and license. Note to self: for this kind of project, never commit the original commercial binary, private reverse-engineering assets, or local machine paths.