From 5c2a80cfa5dcb7ea6dc6786ae72abea666b4d9d0 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Sat, 22 Aug 2026 20:52:03 +0200 Subject: [PATCH] fix(reverse): avoid stopping Wine during probes Repeated SIGSTOP-based injection can suspend Wine while its Win16 mutex is held and eventually strand the timer callback. Make the short process-memory write sequence the default between 30 ms callbacks, while retaining whole-process stopping as an explicit single-probe diagnostic option. Test Plan: - `ruff check original/tools/trace_original_state.py original/tools/inject_original_state.py` -- passed - live no-stop ball-state injection -- passed - subsequent original timer updates remained observable - `git diff --cached --check` -- passed --- original/MECHANICS_PROGRESS.md | 8 +++++--- original/tools/inject_original_state.py | 7 ++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/original/MECHANICS_PROGRESS.md b/original/MECHANICS_PROGRESS.md index 141c707..60e9efc 100644 --- a/original/MECHANICS_PROGRESS.md +++ b/original/MECHANICS_PROGRESS.md @@ -93,8 +93,8 @@ velocities, flipper inputs and states, and claw animation state whenever any of them changes. It neither patches `TDKPIN.EXE` nor pauses Wine. The tracing helper is Linux-only development infrastructure; it is not part of the Rust replica. -`tools/inject_original_state.py` briefly stops the opted-in process and updates -all recovered copies of the ball position and velocity atomically. This permits +`tools/inject_original_state.py` updates all recovered copies of the ball +position and velocity between the original 30 ms callbacks. This permits repeatable probes at individual walls, circles, gates, and mechanism triggers: ```sh @@ -106,7 +106,9 @@ process is modified. Run the injector while the ball is waiting in the launcher so it can identify the live game object, or supply the previously reported `--object-base` to both the injector and tracer during a sequence of active probes. `--substeps 1` isolates one collision integration step; omitting it -retains the original configured detail level. +retains the original configured detail level. `--stop-process` is available for +single probes, but repeated whole-process stops can strand Wine while a Win16 +mutex is held and therefore are not the default. A probe at `(289,94)` captured the original terminal-18 path. The collision suspended the ball while frames advanced from 10 through 18 at the configured diff --git a/original/tools/inject_original_state.py b/original/tools/inject_original_state.py index 412e0cb..a7a5ccb 100755 --- a/original/tools/inject_original_state.py +++ b/original/tools/inject_original_state.py @@ -56,6 +56,11 @@ def parse_args() -> argparse.Namespace: choices=range(1, 6), help="temporarily force the original physics substep count", ) + parser.add_argument( + "--stop-process", + action="store_true", + help="stop all Wine threads during writes; unsafe for repeated Win16 mutex probes", + ) return parser.parse_args() @@ -91,7 +96,7 @@ def main() -> None: args = parse_args() verify_original() pid = args.pid if args.pid is not None else find_winevdm_pid() - resume_afterward = stop_process(pid) + resume_afterward = stop_process(pid) if args.stop_process else False try: with ProcessMemory(pid, writable=True) as memory: data_base = locate_data_segment(memory)