runtime: add XGameRuntime thunk skeleton #1044

Merged
lambirou merged 3 commits from upstream-pr/1051 into main 2026-11-23 23:59:43 +00:00
lambirou commented 2026-11-23 23:22:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-23T23:22:35Z.


Change

Add the first XGameRuntime shim skeleton and its load test.

  • src/xgameruntime_shim.cpp uses one X-macro table to define seven public thunks and their
    metadata. The table covers XUser, XGameSave, XPackage, XSystem, XGame, XAsync and XTaskQueue.
  • Every thunk records its component, function, result and sequence in a bounded deterministic
    log, then returns E_NOTIMPL (0x80004001). A missing export remains distinguishable from a
    present skeleton thunk.
  • xgameruntime.dll is built in out/build/<preset>/fixture-shims, never beside the normal
    xmem.dll or d3d12_xs.dll. The C++ test loads it by explicit path and checks both
    directories.
  • src/xgameruntime_shim.def fixes the DLL name and declares no ordinals; exports are generated
    from the table with __declspec(dllexport).
  • tests/xgameruntime_thunks_check.cpp loads the built DLL, resolves each name, calls each
    thunk, checks the log and duplicate names, and verifies an unknown export returns null.
  • tests/xgameruntime_table_check.py statically checks the table and .def for the required
    classes, duplicates and source/export consistency. It is registered in the Linux Python job and
    the AGENTS list.
  • tests/xgameruntime_preflight_check.py packages a real source-built EXE that imports
    xgameruntime.dll!XUserAddAsync with the normal shims but without the fixture DLL. Strict
    plan(report, allow_external=False) refuses the import as external_unverified before any
    image is mapped.

This is a skeleton, not an ABI-complete implementation. No Xbox ordinal is guessed.

Verification

  • cmake --build --preset dev --target xgameruntime_shim xgameruntime_shim_check
    • Passed with MSVC 19.44.
  • ctest --preset dev --no-tests=error -R '^xgameruntime_thunks$' -V
    • Desktop fixture xgameruntime.dll: exports=7 calls=7 unknown_export=null log=7 PASS.
  • ctest --preset dev --no-tests=error -R '^xgameruntime_preflight_stub_refused$' -V
    • xgameruntime preflight: package=real-source-exe import=xgameruntime.dll!XUserAddAsync status=external_unverified strict_plan=refused mapped=0 PASS.
  • python -B tests/xgameruntime_table_check.py
    • exports=7 classes=XAsync,XGame,XGameSave,XPackage,XSystem,XTaskQueue,XUser duplicate_control=detected PASS.
  • python -B tests/pe_package_preflight_check.py -v -k test_strict_plan_refuses_external_provider
    • 1 test, OK.
  • dumpbin /exports shows the seven public names and the two shim-only log functions.
  • The same two controls pass under the release preset. dumpbin /imports on the fixture EXE
    shows only xgameruntime.dll!XUserAddAsync. The fixture DLL is absent from both normal shim
    directories and present only under fixture-shims.
  • Not run: the full CTest suite and Windows CI for this branch.

Evidence and follow-up

  • Branch runtime/xgameruntime-thunks, head d295488, based on c74d708. Three commits:
    239d363 adds the skeleton; af71215 moves the DLL to fixture-shims, checks the normal
    directory, and adds the real EXE preflight control and the strict allow_external=False plan;
    d295488 registers the generated fixture import library with target_sources so the
    VS 2026/Ninja build has a rule for it.
  • Signatures come from the public Microsoft GDK reference:
    XUserAddAsync,
    XGameSaveInitializeProviderAsync,
    XPackageMountWithUiAsync,
    XSystemGetConsoleId,
    XGameGetXboxTitleId,
    XAsyncGetStatus,
    XTaskQueueCreate.
  • Provenance: Reference ivall/xcl@38b05b7b6954cfa5bd21cec72f68823603ca2227, public GDK
    documentation only, observed 2026-11-23 for the class list. No XCL table, ordinal, identifier
    or code was copied.
  • Follow-up: implement XUser and XGameSave in XCL-05; PLS and XPackage in XCL-06; XSystem and
    XGame in XCL-07. Each class needs an owned fixture and a negative control before it is called
    implemented.
  • The diff is larger than the 400-line guide because the skeleton table, C++ load test and real
    EXE preflight control are one behavior: proving the fixture DLL is not a provider. Actual
    provider work lands one observable API contract at a time.
  • No game files, dumps, shader bytes, title paths or secrets are included.

Checklist

  • One reviewable behavior: data-driven XGameRuntime thunk skeleton.
  • Positive load/call test and unknown-export/duplicate negative controls.
  • CMake target, CTest and Linux Python check registered.
  • No game files, dumps, logs or secrets.
  • Public GDK provenance recorded; no Xbox ordinal guessed.
  • AI-assisted (Codex).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6570918218 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1051). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-23T23:22:35Z. --- ## Change Add the first XGameRuntime shim skeleton and its load test. - `src/xgameruntime_shim.cpp` uses one X-macro table to define seven public thunks and their metadata. The table covers XUser, XGameSave, XPackage, XSystem, XGame, XAsync and XTaskQueue. - Every thunk records its component, function, result and sequence in a bounded deterministic log, then returns `E_NOTIMPL` (`0x80004001`). A missing export remains distinguishable from a present skeleton thunk. - `xgameruntime.dll` is built in `out/build/<preset>/fixture-shims`, never beside the normal `xmem.dll` or `d3d12_xs.dll`. The C++ test loads it by explicit path and checks both directories. - `src/xgameruntime_shim.def` fixes the DLL name and declares no ordinals; exports are generated from the table with `__declspec(dllexport)`. - `tests/xgameruntime_thunks_check.cpp` loads the built DLL, resolves each name, calls each thunk, checks the log and duplicate names, and verifies an unknown export returns null. - `tests/xgameruntime_table_check.py` statically checks the table and `.def` for the required classes, duplicates and source/export consistency. It is registered in the Linux Python job and the AGENTS list. - `tests/xgameruntime_preflight_check.py` packages a real source-built EXE that imports `xgameruntime.dll!XUserAddAsync` with the normal shims but without the fixture DLL. Strict `plan(report, allow_external=False)` refuses the import as `external_unverified` before any image is mapped. This is a skeleton, not an ABI-complete implementation. No Xbox ordinal is guessed. ## Verification - `cmake --build --preset dev --target xgameruntime_shim xgameruntime_shim_check` - Passed with MSVC 19.44. - `ctest --preset dev --no-tests=error -R '^xgameruntime_thunks$' -V` - `Desktop fixture xgameruntime.dll: exports=7 calls=7 unknown_export=null log=7 PASS`. - `ctest --preset dev --no-tests=error -R '^xgameruntime_preflight_stub_refused$' -V` - `xgameruntime preflight: package=real-source-exe import=xgameruntime.dll!XUserAddAsync status=external_unverified strict_plan=refused mapped=0 PASS`. - `python -B tests/xgameruntime_table_check.py` - `exports=7 classes=XAsync,XGame,XGameSave,XPackage,XSystem,XTaskQueue,XUser duplicate_control=detected PASS`. - `python -B tests/pe_package_preflight_check.py -v -k test_strict_plan_refuses_external_provider` - 1 test, OK. - `dumpbin /exports` shows the seven public names and the two shim-only log functions. - The same two controls pass under the `release` preset. `dumpbin /imports` on the fixture EXE shows only `xgameruntime.dll!XUserAddAsync`. The fixture DLL is absent from both normal shim directories and present only under `fixture-shims`. - Not run: the full CTest suite and Windows CI for this branch. ## Evidence and follow-up - Branch `runtime/xgameruntime-thunks`, head `d295488`, based on `c74d708`. Three commits: `239d363` adds the skeleton; `af71215` moves the DLL to `fixture-shims`, checks the normal directory, and adds the real EXE preflight control and the strict `allow_external=False` plan; `d295488` registers the generated fixture import library with `target_sources` so the VS 2026/Ninja build has a rule for it. - Signatures come from the public Microsoft GDK reference: [XUserAddAsync](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xuser/functions/xuseraddasync?view=gdk-2604), [XGameSaveInitializeProviderAsync](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xgamesave/functions/xgamesaveinitializeproviderasync?view=gdk-2610), [XPackageMountWithUiAsync](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xpackage/functions/xpackagemountwithuiasync?view=gdk-2610), [XSystemGetConsoleId](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xsystem/functions/xsystemgetconsoleid?view=gdk-2604), [XGameGetXboxTitleId](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xgame/functions/xgamegetxboxtitleid?view=gdk-2604), [XAsyncGetStatus](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xasync/functions/xasyncgetstatus?view=gdk-2604), [XTaskQueueCreate](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xtaskqueue/functions/xtaskqueuecreate?view=gdk-2604). - Provenance: Reference `ivall/xcl@38b05b7b6954cfa5bd21cec72f68823603ca2227`, public GDK documentation only, observed 2026-11-23 for the class list. No XCL table, ordinal, identifier or code was copied. - Follow-up: implement XUser and XGameSave in XCL-05; PLS and XPackage in XCL-06; XSystem and XGame in XCL-07. Each class needs an owned fixture and a negative control before it is called implemented. - The diff is larger than the 400-line guide because the skeleton table, C++ load test and real EXE preflight control are one behavior: proving the fixture DLL is not a provider. Actual provider work lands one observable API contract at a time. - No game files, dumps, shader bytes, title paths or secrets are included. ## Checklist - [x] One reviewable behavior: data-driven XGameRuntime thunk skeleton. - [x] Positive load/call test and unknown-export/duplicate negative controls. - [x] CMake target, CTest and Linux Python check registered. - [x] No game files, dumps, logs or secrets. - [x] Public GDK provenance recorded; no Xbox ordinal guessed. - [x] AI-assisted (Codex).
upstream-sync closed this pull request 2026-11-24 06:46:01 +00:00
R0Y00 commented 2026-11-24 06:49:51 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T23:27:52Z.


The named exports and E_NOTIMPL log can help a controlled caller trace. Please keep this DLL in a fixture-only output directory and have the test load it by explicit path. A production-named DLL next to the normal shims can satisfy name resolution even though none of these APIs provides its documented behavior. Add a source-built control that strict package preflight still refuses the unimplemented import before entry. Retain the explicit E_NOTIMPL and unknown-export checks for the fixture. Actual provider work can then land one observable API contract at a time.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7116986032 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1051#issuecomment-7116986032). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T23:27:52Z. --- The named exports and E_NOTIMPL log can help a controlled caller trace. Please keep this DLL in a fixture-only output directory and have the test load it by explicit path. A production-named DLL next to the normal shims can satisfy name resolution even though none of these APIs provides its documented behavior. Add a source-built control that strict package preflight still refuses the unimplemented import before entry. Retain the explicit E_NOTIMPL and unknown-export checks for the fixture. Actual provider work can then land one observable API contract at a time.
lambirou commented 2026-11-24 06:49:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-23T23:39:19Z.


Addressed in af71215. xgameruntime.dll now builds in out/build//fixture-shims, and the load test checks it is not in the normal shim directory. A real source-built EXE importing xgameruntime.dll!XUserAddAsync is packaged with xmem.dll and d3d12_xs.dll but without the fixture DLL; strict plan(report, allow_external=False) refuses it as external_unverified before mapping. Added the strict-plan unit control and documented the fixture-only path. The E_NOTIMPL, log and unknown-export checks remain. Targeted CTest: xgameruntime_thunks and xgameruntime_preflight_stub_refused both pass.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7117208026 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1051#issuecomment-7117208026). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-23T23:39:19Z. --- Addressed in af71215. xgameruntime.dll now builds in out/build/<preset>/fixture-shims, and the load test checks it is not in the normal shim directory. A real source-built EXE importing xgameruntime.dll!XUserAddAsync is packaged with xmem.dll and d3d12_xs.dll but without the fixture DLL; strict plan(report, allow_external=False) refuses it as external_unverified before mapping. Added the strict-plan unit control and documented the fixture-only path. The E_NOTIMPL, log and unknown-export checks remain. Targeted CTest: xgameruntime_thunks and xgameruntime_preflight_stub_refused both pass.
R0Y00 commented 2026-11-24 06:49:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T23:42:56Z.


The fixture isolation and strict-plan refusal are in place. A clean Ninja build failed because the generated import library had no target dependency. I pushed d295488e to register that output. The two XGameRuntime checks and the existing package import-closure check pass in both Windows presets (3/3 each). The strict source-built package reports external_unverified and maps no images. The static thunk-table check also passed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7117280887 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1051#issuecomment-7117280887). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T23:42:56Z. --- The fixture isolation and strict-plan refusal are in place. A clean Ninja build failed because the generated import library had no target dependency. I pushed d295488e to register that output. The two XGameRuntime checks and the existing package import-closure check pass in both Windows presets (3/3 each). The strict source-built package reports external_unverified and maps no images. The static thunk-table check also passed.
lambirou commented 2026-11-24 06:49:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-11-23T23:43:29Z.


Adopted d295488, which registers the generated fixture import library with target_sources. Both Windows presets pass the two XGameRuntime checks and the package import-closure check. My local a486d53 variant was dropped; the PR body now points to d295488.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7117293092 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1051#issuecomment-7117293092). Originally posted by [lambirou](https://github.com/lambirou) on 2026-11-23T23:43:29Z. --- Adopted d295488, which registers the generated fixture import library with target_sources. Both Windows presets pass the two XGameRuntime checks and the package import-closure check. My local a486d53 variant was dropped; the PR body now points to d295488.
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!1044
No description provided.