App: VICTORY_NO_WATCHDOG=1 pauses the title's own hang watchdog (#3624) #3856

Open
MannA-001 wants to merge 2 commits from upstream-pr/3856 into main
MannA-001 commented 2026-11-29 18:33:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by MannA-001 on 2026-11-29T18:33:01Z.


Implements #3624's "feed the heartbeat" option: a switch that keeps the title's own hang watchdog from ending a slow run, found by its pattern in the code.

Why

Grand Theft Auto VI runs a thread that counts down 30 s whenever its main loop has not ticked, then writes to address 0 on purpose (+0x23cf683, from +0x2215c35 on Series 1.0.2.1). Any slow phase triggers it: pipelines made on a cold cache, a long load, a slow card. Many crash reports are this watchdog rather than a fault (#3603, #2477, #1464 and others). Today the only way past it is VICTORY_POKE, which needs a diagnostics build and the address for the title build.

How the watchdog works (Series 1.0.2.1, function +0x2215a60)

Each one-second round reads three bytes next to the heartbeat (0x71b6338):

  • 0x71b6340, the quit flag: when set, the thread returns.
  • 0x71b6331, a one-shot reset: when set, the round stores a fresh heartbeat, restarts the countdown, and clears the byte.
  • 0x71b6330, a pause flag: while bit 0 is set, every round stores a fresh heartbeat and restarts the countdown. The watchdog never clears it. The title sets it itself (+0x2214a90), its tick writes it every frame (+0x22159df), and its shutdown clears it next to setting the quit flag (+0x22161b4).

Change

New apps/victory/src/watchdog.rs, called from run before the title starts:

  • pause_flag(text, pdata, writable) finds the watchdog: the one function (by its .pdata entry) holding both mov ebp, 30 and mov dword ptr [0], imm32. In it, the pause flag is the writable byte loaded with mov r8, byte ptr [rip+disp32], tested with test r8, 1 and branched on with je, where the set path restarts the countdown within 16 bytes and the function never clears it (mov byte ptr [rip+disp32], 0). That rules out the quit flag (jne) and the one-shot reset byte (cleared). If no function or byte matches, or more than one does, nothing is written.
  • pause (when VICTORY_NO_WATCHDOG is on, in every build) keeps bit 0 of that byte set twice a second and prints which byte it used, or that no watchdog was found. When the title is running, its own tick takes the byte over every frame. When it stalls, the watchdog keeps re-arming instead of counting down.
  • README: a paragraph after the crashes.log note. A real hang then hangs instead of ending, so the switch is off by default.

The first version set the quit flag. cobrajet302gt's run showed that the title then asserts 10 s into boot (int3 at +0x31f50): it checks that the watchdog thread is alive. Pausing keeps the thread alive.

Verification

  • On the Series 1.0.2.1 image (victory-image-b99f876b74d4a77f): it finds title+0x71b6330 in 35 ms. The watchdog function 0x2215a60 is the only match.
  • A boot with the switch on (release build of this branch, Windows 11, RX 7800 XT, --console series-s, cold cache): the banner title watchdog paused (its pause flag at title+0x71b6330) is printed, and the run passes XUserAddAsync: the offline local user, where the quit-flag version stopped, then streams story data at 30 fps for over two minutes, with no exception.
  • Unit tests on a synthetic watchdog with quit, reset and pause bytes: the pause byte is found, a byte outside writable data is not taken, and code without the countdown gives no flag.
  • cargo test -p victory --bin victory: 16 passed. cargo clippy -p victory --all-targets -- -D warnings, with and without diagnostics: clean.

AI use: Claude Code (Claude Opus 5.5).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:5553791477 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3856). Originally posted by [MannA-001](https://github.com/MannA-001) on 2026-11-29T18:33:01Z. --- Implements #3624's "feed the heartbeat" option: a switch that keeps the title's own hang watchdog from ending a slow run, found by its pattern in the code. ## Why Grand Theft Auto VI runs a thread that counts down 30 s whenever its main loop has not ticked, then writes to address 0 on purpose (`+0x23cf683`, from `+0x2215c35` on Series 1.0.2.1). Any slow phase triggers it: pipelines made on a cold cache, a long load, a slow card. Many crash reports are this watchdog rather than a fault (#3603, #2477, #1464 and others). Today the only way past it is `VICTORY_POKE`, which needs a diagnostics build and the address for the title build. ## How the watchdog works (Series 1.0.2.1, function `+0x2215a60`) Each one-second round reads three bytes next to the heartbeat (`0x71b6338`): - `0x71b6340`, the **quit flag**: when set, the thread returns. - `0x71b6331`, a **one-shot reset**: when set, the round stores a fresh heartbeat, restarts the countdown, and clears the byte. - `0x71b6330`, a **pause flag**: while bit 0 is set, every round stores a fresh heartbeat and restarts the countdown. The watchdog never clears it. The title sets it itself (`+0x2214a90`), its tick writes it every frame (`+0x22159df`), and its shutdown clears it next to setting the quit flag (`+0x22161b4`). ## Change New `apps/victory/src/watchdog.rs`, called from `run` before the title starts: - `pause_flag(text, pdata, writable)` finds the watchdog: the one function (by its `.pdata` entry) holding both `mov ebp, 30` and `mov dword ptr [0], imm32`. In it, the pause flag is the writable byte loaded with `mov r8, byte ptr [rip+disp32]`, tested with `test r8, 1` and branched on with `je`, where the set path restarts the countdown within 16 bytes and the function never clears it (`mov byte ptr [rip+disp32], 0`). That rules out the quit flag (`jne`) and the one-shot reset byte (cleared). If no function or byte matches, or more than one does, nothing is written. - `pause` (when `VICTORY_NO_WATCHDOG` is on, in every build) keeps bit 0 of that byte set twice a second and prints which byte it used, or that no watchdog was found. When the title is running, its own tick takes the byte over every frame. When it stalls, the watchdog keeps re-arming instead of counting down. - README: a paragraph after the `crashes.log` note. A real hang then hangs instead of ending, so the switch is off by default. The first version set the quit flag. cobrajet302gt's run showed that the title then asserts 10 s into boot (`int3` at `+0x31f50`): it checks that the watchdog thread is alive. Pausing keeps the thread alive. ## Verification - On the Series 1.0.2.1 image (`victory-image-b99f876b74d4a77f`): it finds `title+0x71b6330` in 35 ms. The watchdog function `0x2215a60` is the only match. - A boot with the switch on (release build of this branch, Windows 11, RX 7800 XT, `--console series-s`, cold cache): the banner `title watchdog paused (its pause flag at title+0x71b6330)` is printed, and the run passes `XUserAddAsync: the offline local user`, where the quit-flag version stopped, then streams story data at 30 fps for over two minutes, with no exception. - Unit tests on a synthetic watchdog with quit, reset and pause bytes: the pause byte is found, a byte outside writable data is not taken, and code without the countdown gives no flag. - `cargo test -p victory --bin victory`: 16 passed. `cargo clippy -p victory --all-targets -- -D warnings`, with and without `diagnostics`: clean. AI use: Claude Code (Claude Opus 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
cobrajet302gt commented 2026-11-29 20:46:44 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cobrajet302gt on 2026-11-29T20:46:44Z.


Field report — first run of VICTORY_NO_WATCHDOG=1 (cherry-picked #3856 @ e4213f7 onto venue trunk + #189/#3714 stack). Windows host, Wine 11 + rbtree wineserver, NVIDIA RTX 5080, Linux/Wine (Wine on NVIDIA), image b99f876b74d4a77f, title 930.048.020-vb_sub_story, console mode series-s.

  • Flag found and matches #3624: banner title watchdog off (its quit flag at title+0x71b6340) (= 0x1471b6340 less image base, same byte as the VICTORY_POKE=71b6340:1 workaround).
  • With the switch on, the title self-stops 10 s into boot with 0x80000003 at image+0x31f50 (first-chance + unhandled; nothing else changed). Decoding the converted image around that RVA: poll a global counter at 0x1477ae4c8 (sentinel 0xFFFFFFFF) against a TLS-table expected value, wait-helper call, int3 on failure — a "subsystem never reported" style assert — and it fires ~0.5 s after the host logs XUserAddAsync: the offline local user options=1.
  • Control run with the same binary and the switch off: no +0x31f50, boots normally to the front end (~4× further). So the stop is attributable to the quit path itself, plausibly the title supervising its own watchdog thread returning.

Reading: quitting the watchdog thread may trip a liveness interlock on this build; #3624's feed-the-heartbeat option (refresh 0x1471b6338 while the host is legitimately busy, thread stays alive) looks like the safer shape. Repro: any diag build with the env var; happy to retest variants (e.g. POKE-once at thread start vs 2 Hz writes).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7262350561 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3856#issuecomment-7262350561). Originally posted by [cobrajet302gt](https://github.com/cobrajet302gt) on 2026-11-29T20:46:44Z. --- Field report — first run of `VICTORY_NO_WATCHDOG=1` (cherry-picked #3856 @ `e4213f7` onto venue trunk + #189/#3714 stack). Windows host, Wine 11 + rbtree wineserver, NVIDIA RTX 5080, Linux/Wine (Wine on NVIDIA), image `b99f876b74d4a77f`, title 930.048.020-vb_sub_story, console mode series-s. - Flag found and matches #3624: banner `title watchdog off (its quit flag at title+0x71b6340)` (= `0x1471b6340` less image base, same byte as the `VICTORY_POKE=71b6340:1` workaround). - With the switch on, the title self-stops **10 s into boot** with `0x80000003` at `image+0x31f50` (first-chance + unhandled; nothing else changed). Decoding the converted image around that RVA: poll a global counter at `0x1477ae4c8` (sentinel `0xFFFFFFFF`) against a TLS-table expected value, wait-helper call, `int3` on failure — a "subsystem never reported" style assert — and it fires ~0.5 s after the host logs `XUserAddAsync: the offline local user options=1`. - Control run with the **same binary** and the switch off: no `+0x31f50`, boots normally to the front end (~4× further). So the stop is attributable to the quit path itself, plausibly the title supervising its own watchdog thread returning. Reading: quitting the watchdog thread may trip a liveness interlock on this build; #3624's *feed-the-heartbeat* option (refresh `0x1471b6338` while the host is legitimately busy, thread stays alive) looks like the safer shape. Repro: any diag build with the env var; happy to retest variants (e.g. POKE-once at thread start vs 2 Hz writes).
MannA-001 commented 2026-11-30 09:39:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by MannA-001 on 2026-11-30T09:39:34Z.


@cobrajet302gt Thanks, that run was the right catch. The quit path does trip the title's check that its watchdog thread is alive.

8e4be78 now pauses the watchdog instead of stopping it. Each round of the watchdog reads three bytes next to the heartbeat. 0x71b6340 is the quit flag. 0x71b6331 is a one-shot reset that the watchdog clears after use. 0x71b6330 is a pause flag: while bit 0 is set, every round takes a fresh heartbeat and restarts the countdown, and the thread keeps running. The title uses that one itself (it sets it at +0x2214a90, and its tick writes it every frame at +0x22159df). The switch now finds that byte by its pattern (je on bit 0, the set path restarts the countdown, the watchdog never clears it) and keeps it set. So this is your feed-the-heartbeat shape, done through the title's own mechanism.

Here, on a release build of the branch (Windows 11, RX 7800 XT, Series S, cold cache): title watchdog paused (its pause flag at title+0x71b6330), then the run passes XUserAddAsync: the offline local user and streams story data at 30 fps for over two minutes, with no +0x31f50. A retest on your Wine/RTX 5080 stack would be very welcome, since that is where the first version failed.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7274510257 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3856#issuecomment-7274510257). Originally posted by [MannA-001](https://github.com/MannA-001) on 2026-11-30T09:39:34Z. --- @cobrajet302gt Thanks, that run was the right catch. The quit path does trip the title's check that its watchdog thread is alive. `8e4be78` now pauses the watchdog instead of stopping it. Each round of the watchdog reads three bytes next to the heartbeat. `0x71b6340` is the quit flag. `0x71b6331` is a one-shot reset that the watchdog clears after use. `0x71b6330` is a pause flag: while bit 0 is set, every round takes a fresh heartbeat and restarts the countdown, and the thread keeps running. The title uses that one itself (it sets it at `+0x2214a90`, and its tick writes it every frame at `+0x22159df`). The switch now finds that byte by its pattern (`je` on bit 0, the set path restarts the countdown, the watchdog never clears it) and keeps it set. So this is your feed-the-heartbeat shape, done through the title's own mechanism. Here, on a release build of the branch (Windows 11, RX 7800 XT, Series S, cold cache): `title watchdog paused (its pause flag at title+0x71b6330)`, then the run passes `XUserAddAsync: the offline local user` and streams story data at 30 fps for over two minutes, with no `+0x31f50`. A retest on your Wine/RTX 5080 stack would be very welcome, since that is where the first version failed.
cloph-dsp commented 2026-11-30 10:40:33 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-30T10:40:33Z.


Independent verification (AI-assisted: Hy4 flash) — Windows, rustc 1.100.0 (MSVC), source + synthetic inputs only, no game data.

PR #3856 (4 files, +237/-0, App: VICTORY_NO_WATCHDOG=1 pauses the title's own hang watchdog (#3624)) is OPEN, non-draft, MERGEABLE/CLEAN, zero formal APPROVED reviews, no prior comment from me.

Checked in a dedicated worktree D:\Victory-Contrib\pr-3856-watch with its own CARGO_TARGET_DIR=D:\Victory-Contrib\target-3856 (never shared).

  • Negative control on the PR's base 63bcca43c6a00a758510398fa43096ce7e4f7df0: git grep -F <test> <base> -- apps/victory/src/watchdog.rs → no match for either test (both new).
  • git diff --check <base>..HEAD → exit 0, clean.
  • cargo test --locked -p victory --bin victory -- watchdog::tests::the_watchdogs_pause_flag_is_found_in_its_code --exact --test-threads=1 --quiet → 1 passed; 0 failed; 15 filtered out, exit 0.
  • cargo test --locked -p victory --bin victory -- watchdog::tests::no_countdown_no_watchdog --exact --test-threads=1 --quiet → 1 passed; 0 failed; 15 filtered out, exit 0.

GPU/driver: N/A — both tests scan synthetic byte buffers for the pause flag, no device or title required.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7275923985 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3856#issuecomment-7275923985). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-30T10:40:33Z. --- Independent verification (AI-assisted: Hy4 flash) — Windows, rustc 1.100.0 (MSVC), source + synthetic inputs only, no game data. PR #3856 (4 files, +237/-0, `App: VICTORY_NO_WATCHDOG=1 pauses the title's own hang watchdog (#3624)`) is OPEN, non-draft, MERGEABLE/CLEAN, zero formal APPROVED reviews, no prior comment from me. Checked in a dedicated worktree `D:\Victory-Contrib\pr-3856-watch` with its own `CARGO_TARGET_DIR=D:\Victory-Contrib\target-3856` (never shared). - Negative control on the PR's base `63bcca43c6a00a758510398fa43096ce7e4f7df0`: `git grep -F <test> <base> -- apps/victory/src/watchdog.rs` → no match for either test (both new). - `git diff --check <base>..HEAD` → exit 0, clean. - `cargo test --locked -p victory --bin victory -- watchdog::tests::the_watchdogs_pause_flag_is_found_in_its_code --exact --test-threads=1 --quiet` → `1 passed; 0 failed; 15 filtered out`, exit 0. - `cargo test --locked -p victory --bin victory -- watchdog::tests::no_countdown_no_watchdog --exact --test-threads=1 --quiet` → `1 passed; 0 failed; 15 filtered out`, exit 0. GPU/driver: N/A — both tests scan synthetic byte buffers for the pause flag, no device or title required.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3856:upstream-pr/3856'
git switch 'upstream-pr/3856'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3856'
git switch 'upstream-pr/3856'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3856'
git switch 'upstream-pr/3856'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3856'
git switch 'main'
git merge --squash 'upstream-pr/3856'
git switch 'main'
git merge --ff-only 'upstream-pr/3856'
git switch 'main'
git merge 'upstream-pr/3856'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!3856
No description provided.