Loader: opt-in VICTORY_NO_WATCHDOG hook for the title's watchdog (build 1.0.2.1) #454

Open
github-bot wants to merge 2 commits from github-bot/gh-454 into main AGit
Owner

@⁠ruvenesh on GitHub · 2026-11-24 03:37 UTC · original
ruvenesh:loader/opt-in-watchdog-hook → main · +95 −0 · 3 files · 2 commits · open

Adds an opt-in way past the title's own watchdog, for hosts that load much more slowly than the console. Off by default.

What it does

The title ends the process on purpose when its main thread has not advanced for about 30 one-second ticks. It writes to address 0 in two places (analysed in #71 for the first one):

  • +0x23cf683: mov dword ptr [0], imm32 in the handler the watchdog calls.
  • +0x2215c35: mov dword ptr [0], 0; int3 right after the call rax to that handler. The handler is not expected to return, so NOPing only the first site just reaches this one.

With VICTORY_NO_WATCHDOG=1, victory-loader patches the mapped image once, before any title code runs:

  • at +0x2215c27, a short jmp (EB 18) over the call and the fallback fault, to the loop's normal continuation at +0x2215c41;
  • at +0x23cf683, an eleven-byte NOP in place of the handler's fault.

Each patch is applied only if the original BLAKE3 starts with the 1.0.2.1 identity and the exact expected bytes are at the offset. Otherwise it logs a warning and does nothing. Other builds are untouched.

Asset policy

Only per-build offsets and short byte signatures (11 and 7 bytes), which docs/asset-policy.md allows. cargo xtask policy --staged passes on the three files.

Evidence

Linux, Wine 11.0 (GE-Proton11-14, vkd3d-proton 3.2.0), RTX 3060 12 GB, d2a4bae plus a few open shader PRs, scripted menu input. Of 14 world-load runs without the hook, 7 ended with the +0x23cf683 fault, between about 2 and 8 minutes after launch. The other 7 ended in other ways (device removal 3, an NVIDIA driver crash in vkAllocateMemory 2, one silent exit, and one that reached the second fault site above when only the first was patched). Those runs also differed in VKD3D_CONFIG and shader-skip settings, so the 7 is a count and not a controlled rate. With the hook, the process kept running past that point: the run is still going at 14 minutes. It reached the first mission's title card and then the dark first scene, which matches the README's current status.

A stack dump series (8 to 90 s) shows the title's helper thread is alive but sits in one long wait for about 50 s while title-main polls for its reply, so the watchdog is firing on a slow load and not on a missing thread. I have not identified what that wait is for.

Limits

  • Tested on Linux/Wine only. The code is cfg(windows) and I would expect it to behave the same on Windows, but I have not run it there.
  • It hides a stall; it does not fix what is slow. If the stall is a real deadlock, the game will sit there instead of exiting.
  • Only build 1.0.2.1. Another build needs its own offsets.

🤖 Generated with Claude Code

**@⁠ruvenesh** on GitHub · 2026-11-24 03:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/454) `ruvenesh:loader/opt-in-watchdog-hook` → `main` · +95 −0 · 3 files · 2 commits · open Adds an **opt-in** way past the title's own watchdog, for hosts that load much more slowly than the console. Off by default. ## What it does The title ends the process on purpose when its main thread has not advanced for about 30 one-second ticks. It writes to address 0 in two places (analysed in #71 for the first one): - `+0x23cf683`: `mov dword ptr [0], imm32` in the handler the watchdog calls. - `+0x2215c35`: `mov dword ptr [0], 0; int3` right after the `call rax` to that handler. The handler is not expected to return, so NOPing only the first site just reaches this one. With `VICTORY_NO_WATCHDOG=1`, `victory-loader` patches the mapped image once, before any title code runs: - at `+0x2215c27`, a short `jmp` (`EB 18`) over the call and the fallback fault, to the loop's normal continuation at `+0x2215c41`; - at `+0x23cf683`, an eleven-byte NOP in place of the handler's fault. Each patch is applied only if the original BLAKE3 starts with the 1.0.2.1 identity **and** the exact expected bytes are at the offset. Otherwise it logs a warning and does nothing. Other builds are untouched. ## Asset policy Only per-build offsets and short byte signatures (11 and 7 bytes), which `docs/asset-policy.md` allows. `cargo xtask policy --staged` passes on the three files. ## Evidence Linux, Wine 11.0 (GE-Proton11-14, vkd3d-proton 3.2.0), RTX 3060 12 GB, `d2a4bae` plus a few open shader PRs, scripted menu input. Of 14 world-load runs without the hook, 7 ended with the `+0x23cf683` fault, between about 2 and 8 minutes after launch. The other 7 ended in other ways (device removal 3, an NVIDIA driver crash in `vkAllocateMemory` 2, one silent exit, and one that reached the second fault site above when only the first was patched). Those runs also differed in `VKD3D_CONFIG` and shader-skip settings, so the 7 is a count and not a controlled rate. With the hook, the process kept running past that point: the run is still going at 14 minutes. It reached the first mission's title card and then the dark first scene, which matches the README's current status. A stack dump series (8 to 90 s) shows the title's helper thread is alive but sits in one long wait for about 50 s while title-main polls for its reply, so the watchdog is firing on a slow load and not on a missing thread. I have not identified what that wait is for. ## Limits - Tested on Linux/Wine only. The code is `cfg(windows)` and I would expect it to behave the same on Windows, but I have not run it there. - It hides a stall; it does not fix what is slow. If the stall is a real deadlock, the game will sit there instead of exiting. - Only build 1.0.2.1. Another build needs its own offsets. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The title ends the process on purpose when its main thread has not advanced
for about 30 one-second ticks (a write to address 0 at +0x23cf683, with a
second one at +0x2215c35 right after the handler call). On a host much slower
than the console a long load can exceed that window.

With VICTORY_NO_WATCHDOG=1 the loader jumps over the abort site and makes the
handler's fault a NOP. Each patch is applied only if the original BLAKE3
starts with the 1.0.2.1 identity and the exact original bytes are at the
offset; otherwise it logs a warning and does nothing. Off by default.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The hook was enabled by the variable being set at all, so =0 or an empty
value turned it on. Treat those as off, as a reviewer suggested.

Checked: cargo clippy -p victory-loader --target x86_64-pc-windows-msvc -- -D warnings is clean and the loader tests build (box, cross-compiled). Not run on Windows.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:04:38 +00:00
Author
Owner

@⁠iurysf on GitHub · 2026-11-24 09:08 UTC · original

Windows data point for the first fault site: on an RTX 4070 (Windows 11, native D3D12, driver 32.0.16.2101, title 1.0.2.1), 7 of 7 runs with VICTORY_D3D12_DEBUG=1 + VICTORY_D3D12_GBV=1 ended at:

unhandled exception 0xc0000005 at victory-image-b99f876b74d4a77f.dll+0x23cf683 (write 0x0)

Those runs were on main d2a4bae with #493 + #483, and some added #233, #581 or #588. They ended 131–186 s after launch, always before the world. GPU-based validation slows the GPU without tripping the TDR, much like the TdrDelay=60 runs in #97, which hit the same address. So it fits your reading that the watchdog fires on a slow load. On Windows this is what has kept us from collecting validation counts inside the world.

I'll run this PR on Windows (GBV on, then off) and report whether the process gets past that point and how far it gets.

AI-assisted.

**@⁠iurysf** on GitHub · 2026-11-24 09:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#issuecomment-7127014391) Windows data point for the first fault site: on an RTX 4070 (Windows 11, native D3D12, driver 32.0.16.2101, title 1.0.2.1), **7 of 7** runs with `VICTORY_D3D12_DEBUG=1` + `VICTORY_D3D12_GBV=1` ended at: ``` unhandled exception 0xc0000005 at victory-image-b99f876b74d4a77f.dll+0x23cf683 (write 0x0) ``` Those runs were on main `d2a4bae` with #493 + #483, and some added #233, #581 or #588. They ended 131–186 s after launch, always before the world. GPU-based validation slows the GPU without tripping the TDR, much like the `TdrDelay=60` runs in #97, which hit the same address. So it fits your reading that the watchdog fires on a slow load. On Windows this is what has kept us from collecting validation counts inside the world. I'll run this PR on Windows (GBV on, then off) and report whether the process gets past that point and how far it gets. AI-assisted.
Author
Owner

@⁠Exorion1er on GitHub · 2026-11-24 09:33 UTC · original

Works under Proton: GE-Proton11-12's Wine, vkd3d-proton 3.2.0, RX 9070 XT RADV, with #190, #493 and #579 on main. title watchdog hooks (VICTORY_NO_WATCHDOG) applied=2, and runs went about 7 minutes into the world, reaching the start of gameplay. They ended on the title's own int3 at +0x63966f (the pool free-list case from #597), not on the watchdog. On this card I saw no GPU fault in those runs, so it didn't hide one.

AI-assisted (Claude Code).

**@⁠Exorion1er** on GitHub · 2026-11-24 09:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#issuecomment-7127583406) Works under Proton: GE-Proton11-12's Wine, vkd3d-proton 3.2.0, RX 9070 XT RADV, with #190, #493 and #579 on `main`. `title watchdog hooks (VICTORY_NO_WATCHDOG) applied=2`, and runs went about 7 minutes into the world, reaching the start of gameplay. They ended on the title's own `int3` at `+0x63966f` (the pool free-list case from #597), not on the watchdog. On this card I saw no GPU fault in those runs, so it didn't hide one. AI-assisted (Claude Code).
Author
Owner

@⁠iurysf on GitHub · 2026-11-24 09:53 UTC · original

First Windows run: it works. Windows 11 (26300), RTX 4070, driver 32.0.16.2101, title 1.0.2.1. This PR on top of #493 + #483 merges cleanly. VICTORY_NO_WATCHDOG=1, DRED=1, default loop limit.

  • Both hooks apply: hook applied what="watchdog: skip the call and the fallback fault", hook applied what="watchdog: handler's deliberate fault", then title watchdog hooks (VICTORY_NO_WATCHDOG) applied=2. A second image logs applied=0, as expected, and nothing logs "hook skipped".
  • With the debug layer + GPU-based validation, the process stayed alive for the full 600 s, where 8 earlier runs had died at 131–186 s on the +0x23cf683 write. There was no title exception, no Breakpad upload, no crashes.log and no device removal. It reached the world at 105 s. Under GBV the world is barely usable, though: the first world frame took 17 s, and from ~125 s the frame counter stays at the same values while the process keeps running with stable memory. So we still get no validation counts deep in the world, but GBV at least gets past the load now.
  • Without validation, a 300 s run behaved like the base: no removal, 226 s in the world.

AI-assisted.

**@⁠iurysf** on GitHub · 2026-11-24 09:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#issuecomment-7128032145) **First Windows run: it works.** Windows 11 (26300), RTX 4070, driver 32.0.16.2101, title 1.0.2.1. This PR on top of #493 + #483 merges cleanly. `VICTORY_NO_WATCHDOG=1`, `DRED=1`, default loop limit. - Both hooks apply: `hook applied what="watchdog: skip the call and the fallback fault"`, `hook applied what="watchdog: handler's deliberate fault"`, then `title watchdog hooks (VICTORY_NO_WATCHDOG) applied=2`. A second image logs `applied=0`, as expected, and nothing logs "hook skipped". - **With the debug layer + GPU-based validation**, the process stayed alive for the full 600 s, where 8 earlier runs had died at 131–186 s on the `+0x23cf683` write. There was no title exception, no Breakpad upload, no `crashes.log` and no device removal. It reached the world at 105 s. Under GBV the world is barely usable, though: the first world frame took 17 s, and from ~125 s the frame counter stays at the same values while the process keeps running with stable memory. So we still get no validation counts deep in the world, but GBV at least gets past the load now. - **Without validation**, a 300 s run behaved like the base: no removal, 226 s in the world. AI-assisted.
Author
Owner

@⁠AugustoZFJ on GitHub · 2026-11-24 09:53 UTC · original

Tested on Linux with an RX 6900 XT (RADV 26.2.6, GE-Proton11-14, kernel 7.3.5) on main d2a4bae + #493 + this PR (d2c93fa), diag build, VICTORY_NO_WATCHDOG=1. Each run starts from the same save and shader cache, and I stop it after 600 s in the world.

Both hooks apply (title watchdog hooks (VICTORY_NO_WATCHDOG) applied=2).

Without this PR, one of two runs on main + #493 ended at +0x2215c35 after 32 s with no frame. With the hook, the first two runs didn't end there and one reached the 600 s limit. That says little about the hook, though: the longest gap between log lines in those two was 15 s, so the 30 s check wouldn't have fired anyway.

Then the stall came back twice with the hook on, and it doesn't end. One run was the same build with VICTORY_STACKS every 15 s. Frames stopped 134 s into the world and the process sat there for the 224 s left on the run's clock. The other was r4tedx's tester tree at 46ca402, which has this PR in it: frames stopped at 135 s and nothing more came for 465 s. The 32 s stall without the hook began at 136 s. So it's one spot in the opening, and three of my six scripted runs stalled there.

It isn't the GPU here, unlike what deadkid14 found on NVIDIA. The kernel log is empty for all three runs, and vkd3d-proton's queue and fence threads are idle in every dump.

The 16 dumps taken during the stall are identical:

  • Nothing of VIctory's is busy or blocked. The 24 DirectStorage workers and the 8 pipeline workers are waiting for work, and no title thread is inside a VIctory function.
  • title-main isn't in the wait the watchdog guards (+0x56a0d called from +0x23cf735, from +0x8126a7), which is where the dumps before the stall have it. It's one call earlier, at +0x509898d (from +0x7b5a9d, +0x21b6d0d, +0x81269b), in a WaitForSingleObject with no timeout.
  • Two job workers are in the same kind of wait, at +0x55bfc39 and +0x55af92f. All three sites set a waiter bit on a count of outstanding work and wait on an event if the count wasn't zero.
  • The thread whose routine runs through +0x23cf104, which I take to be the helper thread from your description, is at +0x43c3d5d, waiting on the event of a thread it handed work to. That one is at +0x527bd2. It bumps a counter in each object of a list and waits on the object's handle when the counter was already positive, which reads like taking a lock somebody else holds.

So on this machine it's title threads waiting on each other, the real deadlock case from your Limits. The hook does what it says, but in three runs out of six it would trade the watchdog's exit for a hang. I don't know yet which handle never gets signalled. I've written a local trace of who creates and signals each handle the title waits on, and that's my next run.

Two of the four measured runs with #493 ended on the int3 at +0x63966f instead, one with the hook and one without, 442 s and 508 s into the world. It's the one Exorion1er got, the pool case from #597. No stall before it in either run.

Indirect execution was off in all of these (#170). With #493 in there was no device removal in any run.

**@⁠AugustoZFJ** on GitHub · 2026-11-24 09:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#issuecomment-7128034251) Tested on Linux with an RX 6900 XT (RADV 26.2.6, GE-Proton11-14, kernel 7.3.5) on `main` d2a4bae + #493 + this PR (d2c93fa), diag build, `VICTORY_NO_WATCHDOG=1`. Each run starts from the same save and shader cache, and I stop it after 600 s in the world. Both hooks apply (`title watchdog hooks (VICTORY_NO_WATCHDOG) applied=2`). Without this PR, one of two runs on `main` + #493 ended at `+0x2215c35` after 32 s with no frame. With the hook, the first two runs didn't end there and one reached the 600 s limit. That says little about the hook, though: the longest gap between log lines in those two was 15 s, so the 30 s check wouldn't have fired anyway. Then the stall came back twice with the hook on, and it doesn't end. One run was the same build with `VICTORY_STACKS` every 15 s. Frames stopped 134 s into the world and the process sat there for the 224 s left on the run's clock. The other was r4tedx's tester tree at 46ca402, which has this PR in it: frames stopped at 135 s and nothing more came for 465 s. The 32 s stall without the hook began at 136 s. So it's one spot in the opening, and three of my six scripted runs stalled there. It isn't the GPU here, unlike what deadkid14 found on NVIDIA. The kernel log is empty for all three runs, and vkd3d-proton's queue and fence threads are idle in every dump. The 16 dumps taken during the stall are identical: - Nothing of VIctory's is busy or blocked. The 24 DirectStorage workers and the 8 pipeline workers are waiting for work, and no title thread is inside a VIctory function. - title-main isn't in the wait the watchdog guards (`+0x56a0d` called from `+0x23cf735`, from `+0x8126a7`), which is where the dumps before the stall have it. It's one call earlier, at `+0x509898d` (from `+0x7b5a9d`, `+0x21b6d0d`, `+0x81269b`), in a `WaitForSingleObject` with no timeout. - Two job workers are in the same kind of wait, at `+0x55bfc39` and `+0x55af92f`. All three sites set a waiter bit on a count of outstanding work and wait on an event if the count wasn't zero. - The thread whose routine runs through `+0x23cf104`, which I take to be the helper thread from your description, is at `+0x43c3d5d`, waiting on the event of a thread it handed work to. That one is at `+0x527bd2`. It bumps a counter in each object of a list and waits on the object's handle when the counter was already positive, which reads like taking a lock somebody else holds. So on this machine it's title threads waiting on each other, the real deadlock case from your Limits. The hook does what it says, but in three runs out of six it would trade the watchdog's exit for a hang. I don't know yet which handle never gets signalled. I've written a local trace of who creates and signals each handle the title waits on, and that's my next run. Two of the four measured runs with #493 ended on the `int3` at `+0x63966f` instead, one with the hook and one without, 442 s and 508 s into the world. It's the one Exorion1er got, the pool case from #597. No stall before it in either run. Indirect execution was off in all of these (#170). With #493 in there was no device removal in any run.
Author
Owner

@⁠AugustoZFJ on GitHub · 2026-11-24 11:54 UTC · original

Correction to my comment above. The stall isn't title threads waiting on each other. One job worker never waits at all: it spins in a lookup, and everything else queues up behind it.

That comes from three more stalled runs (three of six again, this time on main 8e79c80 and ffe310e with #493 and this PR), a local trace of the title's event and semaphore calls, and a register dump for threads caught in title code.

  • In every dump of every stalled run (four runs, 30 dumps) a worker is at +0x50eb826 or a few instructions before it, called from +0x31962, +0x317fd, +0x25d801b, with no system call above it. I missed it the first time because my script only compared stacks that were identical byte for byte. In two of the runs a second worker is in the same loop.
  • The loop is a lookup in an open-addressing table keyed by object handle (pool, slot, and some bits of the pool's word for that slot). When a group has no match it moves on to the next group. It has no exit for a key that isn't in the table, so a miss spins forever.
  • The key really is missing. In the run where I dumped it, both threads were looking for 0xc8084a and the table held 0x88084a: same pool, same slot, one bit apart. So an entry was added for that slot, and the slot's word changed before the lookup built its key. The table was fine otherwise. It was the one the threads were probing, 426 entries in 2,048 slots, not rebuilt since loading.
  • The rest follows. The lookup job never releases the latch at +0x8d7a9b0, so the job that clears the table (the wait at +0x55bfc39 from my first comment) never gets to run, title-main waits on job completions, and the other workers sit idle.

No VIctory thread is involved and none of the stuck handles is one VIctory signals, so I read it as a race in the title that frames of about 2 s open up (0.4 to 0.6 fps here). I haven't found what changes the slot in between. For this PR nothing changes from what I said before: with the hook the process hangs at that point, and without it the watchdog ends it after 30 s.

**@⁠AugustoZFJ** on GitHub · 2026-11-24 11:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#issuecomment-7130712671) Correction to my comment above. The stall isn't title threads waiting on each other. One job worker never waits at all: it spins in a lookup, and everything else queues up behind it. That comes from three more stalled runs (three of six again, this time on `main` 8e79c80 and ffe310e with #493 and this PR), a local trace of the title's event and semaphore calls, and a register dump for threads caught in title code. - In every dump of every stalled run (four runs, 30 dumps) a worker is at `+0x50eb826` or a few instructions before it, called from `+0x31962`, `+0x317fd`, `+0x25d801b`, with no system call above it. I missed it the first time because my script only compared stacks that were identical byte for byte. In two of the runs a second worker is in the same loop. - The loop is a lookup in an open-addressing table keyed by object handle (pool, slot, and some bits of the pool's word for that slot). When a group has no match it moves on to the next group. It has no exit for a key that isn't in the table, so a miss spins forever. - The key really is missing. In the run where I dumped it, both threads were looking for `0xc8084a` and the table held `0x88084a`: same pool, same slot, one bit apart. So an entry was added for that slot, and the slot's word changed before the lookup built its key. The table was fine otherwise. It was the one the threads were probing, 426 entries in 2,048 slots, not rebuilt since loading. - The rest follows. The lookup job never releases the latch at `+0x8d7a9b0`, so the job that clears the table (the wait at `+0x55bfc39` from my first comment) never gets to run, title-main waits on job completions, and the other workers sit idle. No VIctory thread is involved and none of the stuck handles is one VIctory signals, so I read it as a race in the title that frames of about 2 s open up (0.4 to 0.6 fps here). I haven't found what changes the slot in between. For this PR nothing changes from what I said before: with the hook the process hangs at that point, and without it the watchdog ends it after 30 s.
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 13:41 UTC · original

Stack test with the game on the build you target (1.0.2.1), Linux/Wine:

main ffe310e + #783 + #388 + #282 + this PR, release MSVC, RX 9060 XT (RDNA4/RADV 26.3.1), Wine 11.22, DXVK 3.1.1, vkd3d-proton 3.2.0.

With VICTORY_NO_WATCHDOG=1 the title no longer ends in its null-write/hang-check path: after the #774 RtlReleaseSRWLockExclusive messages (~3 min into the world) the process stays alive with no new frames. So the hook does what it says; the freeze itself is still there.

Not tested: a run without the hook on the same build/save for a direct A/B, and Windows.

**@⁠DaviTostes** on GitHub · 2026-11-24 13:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#issuecomment-7133194219) Stack test with the game on the build you target (1.0.2.1), Linux/Wine: `main ffe310e` + #783 + #388 + #282 + this PR, release MSVC, RX 9060 XT (RDNA4/RADV 26.3.1), Wine 11.22, DXVK 3.1.1, vkd3d-proton 3.2.0. With `VICTORY_NO_WATCHDOG=1` the title no longer ends in its null-write/hang-check path: after the #774 `RtlReleaseSRWLockExclusive` messages (~3 min into the world) the process stays alive with no new frames. So the hook does what it says; the freeze itself is still there. Not tested: a run without the hook on the same build/save for a direct A/B, and Windows.
Author
Owner

@⁠Yaekai on GitHub · 2026-11-24 16:13 UTC · original

Independent test & review on Windows 11 + GTA VI 1.0.2.1 (b99f876b74d4a77f, Rust 1.98.1) at head d2c93fa:

  • cargo test -p victory-loader --lib: 18 passed, 0 failed; cargo clippy -p victory-loader -- -D warnings: 0 warnings.
  • Verified live with VICTORY_NO_WATCHDOG=1: both patches apply cleanly and prevent the 30 s watchdog fault at +0x23cf683 during heavy world loading.
  • Minor UX nit in crates/victory-loader/src/windows.rs: std::env::var_os(NO_WATCHDOG_ENV).is_some() treats VICTORY_NO_WATCHDOG=0 or "" as enabled; is_some_and(|v| !v.is_empty() && v != "0") is safer.
**@⁠Yaekai** on GitHub · 2026-11-24 16:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#issuecomment-7137328345) Independent test & review on Windows 11 + GTA VI `1.0.2.1` (`b99f876b74d4a77f`, Rust 1.98.1) at head `d2c93fa`: - `cargo test -p victory-loader --lib`: 18 passed, 0 failed; `cargo clippy -p victory-loader -- -D warnings`: 0 warnings. - Verified live with `VICTORY_NO_WATCHDOG=1`: both patches apply cleanly and prevent the 30 s watchdog fault at `+0x23cf683` during heavy world loading. - Minor UX nit in `crates/victory-loader/src/windows.rs`: `std::env::var_os(NO_WATCHDOG_ENV).is_some()` treats `VICTORY_NO_WATCHDOG=0` or `""` as enabled; `is_some_and(|v| !v.is_empty() && v != "0")` is safer.
Author
Owner

@⁠deadkid14 on GitHub · 2026-11-24 04:32 UTC · original · edited 2026-11-24 17:51 UTC

Tested this together with #177 on d2a4bae: RTX 5070 Ti, driver 620.73.04, GE-Proton11-14's wine run directly, --features diagnostics, Series X files, menus driven by VICTORY_KEYS. Both hooks apply (applied=2) and there is no fault. On this setup, though, the stall does not recover:

  • In three world loads, the frames stop and never resume (I watched for 10+ min, GPU at 0 %). Without a warm shader cache the frames stopped about 2 min after the first mesh pipeline (frame 1352). With a warm cache they stopped after about 40-45 s (frames 1394 and 1249).
  • title-main sits in the wait the watchdog was guarding: +0x56a0d ← +0x23cf735 ← +0x8126a7 ← … ← +0x56a1e5a (from victory_loader::windows::spawn_main).
  • On our side nothing is busy. The DirectStorage workers (dstorage.rs:448), the pipeline makers (idle on their queue) and the XAsync pool are all waiting, and so are vkd3d-proton's threads. The only title thread that showed title code on top in an earlier sample (+0x4ddfdcd, +0x4de35a0) was idle by the third sample.
  • Adding #322 changes nothing. It does fix #128's buffer_data_reaches_the_host_texture under Wine here, but the hang has the same stacks and timing.

Your RTX 3060 run got past this point. Which open PRs did you have applied on top of d2a4bae? I can try the same set on this card. I can also share the full winedbg bt all dumps.

AI-assisted: Claude Code ran the builds and tests on my machine, read the logs and wrote this comment; posted at my request.

**@⁠deadkid14** on GitHub · 2026-11-24 04:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#issuecomment-7122106203) · edited 2026-11-24 17:51 UTC Tested this together with #177 on d2a4bae: RTX 5070 Ti, driver 620.73.04, GE-Proton11-14's `wine` run directly, `--features diagnostics`, Series X files, menus driven by `VICTORY_KEYS`. Both hooks apply (`applied=2`) and there is no fault. On this setup, though, the stall does not recover: - In three world loads, the frames stop and never resume (I watched for 10+ min, GPU at 0 %). Without a warm shader cache the frames stopped about 2 min after the first mesh pipeline (frame 1352). With a warm cache they stopped after about 40-45 s (frames 1394 and 1249). - title-main sits in the wait the watchdog was guarding: `+0x56a0d` ← `+0x23cf735` ← `+0x8126a7` ← … ← `+0x56a1e5a` (from `victory_loader::windows::spawn_main`). - On our side nothing is busy. The DirectStorage workers (`dstorage.rs:448`), the pipeline makers (idle on their queue) and the XAsync pool are all waiting, and so are vkd3d-proton's threads. The only title thread that showed title code on top in an earlier sample (`+0x4ddfdcd`, `+0x4de35a0`) was idle by the third sample. - Adding #322 changes nothing. It does fix #128's `buffer_data_reaches_the_host_texture` under Wine here, but the hang has the same stacks and timing. Your RTX 3060 run got past this point. Which open PRs did you have applied on top of d2a4bae? I can try the same set on this card. I can also share the full `winedbg bt all` dumps. *AI-assisted: Claude Code ran the builds and tests on my machine, read the logs and wrote this comment; posted at my request.*
Author
Owner

@⁠deadkid14 on GitHub · 2026-11-24 07:18 UTC · original · edited 2026-11-24 17:51 UTC

Correction to my comment above: the stall I reported here was not a title-side deadlock. The kernel log for those runs shows Xid 13 … Graphics SM Warp Exception … MMU Fault from title-main: the GPU faulted, so title-main waited forever on work that would never finish. That is the NVIDIA raw-access-chain fault from #542 (see #144).

With VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains and this PR, the same machine runs past that point. With wave64 handled (#189 or #579), it stays in the world for 10+ minutes with no fault and reaches player control. So on this setup #454 does what it says, and I have no evidence against it.

AI-assisted: Claude Code ran the builds and tests on my machine, read the logs and wrote this comment; posted at my request.

**@⁠deadkid14** on GitHub · 2026-11-24 07:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#issuecomment-7124843028) · edited 2026-11-24 17:51 UTC Correction to my comment above: the stall I reported here was not a title-side deadlock. The kernel log for those runs shows `Xid 13 … Graphics SM Warp Exception … MMU Fault` from `title-main`: the GPU faulted, so title-main waited forever on work that would never finish. That is the NVIDIA raw-access-chain fault from #542 (see #144). With `VKD3D_DISABLE_EXTENSIONS=VK_NV_raw_access_chains` and this PR, the same machine runs past that point. With wave64 handled (#189 or #579), it stays in the world for 10+ minutes with no fault and reaches player control. So on this setup #454 does what it says, and I have no evidence against it. *AI-assisted: Claude Code ran the builds and tests on my machine, read the logs and wrote this comment; posted at my request.*
Author
Owner

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

Automated triage for the maintainers.

Needs work: needs the maintainer's decision. This adds an opt-in VICTORY_NO_WATCHDOG that patches two sites in the title's code for build 1.0.2.1 (disarm_watchdog in crates/victory-loader/src/hooks.rs, called from load in windows.rs). The checks look right: it patches only when the build hash matches and the original bytes are exactly as expected, the EB 18 jump lands on +0x2215c41, and the replacement is a valid 11-byte NOP; the checked bytes are short signatures, which docs/asset-policy.md allows. Whether to patch title code at all is the maintainer's call. Note from the thread: in 3 of 6 runs the stall was a lookup spinning forever in the title itself, so with the hook on the game hangs instead of exiting; main already has VICTORY_POKE for a watchdog tick. If accepted, please add the variable to the README's diagnostics table.

CI: no check runs on the head commit.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#issuecomment-7148515445) <!-- victory-triage v1 head=85c04d129a0ad37a9f345b19cfbb3fbedf157327 verdict=needs-work at=2026-11-25T00:22:07Z --> Automated triage for the maintainers. **Needs work: needs the maintainer's decision.** This adds an opt-in `VICTORY_NO_WATCHDOG` that patches two sites in the title's code for build 1.0.2.1 (`disarm_watchdog` in `crates/victory-loader/src/hooks.rs`, called from `load` in `windows.rs`). The checks look right: it patches only when the build hash matches and the original bytes are exactly as expected, the `EB 18` jump lands on `+0x2215c41`, and the replacement is a valid 11-byte NOP; the checked bytes are short signatures, which `docs/asset-policy.md` allows. Whether to patch title code at all is the maintainer's call. Note from the thread: in 3 of 6 runs the stall was a lookup spinning forever in the title itself, so with the hook on the game hangs instead of exiting; main already has `VICTORY_POKE` for a watchdog tick. If accepted, please add the variable to the README's diagnostics table. CI: no check runs on the head commit. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠AgneyaK on GitHub · 2026-11-25 05:28 UTC · original · edited 2026-11-25 06:21 UTC

For the maintainer's decision: main can already do this without patching code. VICTORY_POKE (apps/victory/src/run.rs, diagnostics build) was added for exactly this watchdog ("runs on through slower frames with its tick flag poked"), but no address is documented. The byte is 0x71B6330:

VICTORY_POKE=71B6330:1

Why that byte, from image b99f876b… (base 0x140000000). Full decode on #630:

  • The watchdog thread (+0x2215a60) wakes once a second. If byte [+0x71b6330] is set, it re-arms and checks nothing. The title sets it itself, in its event handler +0x22159c0, on event type 0x24, and clears it on 0x25. So poking it to 1 is the title's own pause, not a code change.
  • Without the pause, the countdown is 30 wakes with no heartbeat (+0x22159f0 writing +0x71b6338), then the kill.
  • All three null stores are this one watchdog. +0x2215c35 and +0x2215da9 are its two kill paths. +0x23cf683 is in +0x23cf620, its callback. That function's only reference is the lea at +0x23cf6f7 that registers it into +0x71b6348 (setter +0x22161f0), and +0x71b6348 is read only at the two kill paths. So pausing the watchdog avoids all three sites, the same two that this PR patches plus +0x2215da9.
  • 0x71B6331 (the re-arm byte) would also reset the countdown, but in the watchdog's table mode it still walks the table. 0x71B6330 skips both.

Run-time evidence: not yet shown (corrected). I first wrote that a run with the poke had no watchdog kill. That run (Windows 11, RTX 3050 laptop, 70564ae) did go on to 80 s, but its NVIDIA device removal (#1754) came only 28 s after XUserAddAsync, before a 30 s countdown could have run out. So it doesn't show that the poke prevents the kill. The run without the poke was killed at +0x2215c35 31 s after XUserAddAsync. What's above is from the disassembly. A clean A/B, holding title-main suspended for 40 s with and without the poke, is still to be run.

The caveat in this PR's Limits holds for the poke too: it hides a stall and doesn't fix it. A one-line README entry naming the address may be all that's needed instead of a loader patch.

AI use: Claude Code (Claude Opus 5.5) disassembled the image locally and wrote this; the two runs are as described.

**@⁠AgneyaK** on GitHub · 2026-11-25 05:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#issuecomment-7153810972) · edited 2026-11-25 06:21 UTC For the maintainer's decision: **`main` can already do this without patching code.** `VICTORY_POKE` (`apps/victory/src/run.rs`, diagnostics build) was added for exactly this watchdog ("runs on through slower frames with its tick flag poked"), but no address is documented. The byte is **`0x71B6330`**: ``` VICTORY_POKE=71B6330:1 ``` Why that byte, from image `b99f876b…` (base `0x140000000`). Full decode on #630: - The watchdog thread (`+0x2215a60`) wakes once a second. If `byte [+0x71b6330]` is set, it re-arms and checks nothing. The title sets it itself, in its event handler `+0x22159c0`, on event type `0x24`, and clears it on `0x25`. So poking it to 1 is the title's own pause, not a code change. - Without the pause, the countdown is 30 wakes with no heartbeat (`+0x22159f0` writing `+0x71b6338`), then the kill. - **All three null stores are this one watchdog.** `+0x2215c35` and `+0x2215da9` are its two kill paths. `+0x23cf683` is in `+0x23cf620`, its callback. That function's only reference is the `lea` at `+0x23cf6f7` that registers it into `+0x71b6348` (setter `+0x22161f0`), and `+0x71b6348` is read only at the two kill paths. So pausing the watchdog avoids all three sites, the same two that this PR patches plus `+0x2215da9`. - `0x71B6331` (the re-arm byte) would also reset the countdown, but in the watchdog's table mode it still walks the table. `0x71B6330` skips both. **Run-time evidence: not yet shown (corrected).** I first wrote that a run with the poke had no watchdog kill. That run (Windows 11, RTX 3050 laptop, `70564ae`) did go on to 80 s, but its NVIDIA device removal (#1754) came only 28 s after `XUserAddAsync`, before a 30 s countdown could have run out. So it doesn't show that the poke prevents the kill. The run without the poke was killed at `+0x2215c35` 31 s after `XUserAddAsync`. What's above is from the disassembly. A clean A/B, holding `title-main` suspended for 40 s with and without the poke, is still to be run. The caveat in this PR's Limits holds for the poke too: it hides a stall and doesn't fix it. A one-line README entry naming the address may be all that's needed instead of a loader patch. AI use: Claude Code (Claude Opus 5.5) disassembled the image locally and wrote this; the two runs are as described.
Author
Owner

@⁠AgneyaK on GitHub · 2026-11-25 06:21 UTC · original

Correction to my comment above (edited): the run I cited for VICTORY_POKE=71B6330:1 ended in the NVIDIA removal 28 s after XUserAddAsync, before a 30 s watchdog could fire, so it doesn't show that the poke prevents the kill. The pause-byte reading is from the disassembly only. A controlled A/B is still to come.

AI use: Claude Code (Claude Opus 5.5).

**@⁠AgneyaK** on GitHub · 2026-11-25 06:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#issuecomment-7154710797) Correction to my comment above (edited): the run I cited for `VICTORY_POKE=71B6330:1` ended in the NVIDIA removal 28 s after `XUserAddAsync`, before a 30 s watchdog could fire, so it doesn't show that the poke prevents the kill. The pause-byte reading is from the disassembly only. A controlled A/B is still to come. AI use: Claude Code (Claude Opus 5.5).
Author
Owner

@⁠mercuryVM on GitHub · 2026-11-24 05:53 UTC · original · approved these changes

Tested d2c93fa on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (264 passed, 0 failed). Not tested in game, since I have no game package. With the variable unset the new code is never reached, which is what the test run covers.

I read the patching code by hand first, since it rewrites title code:

  • It only touches the just-mapped title image, before title code runs, gated on the env var, the build hash prefix and an exact byte match at each RVA. The protection is restored and the instruction cache flushed. Nothing else in the process or system is touched.
  • The jump target adds up: 0x2215c27 + 2 + 0x18 = 0x2215c41. The patch and the expected bytes are the same length, and both are a whole number of instructions.
  • The hash is checked before any read at base + rva, so other builds never read out of bounds.

Small points:

  • std::env::var_os(..).is_some() enables the hook for any value, including VICTORY_NO_WATCHDOG=0. The description says =1. Checking for "1" would avoid surprises.
  • The second VirtualProtect (restore) result is ignored. That is fine in practice, but a failure would leave the pages RWX without a log line.
  • Disabling the watchdog turns a fast crash into a possible silent hang for genuinely stuck loads. Since it is opt-in, I think that is an acceptable trade, and the info log line makes it visible.

AI-assisted (Claude Code).

**@⁠mercuryVM** on GitHub · 2026-11-24 05:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#pullrequestreview-6034353064) · **approved these changes** Tested d2c93fa on Windows 11, RTX 5070, MSVC: `cargo test --workspace --no-fail-fast` passes (264 passed, 0 failed). Not tested in game, since I have no game package. With the variable unset the new code is never reached, which is what the test run covers. I read the patching code by hand first, since it rewrites title code: - It only touches the just-mapped title image, before title code runs, gated on the env var, the build hash prefix and an exact byte match at each RVA. The protection is restored and the instruction cache flushed. Nothing else in the process or system is touched. - The jump target adds up: `0x2215c27 + 2 + 0x18 = 0x2215c41`. The patch and the expected bytes are the same length, and both are a whole number of instructions. - The hash is checked before any read at `base + rva`, so other builds never read out of bounds. Small points: - `std::env::var_os(..).is_some()` enables the hook for any value, including `VICTORY_NO_WATCHDOG=0`. The description says `=1`. Checking for `"1"` would avoid surprises. - The second `VirtualProtect` (restore) result is ignored. That is fine in practice, but a failure would leave the pages RWX without a log line. - Disabling the watchdog turns a fast crash into a possible silent hang for genuinely stuck loads. Since it is opt-in, I think that is an acceptable trade, and the info log line makes it visible. AI-assisted (Claude Code).
Author
Owner

@⁠catminou4 on GitHub · 2026-11-24 12:38 UTC · original · reviewed

Test-merge with current main (ffe310e) is clean. cargo test -p victory-loader --locked (macOS arm64, rustc 1.98.1) → 0 passed / 3 failed — but the same 3 fail on unmodified main (prepare::tests::{patches_own_test_binary, keeps_iat_slots_when_import_size_excludes_the_terminator, file_name_is_stable_per_build}), so this PR introduces no regression; they look like the same Mach-O-vs-PE platform issue I flagged for victory-pe on #529 (tests parsing the test executable as a PE).

The VICTORY_NO_WATCHDOG opt-in hook itself is loader-side and platform-independent, so it's worth a look on Windows where the loader tests actually run. I couldn't exercise the new path here beyond compilation.

**@⁠catminou4** on GitHub · 2026-11-24 12:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#pullrequestreview-6039320582) · **reviewed** Test-merge with current main (`ffe310e`) is clean. `cargo test -p victory-loader --locked` (macOS arm64, rustc 1.98.1) → **0 passed / 3 failed** — but the same 3 fail on unmodified main (`prepare::tests::{patches_own_test_binary, keeps_iat_slots_when_import_size_excludes_the_terminator, file_name_is_stable_per_build}`), so this PR introduces no regression; they look like the same Mach-O-vs-PE platform issue I flagged for victory-pe on #529 (tests parsing the test executable as a PE). The `VICTORY_NO_WATCHDOG` opt-in hook itself is loader-side and platform-independent, so it's worth a look on Windows where the loader tests actually run. I couldn't exercise the new path here beyond compilation.
Author
Owner

@⁠crissuper20 on GitHub · 2026-11-26 12:06 UTC · original

Long-run data on a GTX 1650 (4 GB), i5-4690, 16 GB, diag build. Base: fxceless/victory-fork be721d5, which doesn't carry this PR.

runs title crash
without this PR 1 yes, ~18 min in (null write in the title's code, Breakpad dump)
+ this PR at 85c04d1, VICTORY_NO_WATCHDOG=1 10 (25-30 min each, Series S and X) none

With it, the lit opening cutscene plays on this card. It merged cleanly onto that fork.

AI-assisted (Claude Code); measured on my own machine.

**@⁠crissuper20** on GitHub · 2026-11-26 12:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/454#issuecomment-7191576768) Long-run data on a GTX 1650 (4 GB), i5-4690, 16 GB, diag build. Base: fxceless/victory-fork `be721d5`, which doesn't carry this PR. | | runs | title crash | |---|---:|---| | without this PR | 1 | yes, ~18 min in (null write in the title's code, Breakpad dump) | | + this PR at `85c04d1`, `VICTORY_NO_WATCHDOG=1` | 10 (25-30 min each, Series S and X) | none | With it, the lit opening cutscene plays on this card. It merged cleanly onto that fork. AI-assisted (Claude Code); measured on my own machine.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/454/head:github-bot/gh-454'
git switch 'github-bot/gh-454'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-454'
git switch 'github-bot/gh-454'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-454'
git switch 'github-bot/gh-454'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-454'
git switch 'main'
git merge --squash 'github-bot/gh-454'
git switch 'main'
git merge --ff-only 'github-bot/gh-454'
git switch 'main'
git merge 'github-bot/gh-454'
git push origin 'main'
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!454
No description provided.