Note
The Windows x64 portable preview supports Normal, Extra, Music Room, endings and saves, with sound.
Portable source is on port/modern-64; the PC-98 DOS reconstruction is on main.
A reconstruction of the Japanese PC-98 Touhou 4: Lotus Land Story, with a C++17 port for Windows and Linux. The portable version runs without a DOS emulator.
▶ Watch on YouTube · Stages 1–3 · Lunatic · Invincibility enabled
Extract the Windows x64 ZIP from Releases
into a writable folder, such as C:\Games\th04-portable.
Install Python 3.9 or newer for the
one-time data preparation. Open CMD in that folder and download the script:
curl.exe --fail -L -o prepare_assets.py https://raw.githubusercontent.com/N0zoM1z0/th04/refs/heads/port/modern-64/port64/prepare_assets.pyIf you already cloned port/modern-64, the script is in port64\prepare_assets.py.
The original game used two installation floppies. Its installer writes loose
game files to a hard disk; th04.hdi is the portable program's container name.
The original installation manual, transcribed at THBWiki,
describes running INSTALL A: under PC-98 DOS or running both disks' self-extractors.
Use your installed game folder, or extract both original installer archives
into one folder, for example C:\Games\TH04-original. It must contain:
| File | Size in bytes |
|---|---|
MAIN.EXE |
156,258 |
幻想郷ED.DAT |
1,120,284 |
東方幻想.郷 |
1,053,177 |
The script finds these files by content even if an extractor garbled their Japanese names. It checks the supported Japanese full-version hashes; trial or translated files need a separate compatibility path. See original media and extraction for installer archives and existing disk images.
From the portable release folder:
py -3 prepare_assets.py --game-dir "C:\Games\TH04-original" --output-dir . --fetch-supportThis creates th04.hdi, FREECG98.BMP and ym2608_adpcm_rom.bin beside the EXE.
The HDI contains your three game files unchanged. --fetch-support downloads a
pinned DOSBox-X font bitmap and extracts the rhythm data from a pinned
libOPNMIDI header. It does not download the game.
Offline preparation, supported inputs and checksums
are documented separately. The script uses Python's standard library; no pip
packages are needed. If py is unavailable, use your Python 3 executable instead.
Run Play.bat for normal play, or Play-no-life-loss.bat for invincibility without the death animation. Both enable sound. Use the arrow keys to move, Z to shoot/confirm, X to bomb/cancel, Shift to move slowly and Esc to pause/back.
The launchers keep scores/settings in save-normal and save-no-life-loss.
Keep those folders when updating. The portable guide
covers gamepads, audio options and troubleshooting.
Compiling requires CMake 3.16+, a 64-bit C++17 compiler and a build tool. Game data is needed when running the game. Install Git, then get the portable branch explicitly:
git clone --branch port/modern-64 https://github.com/N0zoM1z0/th04.git th04-portable
cd th04-portableInstall MinGW-w64 GCC, CMake and Ninja. One setup is MSYS2: run this in its UCRT64 terminal:
pacman -S --needed mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-ninjaThen open CMD, enter your checkout and run the following. Adjust the MSYS2 path if you installed it elsewhere:
set "PATH=C:\msys64\ucrt64\bin;%PATH%"
port64\build-windows.bat
mkdir run
copy build\portable-win64\th04-port64.exe run\
copy port64\Play.bat run\
py -3 port64\prepare_assets.py --game-dir "C:\Games\TH04-original" --output-dir run --fetch-support
run\Play.batThe invincibility launcher supports the published executable; self-built
executables use Play.bat until their patch offsets are registered.
On Debian/Ubuntu, install build-essential cmake ninja-build pkg-config libsdl2-dev python3.
From the checkout:
cmake -S port64 -B build/linux-x64 -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build/linux-x64 --target th04-port64 --parallel 1
python3 port64/prepare_assets.py --game-dir /path/to/TH04-original --output-dir run --fetch-support
./build/linux-x64/th04-port64 --hdi run/th04.hdi --font-bmp run/FREECG98.BMP \
--save-dir run/save-normal --title --audio --pmd-driver pmd86 \
--opna-rom run/ym2608_adpcm_rom.binBuild details and Linux-to-Windows cross-compilation.
This reconstruction was built with AI coding agents. There is still room to improve its behavior, recovered semantics and readability. Contributions and feedback are welcome.
- Testing and bug reports. We haven't tested every route or configuration. Try different characters, shot types, difficulties, endings and save flows. Report bugs with your release or commit, OS, reproduction steps, and expected versus actual behavior. Screenshots or replays help.
- Ports. Help bring the portable version to more platforms and architectures, or improve its rendering, audio and input backends.
- Semantics and readable code. Review reconstructed behavior, improve names and types, simplify control flow, and fill gaps in comments or documentation. Focused fixes with a reproducible example or regression check are welcome.
Send portable PRs to port/modern-64 and DOS reconstruction PRs to main.
ZUN (上海アリス幻樂団 / Team Shanghai Alice) created Touhou Project and the original TH04 game, characters, artwork and music.
Thanks to the authors and contributors of:
- ReC98 — nmlgc and contributors, for PC-98 reverse engineering, recovered source, hardware definitions and DOS build infrastructure used throughout this reconstruction.
- master.lib — the PC-98 graphics and system library used by TH04 and the DOS reconstruction.
- KAJA / PMD — the original PC-98 music driver and formats reconstructed by the portable audio layer.
- ymfm — Aaron Giles and contributors, for the Yamaha FM, SSG and ADPCM synthesis used by the portable version.
- SDL2 — Linux windowing, input and audio.
- DOSBox-X and the FREECG98 contributors — PC-98 execution tests and the external font bitmap used by setup, including font corrections by hdk1983.
- libOPNMIDI, MAME and 98fmplayer/libopna — rhythm-data preparation and audio reference implementations used for validation.
- Unicorn, Capstone and Ghidra — original-code execution, disassembly and reconstruction checks.
- Wine and mtools — DOS-toolchain execution and disk-image preparation.
Project-authored code and documentation use the MIT License. ymfm retains its BSD-3-Clause license; SDL2 uses the zlib license.