Read-only copy of github.com/Skrills68/Valhalla-xmem
  • Rust 96.5%
  • C++ 2.7%
  • Python 0.3%
  • Shell 0.2%
  • C 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Valhalla-xmem 3572bc144a README, INSTALL: larp, the texture fixes and the video memory changes
- README: what is new (larp, the texture fixes from Darner, video memory on
  16 GB cards), a section on larp (how it works, what is not included, how to
  use it, measured), its settings, DLLs, known issues and credits. The memory
  settings line no longer says that pages the card reads move up again: that
  has been off since the texture fixes (VICTORY_PAGES_SEEN).
- INSTALL: building and starting larp, its DLLs, two troubleshooting rows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-05 21:22:50 +00:00
.cargo
.githooks
apps/victory
config
crates
docs
larp
patches
scripts
tests/fixtures/hle-probe
tools
valhalla
xtask
.gitattributes
.gitignore
.victory-root
build.sh
Cargo.lock
Cargo.toml
env.sh
INSTALL.md README, INSTALL: larp, the texture fixes and the video memory changes 2026-12-05 21:22:50 +00:00
LICENSE
README.md README, INSTALL: larp, the texture fixes and the video memory changes 2026-12-05 21:22:50 +00:00
run.conf.default.txt
run.sh
rust-toolchain.toml
rustfmt.toml
setup.sh
victory.example.toml

Valhalla-xmem

A fork of VIctory, an Xbox Series runtime for PCs, that runs titles under Wine on Linux with an AMD graphics card. It is built on lobomfz/VIctory-xmem, whose patched RADV driver maps the title's memory straight into the GPU, as the console shares one memory between CPU and GPU, so nothing is copied back and forth every frame. On top of that it adds the launcher, the mouse handling and the frame generation of the Valhalla fork, FSR 4 under plain Wine, fixes for flickering, and memory settings for 16 GB cards.

It also carries larp, a second runtime you can choose in the launcher: another VIctory fork that knows the title's own functions, builds the card's own ray-tracing structures and is faster with ray tracing on. See larp, the second runtime.

No game files are in this repository, and none will be. Bring your own dump of a title you own. See docs/asset-policy.md.

What's new (December 2026)

  • larp, a second runtime: in the launcher, Play page, "Runtime". Ray tracing is always on and costs little: 1440p with FSR 4 Quality about 27 ms a frame (37 fps). See larp, the second runtime.
  • Texture fixes ported from Darner: fewer black, missing and flickering textures (distant walls, faces, shirts, videos), make-up and tattoos baked from settled memory, new textures made from their small mip levels when the card is full instead of waiting grey, and Darner's BCPack decoder. Every fix has a VICTORY_* switch to turn it off (the commit messages name them).
  • Video memory on 16 GB cards: when new textures find no room, cold title pages make room for them, and the room kept for render targets follows their real size. The stats panel's VRAM line turns red only when textures find no room (a full card is the cache's normal state). The launcher shows how much video memory other programs hold before you start.
  • Ray tracing works now. With ray tracing on, the structures are built in place, so the card tests the nodes with its own instruction: about 35 instead of about 112 ms a frame at 1440p. Ray tracing can still show texture faults; it is experimental.
  • Hardware ray tracing (upstream PR #262, VICTORY_HW_RT=1, needs ray tracing on): the rays run on the card's ray-tracing hardware, about 2.4 ms faster a frame, but it takes about 1.5 GB more video memory.
  • Upstream xmem merged up to 32b136e: card pool, in-game menu (F1), controller hotplug, LOD switches, AMD paging integration, and much more.
  • Flickering fixed: objects and walls no longer go black for a frame.
  • Confetti and black sand fixed (as upstream PRs #47 and #45).
  • Memory settings for 16 GB cards: upstream's settings suit 24 GB cards; here the card does not pull title pages up by itself (VICTORY_CARD_PULL, VICTORY_READ_DOWN off), and the page mover no longer stops the title.
  • Launcher: "Render quality" for FSR and the title's own upscaler, "Interface size" for a smaller HUD, "Hardware ray tracing", "F4 frame capture".
  • The profiler (VICTORY_PROFILE) and the stack dumps (VICTORY_STACKS) no longer crash under Wine.

What it adds to xmem

  • Launcher (valhalla/launcher/valhalla.py, PySide6), from the Valhalla fork: presets, resolution, render quality, AMD FSR, frame generation, ray tracing, interface size, mouse settings, a system check, shader preparation, Play/Stop.
  • AMD FSR 4 with AMD's PC FidelityFX at any output size. The PC FidelityFX is loaded before the D3D12 device is made, so vkd3d-proton loads AMD's FSR 4 driver part (amdxc64.dll) with it. The title's own console FSR only takes a 1920x1080 output and leaves the world black.
  • AMD frame generation (VICTORY_FIDELITYFX_FRAMEGEN=1, diagnostics builds), from the Valhalla fork. The title's UI layer is kept out of the generated frames, so text and the minimap do not smear. The stats panel shows the displayed and the real frame rate, and the average of the last 60 seconds.
  • Mouse look from the Valhalla fork. A click into the window captures the mouse and Esc/P frees it. The camera turns per frame through the inverse of the title's stick curve, so slow movements are not lost in the dead zone. Controller, keyboard and mouse feed one pad.
  • Flicker fix: a new record slot of the title shows the previous view at once, instead of being empty for GPU work already in flight (VICTORY_STAND_EARLY=0 turns it off).
  • Interface size (VICTORY_UI_SCALE=0.8): the title's HUD and menus are made for a TV across the room; this draws them smaller in the middle of the screen (not with frame generation).
  • Diagnostics: frame times one per line (VICTORY_FRAME_TIMES), F4 frame capture (VICTORY_CAPTURE), a "long frame" log line for every frame of 50 ms or more (upstream PR #258).
  • Scripts that keep everything outside the source tree: valhalla/play.sh and valhalla/build.sh.

larp, the second runtime

larp is a VIctory fork (GPL-3.0-or-later; its author is unknown to us) that goes at the same problem as xmem from another side. The console has one memory for CPU and GPU, a PC two, so a runtime must know what the title wrote and get it to the card. larp hooks the title's own functions (for one build of the title) and so knows exactly when the title has finished writing a buffer: it copies just that, with no write watch, no comparing and nothing copied back. It replaces the title's streaming pager with plain memory (no page mapping, which is slow under Wine), places textures in heaps that are there already (AMD's D3D12 Memory Allocator), and answers the title's ray-tracing builder with the card's own ray-tracing structures (DXR). Before the title may leave its start menu, larp builds every pipeline it has seen, so there is no shader stutter in play.

This repository has larp's source in larp/ with four changes: it starts at output sizes other than 4K (the title's back-buffer pool check, as xmem patches it), LARP_PORTABLE_VIEWS (the view heap of the size larp's replacement shaders were made for; on AMD the lighting went black without it), mouse look and PC keys from Valhalla-xmem (LARP_KBM_PC), and warnings when a memory call of the title fails.

Not in this repository: larp's replacement shaders. They are made from the title's own shaders, so they cannot be published here (docs/asset-policy.md). Without them larp runs the translation of every program, and the picture is right. A folder of them in VALHALLA_HOME/larp/shader-replace is used when it is there.

Use it: valhalla/build.sh larp, put amd_fidelityfx_loader_dx12.dll and SDL3.dll with the other DLLs (below), then choose "larp" as the runtime in the launcher, or valhalla/play-larp.sh. It has its own prefix and its own copy of your saves (VALHALLA_HOME/larp/saves, copied from data/saves at its first start). In the game, F10 opens larp's picture menu and F9 its performance panel.

Measured on the PC below (Ryzen 5 7500F, RX 9070 XT), 2560x1440 with FSR 4 Quality, Series X, ray tracing on, a walk through the open world, release build: about 27 ms a frame (about 37 fps); the 99th percentile of the gaps between frames about 33 ms; about 14 GB of RAM and 12 GB of video memory. Without the replacement shaders it is the same (26.8 ms in a run from this repository's scripts). Valhalla-xmem on the same walk takes about 27 ms without and 33 to 35 ms with ray tracing. With frame generation (FG=2x) the real frame stays about the same and about twice as many frames are shown. No crash in 7 runs of 7 to 10 minutes.

Measured

On one PC (Ryzen 5 7500F, 32 GB, Radeon RX 9070 XT 16 GB with resizable BAR, Arch-based Linux, Wine 11.23), Series X profile, 2560x1440 output, the same save in the open world, standing. Each line is 3 runs of 5 to 7 minutes; the frame time is the median of 5-second windows.

frame time frames per second
Valhalla (copying instead of xmem, FSR 4 Quality) 67.3 ms ~15
Valhalla-xmem, FSR 4 Quality ~28 ms ~36
Valhalla-xmem, the title's own upscaler at 2/3 (as on the console) 26.9 ms ~37
Valhalla-xmem, the title's own upscaler at 77% / 100% 29.8 / 35.0 ms ~34 / ~29
Valhalla-xmem, FSR 4 Quality + frame generation 39.1 ms real ~26 real, ~51 shown
Valhalla-xmem, FSR 4 Quality, ray tracing, before (structures not in place) ~112 ms ~9
Valhalla-xmem, FSR 4 Quality, ray tracing ~35 ms ~29
Valhalla-xmem, FSR 4 Quality, hardware ray tracing ~33 ms ~30

The upscaler lines and the frame generation line are single runs. The Valhalla line was measured walking through the same area, without ray tracing.

  • The graphics card limits the frame, not the CPU: release and diagnostics builds are equally fast (27.8 against 27.9 ms), and the submitting thread waits for the card most of the time.
  • 1% lows are about 15 fps. In 5 minutes about 190 frames take 50 ms or more. The "long frame" log line shows that these frames come from the title's side, not from the runtime's copies, textures or waiting.
  • Video memory: about 13 to 14 GB with ray tracing, up to 15 GB with hardware ray tracing.
  • Stability: no crash and no GPU reset in about 50 runs of 5 to 7 minutes with the settings above.

Requirements

  • An AMD graphics card (tested: RDNA 4) with resizable BAR on. Without it the runtime stops at start. NVIDIA and Intel cards do not work: the memory mapping is a RADV patch.
  • Linux with Wine 11.23 or newer (/usr/bin/wine). Proton also works (WINE_BIN/WINESERVER_BIN/PREFIX).
  • 32 GB of RAM or more.
  • 16 GB of video memory or more. Hardware ray tracing needs about 15 GB of it.
  • To build: Rust (the toolchain in rust-toolchain.toml), cargo-xwin, clang/lld, and for the drivers git, meson, ninja, python-mako, glslang and mingw-w64.
  • larp does not use the patched driver: it runs on the system's RADV (tested: Mesa 26.3.1) with the vkd3d-proton of valhalla/build.sh drivers. It was tested with resizable BAR on only. Its toolchain is in larp/rust-toolchain.toml.

Setup

Step by step, with the packages to install: INSTALL.md. In short:

Everything that is built, downloaded or derived goes to VALHALLA_HOME. The default is a folder valhalla-xmem-home beside this repository, never inside it.

valhalla/build.sh drivers   # patched RADV + vkd3d-proton (a few minutes)
valhalla/build.sh           # victory.exe (diagnostics profile)
valhalla/build.sh larp      # larp.exe, the second runtime (optional, about a minute)
echo /path/to/your/dump > ../valhalla-xmem-home/game-dir.txt
# put the third-party DLLs into ../valhalla-xmem-home/dlls/ (see below)
valhalla/play.sh shaders    # translate the shaders ahead (once)
python3 valhalla/launcher/valhalla.py

Or without the launcher: valhalla/play.sh (1080p), XOUT=2560x1440 FSR=1 valhalla/play.sh, or FSR=1 FG=1 valhalla/play.sh. The first start builds the pipelines and takes about 5–7 minutes.

After an update with a new shader translator: valhalla/build.sh, then valhalla/play.sh shaders and valhalla/play.sh warm (builds the pipelines of earlier runs ahead, about 6 minutes), so the first run does not stutter. The first run with hardware ray tracing builds some more pipelines.

Third-party DLLs

These are not part of this repository and are under their makers' licences. Get them yourself and put them into VALHALLA_HOME/dlls/:

File Where from Needed for
dxgi.dll DXVK 3.1.1, x64/ always
d3dcompiler_47.dll Microsoft (Windows SDK; xmem's setup.sh fetches it) always
dxil.dll Microsoft DirectXShaderCompiler, bin/x64/ always
fidelityfx/amd_fidelityfx_upscaler_dx12.dll, fidelityfx/amd_fidelityfx_framegeneration_dx12.dll AMD FidelityFX SDK FSR, frame generation
fsr4/amdxc64.dll a Proton install, files/lib/wine/x86_64-windows/ FSR 4
fsr4/amdxcffx64.dll a Proton install, contrib/ FSR 4
fidelityfx/amd_fidelityfx_loader_dx12.dll AMD FidelityFX SDK (the same folder) larp with FSR
SDL3.dll SDL 3.4, SDL3-*-win32-x64.zip larp with a controller

Settings

valhalla/play.sh reads these settings. The launcher sets them for you.

Variable Effect
XOUT=2560x1440 output size (default 1920x1080)
FSR=1 AMD FSR 4 Quality (VICTORY_FFX_SCALE=0.5 to 1.0 for less or more detail)
FG=1 AMD frame generation (needs FSR=1)
VICTORY_RENDER_SCALE=0.77 without FSR: the share the title's own upscaler renders at (0.5 to 1.0)
VICTORY_BVH_BUILDER=1 ray tracing (experimental; turns on VICTORY_BVH_IN_PLACE=1 too)
VICTORY_HW_RT=1 with ray tracing: on the card's ray-tracing hardware (about 1.5 GB more video memory)
VICTORY_UI_SCALE=0.8 the title's interface smaller (0.5 to 1.0, not with frame generation)
VICTORY_PANEL=1 stats panel (F3 shows and hides it)
VICTORY_MOUSE_SENS=1.0 mouse sensitivity (1.0: 0.065° a pixel)
CAPTURE=1 F4 saves the next frames and a list of their draws to data/captures/
CONSOLE=series-s Series S profile

F1 opens upstream's in-game menu.

valhalla/play-larp.sh reads these. What is set here wins over larp's own menu (F10); the menu keeps the rest.

Variable Effect
XOUT=2560x1440 output size: 3840x2160, 2560x1440, 1920x1080, 1664x936 or 1280x720
UPSCALER=fsr AMD FSR 4 (UPSCALER=off: the title's own upscaler at 2/3)
MODE=quality FSR's share: quality, balanced, performance, ultra or a number from 0.33 to 1
FG=2x AMD frame generation (with UPSCALER=fsr; FG=off)
LARP_PERF_OVERLAY=1 the performance panel from the start (F9 shows and hides it)
LARP_FRAME_RATE=60 the title's frame rate: 30, 40 or 60
LARP_MOUSE_SENS=1.0 mouse sensitivity; LARP_MOUSE_INVERT_Y=1; LARP_KBM_PC=0 turns mouse look off
CONSOLE=series-s Series S profile

Known issues

  • Ray tracing is experimental: it works and is fast enough to play, but textures can be wrong or missing with it. Some ray-traced structures of moving objects are still broken. With hardware ray tracing the video memory of a 16 GB card is nearly full, so new textures can arrive later or stay coarse for a while.
  • Stutter: about 15 fps 1% lows; it comes from the title's side and is not solved yet.
  • Loading screen hang: about 2 starts in 10 stay in the loading screen. Start the title again.
  • Black buildings in the distance: some buildings stay black until you get closer. Upstream VIctory and the other forks have the same issue.
  • Missing parts of signs and billboards: the title creates some graphics and compute pipelines through two console methods (0x1c8, 0x218) that VIctory does not implement yet, and goes without them. xmem's experimental translation of them (VICTORY_NATIVE_GRAPHICS, VICTORY_NATIVE_COMPUTE) is not ready: with it, faces break.
  • The title can crash, rarely, in its own code; start it again.
  • Frame generation costs about 11 ms of each real frame at 1440p.
  • larp works only with the one build of the title its hooks were written for; with another it warns and may not start. On its first start (and after a driver update) it holds the title in its start menu until every pipeline is built: from a few minutes to much longer; later starts about 40 s. It plays its own copy of the saves. Its replacement shaders are not included (see above).

Licence and credits

GPL-3.0-or-later, see LICENSE. The source of every change is in this repository.

  • VIctory by Marvisak and contributors.
  • VIctory-xmem by lobomfz and its contributors: the unified memory (RADV patch, runtime side) and much more; its own credits are in docs/README-xmem.md.
  • Hardware ray tracing: upstream PR #262 by Jenslee Dsouza. The "long frame" log line: upstream PR #258 by Jojonobody2. Joined barriers (VICTORY_JOIN_BARRIERS=1, off by default): from cadyx/VIctory-xmem-cadyx.
  • The Valhalla fork by Slaktarn: launcher, mouse look and frame generation, ported here.
  • The forks xmem credits: avatarmanz, fxceless, DexNom, Belobug, FQY55kai, myokex, triippywhale, trustno1-coder, PastiiJay, Geckomacabre, cxy0072019-sketch, and others.
  • Texture fixes and the BCPack decoder from Darner (150de10). The decoder's BC2 constants and its lane scheduling come from Xbox2Windows and Microsoft's silicon-rans (MIT): see docs/bcpack.md and docs/bcpack-third-party.md.
  • larp: a VIctory fork by an author unknown to us (GPL-3.0-or-later), from its source package (its commit 57b0877 with uncommitted changes, December 2026); its own credits are in larp/README.md. It contains AMD's D3D12 Memory Allocator and NVIDIA's Image Scaling shader, both MIT (their notices are beside them).
  • Ported changes name their origin in the commit messages.

Third-party data: crates/victory-formats/src/bcpack-tables.bin holds the constant tables of the BCPack texture format. They come from upstream VIctory and are needed to decode BCPack textures. They are not covered by this repository's licence (see docs/asset-policy.md, "The one exception").

This project is not affiliated with Microsoft, AMD, Valve or any game publisher. Use it only with titles you own.