WebSocket debugger: runUntilTime that's already there, and across loads

A target time that had already passed, relativeUs 0 for one, failed
without a stop event, so a client waiting for cpu.stepping waited until
its own timeout. Now it doesn't run, and reports the stop right away.

A savestate loaded during the run kept the deadline's absolute time,
which belongs to the timeline the load replaced: a state from later in
the game stopped the run at once, one from earlier ran it for as long
as the gap. Now the deadline keeps the time it had left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-29 00:21:49 +01:00
1 parent df72f3be81
commit 93b7dacc1e
5 files changed
+35 -9

No files matched your search

+6 -1
View File
@@ -567,6 +567,9 @@ void DoState(PointerWrap &p) {
return;
// States are saved between slices.
otherCPUsRan = 0;
// A debugger's run-until deadline keeps the time it had left, not its absolute time, which
// belongs to the timeline being replaced.
const s64 deadlineLeftUs = p.mode == PointerWrap::MODE_READ && breakDeadlineUs ? breakDeadlineUs - (s64)GetGlobalTimeUs() : 0;
int n = (int)event_types.size();
int current = n;
@@ -632,7 +635,9 @@ void DoState(PointerWrap &p) {
lastGlobalTimeUs = 0;
}
if (p.mode == PointerWrap::MODE_READ) {
// A debugger's run-until deadline is in emulated us, and the ticks it maps to just changed.
if (breakDeadlineUs) {
breakDeadlineUs = (s64)GetGlobalTimeUs() + std::max(deadlineLeftUs, (s64)0);
}
RecomputeBreakDeadline();
}