Skip to content

About

Jade Cocoon 2 (NTSC-U, SLUS-20309): a native PC port by static recompilation on BozoEngine, no PS2 emulation. Code, tools and notes only (no game data)

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

102 Commits

Folders and files

Repository files navigation

Jade Cocoon 2, native PC port by The Bozos

JC2_Recomp

A native Windows and Linux port of Jade Cocoon 2 (NTSC-U, SLUS-20309), made by statically recompiling the game's PlayStation 2 code to C++.
Not an emulator: the game's own MIPS R5900 code, rebuilt as a native program on BozoEngine, with no PS2 hardware at any level.

Platform Compiler Engine Status

Important

No game files are included: no ELF, IRX modules, data archives, or code generated from them. You need your own copy of the North American release, PS2 ID SLUS-20309. The port is built against that disc's executable:

File SHA-1
SLUS_203.09 fa778a8dcb5a16e8146976fe4ab444856f04c47b

Status

Bring-up, playable far into the story. The port builds on BozoEngine, The Bozos' own toolchain: the game's calls are answered by native libraries and JC2's own port code, with no GIF packet, no GS state machine and no IOP in between. The story plays from the intro to chapter 18: the hub, the Arena, the four Forests with their bosses and Orbs, Kalma's Dark Summoning, the anime cut that follows and the first steps into the Forest of Darkness, all drawn natively from the game's own data. Some effects are still being ported, one draw family at a time. Windows comes first, then Linux.

Milestone
Main ELF recompiled offline from the player's disc at build time ✅
Code overlays: the 1,383 CodeWarrior modules loaded at run time, each compiled as an image of its own ✅
Sound driver (the game's own IOP modules) compiled offline to native C++ over host services ✅
Movies, title screen, main menu ✅
New game: opening movie, first scenes and dialogue, the Jade Throne Room, the forests ✅
Battles drawn (stage, monsters, effects) ✅
Story: the Water, Earth, Fire and Wind Forests and their Orbs, the Dark Summoning, through the Kaya Gate (chapter 18) ✅
Story: the Forest of Darkness (entered) and the ending 🔧
Sound streams (voice lines, cut-scene audio) ending through the SPU2 interrupt, as on a PS2 ✅
Animated IPU textures decoded natively (D001's water) ✅
Forest and town effects (VU1 program D: water, rain, spores, fireflies, dust, motes; program E: the Fire Forest's heat haze) 🔧
Debug teleport (--scene, --warp), battle launcher (--battle, --battle-group), story state (--chapter, --subarea...), --win-battles ✅
Memory card saves (save at the hub, Continue from the title) ✅
Linux build ⏳
Widescreen, higher internal resolution ⏳

✅ works · 🔧 in progress · ⏳ not reached yet

docs/RECOMP_NOTES.md records how the port is brought up, every fix and how it was found, and what remains open.

Screenshots

The intro movie, the title and the main menu, drawn natively:

The title screen The main menu

The first in-game scenes, from an earlier build, up to the Wormhole Forest:

The hero in the first room First dialogue line Dialogue with Levant
Free control in the Jade Throne Room The Wormhole Forest

The four Forests and their Orbs, chapters 10 to 14:

The Kumari Gate's forest picker The Water Forest's boss Level-ups after a battle
The king after the first Orb A level of the Earth Forest The Earth Forest's duel with Cocona
The Sweet Knights after the duel A level of the Fire Forest A level of the Wind Forest

Chapters 14 to 18: the four Orbs in the Throne Room, the anime cut after the Dark Summoning, and the Entrance of Darkness:

Kahu before the four Orbs The anime cut of chapter 17 The Entrance of Darkness

Goal

A fully playable Jade Cocoon 2 as a native executable on Windows and Linux, from the intro to the end of the story. Accuracy first; once it is playable, widescreen and higher internal resolution.

How it works

disc files (game/) ──► tools/jc2_bozo_prepare.py (code spans, entry points; recomp/ghidra/jc2_functions.csv)
                   ──► bozo-recomp ──► the main ELF as C++ (build/bozo_game/jc2_gen)
   CDDATA.000 overlays ──► tools/jc2_bozo_overlays.py ──► bozo-recomp per module (1,383 modules)
   the game's sound IRX ──► tools/jc2_bozo_audio.py ──► BozoEngine's native_irx ──► native C++
   3D models ──► tools/jc2_mesh_pack.py ──► BozoEngine mesh pack
                                           │
             CMakeLists.txt ──► BozoEngine + generated code + runtime/jc2_*.cpp ──► jc2 (window), jc2-headless
  • The retail executable is stripped, and its code and data share a single segment. recomp/ghidra/jc2_functions.csv is the function map (Ghidra with the Emotion Engine extension, entries on data dropped by tools/filter_ghidra_map.py); recomp/jc2_symbols.txt names the functions BozoEngine's libraries answer.
  • Everything derived from the disc is produced at build time into build/, never committed.
  • runtime/ holds JC2's port code: draws from the game's own data, the scene and battle debug tools, save states.

Requirements

  • Windows 10/11 with MSYS2 (UCRT64, see below) or Linux
  • CMake 3.21+, Ninja, GCC 13+ or Clang with C++20
  • FFmpeg development libraries (libavcodec, libavformat, libavutil, libswresample, libswscale) and pkg-config
  • bsdtar (libarchive) to extract the disc, Python 3
  • A CPU with AVX2
  • Your own copy of SLUS-20309 (check the hash above)

Build and run

git clone https://github.com/TheBozos/JC2_Recomp.git
cd JC2_Recomp
scripts/extract_iso.sh "/path/to/Jade Cocoon 2 (USA).iso"   # disc files -> game/
cmake -S . -B build/bozo_game -G Ninja -DJC2_WINDOW=ON   # fetches the pinned BozoEngine release
cmake --build build/bozo_game -j 4
build/bozo_game/jc2                                          # the game window
build/bozo_game/jc2-headless --frames 600                    # no window (checks, scripted runs)

--help lists the options: save states (--load-state, --save-state), teleport (--scene N, --warp X,Z to a point of the current field, --warp-exit beside a forest level's exit, --open-exits), the story (--chapter, --story-flag, --scene-done, --forest-stage, --subarea), the battle launcher (--battle N), --win-battles (a debug cheat: each of your hits takes the enemy's last HP, and your side takes no damage), scripted input (--pad-script), hidden-window captures (--hidden, silent too) and --mute.

The engine is a BozoEngine release, pinned by version and SHA-256 in cmake/bozo_engine.json and fetched into BozoEngine/ when configuring (cmake -P cmake/bozo_engine_fetch.cmake does it alone; nothing is downloaded while BozoEngine/.release matches the pin). An engine update changes that pin to a newer release. To build on engine work not yet released, point -DBOZO_ENGINE_DIR=<a BozoEngine checkout> at it.

Windows

Build in an MSYS2 UCRT64 shell, with MSYS2's GCC (MSVC is not supported for this port).

pacman -S --needed mingw-w64-ucrt-x86_64-{gcc,cmake,ninja,pkgconf,ffmpeg,libarchive,python} git

Disc facts

Boot ELF SLUS_203.09, entry 0x100008, one segment at 0x100000 (6 MB of code and data), stripped
Code 0x100000-0x4E3E80 and 0x6B2B00-0x6B9310 (static constructors, table at 0x6B9310)
Overlays ~1,390 zero-size LOAD segments at 0x940000, filled at run time
Video mode NTSC
IOP modules IRX/*.IRX: ATAD, DEV9, HDD, PFS, IMODEDRV, IMODEMAN, M2IMODE, M2IOPSYS, M2SOUND, MODHSYN, MODMIDI, LIBSD, MCMAN, MCSERV, MTAPMAN, PADMAN, SIO2MAN, UAMAN
IOP image IRX/IOPRP23.IMG
Data CDDATA.000 (1.3 GB archive) with its index CDDATA.LOC, MOV/, VOICE/

Sharing the machine with other ports

Several ports are developed on the same machine. A timed game run, benchmark or heavy build takes the shared bench lock (BozoEngine's tools/bench_lock.sh, file D:/ps2recomp_bench.lock) first, so that another port's build or game does not skew it:

scripts/bench_run.sh 5 "boot timing" build/bozo_game/jc2-headless --frames 600   # one slot
scripts/bench_run.sh --alone 60 "JC2 build" cmake --build build/bozo_game -j 4      # the bench alone

Repository layout

Path Contents
recomp/ The Ghidra function map and the symbol names
runtime/ JC2's port code (draws, debug tools, save states, the game window's entry point)
scripts/ Disc extraction, the bench lock wrapper
tools/ Build-time converters (jc2_bozo_*.py, jc2_mesh_pack.py) and analysis helpers
docs/ Bring-up notes, branding
cmake/ The BozoEngine release the port builds on (bozo_engine.json: version and SHA-256) and its fetch
BozoEngine/ The engine (MIT): the pinned release, fetched when configuring, not committed

Everything derived from the game (game/, generated/, build/, disc images, captures) is git-ignored. Never commit or redistribute it.

Credits

  • BozoEngine by The Bozos, the engine this port is built on.
  • The Twisted Metal: Black, The Third Age, Valkyrie Profile 2: Silmeria and Drakengard ports, developed on the same engine; fixes are shared.
  • Jade Cocoon 2 © Genki, published by Ubisoft in North America. This is an unofficial fan project, not affiliated with or endorsed by them.

About

Jade Cocoon 2 (NTSC-U, SLUS-20309): a native PC port by static recompilation on BozoEngine, no PS2 emulation. Code, tools and notes only (no game data)

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages