Skip to content

app, hle: resolve title folders for xtp run - #20

Merged
simnJS merged 2 commits into
MiamiGame:mainfrom
AliceWood:app/run-title-folder
Nov 24, 2026
Merged

simnJS merged 2 commits into
MiamiGame:mainfrom
AliceWood:app/run-title-folder

Conversation

@AliceWood

@AliceWood AliceWood commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Fixes #3. No PR dependencies.

xtp run now accepts a package directory. It selects an existing executable from MicrosoftGame.config, including a relative path in a subdirectory. If no manifest entry matches, it reports why each named entry was skipped and looks for a single top-level .exe. Multiple matches produce a sorted list, and an empty folder produces a diagnostic naming the folder. Passing an executable directly still works.

Area

The xtp CLI resolves the argument and keeps the package root mounted when the selected executable is nested. xtp-hle reads executable names with the existing manifest reader. The README, CLI help and contributor quick start document the folder argument. The tests reuse the workspace's tempfile dependency.

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 the title: no. Both revisions were built and tested in Windows Sandbox with Rust 1.98.1 MSVC, the debug profile, WARP and the same synthetic files.

The comparison used unmodified 79fa391 and PR commit 9ede113. Each row ran xtp run <path> without --execute. The valid executable was built from XTP's own hle-probe fixture.

Input Upstream This PR
Manifest selects the probe beside a decoy Directory read failed Selected and bound the probe
Only the probe in the folder Directory read failed Selected and bound the probe
Two candidates, no manifest Directory read failed Listed both candidates and stopped
Empty folder Directory read failed Reported that the folder contains no executable
Explicit probe path Bound the probe Bound the probe

cargo test --locked -p xtp -p xtp-hle passed all 13 CLI tests, including five new ones. The HLE suite reported 150 passed, two ignored and one failure on each revision. The failing test was modules::xmem::tests::title_calls_succeed_under_open_heaps on both. The separate cargo test --locked -p xtp-hle --lib runtime::tests:: run passed both matched tests, including the manifest-reader regression test.

cargo xtask pr-check --base origin/main passed formatting, both Clippy configurations, asset policy and conventions. The workspace test step stopped in xtp-gpu with 189 passed, seven failed and seven ignored. A separate cargo test --workspace --locked on unmodified upstream stopped in the same crate. The seven failing test names matched exactly across the two runs.

GPU tests that failed on both revisions
draw::tests::copied_root_srvs_see_what_the_list_wrote_before
draw::tests::lists_without_a_view_heap_use_xtps_own
draw::tests::root_cbvs_read_inside_memory_the_list_holds
draw::tests::root_srv_tables_read_their_range
pipeline::host::tests::wave64_compute_for_a_forced_32_lane_target
resource::tests::host_descriptions_are_ones_the_host_gpu_creates
resource::tests::host_descriptions_are_ones_warp_creates

Review update on eb05f4e

The fallback now names every rejected manifest entry and its reason on stderr. An empty directory includes the same information in its error. Unreadable or invalid UTF-8 manifests produce a diagnostic. The CLI help and autopilot docs now show the folder form.

In Windows Sandbox, the same synthetic package bound its sole top-level executable on both the previous head and this revision. The previous head emitted no fallback warning. The new head identified all three rejected entries (a missing file, an out-of-package path, and a non-executable extension). The empty-folder variant reported all three reasons. A separate invalid UTF-8 case bound the fixture and emitted a read warning.

On this revision, cargo test --locked -p xtp passed all 14 tests, including the new CLI warning check. cargo test --locked -p xtp-hle --lib runtime::tests:: passed all three matched tests, including the parser test for quoting, entities and paths. The full PR check passed both Clippy configurations, formatting, conventions and policy. Its seven GPU test failures matched the unmodified upstream comparison above by name.

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:

AI assistance: OpenAI Codex wrote and reviewed the code, tests and documentation, ran the comparisons and prepared this PR. Direct sources were issue #3, the review on PR #20, XTP's B14 plan, the contribution and asset policies, and XTP's CLI, manifest reader and synthetic fixture. Xcl's behavior was described second-hand in the issue and B14. Codex did not open xcl or AnyPS5 for this PR.

AliceWood personally reviewed eb05f4e. Contributor's review comment

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>; one topic; under 400 changed lines, or the reason is above
  • Docs updated where behaviour, commands or variables changed (README, docs/)

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

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Other open pull requests change the same files. Check that they do not do the same work, and agree with their authors on which lands first: the other one will then need a rebase.

Pull request Files changed by both
#21 docs/dev/START_HERE.md
#23 README.md

This comment is kept up to date automatically and removed when the overlap ends.

@github-actions github-actions Bot added area/hle touches crates/xtp-hle area/app apps/ area/docs docs/, Markdown area/deps Cargo.lock size/M 100 to 399 changed lines labels Nov 24, 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 @AliceWood, this is a clean, well-scoped change:

  • path handling is careful (component filter plus canonicalize/prefix check);
  • it reuses the existing manifest reader instead of adding a dependency;
  • fixtures are synthetic;
  • CI is green.

Before merge:

  1. Provenance. CONTRIBUTING allows AI-written code, but the contributor answers for every line, and the description says your personal review is "unconfirmed". Please confirm that you have reviewed the change and take responsibility for it. Please also restore the template's Provenance wording and its AI assistance: line.
  2. Silent fallback. When MicrosoftGame.config lists executables but none qualifies (missing, not .exe, or outside the folder), pick_executable silently falls back to the single top-level .exe (run.rs:62-71, which folder_falls_back_to_its_only_executable asserts). That can start the wrong program without a word. Please make it an error naming the manifest entries and why each was skipped, or at least print a warning. The "no executable found" message should mention the manifest entries too.

Non-blocking suggestions:

  • Consider preferring TargetDeviceFamily="Scarlett" entries before declaring ambiguity, since a package can list Series and Xbox One executables side by side.
  • Warn when MicrosoftGame.config exists but cannot be read as UTF-8, instead of treating it as empty.
  • Please add a unit test in xtp-hle runtime::tests for the new parser paths:
    • Name with spaces around =;
    • single quotes;
    • > inside a quoted value;
    • entities;
    • Executable outside ExecutableList.
  • Doc nits:
    • runtime.rs:74 ("beside its executable");
    • the run help text: folder mode also works without a manifest, and value_name = "EXE|FOLDER" would match the README;
    • docs/dev/autopilot.md.
  • FYI, no change needed here: in folder mode relaunch_args (xgame.rs) finds no exe argument to replace, so a relaunch resolves the folder again. That's fine for a title that relaunches itself.

PR #19 touches different hunks of run.rs, main.rs and the README, so whichever lands second should need at most a trivial rebase.

@AliceWood

Copy link
Copy Markdown
Contributor Author

@simnJS, could you take another look at eb05f4e? The fallback now warns before launching the sole top-level executable and names every skipped manifest entry with its reason. The empty-folder error includes the same details. An unreadable or invalid UTF-8 manifest also produces a warning.

The new CLI test exercises the warning through xtp run. The parser unit test covers both quote styles, whitespace around =, > inside quotes, entities, and Executable outside ExecutableList. The CLI help, runtime comment and autopilot docs now describe folder mode. Multiple eligible programs still produce an ambiguity error listing the candidates. Preferring TargetDeviceFamily="Scarlett" would change which program launches, so I left that suggestion for a separate decision.

All 14 CLI tests and all three targeted runtime tests passed in Windows Sandbox. GitHub CI passed on eb05f4e. The description restores the template’s provenance wording and AI assistance line. The contributor’s personal sign-off is still pending.

@simnJS

simnJS commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Thanks @AliceWood. Item 2 is resolved:

  • the skipped entries and their reasons are now in both the warning and the "no executable found" error;
  • the parser test and the doc fixes are in, thanks for those too;
  • leaving the Scarlett preference for a follow-up is fine.

Item 1 is still open. The description still says "Human review of the updated revision is pending", and your last comment says the personal sign-off is still pending. Please reply here, yourself, that you have reviewed this change and take responsibility for every line, and remove that line from the description. While you're editing it, please also restore the template's checklist wording (for example, the asset-policy line). That's the only thing blocking the merge, and no rebase is needed.

Optional, non-blocking: print entry names with {} rather than {:?}, so that Windows paths don't show doubled backslashes, and have the CLI test assert a non-zero exit.

@AliceWood

Copy link
Copy Markdown
Contributor Author

replying myself, looked at the code, seems ok

@AliceWood
AliceWood requested a review from simnJS November 24, 2026 19:16

@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 @AliceWood for the sign-off and the restored template. Both blocking items are resolved and CI is green. Approving and merging. The optional nits ({} instead of {:?} for entry names, a non-zero exit assertion in the CLI test, the Scarlett preference) can go in a follow-up.

@simnJS
simnJS merged commit c38f95c into MiamiGame:main Nov 24, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/app apps/ area/deps Cargo.lock area/docs docs/, Markdown area/hle touches crates/xtp-hle overlap another open PR changes the same files size/M 100 to 399 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

xtp run <game folder>: pick the title's executable from MicrosoftGame.config

2 participants