# cool_fox [![CI](https://github.com/DoubleGhosty/cool_fox/actions/workflows/ci.yml/badge.svg)](https://github.com/DoubleGhosty/cool_fox/actions/workflows/ci.yml) Experimental compatibility layer and shader translation runtime for running Xbox Series (Scarlett / GDK) x64 executables natively on Windows D3D12 (AMD Radeon and NVIDIA GeForce). > **Legal notice:** This repository contains no copyrighted game code, keys, assets, or executables. It does not provide or link to any third-party software, and does not instruct or encourage bypassing console protections. Use only with software you are legally entitled to run. All original code here is licensed under **GPL-3.0-or-later** (see [LICENSE](LICENSE) and [docs/asset-policy.md](docs/asset-policy.md)). --- ## Quick Start (Prebuilt Release — Low-End & 4 GB VRAM Ready) No Rust toolchain or Visual Studio required on **Windows 11**. On **Windows 10** the prebuilt release does not run (its D3D12 has no shader model 6.6 bindless heaps): build from source with the Agility SDK instead, see [Build from Source](#build-from-source). 1. Download `cool_fox-windows-x64.zip` from [**Releases**](https://github.com/DoubleGhosty/cool_fox/releases) and extract it. 2. Copy `victory.example.toml` to `victory.toml` and set `game_dir` to your title folder (or set `VICTORY_GAME_DIR`). 3. Run the launcher for your card's video memory: - **4 GB:** `.\Play-VIctory-4GB.cmd` *(Series S profile, reduced card buffers)* - **8 to 12 GB, NVIDIA or AMD:** `.\Play-VIctory.cmd` - **16 GB and more, NVIDIA or AMD (new, feedback welcome):** `.\Play-VIctory-16GB.cmd` - **AMD, 16 GB and more:** `.\Play-VIctory-AMD.cmd` also works (renderer port 5, recorded command lists and parallel submission on) The first start after an update translates the shaders again, so loading takes longer once. > **Note:** Requires a Direct3D 12 GPU with **Shader Model 6.6 and Mesh Shaders** (older architectures without hardware Mesh Shaders, such as Polaris / RX 580, are not supported). ### Verify the download The archive is built by GitHub Actions from this repository's source (`.github/workflows/release.yml`). You can check that what you downloaded is that build: ```powershell # 1. The checksum: compare with cool_fox-windows-x64.zip.sha256 on the release page. Get-FileHash .\cool_fox-windows-x64.zip -Algorithm SHA256 # 2. GitHub's signed build provenance (needs the GitHub CLI, `gh`): gh attestation verify .\cool_fox-windows-x64.zip -R DoubleGhosty/cool_fox ``` --- ## Measured Gains & Hardware Reports - **4 GB VRAM Profile (`Play-VIctory-4GB.cmd`):** Series S profile with reduced card buffers. With `scripts\play.ps1 -SkipRayWork` the ray-tracing preparation passes are left out too, cutting GPU card time from **128 ms to 67 ms** on an **RTX 3050 4 GB** (#113). - **On-Demand Mip Levels (`VICTORY_LEVELS_ON_DEMAND=1`):** Allocates card memory only for texture mip levels the title holds, saving **up to 3 GB of VRAM**. - **Renderer Ports (`PORT_GUARD` + `PORT_JOURNAL`):** Enabled by default in all launchers, saving **2–5 ms per frame** on tested GPUs (and **15–61 ms** RT stalls removed with `VICTORY_PORT_RT=1`). - **Community Fixes & Verified Runs:** Recent closed issues resolved blockers across **NVIDIA 32-lane** ([#129](https://github.com/DoubleGhosty/cool_fox/issues/129)), **16 GB VRAM / 32 GB RAM** ([#115](https://github.com/DoubleGhosty/cool_fox/issues/115)), **Wine / Proton** ([#114](https://github.com/DoubleGhosty/cool_fox/issues/114), [#116](https://github.com/DoubleGhosty/cool_fox/issues/116)), and **DXIL shader lowering** ([#106](https://github.com/DoubleGhosty/cool_fox/issues/106), [#111](https://github.com/DoubleGhosty/cool_fox/issues/111)). - **Fixed this week:** wrong sky and colours on a second start from the same cache ([#59](https://github.com/DoubleGhosty/cool_fox/issues/59)), the AMD shader compiler crash on RX 9070 XT ([#161](https://github.com/DoubleGhosty/cool_fox/issues/161)), the game's 30 s watchdog at world entry ([#80](https://github.com/DoubleGhosty/cool_fox/issues/80)), ~4 GB of video memory lost on Linux NVIDIA ([#140](https://github.com/DoubleGhosty/cool_fox/issues/140)), device losses on AMD RDNA 2 ([#139](https://github.com/DoubleGhosty/cool_fox/issues/139)), and twice the outdoor frame rate on AMD with renderer port 1 off ([#180](https://github.com/DoubleGhosty/cool_fox/issues/180)). - **Submit your results:** Running on a 4 GB, 8 GB, or 16 GB+ card? Share your FPS, frametime, and `logs\session-*.log` via [**GPU Compatibility Report**](https://github.com/DoubleGhosty/cool_fox/issues/new?template=gpu-report.yml). --- ## Key Features & Recent Improvements - **Pareto Memory Residency & 32 GB RAM Support:** Adaptive GPU memory residency limits, preventing WDDM paging exhaustion (`0x8007000E`) on 16–32 GB systems. - **Pipeline & Descriptor Stability:** - `VICTORY_PIPELINE_WAIT_MS=0` & `VICTORY_LIBRARY_STORE_LATER=1` in launchers to eliminate 500 ms frame stalls and 200 ms+ pipeline-library save hitches. - Panic-safe pipeline worker queue (`Pending::make_with`) so a failed translation never hangs waiting threads. - `submit_split` dynamic descriptor slot release (`list::tables_done`) and `alias_of` reference pinning (`Held` guard) to prevent slot exhaustion and use-after-free during async texture aliasing. - DirectStorage staging buffer cleanup and idle list/upload trimming (`VICTORY_LIST_IDLE_TRIM_S`). - Bindless heap root-signature flags (`CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED`, `SAMPLER_HEAP_DIRECTLY_INDEXED`) are now probed at startup and omitted on runtimes that reject them, fixing "Unsupported bit-flag set" errors on older D3D12 runtimes. - Offline batch shader translator (`victory shaders`) catches panics per-shader so a single void-value assert no longer kills the entire translation run. - **Shader & Ray Tracing Fixes:** - Shader LOD slot fix (leaves unused LOD slots undefined in array texture coordinate queries to pass DXIL validation). - Wave32 cascade lowering, scoped submerged shader lowering, and dynamic view address buffer indexing (`SLOT_VIEW_ADDRESSES`) for ray-tracing BVH descriptors. - Voxel visibility wave64 mask provenance recovery and blendshape pre-dispatch initialization. - **NVIDIA & Video Synchronization:** Synchronous flush for decoded video frame copies (`VICTORY_THIN=0`, `VICTORY_JOIN_PARTS=0` by default in launchers for NVIDIA compatibility) and constant ambient lighting (`VICTORY_AMBIENT=constant:0.8`). - **Wine / Proton & DXIL Robustness:** Code-generated root signatures for `vkd3d-shader`, single-latch DXIL loop CFG normalization, and 256 MiB pipeline worker stack. - **Custom Resolution, Scaling & Framerate:** - `VICTORY_OUTPUT=1920x1080` (or `2560x1440`) and `VICTORY_RENDER_SCALE=0.667..1.0`. - `VICTORY_FRAME_INTERVAL_MS=16.667` (60 FPS) or `8.333` (120 FPS) while keeping simulation timing at 1.00x. - **Defaults changed recently:** - Hair strands are drawn by default (`VICTORY_HAIR=0` leaves them out). - Pipelines from earlier runs are made at their first use, not while the world loads; this fixed the banded sky and missing clouds of a second start (`VICTORY_EARLY_LIST=1`: as before). - On AMD cards of RDNA 2 and older the relay is off by default under Windows; it lost the device there (`VICTORY_RELAY=2` to turn it on). - Cards with large budgets keep idle textures until 2 GiB is left free, instead of 12 % of the budget (#177). - Every launcher holds the game's 30 s watchdog (`VICTORY_POKE`) so slow first frames don't end the run. - **Renderer Ports (Performance):** - `VICTORY_PORT_GUARD=1` and `VICTORY_PORT_JOURNAL=1` now enabled by default in launchers: write-guard lock sharing and journal splitting save 2–5 ms per frame on all tested GPUs. - `VICTORY_PORT_CBV=1` (port 5) is on in `Play-VIctory-AMD.cmd` and opt-in elsewhere. `VICTORY_PORT_CONSTANTS=1` (port 1) is opt-in everywhere except `Play-VIctory-AMD.cmd` on CPUs of 16 threads or fewer, where it is on with its clamps batched (`VICTORY_PORT_CONSTANTS_ORDER_ALONE=0`): with clamps one by one it halves AMD frame rates outdoors (#180, #181, #171), and with port 1 off an 8-core CPU loses more on copies than the card gains (#180). - `VICTORY_LEVELS_ON_DEMAND=1` enabled by default: card memory allocated only for texture mip levels the title holds, saving up to 3 GB of VRAM. --- ## Build from Source ### Requirements - Windows 10/11 x64 - CPU with AVX2 support - Direct3D 12 GPU with Shader Model 6.6 and Mesh Shaders - Rust toolchain (see `rust-toolchain.toml`) and MSVC C++ Build Tools (with Windows SDK) ### Build from Source ```powershell git clone https://github.com/DoubleGhosty/cool_fox.git cd cool_fox cargo build --release --locked -p victory ``` On Linux (including NixOS), victory is cross-built with `cargo xwin` and run under Proton or Wine; see [docs/linux.md](docs/linux.md). On **Windows 10**, build with the D3D12 Agility SDK instead. Windows 10's own D3D12 has no shader model 6.6 bindless heaps, and root signatures then fail with `0x80070057`: ```powershell cargo build --release --locked -p victory --features agility-sdk powershell -ExecutionPolicy Bypass -File scripts\get-agility-sdk.ps1 ``` The feature makes `victory.exe` ask for Microsoft's `D3D12Core.dll` 1.619.6 in `D3D12\` beside it, and the script fetches it from NuGet and puts it there. Such a build needs the DLL: without it D3D12 does not start (`0x887E0003`). The default build is unchanged and does not need it. Not for Wine or Proton. The GPU tests on Windows 10 need the same. Build the test programs, run the script once more (it also fills `target\debug\deps\D3D12\`), then run the same tests: ```powershell cargo test --locked -p victory-shader -p victory-gpu --features victory-shader/agility-sdk,victory-gpu/agility-sdk --no-run powershell -ExecutionPolicy Bypass -File scripts\get-agility-sdk.ps1 cargo test --locked -p victory-shader -p victory-gpu --features victory-shader/agility-sdk,victory-gpu/agility-sdk ``` ### Launch ```powershell $env:VICTORY_GAME_DIR = 'D:\path\to\your\title' .\Play-VIctory.cmd ``` Or set `game_dir` in `victory.toml` (copied from `victory.example.toml`); every launcher reads it when `VICTORY_GAME_DIR` is not set. For cards with 16 GB or more, NVIDIA or AMD: ```powershell .\Play-VIctory-16GB.cmd ``` For AMD Radeon GPUs (RX 7000+, 16 GB+ VRAM), with renderer ports 5, 6 and 7 on: ```powershell .\Play-VIctory-AMD.cmd ``` For 4 GB VRAM GPUs or low-memory systems: ```powershell .\Play-VIctory-4GB.cmd ``` | Launcher | Target | Renderer Ports | Notes | |---|---|---|---| | `Play-VIctory.cmd` | NVIDIA + AMD, 8 GB+ | 6, 7 on; 1, 5 opt-in | Safe default for all GPUs | | `Play-VIctory-AMD.cmd` | AMD 16 GB+ | 5, 6, 7 on; 1 opt-in | Port 1 off since it halved outdoor fps on three AMD cards (#180) | | `Play-VIctory-4GB.cmd` | 4 GB VRAM | 6, 7 on; 1, 5 off | Series S profile, reduced card buffers | | `Play-VIctory-16GB.cmd` | NVIDIA or AMD, 16 GB+ | 6, 7 on; 1, 5 opt-in | Series X, native 4K output, 2 GB card buffers, async texture streaming; threads follow the CPU (was `Play-VIctory-RTX5070Ti.cmd`) | | `scripts\play.ps1` | Diagnostics | 6, 7 on; `-Safe` disables | Full logging; `-RayTracing` for RT | For an experimental performance comparison on Windows, run `.\Play-VIctory.cmd fast`. This enables consecutive GPU page mappings, threaded list translation, joined submissions, in-place constants, raw constant buffers and pipeline recording. It uses the scene-dependent indirect lighting estimate (`VICTORY_AMBIENT=0.8`) in place of the default's constant fill. It can tint paper or cloth purple; a useful comparison is the same object from the same angle. To compare lighting without changing the other fast settings, set `$env:VICTORY_AMBIENT = 'constant:0.8'` and rerun the same scene. The ordinary launcher and `pareto-residency` keep their previous settings. Some titles or drivers can lose geometry with the fast paths. Both commands default to Series X. To compare the same settings on Series S, set `$env:VICTORY_CONSOLE = 'series-s'` in PowerShell; set it back to `series-x` to return. Each `VICTORY_*` setting can still be overridden individually. In a rendering report, include the console, launcher argument and any overrides. Each `Play-VIctory*.cmd` launcher writes the session's log to `logs\session--