- Rust 99.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .cargo | ||
| .githooks | ||
| .github/workflows | ||
| apps/victory | ||
| crates | ||
| docs | ||
| scripts | ||
| tests/fixtures/hle-probe | ||
| xtask | ||
| .gitattributes | ||
| .gitignore | ||
| .victory-root | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE | ||
| Play-VIctory.cmd | ||
| README.md | ||
| rust-toolchain.toml | ||
| rustfmt.toml | ||
| victory.example.toml | ||
VIctory — Optimized for 4–6 GB VRAM & 16 GB RAM (cool_fox Fork)
How to Run It
Requirements
- OS: Windows 10 / 11 x64
- CPU: x86-64 with AVX2 (8 cores / 16 threads recommended)
- GPU: Direct3D 12 GPU with Shader Model 6.6 and Mesh Shaders (works down to 4 GB VRAM / 16 GB system RAM with the low-VRAM profile below)
- Build tools (if building from source): Rust (pinned via
rust-toolchain.toml) + Visual Studio C++ Build Tools & Windows SDK - Game files: Your own complete, intact Xbox Series dump (this repository contains zero game files, code, or assets)
1. Clone & Build
git clone https://git.gtahub.st/Mskh/codec-d--cool_fox-OPTIMIZED.git
cd codec-d--cool_fox-OPTIMIZED
cargo build --release --locked -p victory
(Optional, recommended before first launch) Pre-translate all shaders once into %LOCALAPPDATA%\VIctory\cache-pareto so runtime shader misses are 0:
$env:VICTORY_CACHE_DIR = "$env:LOCALAPPDATA\VIctory\cache-pareto"
.\target\release\victory.exe shaders "D:\Games\YourDump"
Hybrid Laptop GPU Note: On laptops with both integrated graphics and a discrete GPU (e.g. AMD Radeon iGPU + NVIDIA RTX 3050), bind
target\release\victory.exeto High Performance in Windows Settings -> System -> Display -> Graphics (or setGpuPreference=2;underHKCU:\Software\Microsoft\DirectX\UserGpuPreferences). Also verify none of your dump's.rpfarchives are truncated or zero-filled (a zero-filled archive triggers0x80000003at startup).
2A. Run on 4–6 GB VRAM / 16 GB RAM Systems (Low-VRAM / Max-FPS Profile)
Save the following as Run-LowVRAM.cmd inside the repository folder (next to Play-VIctory.cmd), edit VICTORY_GAME_DIR to point to your dump folder, and run it:
@echo off
setlocal
set "VICTORY_GAME_DIR=D:\Games\YourDump"
set "VICTORY_CACHE_DIR=%LOCALAPPDATA%\VIctory\cache-pareto"
set "VICTORY_DISPLAY_MODE=1024x576"
set "VICTORY_WINDOW_MAX=1920x1080"
set "VICTORY_PORT_DESCRIPTORS=1"
set "VICTORY_HEAP_SYNC_EARLY=0"
set "VICTORY_HEAP_ROUND=64"
set "VICTORY_HEAP_RECHECK=0"
set "VICTORY_RELAY=2"
set "VICTORY_RELAY_COPY=1"
set "VICTORY_WIDE_BACK=1"
set "VICTORY_CARD_STEPS=2"
set "VICTORY_WAIT_RESIDENT=0"
set "VICTORY_RIPE_BLOCKS=2"
set "VICTORY_INDIRECT_BATCH=2"
set "VICTORY_INDIRECT_WINDOW=1"
set "VICTORY_CARD_REHASH_RUNS=1"
set "VICTORY_JOIN_COPIES=1"
set "VICTORY_JOIN_PARTS=8"
set "VICTORY_UPLOAD_AHEAD=1"
set "VICTORY_SHOW_AFTER=1"
set "VICTORY_CARD_AWAKE=1"
set "VICTORY_THIN=1"
set "VICTORY_THIN_THREADS=6"
set "VICTORY_LAND_THREADS=4"
set "VICTORY_PIPELINE_WORKERS=4"
set "VICTORY_MAP_THREADS=1"
set "VICTORY_TEXTURE_NO_WAIT=1"
set "VICTORY_LEVELS_ON_DEMAND=0"
set "VICTORY_MAX_TEXTURE_DIM=512"
set "VICTORY_TEXTURE_BUDGET_MB=650"
set "VICTORY_TEXTURE_STAGE_MB=32"
set "VICTORY_TEXTURE_STAGE_MS=12"
set "VICTORY_TEXTURE_CATCHUP=0"
set "VICTORY_CARD_BUFFERS_MIN_KB=256"
set "VICTORY_CARD_BUFFERS_MB=850"
set "VICTORY_MEMORY_CARD_MB=64"
set "VICTORY_DSTORAGE_STAGING_MB=64"
set "VICTORY_AMBIENT=0.6"
set "VICTORY_AMBIENT_FLOOR=0.015"
set "VICTORY_AMBIENT_AIR=1.5"
set "VICTORY_LOG=warn"
call "%~dp0Play-VIctory.cmd" pareto-residency
exit /b %errorlevel%
(Keep VICTORY_DISPLAY_MODE at a 64-pixel-aligned 16:9 size such as 1024x576 or 1280x720 with FSR disabled in settings.xml so mip chains stay 4x4 BC-block aligned.)
2B. Run on 8–24+ GB VRAM / 32–64 GB RAM Systems
All low-VRAM / tight-RAM caps automatically stay out of the way on > 6 GiB VRAM and > 18 GiB RAM hosts:
$env:VICTORY_GAME_DIR = 'D:\Games\YourDump'
.\Play-VIctory.cmd pareto-residency
What We Did in This Fork
Upstream cool_fox targeted 24–32 GB VRAM GPUs and 32–64 GB system RAM (40–46 GB private commit). On a 4 GB VRAM / 16 GB RAM laptop, upstream either ran out of commit (0x8007000E), faulted the D3D12 device (0x887A0001 / 0x887A0006), stalled for 620–1070 ms/frame in CPU/residency housekeeping, or ran at 0.7 FPS in the 3D world.
Across 30 Rust source files in victory-shader, victory-gpu, victory-hle, and victory-loader, we made the following changes:
1. 16 GB Host RAM Protection & Upload Chunk Pooling (crates/victory-gpu)
HostList::uploadbucketed chunk pool (host.rs): AddedSHARED_SPAREpower-of-two upload pooling (4 KiB .. 8 MiBbuckets,48 MiBcap, integrated withDeferred::shared_uploadsandtrim_spare_chunks()) for bothcard_steps > 1and<= 1. Eliminated tens of thousands of unpooled per-frame committed upload allocations and80s+synchronousMakeResident/mapped()stalls.- Tight-RAM spare & staging caps (
residency.rs,host/send.rs,pool.rs): Addedtight_host_ram()(<= 18 GiBRAM hysteresis), cappedsend.rsspare upload memory from768 MiBdown to128 MiB(64 MiBunder pressure,0under critical commit), and capped idleSTAGINGblocks inpool.rsto2(128 MiB). - Async card steps unlocked (
VICTORY_RELAY=2+VICTORY_CARD_STEPS=2): With upload and relay memory bounded on 16 GB RAM, exact relay (VICTORY_RELAY=2) safely enables GPU-side upload fills (~4,500–5,000fills/frame on the card), dropping CPU->GPU settle waits from76.8 ms/frameto0.0 msmedian.
2. 4–6 GB VRAM Residency, Texture Clamping, & Copy Bounds Safety (crates/victory-gpu)
- 4–6 GB VRAM budgets (
resource.rs,pool.rs,shadow.rs,descriptor/host.rs):- Lowered
targets_room_kept()to512 MiBon<= 6 GiBlocal VRAM budgets. - Added
VICTORY_MAX_TEXTURE_DIM(min_mip_for_max_dim, restricted to placed textures) so streamed world textures fit comfortably inside600–650 MiBon 4 GB cards instead of oversubscribing WDDM local VRAM (3,367 MBbudget). - Scaled
pool.rsspares()andahead()(VICTORY_RIPE_BLOCKSdefault) to2(128 MiB) on<= 6 GiBVRAM. - Raised
shadow.rsgive_backcap_bytesto256 MiB(snapshots_kept = 256), cuttingranges done withstalls from620 ms/framedown to0.5 ms/frame, and scaleddefault_card_limits_mbto(16, 320)for<= 4608 MiBVRAM budgets. - Set
CAPPED_TITLE_SLOTS = 393_215, fixedfrom_basemip-level counting, and guardedkeep_shownwithroom_lately()indescriptor/host.rs.
- Lowered
- D3D12 copy bounds guards (
list.rs): Validated subresource counts and mip dimensions prior toCopyResourceandCopyTextureRegion, preventing0x887A0001(DXGI_ERROR_INVALID_CALL) crashes on sub-720p mip chains.
3. Fast Descriptor Sync & Bindless Heap Sweep (victory-loader, victory-hle, victory-gpu)
- Patched descriptor-store hooks (
descriptor_sites.rs,port_descriptors.rs,port.rs,xmem.rs): Hooked title descriptor-heap store sites (VICTORY_PORT_DESCRIPTORS=1) with page-level fallback, reducing per-frame descriptor heap synchronization from~90 msto0.5–1.5 ms. - Configurable bindless buffer sweep round (
draw.rs): AddedVICTORY_HEAP_ROUND(64vs16default) alongsideVICTORY_HEAP_RECHECK=0, cutting background unchanged buffer-slot re-mirroring to~2.8 ms/framewhile still mirroring all changed slots immediately every frame.
4. RDNA2 Shader Translator & Indoor Lighting Fixes (crates/victory-shader, ambient.rs)
same_mode_per_rowinterpolation packing (emit/container.rs,emit/shader.rs): Prevents DXIL validation failures when guest shaders pack mixed interpolation modes into one signature row.image_get_lodarray-slice clamping (emit/lower.rs,emit/mod.rs): Fixes out-of-bounds coordinate counts on arrayedget_lodintrinsics.- RDNA2 VOP1 & VOP3
v_cmpx*EXECfixes (gfx10/fields.rs,gfx10/mod.rs): Fixes operandless VOP1 word lengths and VOP3v_cmpxEXECmask writes so previously dropped shaders translate and validate cleanly (25,663cached shaders,0runtime misses). - Ambient floor & probe filter (
ambient.rs): AddedVICTORY_AMBIENT_FLOORand filtered uninitialized magenta sky/probe values so indoor rooms without-RayTracingstay visible without milky haze.
5. Release Capture & Zero-Stall 1:1 Live Stream (capture.rs, host.rs, queue.rs)
- Enabled opt-in
VICTORY_CAPTURE/VICTORY_CAPTURE_WORLDin--releasebuilds on a backgroundvictory-pngthread, plusVICTORY_LIVE_DIR(async pooled D3D12 readback writing a 16-slot half-res BMP ring +frame_meta.json a detachedvictory-livethread for 1:1 real-time browser monitoring with zero overhead when unset).
Measured Performance on 4 GB VRAM / 16 GB RAM Hardware
Tested on Windows 11 x64, AMD Ryzen 7 6800H (8C/16T), 16 GB DDR5 RAM, NVIDIA GeForce RTX 3050 Laptop GPU (4 GB VRAM / 3,367 MB D3D12 local budget) at 1024x576 (Series S profile):
| Metric | Initial Baseline on 4 GB / 16 GB | Current rtx3050-opt Build |
|---|---|---|
| Startup / world stability | Crashed (E_OUTOFMEMORY / device removal) |
0 crashes across full world runs |
| Menus & loading screens | 30 FPS | 30 FPS |
3D world (4,500–5,733 draws/frame) |
0.7 median / 1.2 max FPS (~1,400 ms/frame) |
4.1 median / 6.9–7.0 peak FPS (~145–243 ms/frame) |
| GPU settle wait on submit thread | 76.8–152 ms/frame |
0.0 ms median (card_steps=2 + relay=2) |
| Descriptor sync + heap buffer pass | ~90 ms + 417 ms |
~1.0 ms + 2.8 ms |
Known Issues (Work in Progress)
- Under aggressive low-VRAM texture clamping (
VICTORY_MAX_TEXTURE_DIM=512) and minimum shadow settings, close-up character faces/skin and certain shadow edges can render pitch-black or blocky in indoor lighting — actively being fixed next. - Sustaining
10+ FPSon 4 GB VRAM / 16 GB RAM remains bounded by CPU-side command-list preparation (~104–152 ms/frame) and shader writeback merging (~49 ms/frame) across4,500+draws/frame.
Asset Policy & Credits
Nothing from the game is ever stored in this repository (see docs/asset-policy.md and cargo xtask policy). Everything derived is generated locally on the user's machine outside the repository.
Built on top of codec-d/cool_fox, VIctory (Marvisak and contributors), fxceless/victory-fork, DexNom/VIctory, Belobug/VIctory-Belobug-AMD, FQY55kai/ZJOU-VICTORY, myokex/victory-amd, Geckomacabre, and cxy0072019-sketch.
License
GPL-3.0-or-later, as VIctory. See LICENSE and docs/asset-policy.md.