Linux: a native runtime, no Wine #526

Closed
github-bot wants to merge 71 commits from gh-pr/526/head into gh-pr/526/base
Owner

@⁠spidercraft on GitHub · 2026-11-24 04:27 UTC · original
spidercraft:linux-native-runtime → main · +38365 −1640 · 155 files · 71 commits · closed without merging

What

A native Linux build of the runtime: victory run <exe> --execute runs the title as an ELF program, with no Wine and no Windows DLL. The title's x86-64 code still runs unchanged in our process; on Linux we also supply what the Windows loader, kernel and system DLLs supply on Windows. The Windows build is unchanged (it type-checks with no diagnostics after every commit here). The design, the rules each part follows and the status are in docs/linux.md.

Builds on #523 and #524 (their commits are the first two here) and includes #177's commits, the fix for image atomics on float-read textures that NVIDIA's compiler crashed on (with the test from #226).

Where things live

Part Where
PE mapper, TEB at the GS base, static TLS, guest threads, entry victory-loader/src/linux/{image,teb,tls,thread}.rs
SEH: signals to EXCEPTION_RECORD/CONTEXT, .pdata dispatcher and unwinder, host frames between title frames, crash report victory-loader/src/linux/{seh,signals,unwind,context,asm}.rs
Region table behind VirtualAlloc (64 KiB granularity, guard pages, placeholders, memfd physical pool) victory-loader/src/linux/vm.rs
Our implementation of the DLLs HostPolicy passes through on Windows: kernel32/ntdll (handle table, waits, locks, threads, thread pool, time, memory, heap, files, text), the UCRT, ws2_32/winhttp (offline), bcrypt, crypt32, advapi32, COM, user32, XAudio2, Spatial Audio, Media Foundation stubs victory-hle/src/linux/<dll>_<slice>.rs, found by host::imp::resolve on Linux
The Windows-only HLE modules, now on both: xmem, files, storage, lifecycle, xsystem, apu, dstorage victory-hle/src/modules/* (per-OS host functions only where they differ)
Host D3D12: vkd3d-proton built as native libraries and loaded at run time; window, keyboard and gamepads from SDL3 (loaded at run time); D3D12/DXGI bindings generated at build time (windows 0.62 does not build on Linux) victory-gpu, victory-shader, crates/victory-windows

The title-facing ABI is win64 everywhere (#524); the CRT-style exports (exit, the CRT file functions) were extern "C" and are fixed here too.

How to run

docs/linux.md: build vkd3d-proton natively (meson), point VICTORY_VKD3D at it; optionally Microsoft's DXC Linux release for VICTORY_DXIL/VICTORY_DXCOMPILER (Arch's directx-shader-compiler 1.10.2605 asserts on every shader). SDL3 and the Vulkan loader come from the distribution.

Tested

Linux (CachyOS, Ryzen 9 7950X3D, RTX 5090, NVIDIA 620.73):

  • cargo test --workspace: 416 passed, 0 failed, 12 ignored, without game data. Guest code under test is PE fixtures we build with lld-link against an xwin SDK (skipped without it): the loader probe, an SEH fixture (__try/__except around real faults, C++ throw/catch/rethrow across threads, unhandled-fault report), and device tests with VICTORY_VKD3D (compute, clear and readback, pipelines from translated shaders, 120 frames to a window).
  • cargo check --workspace --all-targets --all-features --target x86_64-pc-windows-msvc: no diagnostics.
  • With the title: it boots at its 30 fps, shows the start-up screens and the first-boot flow (settings, legal, terms) with scripted keys, keeps its profile and saves, loads the story and reaches the world (game state running, player and population placed): 3 of 3 runs stayed there for 200 s at 1.1-1.8 fps (the world itself still draws dark, as the README says for Windows).
  • victory translate --validate over the title's shaders on Linux: the same validated counts as the validator reports there; every emitted vertex, pixel and mesh program makes a pipeline.

Two fixes found on Linux that also concern Windows

  • Write watching now exists on Linux too (victory-loader/src/linux/{vm,watch}.rs, the GPU journal in victory-gpu/src/watch.rs shared): world copies of title memory fell from 6-11 GB to 0.2-0.4 GB a frame (0.6 to 1.1-1.8 fps). Overlaps the Windows-side work in #464 and #490 only in victory-gpu/src/watch.rs.
  • Raw buffer offsets are bounded (victory-shader/src/emit/lower.rs): a compute program in the world load computes raw offsets that wrap to near 2^32; the console reads 0 there, while on vkd3d-proton/NVIDIA the access hit an MMU fault (kernel Xid 13), the channel stopped and the submission's fence never signalled, which is what stalled most world loads (before: 4 of 5 runs ended by the title's watchdog; after: none in 9). Offsets are now kept at or below 0x7FFF_FFF0 (still past any view: reads give 0, writes drop). The same commit bounds root SRV reads by their host buffer's length, which overlaps #493 (root SRVs as bounded one-view tables); if #493 lands first this part can go.
  • DXC's LLVM replaced our fault handlers on its first compile (title SEH then died silently on Linux); ours are restored after it.

Not done yet

  • World frames are GPU-bound now (200-520 ms of GPU time), plus about 100-150 ms of write-watch bookkeeping that checking runs instead of blocks would cut.
  • B5G5R5A1/B4G4R4A4 render targets of that size are refused by the host here; wave64-only compute pipelines are refused (as on Windows with such GPUs).
  • Locales other than en-US data, share modes on files, waitable timers, APCs, and the DLL functions the title does not import, are left out on purpose.

No game data in the repository, the tests or this description.

🤖 Generated with Claude Code

**@⁠spidercraft** on GitHub · 2026-11-24 04:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/526) `spidercraft:linux-native-runtime` → `main` · +38365 −1640 · 155 files · 71 commits · closed without merging ## What A native Linux build of the runtime: `victory run <exe> --execute` runs the title as an ELF program, with no Wine and no Windows DLL. The title's x86-64 code still runs unchanged in our process; on Linux we also supply what the Windows loader, kernel and system DLLs supply on Windows. The Windows build is unchanged (it type-checks with no diagnostics after every commit here). The design, the rules each part follows and the status are in `docs/linux.md`. Builds on #523 and #524 (their commits are the first two here) and includes #177's commits, the fix for image atomics on float-read textures that NVIDIA's compiler crashed on (with the test from #226). **Where things live** | Part | Where | |------|-------| | PE mapper, TEB at the GS base, static TLS, guest threads, entry | `victory-loader/src/linux/{image,teb,tls,thread}.rs` | | SEH: signals to `EXCEPTION_RECORD`/`CONTEXT`, `.pdata` dispatcher and unwinder, host frames between title frames, crash report | `victory-loader/src/linux/{seh,signals,unwind,context,asm}.rs` | | Region table behind `VirtualAlloc` (64 KiB granularity, guard pages, placeholders, memfd physical pool) | `victory-loader/src/linux/vm.rs` | | Our implementation of the DLLs `HostPolicy` passes through on Windows: kernel32/ntdll (handle table, waits, locks, threads, thread pool, time, memory, heap, files, text), the UCRT, ws2_32/winhttp (offline), bcrypt, crypt32, advapi32, COM, user32, XAudio2, Spatial Audio, Media Foundation stubs | `victory-hle/src/linux/<dll>_<slice>.rs`, found by `host::imp::resolve` on Linux | | The Windows-only HLE modules, now on both: xmem, files, storage, lifecycle, xsystem, apu, dstorage | `victory-hle/src/modules/*` (per-OS host functions only where they differ) | | Host D3D12: vkd3d-proton built as native libraries and loaded at run time; window, keyboard and gamepads from SDL3 (loaded at run time); D3D12/DXGI bindings generated at build time (`windows` 0.62 does not build on Linux) | `victory-gpu`, `victory-shader`, `crates/victory-windows` | The title-facing ABI is `win64` everywhere (#524); the CRT-style exports (`exit`, the CRT file functions) were `extern "C"` and are fixed here too. ## How to run `docs/linux.md`: build vkd3d-proton natively (meson), point `VICTORY_VKD3D` at it; optionally Microsoft's DXC Linux release for `VICTORY_DXIL`/`VICTORY_DXCOMPILER` (Arch's `directx-shader-compiler` 1.10.2605 asserts on every shader). SDL3 and the Vulkan loader come from the distribution. ## Tested Linux (CachyOS, Ryzen 9 7950X3D, RTX 5090, NVIDIA 620.73): - `cargo test --workspace`: 416 passed, 0 failed, 12 ignored, without game data. Guest code under test is PE fixtures we build with `lld-link` against an xwin SDK (skipped without it): the loader probe, an SEH fixture (`__try`/`__except` around real faults, C++ throw/catch/rethrow across threads, unhandled-fault report), and device tests with `VICTORY_VKD3D` (compute, clear and readback, pipelines from translated shaders, 120 frames to a window). - `cargo check --workspace --all-targets --all-features --target x86_64-pc-windows-msvc`: no diagnostics. - With the title: it boots at its 30 fps, shows the start-up screens and the first-boot flow (settings, legal, terms) with scripted keys, keeps its profile and saves, loads the story and reaches the world (game state running, player and population placed): 3 of 3 runs stayed there for 200 s at 1.1-1.8 fps (the world itself still draws dark, as the README says for Windows). - `victory translate --validate` over the title's shaders on Linux: the same validated counts as the validator reports there; every emitted vertex, pixel and mesh program makes a pipeline. ## Two fixes found on Linux that also concern Windows - **Write watching** now exists on Linux too (`victory-loader/src/linux/{vm,watch}.rs`, the GPU journal in `victory-gpu/src/watch.rs` shared): world copies of title memory fell from 6-11 GB to 0.2-0.4 GB a frame (0.6 to 1.1-1.8 fps). Overlaps the Windows-side work in #464 and #490 only in `victory-gpu/src/watch.rs`. - **Raw buffer offsets are bounded** (`victory-shader/src/emit/lower.rs`): a compute program in the world load computes raw offsets that wrap to near 2^32; the console reads 0 there, while on vkd3d-proton/NVIDIA the access hit an MMU fault (kernel `Xid 13`), the channel stopped and the submission's fence never signalled, which is what stalled most world loads (before: 4 of 5 runs ended by the title's watchdog; after: none in 9). Offsets are now kept at or below `0x7FFF_FFF0` (still past any view: reads give 0, writes drop). The same commit bounds root SRV reads by their host buffer's length, which overlaps #493 (root SRVs as bounded one-view tables); if #493 lands first this part can go. - DXC's LLVM replaced our fault handlers on its first compile (title SEH then died silently on Linux); ours are restored after it. ## Not done yet - World frames are GPU-bound now (200-520 ms of GPU time), plus about 100-150 ms of write-watch bookkeeping that checking runs instead of blocks would cut. - B5G5R5A1/B4G4R4A4 render targets of that size are refused by the host here; wave64-only compute pipelines are refused (as on Windows with such GPUs). - Locales other than en-US data, share modes on files, waitable timers, APCs, and the DLL functions the title does not import, are left out on purpose. No game data in the repository, the tests or this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A texture UAV read as float and used atomically in the same program got
the float handle for its atomic: dxil-spirv then emitted OpAtomicOr on a
float texel pointer (invalid SPIR-V), and the NVIDIA compiler crashed in
vkCreateComputePipelines when GTA VI entered its world (two programs:
c12c1f7296419a5b, 8358f9eef7931421). With the type in the key the atomic
gets its own uint handle; all dumped SPIR-V validates.
Since the world bring-up, main no longer builds on Linux: victory-gpu
names host_resource outside its cfg(windows), and victory-hle reaches
Windows-only modules (xmem, files, lifecycle, the text entry dialog).
This gates those uses only, as the smallest base for a native Linux
runtime:

- view_format and the D3D12 allocator hookup are Windows-only, like
  what they call.
- XLaunchNewGame ends the title only on Windows; the text entry dialog
  answers "dismissed" elsewhere.
- translate --validate / --pipelines refuse to start off Windows (no
  host DXIL validator or D3D12 there); translation itself runs.
- Tests that parse the test binary as a PE image, or use Windows title
  paths, are ignored off Windows with the reason.

Tested: Linux (CachyOS, rustc 1.98.1): cargo test --workspace passes
(162 passed, 13 ignored). cargo check --target x86_64-pc-windows-msvc
--all-targets gives the same diagnostics as before (none).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Title code calls our exports, and is called by us, with the Windows x64
convention. `extern "system"` is that convention only on Windows; on
Linux it is SysV, so a native Linux runtime would receive the title's
arguments in the wrong registers. `"win64"` is the same convention on
every x86-64 host, so this changes nothing on Windows.

Callbacks we hand to the host's own APIs stay `"system"` (the crash
reporter's exception handlers, the write watch handler, window and
dialog procedures, EnumWindows, our TLS callback, the probe test's
CreateThread start routine). The title fixture keeps `"system"`: it is
built only as a Windows PE.

Tested: cargo check --workspace --all-targets --all-features for
x86_64-pc-windows-msvc: no diagnostics; on Linux cargo test --workspace
passes (162 passed, 13 ignored).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/linux.md: what the native Linux runtime supplies in place of the
Windows loader, kernel and system DLLs, where each part lives, and the
rules every part follows (win64 ABI, one handle table, one region table,
no Wine and no system DLL forwarding).

- victory-loader::linux: the platform; for now the last-error and
  region-table seams (teb, vm) the other parts call.
- victory-hle::linux: our implementation of the DLLs HostPolicy passes
  through on Windows; host:👿:resolve looks imports up there on
  Linux (exports by ordinal are named #<n>).
- libc as a direct dependency on Linux.

Tested: cargo test --workspace on Linux; Windows target type-checks
with no diagnostics.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Guest thread spawn (a plain host thread for now), SEH image
registration and the handle table, with the signatures the loader,
kernel32 and file slices code against while they are built in parallel.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title reserves, commits, protects and queries memory with Windows
semantics, and the xmem port needs shared physical pages on Linux. The
region table gives VirtualAlloc/Free/Protect/Query those semantics over
mmap: 64 KiB granularity, reserve vs commit, large pages (MAP_HUGETLB,
else MADV_HUGEPAGE), MEM_RESET, guard pages with a take_guard hook for
the fault handler, placeholders, memfd sections with views and aliases,
and a physical page pool. Host memory is answered from the kernel's own
table (PROCMAP_QUERY, else /proc/self/maps).

Guest heap blocks are host malloc blocks, so either side can free what
the other allocated; HeapSize reports the exact size through a slack
byte at the end of each block.

Tested: cargo test -p victory-loader linux::vm (11), victory-hle linux:: (5)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Title code on Linux needs the kernel32 objects it creates, waits for and
locks with, implemented over futexes since nothing on the host serves
them.

- handles: the one handle table (values 4, 8, ... reused, pseudo handles
  -1 and -2, named objects) and the wait engine. A waiting thread links a
  per-thread futex word to each object; `update` changes an object under
  the one wait lock and wakes its waiters, each of which re-checks its own
  wait. So `Waitable::try_acquire` keeps its signature for the file and
  socket slices; `signalled` and `take_abandoned` default sensibly. No
  lock is held while sleeping.
- Events (named, manual and auto reset), mutexes (owner, recursion,
  abandonment at owner exit), semaphores, thread objects (signalled with
  their exit code), the process object.
- SuspendThread's engine: a signal that parks the thread only in title
  code; inside a wait or lock sleep the thread parks before it next tries
  for anything, so a suspended thread is given no lock or signal
  (the lesson of Leonida's runtime).
- CRITICAL_SECTION, SRWLOCK, CONDITION_VARIABLE, INIT_ONCE and
  WaitOnAddress live in the title's own memory at Windows sizes; the
  condition variable keeps the two fixes Leonida's runtime needed (read
  the sequence before counting; only wakes uncount sleepers).
- The process: ids, ExitProcess, command line, environment (our changes
  over the host's), start-up info, last error, debugger checks,
  EncodePointer, FlushProcessWriteBuffers.

Tested: cargo test -p victory-hle linux:: (22 tests: wake ordering,
timed-out sleeper vs wake, wait-all all-or-nothing, mutex abandonment, a
suspended waiter takes nothing, layouts).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On Linux nothing maps the title for us, so linux::image maps the original
image itself: at its preferred base (MAP_FIXED_NOREPLACE) or relocated on
a 64 KiB boundary, sections copied and protected, then made known to the
region table and the exception dispatcher. Binding, title DLLs (found
without regard to case), delay-load slots, TLS callbacks, DllMain and
spawn_main keep the shape of the Windows path, so the front end shares it.
thunks.rs now builds on both: the unimplemented-import stub is the same.

Every thread that runs title code gets a TEB at its GS base (wrgsbase, else
arch_prctl) with its real stack bounds, the PEB (image base, process
parameters, empty loader lists), last error, TlsSlots, TlsExpansionSlots
and FLS storage, at Windows offsets checked by a test. Static TLS hands out
the indices itself (exe 0, DLLs 1.. in load order), so unlike Windows
nothing is patched; every thread has a block for every image. Guest
threads start with the Windows x87 control word and MXCSR, run the
attached images' thread notices, and ExitThread resumes at their guest
frame without unwinding title frames.

The new probe-title fixture is a CRT-free DLL for the hle-probe to import
on Linux, where there is no system DLL to rename.

Tested: cargo test --workspace on Linux (171 passed, 13 ignored; the new
load_probe_linux maps, binds and calls hle-probe and runs its CRT DllMain
and TLS callbacks on guest threads); Windows cargo check --all-targets
--all-features clean; cargo xtask policy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Windows path's config, manifest, storage, console, title DLLs, binding
and late LoadLibrary handling are portable now that the Linux loader has
the same shape, so run() serves both, with cfg only where they differ: no
prepared copy, no files mounts yet (that module is not ported), crash
reporting and console timers stay Windows-only, and the PEB gets the
process parameters. On Linux the DLLs the title ships beside its exe
(vcruntime140, msvcp140, ...) are mapped, since no host DLL stands in.

Tested: victory run on the title maps its executable at its preferred
base with TLS index 0 and its seven DLLs, binds them; --execute starts the
guest main thread and stops in vcruntime140's DllMain, whose
InitializeCriticalSectionEx (kernel32) is not implemented yet. Windows
cargo check clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Title threads on Linux start through the loader's guest-thread spawn; the
title sizes and pins its job threads from the processor facts, so those
come from the host's real topology.

- CreateThread / CreateRemoteThreadEx (CREATE_SUSPENDED, the group
  affinity and ideal processor attributes), thread handles signalled with
  the exit code, OpenThread, SuspendThread / ResumeThread, Sleep,
  SwitchToThread, GetCurrentThreadStackLimits.
- Priorities and ideal processors are remembered and read back; affinity
  masks pin the host thread (sched_setaffinity), a processor this machine
  lacks folding onto one it has.
- TLS slots behind victory_loader::linux::teb::tls_slots (a thread-local
  until the TEB holds them at gs:[0x1480]); index 0 never handed out.
  FLS with its callbacks at thread exit and on FlsFree for every thread.
- GetLogicalProcessorInformation(Ex) from sysfs: cores with their SMT
  siblings numbered next to each other, caches, packages, one NUMA node
  and one group. GetNativeSystemInfo, GlobalMemoryStatusEx,
  IsProcessorFeaturePresent from cpuid.

Tested: cargo test -p victory-hle linux:: (31 tests); layout asserts for
SYSTEM_INFO, SYSTEM_LOGICAL_PROCESSOR_INFORMATION(_EX) record sizes,
MEMORYSTATUSEX, GROUP_AFFINITY, PROCESSOR_NUMBER.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title and the files module open, read, list and manage files through
kernel32; on Linux nothing served it. Host paths spelled the Windows way
(either separator, an optional drive that means nothing on the host) are
resolved without regard to case one component at a time, as NTFS would
find them, and the errors are Windows' (FILE_NOT_FOUND vs PATH_NOT_FOUND,
ALREADY_EXISTS after CREATE_ALWAYS/OPEN_ALWAYS, ...).

OVERLAPPED transfers complete inside the call, signal their event and
post to the associated completion port, which is one of the answers
Windows gives; ports, GetOverlappedResult and CancelIo follow from that.
handles::Object gains set_signal so the file layer can set an event the
sync slice owns.

Tested: cargo test -p victory-hle linux:: (16)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title reads the time, keeps lock-free lists and runs work, timers and
waits on the system thread pool; on Linux all of it is ours.

- Time: QueryPerformanceCounter at 10 MHz (CLOCK_MONOTONIC), tick counts
  including sleep (CLOCK_BOOTTIME), FILETIME and SYSTEMTIME now (UTC and
  local), FileTimeToSystemTime and back with Windows' range checks.
- SLIST_HEADER in the x64 layout, lock-free with cmpxchg16b (inline asm:
  the intrinsic becomes a libatomic call in debug builds) and a sequence
  against ABA.
- The thread pool: work, timers (one-shot and periodic, relative and
  absolute due times, disarm and close while a callback runs) and waits
  on any waitable handle, QueueUserWorkItem, WaitFor...Callbacks with
  cancel, DisassociateCurrentThreadFromCallback. Workers are guest threads
  added on demand; timers and waits are kept by host threads that never
  run title code.

Tested: cargo test -p victory-hle linux:: (41 tests), 60 more runs of
them six at a time with no failure.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The plan keeps one D3D12 code path: on Linux the host D3D12 is
vkd3d-proton built as native libraries and loaded at run time
(`hostlib`, `VICTORY_VKD3D`). Its COM is SysV there, as is
`extern "system"`, so the windows-rs vtables match it unchanged.
The `windows` crate itself does not build on Linux (its
`windows-future` needs Windows-only parts of windows-core), so
`victory-windows` generates the same Direct3D, D3D12 and DXGI
bindings with windows-bindgen at build time, plus the few core
items windows-core only has on Windows; users name it `windows`.

The validator runs against DXC's libdxil.so with the same vtable
slots, but only when VICTORY_DXIL names it: 1.10.2605 traps on some
of our modules.

Tested: cargo test -p victory-shader --features host, 69 passed with
VICTORY_VKD3D set (VALU and pipeline tests on the RTX 5090 through
vkd3d-proton 3.2), 69 passed without it (device tests skip); Windows
cargo check clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Clippy's points in the new files (no busy-wait look-alike in the
suspend handshake, a volatile read in a test loop, checked division),
the handle-table example as text so it is no ignored doctest, and the
status of the slice in docs/linux.md, with the signal SuspendThread
takes so the signal slice knows it.

Tested: cargo test --workspace on Linux (203 passed, 13 ignored); cargo
clippy -p victory-hle shows nothing in src/linux; the Windows target
type-checks with no diagnostics; victory census --missing over the game
lists none of this slice's imports.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
KMutex::new(true) recorded the creator's id but gave the creator no thread
object, so a host thread that created a mutex owned and exited holding it
never abandoned it: every later wait for it timed out.

Tested: cargo test --workspace on Linux (203 passed, 13 ignored); the
mutex test now creates one owned on a thread that exits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Grand Theft Auto VI plays its sound through Spatial Audio: it makes an
MMDeviceEnumerator with CoCreateInstance, activates ISpatialAudioClient
on the default render device and fills 10 ms buffers of static channel
objects each time the stream's event is set. On Windows that is the
host's WASAPI; on Linux mmdevapi.rs serves one device with those
interfaces, and a device thread sets the event, downmixes the objects to
stereo and plays them.

audio_out.rs plays through PulseAudio, which PipeWire also serves, via
libpulse-simple loaded with dlopen: three C functions, no crate and no
build-time headers, and a machine without a sound server keeps running
on a silent clock. cpal would pull in alsa-sys and a link-time
libasound for the same job.

combase.rs: CoInitializeEx and friends, CoCreateInstance (our device
enumerator, REGDB_E_CLASSNOTREG otherwise), task memory, CoCreateGuid,
StringFromGUID2, PropVariantClear, the WinRT start-up, error and HSTRING
functions vccorlib140 imports, and the helpers our COM objects share.
oleaut32.rs: BSTRs, also by ordinal.

handles.rs gets a stand-in Event with the sync slice's signatures
(new, set, reset); that slice's version replaces it.

Tested: cargo test -p victory-hle on Linux (spatial stream passes with
the event, device and property lookups as the title makes them, HSTRING
and BSTR layouts); the ignored a_tone_reaches_the_sound_server played a
tone through PipeWire.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Bink plays a video's sound through xaudio2_9.dll (ordinal 1,
XAudio2Create), the host's on Windows. Ours runs one guest thread per
engine with a pass every 10 ms: engine and voice callbacks with no lock
held (so OnBufferEnd may submit the next buffer), source voices decoded
from the title's buffers (integer PCM and float, plain or extensible)
and linearly resampled to the mastering rate, submix voices by stage,
output matrices and volumes, then the mastering voice downmixed to
stereo into an audio_out stream whose blocking writes pace the passes.
Loops, flushes, discontinuities and GetState behave as documented;
effects and filters are kept but not run, as reverb is silent on
Windows today. FAudio would give the same voice model, but in C with a
SysV ABI: every method and callback would still need a win64 shim here,
and it is not installed by default.

Tested: cargo test -p victory-hle on Linux (buffer completion and
stream-end callbacks with a resubmit from OnBufferEnd, flush of a
stopped voice, a 24 kHz source through a submix, default matrices,
structure layouts).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The kernel32 slice kept TLS slots in a thread-local until threads had a
TEB; with the loader's TEBs in place, tls_slots() returns gs:[0x1480]
of a thread that has one, so title code reading its TEB directly and
TlsGetValue agree. Threads without a TEB keep the thread-local.

Tested: cargo test --workspace on Linux: 211 passed, 13 ignored. The
real executable now reaches its first UCRT start-up call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title and the DLLs it ships (msvcp140, vcruntime140, ...) import
about 250 UCRT functions through the api-ms-win-crt-* sets. On Linux
nothing serves them, and glibc's are the wrong ABI and the wrong
semantics: long is 32 bits, wchar_t 16, errno numbers differ above 34,
printf has its own specifiers and buffer rules, the _s functions
report through the invalid-parameter handler.

One module per API set (ucrt_runtime, heap, string, convert, math,
stdio, time, locale, environment, filesystem, utility), plus the printf
and scanf engines (ucrt_format, ucrt_scan) that stdio lists. The C
locale only. Heap blocks are plain host malloc blocks; _aligned_* keep
the UCRT's layout. The FILE keeps the UCRT's first 48 bytes so
msvcp140's basic_filebuf can work through _get_stream_buffer_pointers.
_beginthreadex goes through the kernel32 slice's CreateThread when it
exists, else the guest thread seam.

Tested: cargo test --workspace (207 passed, 13 ignored; 45 new);
victory census --missing on the game: 0 missing in every
api-ms-win-crt row; Windows cargo check with stub CC: no diagnostics;
cargo xtask policy ok.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Title code and msvcp140 convert, compare and case-map text and ask for
the user's locale through kernel32. Code pages are UTF-8, 1252 (CP_ACP)
and 437 (CP_OEMCP), as on an English console, with Windows' handling of
ill-formed UTF-8. Comparison and LCMapString sort keys share one
four-level word sort; FormatMessage serves the system texts the runtime
reports. The user locale is en-US unless LC_ALL or LANG maps cleanly to
a known locale.

An opt-in test reads a file of the game dump (VICTORY_GAME_DIR), named
in another case, through an overlapped handle.

Tested: cargo test --workspace (198 passed, 13 ignored); victory-hle
linux:: with VICTORY_GAME_DIR (26); Windows cargo check clean

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	crates/victory-hle/src/linux/mod.rs
#	docs/linux.md
The calling-convention change covered extern "system" only. exit,
abort, terminate and _invalid_parameter_noinfo_noreturn in the kernel
module, and the CRT file functions in the files module (with the host
CRT functions they forward to), were extern "C": the Windows x64
convention on Windows, SysV on Linux, so on Linux exit(code) read a
garbage code. They are "win64" now; nothing changes on Windows.

On Linux, exit also runs our UCRT's shutdown (the title's atexit table,
the EXE's thread_local destructors, stream buffers), which the host
CRT's exit does on Windows.

Tested: cargo test --workspace on Linux: 255 passed, 13 ignored;
Windows target type-checks with no diagnostics.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Title code expects Windows SEH: faults and RaiseException dispatched
through the images' .pdata to the language handlers in its own
vcruntime, with RtlUnwindEx, STATUS_UNWIND_CONSOLIDATE for C++ catch
blocks, vectored handlers and the unhandled-exception filter. On Linux
nothing provides that, so victory-loader::linux now does:

- context.rs: CONTEXT, EXCEPTION_RECORD, DISPATCHER_CONTEXT and the rest
  with their Windows layouts checked by a test.
- unwind.rs: the function-table registry (images from register_image,
  RtlAddFunctionTable, table callbacks), RtlLookupFunctionEntry and
  RtlVirtualUnwind for every unwind code, chained info and both epilogue
  forms. A pc in our own code gets a boundary entry: walks end there.
- seh.rs: the two-phase dispatcher, RtlUnwindEx, RtlRestoreContext,
  vectored and continue handlers, the top-level filter, and a crash
  report in the Windows reporter's format (crash_log.rs, now shared with
  crash.rs) to stderr and crashes.log before the process ends.
- asm.rs: every call into title code goes through one routine with
  hand-built unwind data (saved nonvolatiles and a machine frame), so a
  title walk started in a handler crosses our Rust frames and nested or
  collided cases are answered as ntdll does; capture_stub! gives an
  export its caller's context.
- signals.rs: SIGSEGV/SIGBUS/SIGILL/SIGFPE/SIGTRAP in title code become
  exceptions dispatched on the faulting stack; faults in our own code
  go to the handler before ours. A hook lets the region table report
  PAGE_GUARD hits.

victory-hle::linux serves the Rtl* names, RaiseException, the vectored
handler functions, UnhandledExceptionFilter and a few small neighbours;
the portable kernel module's SetUnhandledExceptionFilter now reaches the
dispatcher on Linux. The asset policy allows .cpp for the guest fixture
(tests/fixtures/seh-probe, our own code built with clang-cl).

Tested: cargo test --workspace (178 passed, 13 ignored), incl. unwind
code units, raise and fault dispatch, and seh_guest: __try/__except/
__finally, C++ throw/catch through the static vcruntime, vectored
handlers, a backtrace and an unhandled fault's report and exit status;
the SEH tests also in release; Windows cargo check (no diagnostics);
cargo xtask policy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	crates/victory-hle/src/linux/mod.rs
#	docs/linux.md
kernel32_process stubbed FormatMessageA/W (always "not found") and
kernel32_text implements them for system messages; whichever module
came first in modules() hid the other. The stub is gone, and a test
fails when two modules serving one DLL export the same name.

Tested: cargo test --workspace on Linux: 292 passed, 13 ignored.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The sync slice's Event implements Object::set_signal, which the file
  layer calls to set an OVERLAPPED's event; it went to the trait's
  default (false) before, so waiters on it never woke. The overlapped
  test now uses the real event and waits on it.
- The PE mapper records each image's headers and sections in the
  region table with the protection VirtualQuery reports on Windows,
  and forgets the image when it is unmapped.

Tested: cargo test --workspace on Linux: 292 passed, 13 ignored; the
probe test checks PAGE_READONLY headers and PAGE_EXECUTE_READ code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolves the module lists and the status table. Two kernel32 functions
came from both the process and the exception slices; one copy of each
stays: DebugBreak from kernel32_exception (raises EXCEPTION_BREAKPOINT
with the caller's context; an int3 in our own frame was a host fault),
IsDebuggerPresent from kernel32_process (reads TracerPid).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The policy of modules::net on Windows, on Linux sockets: the title can
talk to itself over loopback (it binds a TCP listener), connects and
datagram sends anywhere else fail with WSAENETUNREACH, a bind to all
interfaces is narrowed to loopback, and lookups answer localhost and
address literals only (WSAHOST_NOT_FOUND otherwise). ws2_32.rs
translates what differs from Linux: sockaddr families, fd_set (select
runs on poll), hostent and addrinfo layouts, socket option levels and
names, MSG_WAITALL, and errno to WSA codes; the exports the title takes
by ordinal are listed under their Winsock 1.1 numbers.

winhttp.rs: sessions open, WinHttpConnect fails with
ERROR_WINHTTP_CANNOT_CONNECT for every server as it does for
off-machine ones on Windows, so the request functions only ever see
invalid handles; closing an async session sends HANDLE_CLOSING; and
WinHttpCrackUrl is real, since libHttpClient and XCurl parse URLs
with it.

Tested: cargo test -p victory-hle on Linux (loopback listener, accept,
select, non-blocking recv, unreachable destinations, offline lookups,
URL cracking into pointers and buffers, structure layouts).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
What the title and the DLLs it ships import from these, and no more:

- bcrypt: the RNG provider, filled from getrandom. No other algorithm
  is imported; opening one answers STATUS_NOT_FOUND.
- crypt32: certificate stores open empty and finds answer
  CRYPT_E_NOT_FOUND (no server is ever reached, so no chain is ever
  checked); CryptStringToBinaryW decodes PEM, base64 and hex, which
  XCurl uses for certificates it carries.
- advapi32 registry: empty. Predefined keys open; every subkey and
  value is missing.
- event tracing (advapi32, api-ms-win-eventing-*): providers register
  and write into nothing, and are never enabled.
- dbghelp: MiniDumpWriteDump fails with ERROR_NOT_SUPPORTED; the
  title's crash handler loads it by name.

Tested: cargo test -p victory-hle on Linux (RNG handles and output,
base64/PEM/hex decoding with short buffers, registry misses, provider
handles).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
user32 (ext-ms-win-rtcore-ntuser-*): RegisterClassExA, CreateWindowExA
(WM_NCCREATE and WM_CREATE with the CREATESTRUCTA, as on Windows),
ShowWindow, DefWindowProcA, and PeekMessageA/DispatchMessageA over one
posted-message queue per thread. Nothing is drawn: the Linux window is
victory-gpu's, and its owner finds the title's window with
user32::main_window and posts WM_CLOSE, WM_ACTIVATEAPP and input to it
with user32::post_message.

Media Foundation: MFStartup, MFShutdown and MFGetSystemTime work; the
creators fail with E_NOTIMPL. The title opens a media file by making
attributes for its source reader first, and its open returns "cannot
open" cleanly when that fails. The intro video is Bink, a shipped DLL,
which does not use Media Foundation.

Tested: cargo test -p victory-hle on Linux (class and window creation,
creation messages, peek filters and removal, dispatch, DefWindowProc
closing a window; MF start-up).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
vccorlib140 imports SysAllocStringLen and SysFreeString (oleaut32 #4
and #6). HostPolicy did not allow oleaut32.dll, so on Linux they stayed
missing although linux::oleaut32 serves them. The allowance is added on
Linux only; on Windows those imports stay unresolved, as they were.

Tested: victory census --missing on the game: no import of the DLLs this
slice covers is missing on Linux.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A synthetic compute program loads a 2D image UAV as four floats and then
runs image_atomic_umin on it in the same block. The atomic must get its
own one-U32 annotation next to the load's four-float one. Test builds
record each annotation's property words so the test can read them.

Fails on the handle cache keyed on the first property word only; passes
with the element type in the key.

(cherry picked from commit 6e01ea0315)
Tested: cargo xtask policy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A frame outside the title's images was printed as a bare address,
which ASLR makes useless after the run. Such frames now read
<file>+<offset> (symbol), from dladdr, ready for addr2line.

Tested: a title fault reached from _initterm_e reports
victory+0x39fe23, which addr2line resolves to ucrt_runtime::_initterm_e.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The CRT start-up in the executable looks up kernel32's condition
variable functions with GetModuleHandleW and GetProcAddress and
fast-fails (code 7) when it gets no module. On Linux the kernel
module's host side returned NULL for every system DLL.

Now a system DLL that victory-hle::linux serves has a pseudo module
(linux::system_dlls): GetModuleHandle and LoadLibrary return it,
GetModuleFileName names it under System32 (so the existing override
lookup by file name works), GetProcAddress resolves names and
ordinals through linux::lookup, FreeLibrary keeps it. Last error goes
to the TEB.

Tested: cargo test --workspace on Linux: 308 passed, 13 ignored; the
title gets past its CRT start-up to its first advapi32 call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The SEH slice left three hooks for the others:
- guest threads take a 64 KiB alternate signal stack as they get their
  TEB (signals::attach_thread), so a stack overflow can be reported;
- the region table's take_guard is the guard page hook, so a fault in a
  PAGE_GUARD page is raised once as STATUS_GUARD_PAGE_VIOLATION;
- images are named after their file in crash reports.

Tested: cargo test --workspace on Linux: 308 passed, 13 ignored.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolves the module lists. The audio slice's stand-in Event in
handles.rs gives way to the sync slice's event, as planned; the audio
code only uses new, set and reset, which it has.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
victory-gpu's D3D12 code is now shared: on Linux the device,
queues, fences, heaps, root signatures, pipelines and pipeline
libraries are vkd3d-proton's, through the same windows-rs calls
(bindings from victory-windows). What stays per platform: device
creation (hostlib), waiting for fences (vkd3d-proton waits in
SetEventOnCompletion without an event), the title-memory copies
(page probes through the kernel's user copy, which also works on
the GPU heaps' device memory, then a plain copy), the timestamp
clock, and the window.

The window is SDL3, loaded at run time: one library gives the
window, its Vulkan surface, the keyboard and gamepads with rumble.
The swap chain is vkd3d-proton's own IDXGIVkSwapChainFactory on our
surface factory, behind the DXGI method names present() calls; the
caption keeps the frame rate.

The title receives root signature blobs and deserializers; on Linux
the host's are SysV objects, so it gets win64 copies. Empty pipeline
libraries pass a null blob, which vkd3d-proton requires. Not yet on
Linux: write watching (every copy is whole), the indirect argument
clamp without a working DXC (VICTORY_DXCOMPILER), fence events until
the handle table registers its SetEvent (fence::on_set_event).

Tested: cargo test -p victory-gpu, 41 passed with VICTORY_VKD3D
(buffer upload and a clear read back on the RTX 5090; 120 frames
presented to a Wayland window with VICTORY_TEST_WINDOW=1), 41 passed
without it (device tests skip); Windows cargo check clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
gameinput reads SDL3's gamepads (slots as XInput's, rumble) and the
keyboard while our window has focus, through victory_gpu::linux; SDL
scan codes become the virtual keys and scan codes the title and the
stand-in pad's table read. Display deferrals succeed as tokens: SDL
keeps the screen saver off while its video runs. d3d12_xs reports
host GPU failures and keeps the shader and pipeline caches on Linux
too. `victory translate --validate/--pipelines` use the same host
device and validator as on Windows instead of refusing.

docs/linux.md, GPU: why vkd3d-proton's native build fits the shared
D3D12 code (SysV COM, its own swap chain factory), how to build it,
SDL3 for the window and input, and what is left.

Tested: cargo test --workspace on Linux, 198 passed, 14 ignored (base
162/13); victory translate --pipelines over shaders.rpf on vkd3d-proton
creates pipelines until one crashes inside NVIDIA's SPIR-V compiler
(libnvidia-gpucomp 620.73, in CreateGraphicsPipelineState); Windows
cargo check clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolves the status table. Also wires the GPU slice's fence event seam
on Linux: victory_gpu::fence::on_set_event sets the handle table's event,
so a title thread waiting on a fence's event wakes; until now it only
logged a warning.

Tested: cargo test --workspace on Linux: 377 passed, 15 ignored;
Windows target type-checks with no diagnostics.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
These four modules were Windows-only, so on Linux the title's
app-state notifications, XApu*, DStorageGetFactory and the device-type
registry read were unbound stubs, and XLaunchNewGame could not end the
title.

The host! forwarder moves to crate::host: crate::host::function already
resolves into crate::linux there, so a module that forwards to "the
host" (CreateEventW for the APU's result event, the registry for keys
that are not the device type's) works on both platforms unchanged.

- lifecycle: suspend routines run on an attached guest thread; the end
  is _exit (TerminateProcess's shape). SIGINT, SIGTERM and SIGHUP go
  through a self-pipe to end_title, as closing the window does on
  Windows; the Linux window's owner raises SIGTERM on a user close
  (installed before the title, so SDL keeps its hands off). A relaunch
  passes our pid and the new process waits on a pidfd. The constrained
  notifications register and never fire, on both platforms (the
  console never constrains a title). The window hooks stay Windows-only.
- xsystem: the device type over the empty Linux registry.
- dstorage: opens through whatever kernel32!CreateFileW the title is
  bound to (files on Windows, the Linux file layer here), keeps a dup
  of the descriptor and reads with read_at. Physical-page destinations
  need xmem and fail with E_NOTIMPL on Linux until it lands.
- net and media stay Windows-only: linux::ws2_32, winhttp and mfplat
  hold the same offline policy, so one policy, no double vetting.

Tested: cargo test --workspace on Linux, 360 passed, 14 ignored
(dstorage, apu, xsystem and lifecycle tests now run there, plus a
relaunch wait on a real child process); Windows cargo check of the
workspace, all targets and features: no diagnostics.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The last imports outside xmem that bound to stubs: msvcp140 takes
GetModuleHandleExW from the libraryloader API set, the exe the two
datetime functions.

GetModuleHandleExW sits in the kernel module next to GetModuleHandleW,
on both platforms: by name it is GetModuleHandleW, by address the
registered image holding it (seh::image_base on Linux, the host on
Windows, where title images are host modules). The date and time
pictures use the en-US data kernel32_locale already has; flags shape
the default formats.

Tested: cargo test -p victory-hle (pictures, quotes, defaults, bad
fields; handles by name and address); the real game now binds every
import but xmem's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
victory run on Linux reported crashes only through the signal handler
the loader installs anyway, kept no crashes.log, ignored a relaunch's
predecessor and let Ctrl+C kill the title without its suspend.

Console timers stay Windows-only: Linux sleeps are fine-grained
already. The G: and T: mounts wait for the files module on Linux.

Tested: the real game on Linux with --unimplemented zero: every import
but xmem's binds; it stops at XMemVirtualAlloc as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SIGTERM must reach the title's suspend routines and then end the
process with 0, as the console ends a title; nothing checked that.
The test forks, so the child can really be signalled and end.

Tested: cargo test -p victory-hle --lib three times, 208 passed;
Windows cargo check of victory-hle: no diagnostics.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On Linux there is no GetProcAddress for title images: modules that know an
image only by its base (xmem's __XMemAllocationHooks__ lookup in the
title's exe) need the export directory read from memory.

Tested: cargo test --workspace on Linux (load_probe_linux checks export_at
against the parsed exports); Windows cargo check for x86_64-pc-windows-msvc.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title's first console-only stop on Linux was xmem.dll right after GPU
device creation, and it opens its package and temp files as G:\ and T:\.

xmem keeps one module with per-OS host pieces. On Linux it is built on the
region table: XMemVirtualAlloc reserves inside the console's address
limits (first fit from a cursor per range, as VirtualAlloc2's address
requirements do on Windows), 64 KiB-page reservations are plain ones since
the table needs no placeholders, physical pages are the table's pool
(page numbers keep the 4 KiB-frame form the title packs into 21 bits),
XMemMapPhysicalPages is phys_map and MEM_DECOMMIT, the GPU's page mapper
is alias, and DirectStorage's write_physical/page_window go through the
pool's memfd. The title's allocation hooks are found with export_at.
d3d12x hands the device xmem's allocator and page mapper on Linux too.

files rewrites virtual drives to Linux folders with / separators for our
Linux kernel32 and CRT; there are no host drives and narrow paths are
UTF-8. On Linux msvcp140 is the title's own mapped DLL, so it is not
served here (that would stop it being mapped) and its _Fiopen reaches
_fsopen/_wfsopen through its imports; std::filesystem's _wrename, _wremove,
_wrmdir, _wchdir, CopyFile2 and hard/symbolic links are wrapped as well.
CRT functions our Linux CRT lacks, which this title never imports, stay
Windows-only. The CRT now finds names whatever their case, as kernel32
does. run.rs mounts G: and T: on Linux, storage mounts its drive and asks
statvfs for free space, and GetModuleFileName hands out \-separated paths.

Tested: cargo test --workspace on Linux, 356 passed, 11 ignored (xmem,
files, storage and the two kernel path tests now run on Linux); two
loader tests (vm reserve_commit_decommit_release, thread
spawned_threads_have_a_teb_and_windows_fpu) fail now and then from
races between tests, and pass on re-run. Windows cargo check --workspace
--all-targets --all-features for x86_64-pc-windows-msvc is clean. The game
makes its seven XMemVirtualAlloc reservations (two 24 GiB 64 KiB-page
pools among them) and writes its crash files through T:, then stops at
psm-appnotify RegisterAppStateChangeNotification (lifecycle).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Typed texture handles were annotated as four F32 components, image
atomics included. DXIL's atomics are 32-bit integer ones, but
vkd3d-proton's DXIL-to-SPIR-V takes the element type from the
annotation and made OpAtomicUMax on a float, invalid SPIR-V that NVIDIA's
Linux shader compiler (620.73) crashed on: victory translate --pipelines
over shaders.rpf died in libnvidia-gpucomp. An image atomic's handle now
names one U32 component; the handle cache is keyed by both annotation
words, so a texture read and updated atomically gets both handles.

Tested: on Linux (RTX 5090, vkd3d-proton, DXC 1.9.2609) translate
--pipelines over shaders.rpf completes: 12272/12272 vertex and pixel,
8191/8191 mesh, 1372/1693 compute pipelines (the rest need 64-lane
waves); --validate counts unchanged (12172, 1670, 8129).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Arch's directx-shader-compiler is broken; Microsoft's v1.9.2609 Linux
release validates the translated shaders and compiles the indirect
argument clamp. How to install it, and the GPU status row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	crates/victory-hle/src/modules/d3d12x.rs
# Conflicts:
#	crates/victory-hle/src/modules/kernel.rs
#	docs/linux.md
- dstorage writes into physical pages on Linux too: xmem builds there
  now, so the E_NOTIMPL stand-in is gone.
- Closing the window raises SIGTERM, which the lifecycle module turns
  into the console's suspend-then-end, instead of exiting at once.
- xasync's host threads (serialized ports, the pool, delayed
  submissions, async providers) attach a TEB before they call title
  code, which Linux does not give a thread by itself.

Tested: cargo test --workspace on Linux: 410 passed, 12 ignored;
Windows target type-checks with no diagnostics.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title reserves a 32-bit pool with XMemVirtualAlloc as a placeholder
(MEM_RESERVE_PLACEHOLDER) and maps physical pages into it. phys_map only
took plain reservations, so both maps failed with ERROR_INVALID_ADDRESS
and the title asserted in System Init. On Windows xmem splits the
placeholder and maps a view in its place; the region table now does the
same: the mapped range becomes a reservation of its own (the rest stay
placeholders), which later maps and MEM_DECOMMIT treat as before.

Tested: cargo test -p victory-loader (vm), the game now presents frames
at 30 fps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
VICTORY_KEYS only fed the Windows host's keyboard, so diagnostics builds
on Linux could not press through the title's first-boot screens. The
script is platform-neutral now; the SDL host adds its keys to the ones
held, with the scan codes of its own table.

Tested: diag build on Linux, VICTORY_KEYS=20:Enter,... walks the title
from its start screen through the first-boot settings to the legal
notices (with SDL gamepads ignored, so the keyboard stand-in is the pad).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Windows dumper suspends threads and unwinds their contexts; on Linux
most title threads wait inside our host code, which has no .pdata. A
signal makes each thread with a TEB scan its own stack for return
addresses into registered images (a call just before them), and the
dumper prints them as module+rva.

Tested: diag build, VICTORY_STACKS=45 prints every thread of a game run,
title frames named per image.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A new Linux thread keeps its creator's GS base, so the poll thread ran the
title's device callbacks on the TEB and static TLS of whichever title
thread first created the hub: per-thread title state (last error, TLS
variables) was shared between the two. It attaches itself before polling,
as the other host threads that run title code do.

Tested: diag build, devices still connect and the keyboard stand-in pad
drives the title's menus.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A title watchdog that ends a stalled run leaves only its own crash; what
stalled is elsewhere. Diagnostics builds on Linux now have what Windows
has and a bit more:
- VICTORY_CRASH_SAVE saves title ranges with the crash report;
- VICTORY_STACKS takes 'crash' for one more dump at the crash, and the
  dumps name return addresses into our own executable too (addr2line);
  a host thread whose GS base points at another thread's TEB scans
  256 KiB instead of up to that thread's stack;
- victory_loader::seh=debug logs every first-chance exception with its
  frames.

Tested: diag build; a watchdog kill in the world prints every thread's
title and host frames and saves the requested ranges.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
VICTORY_GPU_TIMING times each list once it ends; one that never ends
(a GPU hang, an endless shader loop) was never named. A watcher now logs
the list's pipelines and last commands while it still runs.

Tested: diag build with VICTORY_GPU_TIMING=1 in the world.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A title that stalls waiting on itself shows only futex waits in a stack
dump. In diagnostics builds an INFINITE wait still waiting after 10 s
now logs its handles, their kind and state and the thread, and logs the
next change of those objects (who signals them), then when the wait
ends.

Tested: diag build in the world: a stalled load named the semaphore the
loader waited on and showed it was never released.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The placeholder test and physical_pages_map_alias_and_free both check
which pool pages they get back; run in parallel, one took the page the
other had just freed (seen once in a workspace run). They now hold one
lock. The status table no longer says dstorage waits for xmem.

Tested: cargo test -p victory-loader --lib, 8 runs, all pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This reverts commit 1c6a939a271c53bbc4456c48042cfd8377bf0bd0.
Replaces this branch's own fix of the same bug (reverted above): main
already annotates an atomic's handle as U32, and #177 keys the handle
cache by the element type too, which is the whole fix for the float
OpAtomicUMax that crashed NVIDIA's compiler on Linux.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On Linux every submission copied the title's GPU memory whole (5-13 GB
per world frame, about 0.5 fps): there is no GetWriteWatch, and the
Windows guard on view memory was off. The region table now guards every
64 KiB block a copy took (private memory and views alike) with
mprotect, and the fault handler takes the first write to one before
anything else sees it, from title code or ours: the block is writable
again and counts written. The state the handler touches is one bit per
block in a lazily backed reservation: lock-free and allocation-free.

The table keeps answering the protection the title set, and every change
of protection or mapping (commit, decommit, release, VirtualProtect,
views, physical pages, aliases) opens the guarded blocks it touches
first. It also knows which blocks show the same section pages, so a page
shown at several addresses is guarded at all of them and a write through
any counts for each; writes into the pool outside the views
(DirectStorage's write_physical and page windows, freed pages reading
zero) open the blocks showing them. Kernel writes (read(2) into a
guarded block returns EFAULT) are opened first in the Linux file layer
(ReadFile, the UCRT's read) and in DirectStorage's raw reads, as Windows
does. A write fault on a block another thread just opened is retried
after a write probe (an atomic or of zero) says it is writable.

victory-gpu's journal is shared: only "pages written since the last
asking" is per OS (GetWriteWatch plus the view guard on Windows, the
region table on Linux). Windows behaviour is unchanged.

Tested: cargo test --workspace (414 passed, 12 ignored; new
vm::tests::guarded_blocks_see_every_writer and
writes_through_any_alias_count), Windows cargo check (no diagnostics),
cargo xtask policy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The first compile in DXC's libdxcompiler (the indirect argument clamp,
at the world's first indirect execution) installs LLVM's own handlers
for SIGSEGV, SIGBUS, SIGILL and SIGFPE (SA_RESETHAND). After it, the
next fault in title code did not reach our handler and the kernel ended
the process: a title exception from then on, and with write watching
the next write to a guarded block (seen: title-main storing into the
174 MB buffer, a core and no line from us).

LLVM registers once per process, so the clamp's DXIL is now compiled
once, at the host device's creation (before any copy guards title
memory), and signals::reclaim() puts our handlers back right after it.

Tested: argument_clamp_builds with VICTORY_DXCOMPILER now checks the
handler is ours after the compile (it was LLVM's before); cargo test
--workspace (414 passed, 12 ignored); Windows cargo check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/linux.md: write watching is done on Linux (how the region table
guards, what the kernel cannot do and who opens for it). watch::open
steps over bitmap words with nothing guarded: releasing a big
reservation walked every block of it.

Tested: cargo test --workspace (414 passed, 12 ignored), cargo xtask
policy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The world load stalled in most runs on the RTX 5090: one host submission
never finished and the title's watchdog ended the run. It was not a spinning shader: each stall came with an
NVIDIA Xid 13 "SM Warp Exception: MMU Fault" in the kernel log, after which
the channel stops and the fence is never signalled.

With the lists' commands serialized and a GPU breadcrumb per command, the
faulting command was a dispatch of compute 72f552f4553fb5f9 every time.
Dropping its raw (offen) buffer loads, alone, let the run reach the world;
dropping its structured loads or its images did not. Its raw offsets come
from data arithmetic ((x - 1) * stride and the like) that wraps to near
2^32. The console's buffer loads bound such an offset by the record count
and read 0; through vkd3d-proton's robust raw access chains on NVIDIA
620.73 they faulted instead. Descriptor QA (vkd3d-proton built with
enable_descriptor_qa) found no bad descriptor, never freeing slot and
shadow resources changed nothing, and no view runs past its host buffer.

Every raw buffer load, store and atomic through a view now takes its byte
offset bounded by RAW_OFFSET_MAX (0x7FFF_FFF0): still past any view, so
reads give 0 and writes are dropped, as on the console; the bound keeps
offset plus access below 2^31.

Root SRVs are bare addresses on vkd3d-proton (nothing bounds them), and
the mesh programs' vertex fetch builds descriptors without a record limit
around them, at indices from data. Each root SRV now gets a user-data
dword (at its parameter's own index) with the bytes its host buffer holds
from the address; loads not wholly within it read offset 0 and return 0,
and a root SRV with no host memory behind it is bound to scratch with
length 0 instead of being left unset. All raw loads go through one helper
(raw_load) for this.

Tested: 6 runs in a row reach the world and stay there for 200 s (0.6-0.8
fps, 960-5300 draws a frame), no watchdog, no Xid; before, 4 of 5 runs
stalled at the world load (12 of 14 with diagnostics builds). cargo test
--workspace 414 passed, 12 ignored; victory-shader (host) and victory-gpu
device tests on vkd3d-proton pass, with two new ones (raw offsets past the
limit, root SRV length); Windows type-check clean; cargo xtask policy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Finding the world-load stall needed the command the GPU never finished:
the 5-second watcher only listed a stuck list's last commands, and
dispatches without barriers between them overlap, so even a timestamp
says little about which one hangs.

With timing on (diagnostics builds), each noted command now ends with a
global UAV barrier and a marker-out write of its index to a mapped
read-back dword (WriteBufferImmediate; vkd3d-proton writes it with
vkCmdWriteBufferMarkerAMD at bottom of pipe). A list still running after
5 s names the first command not finished and logs every command of the
list. The barrier serializes a timed list's commands, which also makes
the per-command times exact.

VICTORY_SHADER_SAVE=<dir> saves each shader container the title passes,
as <hash>.<stage>, so `victory shader-info --disasm` and `victory
translate --pipelines` (with VKD3D_SHADER_DUMP_PATH for the SPIR-V) can
take one program apart. The files go where the user says, never into the
repository.

Tested: the stall runs named compute 72f552f4553fb5f9 as the unfinished
command in serialized lists (and the fix in the previous commit removed
the stall); cargo test --workspace 414 passed, 12 ignored; Windows
type-check clean; cargo xtask policy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:07:12 +00:00
github-bot closed this pull request 2026-11-26 04:07:12 +00:00
Author
Owner

@⁠KoLolX3 on GitHub · 2026-11-24 05:35 UTC · original

Check on Linux, not Windows: pass. Head 323168050 merged onto main d2a4bae1f (clean merge).

  • Native tests of the seven crates that build on Linux (core, formats, game, loader, pe, pipeline, shader): PR 140 passed, 0 failed, main 92 passed, 7 failed. The 7 tests that fail on main no longer fail.
  • Whole workspace, native Linux (what this PR is for): cargo check --workspace --all-targets ok and cargo test --workspace ok: 412 passed, 0 failed, 12 ignored. On main the same check fails to build (3 errors). Only the test run, not the new native runtime itself (no game, no GPU host).
  • Windows cross type-check of the whole workspace (cargo xwin check --workspace --target x86_64-pc-windows-msvc, covers victory-gpu, victory-hle and the app): PR ok, main ok.
  • Tests this PR adds: 192, of which 41 ran in the native run (the pass count rose by 41); the other 151 are in code this run does not execute (cfg(windows) modules, the victory-gpu and victory-hle crates, or ignored tests), and were not run.
  • rustfmt: unformatted hunks, PR 756, main 168.
  • Failing on main here as well (not this PR): 7 tests in victory-loader and victory-pe that parse their own test binary as a PE image, which is an ELF file on Linux.
  • Not run: victory-gpu / victory-hle tests and the game itself.

On: AMD Ryzen 7 5700, 62 GB RAM, Artix Linux 7.3.4-artix1-2, rustc 1.98.1 (the repo's pinned toolchain), cargo-xwin 0.24.1. No game data. Automated check only: the code itself was not reviewed.

**@⁠KoLolX3** on GitHub · 2026-11-24 05:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/526#issuecomment-7123083141) Check on Linux, not Windows: **pass**. Head `323168050` merged onto `main` `d2a4bae1f` (clean merge). - Native tests of the seven crates that build on Linux (`core`, `formats`, `game`, `loader`, `pe`, `pipeline`, `shader`): PR `140 passed, 0 failed`, `main` `92 passed, 7 failed`. The 7 tests that fail on `main` no longer fail. - **Whole workspace, native Linux** (what this PR is for): `cargo check --workspace --all-targets` ok and `cargo test --workspace` ok: **412 passed, 0 failed, 12 ignored**. On `main` the same check fails to build (3 errors). Only the test run, not the new native runtime itself (no game, no GPU host). - Windows cross type-check of the whole workspace (`cargo xwin check --workspace --target x86_64-pc-windows-msvc`, covers `victory-gpu`, `victory-hle` and the app): PR ok, `main` ok. - Tests this PR adds: 192, of which 41 ran in the native run (the pass count rose by 41); the other 151 are in code this run does not execute (`cfg(windows)` modules, the `victory-gpu` and `victory-hle` crates, or ignored tests), and were **not run**. - rustfmt: unformatted hunks, PR 756, `main` 168. - Failing on `main` here as well (not this PR): 7 tests in `victory-loader` and `victory-pe` that parse their own test binary as a PE image, which is an ELF file on Linux. - Not run: `victory-gpu` / `victory-hle` tests and the game itself. On: AMD Ryzen 7 5700, 62 GB RAM, Artix Linux 7.3.4-artix1-2, rustc 1.98.1 (the repo's pinned toolchain), cargo-xwin 0.24.1. No game data. Automated check only: the code itself was not reviewed.
Author
Owner

@⁠cobrabm12 on GitHub · 2026-11-24 10:10 UTC · original · edited 2026-11-24 10:23 UTC

Linux hardware test on an 8 GB Radeon RX 7600 (Navi 33), Mesa RADV 26.2.5, SDL 3.4.18. I built the Linux runtime at d46727f, native vkd3d-proton at 30b0eb9bc12d and used Microsoft's Linux DXC v1.9.2609. I used the default Series X profile and a local save that had completed first-boot setup. The native runtime used its own storage implementation.

The account picker responded to keyboard input. The illustrated load advanced to the “Vice City, Two Years Ago” chapter card. The runtime logged 240 successful mesh pipeline creations before I stopped the run. In four successive intervals during the transition it reported 0.9, 0.5, 0.9 and 1.0 fps. The final visible frame was black. Player movement and a visible world remain unverified.

On the same PC, the Windows runtime at ffe310e under Wine 11.21 exited at the first mesh pipeline, both with the default storage implementation and with a Leonida provider. Across these tests the graphics software versions also differ, so this comparison identifies a working route to the chapter card without establishing the cause of the difference.

CPU validation of the shaders used in this run

I matched all 1,257 distinct shader containers seen during startup, loading and the first scene to the local installation. For each build I called the same translator as the native runtime and checked every emitted module with Microsoft's Linux DXIL validator (DXC v1.9.2609).

Linux build Validated Unsupported by translator Rejected by validator
#526 at d46727f 958 288 11
With #180 987 269 1
With #193 973 273 11
With #180 and #193 1,002 254 1
With #180, #704 (includes #193), and the stable signature ordering from #306 1,003 254 0

All 958 baseline successes still validated. Of the 45 additional successes, 37 were compute, six pixel and two mesh shaders. On the #180 + #193 build, applying the signature ordering change alone cleared the remaining mesh output-signature error. The #704 integration also includes its descriptor-heap prerequisites cbb50b8, 3c81420 and e8d3b64 and builds natively. Rendering and frame rate on that build are still unverified.

**@⁠cobrabm12** on GitHub · 2026-11-24 10:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/526#issuecomment-7128409191) · edited 2026-11-24 10:23 UTC Linux hardware test on an 8 GB Radeon RX 7600 (Navi 33), Mesa RADV 26.2.5, SDL 3.4.18. I built the Linux runtime at d46727f, native vkd3d-proton at 30b0eb9bc12d and used Microsoft's Linux DXC v1.9.2609. I used the default Series X profile and a local save that had completed first-boot setup. The native runtime used its own storage implementation. The account picker responded to keyboard input. The illustrated load advanced to the “Vice City, Two Years Ago” chapter card. The runtime logged 240 successful mesh pipeline creations before I stopped the run. In four successive intervals during the transition it reported 0.9, 0.5, 0.9 and 1.0 fps. The final visible frame was black. Player movement and a visible world remain unverified. On the same PC, the Windows runtime at ffe310e under Wine 11.21 exited at the first mesh pipeline, both with the default storage implementation and with a Leonida provider. Across these tests the graphics software versions also differ, so this comparison identifies a working route to the chapter card without establishing the cause of the difference. ### CPU validation of the shaders used in this run I matched all 1,257 distinct shader containers seen during startup, loading and the first scene to the local installation. For each build I called the same translator as the native runtime and checked every emitted module with Microsoft's Linux DXIL validator (DXC v1.9.2609). | Linux build | Validated | Unsupported by translator | Rejected by validator | | --- | ---: | ---: | ---: | | #526 at d46727f | 958 | 288 | 11 | | With #180 | 987 | 269 | 1 | | With #193 | 973 | 273 | 11 | | With #180 and #193 | 1,002 | 254 | 1 | | With #180, #704 (includes #193), and the stable signature ordering from #306 | 1,003 | 254 | 0 | All 958 baseline successes still validated. Of the 45 additional successes, 37 were compute, six pixel and two mesh shaders. On the #180 + #193 build, applying the signature ordering change alone cleared the remaining mesh output-signature error. The #704 integration also includes its descriptor-heap prerequisites cbb50b8, 3c81420 and e8d3b64 and builds natively. Rendering and frame rate on that build are still unverified.
Author
Owner

@⁠onpeek on GitHub · 2026-11-24 16:58 UTC · original

Ran GTA VI on this branch natively (RTX 4070, Arch) and hit three bugs. Fixes against linux-native-runtime are in spidercraft/VIctory#2:

  • GetProcAddress returned null for title DLLs mapped by our PE loader. GTA VI's FidelityFX loader looks up ffxCreateContext in amd_fidelityfx_upscaler_xbox.dll and calls it, so the game crashed about 4 s in (call to 0x0). With the fix it gets past the menus to the world load.
  • cas16 (cmpxchg16b) could get rbx as an in(reg) operand, which the manual rbx swap then clobbered. The SList tests segfaulted. Fixed registers now.
  • host_and_guest_blocks_mix was flaky under parallel tests (it read an uninitialized malloc byte and used a wrong upper bound).
**@⁠onpeek** on GitHub · 2026-11-24 16:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/526#issuecomment-7138491584) Ran GTA VI on this branch natively (RTX 4070, Arch) and hit three bugs. Fixes against `linux-native-runtime` are in spidercraft/VIctory#2: - **`GetProcAddress` returned null for title DLLs mapped by our PE loader.** GTA VI's FidelityFX loader looks up `ffxCreateContext` in `amd_fidelityfx_upscaler_xbox.dll` and calls it, so the game crashed about 4 s in (call to 0x0). With the fix it gets past the menus to the world load. - **`cas16` (`cmpxchg16b`) could get rbx as an `in(reg)` operand,** which the manual rbx swap then clobbered. The SList tests segfaulted. Fixed registers now. - **`host_and_guest_blocks_mix` was flaky under parallel tests** (it read an uninitialized `malloc` byte and used a wrong upper bound).
Author
Owner

@⁠toothpaste011 on GitHub · 2026-11-24 15:57 UTC · original · edited 2026-11-24 17:23 UTC

Tested linux-native-runtime (d46727f) on Gentoo (kernel 7.0.10, Niri/Wayland, Intel Core Ultra 7 265K, RTX 5070 Ti, native vkd3d-proton ec20719452e916b, Microsoft Linux DXC v1.9.2609).

Intel CPU boot crash (0xc000001d / SIGILL)

On Intel CPUs, boot traps immediately with an unhandled 0xc000001d (SIGILL) on clzero (0f 01 fc) because crash.rs::emulate_amd_only (clzero, monitorx/mwaitx, clwb, SSE4a extrq/insertq) isn't ported to victory_loader::linux::signals yet.

Opened a fix against linux-native-runtime in spidercraft/VIctory#3 (handles SIGILL directly on ucontext_t, collapses clzero loops, updates XSAVE xstate_bv bit 1 for SSE4a, and adds synthetic ucontext_t unit tests so AMD hosts and CI exercise every branch alongside the live-execution test).

Hardware results after the fix (RTX 5070 Ti, Wayland/Niri)

  • Boot, first-boot setup screens, menus, and loading run at a locked 30.0 fps (1.2–2.6 ms GPU; DXC indirect argument clamp compiles and runs).
  • Reaches the world loop at 1.2–2.6 fps (~2,000–3,900 draws/frame, ~1,558 translated shaders / 1,039 cached pipelines), with no crashes or NVIDIA driver hangs.
  • World-stage host notes on RTX 5070 Ti:
    • 116 host pipelines refused by vkd3d-proton (Required WaveSize range [64, 64], but supported range is [32, 32]).
    • 1x WARN victory_gpu::descriptor::host: no free dynamic descriptor slots: a table is not made n=7 on world entry.
**@⁠toothpaste011** on GitHub · 2026-11-24 15:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/526#issuecomment-7136891985) · edited 2026-11-24 17:23 UTC Tested `linux-native-runtime` (`d46727f`) on Gentoo (kernel 7.0.10, Niri/Wayland, Intel Core Ultra 7 265K, RTX 5070 Ti, native vkd3d-proton `ec20719452e916b`, Microsoft Linux DXC v1.9.2609). ### Intel CPU boot crash (`0xc000001d` / `SIGILL`) On Intel CPUs, boot traps immediately with an unhandled `0xc000001d` (`SIGILL`) on `clzero` (`0f 01 fc`) because `crash.rs::emulate_amd_only` (`clzero`, `monitorx`/`mwaitx`, `clwb`, SSE4a `extrq`/`insertq`) isn't ported to `victory_loader::linux::signals` yet. Opened a fix against `linux-native-runtime` in spidercraft/VIctory#3 (handles `SIGILL` directly on `ucontext_t`, collapses `clzero` loops, updates XSAVE `xstate_bv` bit 1 for SSE4a, and adds synthetic `ucontext_t` unit tests so AMD hosts and CI exercise every branch alongside the live-execution test). ### Hardware results after the fix (RTX 5070 Ti, Wayland/Niri) - Boot, first-boot setup screens, menus, and loading run at a locked **30.0 fps** (`1.2–2.6 ms` GPU; DXC indirect argument clamp compiles and runs). - Reaches the world loop at **1.2–2.6 fps** (~2,000–3,900 draws/frame, ~1,558 translated shaders / 1,039 cached pipelines), with no crashes or NVIDIA driver hangs. - World-stage host notes on RTX 5070 Ti: - `116` host pipelines refused by vkd3d-proton (`Required WaveSize range [64, 64], but supported range is [32, 32]`). - `1x` `WARN victory_gpu::descriptor::host: no free dynamic descriptor slots: a table is not made n=7` on world entry.
Author
Owner

@⁠x3ero0 on GitHub · 2026-11-24 19:27 UTC · original

Test report for d46727f on NVIDIA, with every run inside a bubblewrap sandbox. (I left the review comment about listen earlier; the fix for that is spidercraft/VIctory#1.)

Setup: RTX 5080, driver 620.70, Ryzen 7 9800X3D, CachyOS (kernel 7.3.5), KDE Wayland, SDL3 on Wayland. Native vkd3d-proton built from 30b0eb9. Diagnostics build, Series X 1.0.2.1, an existing local save, menus driven by VICTORY_KEYS.

Sandbox: bwrap --unshare-all --clearenv, no network namespace beyond loopback, no home directory, the game folder read-only, only the cache and data folders writable, the Wayland socket and the NVIDIA device nodes bound. The runtime needs nothing else. Audio was not exposed, so pa_simple_new fails and it plays silently, as designed.

Build and tests

  • Builds natively; run maps and binds with 0 missing imports.
  • cargo test --workspace: 416 passed, 0 failed.
  • linux::vm::tests::physical_pages_map_alias_and_free failed once in five full-workspace runs (region_size 65536, expected 196608 at vm.rs:1875) and passed alone six times in a row. It looks order- or parallelism-dependent; I have not looked into it.

Title runs

Run Length Last frame Result
1 95 s 1376 0xc0000005 at game_scarlett_master.exe+0xc4b94e (write 0x670fc04), in the world
2 260 s 1715 ran to the time limit
3 260 s 1686 ran to the time limit
4 430 s 2121 ran to the time limit
5 430 s 1569 ran to the time limit; with DXC v1.9.2609 (VICTORY_DXCOMPILER)
  • Boot, the intro video, the start screen and the loading art run at 30 fps.
  • In the opening sequence the frame rate is 0.5 to 14 fps (mean 3 to 4.6 across runs). The illustrated credit cards draw correctly; the 3D scene behind them is black apart from the credit text.
  • The crash in run 1 did not come back in four further runs.
  • For comparison, the Windows build of main + #177 + #259 under GE-Proton on the same machine stops about a minute into the world at the title's +0x23cf683 (#1118). None of the native runs hit that in up to six minutes of world time.

What the log gives as causes

Message Runs 1 to 4 Run 5 (DXC)
Indirect execution dropped, not bounded (no clamp...) several hundred draws and dispatches per world frame none
Compute pipelines refused, Required WaveSize range [64, 64], but supported range is [32, 32] 79 to 99 142
Shaders that do not translate 95 to 142 523
no host texture (2560x1440, formats 86 and 115) 2 2
host view heap capped at 1000000, asked 1245184 1 1
Device methods not implemented, slots 0x1c8 and 0x218 1 each 1 each

With DXC the indirect draws run, more of the title's pipelines get requested (hence the higher counts), frames get slower (mean 2.2 fps against 3.2 in run 4), and the scene is still dark. So on this card the missing picture is not the dropped indirect execution.

On the DXC dependency: without VICTORY_DXCOMPILER every indirect execution is dropped, and Arch's package is unusable as docs/linux.md says. #190 builds the same clamp with the shader crate's own writer, so merging or rebasing onto it would remove the need for a compiler here too. I tried that design on this branch: with the clamp emitted that way and no DXC, a run reaches the world with zero not bounded drops.

Single machine, one GPU, runs of a few minutes; I did not play past the opening sequence.

**@⁠x3ero0** on GitHub · 2026-11-24 19:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/526#issuecomment-7142117866) Test report for `d46727f` on NVIDIA, with every run inside a bubblewrap sandbox. (I left the review comment about `listen` earlier; the fix for that is spidercraft/VIctory#1.) **Setup:** RTX 5080, driver 620.70, Ryzen 7 9800X3D, CachyOS (kernel 7.3.5), KDE Wayland, SDL3 on Wayland. Native vkd3d-proton built from `30b0eb9`. Diagnostics build, Series X 1.0.2.1, an existing local save, menus driven by `VICTORY_KEYS`. **Sandbox:** `bwrap --unshare-all --clearenv`, no network namespace beyond loopback, no home directory, the game folder read-only, only the cache and data folders writable, the Wayland socket and the NVIDIA device nodes bound. The runtime needs nothing else. Audio was not exposed, so `pa_simple_new` fails and it plays silently, as designed. ### Build and tests - Builds natively; `run` maps and binds with 0 missing imports. - `cargo test --workspace`: 416 passed, 0 failed. - `linux::vm::tests::physical_pages_map_alias_and_free` failed once in five full-workspace runs (`region_size` 65536, expected 196608 at `vm.rs:1875`) and passed alone six times in a row. It looks order- or parallelism-dependent; I have not looked into it. ### Title runs | Run | Length | Last frame | Result | |---|---|---|---| | 1 | 95 s | 1376 | `0xc0000005` at `game_scarlett_master.exe+0xc4b94e` (write `0x670fc04`), in the world | | 2 | 260 s | 1715 | ran to the time limit | | 3 | 260 s | 1686 | ran to the time limit | | 4 | 430 s | 2121 | ran to the time limit | | 5 | 430 s | 1569 | ran to the time limit; with DXC v1.9.2609 (`VICTORY_DXCOMPILER`) | - Boot, the intro video, the start screen and the loading art run at 30 fps. - In the opening sequence the frame rate is 0.5 to 14 fps (mean 3 to 4.6 across runs). The illustrated credit cards draw correctly; the 3D scene behind them is black apart from the credit text. - The crash in run 1 did not come back in four further runs. - For comparison, the Windows build of `main` + #177 + #259 under GE-Proton on the same machine stops about a minute into the world at the title's `+0x23cf683` (#1118). None of the native runs hit that in up to six minutes of world time. ### What the log gives as causes | Message | Runs 1 to 4 | Run 5 (DXC) | |---|---|---| | Indirect execution dropped, `not bounded (no clamp...)` | several hundred draws and dispatches per world frame | none | | Compute pipelines refused, `Required WaveSize range [64, 64], but supported range is [32, 32]` | 79 to 99 | 142 | | Shaders that do not translate | 95 to 142 | 523 | | `no host texture` (2560x1440, formats 86 and 115) | 2 | 2 | | `host view heap capped at 1000000`, asked 1245184 | 1 | 1 | | Device methods not implemented, slots `0x1c8` and `0x218` | 1 each | 1 each | With DXC the indirect draws run, more of the title's pipelines get requested (hence the higher counts), frames get slower (mean 2.2 fps against 3.2 in run 4), and the scene is still dark. So on this card the missing picture is not the dropped indirect execution. On the DXC dependency: without `VICTORY_DXCOMPILER` every indirect execution is dropped, and Arch's package is unusable as `docs/linux.md` says. #190 builds the same clamp with the shader crate's own writer, so merging or rebasing onto it would remove the need for a compiler here too. I tried that design on this branch: with the clamp emitted that way and no DXC, a run reaches the world with zero `not bounded` drops. Single machine, one GPU, runs of a few minutes; I did not play past the opening sequence.
@ -0,0 +414,4 @@
let fd = fd_or_fail!(s);
// SAFETY: plain call on our descriptor.
if unsafe { libc::listen(fd, backlog) } != 0 { os_fail() } else { 0 }
}
Author
Owner

@⁠x3ero0 on GitHub · 2026-11-24 16:04 UTC · original

listen goes straight to the kernel, and Linux binds an unbound socket to all interfaces at that point (0.0.0.0 and a port it chooses), so other machines can connect in. That gets around the narrowing bind does. Winsock returns WSAEINVAL for listen on an unbound socket, so refusing it here matches Windows.

The same happens with a first sendto from an unbound datagram socket: it is bound to 0.0.0.0 and can then receive datagrams from the network.

spidercraft/VIctory#1 fixes both against this branch, with a test: listen fails with WSAEINVAL unless the socket has a loopback address, and sendto binds an unbound datagram socket to loopback first.

**@⁠x3ero0** on GitHub · 2026-11-24 16:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/526#discussion_r4682841863) `listen` goes straight to the kernel, and Linux binds an unbound socket to all interfaces at that point (`0.0.0.0` and a port it chooses), so other machines can connect in. That gets around the narrowing `bind` does. Winsock returns `WSAEINVAL` for `listen` on an unbound socket, so refusing it here matches Windows. The same happens with a first `sendto` from an unbound datagram socket: it is bound to `0.0.0.0` and can then receive datagrams from the network. spidercraft/VIctory#1 fixes both against this branch, with a test: `listen` fails with `WSAEINVAL` unless the socket has a loopback address, and `sendto` binds an unbound datagram socket to loopback first.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:03 UTC · original

Automated triage for the maintainers. Closing because it is outside the project's scope (VIctory targets Windows hosts; ports, launchers and tooling for other platforms are not being taken).

Native Linux runtime, 38,000 lines over 155 files (own loader, SEH, a new crate with a build script, libc and serde_json, a docs/linux.md design document, an edit to xtask/src/policy.rs): a port, out of scope.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 00:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/526#issuecomment-7148095178) Automated triage for the maintainers. Closing because it is outside the project's scope (VIctory targets Windows hosts; ports, launchers and tooling for other platforms are not being taken). Native Linux runtime, 38,000 lines over 155 files (own loader, SEH, a new crate with a build script, libc and serde_json, a docs/linux.md design document, an edit to xtask/src/policy.rs): a port, out of scope. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!526
No description provided.