mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:55:52 +01:00
[PR #153] gta6rt: --upscaler-picker RVA[,KIND] replaces the game's choice of upscaler (FSR on Series X) #205
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#205
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/153
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/9885📝 Commits (5)
432f850gta6rt: --upscaler-picker RVA[,KIND] replaces the game's choice of upscaler (FSR on Series X)e6174c0mods: an "upscaler" section, and mods/fsr_series_x (off by default)db346fddocs: point to the FSR mod from the README and the docs index996c12dgta6rt: parse hook options in place, and say when an RVA has no direct call0b55cf0Merge remote-tracking branch 'origin/main' into fsr-series-x📊 Changes
7 files changed (+245 additions, -31 deletions)
View changed files
📝
README.md(+7 -0)📝
docs/README.md(+1 -0)📝
docs/modding.md(+46 -0)➕
mods/fsr_series_x/mod.json(+6 -0)📝
runtime/src/main.cpp(+69 -31)📝
runtime/src/mods.h(+72 -0)📝
runtime/test/mods_test.cpp(+44 -0)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Resubmitted unchanged: this was
#7006, 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 (0b55cf08b), which merges cleanly onmain7e39a81ea. The test reports from other contributors are on#7006.Claimed in the coordination issue as: https://github.com/ItsNotRexed/Leonida/issues/6750#issuecomment-7105596665 (FSR in the Series X render path).
Depends on:
#9883(the title's FFX calls answered by the PC upscaler; with#9877,#9882) for FSR to actually run on a PC. Related:#9884(the console type the title reads from the registry); this PR works without it.In short
The game asks one question at startup: "which upscaler should I use?" It answers "FSR" only on a Series S (720p → 1080p) and "my own" on a Series X. This PR lets the runtime answer that question instead, so the game keeps its Series X resolution and settings but upscales with FSR. Nothing in the game file is changed: every call to that one function is redirected to a small thunk that returns "FSR". The FSR calls themselves then go to AMD's PC FSR through the upscaler shim (
#9883).How to turn it on: run with the PC upscaler shim (
LEONIDA_FFX_PC=1andLEONIDA_FFX_DIR), and either set"enabled": trueinmods/fsr_series_x/mod.jsonor pass--upscaler-picker 7E93F0. WithoutLEONIDA_FFX_PC=1, FSR (kind 7) stays off either way and the log says why; another kind (e.g.,6) needs no shim.What and why
A static look at my own copy of the 1.0.2.1 executable (nothing executed; only names, counts and the RVA here):
ffxCreateContext,ffxDestroyContext,ffxDispatch,ffxQuery; noffxConfigure) all come from one class with a single static instance.ConsoleMode, see#9884) and the FFX path is available; otherwise 6. The console type is tested in 70 places, but never inside the FFX class, so the class doesn't gate itself.So a Series X configuration renders through the game's own upscaler, and FSR is tied to the Series S configuration (720p → 1080p).
The change
gta6rt --upscaler-picker RVA[,KIND](hex RVA, decimal KIND, default 7) hooks the picker with the existing result-override thunk (code_hooks.h, as--view-mode-getter), so every pick returnsKIND: the game keeps its Series X configuration and upscales through FFX, which#9883serves with AMD's PC upscaler.leonida::mods::override_upscaler/upscaler_kind_slotinmods.h;docs/modding.mdgets an "Upscaler" section with the 1.0.2.1 RVA (0x7E93F0) and how to find it in another version.The setting (second commit): a mod's
"upscaler"section ("use":"fsr"or"game", and"picker_rva") does the same without the command line; the last enabled mod with one decides and--upscaler-pickerwins over it.mods/fsr_series_xships with it, off by default. FSR is only applied withLEONIDA_FFX_PC=1: without the PC upscaler shim the game's FFX calls would reach the package's console DLL, so the runtime leaves the game's choice and logs why.A menu to switch upscalers (an overlay, or later the game's own settings) and other backends (DLSS, XeSS through the same shim) are follow-ups once the game shows frames.
Review fixes (third commit): the hook options are parsed in place by
leonida::mods::parse_hook_option(no pointer into a destroyed temporary, nothing allowed after the last number), shared by--upscaler-picker,--archetype-lookupand--view-mode-getter; the archetypeARGis now refused unless 0 or 1. A hook that redirects no direct call logsnot hooked: no direct call to it (wrong RVA for this executable?)instead of "hooked".Tested
Windows cross-build (clang-cl + xwin) under Wine 11, CachyOS:
mods: 41 checks, 0 failures (the parser:RVA,RVA,KIND, a 0x prefix; refused:7E93F0x,7E93F0,6x,7E93F0,,,6,0, a leading space or sign,RVA,256, an RVA past 32 bits). Earlier: 35 checks (new: no kind passes the game's choice through;RVA,7makes every pick 7; the"upscaler"section parsesfsr/game, refuses an unknown upscaler or a missing/bad RVA, and the last enabled mod decides).--dry-runwithmods/fsr_series_xenabled: withoutLEONIDA_FFX_PCit logsFSR upscaler not applied: it needs LEONIDA_FFX_PC=1; with it, the same 4 calls are redirected.gta6rt --dry-run game_scarlett_master.exe --game-dir <my package> --upscaler-picker 7E93F0(executable SHA-256e95020b2…a08993, the one in#6715):[rt] mods: upscaler picker at RVA 0x7E93F0 hooked, upscaler 7: 4 direct call(s) redirected(three calls and a tail jump, as counted statically). The dry run executes no image code.gta6rt --dry-runon the retail executable through the real command line:7E93F0,7and7E93F0,6hook 4 calls;7E93F0x,7E93F0,6x,7E93F0,,--view-mode-getter 7E93F0,1and--archetype-lookup 7E93F0,2print usage (exit 2);7E93F1logs "not hooked: no direct call to it" for all three options.gta6rtyet (RT-5), so FSR at the Series X resolution is unmeasured; the render size per quality mode is the FFX wrapper's own.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.