Commit Graph
25 Commits
Author SHA1 Message Date
tedin7 85d03354fb fix: skip unused export address slots instead of reporting them at RVA 0 2026-11-24 01:15:10 +01:00
MarvisandClaude Fable 5.2 62b737a69b GPU: pipelines off the render thread and cached; indirect execution on
With indirect execution the world's first frame asked for over 1,200
pipelines at once and took more than 30 s, so the title's own GPU
watchdog ended the run. Host pipelines are now made by worker threads: a
first use waits at most 0.5 s per title frame, and that pipeline's draws
are dropped until it is ready. The world presents frames again, and
indirect execution is the default (the switch is gone).

Pipelines are cached across runs:
- every host pipeline goes into a pipeline library saved under the cache
  folder (named by a hash of the translated code, our root signature and
  the state; a blob the device rejects starts an empty library);
- the pipelines drawn with are remembered and started during loading on
  the next run.
One cold and one warm run: the last pipeline was ready 38 s after the
world's first frame cold, 1.4 s warm; the first world frame took 3.2 s
cold, 0.37 s warm.

Also:
- Copy-backs of shader-written ranges return only the bytes the GPU
  changed; they used to overwrite what the title's CPU wrote meanwhile,
  which crashed the title.
- Indirect dispatch records are bounded (group counts were not), and the
  console's single-dispatch argument type runs as a dispatch.
- Per-shader counts of dropped draws in the diagnostics log; a switch
  that submits and times each list alone.

Not working yet: the world shows no geometry, and runs end on a GPU page
fault after at most about 55 s.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-24 01:02:11 +01:00
Marvis b9aff99b98 Merge pull request #21 from Nostyxx/fix/nvidia-view-heap-cap
GPU: make tables past a capped host view heap afresh (NVIDIA menu hang)
2026-11-24 00:34:23 +01:00
Marvis 6d7df474b3 Merge pull request #19 from raffclar/exit-watchdog
Process exit: start the watchdog before other threads end
2026-11-24 00:31:26 +01:00
Marvis c07f19d559 Merge pull request #15 from 9hvn9yt2vk-netizen/fix-texture-extents
texture: refuse extents past 16384 texels instead of overflowing
2026-11-24 00:28:40 +01:00
Marvis b8000d18dc Merge pull request #14 from 9hvn9yt2vk-netizen/fix-xma-zero-length
xma: stop at a zero-length frame instead of looping forever
2026-11-24 00:18:09 +01:00
NostyxxandClaude Opus 5.5 f3ae2edbd4 GPU: make tables past a capped host view heap afresh
The title's shader-visible view heap has 1,245,184 slots. NVIDIA caps
shader-visible view heaps at 1,000,000, so HostHeap::new falls back to a
heap of 1,000,000 whose title part ends at 934,464, with the dynamic
slots after it. The title binds a per-frame table ring in its top slots
(934,464 to 1,245,184, moving 4,096 slots a frame), so those tables'
host offsets either aliased the dynamic slots or ran past the heap's
end. On NVIDIA the GPU then hangs within the first-boot screens
(DXGI_ERROR_DEVICE_HUNG), after black and glitched frames.

A table that reaches past the host heap's title slots is now made
afresh in dynamic slots, as tables holding constant buffers already
are, and the shader is given the new offset. Hosts that take the whole
heap (AMD) are unchanged. mirror() logs the highest title slot it
meets past the host heap, once per new maximum.

Tested on an RTX 3080 (driver 32.0.16.2114): the first-boot screens and
menus run without glitches, and the title loads into the intro with no
device loss (before: device removed about 45-60 s in, 3 of 3 runs). The
slot warning went from 78 lines to none. cargo test --workspace passes.

Refs #16, #11

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 06:16:01 +07:00
MarvisandClaude Fable 5.2 d50f2368cb GPU: the world stays up; indirect execution behind a switch
The host device was removed seconds into the world because a shader read
a descriptor of the wrong kind: empty slots held a null 2D texture view
where the shader expected a buffer, which gave a garbage heap index and
a read far past the view heap. Null descriptors now have the kind the
shader expects (raw buffer, constant buffer, or a texture of the title's
own dimension). The world then ran to a 240 s time limit with no removal.

Also:
- Host lists hold the textures, pipelines, root signatures and heaps they
  name, and heap slots hold the resource they view (the title releases
  objects before submitting lists that use them).
- The device-removed report places the fault against the host descriptor
  heaps and names our own uploads; VICTORY_D3D12_GBV turns on GPU-based
  validation, VICTORY_DUMP_TARGETS works.
- Indirect execution (draw, indexed draw, dispatch, mesh dispatch): the
  world draws most of its geometry this way. Arguments are clamped and
  charged to a per-list budget by a small compute pass first, so garbage
  cannot hang the GPU. Off by default (VICTORY_INDIRECT=1): with it on
  the title's own GPU watchdog ends the run about 30 s into the world.
- Shader-written ranges are copied back once per submission and only
  where they differ; refreshes beside them copy only stale pages. The
  frame-rate line counts copy-backs and dropped draws.

Not working yet: the world's picture is black (indirect draws off, and
hundreds of draws per frame have no translated shader).

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-24 00:13:19 +01:00
MarvisandClaude Fable 5.2 1922261412 Shaders: sine and cosine in turns, exact zeros at half and quarter turns
v_sin and v_cos (f32 and f16) take an angle in turns. The whole turns
now come off first (x - round_even(x), exact), so a large angle keeps
its fraction of a turn instead of losing it when scaled to radians.
The sine of a half turn and the cosine of a quarter turn are exactly +0,
as the hardware gives; the host's functions of the rounded angle give
about 1e-7. A zero operand passes unreduced, so sin(-0) stays -0.

float_semantics_are_the_consoles asserts the exact zeros (it failed
before this change). The compiler the tests use takes whole turns off
itself, so the large-angle path cannot be reached from HLSL and rests
on the measurements cited in issue #2.

Left from the issue: denormal operands of the legacy multiply, which
needs the float mode register as state first.

Refs #2

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-24 00:13:19 +01:00
MarvisandClaude Fable 5.2 5d52765de7 Shaders: med3 with NaN, fract below 1.0, signed bit fields past bit 31
Three lowerings gave results the console's GPU does not (issue #2, from
hardware measurements published by another project):

- v_med3_f32/f16: with a NaN operand the hardware gives the minimum of
  the three; we gave the median of the other two.
- v_fract_f32/f16: the hardware never reaches 1.0 (a tiny negative
  input gives the largest value below it); the host's own fract differs
  by vendor and can give 1.0.
- v_bfe_i32/s_bfe_i32: a signed field running past bit 31 extends from
  bit 31; the shift is arithmetic now. Fields that fit are unchanged.

The fract case is asserted in float_semantics_are_the_consoles (the
console compiler emits v_fract_f32 for frac). The other two cannot be
produced from HLSL with the compiler the tests use and rest on the
measured values in the issue.

Still open from the issue: range reduction before sine and cosine, and
denormal operands of the legacy multiply.

Refs #2

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-24 00:13:19 +01:00
9hvn9yt2vk-netizen 2ad0a1ef74 texture: refuse extents past 16384 texels instead of overflowing
Layout::new checked that width, height and depth are non-zero but not that
they are bounded, so values a title passes unchecked (up to u32::MAX)
overflowed the size arithmetic: `offset * depth` in the linear layout,
`slice_size * slices` and the per-mip sizes in the tiled one, and a u32
next_multiple_of in Layout::tiled. Debug builds panicked; release builds
wrapped silently and returned a wrong size.

Refuse anything past 16384 texels per side, the most a GFX10 image
descriptor holds, so no texture the GPU can use is affected.

Found with a random-input harness (four distinct overflow sites, none left
after this change).
2026-11-24 00:08:59 +01:00
Marvis abb8d9fe14 Merge pull request #10 from ismailchaka1/emulate-amd-only-instructions
loader: emulate AMD-only instructions on Intel CPUs
2026-11-24 00:08:20 +01:00
raffclar 1d1f82651a Process exit: start the watchdog before other threads end
The exit code ended the other threads first and then started the
watchdog. A thread that ends can hold the heap lock or the loader lock.
A new thread needs both, so the watchdog did not start and the exit did
not stop.

Now the exit code starts the watchdog and waits until it runs its own
code: only then are its loader notices and Rust's thread set-up done.
The watchdog publishes its thread id, and end_other_threads does not
end it. The wait has the same deadline as the detach, because this
thread, or a thread that waits for it, can hold the loader lock; then
the watchdog cannot start.

After the deadline the watchdog only ends the process. It does not
log, because logging needs the heap and the lock of the log writer.

The exit test now also checks that a thread in `keep` is not ended.
2026-11-23 23:08:01 +00:00
9hvn9yt2vk-netizen 72fbbc3f87 xma: stop at a zero-length frame instead of looping forever
next_frame walks the frames before `start` to learn whether the frame at
`start` is the packet's last. A damaged packet whose earlier frame has a
length of 0 never advanced `at`, so the walk spun forever (in a debug build
it overflowed `number` after about 4 billion rounds and panicked).

Apply the rule read_frame already uses: a length that does not cover its
own 15-bit field is not a frame, and the search ends.

Found with a random-input harness. The new test hangs without the fix and
passes at once with it.
2026-11-24 00:08:01 +01:00
ismailchaka1andClaude Opus 5.5 934e67fbad loader: emulate AMD-only instructions on Intel CPUs
The title is built for Zen 2 and uses clzero, monitorx/mwaitx and SSE4a's
extrq/insertq, which Intel CPUs lack: it died at startup with an illegal
instruction on an i7-14700KF. The vectored handler now does their job and
resumes: clzero zeroes the 64-byte line at rax, monitorx is skipped, mwaitx
yields, extrq/insertq run on the saved XMM registers.

Tested: victory-loader crash tests (new one runs each instruction), and the
title now gets past startup on an i7-14700KF with an RTX 4070 SUPER.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 22:49:54 +00:00
Marvis 4776fb84d0 Merge pull request #4 from Exorion1er/fix/tls-callbacks-reloc
Loader: keep the cleared TLS callback pointer out of base relocations
2026-11-23 23:45:26 +01:00
ExorionandClaude Opus 5.5 c21208c18a Loader: keep the cleared TLS callback pointer out of base relocations
prepare() zeroes the title's TLS AddressOfCallBacks but left the
IMAGE_REL_BASED_DIR64 entry that patches it. When the loader maps the
prepared copy away from its preferred base, that entry turns the 0 into
the rebase delta and the loader reads TLS callbacks from there. On
Windows the copy lands at 0x140000000 so the delta is 0; under Wine,
which maps DYNAMIC_BASE images high, LoadLibraryExW faults in ntdll
before any title code runs.

The entry is now rewritten as IMAGE_REL_BASED_ABSOLUTE (a no-op), and
the prepare test checks that no relocation targets the cleared field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 23:37:05 +01:00
MarvisandClaude Fable 5.2 015d45bfff README: status, subsystem table, how to run, debugging switches
Says how far the title gets (menus at 30 fps, the world reached but not
rendering), what each subsystem does and still needs, and warns that the
world can reset the display driver on a real GPU. Adds how to run the
title, the translate command, and tables for the keyboard pad and the
debugging switches.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-23 23:15:07 +01:00
MarvisandClaude Fable 5.2 2849477415 Run Grand Theft Auto VI from first boot into the world
The title now boots through every first-boot and menu screen at its own
30 fps, drawing with translated shaders, with input, sound, saves and
loading served; it reaches the world, where the host GPU path still
fails (see "Not working yet").

Loader and runtime
- Crash reports unwind properly, name C++ throws and host GPU failures,
  carry the title's last debug lines and are appended to crashes.log.
- Thread notices on our own threads, reentrant late DLL loading, exit in
  the console's order, relaunch on a launch-new-game request.
- Offline guard: the title cannot reach the network (sockets, name
  lookups, WinHTTP, the media source resolver); by-name lookups and
  loads follow the import rules.
- Every runtime area the title calls is served (networking hint,
  packages, store, saves, display, UI, speech stubs, user, async pool).
  Saves persist; an update is one rename and survives a kill at any step.
- DirectStorage reads for real: shared worker pool, priorities, zlib and
  BCPack. BCPack is our own decoder; the format's constant tables ship in
  crates/victory-formats/src/bcpack-tables.bin (the asset policy's one
  exception, see docs/asset-policy.md).
- GameInput from XInput pads and the keyboard, with a keyboard stand-in
  pad; console timers (1 ms) for the whole process.
- Audio: XMA2 decoding on the emulated contexts, Opus on the decoder
  queues, the DSP interface as a stub; title memory placed below 2^40.
- Console texture layouts (sizes, tiling, detiling) and the layout
  library's imports.

GPU
- Draws, mesh dispatches and compute dispatches run on the host with
  shaders translated at first use and cached on disk; descriptor heaps,
  views, root signatures, barriers and host texture states; rectangle
  lists; comparison samplers.
- Title memory reaches the host through persistent mirrors that copy
  only pages written since the last copy; shader-written buffers are
  copied back.
- Presentation with frame pacing per event kind; framerate in the window
  caption.

Shaders
- DXIL emission for vertex, pixel, compute and mesh programs from the
  console's native code, with a differential test suite against the PC
  compile. World set: mesh 8,191 of 8,506, vertex/pixel 10,617 of
  12,346, compute 1,643 of 2,539; utility set complete.

Build
- Debugging aids (debug logs, frame capture, stack dumps, scripted keys,
  the host debug layer, the software adapter) exist only with the
  `diagnostics` feature; `[profile.diag]` keeps that build apart.

Not working yet
- In the world the host device is removed within seconds (descriptor
  handling fixes are in, unproven by a surviving run) and frames present
  black.
- 64-bit image atomics, merged geometry stages and the BVH builder's own
  shaders do not translate; reverb is silent.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2026-11-23 23:10:01 +01:00
MarvisandClaude Opus 5.5 bc3070991a Thread notices: leave out threads Rust's std starts
Their TLS callbacks run before std's start routine records the thread,
and std aborts if anything asks for the current thread first (stdout and
stderr locks do, so title code calling our logging functions would).
Threads starting in our exe (the title's main thread and our runtime's
workers) now get no notices; the probe test starts its thread in title
code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 15:29:46 +01:00
MarvisandClaude Opus 5.5 4b2526918b Thread notices for title images
The prepared images get no DLL_THREAD_ATTACH/DETACH from Windows. A TLS
callback in our exe, called on every thread of the process, passes each
start and end on to the attached images: their TLS callbacks, then a
DLL's DllMain. DisableThreadLibraryCalls stops the DllMain calls and
fails for images with static TLS, as on Windows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 15:16:37 +01:00
MarvisandClaude Opus 5.5 d032b8a241 Title DLLs at run time: find by name, map on first LoadLibrary
GetModuleHandle* and LoadLibrary* find the title's images and our
console modules by file name. LoadLibrary* of a title DLL nothing
imports maps, binds and attaches it on the calling thread (a title's
own loader DLL may load its backends this way). FreeLibrary never
unloads title images.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 14:59:03 +01:00
MarvisandClaude Opus 5.5 754619f30e Run Minecraft: runtime HLE, D3D12.X device on the host GPU, shader IR
Loader: map title-shipped DLLs, patch static TLS loads to slot 0, crash
reporter, title paths for GetModuleFileName*.

HLE: task queue and async, XUser (one offline user), system ids,
title id, features, invites, game events, persistent local storage,
GameInput with no devices, xmem, console audio hardware queues, life
cycle (close suspends, then terminates), and a file layer with virtual
drives rewritten in path-taking imports.

GPU: D3D12.X device, DXGI chain, heaps, resources, fences, queues and
command lists translated onto a host D3D12 device; clears, barriers,
copies, resolves and PresentX into the title's window.

Shaders: SGD5 reader and `victory translate`; SSA IR with node
splitting for irreducible flow; structurisation removing EXEC.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 14:42:21 +01:00
MarvisandClaude Opus 5.5 12caefe804 GFX10 operand fields and SP3 text; FSSM wave size
Decode the operand fields of every GFX10 encoding (Instruction::fields)
and print them in SP3 syntax (Instruction::text, shader-info --disasm).
Read the wave size from the FSSM stage record flags.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-23 01:43:34 +01:00
MarvisandClaude Sonnet 5.5 f4504f6413 Initial commit
Rust workspace for VIctory: PE analysis, loader, HLE skeleton,
DXBC/DXIL parsing with a GFX10 decoder, conversion cache, CLI and
asset-policy enforcement.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-11-23 01:15:26 +01:00