Repository navigation
Conversation
…the environment gta6rt had no general way to try a patch of the title's code: the watchdog kick is the only one, with its own variable. LEONIDA_TITLE_PATCH=<rva>:<expected hex>:<new hex> (several, separated by ',' or '+') rewrites places of the executable before it runs, each only when the expected bytes are there, and logs each as applied or left alone. As with the watchdog's RVAs, the values stay out of the runtime (runtime/src/title_patch.h). docs/running.md: one use, the title's own upscaler at a fixed 2/3 scale on Series S (the d3d12 runtime's OWN_UPSCALER and render-scale patches), with why both patches are needed (the title's out-of-memory int3 with the first alone) and the frame rate measured. Test: title_patch_test (parser, checked writes into a page of executable memory). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
#2554 | head 5039a8d (merged cleanly with main 02f71cc) | Minor non-blocking note on |
lixonik
left a comment
There was a problem hiding this comment.
Reviewed the diff and tested merged onto main (493867366) with Ninja Release (MSVC).
The LEONIDA_TITLE_PATCH parser and checked apply() path (VirtualQuery + exact memcmp + VirtualProtect restore + FlushInstructionCache) are clean, bounds-checked against overflow, and well covered by title_patch_test.
Tests run
ctest --output-on-failure -R "^title_patch$": 1/1 passed (title_patch0.02 s).python -m unittest tests/test_ctest_registration.py: 7/7 passed.- Note:
tests/test_docs_env_vars.pyconfirmsLEONIDA_TITLE_PATCHis documented (its only failure on currentmainis the unrelated pre-existingLEONIDA_CLWB_PATCH).
AI-assisted (Antigravity, Gemini).
…reading it Review note on ProjectLeonida#2554 (zmasi): apply() asked VirtualQuery only about the region holding the patch's first byte, so a patch running into an uncommitted or no-access region inside the image would make memcmp read it. Each region the patch covers is now checked (committed, readable, not a guard page) before anything is read (Result::unreadable otherwise), and the protection is changed and restored region by region, so pages with different protections keep their own. Test: title_patch_test case 6 (a reserved page, a no-access page, two committed pages with different protections). With the old apply() the test crashes on the reserved page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@zmasi thanks, you were right: with a patch running from a committed page into a reserved one, the old |
|
Re-verified updated head
AI-assisted. |
Claimed in the coordination issue as: RT-TITLE-PATCH-ENV (#1608 (comment))
What and why
gta6rt had no general way to try a patch of the title's code: the watchdog kick is the only one, with a variable of
its own.
LEONIDA_TITLE_PATCH=<rva>:<expected hex>:<new hex>(several, separated by,or+;+fits alauncher whose own list is comma-separated) rewrites places of the executable before it runs:
bytes) and the place lies inside the image;
appliedorleft alone: ...for each, and names malformed items;LEONIDA_TITLE_WATCHDOG_KICK, the values stay out of the runtime: this is the mechanism, not a list ofpatches (
runtime/src/title_patch.h).docs/running.mdgets one use, measured on NVIDIA withLEONIDA_DEVICE_TYPE=6(Series S):eight
fspx/amd_fidelityfx_upscaler_xbox_*dispatches (wave32, not emulated) at about 400 ms of GPU time perworld frame on an RTX 4070, the largest single item of the frame.
OWN_UPSCALERpatch (d3d12/crates/leonida-loader/src/hooks.rs) switches the title to itsown temporal upscaler. With that patch alone the title stops about 30 s in on its out-of-memory
int3:a title allocator over a 1,277 MiB range (FidelityFX fills it to 1,245 MiB) cannot give a 2.1 MiB block,
because the own upscaler sizes its targets for its largest scale. Traced with the fault report of the companion
pull request (RVA, registers, the allocator's vtable) and the range's fields read with
LEONIDA_PEEK.run goes on.
Tested
title_patch_test(new): parser (both separators, upper-case hex, six kinds of malformed items) and the checkedwrites into a page of executable memory (applied, protection restored, neighbours untouched, a second run refused,
past-the-end refused). 13/13.
cteston this branch (Windows 11, MSVC 2022, Ninja, RelWithDebInfo): 508 of 510 passed, 11 skipped (needthe game or a validation layer). The two failures,
xbox_present(present failed (VkResult -11)) andd3d12_set_descriptor_heaps(recorded_commandscheck), are separate executables that do not buildsrc/main.cppor the new header.tests/test_docs_env_vars.py,test_docs_encoding.py,test_docs_repeated_lines.py,test_docs_list_items.py,test_docs_links.py,test_ctest_registration.py,test_text_encoding.py: OK.scripts/check_no_game_data.pyon the changed files: clean.
935a2cd5bplus local changes) andlibrary/lib_cs_03010translated by Translator: gather a lane mask's bits where a merge takes it as data (SHADER-WAVE-LOOP-EXEC-VOTE) #2501's branch: world median over 280-600 s 0.99 frames/s without the two patches, 1.75 with them
(one 600 s run each, no exception). The picture changes from near black to a lit scene in that run; not compared
frame by frame. Not yet measured on this
main.GPUs tested: NVIDIA GeForce RTX 4070 12 GB, driver 621.40, Windows 11 (ctest and the game runs above)
AI-assisted: yes (Claude Code)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a)