mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 12:38:38 +00:00
Measured 2026-11-29 by HTTP against the public docs.xbox.com index and Microsoft Learn; page contents not read, nothing copied from the GDK. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
102 lines
8.4 KiB
Markdown
102 lines
8.4 KiB
Markdown
# Using the public GDK to write shims
|
|
|
|
How to use Microsoft's **public** GDK documentation and headers to implement the console APIs the game imports,
|
|
without copying Microsoft's files and without touching anything under NDA. A convention for contributors; only the
|
|
table of public pages is a measurement.
|
|
|
|
## The rule in one line
|
|
|
|
Read the public PC GDK reference and headers, then write in your own words only what a shim needs: names, values,
|
|
signatures and struct layouts. Never commit GDK files, and never use the console GDK, which is under NDA.
|
|
|
|
## What the public GDK gives the project
|
|
|
|
- Signatures, enums and structs of the system APIs the game imports: XGameRuntime, XTaskQueue, XUser, XStore,
|
|
XGameSave and GameInput.
|
|
- That is what these already implement, and they are the models to follow:
|
|
- `runtime/shims/xgameruntime.cpp`, `xgameruntime_user.cpp`, `xgameruntime_store.cpp`,
|
|
`xgameruntime_gamesave.cpp`, `xgameruntime_offline.cpp`
|
|
- `d3d12/crates/leonida-hle/src/modules/xgameruntime.rs`
|
|
- `runtime/shims/gameinput*` (see [gameinput.md](gameinput.md))
|
|
|
|
## What it does not give
|
|
|
|
- The console-only graphics surface: `D3D12XboxCreateDevice`, `PresentX`, XDXR and the rest of `d3d12_xs` beyond
|
|
what the public pages list. [d3d12_xs_surface.md](d3d12_xs_surface.md) and [xbox_d3d12_xs.md](xbox_d3d12_xs.md)
|
|
say which pages exist and which are missing or NDA-gated.
|
|
- Those layouts are recovered from the game's own call sites and from public code compiled against the headers
|
|
(Mesa, ebiten, the Microsoft samples), as [d3d12_vulkan.md](d3d12_vulkan.md) does. They are not guessed, and
|
|
they are not taken from leaked or NDA material.
|
|
|
|
## The method, in 4 steps
|
|
|
|
1. **Get the public references.** The system API reference at
|
|
[docs.xbox.com](https://docs.xbox.com/reference/system/xgamestreaming/functions/xgamestreamingsetresolution)
|
|
(pages under `reference/system/<family>/functions/<name>`), the graphics reference at
|
|
[devdocs.xbox.com](https://devdocs.xbox.com/reference/graphics/d3d12), and the public PC GDK headers from
|
|
Microsoft's own download. GameInput is also published as the `Microsoft.GameInput` NuGet package.
|
|
2. **List what the game imports**, locally, on your own copy (`dumpbin /imports`). The measured tables are already
|
|
in [runtime_imports.md](runtime_imports.md), and `tests/test_gdk_runtime_calls.py` checks them. Nothing from the
|
|
game goes into the repository.
|
|
3. **For each missing function**, read its public page and header, then write the declaration and the shim yourself,
|
|
with a test: `runtime/test/xgameruntime_*_test.cpp` for the C++ runtime, with
|
|
`runtime/test/fixtures/tiny_gdk_load.cpp` as the model for loading a GDK-style module.
|
|
4. **Document it** in [runtime_imports.md](runtime_imports.md), linking the public page you used. Then the usual
|
|
path: claim it in the coordination issue, open a pull request with a test that fails on `main` and passes with
|
|
it ([CONTRIBUTING.md](../CONTRIBUTING.md)).
|
|
|
|
## Public pages by family
|
|
|
|
MEASURED on 2026-11-29 from a Mac, by HTTP only; the page contents were not read. Each GDK name in
|
|
[runtime_imports.md](runtime_imports.md) (the names in backticks, not the whole import table) was looked up in two
|
|
places: the public index at `https://docs.xbox.com/_llms/en/apis/gdk-apis/system-api-reference.txt` (and its XStore
|
|
part), then directly at `https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/<area>/<family>/<kind>/<name>`
|
|
(kinds `functions`, `structs`, `enums`, `handles`). A name counts as found when the page answers 200 with that name in
|
|
its title. The index is incomplete: it leaves out most of XMem and all of XNetworking, whose pages do exist on
|
|
Microsoft Learn.
|
|
|
|
| Family | Contents page | Found | Not found |
|
|
|---|---|---|---|
|
|
| XAccessibility | [xaccessibility](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xaccessibility/xaccessibility_members) | 2 | |
|
|
| XAppCapture | [xappcapture](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xappcapture/xappcapture_members) | 1 | |
|
|
| XAsync | [xasync](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xasync/xasync_members) | 2 | |
|
|
| XAsyncProvider | [xasyncprovider](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xasyncprovider/xasyncprovider_members) | 3 | `XAsyncBeginAlloc` |
|
|
| XDisplay | [xdisplay](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xdisplay/xdisplay_members) | 3 | |
|
|
| XError | [xerror](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xerror/xerror_members) | 1 | `XErrorReport` |
|
|
| XGame | [xgame](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xgame/xgame_members) | 3 | |
|
|
| XGameEvent | [xgameevent](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xgameevent/xgameevent_members) | 1 | |
|
|
| XGameRuntimeFeature | [xgameruntimefeature](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xgameruntimefeature/xgameruntimefeature_members) | 1 | |
|
|
| XGameRuntimeInit | [xgameruntimeinit](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xgameruntimeinit/xgameruntimeinit_members) | 1 | |
|
|
| XGameSave | [xgamesave](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xgamesave/xgamesave_members) | 5 | |
|
|
| XGameSaveFiles | [xgamesavefiles](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xgamesavefiles/xgamesavefiles_members) | family page only | |
|
|
| XGameStreaming | [xgamestreaming](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xgamestreaming/xgamestreaming_members) | 3 | |
|
|
| XGameUI | [xgameui](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xgameui/xgameui_members) | 1 | |
|
|
| XLauncher | [xlauncher](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xlauncher/xlauncher_members) | 1 | |
|
|
| XMem | [xmem](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xmem/xmem_members) | 13 | |
|
|
| XNetworking | [xnetworking](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/networking/xnetworking/xnetworking_members) | 2 | |
|
|
| XPackage | [xpackage](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xpackage/xpackage_members) | 2 | |
|
|
| XPersistentLocalStorage | [xpersistentlocalstorage](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xpersistentlocalstorage/xpersistentlocalstorage_members) | 2 | |
|
|
| XSpeechSynthesizer | [xspeechsynthesizer](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xspeechsynthesizer/xspeechsynthesizer_members) | 2 | |
|
|
| XStore | [xstore](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xstore/xstore_members) | 4 | `XStoreIsAvailabilityPurchasable` |
|
|
| XSystem | [xsystem](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xsystem/xsystem_members) | 7 | |
|
|
| XTaskQueue | [xtaskqueue](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xtaskqueue/xtaskqueue_members) | 4 | `XTaskQueueIsEmpty` |
|
|
| XThread | [xthread](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xthread/xthread_members) | 2 | |
|
|
| XUser | [xuser](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xuser/xuser_members) | 11 | `XUserHandle` |
|
|
| XApu (console audio) | none found | 0 | `XApuConnect`, `XApuDequeueResult`, `XApuDisconnect`, `XApuEnqueueCommand`, `XApuGetResultCount` |
|
|
| XDsp (console audio) | none found | 0 | `XDspActivate`, `XDspConnectWithMaximumStreamLimit`, `XDspDeactivate`, `XDspDisconnect`, `XDspSubmitCommand` |
|
|
| XG (console graphics) | none found | 0 | `XGCreateTextureComputer`, `XGSuggestSwizzleMode` |
|
|
|
|
"Not found" means no page at the index or at the usual paths on that date; the five names in the upper rows may
|
|
still be documented under another path or name. For the last three rows no public page was found at all: treat
|
|
them like `d3d12_xs` above and recover what a shim needs from the game's call sites.
|
|
|
|
## Lines not to cross
|
|
|
|
- **Do not copy GDK headers, samples or documentation text into the repository.** They are under Microsoft's
|
|
licence. Take the facts (names, values, layouts), not the text.
|
|
- **Nothing from the console GDK or from a leak**, not even to check a value. If a layout is only in NDA material,
|
|
write down that it is open and recover it from call sites instead.
|
|
- **The repository's hard rules still apply** ([AGENTS.md](../AGENTS.md)): no keys, no decryption, no protection
|
|
workarounds, and nothing online. The shims answer offline (`runtime/shims/xgameruntime_offline.cpp`); no Xbox Live
|
|
or Rockstar services.
|