# Jade Empire (Xbox) - Recompiled An unofficial native Windows port of the original Xbox version of **Jade Empire**, made by statically recompiling the game's executable with [Xbox XBE Recomp](https://github.com/TGP482/XboxXBE-Recomp). > **You need your own copy of the game.** This repository contains no game code, no game data and no executable. > The installer builds the port on your PC from a disc image that you provide. > Not affiliated with or endorsed by BioWare, Electronic Arts or Microsoft. ## Status Early. It has been played by hand only through the opening of Two Rivers. | Works | Notes | |---|---| | Boot, legal screen, title, menus | Intro logo videos are skipped by default | | New game, character creation | | | 3D world, conversations, combat tutorial | | | Audio | | | Saving and loading, save thumbnails | | | Xbox controllers and keyboard | | | Widescreen | 3D view widened, HUD and menus keep their shape | Everything past the first area is untested. Expect bugs; see [Known issues](#known-issues). ## Requirements - Windows 10 or 11, 64-bit, with a Direct3D 12, Direct3D 11 or Vulkan graphics card - About 10 GB of free disk space - A disc image (`.iso`) of **Jade Empire (USA, Europe) (En,Es,It)** for the original Xbox, from your own disc. A full disc dump or a game-partition image both work. The installer checks that `default.xbe` has SHA-256 `D1621D33B8F4F5E2134DAB1B9211F1DFEA7C9216F66D31E6036057E34824052E`; other releases are refused. - To build from source, build tools (the installer checks for them and prints the `winget` command for any that are missing): - Visual Studio 2022 Build Tools with "Desktop development with C++" - LLVM / Clang - CMake 3.25+, Ninja, Git, Python 3 ## Play a release (no build tools needed) 1. Download `JadeEmpire-Recompiled-.zip` from [Releases](https://github.com/jeremybris/JadeEmpire-Recompiled/releases) and extract all of it into a folder you can write to. 2. Copy your disc image (`.iso`) into its `assets` folder. 3. Start `JadeEmpire.exe`. The release contains no game code. On its first start the executable translates the game's code from your disc image with the compiler bundled in the zip; that takes a few minutes and happens once. The disc image must be the release named under Requirements. `README.txt` in the zip has the details. ## Build from source 1. Download or clone this repository into a folder with a **short path**, for example `C:\Games\JadeEmpire`. (The build fetches libraries with Git, which fails in deeply nested folders.) 2. Double-click `Install.bat`, or run: ```powershell powershell -ExecutionPolicy Bypass -File install.ps1 -Iso "D:\path\to\Jade Empire.iso" ``` 3. Pick your disc image when asked. The installer extracts it (about 6.6 GB), verifies it, and builds the port. The first build downloads SDL3, Zydis, toml++, Dear ImGui, the Vulkan headers and Microsoft's DirectX Shader Compiler, and takes several minutes. 4. Run `JadeEmpire.exe` in the same folder. Running the installer again is safe: finished steps are skipped. ### What ends up in the folder | Item | What it is | |---|---| | `JadeEmpire.exe` | The game | | `JadeEmpire.dll`, `dxcompiler.dll`, `dxil.dll`, `compiler\` | Needed beside the exe | | `saves` | Your save games (a link into `hdd\E\UDATA\4d53006d`) | | `hdd\` | The emulated Xbox hard disk | | `assets` | A link to `jade\assets`, the extracted game data | | `settings.toml`, `logs\`, `shadercache\` | Made as the game runs | Keep these together. The two links store full paths, so after moving the folder delete `assets` and `saves` and run the installer again. ## Controls An Xbox-style controller works as on the console. The keyboard is always available as a controller too: | Keys | Xbox control | |---|---| | W A S D | Left stick | | I J K L | Right stick | | Arrow keys | D-pad | | Enter / Backspace | START / BACK | | Space, E, Q, R | A, B, X, Y | | 1, 2 | White, Black | | Z, C | Left, right trigger | | F, V | Stick clicks | ## Graphics settings ("Recomp" menu) Choose **Video Settings** in the game's Options list, or press **F1** anywhere. - Display mode, resolution, vertical sync, frame rate limit - Aspect ratio: 4:3 (original, with side bars), Widescreen, or Stretch - Render scale (25% to 200%), anisotropic filtering, renderer (Direct3D 12 / 11 / Vulkan) - Bloom: Off, Original, High or Very high (the default). The higher tiers build the game's glow from more pixels; Off gives the sharpest picture - Sharper enlarged textures (off by default): enlarges the game's low-resolution art, such as the logo and menu text, with a Catmull-Rom filter instead of the original bilinear one - HDR output (off by default), with white brightness and peak brightness in nits. Needs HDR turned on in Windows and the Direct3D 12 or Vulkan renderer. The game's picture is 8-bit, so this is an HDR presentation of it: colours and mid tones stay as they are, and only the brightest parts are raised towards the peak - Frame rate counter, skip intro videos D-pad or arrow keys move, A or Space selects, B or Esc closes. **Save** writes `settings.toml`. ## Changes from the console game - **Quit Game** in the pause menu closes the game instead of returning to the title screen. - The two logo videos at start-up are skipped unless turned back on. - Compiled shaders are cached on disk (`shadercache\`), so a shader stutters only the first time it is ever used. ## Known issues - Only the first area has been played. Later areas, mini-games and many menus are untested. - Positioned sound effects (footsteps, blows) play since v0.3.2, but their loudness and placement have not been compared with a console. - The game keeps copies of its sound banks in `hdd\Z` (about 430 MB). It is a cache and safe to delete. - The game was made for 30 frames a second. It has been run at 60; higher limits are offered but unchecked for game speed problems. - Widescreen's handling of the 2D layer is a set of heuristics tuned on the opening screens and tested on Direct3D 12 and a 16:10 display only. - Objects are no longer skipped when hidden behind walls (a workaround for objects blinking out at a distance). The cause of the original problem is not understood. - Controller navigation inside the Recomp menu was only tested with the keyboard. - HDR output was checked by measuring the Direct3D 12 output on one HDR display (white at the set peak, mid tones unchanged). On Vulkan it only ran without errors. Direct3D 11 has no HDR output. - The High and Very high bloom tiers were checked for stability and speed, not for how much better they look, and only on Direct3D 12. - The game's 2D art (logo, menu text) was made for 640x480 and looks coarse when enlarged. "Sharper enlarged textures" makes its edges crisper but adds no detail, and shows the art's compression blocks a little more. It applies to every enlarged texture and was checked on the title screen and one indoor scene, on Direct3D 12 only. - The on-disk shader cache is implemented for Direct3D 12 only. If something breaks, `logs\jadeempire.log` and a description of where you were are the useful things to report. ### No sound The game plays on Windows' default playback device. Check that it is the one you are listening on (Settings > System > Sound), and that "Jade Empire" is not muted in the volume mixer while the game runs. The log's `audio:` lines name the device, its volume and mute state, the game's own mixer volume, and whether the game's sound reached the device; include them in a report. ## How it works - `jade/config/game.toml` tells the recompiler where the Xbox SDK's functions and data sit inside this exact executable. About 60 of the addresses, and the register conventions of the link-time-optimised Direct3D functions, were worked out by hand from the disassembly; each has a comment saying how. - `jade/src/game/hooks.cpp` replaces a few functions of the game: GPU tile helpers that have no hardware to talk to, the wait for visibility-test results, the camera's aspect ratio, quitting, the intro videos, and a timing assumption in the sound engine that dropped every short sound effect. - `jade/src/common/` holds the keyboard controls and the Recomp menu. - `jade/sdk/` is Xbox XBE Recomp at commit `4a07436` with local changes, each marked `local change (Jade Empire port)` in the source. `docs/sdk-local-changes.patch` is the full difference from upstream. In short: indexed and ranged draws inside recorded command buffers, the widescreen 2D squeeze and scissor handling, a per-game aspect setting, the Direct3D 12 shader cache, extra resolution for small render targets (the bloom tiers), the optional sharper texture enlargement, HDR10 output for Direct3D 12 with highlight expansion for it and Vulkan, always-passing bounding-box visibility tests, empty-pattern directory listings, a verbose-log switch (which the F3 thread listing now needs), sound device details in the log, sounds played through mix-in (output) buffers, renaming of open files and a movable compiler folder. ### Developer tools `tools/` also has the scripts used while making the port: `capture.ps1` (saves the game's own final image at chosen moments, with scripted controller input), `burst.ps1` (rapid screen grabs), `sheet.ps1` / `sheet2.ps1` (contact sheets), `package.ps1` (packs a player release), `framediff.py`, `mkscript.py`, `xbeinfo.py` and `xiso.py`. Scripted input is read from the file named by `JADE_INPUT_SCRIPT`; see `jade/src/common/pad_input.cpp`. ## Credits - [Xbox XBE Recomp](https://github.com/TGP482/XboxXBE-Recomp) by TGP482: the recompiler and runtime this is built on. - [Athelas](https://github.com/Shagg88/Athelas) by Shagg, whose published configs for other titles using the same Direct3D library build were used as a map, and [Mercenaries Recompiled](https://github.com/KraftMacAndChee/Mercenaries-Recompiled) by KraftMacAndChee, as references for how such a port is put together. - The libraries listed in `jade/sdk/THIRD_PARTY.txt`. - BioWare, for the game. This port was made with Claude (Anthropic). ## Licence MIT for this repository's own files; see `LICENSE`. `jade/sdk` keeps its own MIT licence. Jade Empire and its assets belong to their owners and are not part of this repository.