Skip to content

feat(xgameruntime): implement the remaining XSystem functions - #79

Open
CaseReed wants to merge 1 commit into
Dark3581:mainfrom
CaseReed:feat/xsystem-rest
Open

CaseReed wants to merge 1 commit into
Dark3581:mainfrom
CaseReed:feat/xsystem-rest

Conversation

@CaseReed

Copy link
Copy Markdown
Contributor

What

Implements the six XSystem stubs of #22, the whole issue. Three of them are only partly served and stop for the rest; every choice is listed in the debt fragment.

Function Behaviour
XSystemGetAppSpecificDeviceId 44 uppercase hex digits and a terminator (45 bytes): the first 22 bytes of a SHA-256 over a fixed AnyBox prefix, the host MachineGuid and the <TitleId>. Stable for one title on one Windows installation, different between titles, and the machine GUID does not show through. A buffer under 45 returns HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), like XSystemGetConsoleId.
XSystemGetAnalyticsInfo Pc titles: osVersion and hostingOsVersion are the host Windows version, family is Windows, form is empty. XboxOne and Scarlett titles stop.
XSystemGetRuntimeInfo Pc titles: both versions are zero, the documented value when the gaming runtime service is not installed. XboxOne and Scarlett titles stop.
XSystemAllowFullDownloadBandwidth Does nothing; declared void as on the documentation page.
XSystemHandleTrack A null callback returns S_OK; a non-null callback stops.
XSystemIsHandleValid A null handle returns false; any other handle stops.

Three points I would like your ruling on:

  • Console titles stop in XSystemGetAnalyticsInfo and XSystemGetRuntimeInfo. The documentation does not give the title OS version, form string or runtime version a console reports, so I did not invent them. These are start-up calls, so a console title that makes them stops there, by name. If you have measured values, they slot into the two AbxUnsupported branches.
  • form is empty for Pc titles. It is the one returned value without a source (the documentation gives no desktop example). It is in the fragment; say so if you would rather have the function stop.
  • Handle functions. Answering for a non-null handle needs one registry of live handles fed by TaskQueue.cpp, GameSave.cpp and the other handle owners, which is larger than this issue. Recognising a task queue by reading its signature would mean reading a possibly freed pointer, so it stops instead. I can do the registry as a follow-up if you want it.

Other notes: xgameruntime now links bcrypt (already used by d3d12_x). The device-type lookup moved into a helper so that a stop is reported under the calling export's name. The all-zero ID the documentation gives for an error is never returned, because the documentation does not say which result comes with it: an unreadable machine GUID stops.

Tested

Windows 11, MSVC 19.38 (Visual Studio 2022), Ninja, Release, clean build directory:

  • Full build, CTest 85/85 passed, pipeline_probe skipped (no Khronos validation layer here).
  • Six new e2e scenarios:
    • app_device_id: short-buffer error, size 45, hex format, not all zeros, a null appSpecificDeviceIdUsed, the machine GUID absent from the ID, then a second run with another title ID (different ID) and a third with the first title ID (same ID).
    • system_pc: family, form, both OS versions against the host version read from the registry by e2e.py, zero runtime versions, the bandwidth call, null-handle cases.
    • analytics_console, runtime_info_console, handle_track, handle_valid: the stop names the right function and message.
  • Mutation: with the title ID removed from the hash input, e2e_app_device_id fails; restored, it passes.
  • python tools/check_conventions.py, python tools/debt_fold.py --check (24 fragments), python tools/readme_docs.py: pass. progress.py --module xgameruntime: 78 implemented.
  • MinGW: full Build workflow on my fork before opening this PR, windows and both relinker jobs green: https://github.com/CaseReed/AnyBox/actions/runs/45144497043

Not tested: anything on a console (the ID format, the size reported in appSpecificDeviceIdUsed, what consoles report for analytics and runtime info). No test triggers the two stops for an unreadable or unhashable machine GUID, nor a missing <TitleId> in the device-ID function.

Self-review: an independent pass over the diff (signatures and layouts against the documentation pages, struct-return ABI on MSVC and MinGW, debt lines against the code, whether each test can fail) found nothing blocking. Fixed from it before opening: the all-zero ID was returned with an undocumented S_OK; the bandwidth debt line did not say the page lists Xbox Series consoles only; the test read the Windows version through sys.getwindowsversion(), which depends on the Python executable's manifest.

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: none
  • Fixes: Fixes feat(xgameruntime): implement the remaining XSystem functions #22
  • Unblocks: none
  • Source of behaviour: the public XSystem reference pages (https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/xsystem/xsystem_members) and the XVersion page; the 45-byte size and the enum widths from the MIT-licensed microsoft/XBOX-GDK-dotnet bindings. No header copied, nothing disassembled.
  • AI-assisted: yes

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added libs core/libs: libraries, runtime and their tests fixes issue Closes an issue (Fixes #N) labels Nov 23, 2026
@github-actions

Copy link
Copy Markdown

Progress report (9f53c52 → c61baee)

📈 Libraries: 29.07% (+1.3216%, +6 implemented functions)

✅ 6 implemented
Library Name
xgameruntime XSystemAllowFullDownloadBandwidth
xgameruntime XSystemGetAnalyticsInfo
xgameruntime XSystemGetAppSpecificDeviceId
xgameruntime XSystemGetRuntimeInfo
xgameruntime XSystemHandleTrack
xgameruntime XSystemIsHandleValid

Changed libraries

Library Before After Change
xgameruntime 72/397 (18.14%) 78/397 (19.65%) +1.51%

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fixes issue Closes an issue (Fixes #N) libs core/libs: libraries, runtime and their tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(xgameruntime): implement the remaining XSystem functions

1 participant