runtime: add XSystem and XGame contracts #1168

Merged
lambirou merged 1 commit from upstream-pr/1175 into main 2026-11-24 03:16:14 +00:00
lambirou commented 2026-11-24 02:30:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-24T02:30:09Z.


Change

Add the synthetic XSystem and XGame identity contracts to the XGameRuntime fixture.

  • XSystemGetConsoleId returns the fixed 38-character identity
    58325731.00000000.00000000.00000000.01; the required buffer is 39 bytes including the
    terminator. A short buffer returns ERROR_INSUFFICIENT_BUFFER, a null path E_POINTER,
    and the used-size output remains optional.
  • XSystemGetDeviceType returns the documented PC value 0x01; the table gains an
    implemented_value state that records S_OK.
  • XGameGetXboxTitleId returns the fixed synthetic TitleID 0x58325731 and E_POINTER for
    a null output. Repeated calls are stable.
  • The table now has 28 exports: 17 implemented HRESULT, 1 implemented value, 5 implemented void
    and 5 stubs. XUser, XGameSave, PLS, XPackage and the async stubs are unchanged.
  • XSystemGetConsoleType and XGameGetXboxTitleIdEx are not present in the public GDK lists
    consulted; they are not invented.

Verification

  • cmake --build --preset dev --target xgameruntime_shim xgameruntime_shim_check xgameruntime_contracts_check xgameruntime_pls_xpackage_check xgameruntime_identity_check xgameruntime_preflight_exe
    • Passed with MSVC 19.44.
  • ctest --preset dev --no-tests=error -R '^xgameruntime_' -V
    • 5/5 passed: thunks, XUser/XGameSave, PLS/XPackage, identity and strict preflight.
    • Identity output:
      console=58325731.00000000.00000000.00000000.01 device=pc title=0x58325731 stable=ok short=ERROR_INSUFFICIENT_BUFFER null=E_POINTER user-async=E_NOTIMPL calls=11 PASS.
  • python -B tests/xgameruntime_table_check.py
    • exports=28 ... states=implemented_hr=17,implemented_value=1,implemented_void=5,stub=5 duplicate_control=detected PASS.
  • docs_links_check.py: Self-test passed., Checked 15 Markdown files and 256 links..
  • git diff --check origin/main...HEAD: clean.
  • Not run: full CTest, release preset, a real Xbox console.

Evidence and follow-up

  • Branch runtime/xsystem-xgame, head 4a1bccf, based on f05369ec (contains XCL-06).
  • Public sources: XSystemGetConsoleId,
    XSystemGetDeviceType,
    XSystemDeviceType,
    XGameGetXboxTitleId.
  • XSystemConsoleIdBytes = 39 is the documented 38-character identity plus terminator;
    corroborated by public Microsoft interoperability constants.
  • Negative controls: 38-byte buffer returns ERROR_INSUFFICIENT_BUFFER with used zero, null
    console buffer E_POINTER, null TitleID output E_POINTER, and XUser/XPackage async calls
    remain E_NOTIMPL.
  • Limits: the shim always reports PC and a fixed TitleID; it does not model a console process or
    an absent-title ERROR_NOT_FOUND.
  • Provenance: public Microsoft GDK docs above; no XCL code, table or output. No game files,
    dumps, shader bytes, title paths or secrets.

Checklist

  • One XSystem/XGame synthetic-identity behavior.
  • Positive identity/stability and short-buffer/null negative controls.
  • Table state and documentation updated.
  • No game files, dumps, logs or secrets.
  • Provenance checked; no XCL code used.
  • AI-assisted (Codex).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6573271056 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1175). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-24T02:30:09Z. --- ## Change Add the synthetic XSystem and XGame identity contracts to the XGameRuntime fixture. - `XSystemGetConsoleId` returns the fixed 38-character identity `58325731.00000000.00000000.00000000.01`; the required buffer is 39 bytes including the terminator. A short buffer returns `ERROR_INSUFFICIENT_BUFFER`, a null path `E_POINTER`, and the used-size output remains optional. - `XSystemGetDeviceType` returns the documented PC value `0x01`; the table gains an `implemented_value` state that records `S_OK`. - `XGameGetXboxTitleId` returns the fixed synthetic TitleID `0x58325731` and `E_POINTER` for a null output. Repeated calls are stable. - The table now has 28 exports: 17 implemented HRESULT, 1 implemented value, 5 implemented void and 5 stubs. XUser, XGameSave, PLS, XPackage and the async stubs are unchanged. - `XSystemGetConsoleType` and `XGameGetXboxTitleIdEx` are not present in the public GDK lists consulted; they are not invented. ## Verification - `cmake --build --preset dev --target xgameruntime_shim xgameruntime_shim_check xgameruntime_contracts_check xgameruntime_pls_xpackage_check xgameruntime_identity_check xgameruntime_preflight_exe` - Passed with MSVC 19.44. - `ctest --preset dev --no-tests=error -R '^xgameruntime_' -V` - 5/5 passed: thunks, XUser/XGameSave, PLS/XPackage, identity and strict preflight. - Identity output: `console=58325731.00000000.00000000.00000000.01 device=pc title=0x58325731 stable=ok short=ERROR_INSUFFICIENT_BUFFER null=E_POINTER user-async=E_NOTIMPL calls=11 PASS`. - `python -B tests/xgameruntime_table_check.py` - `exports=28 ... states=implemented_hr=17,implemented_value=1,implemented_void=5,stub=5 duplicate_control=detected PASS`. - `docs_links_check.py`: `Self-test passed.`, `Checked 15 Markdown files and 256 links.`. - `git diff --check origin/main...HEAD`: clean. - Not run: full CTest, release preset, a real Xbox console. ## Evidence and follow-up - Branch `runtime/xsystem-xgame`, head `4a1bccf`, based on `f05369ec` (contains XCL-06). - Public sources: [XSystemGetConsoleId](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xsystem/functions/xsystemgetconsoleid?view=gdk-2604), [XSystemGetDeviceType](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xsystem/functions/xsystemgetdevicetype?view=gdk-2604), [XSystemDeviceType](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xsystem/enums/xsystemdevicetype?view=gdk-2604), [XGameGetXboxTitleId](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xgame/functions/xgamegetxboxtitleid?view=gdk-2604). - `XSystemConsoleIdBytes = 39` is the documented 38-character identity plus terminator; corroborated by public Microsoft interoperability constants. - Negative controls: 38-byte buffer returns `ERROR_INSUFFICIENT_BUFFER` with used zero, null console buffer `E_POINTER`, null TitleID output `E_POINTER`, and XUser/XPackage async calls remain `E_NOTIMPL`. - Limits: the shim always reports PC and a fixed TitleID; it does not model a console process or an absent-title `ERROR_NOT_FOUND`. - Provenance: public Microsoft GDK docs above; no XCL code, table or output. No game files, dumps, shader bytes, title paths or secrets. ## Checklist - [x] One XSystem/XGame synthetic-identity behavior. - [x] Positive identity/stability and short-buffer/null negative controls. - [x] Table state and documentation updated. - [x] No game files, dumps, logs or secrets. - [x] Provenance checked; no XCL code used. - [x] AI-assisted (Codex).
upstream-sync closed this pull request 2026-11-24 06:46:42 +00:00
tedin7 commented 2026-11-24 06:46:42 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:40:19Z.

Review: COMMENTED


Reviewed at commit 4a1bccf2f89d64ec2cfcb8687d7e294f26108481.

  • Code notes: src/xgameruntime_shim.cpp cleanly extends the thunk table with implemented_value for XSystemGetDeviceType and implements XSystemGetConsoleId (39-byte XSystemConsoleIdBytes check, ERROR_INSUFFICIENT_BUFFER, E_POINTER) and XGameGetXboxTitleId (0x58325731, E_POINTER), while tests/xgameruntime_identity_check.cpp covers stability, error paths, and the XUserAddAsync stub control. Existing stub-expectation tests and tests/xgameruntime_table_check.py are updated to match.
  • Linux checks passed:
    • python3 tests/docs_links_check.py (256 links across 15 Markdown files)
    • python3 tests/bidi_controls_check.py (957 files)
    • python3 tests/gpu_report_format_check.py (10 tests)
    • python3 tests/xgameruntime_table_check.py (28 exports, 6 implemented classes, 5 stubs, duplicate_control=detected PASS)
  • Not run on Linux: Windows MSVC build and xgameruntime_* CTest runs (4 Windows CI checks currently pending).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6032871487 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1175#pullrequestreview-6032871487). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T02:40:19Z. **Review:** COMMENTED --- Reviewed at commit `4a1bccf2f89d64ec2cfcb8687d7e294f26108481`. - **Code notes**: `src/xgameruntime_shim.cpp` cleanly extends the thunk table with `implemented_value` for `XSystemGetDeviceType` and implements `XSystemGetConsoleId` (39-byte `XSystemConsoleIdBytes` check, `ERROR_INSUFFICIENT_BUFFER`, `E_POINTER`) and `XGameGetXboxTitleId` (`0x58325731`, `E_POINTER`), while `tests/xgameruntime_identity_check.cpp` covers stability, error paths, and the `XUserAddAsync` stub control. Existing stub-expectation tests and `tests/xgameruntime_table_check.py` are updated to match. - **Linux checks passed**: - `python3 tests/docs_links_check.py` (256 links across 15 Markdown files) - `python3 tests/bidi_controls_check.py` (957 files) - `python3 tests/gpu_report_format_check.py` (10 tests) - `python3 tests/xgameruntime_table_check.py` (28 exports, 6 implemented classes, 5 stubs, `duplicate_control=detected PASS`) - **Not run on Linux**: Windows MSVC build and `xgameruntime_*` CTest runs (4 Windows CI checks currently pending).
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
R0Y00/Xbox2Windows!1168
No description provided.