loader: VICTORY_PATCH_TRAP, to continue past the title's own int3 at +0x1330A44 #719

Closed
github-bot wants to merge 1 commit from gh-pr/719/head into gh-pr/719/base
Owner

@⁠Key-rs on GitHub · 2026-11-25 05:33 UTC · original
Key-rs:trap-bypass-switch → main · +34 −0 · 2 files · 1 commits · closed without merging

What

Adds VICTORY_PATCH_TRAP=1, an opt-in switch that makes a run continue past the title's own int3 at +0x1330A44 during world bootstrap, instead of ending the process with 0x80000003.

It is a switch rather than a new default: nothing changes unless the variable is set.

Why

On the machine in #535 the title always reaches that assertion about 20 s into boot, after the first-boot screens and before the world, and dies on it. Everything functional was excluded there — same address on MSVC and MinGW builds, cold and warm shader caches, hardware and WARP, the November servicing update removed (10075 → 9807, d3d12core 10068 → 9807), with and without a signed-in Xbox stack (Microsoft.GamingServices 39.118.30001.0 installed during the investigation), with a settings.xml written by another host and with a fresh data_dir, no cpuid and no AVX-512 anywhere in the trapping function or its callees, and the pipeline stream, view count and asset opens byte-identical to a host that gets through.

What did work was ignoring the assertion. With the two jumps that lead into the int3 replaced by nops, the same build on the same host:

05:24:30  diagnostic: a jump into the +0x1330A44 trap was replaced with nops  at=…970 len=6
05:24:30  diagnostic: a jump into the +0x1330A44 trap was replaced with nops  at=…a34 len=2
05:24:43  first-boot screens
05:24:44  world starts loading
05:25:54  30.0 fps, 33.3 ms/frame
05:25:59  30.0 fps, 33.3 ms/frame        (still running)

No crash log, no device loss, sustained 30 fps, and the first frames the world produces are the same "texture picked by index changed after its upload" warnings a working host shows at that point.

So the assertion is a "this state should not be possible" check whose continuation is fine: the helper still runs and its result is still computed, only the branch into the int3 becomes a fall-through. Finding out which platform answer puts the host into that state is still open, and this switch is what makes the machine usable (and comparable to a working one) while that is investigated.

How

load_title_image calls patch_trap(base) after the image is mapped and before any title code runs, when VICTORY_PATCH_TRAP is set and the image is the executable (not one of the title's DLLs):

RVA bytes becomes
+0x1330970 0f 84 ce 00 00 00 (je +0x1330A44) 90 × 6
+0x1330A34 74 14 (short je to the other int3) 90 90

Each site is un-protected with VirtualProtect, written, and re-protected with the flags the mapping had; a site that cannot be unprotected logs a warning and is left alone. The RVAs are the ones the title's 1.0.2.1 build uses, which is the build the port is written against.

README gets one row in the diagnostics table.

Verification

  • cargo build --release -p victory on Windows 11 26300.9807, Rust 1.98.1 MSVC: clean.
  • With the switch: 90 s run, first-boot screens, world, 30 fps, no trap (log above).
  • Without the switch: unchanged, still traps at +0x1330A44 as before.

I can also send the two RVAs as a VICTORY_WATCH-style table if you would rather have the switch express the sites as data (VICTORY_PATCH=<rva>:<bytes>,…, general-purpose) than as one named trap; say which shape you want and I will rework it.

Refs #535.

**@⁠Key-rs** on GitHub · 2026-11-25 05:33 UTC · [original](https://github.com/fxceless/victory-fork/pull/719) `Key-rs:trap-bypass-switch` → `main` · +34 −0 · 2 files · 1 commits · closed without merging ## What Adds `VICTORY_PATCH_TRAP=1`, an opt-in switch that makes a run continue past the title's own `int3` at `+0x1330A44` during world bootstrap, instead of ending the process with `0x80000003`. It is a switch rather than a new default: nothing changes unless the variable is set. ## Why On the machine in #535 the title always reaches that assertion about 20 s into boot, after the first-boot screens and before the world, and dies on it. Everything functional was excluded there — same address on MSVC and MinGW builds, cold and warm shader caches, hardware and WARP, the November servicing update removed (`10075` → `9807`, `d3d12core` `10068` → `9807`), with and without a signed-in Xbox stack (`Microsoft.GamingServices 39.118.30001.0` installed during the investigation), with a `settings.xml` written by another host and with a fresh `data_dir`, no `cpuid` and no AVX-512 anywhere in the trapping function or its callees, and the pipeline stream, view count and asset opens byte-identical to a host that gets through. What did work was ignoring the assertion. With the two jumps that lead into the `int3` replaced by nops, the same build on the same host: ``` 05:24:30 diagnostic: a jump into the +0x1330A44 trap was replaced with nops at=…970 len=6 05:24:30 diagnostic: a jump into the +0x1330A44 trap was replaced with nops at=…a34 len=2 05:24:43 first-boot screens 05:24:44 world starts loading 05:25:54 30.0 fps, 33.3 ms/frame 05:25:59 30.0 fps, 33.3 ms/frame (still running) ``` No crash log, no device loss, sustained 30 fps, and the first frames the world produces are the same "texture picked by index changed after its upload" warnings a working host shows at that point. So the assertion is a "this state should not be possible" check whose continuation is fine: the helper still runs and its result is still computed, only the branch into the `int3` becomes a fall-through. Finding out *which* platform answer puts the host into that state is still open, and this switch is what makes the machine usable (and comparable to a working one) while that is investigated. ## How `load_title_image` calls `patch_trap(base)` after the image is mapped and before any title code runs, when `VICTORY_PATCH_TRAP` is set and the image is the executable (not one of the title's DLLs): | RVA | bytes | becomes | |---|---|---| | `+0x1330970` | `0f 84 ce 00 00 00` (`je +0x1330A44`) | `90 × 6` | | `+0x1330A34` | `74 14` (short `je` to the other `int3`) | `90 90` | Each site is un-protected with `VirtualProtect`, written, and re-protected with the flags the mapping had; a site that cannot be unprotected logs a warning and is left alone. The RVAs are the ones the title's 1.0.2.1 build uses, which is the build the port is written against. README gets one row in the diagnostics table. ## Verification * `cargo build --release -p victory` on Windows 11 26300.9807, Rust 1.98.1 MSVC: clean. * With the switch: 90 s run, first-boot screens, world, 30 fps, no trap (log above). * Without the switch: unchanged, still traps at `+0x1330A44` as before. I can also send the two RVAs as a `VICTORY_WATCH`-style table if you would rather have the switch express the sites as data (`VICTORY_PATCH=<rva>:<bytes>,…`, general-purpose) than as one named trap; say which shape you want and I will rework it. Refs #535.
On some hosts the title reaches a sanity assertion during world bootstrap and
ends the process with 0x80000003 at +0x1330A44 (fxceless/victory-fork#535:
identical on MSVC and MinGW builds, cold and warm shader caches, hardware and
WARP, every servicing level, and with the retail Gaming Services stack present).
The assertion fires from a helper whose result the caller tests; the code after
it runs fine when the branch is taken anyway, and a run with both jumps nop'd
reaches the first-boot screens and the world at 30 fps.

This adds an opt-in switch rather than changing any default:

  VICTORY_PATCH_TRAP=1

replaces 'je +0x1330A44' at +0x1330970 (six bytes) and the short 'je' to the
other int3 at +0x1330A34 (two bytes) with nops, right after the image is mapped
and before any title code runs. Nothing else is touched: the helper still runs
and its result is still computed; only the jump into the int3 falls through.

The patch is keyed by RVA and applies to the executable only, not to the title's
DLLs, so an image without those bytes logs a warning and is left alone.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:49:39 +00:00
github-bot closed this pull request 2026-11-26 03:49:39 +00:00
Author
Owner

@⁠Key-rs on GitHub · 2026-11-25 05:39 UTC · original

Rebased onto 310c6eb and re-verified on the current main

Pushed a rebase so the branch sits on today's main rather than c96b4f2. Re-ran both cases on the new base:

=== new main 310c6eb, WITHOUT the patch ===
    TRAP: VIctory: unhandled exception 0x80000003 at victory-image-…dll+0x1330a44
=== new main 310c6eb, WITH VICTORY_PATCH_TRAP=1 ===
    survived 60 s -> no trap
    30.0 fps, 33.3 ms/frame, 46 draws/frame, dropped 0 without a host pipeline (0 being made) and 0 indirect
    texture slots written so far: 3751 placed, 10753 of objects
    textures picked by index: 576 uploaded so far (203 MB), 7 waiting, 0 passed over unmapped

So the assertion still fires on the current main on this host, and the bypass still carries a run into the world — your 310c6eb did not change either side of that (the upload-queue work does show up in the counters, 576 textures uploaded with 7 waiting, and the flicker at the first-boot screens is reduced compared to the earlier builds).

Fork main also carries the commit now, so a checkout of Key-rs/victory-fork builds with the switch available without picking a branch.

No checks are reported on the branch (there is no workflow that runs for PRs from this fork), so nothing automated is pending on my side: the two sites, the README row and the build are all there, and cargo clippy -p victory-loader is clean. Ready for review whenever you get to it.

**@⁠Key-rs** on GitHub · 2026-11-25 05:39 UTC · [original](https://github.com/fxceless/victory-fork/pull/719#issuecomment-7154011530) **Rebased onto `310c6eb` and re-verified on the current main** Pushed a rebase so the branch sits on today's `main` rather than `c96b4f2`. Re-ran both cases on the new base: ``` === new main 310c6eb, WITHOUT the patch === TRAP: VIctory: unhandled exception 0x80000003 at victory-image-…dll+0x1330a44 === new main 310c6eb, WITH VICTORY_PATCH_TRAP=1 === survived 60 s -> no trap 30.0 fps, 33.3 ms/frame, 46 draws/frame, dropped 0 without a host pipeline (0 being made) and 0 indirect texture slots written so far: 3751 placed, 10753 of objects textures picked by index: 576 uploaded so far (203 MB), 7 waiting, 0 passed over unmapped ``` So the assertion still fires on the current main on this host, and the bypass still carries a run into the world — your `310c6eb` did not change either side of that (the upload-queue work does show up in the counters, 576 textures uploaded with 7 waiting, and the flicker at the first-boot screens is reduced compared to the earlier builds). Fork `main` also carries the commit now, so a checkout of `Key-rs/victory-fork` builds with the switch available without picking a branch. No checks are reported on the branch (there is no workflow that runs for PRs from this fork), so nothing automated is pending on my side: the two sites, the README row and the build are all there, and `cargo clippy -p victory-loader` is clean. Ready for review whenever you get to it.
Author
Owner

@⁠Key-rs on GitHub · 2026-11-25 12:51 UTC · original

Closing this: the premise was wrong, and I would rather not leave a switch that hides real problems.

The +0x1330A44 assert turned out to be correct: it fires because an asset record's type tag does not match the owner's cached copy, and on my machine that was because the dump was damaged — the last 3.24 GB of
avmeshes.rpf were zero-filled by an extraction that ran out of disk space (194 of its 401 torrent pieces hashed wrong, the file's size unchanged, which is why a size-based check passed).

With that one file rebuilt from a verified source and no switch at all (neither VICTORY_PATCH_TRAP nor VICTORY_TRAP_REPAIR), the same build runs:

30 s 30 fps menus 90 s 2 fps world 180 s 1 fps 9993 draws, still running 240 s no assert, no crash log

So the bypass was hiding a data-integrity report, not working around a false positive. Keeping it in the tree would make the next corrupted dump look like a port bug — which is exactly the trap I fell into for a day.

The analysis in #535 stays (the decoded comparison, the reproduction recipe, the stream-reader stack), and Marvisak/VIctory#2165 — the rebase of the generic VICTORY_TITLE_ASSERTS from #1156 — remains a legitimate diagnostic tool, though not a fix.

Thanks for taking it seriously enough to review it; sorry it turned out to be the wrong tool.

**@⁠Key-rs** on GitHub · 2026-11-25 12:51 UTC · [original](https://github.com/fxceless/victory-fork/pull/719#issuecomment-7162942394) Closing this: the premise was wrong, and I would rather not leave a switch that hides real problems. The +0x1330A44 assert turned out to be **correct**: it fires because an asset record's type tag does not match the owner's cached copy, and on my machine that was because the dump was damaged — the last 3.24 GB of avmeshes.rpf were zero-filled by an extraction that ran out of disk space (194 of its 401 torrent pieces hashed wrong, the file's size unchanged, which is why a size-based check passed). With that one file rebuilt from a verified source and **no switch at all** (neither VICTORY_PATCH_TRAP nor VICTORY_TRAP_REPAIR), the same build runs: ` 30 s 30 fps menus 90 s 2 fps world 180 s 1 fps 9993 draws, still running 240 s no assert, no crash log ` So the bypass was hiding a data-integrity report, not working around a false positive. Keeping it in the tree would make the next corrupted dump look like a port bug — which is exactly the trap I fell into for a day. The analysis in #535 stays (the decoded comparison, the reproduction recipe, the stream-reader stack), and Marvisak/VIctory#2165 — the rebase of the generic VICTORY_TITLE_ASSERTS from #1156 — remains a legitimate diagnostic tool, though not a fix. Thanks for taking it seriously enough to review it; sorry it turned out to be the wrong tool.
Author
Owner

@⁠Key-rs on GitHub · 2026-11-25 12:51 UTC · original

Closing for the reason above: the assert was reporting a damaged asset, not a false positive. #535 has the full write-up.

**@⁠Key-rs** on GitHub · 2026-11-25 12:51 UTC · [original](https://github.com/fxceless/victory-fork/pull/719#issuecomment-7162943912) Closing for the reason above: the assert was reporting a damaged asset, not a false positive. #535 has the full write-up.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.