Skip to content

After a restart, partial OBS and AGR takes and late OBS starts aren't marked Captured, and a Steam game no longer blocks Start (part of #20) - #1255

Merged
ccoventry merged 3 commits into
devfrom
fix/capture-recovery-risks-20
Oct 31, 2026
Merged

ccoventry merged 3 commits into
devfrom
fix/capture-recovery-risks-20

Conversation

@ccoventry

Copy link
Copy Markdown
Owner

Release note: Fixed: after DoD Studio closed during a capture batch, a clip the game or OBS didn't finish recording, or that OBS started late, is no longer marked Captured when Studio reopens, and a game started from Steam no longer holds up Start Capture Batch.

Part of #20 (closed; this fixes the three known risks #1171 and #1185 left, listed in their Decisions).

What changes

The catch-up after a restart (#545, #760, #1171) checks the takes of a batch that ran on after Studio closed. It could only tell a partial HLAE take (by its sound.wav). Now, in studio/src-tauri/src/catch_up_takes.rs (new; the wav check moved there from batch_catch_up.rs):

  1. OBS and AGR partial takes are no longer counted as captured.
    • The game's console log, any mode. Every launch passes -condebug, so the game copies each [dod-studio] marker into qconsole.log beside hl.exe, and only the end of a batch Studio watched clears it (Auto-clear Logs). The catch-up reads the log's last 64 MB, splits it into runs at each DEMO_START 1 …, and takes the last run that is this batch's: the same number of demos, and every START_RECORD tick a clip start of the demo playing. A START_RECORD with no STOP_RECORD after it is the clip the game was recording when it closed; it goes through the watched batch's own mark_cut_short (A batch cancelled mid-clip still says the clip was captured #1081). This is the only sign an AGR take has. Checked on this PC's two installs: both logs hold the markers of hook-run batches (PRE 48 MB / 94 runs, POST 30 MB / 183 runs; the biggest run 5.8 MB).
    • OBS: a recording Studio never stopped. In OBS mode Studio starts and stops each clip. If it closes mid-clip, the game plays on and OBS keeps recording (or dies with a dev Studio), so the take isn't the clip as planned. ObsSession now writes dodstudio_obs_take.json into the block folder when a recording starts and removes it at the stop (native/src/obs/take_state.rs). The catch-up finds one still saying recording and marks the take "still recording in OBS when DoD Studio closed" (new CutBy::StudioClosed, with Last Batch strings).
  2. A late OBS start is seen by the catch-up. The same file keeps started_late_ms after the stop when ObsSession found OBS started late (An OBS clip whose recording started after the clip's first frame still counts as captured #1109). The catch-up marks such a take started late, not captured, as a watched batch does.
  3. Start isn't held up by a game that can't be capturing. The wait (and with it Start Capture Batch's refusal) now counts only running games with HLAE's AfxHookGoldSrc.dll loaded (batch_reuse::may_be_capturing). Every batch records through HLAE, and a game left open for one (Start Capture Batch runs in the game that is already open instead of relaunching it (#725) #1075) was started through HLAE too, so a game started from Steam never is. A game whose DLLs can't be read still counts.

Each marked take is left on disk, not counted, and logged in the activity log with its folder; the existing "Capture the rest?" offer then includes it. take_meta::is_metadata lists the new file, so it never counts as captured output.

Decisions

  • The console log over a hook change. The hook could write a per-clip record, but the markers are already on disk in every mode and every hook version, and a hook change needs a two-install live test. The log is matched to the batch by its demo count and clip-start ticks, so another batch's run, a preview or a log from another install is ignored (activity log: "has no run of this batch"), and the takes are judged as before.
  • The last matching run wins. A later run of another batch in the same log doesn't hide this batch's run before it. A run that restarts the first demo (the PRE log has one) only drops the clips before the restart from the count, and the unfinished clip is still the last one started.
  • OBS state is a file in the block folder, not a manifest field. It travels with the take, it's written at the moment Studio knows, and nothing has to rewrite the manifest mid-batch. A clip that started in time and stopped leaves no file.
  • Only the catch-up reads the file. A watched batch already marks late and cut takes from its own events; reading the file there too would change nothing.
  • A Studio-launched game (Launch Game) still holds Start up while a planned manifest from before the restart is unchecked: it has HLAE, and a batch can run in such a game (Start Capture Batch runs in the game that is already open instead of relaunching it (#725) #1075), so Studio can't tell it isn't capturing. The footer says to close it, as before. A Steam-started game no longer does.
  • Older builds: the manifest is unchanged. An older Studio that finds dodstudio_obs_take.json counts it as part of the take, which is how it counted that take before (the take folder already held take0000\). The JSON tolerates unknown fields both ways.

Test done

  • New unit tests: catch_up_takes (7: the clip with no stop is cut; a finished batch marks nothing; another batch's run, another demo count, no clip start, an empty log are ignored; the last matching run is read; no log; the tail read; OBS state recording/late/none), obs::take_state (2), obs::session (the late start is kept, a stop in time leaves no file), batch_reuse::may_be_capturing, take_meta::is_metadata, strings.test.js (studio_closed).
  • rustup run 1.98.1 cargo fmt --all --check: clean. Clippy 1.98.1 --workspace --all-targets --locked --exclude goldsrc-hooks -D warnings: clean (no hook code changed).
  • cargo test --workspace --locked --exclude goldsrc-hooks --exclude web-analyzer: all pass (native 1262, desktop-studio 252).
  • npm run test:unit: 1208 passed. Playwright app-boot.spec.js + batch-results.spec.js: 13 passed.
  • Not tested live: no game run. Studio closing mid-batch in OBS or AGR mode, and a Steam-started game open at Studio start, are covered by unit tests only. The console-log assumption (markers reach qconsole.log in hook-run batches) was checked read-only against the PRE and POST installs' existing logs.

🤖 Generated with Claude Code

ccoventry and others added 2 commits October 30, 2026 23:53
…s, don't wait for a game without HLAE (part of #20)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the OBS take state (part of #20)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ccoventry
ccoventry merged commit 6fd580f into dev Oct 31, 2026
6 checks passed
@ccoventry
ccoventry deleted the fix/capture-recovery-risks-20 branch October 31, 2026 06:19
ccoventry added a commit that referenced this pull request Oct 31, 2026
…2-1255

Overview stair areas, OBS take deletion and console-log read: three small fixes (part of #1252, #1255)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant