feat(xgameruntime): export the GDK API-impl entry points and name what a title asks for #70

Manually merged
github merged 1 commit from gh-pr/70/head into gh-pr/70/base 2026-11-26 19:17:28 +00:00
Owner

@⁠Dark3581 on GitHub · 2026-11-23 04:43 UTC · original
Dark3581:feat/api-impl-entry-points → main · +99 −4 · 8 files · 1 commits · merged 2026-11-23 04:47 UTC

What

The second half after #69. GDK modules don't call the game runtime's named functions; they call QueryApiImpl and the InitializeApiImpl* entry points, then the method tables QueryApiImpl returns. ab_xgameruntime had none of these, so a title's first runtime call had nowhere to go. It now exports all six, with the argument shapes measured at call sites in two bundled GDK modules (details in #69):

  • QueryApiImpl(const GUID*, const GUID*, void**) clears the output and stops, naming both GUIDs. Which one is the provider and which the interface is assumed. The method table layouts aren't mapped yet, so the first run names the interface it needs.
  • InitializeApiImpl(u32, u32), InitializeApiImplEx(u64, u64, flags) and InitializeApiImplEx2(u64, u64, flags, pointer) stop with their arguments, because what the handshake checks or records is unknown. UninitializeApiImpl is a stub.
  • XErrorReport(HRESULT, const char*) logs the code and message. The modules call it to report their own errors, for example when QueryApiImpl returns class-not-registered.

The README's xgameruntime row now says that GDK titles use these tables and that they aren't mapped. The debt entry records the assumptions and how they close: from a public GDK thunk library or measured call sites.

Tested

Windows 10, MinGW (GCC) and MSVC 2022.

  • New e2e_api_impl: the relinked fake title loads xgameruntime.dll at run time with System32-only search, as the GDK thunks do (redirected to AnyBox by #69). It finds all six entry points, calls XErrorReport (logged), then calls QueryApiImpl with two test GUIDs. The run stops as unsupported in QueryApiImpl; the message names both GUIDs and caller is title.exe.
  • With a bundled module from a title package: a scratch harness loads ab_runtime, then the package's own HTTP client module, and calls its public HCInitialize(nullptr). The log shows:
    [anybox] loader: LoadLibraryExW(xgameruntime.dll) from libHttpClient.GDK.dll+0x5d8d8 loads ab_xgameruntime.dll
    [anybox] unsupported: xgameruntime!InitializeApiImplEx2: the GDK runtime handshake (0x633600002712, 0x65f400001832, flags 0x3, 0x0) is not implemented: ...
    [anybox] called from libHttpClient.GDK.dll+0x5d5de
    
    The module's runtime load reaches AnyBox, not the desktop runtime in System32, and its handshake arrives with the measured values. The harness and module are not in the repository.
  • MinGW ctest: 75 of 75. With MSVC, e2e_api_impl, e2e_dynamic_load and e2e_stub pass, and every target builds except ab_gameinput, which needs gameinput.lib, which this machine doesn't have. python tools/check_conventions.py and debt_fold.py --check: ok.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • python tools/check_conventions.py passes (no comments in code, one declaration per export, Conventional Commit subjects)
  • Unimplemented paths stop (AbxNotImplemented / AbxUnsupported); silent stubs are listed under Silent stubs through a debt fragment
  • Known gaps added, changed or removed through docs/dev/debt/changes/<branch>.md
  • Generic behaviour, not specific to one title
  • No game files, keys, notes or logs added to the repository
  • Depends on: #69 (merged)
  • Fixes: none
  • Unblocks: none
  • Source of behaviour: measured call sites in two bundled GDK modules (#69); the export list of the desktop runtime (DllCanUnloadNow plus these six)
  • AI-assisted: yes
**@⁠Dark3581** on GitHub · 2026-11-23 04:43 UTC · [original](https://github.com/Dark3581/AnyBox/pull/70) `Dark3581:feat/api-impl-entry-points` → `main` · +99 −4 · 8 files · 1 commits · merged 2026-11-23 04:47 UTC ### What The second half after #69. GDK modules don't call the game runtime's named functions; they call `QueryApiImpl` and the `InitializeApiImpl*` entry points, then the method tables `QueryApiImpl` returns. `ab_xgameruntime` had none of these, so a title's first runtime call had nowhere to go. It now exports all six, with the argument shapes measured at call sites in two bundled GDK modules (details in #69): - `QueryApiImpl(const GUID*, const GUID*, void**)` clears the output and stops, naming both GUIDs. Which one is the provider and which the interface is assumed. The method table layouts aren't mapped yet, so the first run names the interface it needs. - `InitializeApiImpl(u32, u32)`, `InitializeApiImplEx(u64, u64, flags)` and `InitializeApiImplEx2(u64, u64, flags, pointer)` stop with their arguments, because what the handshake checks or records is unknown. `UninitializeApiImpl` is a stub. - `XErrorReport(HRESULT, const char*)` logs the code and message. The modules call it to report their own errors, for example when `QueryApiImpl` returns class-not-registered. The README's `xgameruntime` row now says that GDK titles use these tables and that they aren't mapped. The debt entry records the assumptions and how they close: from a public GDK thunk library or measured call sites. ### Tested Windows 10, MinGW (GCC) and MSVC 2022. - New `e2e_api_impl`: the relinked fake title loads `xgameruntime.dll` at run time with System32-only search, as the GDK thunks do (redirected to AnyBox by #69). It finds all six entry points, calls `XErrorReport` (logged), then calls `QueryApiImpl` with two test GUIDs. The run stops as unsupported in `QueryApiImpl`; the message names both GUIDs and `caller` is `title.exe`. - **With a bundled module from a title package**: a scratch harness loads `ab_runtime`, then the package's own HTTP client module, and calls its public `HCInitialize(nullptr)`. The log shows: ``` [anybox] loader: LoadLibraryExW(xgameruntime.dll) from libHttpClient.GDK.dll+0x5d8d8 loads ab_xgameruntime.dll [anybox] unsupported: xgameruntime!InitializeApiImplEx2: the GDK runtime handshake (0x633600002712, 0x65f400001832, flags 0x3, 0x0) is not implemented: ... [anybox] called from libHttpClient.GDK.dll+0x5d5de ``` The module's runtime load reaches AnyBox, not the desktop runtime in System32, and its handshake arrives with the measured values. The harness and module are not in the repository. - MinGW `ctest`: 75 of 75. With MSVC, `e2e_api_impl`, `e2e_dynamic_load` and `e2e_stub` pass, and every target builds except `ab_gameinput`, which needs `gameinput.lib`, which this machine doesn't have. `python tools/check_conventions.py` and `debt_fold.py --check`: ok. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] `python tools/check_conventions.py` passes (no comments in code, one declaration per export, Conventional Commit subjects) - [x] Unimplemented paths stop (`AbxNotImplemented` / `AbxUnsupported`); silent stubs are listed under Silent stubs through a debt fragment - [x] Known gaps added, changed or removed through `docs/dev/debt/changes/<branch>.md` - [x] Generic behaviour, not specific to one title - [x] No game files, keys, notes or logs added to the repository - [x] Depends on: #69 (merged) - [x] Fixes: none - [x] Unblocks: none - [x] Source of behaviour: measured call sites in two bundled GDK modules (#69); the export list of the desktop runtime (`DllCanUnloadNow` plus these six) - [x] AI-assisted: yes
GDK modules call QueryApiImpl and the InitializeApiImpl entry points instead of named runtime functions. ab_xgameruntime now exports all six with the argument shapes measured at bundled call sites; the handshake and QueryApiImpl stop with their arguments and GUIDs until the method tables are mapped, and XErrorReport logs.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:17:25 +00:00
github manually merged commit c63dcceee3 into gh-pr/70/base 2026-11-26 19:17:28 +00:00
Author
Owner

@⁠github-actions[bot] on GitHub · 2026-11-23 04:43 UTC · original

Progress report (1bdd25b → c63dcce)

📈 Libraries: 27.75% (+0.7444%, +5 implemented, +6 declared functions)

✅ 5 implemented
Library Name
xgameruntime InitializeApiImpl
xgameruntime InitializeApiImplEx
xgameruntime InitializeApiImplEx2
xgameruntime QueryApiImpl
xgameruntime XErrorReport
🆕 1 declared as stubs
Library Name
xgameruntime UninitializeApiImpl

Changed libraries

Library Before After Change
xgameruntime 67/391 (17.14%) 72/397 (18.14%) +1.00%
**@⁠github-actions[bot]** on GitHub · 2026-11-23 04:43 UTC · [original](https://github.com/Dark3581/AnyBox/pull/70#issuecomment-7091820804) <!-- progress-report --> ### Progress report (1bdd25b → c63dcce) 📈 **Libraries**: 27.75% (+0.7444%, +5 implemented, +6 declared functions) <details> <summary>✅ 5 implemented</summary> | Library | Name | | - | - | | xgameruntime | `InitializeApiImpl` | | xgameruntime | `InitializeApiImplEx` | | xgameruntime | `InitializeApiImplEx2` | | xgameruntime | `QueryApiImpl` | | xgameruntime | `XErrorReport` | </details> <details> <summary>🆕 1 declared as stubs</summary> | Library | Name | | - | - | | xgameruntime | `UninitializeApiImpl` | </details> #### Changed libraries | Library | Before | After | Change | | - | - | - | - | | xgameruntime | 67/391 (17.14%) | 72/397 (18.14%) | +1.00% |
This discussion has been locked. Commenting is limited to contributors.
No description provided.