xgameruntime: export missing GDK APIs from xgameruntime.dll #1211

Open
Ivankiosan wants to merge 1 commit from upstream-pr/1220 into main
Ivankiosan commented 2026-11-24 13:21:18 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Ivankiosan on 2026-11-24T13:21:18Z.


Exports missing GDK functions from xgameruntime.dll in crates/xcl/src/hle/xgameruntime/mod.rs that were previously internal to api.rs or unexported, ensuring titles and libraries querying these symbols directly via GetProcAddress or static import resolve them properly.

What is in it

  • Exports XSystemGetAppSpecificDeviceId with GDK buffer validation (minimum 45 bytes, returns E_NOT_SUFFICIENT_BUFFER when undersized, E_INVALIDARG on null buffer, and populates 44 uppercase alphanumeric characters + NUL terminator).
  • Exports XUserCheckPrivilege with user validation against local user handle and null check on the has output parameter.
  • Exports standard GDK package, title, and storage APIs: XGameGetXboxTitleId, XGameSaveFilesGetRemainingQuota, XPackageGetPackageKind, XPackageGetUserLocale, XPackageGetWriteStats, XPackageFindChunkAvailability, XPackageEstimateDownloadSize, XPackageCreateInstallationMonitor, XPackageGetInstallationProgress, XPackageRegisterInstallationProgressChanged, XPackageUnregisterInstallationProgressChanged, XLaunchNewGame, and XLaunchRestartOnCrash.
  • Removes duplicated internal implementations between api.rs and mod.rs.
  • Adds unit tests in crates/xcl/src/hle/xgameruntime/mod.rs verifying all runtime exports are present in exports(), buffer size validation for XSystemGetAppSpecificDeviceId, and user/pointer validation for XUserCheckPrivilege.

Tested

  • Hardware/OS: AMD Radeon RX 7600 (driver 32.0.12028.1005), Windows 11, rustc 1.99.1 (58cf8f9c3 2026-10-13) / MSVC 14.51.
  • cargo test -p xcl --lib hle::xgameruntime: all 76 unit tests passed.
  • cargo test --workspace -- --test-threads=4: 722 unit tests passed, all integration tests passed, 0 failures.
  • Built release binary target/release/xcl.exe (cargo build --release -p xcl).

Regression run

main:

xcl-smoke v1
commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3
gpu: AMD Radeon RX 7600
title: 419239bf
seconds: 10
exit: 0x0
frames shown: 26 (PresentX 26)
presents per 2 s (last 3): 0 0 23
device removals: 0
crashes: 0
peak commit: 8172 MB

PR head:

xcl-smoke v1
commit: 3e079cd994f39a6f90a7640d380e99c610ff1c79
gpu: AMD Radeon RX 7600
title: 419239bf
seconds: 10
exit: 0x0
frames shown: 41 (PresentX 41)
presents per 2 s (last 3): 0 36 61
device removals: 0
crashes: 0
peak commit: 8986 MB

Not tested

  • Dynamic installation progress events (installation monitor runs offline for pre-installed packages).
  • Linux / Wine / Proton environment (tests and smoke run executed natively on Windows 11).

AI use

  • Google Antigravity (Gemini): audited missing GDK exports in xgameruntime.dll against api.rs vtables and GDK specifications, implemented export symbols and validation logic, wrote unit tests, and verified full workspace tests and smoke regression run.
<!-- greyfinch-sync:ivall/xcl:issue:5472944610 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1220). Originally posted by [Ivankiosan](https://github.com/Ivankiosan) on 2026-11-24T13:21:18Z. --- Exports missing GDK functions from `xgameruntime.dll` in `crates/xcl/src/hle/xgameruntime/mod.rs` that were previously internal to `api.rs` or unexported, ensuring titles and libraries querying these symbols directly via `GetProcAddress` or static import resolve them properly. **What is in it** - Exports `XSystemGetAppSpecificDeviceId` with GDK buffer validation (minimum 45 bytes, returns `E_NOT_SUFFICIENT_BUFFER` when undersized, `E_INVALIDARG` on null buffer, and populates 44 uppercase alphanumeric characters + NUL terminator). - Exports `XUserCheckPrivilege` with user validation against local user handle and null check on the `has` output parameter. - Exports standard GDK package, title, and storage APIs: `XGameGetXboxTitleId`, `XGameSaveFilesGetRemainingQuota`, `XPackageGetPackageKind`, `XPackageGetUserLocale`, `XPackageGetWriteStats`, `XPackageFindChunkAvailability`, `XPackageEstimateDownloadSize`, `XPackageCreateInstallationMonitor`, `XPackageGetInstallationProgress`, `XPackageRegisterInstallationProgressChanged`, `XPackageUnregisterInstallationProgressChanged`, `XLaunchNewGame`, and `XLaunchRestartOnCrash`. - Removes duplicated internal implementations between `api.rs` and `mod.rs`. - Adds unit tests in `crates/xcl/src/hle/xgameruntime/mod.rs` verifying all runtime exports are present in `exports()`, buffer size validation for `XSystemGetAppSpecificDeviceId`, and user/pointer validation for `XUserCheckPrivilege`. **Tested** - Hardware/OS: AMD Radeon RX 7600 (driver 32.0.12028.1005), Windows 11, `rustc 1.99.1 (58cf8f9c3 2026-10-13)` / MSVC 14.51. - `cargo test -p xcl --lib hle::xgameruntime`: all 76 unit tests passed. - `cargo test --workspace -- --test-threads=4`: 722 unit tests passed, all integration tests passed, 0 failures. - Built release binary `target/release/xcl.exe` (`cargo build --release -p xcl`). **Regression run** main: ``` xcl-smoke v1 commit: 47efa2ecea0a12934719ae69b81930cf02a4b1c3 gpu: AMD Radeon RX 7600 title: 419239bf seconds: 10 exit: 0x0 frames shown: 26 (PresentX 26) presents per 2 s (last 3): 0 0 23 device removals: 0 crashes: 0 peak commit: 8172 MB ``` PR head: ``` xcl-smoke v1 commit: 3e079cd994f39a6f90a7640d380e99c610ff1c79 gpu: AMD Radeon RX 7600 title: 419239bf seconds: 10 exit: 0x0 frames shown: 41 (PresentX 41) presents per 2 s (last 3): 0 36 61 device removals: 0 crashes: 0 peak commit: 8986 MB ``` **Not tested** - Dynamic installation progress events (installation monitor runs offline for pre-installed packages). - Linux / Wine / Proton environment (tests and smoke run executed natively on Windows 11). **AI use** - Google Antigravity (Gemini): audited missing GDK exports in `xgameruntime.dll` against `api.rs` vtables and GDK specifications, implemented export symbols and validation logic, wrote unit tests, and verified full workspace tests and smoke regression run.
DavidM1911 commented 2026-11-24 14:06:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T13:47:20Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib xgameruntime: 76 passed, 0 failed.

Note: the full d3d12x lib filter currently aborts with 0xc0000005 on unmodified main too (pre-existing, unrelated to this PR); the PR's own tests were run by name and pass.

<!-- greyfinch-sync:ivall/xcl:comment:7133337894 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1220#issuecomment-7133337894). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T13:47:20Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - cargo test -p xcl --lib xgameruntime: 76 passed, 0 failed. Note: the full `d3d12x` lib filter currently aborts with 0xc0000005 on unmodified `main` too (pre-existing, unrelated to this PR); the PR's own tests were run by name and pass.
DavidM1911 commented 2026-11-26 04:07:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T04:05:31Z.


Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

<!-- greyfinch-sync:ivall/xcl:comment:7182286010 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1220#issuecomment-7182286010). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-26T04:05:31Z. --- Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
github-actions[bot] commented 2026-11-29 07:40:06 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:40:06Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7252615477 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1220#issuecomment-7252615477). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-29T07:40:06Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 05:09:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:09:46Z.


Triage (#1607) – head 3e079cd

No open or merged PR makes the same change: on main these functions are still private in hle/xgameruntime/api.rs and reachable only through the QueryApiImpl tables, not exported by name from exports().
Two behaviour changes beyond adding exports that the description should state: XSystemGetAppSpecificDeviceId (moved to mod.rs) now returns a 44-hex-char id instead of main's 16-char one, also through the QueryApiImpl slot path, so a title that stored the old id sees a different one; and XUserCheckPrivilege now returns E_INVALIDARG for any handle valid_user does not know (main ignored the handle).
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7301483706 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1220#issuecomment-7301483706). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:09:46Z. --- **Triage (#1607)** – head 3e079cd No open or merged PR makes the same change: on main these functions are still private in hle/xgameruntime/api.rs and reachable only through the QueryApiImpl tables, not exported by name from `exports()`. Two behaviour changes beyond adding exports that the description should state: `XSystemGetAppSpecificDeviceId` (moved to mod.rs) now returns a 44-hex-char id instead of main's 16-char one, also through the QueryApiImpl slot path, so a title that stored the old id sees a different one; and `XUserCheckPrivilege` now returns E_INVALIDARG for any handle `valid_user` does not know (main ignored the handle). Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1220:upstream-pr/1220'
git switch 'upstream-pr/1220'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1220'
git switch 'upstream-pr/1220'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1220'
git switch 'upstream-pr/1220'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1220'
git switch 'main'
git merge --squash 'upstream-pr/1220'
git switch 'main'
git merge --ff-only 'upstream-pr/1220'
git switch 'main'
git merge 'upstream-pr/1220'
git push origin 'main'
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
xcl-dev/xcl!1211
No description provided.