XGameRuntime: one reading of the title id for both APIs and the start-up line #1841

Open
us3r40456 wants to merge 1 commit from upstream-pr/1851 into main
us3r40456 commented 2026-11-24 21:48:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by us3r40456 on 2026-11-24T21:48:45Z.


XCL gives a title its title id through two XGameRuntime functions, and they read title_id in two ways. XGameGetXboxTitleId parses it as hex after stripping a lowercase 0x, and gives 0 for anything else. XPackageEnumeratePackages hands over the raw text, upper-cased. So a malformed id reaches the title as 0 from one and as text from the other (XYZ123 → 0 and "XYZ123"). The start-up line also prints the manifest's value as if it were taken, and the warning says "no TitleId" when there is one it cannot read. This PR gives both functions and the start-up line one reading.

What is in it

  • config::parse_title_id: hex, with or without 0x / 0X, spaces around it ignored. Empty, not hex (a + sign included), wider than 32 bits or 0 is no title id. Config::title_id_value applies it to title_id.
  • XGameGetXboxTitleId uses it. The warning stays "no TitleId …" when there is none, and names the value when there is one it cannot read (TitleId "XYZ123" (MicrosoftGame.Config / xcl.toml) is not a nonzero 32-bit hex title id → 0).
  • XPackageEnumeratePackages's title_id is that number as 8 hex digits, or empty where XGameGetXboxTitleId gives 0.
  • The start-up line marks a manifest id that is not one: TitleId "XYZ123" (not a nonzero 32-bit hex title id: the title gets none).
  • Test a_title_id_is_read_one_way: the parser on 12 inputs, the start-up line for a good and a bad id, and that xcl.toml's id wins over the manifest's.
  • Unchanged on purpose: the XSystemGetAppSpecificDeviceId hash (api.rs:1265) still uses the title_id text, so the id it gives a title does not change for anyone.

Tested

  • MacBook Pro, Apple M5 Pro (20-core GPU), 24 GB, macOS 27.2.1, Rosetta 2. CrossOver 26.3.0.39832 with D3DMetal 3.0. Cross-built with cargo-xwin 0.24.1 (Rust 1.100.0, clang-cl / lld 23.1.6), DXC 1.9.2609.
  • lib unit tests, debug, one at a time, at this PR's head on main 1d027e5: config:: 8 passed, hle::xgameruntime:: 73 passed, 0 failed.
  • The e2e test title (release), with a local probe that calls both functions the way a GDK title does (QueryApiImpl, XGame slot 3 and XPackage slot 39), with 13 variants (12 before the change) of its MicrosoftGame.config <TitleId> and of title_id in xcl.toml. Each variant was run before the change, on the Mac test stack (main 7f7e768 + #750 + #1329 + #1813 + pr/native-host-vtables, which takes the title to its end on a Mac), and after it, on main 1d027e5 + this PR. Three of them (XYZ123, 0X1234ABCD, 1234ABCD) were also run on plain main 1d027e5, with the same values as on the stack:
<TitleId> / xcl.toml main: slot 3 / slot 39 this PR: slot 3 / slot 39
none 0 / "" 0 / ""
1234ABCD, 0x1234abcd, with spaces and line breaks 0x1234abcd / "1234ABCD" the same
0X1234ABCD 0 / "0X1234ABCD" 0x1234abcd / "1234ABCD"
XYZ123 0 / "XYZ123" 0 / ""
123456789 0 / "123456789" 0 / ""
empty 0 / "" 0 / ""
00000000 0 / "00000000" 0 / ""
ABCD 0x0000abcd / "ABCD" (read from the code, not run) 0x0000abcd / "0000ABCD"
xcl.toml CAFE0001 (manifest 1234ABCD) 0xcafe0001 / "CAFE0001" the same
xcl.toml pasunid 0 / "PASUNID" 0 / ""

The title id changes nothing else in the test title: on the stack every variant ends with the same 47 PASS / 3 FAIL, and on plain main with and without this PR every variant gets 31 PASS / 1 FAIL before plain main's known D3DMetal crash (#258), which comes after the probe. The probe is not part of this PR.

Regression run
This changes crates/xcl/src, so it needs xcl-smoke pairs. I have no title. A title with a valid hex <TitleId> gets the same values as before, except that XPackageEnumeratePackages now always writes 8 digits (ABCD → 0000ABCD). Draft until the pairs are here.

main:

PR:

Not tested

  • Windows and Linux / Wine. The change has no host-specific path.
  • Whether a GDK title expects 8 digits or the manifest's own spelling in XPackageDetails::titleId. I chose 8 digits, the way the console writes title ids. I have no title to check against.
  • The whole unit test suite; only config:: and hle::xgameruntime::.

AI use

  • Claude Code, Claude Opus 5.5 found the inconsistencies with the test runs, wrote the change, the test and this description, and ran the tests on this machine.
<!-- greyfinch-sync:ivall/xcl:issue:5480900479 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1851). Originally posted by [us3r40456](https://github.com/us3r40456) on 2026-11-24T21:48:45Z. --- XCL gives a title its title id through two XGameRuntime functions, and they read `title_id` in two ways. `XGameGetXboxTitleId` parses it as hex after stripping a lowercase `0x`, and gives 0 for anything else. `XPackageEnumeratePackages` hands over the raw text, upper-cased. So a malformed id reaches the title as 0 from one and as text from the other (`XYZ123` → 0 and `"XYZ123"`). The start-up line also prints the manifest's value as if it were taken, and the warning says "no TitleId" when there is one it cannot read. This PR gives both functions and the start-up line one reading. **What is in it** - `config::parse_title_id`: hex, with or without `0x` / `0X`, spaces around it ignored. Empty, not hex (a `+` sign included), wider than 32 bits or 0 is no title id. `Config::title_id_value` applies it to `title_id`. - `XGameGetXboxTitleId` uses it. The warning stays "no TitleId …" when there is none, and names the value when there is one it cannot read (`TitleId "XYZ123" (MicrosoftGame.Config / xcl.toml) is not a nonzero 32-bit hex title id → 0`). - `XPackageEnumeratePackages`'s `title_id` is that number as 8 hex digits, or empty where `XGameGetXboxTitleId` gives 0. - The start-up line marks a manifest id that is not one: `TitleId "XYZ123" (not a nonzero 32-bit hex title id: the title gets none)`. - Test `a_title_id_is_read_one_way`: the parser on 12 inputs, the start-up line for a good and a bad id, and that xcl.toml's id wins over the manifest's. - Unchanged on purpose: the `XSystemGetAppSpecificDeviceId` hash (`api.rs:1265`) still uses the `title_id` text, so the id it gives a title does not change for anyone. **Tested** - MacBook Pro, Apple M5 Pro (20-core GPU), 24 GB, macOS 27.2.1, Rosetta 2. CrossOver 26.3.0.39832 with D3DMetal 3.0. Cross-built with cargo-xwin 0.24.1 (Rust 1.100.0, clang-cl / lld 23.1.6), DXC 1.9.2609. - lib unit tests, debug, one at a time, at this PR's head on `main` `1d027e5`: `config::` 8 passed, `hle::xgameruntime::` 73 passed, 0 failed. - The e2e test title (release), with a local probe that calls both functions the way a GDK title does (`QueryApiImpl`, `XGame` slot 3 and `XPackage` slot 39), with 13 variants (12 before the change) of its `MicrosoftGame.config` `<TitleId>` and of `title_id` in `xcl.toml`. Each variant was run before the change, on the Mac test stack (`main` `7f7e768` + #750 + #1329 + #1813 + `pr/native-host-vtables`, which takes the title to its end on a Mac), and after it, on `main` `1d027e5` + this PR. Three of them (`XYZ123`, `0X1234ABCD`, `1234ABCD`) were also run on plain `main` `1d027e5`, with the same values as on the stack: | `<TitleId>` / xcl.toml | `main`: slot 3 / slot 39 | this PR: slot 3 / slot 39 | |---|---|---| | none | 0 / `""` | 0 / `""` | | `1234ABCD`, `0x1234abcd`, with spaces and line breaks | `0x1234abcd` / `"1234ABCD"` | the same | | `0X1234ABCD` | **0** / `"0X1234ABCD"` | `0x1234abcd` / `"1234ABCD"` | | `XYZ123` | 0 / **`"XYZ123"`** | 0 / `""` | | `123456789` | 0 / **`"123456789"`** | 0 / `""` | | empty | 0 / `""` | 0 / `""` | | `00000000` | 0 / **`"00000000"`** | 0 / `""` | | `ABCD` | `0x0000abcd` / `"ABCD"` (read from the code, not run) | `0x0000abcd` / `"0000ABCD"` | | xcl.toml `CAFE0001` (manifest `1234ABCD`) | `0xcafe0001` / `"CAFE0001"` | the same | | xcl.toml `pasunid` | 0 / **`"PASUNID"`** | 0 / `""` | The title id changes nothing else in the test title: on the stack every variant ends with the same 47 PASS / 3 FAIL, and on plain `main` with and without this PR every variant gets 31 PASS / 1 FAIL before plain `main`'s known D3DMetal crash (#258), which comes after the probe. The probe is not part of this PR. **Regression run** This changes `crates/xcl/src`, so it needs `xcl-smoke` pairs. I have no title. A title with a valid hex `<TitleId>` gets the same values as before, except that `XPackageEnumeratePackages` now always writes 8 digits (`ABCD` → `0000ABCD`). Draft until the pairs are here. main: PR: **Not tested** - Windows and Linux / Wine. The change has no host-specific path. - Whether a GDK title expects 8 digits or the manifest's own spelling in `XPackageDetails::titleId`. I chose 8 digits, the way the console writes title ids. I have no title to check against. - The whole unit test suite; only `config::` and `hle::xgameruntime::`. **AI use** - Claude Code, Claude Opus 5.5 found the inconsistencies with the test runs, wrote the change, the test and this description, and ran the tests on this machine.
DavidM1911 commented 2026-11-25 02:08:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T01:28:43Z.


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7149591136 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1851#issuecomment-7149591136). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T01:28:43Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** — needs a rebase before it can be tested.
github-actions[bot] commented 2026-11-28 08:01:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T08:01:15Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7236309230 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1851#issuecomment-7236309230). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T08:01:15Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 06:59:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:59:20Z.


Triage (#1607) – head 40df48b

No open or merged PR makes this change. On main, XGameGetXboxTitleId and enumerate_packages in api.rs still each read title_id their own way (trim_start_matches("0x")), so the shared parse_title_id is not on main. No problems found in the diff. The failing check is the PR description check, and the branch conflicts with main.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7303513725 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1851#issuecomment-7303513725). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:59:20Z. --- **Triage (#1607)** – head 40df48b No open or merged PR makes this change. On main, `XGameGetXboxTitleId` and `enumerate_packages` in `api.rs` still each read `title_id` their own way (`trim_start_matches("0x")`), so the shared `parse_title_id` is not on main. No problems found in the diff. The failing check is the PR description check, and the branch conflicts with main. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1851:upstream-pr/1851'
git switch 'upstream-pr/1851'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1851'
git switch 'upstream-pr/1851'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1851'
git switch 'upstream-pr/1851'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1851'
git switch 'main'
git merge --squash 'upstream-pr/1851'
git switch 'main'
git merge --ff-only 'upstream-pr/1851'
git switch 'main'
git merge 'upstream-pr/1851'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1841
No description provided.