Skip to content

hle, loader, app, docs: implement XLaunchRestartOnCrash - #47

Open
PrivacyOnion wants to merge 5 commits into
MiamiGame:mainfrom
PrivacyOnion:hle/restart-on-crash
Open

PrivacyOnion wants to merge 5 commits into
MiamiGame:mainfrom
PrivacyOnion:hle/restart-on-crash

Conversation

@PrivacyOnion

@PrivacyOnion PrivacyOnion commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Implement XLaunchRestartOnCrash at TITLE_VTABLE slot 0x28, inferred from the declaration order in XGame.h. The HLE call rejects a nonzero reserved with E_INVALIDARG and otherwise records the restart arguments and returns S_OK.

  • The loader writes the crash report first. The HLE wrapper then calls the title’s unhandled-exception filter. A filter that returns EXCEPTION_CONTINUE_EXECUTION resumes execution with the restart still armed. The loader’s default filter handles the case where the title registers no filter.
  • On a fatal unhandled SEH exception with restart armed, the hook starts a replacement, then calls TerminateProcess(GetCurrentProcess(), 1). XTP_RELAUNCHED_FROM carries the process handle the replacement uses to wait for its predecessor. The replacement consumes XTP_CRASH_RESTARTED at startup to limit the launch to one crash restart. A later XLaunchNewGame starts a fresh launch.
  • Starting an intentional shutdown clears the pending restart before the title’s suspend routines run. Under --autopilot, the hook logs that it skipped the restart so the supervisor can observe the original exception exit.

Fixes: #11
Depends on: none

Area

  • crates/xtp-loader/src/crash.rs, crates/xtp-loader/src/lib.rs
  • crates/xtp-hle/src/modules/kernel.rs, crates/xtp-hle/src/modules/lifecycle.rs, crates/xtp-hle/src/modules/xgame.rs
  • crates/xtp-hle/Cargo.toml, crates/xtp-hle/tests/restart_on_crash.rs
  • apps/xtp/src/run.rs
  • docs/analysis/hle.md

Tests

  • cargo xtask pr-check passes on my machine
  • New or changed behaviour has tests that need no game files, or I explain below why it cannot
  • Ran on a title: no

cargo xtask pr-check --base upstream/main --title "hle, loader, app, docs: implement XLaunchRestartOnCrash" --skip test passed formatting, both Clippy configurations, policy and conventions. The workspace test step was skipped. cargo test -p xtp-hle --lib, cargo test -p xtp-hle --test restart_on_crash, and cargo test -p xtp-loader passed.

The five crash-restart tests re-execute their own test binary with --exact. They cover the restart and loop guard, null arguments, the title filter resuming execution and then letting a fatal exception through, unattended mode, and a fault in a suspend routine during XLaunchNewGame. The parent verifies exit codes and counts all processes that ran. A Windows job cleans up surviving probe processes on a failure. Unit tests cover empty executable overrides, empty and null arguments, and how the shared whitespace split handles quotes.

Provenance

  • I wrote all of this change myself for XTP, or it only moves code already in XTP.
  • Some of it comes from elsewhere. Each source, its licence and the files concerned are listed here, and every licence is compatible with GPL-3.0-or-later:

The original implementation used public Microsoft Learn documentation for XLaunchRestartOnCrash and existing XTP relaunch and crash-reporting code. Review fixes use XTP’s child-process test pattern and the existing Windows bindings. No source from xcl or AnyPS5 was read or incorporated.

AI assistance: AI coding tools wrote parts of this change: Antigravity (Gemini) the original implementation and test, OpenAI Codex the review changes.

Checklist

  • No game data, keys, console SDK code or headers, and nothing that circumvents DRM (asset policy)
  • No code copied from xcl or AnyPS5 (references only: read them to understand, write your own)
  • I agree to license this contribution under GPL-3.0-or-later
  • Title and every commit follow <area>: <summary>. The diff is 596 changed lines. The synthetic Windows crash probes account for 382 of those lines and cover process cleanup, synchronized exit-code checks, and the five restart scenarios.
  • Docs updated where behaviour, commands or variables changed (README, docs/)

@github-actions github-actions Bot added overlap another open PR changes the same files area/loader touches crates/xtp-loader area/hle touches crates/xtp-hle area/app apps/ size/M 100 to 399 changed lines labels Nov 25, 2026

@simnJS simnJS left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking up #11. This is a clean, well-scoped change and the child-process test is a good idea. A few things before it can land:

  1. Overlapping processes: the replacement starts from inside the crash filter, and wait_for_previous gives up after 30 s. If the crashed process lingers (a title filter, a Windows Error Reporting dialog) or the title's filter resumes execution, two instances share the title's files. Could the crash path end the process after spawning (as end() does), or could a crash restart wait without a time limit?
  2. XTP_CRASH_RESTARTED is inherited by later XLaunchNewGame relaunches, so restart-on-crash stays off after the first restart. Please remove it at startup, like XTP_RELAUNCHED_FROM.
  3. Slot 0x28: public docs don't list the vtable order. How did you find it? A line in the PR or a comment would help future readers.
  4. Docs: please update docs/analysis/hle.md (the table row and R10), since the checklist says docs were updated.

Nits: use xasync::E_INVALIDARG; current does nothing when exe is empty. In the test, waiting for the grandchild to exit (or for a "faulting" marker) instead of a 400 ms sleep would make the "no third run" check solid, and the grandchild shouldn't be left running.

The gpu-debug-layer failure comes from xtp-gpu tests that landed on main today, not from your change; we're fixing it, and a rebase afterwards should clear it.

@PrivacyOnion PrivacyOnion changed the title hle, loader, app: implement XLaunchRestartOnCrash hle, loader, app, docs: implement XLaunchRestartOnCrash Nov 25, 2026
@PrivacyOnion

Copy link
Copy Markdown
Contributor Author

Addressed all review items and nits:

  1. No overlapping processes: relaunch_on_crash now calls end_with(1) immediately after spawning the replacement process, so the crashing instance exits right away (preventing WER/filter hangs or two instances sharing title files).
  2. XTP_CRASH_RESTARTED inheritance: wait_for_previous() now consumes XTP_CRASH_RESTARTED into an in-process ALREADY_CRASH_RESTARTED atomic and removes it from the environment at startup, so a subsequent XLaunchNewGame relaunch does not inherit it.
  3. Slot 0x28: documented on TITLE_VTABLE that TITLE_IID exposes the three XGame.h functions in declaration order after IUnknown (0x18 XGameGetXboxTitleId, 0x20 XLaunchNewGame, 0x28 XLaunchRestartOnCrash).
  4. Docs: updated docs/analysis/hle.md (table row and R10 heading) to reflect XLaunchRestartOnCrash tested and XLaunchNewGame still untested live.
  5. Nits: reused super::xasync::E_INVALIDARG, dropped the unused current lookup when exe is empty, and updated restart_on_crash.rs to deterministically OpenProcess(PROCESS_SYNCHRONIZE) + WaitForSingleObject on the grandchild PID instead of a 400 ms sleep.

@github-actions github-actions Bot added the area/docs docs/, Markdown label Nov 25, 2026

@simnJS simnJS left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick turnaround — point 2 and the two code nits are resolved. A few small things remain:

  • end_with saves the pipeline cache (and releases the mouse) from inside the crash filter; if that blocks (e.g. the faulting thread holds a pipeline-library lock), the replacement's 30 s wait expires and the overlap comes back. Could the crash path call TerminateProcess directly, or could a crash-restarted process wait without a limit?
  • Please say in the slot-0x28 comment that the order is inferred from declaration order, not confirmed.
  • In hle.md, the row should stay ◐ while XLaunchNewGame is untested live, and the R10 Goal could say restart-on-crash is done.
  • Test: the "no third run" check can still race (a third run would only write its line after the grandchild exits). Asserting exit codes — 1 for the first child (from end_with(1)) and 0xC0000005 for the grandchild — would make it deterministic. Please also kill the grandchild if the wait times out.

The gpu-debug-layer failures come from main, not from this PR.

@PrivacyOnion

Copy link
Copy Markdown
Contributor Author

Thanks @simnJS! Addressed all four items in 476e92a:

  • Direct termination in crash filter (lifecycle.rs): relaunch_on_crash now calls TerminateProcess(GetCurrentProcess(), 1) directly without saving the pipeline cache or releasing input, avoiding any deadlock if the faulting thread holds an internal lock (and collapsed end_with back into end).
  • Slot 0x28 comment (xgame.rs): explicitly notes that slot 0x28 is inferred from XGame.h declaration order after IUnknown, not confirmed against a live call site.
  • docs/analysis/hle.md: kept the table row ◐ while XLaunchNewGame is untested live, and updated the R10 Goal to state that XLaunchRestartOnCrash is done.
  • Deterministic exit-code assertions & timeout kill (restart_on_crash.rs): asserts exit code 1 for the first child and 0xC0000005 (STATUS_ACCESS_VIOLATION) for the restarted grandchild (proving it took the unhandled-fault path rather than relaunching a third time), and kills the grandchild via TerminateProcess if the 10 s wait times out.

Verified locally with cargo test -p xtp-hle --test restart_on_crash --locked, cargo test -p xtp-hle lifecycle --locked, cargo clippy -p xtp-hle --all-targets (default & --all-features), cargo xtask policy, and cargo xtask conventions.

@simnJS simnJS left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the last round is fully addressed: the crash path calls TerminateProcess directly, XTP_CRASH_RESTARTED is cleared at startup, the slot-0x28 comment says the order is inferred, the hle.md row stays ◐ with R10 updated, and the test asserts both exit codes and kills a stuck grandchild.

Two things I should have raised earlier:

  1. The restart pre-empts the title's own filter. run_on_crash runs inside xtp_loader::report_unhandled, which report_unhandled in kernel.rs (L267–277 on main) calls before the filter the title registered. Since the hook now terminates, the title's filter never runs: whatever it does is skipped, and an exception it would resume (EXCEPTION_CONTINUE_EXECUTION) now ends and restarts the title. Could the hook run after the title's filter instead — from the kernel wrapper unless the filter returned EXCEPTION_CONTINUE_EXECUTION, and from the loader's own filter when the title set none? The report itself can stay first.

  2. Unattended runs. Under --autopilot (cargo xtask play), the replacement inherits --autopilot and the harness's pipes, while the harness sees exit code 1 and stops watching. The replacement keeps running the title unobserved, and the next session refuses to start because an xtp.exe is already running. Please skip the restart under --autopilot and log it instead, as #26 does for dialogs.

Test nit: nobody else holds a handle to the grandchild, so if it exits before OpenProcess, the exit-code check is skipped silently. Having the restarted probe wait for a file or event from the parent before faulting would close that.

Description: please mention the TerminateProcess(…, 1) exit and add docs/analysis/hle.md to the Area list.

@fogydes fogydes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: PR #47 "hle, loader, app, docs: implement XLaunchRestartOnCrash" (issue #11)

Head reviewed: 476e92a (3 commits, base 448bb93, main is now f74e985). CI is green on the head,
and GitHub reports it MERGEABLE. I reviewed by reading only; no cargo build or test was run. Line numbers refer to the PR head.

Verdict: needs changes

The maintainer's points are almost all addressed. One new behaviour bug should be fixed before
merge: when restart is armed, the crash hook ends the process before the title's own
unhandled-exception filter runs (N1). The other findings are smaller.

1. Maintainer points (simnJS, reviews on 697953d and d3df5ae)

# Point Addressed? Where
R1.1 Overlapping processes: end the crashed process after spawning, or wait without a limit Yes lifecycle.rs:278-287: TerminateProcess(GetCurrentProcess(), 1) right after a successful spawn. Side effect: see N1
R1.2 XTP_CRASH_RESTARTED inherited by later XLaunchNewGame relaunches Yes lifecycle.rs:340-344 moves it into ALREADY_CRASH_RESTARTED and removes it at startup (run.rs:142, before any title thread)
R1.3 How was slot 0x28 found? Yes xgame.rs:178-181 comment
R1.4 Docs: hle.md row and R10 Yes, one table missed Row hle.md:180, R10 hle.md:375-378. The order table hle.md:513 ("11 | R10 relaunch, restart on crash") is not updated. #26 updated its equivalent row for R5
Nit xasync::E_INVALIDARG Yes xgame.rs:100
Nit current unused when exe is empty Yes xgame.rs:105 passes ""
Nit Test: wait for the grandchild rather than sleep 400 ms; don't leave it running Partly restart_on_crash.rs:84-106 waits on its handle, but see T1
R2.1 end_with saves the pipeline cache from the crash filter; terminate directly Yes lifecycle.rs:284-286. end() is back to its original form
R2.2 Say slot 0x28 is inferred, not confirmed Yes xgame.rs:178-181
R2.3 Row stays ◐; R10 Goal says restart-on-crash is done Yes hle.md:180, hle.md:375-378
R2.4 Assert exit codes (1 and 0xC0000005); kill the grandchild if the wait times out Partly Codes asserted at restart_on_crash.rs:39-43 and :101-104, kill at :87-93. If OpenProcess fails (:84), every check is skipped silently and the racy line count (:111) is all that is left (T1)

2. New findings, by severity

N1 (High): restart-on-crash skips the title's own unhandled-exception filter

  • Where: crates/xtp-loader/src/crash.rs:621-625 (report_unhandled now calls run_on_crash).
    Caller (unchanged): crates/xtp-hle/src/modules/kernel.rs:267-277. It calls
    host::report_unhandled(info) first and the title's filter (TITLE_FILTER) afterwards.

  • Problem: report_unhandled used to only report. Now it runs the hook, and the hook calls
    TerminateProcess when a replacement is spawned. Our filter runs ahead of the title's filter
    (that is how crash.rs:9-10 documents it), so with restart armed the title's filter never runs.

  • Scenario: a title calls SetUnhandledExceptionFilter to write its own crash dump, flush
    telemetry or saves, or handle a known fault and return EXCEPTION_CONTINUE_EXECUTION. It also
    calls XLaunchRestartOnCrash at boot. Its first unhandled fault then restarts the title, and its
    filter never runs: no dump, nothing flushed, and a fault it would have recovered from becomes a
    restart. The maintainer's first review warned about "the title's filter resumes execution". The
    TerminateProcess fix turned "two instances" into "the title's filter is skipped".

  • Fix: keep report_unhandled report-only and run the hook at the point where the process is
    certain to die:

    • in kernel.rs report_unhandled, after the title's filter returns, unless it returned
      EXCEPTION_CONTINUE_EXECUTION (-1);
    • in loader report_crashes::filter (crash.rs:162-166) when no title filter is installed.

    Add a test in which a title filter returns -1: no restart. And one in which it returns
    EXCEPTION_CONTINUE_SEARCH: restart after the filter ran.

N2 (Medium): a crash while the title is ending can start a second process, or restart a title the user closed

  • Where: lifecycle.rs:265-288 (relaunch_on_crash) does not check whether end_title
    (lifecycle.rs:205-236) is already running.
  • Scenario A: the title calls XLaunchNewGame. end_title runs the suspend routines, then
    then() spawns the new game (:218-219). A title thread, or end() itself (release_mouse,
    save_pipeline_cache), faults before TerminateProcess at :368. The hook then spawns a
    crash-restart as well. Two xtp processes wait on the same handle and both start the title,
    which is the overlap R1.1 wanted to prevent, through another path.
  • Scenario B: the user closes the window and the title faults in a suspend routine (a common
    place for shutdown bugs). The title restarts after the user quit it.
  • Fix: at the start of end_title, take RESTART_ON_CRASH
    (RESTART_ON_CRASH.lock().take()). Or make ENDING a module static and return early from
    relaunch_on_crash when it is set.

N3 (Low/Medium): too much work in the crash filter on the faulting thread

  • Where: lifecycle.rs:296-332 (relaunch_with_env, called from the filter).

  • Problem: inside the unhandled-exception filter, on the faulting thread, this code calls
    tracing::info!/warn! (:324, :328), allocates (current_exe, Command, args, env block),
    takes std's env lock, and calls CreateProcessW.

  • Scenario:

    • The fault is heap corruption, or the faulting thread holds the tracing writer or stdout lock:
      the filter deadlocks, the process hangs, and there is no restart and no exit.
    • EXCEPTION_STACK_OVERFLOW: the filter runs on the overflowed thread with only the guard
      slack, Command::spawn overflows again, and the process dies with no restart.

    report() already allocates, so part of this risk exists today, but the spawn adds to it.

  • Fix, either of:

    • build the command line (UTF-16) once in set_restart_on_crash, and call CreateProcessW
      directly in the hook with no allocation and no tracing; log afterwards, or not at all;
    • start a helper thread from XLaunchRestartOnCrash that waits on an event. The filter signals
      the event and waits a bounded time for "spawned". This also covers stack overflow.

N4 (Low): crashes that do not pass through the unhandled filter never restart

  • Where:
    • kernel.rs:247-256: terminate and _invalid_parameter_noinfo_noreturn call host::abort;
    • fastfail::install (crash.rs:176): __fastfail, failure exit codes.
  • Problem: "restart on crash" only covers SEH exceptions that nobody handled. An uncaught C++
    exception that ends in std::terminate, or a __fastfail, does not restart. The docs (hle.md
    R10, the PR description) don't say this.
  • Fix: call the hook from the abort and fastfail paths too, or state the limit in R10 and in
    the relaunch_on_crash doc comment.

N5 (Low): the restarted process never restarts again, however long it runs

  • Where: lifecycle.rs:266-271. ALREADY_CRASH_RESTARTED lasts for the whole life of the
    process.
  • Problem: a crash-restarted session that runs for hours and crashes again is not restarted,
    even if the title calls XLaunchRestartOnCrash again. That prevents loops, but it is stricter
    than "once per crash". I can't confirm the console's exact rule from public docs, so this is a
    question rather than a defect.
  • Fix: clear the guard after a period without crashes (for example 60 s after startup), or
    document "one restart per launch" in R10.

N6 (Low, existing code, now reused): title arguments are split on whitespace

  • Where: xgame.rs:126 (args.split_whitespace()), now used by xgame.rs:105.
  • Problem: XLaunchRestartOnCrash("-save \"slot 1\"", 0) arrives as -save, "slot, 1".
    Command then quotes each piece, so the title sees literal quote characters.
  • Injection: I checked this. A title string cannot become an xtp option: everything goes
    after --, a later -- in the string stays a title argument, take_while(|a| a != "--") stops
    at our own separator, and Command quotes each argument by MSVC rules. No injection.
  • Fix (follow-up, shared with XLaunchNewGame): parse with CommandLineToArgvW rules
    instead of split_whitespace, and add a unit test for relaunch_args with quotes, an empty
    string and an empty exe.

N7 (Low): exit status and parent supervision

  • Where: lifecycle.rs:285.
  • Problem: the crashing process exits with 1, not the exception code. The new process is
    detached, so whatever started xtp sees a clean-looking exit 1 and stops supervising, while the
    title keeps running unsupervised. For example cargo xtask play --measure waits on the first
    xtp process.
  • Fix: exit with the exception code from the record. The test then needs another sign that the
    restart path ran, for example a line the hook writes to the log. Or document exit code 1 and the
    detached child in R10.

N8 (Nit): PR description is out of date

It describes the spawn without the TerminateProcess. Its Area list leaves out
docs/analysis/hle.md, and the pr-check box is unticked (local GPU failures are explained,
which is fine).

3. Repo rules (CONTRIBUTING.md)

  • Area headers: the title and all 3 commits use hle, loader, app[, docs]: ..., and
    conventions passed.
  • Tests without game files: OK. The child-process test is synthetic.
  • Provenance: "all my own work" is ticked, AI help (Antigravity) is disclosed, and the
    description says xcl was not read.
  • Rule 3 (console SDK): the slot order is "inferred from XGame.h declaration order". The
    public PC GDK header is not console-SDK material, and no code was transcribed. The maintainer
    should still decide whether that inference is acceptable as provenance. The comment honestly
    says "not confirmed".
  • No titles named: none in the added lines.
  • Overlap with #26: both PRs change apps/xtp/src/run.rs and docs/analysis/hle.md. The
    hunks don't touch (rows 176 and 180, three unchanged lines between them), so whichever lands
    second needs a rebase, not a conflict resolution. The base is behind main (448bb93 vs
    f74e985). Main's later changes to run.rs are near lines 164-178 and 274, and do not overlap.

4. Test gaps

  • T1: at restart_on_crash.rs:84, if OpenProcess returns null, the exit-code checks are
    skipped silently. Use panic! (or assert!) instead of if !handle.is_null(). Also, if
    grandchild_pid is None (:67), the test panics and a late grandchild keeps running. Kill by
    PID on that path too, or have the child report its PID through a pipe or an inherited handle.
  • T2: no test covers a title filter being present (N1), or a crash during
    end_title/XLaunchNewGame (N2).
  • T3: relaunch_args has no unit test for the restart shape: empty exe, empty or null
    args (no --), quoted args.
  • T4: XLaunchRestartOnCrash(nullptr, 0) is not exercised (the probe passes null only with
    reserved = 1).
  • T5: this is the first harness = false test in the repo. It ignores test filters, so
    cargo test -p xtp-hle lifecycle also runs it, and it prints a fake test ... ok line. The repo
    already has a self-re-exec pattern for child-process tests (isolated() in
    crates/xtp-loader/src/crash.rs:1958). A normal #[test] that re-executes itself with
    --exact would fit better.
  • T6: on a developer machine with the WER UI enabled, the grandchild's second fault can show a
    dialog and hit the 10 s timeout. CI doesn't show WER dialogs.

Review drafted with Claude Code; findings checked against the PR head by reading the code.

@PrivacyOnion

Copy link
Copy Markdown
Contributor Author
  1. The crash report still runs first. The title filter then gets the exception. If it returns EXCEPTION_CONTINUE_EXECUTION, the wrapper returns that result without calling the restart hook. The loader's default filter covers the case where the title registers no filter.
  2. With --autopilot, an armed restart logs skipping crash restart: autopilot is enabled. The original process exits with its exception status so cargo xtask play can observe the crash.
  3. The replacement probe publishes its PID and waits on an event. The parent must open its process handle before signalling the event, then it checks the replacement's 0xC0000005 exit code. The probe also checks both title-filter dispositions and the unattended exit.

The description now mentions TerminateProcess(GetCurrentProcess(), 1) and lists docs/analysis/hle.md under Area.

@github-actions github-actions Bot added size/L 400 to 999 changed lines and removed size/M 100 to 399 changed lines labels Nov 25, 2026
simnJS
simnJS previously approved these changes Nov 25, 2026

@simnJS simnJS left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this addresses my last review:

  • The restart now runs after the title's filter, and is skipped when the filter resumes execution.
  • Autopilot logs an armed restart and skips it.
  • The probe holds the replacement's handle before it faults.
  • The description is updated.

Two small points, neither blocking:

  • In the hle.md summary, row 11 puts its status in the "Depends on" column.
  • If a suspend routine faults during end_title, the title would still restart. Clearing RESTART_ON_CRASH at the start of end_title would fix that; a follow-up is fine.

CI is green apart from the known gpu-debug-layer failures, which also fail on main; we're fixing those there, and I'll merge once that job is green. Approving.

@PrivacyOnion

Copy link
Copy Markdown
Contributor Author

Thanks for the review. The follow-up is d50e45d, based on b04fb41.

  • N1 / T2, title filter: b04fb41 calls the title’s filter before the restart hook. The probe checks that execution resumes after the first exception and that the filter runs before restart on the next one.
  • N2 / T2, shutdown: end_title clears the pending restart before running suspend routines. The probe arms a restart, calls XLaunchNewGame, then faults in a suspend routine. The process exits with 0xC0000005 and starts no replacement.
  • R1.1–R1.3 / R2.1–R2.3: Verified direct termination after spawn, the replacement’s predecessor wait and startup marker consumption, the explanation of the inferred vtable slot, and R10’s partial status. The argument handling already uses E_INVALIDARG and an empty current path for restart.
  • R1.4 / summary row 11: Moved the status into the R10 item and put — in Depends on. R10 still tracks live relaunch verification.
  • T1 / R2.4, process checks: The probe requires 1 from a process that restarted and 0xC0000005 from its replacement. A missing PID, failed handle open, or failed wait or exit-code query fails the test. A Windows job cleans up any surviving probe processes, including on failure, and counts how many started.
  • T3 / T4, arguments: Unit tests cover an empty executable override, null and empty arguments, and the current whitespace split for quoted input. A probe calls XLaunchRestartOnCrash(nullptr, 0) and verifies that the replacement receives no title arguments or -- separator.
  • T5, test runner: The five cases are normal #[test] functions. Each re-executes the same binary with --exact and its own test name.
  • T6, crash dialogs: The probes keep SEM_NOGPFAULTERRORBOX and the bounded waits.
  • N8, description: Updated the test section and documented disarming on shutdown. The description covers direct termination, replacement wait, and docs/analysis/hle.md in the area list.

Follow-ups from the review are moving restart work off the faulting thread (N3), evaluating abort and fast-fail coverage (N4), confirming the restart guard’s lifetime against the console (N5), parsing quoted arguments for both launch APIs (N6), and revisiting exit status and replacement supervision (N7).

@github-actions github-actions Bot removed the overlap another open PR changes the same files label Nov 25, 2026

@simnJS simnJS left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed d50e45d. Both nits are fixed:

  • row 11's status is in the item column;
  • end_title clears RESTART_ON_CRASH right after setting ENDING, which set_restart_on_crash and the crash hook also check.

fogydes's N1, N2 and T1–T5 look resolved; N3–N7 remain follow-ups. @fogydes, could you re-review when you have a moment? I'll merge once CI is green and your request is cleared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/app apps/ area/docs docs/, Markdown area/hle touches crates/xtp-hle area/loader touches crates/xtp-loader size/L 400 to 999 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relaunch and restart on crash (XLaunchNewGame, XLaunchRestartOnCrash)

3 participants