Skip to content

docs: first-boot import audit (XErrorReport fatal, networking callback, module identity) - #5614

Closed
Kam471 wants to merge 1 commit into
ProjectLeonida:mainfrom
Kam471:docs-boot-import-audit
Closed

Kam471 wants to merge 1 commit into
ProjectLeonida:mainfrom
Kam471:docs-boot-import-audit

Conversation

@Kam471

@Kam471 Kam471 commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Scope

Audit of the documented first-boot import surface at 3faac557b: docs/runtime_imports.md and docs/boot.md §1–3 against runtime/shims/registry.cpp, runtime/shims/xgameruntime*.cpp, runtime/shims/d3d12_xs.cpp, runtime/shims/dxgi_com.cpp, runtime/shims/xmem.cpp, the file/process/loader shims, and the static import tables in pe_loader.cpp and tools/d3d12_xs_surface.py / tools/gdk_runtime_classes.json.

The audit adds docs/boot_import_audit.md and one index row in docs/README.md. No runtime code changed. No game data, keys, decrypted content or probe artifacts are included.

Top 5 first-boot risks, in order

  1. xgameruntime.dll!XErrorReport is not served. error_report exists as IXErrorImpl slot 3 (runtime/shims/xgameruntime.cpp:236-240) but the SHIM_TABLE (:1098-1146) has no XErrorReport entry. The thunk pseudo-handle returns NULL / ERROR_PROC_NOT_FOUND. PR xgameruntime: serve XErrorReport, the sixth name the GDK thunks look up (libHttpClient and XCurl init fail without it) #5312 measured HCInitialize → 0x89240101 and curl_global_init → CURLE_FAILED_INIT; the thunk helper refuses the runtime before any initializer runs. Fatal, confirmed. Owner: xgameruntime: serve XErrorReport, the sixth name the GDK thunks look up (libHttpClient and XCurl init fail without it) #5312 @dracbat.
  2. XNetworkingImpl slot 16 (XNetworkingRegisterConnectivityHintChanged) is a success stub. net_register (runtime/shims/xgameruntime.cpp:301-306) hands out a token and never calls back; unregister always returns true. PR xgameruntime: XNetworking register calls send their initial callback (RT-296) #4551 reports XCurl calls slot 16 at boot and the usual network-init pattern waits for the initial callback. Fatal hang, confirmed. Owner: xgameruntime: XNetworking register calls send their initial callback (RT-296) #4551 @AirKyzzZ.
  3. GetModuleFileNameW(NULL) names the host loader, not the guest. It is not in the library_loader table, so GetModuleHandleEx* and GetProcAddress(NULL, …) are host answers too. PR Runtime: the mapped executable's module identity (GetModuleHandle/Ex, GetModuleFileName, GetProcAddress) #2075 notes titles often derive their install folder from this. High, confirmed. Owner: Runtime: the mapped executable's module identity (GetModuleHandle/Ex, GetModuleFileName, GetProcAddress) #2075 @dracbat.
  4. XGameRuntimeFeatureImpl is not served. Class id 8836fe87-… returns 0x80070032 with the out pointer cleared. The thunk returns the HRESULT, so a bool caller reads al = 0x32 = true for every feature. PR xgameruntime: serve XGameRuntimeFeature and XSystemAnalytics offline through QueryApiImpl #3476 documents the per-feature answer. Likely. Owner: xgameruntime: serve XGameRuntimeFeature and XSystemAnalytics offline through QueryApiImpl #3476 @seblessa.
  5. XSystemAnalyticsImpl is not served. The named XSystemGetAnalyticsInfo export exists (:1114), but the class id b884675d-… is not in QueryApiImpl, so the thunk path returns 0x80070032 and the 144-byte struct is never written. Possible. Owner: xgameruntime: serve XGameRuntimeFeature and XSystemAnalytics offline through QueryApiImpl #3476 @seblessa.

The full ranked table has 10 rows, all with an open owner PR. It also records XGameProtocolImpl/XGameInviteImpl (#4239, measured ERROR_NOT_SUPPORTED at title start), XAccessibilityImpl (#4235), XAppCaptureImpl/XAppCaptureMetadataImpl (#4307), the missing standard d3d12_xs forwards (#2098), and XMem alignment/query/default routines (#3601, #5253).

Confirmed by probe vs reasoned

Probe-confirmed under gta6rt --run (no artifacts included):

  • Six thunk names: five served, XErrorReport missing (err 127).
  • 24 class ids: 9 unserved, all 0x80070032 with the out pointer cleared; XThreadingImpl served as control.
  • 23 documented d3d12_xs functions: 4 served, 19 missing.
  • XNetworking slot 16: hr=0, token=1, callbacks=0 after 50 dispatch rounds.
  • GetModuleFileNameW(NULL): names the host loader's image, not the guest.

Reasoned from code and open-PR measurements:

  • Boot impact of the missing feature/analytics/accessibility/capture classes. The classes are confirmed missing; whether a title dies or takes a fallback depends on its path.
  • XMem alignment/page bits and XMemVirtualQuery +0x30: PR Runtime: xmem honours the attribute word's alignment and reports the memory kind (RT-202) #3601 measured the package DLL call sites; the title's own allocator is unmeasured.
  • dxgi.dll/d3d12.dll host bindings work on Windows 11; the risk is the Vulkan backend and Xbox root-signature flags, not a bind failure.
  • XPackage installation-monitor/content-mount limits and XPersistentLocalStorageMountForPackage are stubs/limits, not measured first-boot calls.

Build and test counts

Windows 11, MSVC 19.44.35228.0, CMake + Ninja, RelWithDebInfo, Vulkan SDK 1.4.363.0, LEONIDA_VK_DEVICE='RTX 5070 Ti', LEONIDA_D3D12='vulkan'.

  • 11/11 selected CTest tests passed in 3.07 s.
  • xgameruntime 128 checks (0.23 s); xgameruntime_user 42 (0.14 s); xgameruntime_gamesave 50 (0.17 s); xgameruntime_store 22 (0.16 s); xgameruntime_offline 29 (0.15 s); xgameruntime_offline_hdr 29 (0.01 s); both gamertag tests pass (0.01 s each).
  • run_tiny_gdk_load 1 module, shim=14 host=51 module=0 unimplemented=0 (0.23 s).
  • run_tiny_atexit 1 module, shim=11 host=47 module=0 unimplemented=0; 8 termination paths match Windows (0.92 s).
  • run_tiny_frame 1 module, shim=10 host=46 module=0 unimplemented=0; 16 guest PASS lines + OK; 19 [d3d12-trace] lines; 9 startup-trace events; NVIDIA GeForce RTX 5070 Ti; 32/32 pixels clear (1.02 s). A second run with LEONIDA_VK_VALIDATION=1 had 0 validation errors.

No runtime code changed

Docs only: docs/boot_import_audit.md and the docs/README.md index row. The audit is at 3faac557b; every ranked runtime gap has an open owner PR in the table, so this PR does not duplicate those patches.

Audit the documented xgameruntime/d3d12_xs/dxgi surface against the shims at 3faac55. Record the top first-boot risks, current status and each owner PR, plus the 11/11 CTest and probe counts. No runtime code changes.
@cynbun

cynbun commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Reviewed 9bbc346 (claims checked against main 561b65a and the audit base 3faac55, docs tests on Linux, Python 3.14.8): three factual problems, two smaller ones

  1. Risk Vulkan tools: fix builds on Linux #2 is fixed on main. xgameruntime: XNetworking register calls send their initial callback (RT-296) #4551 merged at 11:36 today (7b82b01e0, "XNetworking register calls send their initial callback"). On main, net_register is now net_register<HintChangedCallback> (runtime/shims/xgameruntime.cpp:382, slot 16 at :439) and queues the callback. The page still lists it as an open, "Fatal hang, confirmed" gap: docs/boot_import_audit.md:62, :114, :140, :161, and the status line at :3 ("every runtime gap is claimed by an open PR"). The PR summary repeats it. Merged into today's main, the page would steer readers to work that is already done.
  2. The d3d12_xs count is 3 of 23, not 4 of 23. tools/d3d12_xs_surface.py FUNCTION_EXPORTS (23 entries) does not contain D3D12XboxCreateDevice; the console create export there is D3D12ConsCreateDevice (ordinal 13). Of the 23, the shim table (runtime/shims/d3d12_xs.cpp:221-227 at base) serves D3D12SerializeVersionedRootSignature, D3D12SerializeRootSignature and D3D12CreateRootSignatureDeserializer, so 20 are missing: the four standard ones from row 9 plus all 16 console ones. Affected: :44 (lists D3D12XboxCreateDevice among the served 4), :69, :86, :139 and :181. If the probe really printed served=4 missing=19, it did not probe the 23 names from that file.
  3. Owner table, :163-173. fix(xgameruntime): publish error callback + context as one consistent pair under a mutex #3927 (XErrorSetCallback) and xgameruntime: keep persistent local storage out of GAME:\ (RT-274) #4327 (PLS out of GAME:\) are merged, xgameruntime: serve XPersistentLocalStorageImpl (v1) (RT-219) #3471 (PLS v1) is closed, and docs/runtime_imports.md: served reads every xgameruntime*.cpp, and --runtime-source takes a file or a folder #5348 is by evilclanker9000, not Vonsek. :145 says "Do not duplicate these patches", so the open/merged state matters here.
  4. Smaller: :78 says slots "27-40" are E_NOTIMPL and also that 34 has a real answer. At base, kPackageVtable slot 34 is pkg_uninstall_package (xgameruntime.cpp:1000), so the range should exclude 34.
  5. Smaller: every line number is at 3faac557b (stated at :1). Main has already moved some of them, e.g. SHIM_TABLE(xgameruntime from :1098 to :1185 and error_report from :237 to :240. That holds as a dated snapshot, but the page then shouldn't call the gaps "on main" (:35).

Checked and correct at base: XErrorReport is absent from SHIM_TABLE while error_report is slot 3 (still true on main). The resolve() order at pe_loader.cpp:1105-1141, and the fact that it never consults owns_dll (still true on main, :1461). library_loader.cpp:94-100. 24 classes in gdk_runtime_classes.json, of which 15 are served by QueryApiImpl plus the user/gamesave/store/offline queries. The 144-byte XSystemAnalyticsInfo (:675-682). 41 XGR names plus the two gameplatformservices.dll names. 33 file names × 5 modules and 9 loader names × 7 modules. The xmem.cpp, registry.cpp, CMakeLists.txt:333-384, d3d12_vulkan_device.cpp:7555-7560/7910, d3d12_vulkan.md:98-99 and runtime_imports.md:276-278 references. #5312's 0x89240101 and CURLE_FAILED_INIT are in its description, and #4239's ERROR_NOT_SUPPORTED in its own. I could not reproduce the Windows probe runs or the CTest check counts (Linux, no artifacts).

All 11 tests/test_docs_*.py pass, git diff --check is clean, and the PR merges clean with main. The README row conflicts with #5661, which rewrites the next row (the gameinput row); whichever lands second needs a trivial rebase.

AI-assisted (Claude Code).

@kapitche

Copy link
Copy Markdown
Collaborator

Tested 9bbc346 merged with main 561b65a on Linux (WSL2) Python 3.12.16: concern

Docs-only (new docs/boot_import_audit.md, 182 lines, plus one docs/README.md row). tests/test_docs_*.py (11 files): all OK, 0 failures; the new file adds no pipes inside table cells that break rows (the docs table tests pass). Negative control: not applicable (no code).
Verified issue: the page is a snapshot at 3faac55 and says "every runtime gap is claimed by an open PR listed in the table", but on current main (561b65a, 1,806 commits later) several of those statements are already false. I checked with gh: #4551 (listed as the open owner of risk #2) is MERGED, and runtime/shims/xgameruntime.cpp net_register now submits the initial notification, so risk #2 ("stub returning success, never calls back") no longer holds; #3927 and #4327 are MERGED and #3471 is CLOSED, yet section 8 lists all four as open owners. Also git log shows "Revert #2490" on main, while the page treats #2490 as an open fix for the loader host-binding gap (it is open, but its code is not on main). The audit's other claims I spot-checked still hold (XErrorReport has no SHIM_TABLE entry; owners of #5312, #3476, #4235, #4239, #4248, #4307, #2098, #3675, #2075, #3601, #5253 are open and the author names match).
Suggest either restating the page as "at 3faac55, since then #4551/#3927/#4327 merged" or refreshing risk #2 and the section 8 table before it lands, since the docs/README row advertises it as the current first-boot risk list.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Package-DLL addendum to the boot import audit at 561b65a83 (counts/API names only; no game data):

  • 16/16 package-root DLLs map and bind; --init exit 0 for each; 0 unimplemented imports.
  • Bink2Scarlett.dll loads as a guest image (GetModuleFileNameA fails, guest base) and BinkOpen/DoFrame/CopyToBuffer decode a real .bk2.
  • amd_fidelityfx_loader_xbox.dll maps the upscaler; ffxQuery and ffxCreateContext succeed on WARP. Neither Bink nor FidelityFX needs a shim.
  • Remaining risks: FSR's first dispatch (console compute pipeline; an Ada driver refused R9G9B9E5_SHAREDEXP UAV); Bink audio untested (XAudio2_9.dll ordinal 1 binds on this host); VC++ x64 redist prerequisite.
  • The fatal XErrorReport gap is the same one #5312 fixes; do not duplicate it.

@LaugeM LaugeM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cynbun's review covers risk 2 (#4551). Since then most of the rest of the ranked list has landed on main too, so the page would now point readers at work that is done:

  • Risk 1, XErrorReport (docs/boot_import_audit.md:61, :101, :149): served by name on main since 6312c057f. The doc's own condition at :61, "if the executable's xgameruntime.lib is the same version", is answered: that commit and #8931 measure the same lookup in the retail executable.
  • Risks 4 and 5, XGameRuntimeFeatureImpl and XSystemAnalyticsImpl (:64-65, :102-103, :150): #3476 merged (7c51695b3). Both class ids are in QueryApiImpl on main (runtime/shims/xgameruntime.cpp, kGameRuntimeFeatureClass and kSystemAnalyticsClass).
  • Row 7, XAccessibilityImpl, and the XLauncherImpl line (:67, :105, :107, :151, :153): served on main by #6810 (4da521de3), not by #4235 or #4248, which the owner table still names.
  • XMemAllocDefault / XMemFreeDefault (:108, :160): served by #6919 (042c5f378). XMemSetAllocationHooks and XMemGetTitleHeap are still missing.
  • :5 says the retail executable is absent. docs/runtime_imports.md, "The retail executable (RT-5)", now lists the 17 runtime classes it reaches. XGameProtocolImpl, XGameInviteImpl and XAppCaptureMetadataImpl are not among them, so rows 6 and 8 (:66, :68) are not first-boot risks for this title. Of row 8, only XAppCaptureImpl slot 5 is referenced.

What is still open from the page: module identity (#2075), the d3d12_xs standard forwards (#2098) and the XMem alignment and XMemVirtualQuery +0x30 (#3601). docs/retail_boot_chain.md now records the measured stops in order. I'd close this PR, or cut it down to those three rows dated against a current main.

AI-assisted review (Opus 5.5). Read the diff against main; checked each row against upstream/main 5d74c27 and the merge state of the named PRs, not built.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants