upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/main.cpp
AgeCommit message (Collapse)Author
7 daysd3d12: --precompile-pipelines builds the skip-listed programs unless ↵Jan Trencansky
--skip-listed LEONIDA_SKIP_COMPUTE is a play-time setting: the game drops the listed programs' dispatches. The precompile also refused to build them, one "not built (LEONIDA_SKIP_COMPUTE)" line each and no override. Players run it with the game's environment (docs/running.md), so their skip list kept those programs out of the journal for good, and a later run without the list compiled them in the game. - precompile_compute_pipelines builds every compute entry; with the list set it says how many entries it names. --skip-listed leaves them out on purpose, one line each. - The last line counts the whole run: built (compiled, from a cache), journaled already, being built by another process, failed; left out: of those the list names, not buildable, filtered out (--filter, the size bounds and now --limit too). - BuildHost::unbuildable no longer checks the list. The compile server checks it itself, as before: the game that starts it drops those dispatches. Docs: running.md, linux_proton.md and d3d12_vulkan.md no longer give compile time as the reason for the skip list. The 89-167 s per program came from wave64-emulated packs; with a native wave64 pack on an RX 7900 XTX (RADV, Mesa 26.3.1, Wine) all 721 library programs of 2 MiB or more built, 360 of them in 170 s on 32 threads, 2.5-32 s each, the largest (13 MiB) in 28.5 s alone, at a peak of 14 GiB of RAM. Two world runs on that card with all of them journaled and no skip list took them all from the journal and got no further than runs with the list (a stop with the GPU idle at 404 s; an idle-queue device loss at about 214 s, which also happens with the list set). Their output is not checked, so the docs keep the skip list and LEONIDA_RT_AS=off as the setting of our longest runs. Test: precompile_skip_list (test/check_precompile_skip_list.cmake) precompiles two synthetic compute modules, one of them listed, three times: with the list set both are built; with --skip-listed only the other one is, and the listed one is named; a second run into the first journal finds both journaled. It fails on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 daysKeep main's watchdog switch and say where the peek default wentJan Trencansky
f0611b752 took the executable's addresses out of the code. Two behaviours changed with it; the removal stays, the changes are now explicit: - runtime/src/main.cpp: the watchdog kick runs again only with LEONIDA_TITLE_WATCHDOG=0, as on main; LEONIDA_TITLE_WATCHDOG_KICK only supplies the two RVAs it needs. Either variable alone leaves the watchdog armed and the loader says so once (before this commit the kick ran whenever LEONIDA_TITLE_WATCHDOG_KICK was set). - scripts/windows-boot/boot.ps1 no longer has the game- and session-state RVAs built in, so LEONIDA_PEEK has no default and the RESULT states read "?" unless LEONIDA_GAME_STATE_RVA and LEONIDA_SESSION_STATE_RVA are set. The script now warns when they are not, and runtime/README.md (LEONIDA_PEEK, LEONIDA_TITLE_WATCHDOG and _KICK rows), scripts/windows-boot/README.md and docs/first_run_ui.md say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 daysMerge main into integration/boot-combined (RT-BOOT-COMBINED)Jan Trencansky
Conflict in runtime/shims/d3d12_xs_device.cpp, proxy_copy_descriptors_simple: keep this branch's copy_null_rtv_marks call and main's fsdraw::enabled() gate for the descriptor-copy diagnostic. tools/rdna2spirv.py merged without a textual conflict, but #1662 on main calls restore_dot4_inline_sel in the exact re-anchoring path, which this branch had deleted. The merge puts main's function back so that call resolves; the next commits reconcile it with the dot4 op_sel rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 daysMerge main c1e1ef0b8 into RT-POST-LOAD-GPU-MEMORY (#2098)Jan Trencansky
Two conflicts: - d3d12_com.cpp, note_direct_heap_indexing: main's console_descriptor_table_va(cbv_srv_uav_base_) for the tracked table, with this branch's per-site once() flag instead of note_once on every draw. - d3d12_vulkan_device.cpp, PipelineState::build_compute: this branch's body (build_compute_pipeline, journal, compile helper). main's dev_status::Build around the compute create moves into build_compute_pipeline, next to the pipeline_profile::DriverCall, so the status line still names the compute pipeline in the driver. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 daysMerge pull request #2137 from Snooozs/dev-overlayaslan2142
runtime: LEONIDA_DEV_OVERLAY shows what the runtime is doing over the title's window (RT-DEV-OVERLAY)
8 daysruntime: LEONIDA_DEV_OVERLAY shows what the runtime is doing over the ↵Snooozs
title's window (RT-DEV-OVERLAY) A click-through window of its own with its own thread: frame and submission rate, a submission's CPU time by phase, the phase running now, pipeline builds in flight, indirect draws, cores and memory. Off by default. submit_phases keeps per-phase counts of the threads inside a phase, so overlapping submissions of several queues leave none behind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 daysMerge main into t-drive-overlayJan Trencansky
docs/boot.md: main added LEONIDA_WRITE_DIR / LEONIDA_SAVE_DIR to the --overlay bullet and a new "Under Wine on Linux" section; keep both and the T: paragraph of this branch after main's sentences. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 daysMerge branch 'integration/translator-fixes' into local/boot-combinedubiquitarianism
# Conflicts: # runtime/src/main.cpp
8 daysImprove post-load GPU memory and pipeline handling (RT-POST-LOAD-GPU-MEMORY)Moriz82
Fall back to a dedicated buffer allocation when the shared arena fills. Update console descriptors and resource backing, preserve pipeline cache entries, and replay mesh records using bounded indirect arguments. Keep scripted input available until read and cover the runtime and translator paths with synthetic tests. Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com> Co-authored-by: ivanepsilondelta <264061546+ivanepsilondelta@users.noreply.github.com>
8 daysMerge pull request #1612 from Tyrannys/first-run-pad-focusaslan2142
runtime: the first-run UI keyboard pad reads keys only with focus (RT-FIRST-RUN-PAD-FOCUS)
8 daysgta6rt: threads that fault together wait for the first one's cache write ↵kurrutako
(RT-SESSION-CACHE-AT-EXIT) A boot ended with eight title threads faulting within a second. Each entered the filter; the ones after the first returned at once and went on to the title's filter, which can end the process during the write. The write now runs under std::call_once, so they wait for it. AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 daysgta6rt: keep the exit-save filter when the title installs its own ↵kurrutako
(RT-SESSION-CACHE-AT-EXIT) The retail title calls SetUnhandledExceptionFilter (from api-ms-win-core-errorhandling-l1-1-0), which replaced the runtime's filter: a title fault at 354 s ended the process without the cache write. The title's call is now served by the runtime, which keeps its filter installed and passes the exception on to the title's. AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 daysd3d12: write the session pipeline cache when the run ends with the device ↵kurrutako
alive (RT-SESSION-CACHE-AT-EXIT) pipeline_cache.session.bin was written only in ~Device. A title never releases its device, so a real boot kept none of what it compiled: not after a normal exit, a console close or a crash, and every boot built the world start again. save_pipeline_caches_at_exit writes the session cache of every live device (a registry the Device constructor and destructor keep), once per process, after stop_pipeline_compiles. A build still running on another thread is given wait_ms, then the previous file is kept, as at teardown. gta6rt calls it at the run's exit, at a console close, and from an unhandled-exception filter (a fault in the title or its DLLs, the int3 after a device loss), which then passes the exception on, so the exit code is unchanged. d3d12_compile_teardown_test's exit case checks that the file is written with the device alive, and only once. AI-assisted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 daysMerge main into first-run-pad-focusTyrannys
Keep main's first-run profile without GPU completion labels and this branch's focused keyboard pad (LEONIDA_KEYBOARD_PAD=1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 daysd3d12_xs: list slots 71/72 have one writer, the list values, when they track ↵Jan Trencansky
the list Found by the comparison agent, not by a failing test. #1723's console list slot path still handed slots 71 and 72 to main's GPU-label hook (record_gpu_label, LEONIDA_GPU_LABELS) when its own list values track the list (track_values, on by default with LEONIDA_LIST_VALUES). The --first-run-ui profile sets LEONIDA_GPU_LABELS=1 (runtime/src/main.cpp). With both on, two threads stored to one title address, one from a Vulkan command buffer's completion and query, the other from the part's fence and a D3D12 timestamp query. A late label could rewind a rising counter or split a begin/end pair. The suite did not catch it: xbox_gpu_label_completion submits its real list straight to the queue, so only the label path landed there. The list values are the right owner. They land slots 71 to 74 in queue order behind the gates, and they also do the waits the labels cannot do. Now: - The label hook runs only for a list the list values do not track (LEONIDA_LIST_VALUES=0, bundles). Each handoff is counted in ListValueStats::labels_handed. - The --first-run-ui profile no longer sets LEONIDA_GPU_LABELS. runtime/README.md and docs/first_run_ui.md say so. - xbox_gpu_label_completion runs its label section with the list values off, as it always measured the label path alone, and checks that all five writes went there. A new section turns both on and records one write32 and one write64 on a tracked list, submitted through the queue proxy. Each lands exactly once: writes_landed == 2, labels_handed == 0, and the values are in memory. With the old condition this section fails at line 136 (labels_handed was 2), on llvmpipe and the iGPU. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 daysIntegrate post-story-load memory, queue and Vulkan runtime changesMoriz82
Preserve physical window aliases across remaps, order console list values, and replay bounded indirect graphics with captured draw state. Coordinate pipeline lifetime, texture refresh and queue teardown. Add synthetic CPU and GPU coverage for the integrated paths. Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com> Co-authored-by: ivanepsilondelta <264061546+ivanepsilondelta@users.noreply.github.com>
9 daysRemove the title's executable addresses #984 brought in; read them from the ↵ubiquitarianism
environment #984 (273b3bdf9) put RVAs and file offsets of the retail executable into code, docs and scripts. The code paths that need one now read it from an environment variable and are off when it is unset; the docs and examples say the location is measured locally. - runtime/src/main.cpp: the hang-watchdog kick takes its trap and kick RVAs from LEONIDA_TITLE_WATCHDOG_KICK="<trap RVA>,<kick RVA>" (hex), still only when the trap instruction is at the first one. Unset, the watchdog stays armed, as before by default; LEONIDA_TITLE_WATCHDOG=1 keeps it armed, and LEONIDA_TITLE_WATCHDOG=0 without the RVAs says once that it needs them. The LEONIDA_PEEK example uses placeholders. - runtime/shims/startup_trace.h: the transient-pool dump fires at the int3 that LEONIDA_POOL_DIAG_AT names (`<module>+0x<offset>`, as the trace prints it), off when unset. - scripts/windows-boot/boot.ps1: LEONIDA_PEEK's default comes from LEONIDA_GAME_STATE_RVA and LEONIDA_SESSION_STATE_RVA (no peek when unset), and the RESULT digest matches those values; the examples and README use placeholders. - runtime/README.md documents LEONIDA_TITLE_WATCHDOG_KICK and LEONIDA_POOL_DIAG_AT. - docs/fspx.md, docs/d3d12_vulkan.md, docs/movies.md, docs/embedded_shaders.md and a comment in runtime/shims/d3d12_xs_alloc_size.h drop the addresses and offsets. This follows the same change on the earlier integration branch (#1495).
9 daysruntime: the first-run UI keyboard pad reads keys only with focus ↵Tyrannys
(RT-FIRST-RUN-PAD-FOCUS) gta6rt --first-run-ui defaulted LEONIDA_KEYBOARD_PAD to always, so keys typed into another program reached the title's consent pages (#1552, hazard 1). Default to the focused mode 1; scripted presses still run while the window is unfocused. tiny_game checks the default under run_tiny_first_run_ui, which now clears the caller's setting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 daysfirst-run-ui: a variable that is set but empty does not count as the ↵Jan Trencansky
caller's setting run_tiny_first_run_ui clears two variables by passing them empty. Windows cannot hold an empty variable, so there they are unset; under Wine they exist, and the profile's size-only query reported them as set and kept them. The test failed that way on #939's head too. The profile now reads the first character, so an empty value gets the profile's default on both. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
9 daysMerge the #984 result as of 71a783e56 into the #939 mergeJan Trencansky
Fourteen commits the #984 merge gained after 8a242efeb: its own failing tests (xmem_test under Wine, check_tls_index0, vk_bindless_grow, xs_present_lazy_test), the console-heap probe and the poke experiment behind their switches, Python tool fixes, and the title watchdog default. No conflicts. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
9 daysmain: the title's hang watchdog stays armed unless LEONIDA_TITLE_WATCHDOG=0Jan Trencansky
The retail title runs its own hang watchdog: when the game's main loop has not reported for 30 seconds, it ends itself. #984 kept that watchdog from firing by default, because under the runtime the game thread can wait longer than that, for example while the driver compiles pipelines on the first boot after a driver update. By the maintainer's decision the watchdog now stays armed by default, as on the console, so a real hang still ends the run. LEONIDA_TITLE_WATCHDOG=0 turns on the runtime thread that keeps it from firing; as before, it only acts in the build the watchdog was measured in. The README's environment table and the log line say the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 daysMerge the #984 result (main + RT-PROTON-STORY-LOAD) into #939Jan Trencansky
The base is 8a242efeb, the merge of main and #984. 68 files conflicted; they were resolved in seven groups by one rule: the same change in two forms keeps the base's form, everything only #939 has is kept, and where the two solve one problem in two ways the base's is the frame and #939's plugs into it. A, the Xbox proxy (d3d12_xs_device.cpp/.h, d3d12_xs.cpp, d3d12_xs_pso_stream.cpp/.h, d3d12_xs_alloc_size.h, d3d12_xs_desc_clean.h, device_proxy_test.cpp, queue_proxy_test.cpp): the base's files with #939's additions ported in. Device slot 57 asks #939's NativeGraphicsFactory first and falls back to the base's proxy_create_graphics_pipeline_from_native_code on E_NOTIMPL. Kept from #939: the providers (texture lease, raw texture view, resource by address, constant view, descriptor mapping, depth-stencil UAV, texture pages), the title-backed descriptor mirror, slot 13's feature answers, GPU labels on list slots 71/72. Dropped: #939's duplicates of the boot ladder routes, its fallback window, its slot 133 stand-in. A2 (xs_proxy_mock_test.cpp): the base's test with #939's slot 70 raw-buffer case; presentation cases follow #939's rule that a device which ever had a handler has no queue fallback. B1, the Vulkan device (d3d12_vulkan_device.cpp, d3d12_com.cpp/.h, shader_library.h, queue_families.h, pipeline_cache_file.h, startup_trace.h): one lazy-pipeline mechanism, the base's; #939's pending_base_compile and first_use_backend_pipelines dropped, prepare_on_bind and cold_graphics_compile kept. create_texture keeps the base's signature; #939's deferred backing is folded into the base's placed-memory binder. #939's quad lists as triangle indices. B2, the D3D12 tests (d3d12_existing_heap, a8_dimensions, pipeline_cache_seed, title_va, rect_list, shader_library, loader_tls_index0, draw, compute, xmem_placed, shader_library_corpus): the base's tests where both carry the same case, #939's cases added (rebound tables, linear texture map, large vertex batch, executable shaders, default A8 views). C, the backend (vulkan_replay.h, vulkan_backend.h, vulkan_bindless.h, vulkan_scratch.h, vulkan_present.h, rect_list_geometry.h, vk_test_device.h, vk_pipeline_check.cpp, vk_store_test.cpp, bindless_sizing_test.cpp, replay_texture_barrier_test.cpp): the base's prepare_draw and lazy compute, its #1055 release rule and its rectangle generator; #939's rectangle variants, GPU quad index expansion, 1D/3D and depth-stencil UAVs, the label fence on the base's submit. D, memory, services, presentation (xmem.cpp/.h, xg_xs.cpp, xg_xs_test.cpp, title_va_alias.h and its test, main.cpp, frame_pacer.h, xbox_present.cpp/.h; xgameruntime_offline.cpp for one comment): the base's xmem with #939's label hooks, file-backed sections and pin_mapped_data; both texture computers in xg_xs.cpp, the base's answering first; --first-run-ui kept without host speech in its profile. E, build, tools, docs (runtime/CMakeLists.txt, make_game.py, tools/rdna2spirv.py, tools/shader_disasm.py, scripts, tests, docs; docs/README.md and tests/test_exe_shaders_stage.py beyond the conflicts): the base's v_dot4 decode, #281's disassembler form and tests/semantic/test_fspx_dot4_op_sel_disasm.py dropped; the base's executable-shader step with #939's cache fix; 366 registered tests. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
9 days[integration] Linux/Proton and native Windows: boot through the story load ↵Moriz82
(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>
9 daysruntime: connect native pipelines and title resources to the offline ↵Rain156
first-run UI Build on the public frame-loop integration in #321. Carry the texture-view and depth work from #213 and #261, the layout provider from #461, the responsive window from #526, and the rectangle generator from #682. Integrate the Xbox constant-buffer row addressing measured in #513 and the draw-time rectangle selection in #722. Keep all fixtures synthetic. The Windows GPU path resolves title-owned shader objects, retires geometry uploads per submission, materializes texture views on use, maps linear surfaces, and delivers completed GPU label writes. A first-run UI launch selects the tested settings for these paths.
9 daysfile_system: T: is a folder of each process's own in the overlayJan Trencansky
T:\ mapped to <overlay>\.gta6rt-temp, one folder shared by every run and kept between runs. The title makes its crash dump and crash log there with CREATE_NEW, and a name an earlier run (or a second process) had left failed with ERROR_FILE_EXISTS (80), so no report landed (old upstream issue 7913, measured by Spacecer2 under Wine 11.22). T:\ now names <overlay>\.gta6rt-temp\<YYYYMMDD-HHMMSS-mmm>-pid<id>, the process's start time in UTC and its id, made on the first T: call. The start time keeps a reused process id (Wine hands each fresh prefix the same small ids) out of an old run's folder. T:\.. cannot climb into the shared folder, T:\ itself still cannot be removed or moved, and earlier runs' folders are kept so their crash files can be read. GAME: and G: are unchanged. rt::fs::scratch_dir() returns the folder, and the startup line names it: "console paths: GAME: -> ..., writes -> ..., T: -> ...". The two CMake checks of that line (run_tiny_game_console_paths, run_tiny_game_dir) and the synthetic test of the first now expect the T: part. file_system_test: a CREATE_NEW of a name earlier runs left in .gta6rt-temp succeeds and lands in the process's own folder; the folder is stable for the process; a second process (the test started again) creating the same name on the same overlay succeeds in a folder of its own; GAME: reads and writes are unchanged. On main these fail with ERROR_FILE_EXISTS (80), in this process and in the second one. Restored from old upstream PR 8161 and ported onto the new main: the folder is made through main's win32_io_path, so long overlay roots keep working, and the scratch-folder check of the write-open path is kept. Main's long-overlay T: check now finds scratch.bin in the process's own folder below .gta6rt-temp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 daysmerge follow-up: the test tree builds againMumogg
- xmem.cpp: rt::xmem::commit_physical_range and commit_physical_pages exist for the run-mapped xmem too (pages are committed when allocated, so they only check the range), and main.cpp registers the slot 133 hook as main does. - vk_test_device.h: VK_EXT_external_memory_host and host_pointer_alignment are back next to the A8 render target probe; d3d12_existing_heap_test and d3d12_xmem_placed_test use them. - xs_proxy_mock_test.cpp: the stack's version, which tests the proxy that is in the tree (the automatic merge left two list mocks in one switch). - d3d12_xs_device.cpp: no include of vulkan_replay.h, which the proxy tests without Vulkan headers could not compile, and the diagnostic that needed it is gone. Every target builds with clang-cl 22.1.8 + xwin. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
10 daysMerge main (9ec34cdff) into the frame-loop boot stackMumogg
The stack is ladder-frame (ASTROWwwW's integration of the retail boot pull requests) with the old pull requests 7604, 7286, 7584, 6446, 8591, 7384, 7535, 7448, 9137 and 9419 and local fixes on top. main carries many of those commits as ancestors without their content, so the merge was made against main's tree, not its history: nothing main dropped is dropped again here. Resolved by hand: - d3d12_xs_device.cpp and frame_pacer.h: the stack's Xbox-ABI layer, plus main's uncapped pacer and its two new registration hooks (set_placed_at_va_pages_hook is called before slot 133's handler; the console descriptor heap handler is stored but slot 14 still uses the title-backed heaps of old PR 7021). - xmem.cpp, xmem_test.cpp: the stack's run-mapped physical pages. main's commit-on-touch xmem with the two view-protection fixes it lost (7e8e3c1db, 954fcb106) boots to 50,468 pipelines and then fails a submit with an unknown resource, so it is not used here yet. - acphal.cpp, acphal_test.cpp, vulkan_replay.h (acceleration structure copy), README: main's. - CMakeLists.txt, build_runtime.ps1, d3d12_com.cpp, d3d12_vulkan_device.cpp, shader_library.h, docs: both sides. Measured (Linux, Wine 11.21 staging, RTX 5070 Ti, driver 615.78.08, clang-cl 22.1.8 + xwin, own 1.0.2.1 copy, network off, LEONIDA_GRAPHICS_STAGE_LAYOUT=1, 300 s): 50,470 pipeline states created, 197,998 ExecuteCommandLists with none failed, 148,467 DrawInstanced, 99,008 PresentX. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HxBQf4pXH8PWpC5oZsM4bt
10 daysMerge TreXito's unmerged PRs: translator fixes, fuzzers, CPU emulation, ↵ubiquitarianism
xapu/chad shims Merged from the TreXito/mangrove copy of the original repository, which carried contributor pull requests that were never merged here. Kept: rdna2spirv fixes (ds_append/ds_consume, v_ldexp_f16 under MODE.FP_ROUND, thread-group SGPR, fma exact), the differential fuzzers (dot, vint, wint, vrel, cvt, f16misc, salu, mode) with their tests, the exe/import fail-fast and int3 cause tools, Zen 2 instruction emulation (cpu_emulation.h) and the xapu.dll/chad.dll shims. Not taken, because they conflict with different implementations already on main: the D3D12 Xbox-ABI layer, xmem, acphal, loader TLS, f64_diff, DirectStorage (needs the typed-error zlib inflate), and the copy's own MANGROVE.md and README changes.
10 daysMerge remote-tracking branch 'origin/pr/8964'ItsNotRexed
# Conflicts: # runtime/shims/d3d12_vulkan_device.cpp
10 daysMerge remote-tracking branch 'origin/pr/9754'ItsNotRexed
# Conflicts: # scripts/build_runtime.ps1
10 daysgta6rt: --init/--run stop with a clear message on a host without AVXSenne Cools
The game runs AVX code from its TLS callbacks on, so a CPU or OS without AVX (a QEMU qemu64 guest) died with a bare 0xC000001D. Check CPUID.1 AVX/OSXSAVE and XCR0 YMM state first, print one line and exit 4 (3 is LEONIDA_UNIMPLEMENTED=stop). --dry-run is unchanged and LEONIDA_SKIP_CPU_CHECK=1 skips the check. AI-assisted.
10 daysd3d12_xs: slot 133 commits the buffer's xmem pages before the host-pointer ↵Raavve
import xmem commits physical pages on first touch (#7556), so a range the title has mapped but not written yet is still MEM_RESERVE when it places a buffer on it through device slot 133, and the Vulkan layer's import (#7218) refuses reserved pages and answers with its fallback buffer, which the title's writes never reach. Slot 133 now calls a registered pages hook (set_placed_at_va_pages_hook, next to set_placed_at_va_handler) with the buffer's range before the handler; gta6rt registers rt::xmem::commit_physical_range. A failed commit is logged once and the handler still runs. Textures don't call it. The Vulkan layer doesn't link xmem. Tests: xs_proxy_mock_test checks the hook order, arguments, failure and texture cases; the new d3d12_xmem_placed_test places a buffer on untouched xmem physical pages and checks the fallback without the hook, and with it the import and a GPU copy reading the CPU's writes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 daysd3d12: a shader path that is not UTF-8 never throws, and LEONIDA_SHADERS is ↵Jan Trencansky
absolute - 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>
10 daysMerge branch 'pr7111' into ladder-frameASTROWwwW
# Conflicts: # docs/runtime_imports.md # runtime/CMakeLists.txt
10 daysMerge main into runtime/emulate-zen2-insns (keep both the cpu_emulation and ↵Krashgamer
xg_xs test targets) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 daysMerge remote-tracking branch 'upstream/main' into rebase/4313-on-042c5f378Roberto0953
# Conflicts: # runtime/CMakeLists.txt # runtime/README.md # runtime/src/pe_loader.cpp
10 daysgta6rt: emulate the Zen 2 instructions a desktop CPU may lack ↵Krashgamer
(INSERTQ/EXTRQ, CLZERO, MONITORX/MWAITX, CLWB) The executable uses SSE4a INSERTQ, CLZERO and MONITORX/MWAITX (AMD only) and CLWB (Intel since Ice Lake) without asking CPUID (docs/cpu_features.md). A host without one raises #UD there. src/cpu_emulation.h adds a vectored handler that recognises those encodings at the faulting RIP, does the same work on the CONTEXT and steps past the instruction; gta6rt installs it before any image code runs, after the startup trace's handler so it runs first. One [rt] line names what the host lacks, one more per instruction on first use. cpu_emulation_test checks the decoder on hand-written encodings, the bit-field helpers and apply() on a synthetic CONTEXT, then runs every form for real from an executable buffer: natively on a Zen host, through the handler on an Intel one, with the same expected values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
10 daysruntime: retain import report when initialization fails (#6835)RaulOrtizSanchez
Squash-merged after diff review of PR #6835 - RT-486: Retain the import binding report when initialization fails
11 daysMerge remote-tracking branch 'origin/main' into rt/exe-tls-slot0mariuslozo-boop
# Conflicts: # runtime/src/main.cpp
11 daysMods: first-person view, the base (camera section, view-mode getter hook)ItsNotRexed
mod.json gains "camera": {"view_mode": "first_person"|"default", "first_person_value", "contexts"}. gta6rt --view-mode-getter RVA hooks the game's view-mode getter with a result-override thunk (code_hooks.h: the original runs, then its result and first argument go through leonida::mods::override_view_mode), so the listed contexts answer first person and the others keep the game's mode. mods/first_person asks for it on foot. docs/modding.md records why switching a mode is enough: the game's tuning data refers to a first-person view (FirstPersonDirectionDot, UseFirstPersonCameraMatrix on cloth capsules, FIRST_PERSON_VIEW hit-reaction recovery, a firstpersonshooter HUD texture; RDR2's engine branch), while GTA V's camera class names are not present by joaat. The context numbering and the first-person enum value (4, GTA V's) are manifest settings to confirm in the executable. ctest mods and code_hooks cover the parser, the override and the thunk on x64 code in memory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 daysMods: the archetype hook, --archetype-lookup RVA[,ARG]ItsNotRexed
code_hooks.h hooks a function of the mapped game image without patching it: every direct call/jmp rel32 to it in the image's executable sections is pointed at a thunk that saves rcx/rdx/r8/r9 and xmm0-3, passes the hash (argument 0 or 1) through leonida::mods::active().remap() and jumps on to the original. gta6rt installs it right after mapping, before any image code runs, and logs how many call sites it redirected, so a --dry-run with a candidate RVA tells whether it is the archetype lookup. ctest code_hooks runs the thunk on x64 functions written into memory (call and tail jump remapped, r8 preserved, a branch elsewhere left byte for byte). With the executable's lookup RVA this applies mods/mandy_prison_intro; docs/modding.md says how to find it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 daysMods: mod.json manifests with archetype swaps, and the Mandy prison-intro modItsNotRexed
gta6rt reads mods/<folder>/mod.json next to gta6rt.exe (or --mods DIR), checks each and logs it. An archetype swap names two models the game has (by joaat name or 0x hash): when the game asks for `from` it gets `to`. The swaps are loaded into leonida::mods::active(); they apply once the game's archetype lookup is hooked, which needs the executable's address for it (docs/modding.md, Day one). mods/mandy_prison_intro swaps Lucia's player model player_story000_00 (0xE472B687) for cs_mandy (0xD7C0CDFF), the ids measured in the packs tables; mods_test checks joaat reproduces both. Conditions narrower than "always" are refused until a hook provides mission state. No game data in either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 daysLoader: reserve TLS index 0 at start, with a home template that copies the EXE'smariuslozo-boop
Fixes from the review of the index-0 change: - The lazy move at the first executable map stopped other threads and swapped their slots, guarded by a "thread is inside gta6rt.exe" check. That is not enough: MSVC keeps &ThreadLocalStoragePointer[_tls_index] across calls (zlib_inflate saves it at [rbp-80h] across memset, push_back and inflate_codes, then reads _Init_thread_epoch through it), so a thread stopped in the heap or memset still reads the wrong slot afterwards. The move is now rt::reserve_tls_index0(), done once at process start: gta6rt calls it from a .CRT$XCT initializer, before its own static initializers and before any of its threads; the CRT startup frames above it hold no TLS slot address (checked in the disassembly). It swaps slots 0 and home on the calling thread only; no thread enumeration, suspension, TEB writes or TlsAlloc mark are left. - The home clone's block was the helper's 514 bytes, smaller than gta6rt.exe's 1398-byte TLS. The home clone is now written from gta6rt_tls_host.dll with its TLS directory pointed at a new 16 KiB export, gta6rt_tls_home_template, filled with a copy of the EXE's template and its alignment (LdrpAllocateTls copies End - Start and ignores SizeOfZeroFill, so the zero fill is part of the range). Every new thread then has a fresh copy of gta6rt.exe's TLS at the home index from its first instruction, so no adoption step or window before the helper's DLL_THREAD_ATTACH is left. The mapped template is checked against the EXE's after the load. - The owner is GetModuleHandleW(nullptr) with _tls_index 0, not any module whose index reads 0. - A primary helper without gta6rt_tls_host_set_thread_event is refused. - An executable that does not get index 0 (no reservation, or another executable holds it) is refused by --run and --init with an error; its /GA code would read and write another module's TLS through slot 0. The README no longer says it "reads the first one's slot 0". - Thread attach installs every module's copy before any TLS callback runs, as Windows allocates all blocks before the first DllMain. - Tests: loader_tls_index0 (runs) checks this EXE's block moving from slot 0 to the home index by identity, the home template's size and content, and that the getter reads slot 0 with its _tls_index pointing elsewhere (fails for a non-/GA build of the fixture); loader_tls_index0_threads reserves while threads are being created, with one suspended thread that has no TLS array yet and tiny_thread_hook.dll running test code before the helper's DLL_THREAD_ATTACH; loader_tls_index0_noreserve maps without the reservation. The tiny_tls_ga.cpp comment names the real test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 daysMerge pull request #3303 from Doffi4ItsNotRexed
11 daysMerge pull request #2957 from Shrey RatnaItsNotRexed
11 daysMerge pull request #2070 from jaybeebabageyusItsNotRexed
11 daysMerge upstream main into RT-207Doffi4
11 daysRuntime: preserve Unicode in the console path diagnosticDoffi4
11 daysMerge remote-tracking branch 'upstream/main' into 2070-lifecycle-fixjaybeebabageyus
# Conflicts: # runtime/src/pe_loader.cpp # runtime/src/pe_loader.h # runtime/test/loader_tls_test.cpp
11 daysruntime: scope the TLS clone purge to ownerless files, clean clones before ↵jaybeebabageyus
ExitProcess, per-slot thread-event errors The startup purge deleted every leonida_tls_host_*.dll in the temp directory, so it could remove the clone of a concurrent process that had copied its helper but not reached LoadLibraryExW yet. Clones are now copied to a staging name and renamed into place while the copy step's guard handle is open, so a final-name clone never exists without a handle, and the purge skips files that fail an exclusive open or whose owner process (from the file name) is still alive. std::atexit cleanup never ran on the --run path because main ends with ExitProcess; the loader now exposes cleanup_tls_clones() and main calls it before ExitProcess (atexit still covers normal exits). on_host_thread_event wrapped the whole slot loop in one try/catch, so one throwing slot killed the events for every other module. The catch is now per slot, and the detach path releases the slot even when the callbacks threw, instead of leaking the block to the OS loader. README and the initialize_tls comment no longer claim only one mapped TLS module can be live; the loader_tls_test gained purge-ownership and explicit-cleanup checks.
11 daysgta6rt: GAME: and the overlay are absolute, so a bare image name has a game ↵Shrey Ratna
folder `gta6rt --run game.exe`, started from the game folder, set the game folder to the image's parent path, which is empty for a bare name: the run printed `console paths: GAME: -> , writes -> overlay` and every GAME: open failed with ERROR_PATH_NOT_FOUND. A relative --game-dir or --overlay worked only until the title changed its current directory. main.cpp now makes both absolute at startup (keeping the path as given if absolute() fails). New CTest run_tiny_game_dir: tiny_game's opt-in `game-file` check moves its current directory, then reads GAME:\tiny_game_probe.txt; check_game_dir.cmake runs it by bare name and with `--game-dir .`. Without the fix both fail (open errors 3 and 2); with it both pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
11 daysInitialize game command line before process-attach callbacksadmin
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
11 daysStartup trace: never replace an existing file; write UTF-8 onlyLeonardo Guimaraes
Review on #1756 (Vonsek): - The trace is opened before the loader reads the image, so `wb` could truncate an input named by mistake (the image itself). open() now uses "x" mode and fails with EEXIST on an existing path; gta6rt says so and exits with 2. - OutputDebugStringA text is in the ANSI code page. It is converted to UTF-8 before quoting, so a byte such as 0xE9 no longer breaks the JSON lines. Host module names now come from GetModuleFileNameW, converted to UTF-8, for the same reason. startup_trace_test: an existing file is refused with EEXIST and its bytes survive, the trace stays off; an ANSI debug string with 0xE9 appears as its UTF-8 form and the whole file is valid UTF-8.
11 daysRuntime: opt-in startup trace (gta6rt --trace FILE)Leonardo Guimaraes
Writes one JSON object per line, flushed per event: module maps, TLS callbacks, DllMain results, the first call of each unimplemented import with its caller as module+RVA, OutputDebugString text, exceptions with module+RVA and a short unwind, and the exit code. A vectored handler records and returns EXCEPTION_CONTINUE_SEARCH, so behaviour is unchanged. Off by default. startup_trace_test builds a synthetic DLL image (no game data) and checks each event kind.
11 daysMerge remote-tracking branch 'origin/main' into runtime-reserve-fixed-baseAsh Hopkins
# Conflicts: # runtime/CMakeLists.txt # runtime/src/main.cpp
11 daysruntime: reserve a relocation-less image's range before arm64 Wine takes itAsh Hopkins
An EXE without .reloc can only run at its ImageBase (0x140000000 by default; RT-22 asks whether the game's is one). Under arm64 Wine on macOS (CrossOver's arm64 bottles, x86-64 code under FEX) the process's own start-up allocations sit at 0x100000000 and up before gta6rt runs, so such an image failed with "preferred base is taken". gta6rt now starts itself again suspended when the image has no relocations and its range is not free, reserves [ImageBase, ImageBase + SizeOfImage) in the new process, resumes it and returns its exit code; the loader commits the image inside that reservation. LEONIDA_BASE_RESERVED tells the new process, which does not start itself again. Where the range is free at start-up (Windows, x86-64 Wine) nothing changes. tiny_game_fixed is the stand-in game linked /FIXED at 0x140000000; run_tiny_game_fixed and run_tiny_game_fixed_exit_code run it. Arm64 bottle (CrossOver Preview 20260821, M2 Max): it maps at 0x140000000 and both tests pass, --dry-run and --init exit 0; with the relaunch disabled it fails as before. The Rosetta (x86-64) bottle passes them too. The in-process loader tests that build relocation-less images (loader, pe_loader_bounds, unimplemented_policy) still fail on arm64. AI-assisted. No game files.
11 daysgta6rt: map GAME: console paths, and send writes to an overlay (RT-97)HQasper
A mapped title names its files on the console's drives, but nothing mapped them: the file calls went straight to the host and --game-dir was only used to find modules, so the first file a title opens at boot would fail. New shims for CreateFile*, FindFirstFile*/FindNextFile*/FindClose, GetFileAttributes*/ GetFileAttributesEx* and DeleteFile* (kernel32, kernelbase and the api-ms-win-core-file sets) map a GAME: path under --game-dir, and send every open that can write and every delete to --overlay (default <game-dir>\overlay), which reads and listings prefer. A write-open copies the package file into the overlay first, so OPEN_EXISTING keeps its bytes, and a delete of a package file leaves a marker instead of removing it, so the package is never modified. A path that climbs above GAME: with ".." or names another drive is refused with ERROR_INVALID_NAME. A path without the prefix is still a host path. The prefixes and the overlay come from ivall/xcl (GPL-2.0-only), as facts only, no code. file_system ctest: 43 checks over folders in %TEMP%, covering mapping and case, copy-up and read preference, a new file in folders the package lacks, delete and re-create, the merged listing, host-path passthrough, the escape refusal and the narrow variants. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
11 daysprocess shim: keep the game's command line wide so a non-ASCII argument ↵Emre Demir
can't crash --run (RT-84) main.cpp turned each game argument into std::filesystem::path::string(), which throws std::system_error under MSVC when the ANSI code page has no mapping for a character. Nothing caught it, so gta6rt --run ended in 0xc0000409 before the game started. set_command_line now takes wide strings: __wargv and GetCommandLineW hold the arguments exactly, and the narrow argv and GetCommandLineA are their CP_ACP text from WideCharToMultiByte, which replaces a character the code page lacks instead of failing, as the CRT does. process_cmdline_test passes wide arguments and checks a Latin-1 one and a Greek, Cyrillic and CJK one that no single-byte code page holds, so the crash is covered on every system locale, not only 1253.
12 daysgta6rt: refuse more than one of --dry-run, --init and --run (#886)Felix Croasdale
--dry-run --run set both flags, so the dry run initialised the modules and called the entry point. gta6rt now takes exactly one mode and prints the usage (exit 2) otherwise. Three ctest cases run the stand-in game with two modes and fail if it is mapped or run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 daysRuntime: add opt-in D3D12 call tracingmohamedsaad.lahlou
12 daysruntime: LEONIDA_UNIMPLEMENTED=log|fail|stop policy for imports with no bindingAlxcBTW
An unimplemented import used to return 0 silently, which is S_OK for an HRESULT function with its out parameters never written. The thunk now passes the caller's return address and rcx/rdx/r8/r9 to a shared stub, and LEONIDA_UNIMPLEMENTED picks the behaviour: - log (default): exactly as before. - fail: E_NOTIMPL for imports known to return HRESULT (D3D12Create*/Serialize*, CreateDXGIFactory*, XGameRuntimeInitialize, and the GDK XAsync/XTaskQueue/ XUser/XStore/XGameSave/XPackage/XGameUi families minus their documented void/bool/int functions), 0 otherwise. - stop: print the import, the caller as module+RVA and the four argument registers, then break under a debugger or exit with code 3. --dry-run now counts unimplemented imports by return class. The stub zeroes xmm0 and has unwind info, so float callers and debuggers are unaffected. unimplemented_policy_test builds a synthetic image and checks all three modes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
12 daysruntime: rename shims/process.h to process_shim.h (it hid the CRT's ↵ItsNotRexed
<process.h> from <thread>) With runtime/shims on the include path, <thread>'s #include <process.h> found #316's header, so _beginthreadex was undeclared in d3d12_com.cpp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 daysRuntime: install static TLS for mapped imagesKam471
12 daysRuntime: gta6rt --run, and a stand-in game executable run through the loaderIAmNotSiob
gta6rt --run <exe> [-- args] maps and binds the executable, initialises its modules and calls its entry point on a game thread. shims/process.cpp answers the process-level imports through the game's own import table: argv/argc and GetCommandLine are the game's (UCRT api-set/ucrtbase and msvcrt forms), and exit/_exit/quick_exit/ExitProcess/abort end the run with that exit code instead of the host. gta6rt then exits with the game's code directly, so the game's atexit handlers don't run during host shutdown. tiny_game.exe (CTest run_tiny_game, run_tiny_game_exit_code) does what a title does in its first second: arguments, a static initializer, a 4 MiB allocation, a file round trip, a thread, and xgameruntime.dll imports, which the shim registry answers instead of the link-time stub. thread_local and a C++ exception are opt-in (LEONIDA_RUN_TLS / LEONIDA_RUN_EH) until #93 and #176.
12 daysRuntime: initialise a loaded module's TLS and DllMainAyinaki
Mapping an image never ran anything. TLS callbacks and DllMain were documented as the caller's, and nothing called them, so a module that needs either could not be brought up at all. Loader::initialise() now allocates the module's TLS slot, copies the template and SizeOfZeroFill into it, writes the slot index into the image, runs the TLS callbacks with DLL_PROCESS_ATTACH, then calls the entry point of a DLL as DllMain. Every address it follows is bounded like the rest of the loader: the directory, the template, the index, the callback table and each callback, with a 1 MiB ceiling on the block. Only DLLs get DllMain; an EXE's entry point has a different signature and stays the caller's to run, and --dry-run still runs nothing. The tests build an image whose TLS callback and DllMain are real machine-code stubs that store a sentinel, so they check the code actually executed rather than merely being parsed.
13 daysInitial commit: Leonida, build-it-yourself PC port groundworkNotRexed
Shader pipeline (carve, FSSM unpack, gfx1013 disassembly, RDNA2 to SPIR-V), asset export via rpf9-explorer's Core (submodule), PE loader and shim skeleton, and make_game.py, which builds from the user's own copy of the game. No game data, keys or executables are included. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>