Far Cry Instincts Predator: static recompilation for Windows

Far Cry Instincts Predator: static recompilation for Windows is a native PC port of the Xbox 360 game Far Cry Instincts Predator with a native renderer and adjustable frame rates.

README

Far Cry Instincts Predator: static recompilation for Windows

An unofficial native Windows port of the Xbox 360 game Far Cry Instincts Predator (both campaigns, Instincts and Evolution). The game's PowerPC code is translated ahead of time to C++ and compiled for x86-64 with the ReXGlue SDK; the Xbox 360 kernel, XAM, audio and input are provided by the SDK's runtime, and the game's Direct3D calls go to a native Vulkan / Direct3D 12 renderer with the game's shaders translated ahead of time.

The project is in beta. Downloads are on the Releases page; changes are listed in the CHANGELOG.

Legal

  • You need your own, legally obtained copy of the game. This project contains no part of the game: no game code, no game data, no shaders, no videos, no sounds, no textures. Neither this repository nor a release built from it includes anything derived from the game, with two exceptions: the PGO profile config/predator/game_code.profdata (shipped as compiler\pgo\predator.profdata). It holds only function names of the form sub_<address>, structure hashes and execution counts recorded in test runs: no code, no text and no other data of the game (BUILDING.md). And the pipeline list config/predator/pipelines.fcpl (shipped as pipelines.fcpl next to predator.exe), which the renderer prewarms at start against stutter on the first visit of a level. It holds only 64-bit hashes of the game's shader containers, render state values (target formats, blend, depth/stencil and cull settings), the guest MSAA level and the names of the levels the pipelines were seen in: no shader code, no constants, no textures and no other data of the game (BUILDING.md).
  • The game code is translated from your disc image on your PC the first time you start the game, and it stays in your user folder. Do not share the files the first start creates (predator_code.dll, shader packs, caches).
  • Please do not ask for, or post, game files or links to them in this project.
  • Far Cry is a trademark of Ubisoft Entertainment. Xbox and Xbox 360 are trademarks of Microsoft Corporation. All other trademarks belong to their owners. This project is not affiliated with, endorsed by or sponsored by Ubisoft or Microsoft.

Features

Everything listed here was measured in test runs (frame dumps, logs, scripted input) on a Windows PC. Points that are not yet verified on real hardware are listed under Known issues.

  • Both campaigns. All 19 story levels load; all level transitions of Instincts and Evolution and both end credits run (scripted test runs). Saves are written at checkpoints and "Resume Game" restores level and position after a restart.
  • Native renderer on Vulkan (default) or Direct3D 12, the game's shaders translated ahead of time into a shader pack. In the scenes compared, the picture matches reference captures made with the Xenia emulator.
  • Frame rate 30 (as the console), any rate from 40 to 120, or the monitor's refresh rate, switchable while playing. Game time runs at wall-clock speed at every rate (ratio 1.000), and places where the game logic depends on the frame count are corrected (see Frame rate and game logic).
  • Any output shape: wider than 16:9 (21:9, 32:9) shows more to the sides (Hor+), narrower (16:10, 4:3) more above and below (Vert+); menus and videos stay in a 16:9 area in the middle, binoculars and scopes stay round and cover the whole picture, and the HUD stays in the middle or ([graphics] hud_aspect = "auto", experimental) moves to the picture's edges.
  • Graphics options: render resolution (native, a fixed size such as 1280x800, or a scale up to 4x / auto = the output height, e.g. 2x at 1440p), shadow map resolution, anisotropic filtering up to 16x, field of view, MSAA as the console or 2x/4x/8x, optional SMAA 1x, the game's gamma ramp, a colour blind mode (protanopia, deuteranopia, tritanopia), optional HDR10 output (the SDR picture at a chosen paper white). All of them default to the console's look.
  • Audio: speech volume apart from music and effects; a peak limiter after the downmix instead of clipping.
  • Mouse and keyboard: direct mouse look on the game's view angles (fixed degrees per count, no stick emulation, the same at every frame rate), optional acceleration and smoothing by time, zoom scaling, invert Y; every pad button and stick direction bindable to keys, mouse buttons or the wheel.
  • Controllers: up to four players through SDL 3 (Xbox, PlayStation, Switch and other pads, hot plug with stable player slots), or XInput only; button remapping with Xbox or PlayStation names, extra dead zone, rumble strength.
  • Button prompts in hints and menus follow the device used last: the bound key for keyboard and mouse, PlayStation or Switch symbols for those pads, or the original Xbox symbols.
  • Settings menu (F10 or Back + Start) for all settings; the game pauses while it is open.
  • Comfort: skip the start-up logo and intro videos, frame rate display, game language (English, French, German, Spanish, Italian, or the Windows language; checked for texts), pause when the window loses focus, borderless fullscreen (Alt+Enter or F11 toggles), window size and position kept across the game's own restarts.
  • No gameplay changes. Difficulty, mechanics and aim assist stay as on the console. Every correction has an environment switch back to the original behaviour.

Documentation

Installation and first start

  1. Extract the release zip into a folder you can write to (for example Documents\Games).

  2. Put your disc image (.iso) next to predator.exe or into a folder assets beside it. A folder with the extracted disc (with default.xex at its top) works as well.

  3. Start predator.exe. It finds the image, checks it and writes its path into predator.toml in the user folder %LOCALAPPDATA%\Far-Cry-Instincts-Predator-Recomp. Places it looks in, in this order: the folder of predator.exe, its assets folder, the user folder (and its assets), the folder above predator.exe (and its assets), your Downloads, Desktop and Documents folders (only their top level; no drive is searched as a whole). If several images are there, the one with the supported default.xex wins. If none is found, a window lists the places; you can then also enter the path yourself:

    [game]
    image = "D:/Games/Far Cry Instincts Predator.iso"
    
  4. On this first start a progress window prepares the game for your PC, once:

    • reads default.xex from the disc image and checks its SHA-256,
    • translates it to C++ (compiler\bin\rexglue.exe),
    • compiles and links it (compiler\bin\clang.exe, compiler\bin\lld-link.exe) into game_code\predator_code.dll in the user folder,
    • builds the shader pack from the disc's shaders (fcshaders.exe).

    Measured: on a 16-core desktop CPU about 41 s for the game code and 17 s for the shader pack (the game is running after about one minute); limited to 4 cores / 8 threads about 90 s plus 89 s (about 3 minutes). Slower CPUs take longer. The game starts by itself afterwards; later starts load the prepared code in a fraction of a second.

If you close the progress window during the build, it asks first; what is finished is kept and the next start continues. If a step fails, a window shows the end of game_code\build.log. A new release that changes the recompiler or the hooks prepares the game code again on its first start.

To keep everything next to predator.exe instead of %LOCALAPPDATA% (portable), create an empty file portable.txt beside it.

Requirements

  • Windows 10 or 11, 64-bit.
  • A CPU with AVX2 (x86-64-v3: Intel Haswell, AMD Zen or newer).
  • A GPU with Vulkan or Direct3D 12 (tested on an NVIDIA RTX 40-series card).
  • About 250 MB for the release folder, plus temporary space for the first start (the work files are deleted after the build).
  • Your disc image of the game (see below).

The release folder includes the Microsoft Visual C++ runtime DLLs, so no separate redistributable is needed.

Providing the game

The game is read directly from a disc image (.iso) of the retail disc Far Cry Instincts – Predator (Xbox 360, USA/Europe release, languages En/Fr/De/Es/It), without a title update. Nothing has to be extracted. The image is only read, never written.

The first start checks default.xex in the image against the SHA-256 0ABD35C4E4C4F39DD330CEBFE051D28A313EF2BDCD80921CACA8F1F2956B0B56 and refuses other versions with a message. Other releases of the game are not supported.

[game] image may also point to a folder with the extracted disc. A relative path is relative to the user folder. The environment variable FCP_GAME_ISO overrides the setting. When [game] image is empty or names an image that is missing or does not fit, the start looks for the image as described under Installation and first start and stores the one it finds (FCP_IMAGE_SEARCH=0 turns the search off). Both forms of an image are read: a full disc dump (Redump, the game partition at its XGD2 offset) and a plain XISO (the game partition alone, as from extract-xiso).

Saves

Saves are in the user folder under user\ (portable: user\ next to predator.exe):

PathContent
user\<profile>\555307DC\00000001\<save>\a saved game: the game's file and its thumbnail
user\<profile>\555307DC\Headers\00000001\<save>.headerits XContent header (name shown in the game)
user\555307DC\profile\the game's profile settings
save_backup\backups of every saved game (below)
save_damaged\damaged or unfinished files moved aside at a start (never deleted)

The game saves at the start of a level and at every checkpoint (as on the console; there is no free saving).

Protection (on by default, FCP_SAVE_GUARD=0 turns it off):

  • A save is written into a new folder beside the old one (<save>.saving) and takes the old one's place only when it is complete. A program that ends in the middle of a save (crash, Task Manager, power loss) keeps the previous save.
  • After every save a copy goes to save_backup\<profile>\555307DC\00000001\<save>\<date-time>\; the newest three are kept (FCP_SAVE_BACKUPS=<n>).
  • At every start each save is checked (files present and not empty, header complete). A damaged save is moved to save_damaged\<date-time>\ and replaced by its newest good backup; a cut save is finished or undone. predator.log has a save: line for every check, every save and every backup.
  • Closing the window or Exit Game in the F10 menu waits up to 5 s for a save in progress (also while the game is paused; FCP_SAVE_EXIT_WAIT_MS).

Copying saves to another PC: copy the whole user\ folder (or a single <save> folder together with its .header file) into the same place of the other user folder, with the game closed. To go back to a backup by hand, copy the files of save_backup\...\<date-time>\content\ into the <save> folder.

Building from source

Details, CMake options and tests: docs/en/BUILDING.md.

Requirements (as used for development):

  • Windows 11 x64, Visual Studio Build Tools 2022 with the C++ workload and Windows SDK 10.0.26100 (only the SDK, the linker libraries and vcvars64.bat are used; the compiler is LLVM),
  • CMake 3.25 or newer, Ninja, Git, Python 3 (for the build scripts),
  • your disc image (the development build translates the game code from it as part of the build).

One-time setup:

powershell -File tools\get_llvm.ps1                rem LLVM/clang 22.1.8 into toolchain\llvm (SHA-256 checked)
powershell -File tools\get_deps.ps1                rem ReXGlue SDK dependencies into third_party\rexglue-deps
powershell -File tools\get_renderer_deps.ps1       rem renderer dependencies into third_party\renderer-deps
python -m venv toolchain\venv
toolchain\venv\Scripts\python.exe -m pip install pycryptodome capstone

All dependencies are pinned to fixed commits or release archives; nothing is installed system-wide. The LZMA SDK decoder is fetched by build.cmd and tools\dist.cmd on first use (tools\get_lzma.ps1).

Build:

set FCP_GAME_ISO=D:\Games\Far Cry Instincts Predator.iso
cmd /c build.cmd release

build.cmd configures the release preset (also relwithdebinfo, debug), translates default.xex from the image to generated\default, builds predator.exe (without game code) and then predator_code.dll the same way the first start does, optimised with the PGO profile config/predator/game_code.profdata (retrain it with tools\pgo.ps1 when the build warns that it is out of date; BUILDING.md). Output: out\build\release\bin\. The development build puts a portable.txt next to the EXE, so settings, saves and caches stay under bin\.

Shader pack for the development build (the release builds it on the first start):

cmd /c tools\renderer_pack.cmd release spirv       rem or dxil for Direct3D 12

Release folder and zip (no game data; refuses anything that comes from the game). This needs no disc image: after the\none-time setup, it works in a fresh clone without FCP_GAME_ISO.

cmd /c tools\dist.cmd release

The result is out\dist\Far-Cry-Instincts-Predator-Recomp-v<version>-win64\ with a zip, the source archive Far-Cry-Instincts-Predator-Recomp-v<version>-sources.zip (exact sources of the LGPL/GPL components FFmpeg, libmspack and the binutils disassembler, with license texts and build notes) and SHA256SUMS next to it. tools\dist.ps1 -NoVcRuntime leaves out the Visual C++ runtime DLLs. The release workflow .github/workflows/release.yml runs the same steps on a tag (only the dist target, no disc image); the release checklist is docs/en/RELEASING.md, the changes per version are in CHANGELOG.md.

Running

Start predator.exe. Logs are written to predator.log in the user folder (the previous run is kept as predator.log.prev).

KeyAction
F10, or Back + Start on a padopen / close the settings menu
Alt+Enter, F11switch between window and fullscreen (the choice is stored in predator.toml)

Text input (cheat codes, save names). Where the console shows its on-screen keyboard (Main Menu → Cheats Menu, the name of a new save), a small input window opens. Type with the keyboard and press Enter (Escape cancels), or use the on-screen keys with the mouse, by touch or with a controller: D-pad or left stick to move, A types the key, X deletes, Y types a space, LB shifts, Start accepts, B cancels. Cheat codes are case-sensitive, as on the console. On a Steam Deck the controller keys work as above; Steam's own keyboard (Steam + X) should type into the field as well (not tested on the Deck yet). FCP_KEYBOARD_UI=0 restores the plain text field without on-screen keys.

Environment switches for the first start:

VariableEffect
FCP_GAME_CODE_REBUILD=1build the game code again even if it matches
FCP_GAME_CODE_BUILD=0never build; show an error instead
FCP_GAME_CODE_JOBS=<n>number of compiler processes (default: logical processors, limited by free memory, 640 MB each)
FCP_GAME_CODE_CPUS=<n>run all build processes on the first n logical processors
FCP_GAME_CODE_KEEP=1keep the work folder (generated code, objects)
FCP_SHADER_PACK_BUILD=0do not build the shader pack (the renderer then translates shaders while playing)
FCP_USER_ROOT=<folder>use this user folder

Configuration

Both files are written with their defaults and comments when they are missing, in the user folder. Every key of predator.toml is also an environment variable (shown in the file); a variable set in the environment wins over the file. Most settings can be changed in the F10 menu; those marked "restart" there take effect at the next start. The full reference is docs/en/CONFIGURATION.md.

predator.toml
SectionKeyDefaultValues
[game]image""path of the disc image or extracted folder (FCP_GAME_ISO)
pause_on_focus_lossfalsetrue = the game opens its pause menu, sound is muted and vibration stops while the window has no focus
skip_introfalsetrue = skip the logo and intro videos at start; story cutscenes stay
fps_counterfalsetrue = frame rate and frame time display in the corner
language"english"english, french, german, spanish, italian, auto (Windows display language); restart
[display]mode"windowed"windowed, borderless, exclusive (video mode: exclusive_mode)
width, height0window client size in pixels; 0 = 1280x720 (Steam Deck: 1280x800)
monitor00 = primary, 1..n = display number
exclusive_mode"desktop"video mode of exclusive fullscreen: desktop (the monitor's own) or "WxH@Hz" from the monitor's list; switches at once
fps30frame rate limit: 30 (console), any whole number from 40 to 120 (45, 60, 90 for the Steam Deck OLED display, 120), or auto (the monitor's refresh rate, at most 120); switches at once in the F10 menu
unsupported_uncapped_fpsfalsetrue = fps and auto also take 121 to 240 (F10 menu: 144, 165, 240 "unsupported"); not supported, what differs is in FRAMERATE.md
vsync"auto"auto (on up to 60 frames/s, off above), on, off
pacing"game"display (every frame equally long on the display; Steam Deck default) or game
frame_queue2frames ahead on the GPU, 1-3 (1 = least input latency)
hdr"off"HDR10 output: off (SDR), on, auto (when Windows HDR is on); hdr_paper_white (200 nits), hdr_peak, hdr_boost: see CONFIGURATION
[graphics]backend"auto"auto (renderer.toml next to the EXE, else Vulkan), vulkan, d3d12
msaa"console"console (2x on the screen, 4x on the reflection, as the console), off, or 2, 4, 8 samples on the screen-sized targets (limited by the GPU); restart. Older files: true = console, false = off
smaafalsetrue = SMAA 1x edge smoothing on the finished picture; switches at once
gammatruethe game's gamma ramp (its brightness setting)
colour_blind"off"off, protanopia, deuteranopia, tritanopia: dal