gdk: XSystem and XGame title id conformance against the PC runtime (17 scenarios, 3 fixes) #300

Closed
github-bot wants to merge 3 commits from gh-pr/300/head into gh-pr/300/base
Owner

@⁠QuentinDanblon on GitHub · 2026-11-23 16:57 UTC · original
QuentinDanblon:pr/gdk-conformance-next → main · +380 −9 · 4 files · 3 commits · closed without merging

Library / area: compat-common, GDK runtime src/gdk/system.rs (XSystem, XSystemAnalytics, XGameGetXboxTitleId), plus a paired conformance suite in the style of the XTaskQueue one.

Exports changed (exports.txt rows): none

Source of the behaviour: measured on the PC xgameruntime.dll 10.0.26100.9656 (System32, loaded directly with InitializeApiImpl / QueryApiImpl, without going through the emulator's gdk module). Method order comes only from our own emulated tables. No disassembly, no third-party code.

Tests

tests/support/xsys.rs holds 17 scenarios and a macro; gdk_xsystem_conformance runs them on the emulated runtime, gdk_xsystem_conformance_real on the PC runtime (skipped without it). What they check, for the console id (39 bytes), the app-specific device id (45) and the sandbox id (16):

  • fixed sizes, nothing written past the field;
  • used is the field size for the console and device ids, strlen+1 for the sandbox id, with zero padding;
  • a buffer one byte short, or size 0 with no buffer: E_NOT_SUFFICIENT_BUFFER, buffer and used untouched;
  • a null used is accepted;
  • the three XSystem iids e349bd1a, 67ce4bfc and 6fd71f09 return the same values.

XSystemAnalytics: the 144-byte struct returned through the hidden pointer, OS version equal to the host version with the major in the low word, NUL-terminated zero-padded strings. Values that are PC-specific (all-zero console id, family "Windows.Desktop", form "Unknown") are not compared, since the emulator presents a console.

Differences found, each fixed in its own commit

scenario before PC runtime commit
XSystem e349bd1a slot 5 (app-specific device id) E_NOTIMPL served, same value as the other two iids 749eafb
XGameGetXboxTitleId with no TitleId E_FAIL E_NOT_FOUND (0x80070490), on iids 50849859 and 2549f142 89902fc
same, with a null output pointer E_INVALIDARG E_NOT_FOUND (the title is checked before the pointer) 89902fc

With a TitleId present nothing changes. After the fixes the suite's DIFFERS table is empty.

On 89902fc (base f89e410, r32l), RTX 5090 PC, Windows 11:

  • gdk_xsystem_conformance and gdk_xsystem_conformance_real: 17/17, 3 runs each;
  • --lib: 147 passed, 1 ignored; gdk_xtaskqueue_conformance and _real: 61/61 each; gdk_minecraft_slots 6/6, gdk_runtime 9 passed 1 ignored, gdk_identity 1/1, gdk_verifier_fixes 14/14, gdk_slot_map 1/1.
  • pr_gate.py --base origin/main: 0 problems.

Questions for you

  • A null buffer with a non-zero size crashes the PC runtime (access violation), so it is not a scenario. The emulator crashes too. Keep it that way?
  • XSystem 1861cf2e (from the #279 census) is not covered here. Add it once #279 is in?
  • "Packaged title + null output" for XGameGetXboxTitleId cannot be measured on this machine; that case keeps E_INVALIDARG.

Not covered

PC runtime only, no console measurement, no title run. Candidates left out: XPersistentLocalStorage (QueryApiImpl returns E_FAIL in an unpackaged process), XLaunchUri and the screen-dim deferral (side effects).

  • cargo test -p compat-common passes for what is listed above
  • No game or console files and no binaries included
  • No fake success

🤖 Generated with Claude Code

**@⁠QuentinDanblon** on GitHub · 2026-11-23 16:57 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/300) `QuentinDanblon:pr/gdk-conformance-next` → `main` · +380 −9 · 4 files · 3 commits · closed without merging **Library / area:** `compat-common`, GDK runtime `src/gdk/system.rs` (XSystem, XSystemAnalytics, XGameGetXboxTitleId), plus a paired conformance suite in the style of the XTaskQueue one. **Exports changed (exports.txt rows):** none **Source of the behaviour:** measured on the PC `xgameruntime.dll` 10.0.26100.9656 (System32, loaded directly with `InitializeApiImpl` / `QueryApiImpl`, without going through the emulator's gdk module). Method order comes only from our own emulated tables. No disassembly, no third-party code. ### Tests `tests/support/xsys.rs` holds 17 scenarios and a macro; `gdk_xsystem_conformance` runs them on the emulated runtime, `gdk_xsystem_conformance_real` on the PC runtime (skipped without it). What they check, for the console id (39 bytes), the app-specific device id (45) and the sandbox id (16): - fixed sizes, nothing written past the field; - `used` is the field size for the console and device ids, strlen+1 for the sandbox id, with zero padding; - a buffer one byte short, or size 0 with no buffer: `E_NOT_SUFFICIENT_BUFFER`, buffer and `used` untouched; - a null `used` is accepted; - the three XSystem iids `e349bd1a`, `67ce4bfc` and `6fd71f09` return the same values. XSystemAnalytics: the 144-byte struct returned through the hidden pointer, OS version equal to the host version with the major in the low word, NUL-terminated zero-padded strings. Values that are PC-specific (all-zero console id, family "Windows.Desktop", form "Unknown") are not compared, since the emulator presents a console. ### Differences found, each fixed in its own commit | scenario | before | PC runtime | commit | |---|---|---|---| | XSystem `e349bd1a` slot 5 (app-specific device id) | `E_NOTIMPL` | served, same value as the other two iids | `749eafb` | | `XGameGetXboxTitleId` with no TitleId | `E_FAIL` | `E_NOT_FOUND` (0x80070490), on iids `50849859` and `2549f142` | `89902fc` | | same, with a null output pointer | `E_INVALIDARG` | `E_NOT_FOUND` (the title is checked before the pointer) | `89902fc` | With a TitleId present nothing changes. After the fixes the suite's DIFFERS table is empty. On `89902fc` (base `f89e410`, r32l), RTX 5090 PC, Windows 11: - `gdk_xsystem_conformance` and `gdk_xsystem_conformance_real`: 17/17, 3 runs each; - `--lib`: 147 passed, 1 ignored; `gdk_xtaskqueue_conformance` and `_real`: 61/61 each; `gdk_minecraft_slots` 6/6, `gdk_runtime` 9 passed 1 ignored, `gdk_identity` 1/1, `gdk_verifier_fixes` 14/14, `gdk_slot_map` 1/1. - `pr_gate.py --base origin/main`: 0 problems. ### Questions for you - A null buffer with a non-zero size crashes the PC runtime (access violation), so it is not a scenario. The emulator crashes too. Keep it that way? - XSystem `1861cf2e` (from the #279 census) is not covered here. Add it once #279 is in? - "Packaged title + null output" for `XGameGetXboxTitleId` cannot be measured on this machine; that case keeps `E_INVALIDARG`. ### Not covered PC runtime only, no console measurement, no title run. Candidates left out: XPersistentLocalStorage (`QueryApiImpl` returns `E_FAIL` in an unpackaged process), XLaunchUri and the screen-dim deferral (side effects). - [x] `cargo test -p compat-common` passes for what is listed above - [x] No game or console files and no binaries included - [x] No fake success 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The same 17 scenarios run against the emulator (gdk_xsystem_conformance)
and against System32 xgameruntime.dll 10.0.26100.9656, loaded directly
with InitializeApiImpl(0x4a61, 0x2712) and QueryApiImpl, without the
emulator's hooks (gdk_xsystem_conformance_real). Method order comes from
the emulator's own XSystem, XSystemAnalytics and XGame tables.

Measured on the PC runtime, unpackaged process, no signed-in user:
- console id, sandbox id and app-specific device id fill fixed fields of
  39, 16 and 45 bytes and write nothing past them in a larger buffer;
  console id and device id report used = field size, the sandbox id
  reports used = strlen + 1 and zero-pads the rest of its 16 bytes;
- one byte short (and 8 or 15 bytes for the 7-byte "RETAIL" sandbox id),
  or size 0 with no buffer, returns E_NOT_SUFFICIENT_BUFFER and leaves
  the buffer and the used count untouched; a null used pointer is accepted;
- e349bd1a, 67ce4bfc and 6fd71f09 return the same three ids;
- XSystemGetAnalyticsInfo returns its 144-byte struct through the hidden
  pointer, os version equal to hosting version, major in the low word,
  family and form NUL-terminated and zero-padded;
- XGameGetXboxTitleId (50849859 and 2549f142) without a title returns
  E_NOT_FOUND, also with a null output pointer.

The PC runtime's values (zero console id, "Windows.Desktop", "Unknown")
are not asserted: the emulator reports console values on purpose, only
sizes, layout and return codes are compared. A null buffer with a
non-zero size faults in the PC runtime and is not a scenario.

14 scenarios match. 3 differ and are skipped in the emulated run with
the reason (TOMBOX_XSYS_ALL=1 runs them):
- the e349bd1a table returns E_NOTIMPL at slot 5 (app-specific device id);
- the title id without a TitleId returns E_FAIL instead of E_NOT_FOUND;
- the same with a null output returns E_INVALIDARG instead of E_NOT_FOUND.

Not claimed: behaviour of a packaged title, of a console runtime, or of
other XSystem ids the census lists (1861cf2e).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The PC runtime (xgameruntime.dll 10.0.26100.9656) answers slot 5 of
e349bd1a with the same 45-byte app-specific device id as 67ce4bfc and
6fd71f09; the emulator's e349bd1a table stopped at slot 4 and its slot 5
stub returned E_NOTIMPL. The table now points slot 5 at the same function
as the two newer ids.

Proved by every_xsystem_iid_serves_the_app_specific_device_id, which
passes on the PC runtime and now on the emulator; its DIFFERS row is
removed. Not claimed: what a console runtime serves at that slot.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Measured on the PC runtime (xgameruntime.dll 10.0.26100.9656), process
without package identity, through both XGame ids 50849859 and 2549f142:
the call returns E_NOT_FOUND (0x80070490) and leaves the output alone,
and returns E_NOT_FOUND as well when the output pointer is null. The
emulator returned E_FAIL, and E_INVALIDARG for a null output, when no
MicrosoftGame.config gives a TitleId. It now checks the title first and
returns E_NOT_FOUND; with a TitleId, a null output still returns
E_INVALIDARG and a valid one still receives the id (unchanged).

Proved by title_id_without_a_title_is_not_found and
title_id_without_a_title_reports_not_found_before_a_null_output, which
pass on the PC runtime and now on the emulator; their DIFFERS rows are
removed and the emulated table has no remaining difference. Not claimed:
the null-output result of a packaged title on the PC runtime, which this
machine cannot measure.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:17:48 +00:00
github-bot closed this pull request 2026-11-26 06:17:48 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-25 13:48 UTC · original

Applied on main in fb95d74 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

**@⁠omonkeyz** on GitHub · 2026-11-25 13:48 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/300#issuecomment-7164328974) Applied on main in fb95d74 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.