Commit Graph

63 Commits

Author SHA1 Message Date
44ddf9b052 Merge pull request #1600 from thiefyzheng/fix/test-tempdir-stripped-env 2026-11-29 13:44:40 +01:00
21f5baff1d Merge pull request #2520 from Tyrannys/rt-offline-gdk-shim-gaps
xgameruntime: gifting UI completes its block, speech without `used`, MountWithUi and TitleId gaps (RT-OFFLINE-GDK-SHIM-GAPS)
2026-11-29 02:04:54 +01:00
b17397f0dd tests: derive every test's scratch folder from test_temp_dir::temp_dir, not GetTempPath (TEST-TEMPDIR-STRIPPED-ENV)
With TMP, TEMP and USERPROFILE all unset, GetTempPathW returns C:\Windows\, and the throwing create_directories/copy_file/ofstream on C:\Windows\leonida_* aborts with 0xc0000409 before the test body runs. runtime/test/test_temp_dir.h grows one entry, testfiles::temp_dir(): LEONIDA_TEST_DIR when set, the current directory when the temp environment is stripped (Windows), else the standard temp resolution. Fifty-two test files and the tiny_game fixture that called GetTempPathA/W or temp_directory_path directly now use it; d3d12_queue_handover_test.cpp also checks the _sopen_s result in capture_stderr instead of silently returning empty stderr. One runtime source function needed the same fallback because tests exercise it: tls_host_clone_dir in runtime/src/pe_loader.cpp (the loader_tls tests). Rebased onto current main after its D3D-448 additions to d3d12_mesh_test.cpp (3-way; the mesh test keeps both). Verification on a Windows VM: stripped environment - the previously crashing d3d12 tests exit 77 (no usable Vulkan device) instead of aborting, file_system_test runs all 505 checks and loader_test all 95 with zero failures; normal environment - identical outcomes; LEONIDA_TEST_DIR honored under a fully stripped environment (the scratch folder observed mid-run inside it, cleaned up after the pass). The finding is whoalin1's (coordination issue #14, 02:37:44Z).

AI-assisted.
2026-11-28 19:01:06 +00:00
1b1bd0054c Merge pull request #997 from TanmaySatyam/feat/xpackage-impl4-and-monitors
xgameruntime: XPackage installation monitor, enumeration, and IXPackageImpl4 (OLD-9900)
2026-11-28 18:58:43 +01:00
9d054cd855 Async callback and handle safety in xgameruntime, gameinput_no_sdl and xapu_queue
kevincommits' Finding 19 in #1608, item 5:

- xgameruntime.cpp (XNetworking): an initial notification's callback
  that unregistered itself with wait=true waited for its own return and
  never came back. The registration now records the thread running its
  callback, and an unregister from that thread returns at once (the
  registration ends when the callback returns). net_register also used a
  throwing new across the ABI; it is new (std::nothrow) now.
- gameinput_no_sdl.cpp: a GameInputBlockingEnumeration report ran
  outside deliver_mu, so UnregisterCallback on another thread returned
  while the callback was still running and the caller could free its
  context mid-call. It now runs under deliver_mu and marked as
  delivering, as deliver() runs callbacks.
- xapu_queue.cpp: handles were never checked, so a second XApuDisconnect
  freed the connection again and closed its event twice. Connections are
  kept in a live set under a shared mutex; every call checks its handle
  and holds the lock shared for the call, and a disconnect takes it
  exclusive. An activate or deactivate changed the stream before the
  result was queued, so running out of memory left it half applied; the
  result's slot is now taken first.

New checks: xgameruntime_test (a callback that unregisters itself with
wait=true returns), gameinput_no_sdl_test (UnregisterCallback waits for a
running blocking callback; a blocking callback can unregister itself),
xapu_chad_test (a second disconnect, a disconnected and a foreign handle
are refused). On main the first two fail and xapu_chad_test crashes with
heap corruption.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 19:40:07 -06:00
c030bfd2ed xgameruntime: gifting UI completes its block, speech without used, MountWithUi and TitleId gaps (RT-OFFLINE-GDK-SHIM-GAPS)
Four offline GDK shim gaps from kevincommits' finding on #1608:

- XStoreShowGiftingUIAsync (store slot 82) is offline_failure_async<82, 5>
  like the other offline *Async slots, so a caller waiting on its block gets
  an answer. The block is the 5th argument (storeContextHandle, storeId,
  name, extendedJsonData, async), as in microsoft/XBOX-GDK-dotnet.
- XSpeechSynthesizerGetStreamData forwards a host stream
  (LEONIDA_LOCAL_SPEECH=1) also when `used` is null; it is _Out_opt_. The
  host provider is made once into a namespace-scope atomic instead of a
  block-scope static on a title thread (the Wine guard issue this file
  already avoids elsewhere). A test hook sets a fake host.
- XPackageMountWithUiAsync completes with E_ACCESSDENIED for the game's
  own package, as XPackageMount refuses it, instead of
  E_GAMEPACKAGE_NO_PACKAGE_IDENTIFIER. A block used again before its result
  was read closes the earlier mount's handle; if the new run does not
  start, the earlier mount keeps its place.
- XGameGetXboxTitleId skips a <TitleId> inside an XML comment, as
  package_locales already does (the comment stripping is now shared).

New checks in xgameruntime_test, xgameruntime_store_test and
xgameruntime_offline_test: 5 fail with main's logic, all pass with the fix.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 18:22:59 -06:00
b88e2b596b xgameruntime: wire XPackage slots 28/29/35/36/40 and flat C exports
Builds on #984 (which landed IXPackageImpl4, slots 5-10, 22, and 39): wires the remaining IXPackageImpl 1-3 EnumeratePackages (slots 28/35) and RegisterPackageInstalled (slots 29/36/40) vtable entries to the offline implementation, adds the nine flat C XPackage* exports in SHIM_TABLE(xgameruntime) forwarding to the same handlers, and adds unit tests in xgameruntime_test.cpp.
2026-11-25 14:27:08 +05:30
39879ce0fd Merge main into RT-PROTON-STORY-LOAD (#984)
Merges main at 1154976d4 into the integration branch at 273b3bdf9 (merge base ece4ba5b3). 42 files conflicted;
this commit is the resolution only. Build and test repairs follow in their own commits.

Rule of resolution: where both sides added different things, both stay; where both made the same change in two
forms, main's reviewed form stays and whatever #984's form did in addition is carried into it; where the two
changed the same code for different purposes, both purposes are kept.

Xbox proxy code (runtime/shims/d3d12_xs_device.cpp, d3d12_xs_device.h, d3d12_xs.cpp, d3d12_xs_alloc_size.h,
d3d12_xs_desc_clean.h, registry.cpp):
- d3d12_xs_device.cpp is #984's file with main's differing pieces ported in: env_slot and the configurable device
  routes, XboxQueueSlotRoutes, PresentationHandler / set_presentation_handler, the console caller rule for device
  slots 61 and 74 (#383, #385), route_xbox_device_slot, slot 81 as GetFrameStatisticsX, create_host_device, the
  console-form rule for slots 25 and 56, the console list IID of #359, and the forms of queue slot 18 (#403) and
  list slot 139 (#396).
- Kept from #984: the list proxy with handle translation, queue slots 16/17 as Signal/Wait, the fence's
  completed-value mirror, the shared FrameTokenSource, PresentX through queue_present_x when no handler is
  attached (slot 30, or 32 on a queue detected as the newer layout), slots 27/53/55/57/70/71/133, the wider
  pc_resource_desc, S_OK for queue slots past the PC table.
- Dropped: #984's GetFrameEventsX and LEONIDA_XS_FRAME_EVENTS_SLOT, its second-word rule for slot 61, its
  undetected-layout rule for queue slot 18, its list IID mapping to GraphicsCommandList6; main's copy of the base
  list proxy, its null-view slot 70 and its refusing slot 133.

Proxy tests (runtime/test/xs_proxy_mock_test.cpp, device_proxy_test.cpp, queue_proxy_test.cpp):
- Checks of both sides, each run once; main's forms of the render-target size and layout checks with #984's extra
  cases added; main's --env-slots-74 and #984's --env-slots-70.
- Adapted to the merged code: the queue tail answers S_OK, slot 73 answers an unknown IID with the list proxy,
  the queue slot 18 case installs a console caller. Dropped: #984's slot 81 GetFrameEventsX cases.

D3D12/Vulkan layer (runtime/shims/d3d12_com.cpp, d3d12_vulkan_device.cpp, runtime/src/command_list.h,
frame_pacer.h, shader_library.h, vulkan_backend.h, vulkan_replay.h, runtime/test/command_list_test.cpp,
d3d12_close_parity_test.cpp, d3d12_execute_indirect_validation_test.cpp, replay_texture_barrier_test.cpp,
vk_pipeline_check.cpp, vk_test_device.h):
- Resource::create_texture: #984's title images (deferred placed, pending streamed, title pool) and main's
  ordinary textures (#1413 shared blocks, #1364 staging fallback) are exclusive branches chosen by the texture's
  origin, so both pools run on disjoint sets of textures.
- frame_pacer.h is main's pacer (#402) with #984's FrameTokenSource as the token counter.
- main's forms kept for ExecuteIndirect (#1066, #377), the barrier into LAYOUT_UNDEFINED (#1055), the B4G4R4A4
  stand-in, per-face stencil masks, the unaligned tile staging (#528) and the device-lost flag (#980).
- shader_library.h: main's block inflate; #984's `bulk` parameter now defaults to true so main's callers keep it.
- Dropped: #984's B8G8R8A8 stand-in for B4G4R4A4 targets, its refusal of separate stencil masks, its zero-count
  refusal in ExecuteIndirect, its wider UNDEFINED -> UNDEFINED release and the test case for it.

Other shims (runtime/shims/dstorage.cpp, file_system.cpp, gameinput.cpp, xgameruntime_offline.cpp,
runtime/test/xgameruntime_offline_test.cpp, xmem_test.cpp):
- ReadFile and DirectStorage reads: #984's pinned kernel_writes read, then main's touch_pages retry on
  ERROR_NOACCESS. main's rt::fs::read_file is folded into #984's read_file.
- gameinput: main's strict LEONIDA_INPUT_SCRIPT parser with #984's rsup/rsdown entries.
- Speech synthesis: main's one silent voice and handle checks; #984's accept-anything form dropped.

Build, tools, docs (runtime/CMakeLists.txt, runtime/cmake/translator_deps.cmake, scripts/build_runtime.ps1,
make_game.py, tools/rdna2spirv.py, shader_disasm.py, shader_ir.py, shader_library.py,
runtime/test/shaders/cs_imgload_tfe.asm, cs_imgload_d16_tfe.asm, docs/README.md, boot.md, d3d12_vulkan.md,
runtime/README.md):
- Unions of the test, target and source lists; spirv_loop_guard.py added to translator_deps.cmake.
- rdna2spirv.py: main's DPP compare rule (#957), SMEM vcc base (#647) and widen_wave64_masks (#1021); #984's
  restore_skipped_instructions and restore_dot4_inline_sel. #984's duplicate widen_wave64_valu_masks dropped.
- shader_disasm.py and shader_ir.py: main's structure with #984's one-line-per-dword llvm-mc input and wave flags.
- shader_library.py: main's structure with #984's --compute-hashes and per-state compute variants.

One file that did not conflict is changed here: tools/rdna2_decode.py. Git kept both sides' decoders for a VOPC
compare with a DPP operand, and #984's narrower one shadowed main's; it is main's file again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 19:38:04 -05:00
0f98d193c5 Merge pull request #441 from jujumoneylol/pr/title-memory-cap
Merging.

**Why merged:** RT-TITLE-MEMORY-CAP: `LEONIDA_TITLE_MEMORY_MB` (MiB, clamped to 2048..65536) overrides what `XSystemGetAppMemoryUsageLimit` and `XMemGetWorkingSetStatistics` report. I held this earlier for one reason: the env var wasn't documented, so `test_docs_env_vars` failed. The author fixed that in 6cb16a4fa (runtime/README.md overrides table). Kokonotcu's idea of a different default budget was accepted as a follow-up.

**Why it's good:** the env read is bounded: `GetEnvironmentVariableA` into a 32-byte buffer, then `strtoull`, rejecting a sign, trailing text, 0 and overflow. Tested on Windows 11 / RTX 4070 SUPER, VS 2022 + Ninja RelWithDebInfo, merged onto main 2a5ff9714 together with #992:
- the repo-consistency set (now including test_ctest_registration) gives 578 passed / 5 skipped / 0 failed;
- docs tests give 47 passed, including test_docs_env_vars;
- full ctest gives 316/317, where the only failure is main's pre-existing `d3d12_depth_resolve`, and xmem and xgameruntime pass;
- `d3d12_*` tests under validation give 119/120 with 0 VUIDs.

git merge-tree against current main 89d7dfcf5: no conflicts.

Small follow-ups, not blockers: the README row says "Caps", but a value above host RAM raises the reported limit (up to 64 GiB). The parsing is duplicated in xgameruntime.cpp and xmem.cpp, so a shared helper would keep them in sync. Separately, the xmem check "mapping them does not charge them" measures system-wide commit charge, so it can flake on a heavily loaded machine. It passed 120/120 repeats on an idle one, and that's unrelated to this PR.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 17:45:58 -05:00
273b3bdf9d [integration] Linux/Proton and native Windows: boot through the story load (RT-PROTON-STORY-LOAD)
One squashed commit of a fork that was developed on a Linux/Proton machine and
tested on two native Windows machines. On all of them the retail 1.0.2.1
package now launches, shows its launch movie, first-run pages and landing
prompt, runs the story load to its end with the loading slideshow drawing its
artwork, and enters the world phase. A first world frame is not verified yet.
docs/linux_proton.md has the setup, a healthy boot's timeline, the machines
and where it stops.

Runtime: frames in the title's own window; DirectStorage pinned reads,
page-list scatter/gather, BCPack and unshuffle with a locally generated
predictor file; pooled, device-local and deferred image backing for streamed
and placed textures; enhanced barriers into LAYOUT_UNDEFINED; a bindless table
that degrades instead of refusing a submission; a descriptor hash finalizer
(off until a library carries it); directly indexed heap offsets for compute
dispatches and VS/PS/GS draws; title buffer windows outside a fragmented
arena; opt-in device-local copies of streamed buffer views; write-fault
retries under the tracker lock, shared trackers and write-watched title memory
for native Windows; device-loss, compute-input and memory probes.

Translator: loop bounds at structured exits, the eight FidelityFX programs
that use a packed-dot form the disassembler skips, buffer bounds modes per
view kind, a compaction option, the hash finalizer option.

Tools and scripts: Linux boot scripts (Wine/Proton, no network), a Windows
boot script, the paired compute translation script.

No game data. AI-assisted (Claude Code and Codex agents), reviewed and booted
by people on the machines named in docs/linux_proton.md.

Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 11:42:12 -06:00
c156e77c46 xgameruntime: XPersistentLocalStorageGetPath reports the required size on a short buffer (RT-712)
The (size, buffer, used) convention of the XSystem id getters: a short buffer learns the path length with its NUL
in *path_used, the buffer stays untouched, the HRESULT is unchanged.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
2026-11-24 16:23:35 +02:00
6c1d939509 runtime: honor LEONIDA_TITLE_MEMORY_MB in XSystemGetAppMemoryUsageLimit and XMemGetWorkingSetStatistics 2026-11-24 00:21:59 -05:00
368228b604 Merge remote-tracking branch 'origin/pr/9716' 2026-11-23 17:24:40 -05:00
5efd38ed8c Merge remote-tracking branch 'origin/pr/9714' 2026-11-23 17:24:39 -05:00
0d3dd7d24a xgameruntime: XPackageGetUserLocale skips commented-out resources and allows spaces around '='
package_locales() searched MicrosoftGame.Config for the literal text
"Language=", so a <Resource> inside an XML comment counted as declared and a
real `Language = "en-US"` did not. It now drops comments first and reads each
<Resource> tag's attributes with optional whitespace around '=', taking only an
attribute named exactly Language on an element named exactly Resource.
2026-11-23 18:59:59 -03:00
54ec9044a0 Exercise the UTF-8 mount path through the GDK byte-buffer APIs 2026-11-24 08:55:13 +11:00
9f89213b01 xgameruntime: terminate empty package user locale 2026-11-23 22:24:24 +01:00
c5094e1dc9 xgameruntime: support long package mount paths 2026-11-23 18:37:20 +01:00
4da521de3e xgameruntime: serve XAccessibilityImpl and XLauncherImpl offline (speech synthesis, launcher) (#6810)
Squash-merged after diff review of PR #6810 - xgameruntime: serve XAccessibilityImpl and XLauncherImpl offline (speech synthesis, launcher)
2026-11-23 09:58:41 -06:00
7c51695b30 xgameruntime: serve XGameRuntimeFeature and XSystemAnalytics offline through QueryApiImpl (#3476)
Squash-merged after review of PR #3476 - xgameruntime: serve XGameRuntimeFeature and XSystemAnalytics offline through QueryApiImpl
2026-11-23 08:12:29 -06:00
561b65a832 Merge remote-tracking branch 'origin/main' into triage-r44
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	.github/workflows/runtime.yml
#	tests/test_first_look_shim_report.py
2026-11-23 06:28:03 -05:00
de67135246 Runtime: offline XGameSaveImpl (save provider, containers, blobs, updates)
A GDK title opens its save provider at boot; QueryApiImpl now serves
XGameSaveImpl (IXGameSaveImpl..3, 33 slots from xgameruntime-docs' layout,
signatures and error codes from the public GDK reference). Saves are files
in LEONIDA_SAVE_DIR\local-user\<container>\<blob> (default
%LOCALAPPDATA%\Leonida\saves), %-encoded: the layout tools/saves.py import
already writes. Updates are buffered and committed by write-then-rename;
container names follow the documented rule; the 16 MB update limit, the
documented E_GS_* codes, async variants through XAsync, and the
XGameSaveFiles folder/quota slots. Assumptions (quota, blob-name length,
nullptr blob list) are marked in the source and docs.

xgameruntime_gamesave_test drives every slot (50 checks). The two tests that
used XGameSaveImpl's id as "a class not served" now use a made-up id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:38:01 -05:00
0be0e8ca5f Merge pull request #4551 from Maxime Mansiet
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:15:50 -05:00
2521a683b0 xgameruntime: keep persistent local storage out of GAME:\
Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
2026-11-23 04:41:49 +01:00
be8570ace1 Merge remote-tracking branch 'origin/main' into triage-r43
# Conflicts:
#	docs/runtime_imports.md
#	runtime/CMakeLists.txt
#	runtime/shims/xgameruntime.cpp
#	runtime/test/xmem_test.cpp
#	tools/rdna2spirv.py
2026-11-22 22:12:50 -05:00
7b82b01e0b xgameruntime: XNetworking register calls send their initial callback
Signed-off-by: Maxime Mansiet <AirKyzzZ@users.noreply.github.com>
2026-11-23 02:57:24 +01:00
c45e650eab Merge pull request #3576 from Felix Croasdale 2026-11-22 17:02:48 -05:00
c36370a253 Merge pull request #3408 from Dominik 2026-11-22 17:01:53 -05:00
fc0cbecfda Merge pull request #2218 from Dominik 2026-11-22 16:59:05 -05:00
4c52ce27a6 Seven fixes from an outside contributor (sent as patches, applied without the author's name)
- rdna2spirv: declare each packed vertex input register once; a register whose elements disagree on the component
  type is refused (SHADER-644).
- runtime: a title's VirtualAlloc drops the console's MEM_GRAPHICS / MEM_TITLE type bits the host rejects (RT-217).
- runtime: XPersistentLocalStorageImpl is served from <overlay>\persistent with the package's 2048 MB quota
  (RT-219; layout from the public docs, not measured in a caller).
- runtime: G:\ names the package and T:\ a scratch folder in the overlay; paths under the configured folders and
  every path with no folders configured stay host paths (RT-218).
- winhttp_offline: header blocks and timeouts the host WinHTTP rejects are rejected the same way.
- cfg_structure.run: a limit of zero or less runs no blocks.
- shader_meta: an s_movk_i32 with a register operand and a float immediate beyond float32 are left unknown instead
  of raising.

Each comes with a test that fails on the old code. Conflicts with main resolved here (internal_dir() hides T:'s
folder; both file_system_test blocks kept).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:55:46 -05:00
5edd926878 xgameruntime: serve XGameImpl (IXGameImpl3) offline through QueryApiImpl
IXGameImpl3 : IXGameImpl2 : IXGameImpl (xgameruntime include/xgame.idl), slots
3-5: XGameGetXboxTitleId gives MicrosoftGame.Config's <TitleId> (E_FAIL without
one, E_INVALIDARG for a null pointer), void XLaunchNewGame is logged and
returns, XLaunchRestartOnCrash succeeds with nothing registered. A retail Gen9
title asks QueryApiImpl for this class (Freminet/ScarlettX's observation).

The config reader is shared with XPackageGetUserLocale. The two tests that used
XGameImpl's id as their example of an unserved class now use XGameSaveImpl's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:10:59 +00:00
f74b8eb87e xgameruntime: read LEONIDA_GAME_DIR wide for MicrosoftGame.Config
GetEnvironmentVariableA narrowed a game folder named outside the ANSI code page
(e.g. a runic or CJK character on cp1252), so the package locale lookup missed
its MicrosoftGame.Config. Read the variable and open the file wide. The test
uses U+16A0, which no ANSI code page has (it fails with the narrow read).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:10:40 +00:00
4f6b753693 xgameruntime_test: the IXSystemImpl5 check's flag no longer hides the entry-point check's (C4456)
93e65132 added the IXSystemImpl5 inheritance check with a `bool all`,
which hides the `bool all` of the GetProcAddress check at line 188;
MSVC reports C4456 at line 400. The inner flag is now all_inherited.
No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:58:05 -06:00
e3662721ea xgameruntime: XPackageImpl review fixes (progress, bool slots, locale, IIDs, --game-dir)
Review (@Flyander):
- slot 7 is void XPackageGetInstallationProgress(monitor,
  XPackageInstallationProgress*): it now writes an installed, launchable,
  completed package instead of an HRESULT stub ignoring its output.
- slots 8, 10, 22, 34 are bool methods (UpdateInstallationMonitor, the two
  Unregister* calls, UninstallPackage); E_NOTIMPL read as true. They return
  false / true / true / false, as documented for nothing to do offline.
- XPackageGetUserLocale returns the package-declared locale closest to the
  user's (MicrosoftGame.Config <Resource Language>, from LEONIDA_GAME_DIR or
  --game-dir), never the host locale; with none declared it succeeds
  without writing, as Microsoft documents.
- QueryInterface answers IXPackageImpl and IXPackageImpl2 too (the IDL
  chain IXPackageImpl3 : IXPackageImpl2 : IXPackageImpl).
And @Ingenioeren's finding: XPackageGetMountPath uses gta6rt's --game-dir
(rt::fs::game_dir()) after LEONIDA_GAME_DIR, before the launcher folder.

xgameruntime_test links file_system.cpp; +6 checks (88).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:22:37 +00:00
ae2f7bf6d3 xgameruntime: serve XPackageImpl (IXPackageImpl3) through QueryApiImpl
libHttpClient.GDK.dll asks QueryApiImpl for XPackageImpl with IXPackageImpl3's
id through 30 thunks (slots 3-19, 22, 24-27, 30, 32-34, 37-40), each in
the argument shape of the method at that position of xgameruntime-docs'
IXPackageImpl (3-34), IXPackageImpl2 (35-38) and IXPackageImpl3 (39-40)
lists, e.g. 10 (monitor, token, bool), 14 (id, count, selectors), 24-26
the mount path trio, 39 (kind, scope, context, callback).

Slots with an offline answer forward to the XPackage functions already
on main, so the vtable and the named exports agree: 3 the package
identifier, 4 packaged process, 25 the mount path; plus 11 the host user's
locale, 24 the mount path size (exactly what 25 needs) and 26 closing a
mount (nothing to release). Every other slot logs its number once and
returns E_NOTIMPL, so the first boot lists what the title needs.

xgameruntime_test +6 (80): the IXPackageImpl3 id, 3 and 4 equal the
exports, the locale and its short-buffer error, 24/25 sizes, 5/40 stubs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:20:50 +00:00
2428954112 xgameruntime: refuse XThreadingImpl slot 8 (XAsyncBeginAlloc) instead of answering S_OK
Slot 8 is the private XAsyncBeginAlloc: no public page, never called by the package's DLLs, signature not measured.
The generic private slot answered 0, so a caller got S_OK for an async call whose provider never received
XAsyncOp::Begin and whose completion never arrives. It now returns E_NOTIMPL and logs once.

Test: xgameruntime_test calls slot 8 with a provider that counts XAsyncOp::Begin and requires either a failure or one
Begin. Fails on ec8ec4c9 (S_OK, 0 Begin), passes with the change; the mutant answering S_OK is caught.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:01:12 +01:00
15f5b2fbc0 Fix what the round-41 merges broke
- tests/semantic: BaseVertex/BaseInstance read 0 in the wave interpreter; the LDS MockGens follow
  SHADER-309 (lds_bound, lds_access, lds_atomic); abs emission tests load their operand, since
  SHADER-315 folds scalar ALU on constants.
- test_translate: the dynamic gather sampler is a loaded word, not s16 + 0 (SHADER-315 folds it).
- test_world_build: DDS downscale weights colours by alpha (62804d0d).
- test_fspx_shaders_stage: the fake disassembler writes the listing make_game now checks.
- xgameruntime_test: re-read the package id after clearing the LEONIDA_PACKAGE_ID override.
- docs: one row per topic again in design.md (72 topics) and README.md; one Other languages line;
  embedded_shaders.md keeps one copy of each bullet; animation.md links the heading anchor.
- tools/scripts: character_textures uses report_paths.same_report_path; stdout guard on six programs;
  LF write in vs_input_survey; the cl.exe fallback compiles winhttp_offline.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:30:33 -05:00
5864f1875c Merge pull request #2372 from Dominik 2026-11-22 13:14:20 -05:00
c5ab4bba97 Merge pull request #2327 from Dominik 2026-11-22 13:13:54 -05:00
99e5a1da3c Merge pull request #2203 from Dominik 2026-11-22 13:13:18 -05:00
c457e0a7bd Merge pull request #2116 from swam122yam-glitch 2026-11-22 13:13:03 -05:00
c8f8c00e34 Merge pull request #1798 from SHAURYASANYAL3 2026-11-22 13:12:34 -05:00
6e65dc9ec2 xgameruntime: resolve MSVC C4201 nameless struct and C4996 strncpy warnings 2026-11-22 23:15:27 +05:30
5ab5c208c9 xgameruntime: deny mounting game package identifier with E_ACCESSDENIED 2026-11-22 23:15:27 +05:30
4a90673850 xgameruntime: validate installed package identifiers and reject unknown packages in XPackageMount 2026-11-22 23:15:26 +05:30
cb8c6445fc xgameruntime: implement XPackageMount and handle registry for mount path getters 2026-11-22 23:15:26 +05:30
48cf34f3a8 xgameruntime: implement XPackageGetMountPathSize and validate XPackageMountHandle per GDK spec 2026-11-22 23:14:50 +05:30
93e6513237 xgameruntime: XSystemImpl answers its inherited interface ids; sandbox id needs 16 bytes
Review (@Flyander):
- QueryInterface accepted the class id and IXSystemImpl5 only. The IDL
  chain is IXSystemImpl5 : IXSystemImpl4 : IXSystemImpl3 : IXSystemImpl2 :
  IXSystemImpl (xgameruntime include/xsystem.idl), so every one of them is
  served by the same vtable. RuntimeObject now carries a null-terminated
  list of interface ids instead of one newer id (XNetworkingImpl's list is
  IXNetworkingImpl2).
- XSystemGetXboxLiveSandboxId requires sandboxIdSize >=
  XSystemXboxLiveSandboxIdMaxBytes (16); buffers of 7-15 bytes returned
  S_OK. copy_id takes the API minimum.

Tests: a 15-byte sandbox buffer is refused, 16 accepted; all five
IXSystemImpl ids give the same object.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:10:41 +00:00
6cb7735c22 xgameruntime: own gameplatformservices.dll, XCurl's other way into the runtime
XCurl.dll reads HKLM\Microsoft\GamingServices ServiceRetryTimeout, then
LoadLibraryExW(L"gameplatformservices.dll", nullptr,
LOAD_LIBRARY_SEARCH_SYSTEM32) and GetProcAddress'es GetApiVersionImpl and
QueryApiImpl (disassembled, no code run). The shims didn't own that module,
so the load went to the host: on a PC with Gaming Services it would reach
the real PC runtime's QueryApiImpl and bypass the offline classes; without
it XCurl returns 0x87E00196. Either way the result depended on what the
player has installed.

The shim table now serves gameplatformservices.dll!QueryApiImpl (the
offline one) and GetApiVersionImpl(uint64_t*, uint64_t*), measured at its
call site (two pointers to 64-bit locals, result unread; XCurl compares the
pair with the last one it saw), writing the same two values every call.
owns_dll() follows from the table, so library_loader answers the load.

xgameruntime_test: the LoadLibraryExW(..., SEARCH_SYSTEM32) load, the
versions and the shared QueryApiImpl (+3, 65). docs/runtime_imports.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:49:51 +00:00
1ab9ac784c xgameruntime: XSystemIsHandleValid returns bool, XSystemAllowFullDownloadBandwidth void
Checked against Microsoft's reference pages: bool XSystemIsHandleValid(
XSystemHandle) and void XSystemAllowFullDownloadBandwidth(bool). Slot 7
returned an HRESULT, so S_OK (0) read as "not valid" to a conforming
caller. The test calls both with the documented types.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:44:21 +00:00