Repository navigation
Conversation
When LEONIDA_COMPAT_DIR names a folder, an import whose DLL is a file there binds to that DLL's export. Windows loads it from the full path (LoadLibraryExW, DLL-load-dir + System32 search, never the game folder), so it takes no manual static-TLS slot. The step comes before shims, bundled modules and the host, and the DLL owns all imports of its module: a missing symbol binds to the unimplemented thunk, not a shim. Unset or empty: no change. Measured on the 1.0.2.1 executable: --dry-run goes from 20 unimplemented imports (AcpHal 9, chad 5, xapu 5, XCRDAPI 1) to 0 with the four matching omonkeyz/xbox-emulator crates in the folder (and their TOMBOX_* static initializers turned off; see runtime/README.md). loader_test: five cases with a synthetic OS-loadable DLL (no game data). AI-assisted (Claude Code).
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Independent Windows host review (commit \7fc6fa72851362875b7105087030ac651db92b35)
What changed:
untime/src/pe_loader.cpp:- Introduces \LEONIDA_COMPAT_DIR\ environment variable check during \Loader::resolve.
- When set, attempts to load matching console DLLs via \LoadLibraryExW\ with \LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32.
- Strict contract preservation: if a compat DLL is loaded, it owns all entry points for that module (unresolved exports bind to the unimplemented stub rather than cross-polluting with a shim).
untime/test/loader_test.cpp:- Tests covering opt-in loading, missing DLL fallback, and shim isolation.
Verification:
- Verified on Windows 11 host with MSVC / C++17.
- \pe_loader\ contract remains intact; no state splitting between host and shim.
- Clean diff: pure standard library / Win32 APIs, no game files.
LGTM!
|
Reproduced a Windows failure for a relative
The file check succeeds, but |
|
Tested 7fc6fa7 merged with main 5d74c27 under Wine: pass On: Linux, Ubuntu 24.04, cross-built with clang-cl 19.1.1 + lld-link + xwin SDK (RelWithDebInfo), run through Wine 9.0; CPU only, no game files.
AI-assisted (Claude Code). |
|
Tested
AI-assisted: yes |
Claim: #8683 (comment) (new item: opt-in compat-module directory)
What
Loader::resolvegets one opt-in step. WhenLEONIDA_COMPAT_DIRnames a folder and an imported DLL is a file there, Windows loads that DLL from its full path (LoadLibraryExW,LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32, never the game folder) and its exports serve the import. Being a host load, it takes no slot of the mapper's static TLS.host;[rt] compat: <dll> -> <path>is printed once per DLL.LoadLibraryof the same names does not yet (follow-up).runtime/README.md, "Compat modules".Why
On
main,gta6rt --dry-runover the 1.0.2.1 executable leaves 20 imports unimplemented: AcpHal 9, chad 5, xapu 5, XCRDAPI 1 (matches #8280 minus the twoxg_xsimports served since). omonkeyz/xbox-emulator (GPL-3.0-or-later) has full implementations of all 20 as cdylibs with the console names and exports. This PR only adds the loader seam and copies no code; whether to use those DLLs stays a separate choice.Does not overlap #6885 / #6981 / #7009 (C++ stubs: with the variable unset they bind exactly as before), the GameInput ordinal PRs, or stop 13.
Measured (own 1.0.2.1 copy, nothing of it in this PR)
--dry-run, variable unsetshim=63 host=432 module=72 unimplemented=20(unchanged frommain)--dry-run, folder with the four xbox-emulator crates built atf89e410shim=63 host=452 module=72 unimplemented=0; the four package DLLs still mapCaveat, also in the README: with their defaults, those crates run static initializers at load (
.CRT$XCU) and one of them hooks the process, after which the package DLLs mapped later fail to map (module=0). WithTOMBOX_GDK_EARLY=0 TOMBOX_GDK_RUNTIME=0 TOMBOX_OSHOST=0 TOMBOX_PAD=0 TOMBOX_TIMER_1MS=0they map; their network guard stays on and denies all traffic.--runstill stops at the XMem stop of the retail boot chain (stops 1/2), with or without the folder; the crash address there varies run to run in both configurations.Tests
loader_test: 93 checks, 0 failed, including five new cases with a synthetic OS-loadable DLL: unset leaves the import unimplemented; set binds and calls the export (returns 42); a compat DLL lacking a symbol does not fall back to its shim; a DLL absent from the folder still binds to its shim; an unloadable file is reported.ctest(full rebuild): 112/113 pass. The one failure,root_signature_oracle, fails identically onmainon this machine (Windows 10 19045's D3D12 serializer rejects root-signature flags0xc7f).scripts/check_no_game_data.pyon the four changed files: clean.Windows 10 Pro 19045, MSVC 2022 Build Tools (
RelWithDebInfo), NVIDIA GTX 1070 Ti, driver 582.78 (no GPU code is touched).AI-assisted (Claude Code).