mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:50:53 +01:00
[PR #152] runtime: answer the console-type registry key (ConsoleMode) from LEONIDA_DEVICE_TYPE #204
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#204
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/152
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/9884📝 Commits (1)
dab4112runtime: answer the console-type registry key (ConsoleMode) from LEONIDA_DEVICE_TYPE📊 Changes
5 files changed (+139 additions, -2 deletions)
View changed files
📝
runtime/CMakeLists.txt(+2 -0)📝
runtime/README.md(+1 -1)➕
runtime/shims/advapi32_registry.cpp(+85 -0)📝
runtime/shims/registry.cpp(+1 -1)📝
runtime/test/xgameruntime_test.cpp(+50 -0)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Resubmitted unchanged: this was
#6990, closed at the repository's move to the organisation (the members-only switch, 22:25–22:49 UTC) with no review comment; reopening it is refused. Same branch and head (dab411220), which merges cleanly onmain7e39a81ea. The test reports from other contributors are on#6990.Claimed in the coordination issue as part of: https://github.com/ItsNotRexed/Leonida/issues/6750#issuecomment-7105596665 (FSR in the Series X render path; this is its first, standalone step and also matters for RT-5).
What and why
The retail executable does not ask
XSystemGetDeviceTypefor its console type. It reads the registry:RegOpenKeyW(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows NT\CurrentVersion\OEM"), then theREG_DWORDConsoleMode, and maps the value itself (a static look at my own copy, nothing executed;RegOpenKeyW,RegQueryValueExWandRegCloseKeyare its onlyadvapi32.dllimports, and that query isRegOpenKeyW's only caller):ConsoleMode0x600x640x680x58/0x50/0x400x10,0x20,0x21,0x30,0x31A PC has no such key, so under
gta6rtthe title saw Pc whileXSystemGetDeviceType(andLEONIDA_DEVICE_TYPE) said Series X. One thing that hangs on it: the title picks its upscaler from it. Series S gets AMD's FFX upscaler (theamd_fidelityfx_loader_xbox.dllpath), every other type the title's own.The change
runtime/shims/advapi32_registry.cpp(new):RegOpenKeyW,RegQueryValueExWandRegCloseKeyanswer that one key fromXSystemGetDeviceType, looked up in the shim table, so the two can't disagree:0x64by default,0x60withLEONIDA_DEVICE_TYPE=6, no key for1(Pc), as the title's mapping reads them back. The key and value names match case-insensitively. Every other key goes to the host's registry.runtime/shims/registry.cpp:advapi32.dlljoins the host DLLs (owns_dll) likekernel32anduser32, so its other names (and the package DLLs' advapi32 imports) still bind to the host's.runtime/README.md: theLEONIDA_DEVICE_TYPErow says the registry follows it.Tested
Windows cross-build (clang-cl + xwin), run under Wine 11 on CachyOS:
xgameruntime_test: OK, 153 checks. New: the three names are shims andadvapi32.dllstays a host DLL;ConsoleModeis0x64by default and0x60withLEONIDA_DEVICE_TYPE=6;1gives no key; case-insensitive key; a size query gives 4; a 2-byte buffer getsERROR_MORE_DATAand 4; another value isERROR_FILE_NOT_FOUND; another key opens and closes in the host's registry.ctest -R "loader|pe_loader|xmem|process_cmdline|winhttp_offline|run_tiny|xgameruntime": 30 of 31 pass.run_tiny_game_abort_exit_codesfails the same way onmain1cc6e3c1under Wine (nativeabortexit codes), so it's unrelated.--run(it doesn't reach the query yet on Linux), native Windows.Nothing from the executable is in the repository or here: only the import names, the public registry path the GDK uses, and the value mapping.
AI-assisted (Claude Code).
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.