Repository navigation
Conversation
…ype reads A title does not import XSystemGetDeviceType: xgameruntime.lib links it in, and that copy opens HKLM\Software\Microsoft\Windows NT\CurrentVersion\OEM and reads the DWORD ConsoleMode; a missing key or value means PC. The package's XCurl.dll and libHttpClient.GDK.dll both carry it. No shim served those registry calls, so they reached the host, which has no such key, and the title was told it runs on a PC whatever the shim's export or LEONIDA_DEVICE_TYPE said. RegOpenKeyW, RegOpenKeyExW, RegQueryValueExW and RegCloseKey are now served under advapi32.dll and the two registry API sets those DLLs import them by. They answer that one key with the ConsoleMode of the device type the export reports and pass every other key, root and handle to the host. advapi32.dll stays a host module. xgameruntime_test runs the title's sequence against the registry functions the loader would bind. docs: the sequence in runtime_imports.md; an entry for xvalkyrie. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Tested 42f3708 on Windows 11, MSVC (VS 2022 Build Tools) RelWithDebInfo, with RTX 5080 (driver 616.92) and AMD Radeon iGPU gfx1036 (driver 26.10.1) each selected in turn (
No negative control run. AI-assisted. |
|
Tested 42f3708 on Windows 11 (26300), RX 9070 (AMD 26.11.1), VS 2022 Build Tools, RelWithDebInfo with SDL3: pass Full AI-assisted |
shayderrr
left a comment
There was a problem hiding this comment.
Review
Reviewed change in PR #3775: xgameruntime: answer the registry key a title's own XSystemGetDeviceType reads, so it is not told "PC".
Scope: docs/related_projects.md, docs/runtime_imports.md, runtime/shims/registry.cpp, +2 more
Diff: +259 / -1 across 5 file(s).
The change stays inside the stated scope and the touched files line up with the description. No unrelated production paths are pulled in, and the stated behavior is directly exercised by the diff. I'm approving this one.
Reviewed by shayderrr via automated batch review.
|
Thanks @kotorvr - I went through xgameruntime: answer the registry key a title's own XSystemGetDeviceType reads, so it i... and the diff around |
Kam471
left a comment
There was a problem hiding this comment.
Reviewed head 42f3708d81b38298b35395335f46851ca00410f6. Windows 11 26200, MSVC 19.44.35207, Ninja, RelWithDebInfo, Vulkan 1.4.363.
xgameruntime 1/1, 151 checks, git diff --check clean. New checks: the four registry calls resolve under advapi32 and both api-ms registry sets; the title's own XSystemGetDeviceType reads 7 (Series X); ConsoleMode is 0x64; LEONIDA_DEVICE_TYPE 2..8 reaches it; a key merely ending in OEM and the same path under HKCU are not answered. Red: reverting runtime/shims/xgameruntime.cpp exits 1 with 1 of 136 checks failed (the block stops at the missing bindings).
Verdict: ready to merge. advapi32 stays a host module; only the four names are overridden at import binding, and the test confirms another key still answers as the host does. Limitation: GetProcAddress on the host advapi32 still returns the host function, so a title resolving these dynamically is unaffected.
First-frame: without this, a retail title is told it runs on a PC and takes its PC device path. Related: #4821 changes the same device-type policy (Series S default), so the two will need a small rebase together.
Claim (new RT item, no ID assigned yet)
AI-assisted (Claude Code). I ran everything under "Tested" on Windows.
Problem
runtime/shims/xgameruntime.cppexportsXSystemGetDeviceType(Series X, orLEONIDA_DEVICE_TYPE). A title never calls that export.xgameruntime.liblinks the function into the title, and that copy asks the registry:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\OEM;ConsoleModeand closes the key;XSystemDeviceType. If the key or the value is missing, its answer is PC.The package's own
XCurl.dllandlibHttpClient.GDK.dllboth carry that function (read statically; nothing was run). The first importsRegOpenKeyW,RegQueryValueExWandRegCloseKeyfromapi-ms-win-core-registry-l1-1-0.dlland-l2-1-0.dll, the second fromadvapi32.dll.No shim served those calls, so they went to the host, where that key does not exist. The title's function therefore answered PC, whatever the shim's export or
LEONIDA_DEVICE_TYPEsaid. The new test prints what the sequence returns against the host's registry before it runs: 1 (PC) on this machine.Other layers: sammwyy/xvalkyrie (GPL-3.0) describes the same read in
docs/research/gdk-titles.mdand reports a retail title that indexes a jump table with the result and crashes on the PC value. ivall/xcl (crates/xcl/src/hle/kernelx.rs, GPL-2.0-only) and omonkeyz/xbox-emulator (crates/compat/compat-common/src/gdk/hook.rs, GPL-3.0) answer the same key; those two share lineage, so together they are one reading, and xvalkyrie is a separate code base. Facts only, and the code is my own. I read xcl's source (GPL-2.0-only) while working on this, so please check the provenance.Change
xgameruntime.cppservesRegOpenKeyW,RegOpenKeyExW,RegQueryValueExWandRegCloseKeyunder the three DLL names above. For that one key (any case, separators around it tolerated) they answer a pseudo-key whose only value is the DWORDConsoleMode, set from the device type the export reports. Every other key, root and handle goes to the host's function unchanged.LEONIDA_DEVICE_TYPEnow reaches the title: 2..8 pick the matchingConsoleMode; 1 (PC) leaves the key to the host, which is how a PC answers (on a machine that really has that key, the title then reads the host's value); 0 answers a value the title does not know.registry.cpp:advapi32.dlljoins the host modules of which only a few functions are replaced, so a title'sLoadLibrary("advapi32.dll")still gets the host module and not a pseudo-handle. That list feedsowns_dllfor every caller; nothing registeredadvapi32.dllnames before, and the fullctestrun below shows nothing relied on the old answer.docs/runtime_imports.md: a section describing the read.docs/related_projects.md: an entry for xvalkyrie.Not done:
RegGetValueW, the ANSI forms, and the enumeration and subkey functions (RegEnumValueW, an open with the pseudo-key as its root) are not served, because neither DLL imports them for this read. Given the pseudo-key, the host's function answersERROR_INVALID_HANDLE. If the executable reads the key another way,--dry-runshows the import.Test
xgameruntime_testgainstest_console_mode_registry. It has a stand-in for the title's function (open, query with a 4-byte buffer, close, map the value) and runs it against the registry functions the loader would bind:LEONIDA_DEVICE_TYPE2..8; with 1 it reads 1 through the host (checked only when the host has no such key, which the test asks the host first);REG_DWORD, 4 bytes),ERROR_MORE_DATAfor a short buffer,ERROR_FILE_NOT_FOUNDfor any other value name, and closes;HKLMkey opened through the shim returns the sameCurrentBuildbytes as the host does directly; a key that merely ends inOEM, and the same path underHKEY_CURRENT_USER, are the host's;advapi32.dllis not a module the shims own.Tested
Windows 11 (build 26200), MSVC 19.44.35222, Visual Studio's CMake and
ctest3.31.6 with Ninja, RelWithDebInfo, built byscripts/build_runtime.ps1. Basef847748c(main).xgameruntime_testwith the new test onmain's shims: 1 of 95 checks failed (the twelve registry names do not resolve; the test stops there, after printing that the sequence answers 1 against the host's registry). With the change: OK, 110 checks.gta6rt --dry-runon my own copy of the two DLLs: the four registry imports of each are nowshim(XCurl.dllshim=28 host=112,libHttpClient.GDK.dllshim=30 host=168, 0 unimplemented).ctest --test-dir runtime/build -C RelWithDebInfowithLEONIDA_GAME_DIRset, on this head: 140 run, 134 passed, 6 skipped, 0 failed (gameinputis disabled, no SDL3 here). NVIDIA GeForce RTX 4090, driver 32.0.16.2114, for the Vulkan tests in that run; this change needs no GPU.python -Iontests/test_docs_links.py,test_docs_repo_paths.py,test_docs_list_items.py,test_docs_design_rows.py,test_i18n_index.py: OK.Overlap: several open PRs add runtime classes to
xgameruntime.cpp(#3363, #3408, #3476, #3505, #3550, #3657). This adds one block afterXSystemGetDeviceTypeand its own small shim table, apart from the class tables and the big export table. #3601 (mine) adds adocs/related_projects.mdentry in a different place.🤖 Generated with Claude Code