Skip to content

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

Draft
us3r40456 wants to merge 1 commit into
xcl-dev:mainfrom
us3r40456:titleid-one-reading
Draft

us3r40456 wants to merge 1 commit into
xcl-dev:mainfrom
us3r40456:titleid-one-reading

Conversation

@us3r40456

Copy link
Copy Markdown

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

<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.

…-up line

XGameGetXboxTitleId parsed title_id as hex after stripping a lowercase
"0x" and gave 0 for anything else, while XPackageEnumeratePackages handed
the title the raw text, upper-cased. A malformed id therefore reached the
title as 0 from one API and as text from the other, the start-up line
showed it as if it were taken, and the warning said there was no TitleId.

config::parse_title_id is now the one reading: hex, "0x" or "0X", spaces
around ignored; empty, not hex, wider than 32 bits or 0 is no title id.
XGameGetXboxTitleId and XPackageEnumeratePackages (8 hex digits, or none)
both use it, the start-up line marks an id that is not one, and the
warning names the value it could not read.

Test: a_title_id_is_read_one_way.
@DavidM1911

Copy link
Copy Markdown
Contributor

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants