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).
No GPU fixture set tfe or lwe, so run_gpu_tests.py never reached the
status write a SHADER-1266 fix adds. cs_imgload_tfe is cs_imgload with
tfe on both image_loads: each status VGPR is seeded with 1000 and added
into the stored sum, so a stale status moves every texel by 2000 while a
correct one (0, every texel resident) gives cs_imgload's result, checked
by vk_store_test's unchanged load mode.
Registered next to cs_imgload in check.py and run_gpu_tests.py, and in
the two unit tests that list the vk_store_test fixtures. Red on main
until a SHADER-1266 fix lands; green with #8771's change on an RTX 4060.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The xmem shims record what they hand the title (XMemAlloc, XMemAllocDefault,
XMemVirtualAlloc, the title's VirtualAlloc); an address outside those ranges
is left as it was and counted. The submit-time scan reads only the
CBV/SRV/UAV slots the bound table's root signature declares, and its cost
is accumulated per ExecuteCommandLists. Section 3.3 describes the three
places addresses are replaced and the two kinds of copy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The static-sampler readback loop skipped the 1.1 OPAQUE_WHITE_UINT row and
#8706's 1.2 UINT_BORDER_COLOR + TRANSPARENT_BLACK row, so both were checked
by their registered S# words only. They now sample the R8G8B8A8_UINT view one
tile to the right (every texel is the border) and expect 1 and 0 in every
channel, alpha included. Unregistered, the lookup falls back to the clamping
sampler and reads the texture's edge, which fails the check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SetHapticMotorState's saturating end time uses UINT64_MAX, which
gameinput.cpp only got through a transitive include. Include <cstdint>
directly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A shader_path.txt that is not UTF-8 no longer throws out of Create*PipelineState: MSVC's STL reports the failed
conversion as std::system_error, not filesystem_error. configured_shader_directory() returns the reason instead,
and DeviceState::library() catches every std::exception, so the "invalid translated shader path" message prints
and the pipeline fails. The reader of the file itself is unchanged.
- A relative LEONIDA_SHADERS no longer follows the current directory: gta6rt makes it absolute at startup, next to
--game-dir and --overlay, and ShaderLibrary::load keeps an absolute folder for the modules it reads later.
Tests: d3d12_shader_path_test (new, Windows, no GPU) and a relative-folder check in shader_library_test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
RADV imports host memory through amdgpu userptr, which libdrm creates anonymous-only, so it refuses a
view of a pagefile-backed section with EPERM (RX 9060 XT under Wine, found in review), and the layer
answers with its fallback as designed. The section-view case now accepts that outcome and checks the
fallback resource exists; NVIDIA and AMD's Windows driver still import it, and the readback is still
checked there.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A root view or buffer V# may name the title's own memory outside any
slot-133 buffer (a per-frame constant ring, #8862 section 3.5). The
layer now makes a 64 KiB-aligned window of those pages in the GPU
address arena, copies it before every submission like a slot-133
shadow, and names that copy instead: for root views when set, for V#s
the layer writes, and for buffer V#s the title writes into a bound
CBV/SRV/UAV table itself, rewritten in place before each submission.
Counters per kind, LEONIDA_TITLE_WINDOWS_MB caps the windows (64 MiB).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shape bobcatchris reports from the retail boot on #7403 (2D 128x1, no flags, one sample, the
full mip chain), with Alignment 0 and 4096. On this head it takes texture_format's existing path (an
R8 image, as on main) and GetResourceAllocationInfo sizes it at the default 64 KiB and the 4 KiB
small-resource alignment. Passes on an RTX 3060 and a UHD 750 with Vulkan validation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Xbox device slot 133 places a buffer at the title's own VA, about 1.5 TiB on
Windows, while a translated shader computes heap_base + console VA with
heap_base the arena's device address. A root view or V# naming that VA
missed the buffer. The layer now translates an address inside a
title-placed buffer where it writes it (root CBV/SRV/UAV, CBV and buffer
SRV/UAV V#s): to the arena offset of the slot-133 shadow, which now lives
in the GPU address arena when it fits, or to an import's device address
minus heap_base. New tests: title_va_alias_test, d3d12_title_va_test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without Resizable BAR, UPLOAD buffers live in system memory, outside the GPU
address arena. Their VA is (device address - arena base), which wraps when
the buffer's device address lies below the arena's. stage_khr_instances
refused such an entry as an overflow (va > UINT64_MAX - heap_base), so the
whole TLAS build list failed with "invalid copy or resolve" and nothing was
submitted. The unsigned sum heap_base + va wraps back to the buffer's device
address, as the replay's other VA translations already rely on.
Measured on an RTX 5060 (NVIDIA 621.14) on a board without Resizable BAR:
d3d12_indirect_rt failed with "RayQueryKHR ARRAY expected hit=1 miss=0, got
hit=0 miss=0" on every run; LEONIDA_ARENA_LOG=1 shows the upload buffers at
VA 0xfffffffffe07xxxx. Adds d3d12_indirect_rt_upload_sysmem, which runs the
same test with LEONIDA_UPLOAD_SYSMEM=1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A count above zero with no descriptor array now returns {UINT64_MAX, 0}
like the other bad-input paths instead of forwarding a null array to the
PC GetResourceAllocationInfo2. xs_proxy_mock_test checks the refusal and
that PC slot 68 is not reached.
ACP 936 represents U+00E9 but not its U+00C9 uppercase, so the
module-name fixture failed on native Windows as well as the loader.
Keep the ANSI case check and require both spellings when selecting
the test letter.
Claim: https://github.com/ItsNotRexed/Leonida/issues/8504#issuecomment-7111536474
AI-assisted (Codex).
register_static_samplers took D3D12_SAMPLER_FLAG_UINT_BORDER_COLOR on
any border colour without a _UINT enum value for a pair D3D12 does not
define, and skipped the sampler: CreateRootSignature succeeded, the S#
was never registered and the shader sampled through the fallback
sampler.
The static enum has no transparent _UINT value, so the 1.2 flag on
TRANSPARENT_BLACK is how a root signature writes the integer border
(0,0,0,0). D3D12 serializes and creates it; the pairs it refuses are the
flag with the float OPAQUE_BLACK and OPAQUE_WHITE, which stay refused.
d3d12_descriptor_test gets a fifth static sampler row for it.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A GDKX title makes its own top-level Win32 window before its first PresentX, and PresentX names no window: on the PC
the frames belong in that window. Measured on a retail executable: by the first PresentX the process has one visible,
unowned top-level window on a thread of its own, and only hidden windows besides (IME, a driver's dummy window). The
PresentX wiring (#2490) built a hidden window of its own instead, so a running title showed a blank window.
find_title_window picks the visible, unowned, non-tool top-level window of the process with the largest client area.
It sends no message: a lookup that read window titles with GetWindowTextW (a WM_GETTEXT sent across threads) stopped
the retail title at its first PresentX, because the title's window thread was not pumping at that moment.
title_window_test makes the windows on a thread that never pumps; the negative control shows a sent WM_GETTEXT times out
there, while the lookup answers at once and skips the larger hidden, owned and tool windows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The mirror's last SetEventOnCompletion can still be pending on the real
fence when the proxy goes away, and no call cancels it. Closing the event
then lets a later completion set a closed or reused handle whenever
another reference keeps the real fence alive. Close it only when the
proxy's Release destroyed the fence. Reported by Hiiva in review.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tests/test_gfx10_descriptors.py parses every format row and failed on the A8 row (found by
dcastell1 on #7403): its trailing comment had a parenthetical, so the row was not read (94 != 95),
and once read, gfx10_name() derived "8_KHR" from VK_FORMAT_A8_UNORM_KHR. The row's comment is now
exactly GFX10_FORMAT_8_UNORM, with the explanation on the line above, and gfx10_name() drops an
extension suffix (_KHR, _EXT) before reading the layout.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>