[PR #153] gta6rt: --upscaler-picker RVA[,KIND] replaces the game's choice of upscaler (FSR on Series X) #205

Open
opened 2026-11-26 20:17:08 +01:00 by 4ld0 · 0 comments
Owner

📋 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)

  • 432f850 gta6rt: --upscaler-picker RVA[,KIND] replaces the game's choice of upscaler (FSR on Series X)
  • e6174c0 mods: an "upscaler" section, and mods/fsr_series_x (off by default)
  • db346fd docs: point to the FSR mod from the README and the docs index
  • 996c12d gta6rt: parse hook options in place, and say when an RVA has no direct call
  • 0b55cf0 Merge 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

Carried over from old PR 9885 by AwkGrep256 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9885, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
AwkGrep256: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references 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 on main 7e39a81ea. 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=1 and LEONIDA_FFX_DIR), and either set "enabled": true in mods/fsr_series_x/mod.json or pass --upscaler-picker 7E93F0. Without LEONIDA_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):

  • The title's FFX calls (ffxCreateContext, ffxDestroyContext, ffxDispatch, ffxQuery; no ffxConfigure) all come from one class with a single static instance.
  • A short function returns an upscaler object by number: that instance for 7, another static for 6, null otherwise.
  • The picker passes it its number: 7 only when the console type is Series S (type 6, from the registry 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 returns KIND: the game keeps its Series X configuration and upscales through FFX, which #9883 serves with AMD's PC upscaler. leonida::mods::override_upscaler / upscaler_kind_slot in mods.h; docs/modding.md gets 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-picker wins over it. mods/fsr_series_x ships with it, off by default. FSR is only applied with LEONIDA_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-lookup and --view-mode-getter; the archetype ARG is now refused unless 0 or 1. A hook that redirects no direct call logs not 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:

  • ctest 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,7 makes every pick 7; the "upscaler" section parses fsr/game, refuses an unknown upscaler or a missing/bad RVA, and the last enabled mod decides).
  • --dry-run with mods/fsr_series_x enabled: without LEONIDA_FFX_PC it logs FSR 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-256 e95020b2…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-run on the retail executable through the real command line: 7E93F0,7 and 7E93F0,6 hook 4 calls; 7E93F0x, 7E93F0,6x, 7E93F0,, --view-mode-getter 7E93F0,1 and --archetype-lookup 7E93F0,2 print usage (exit 2); 7E93F1 logs "not hooked: no direct call to it" for all three options.
  • Not tested: the effect in game. The title doesn't reach its first frame under gta6rt yet (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.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/153 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `old-pr/9885` --- ### 📝 Commits (5) - [`432f850`](https://github.com/ubiquitarianism/leonida/commit/432f850470c1f54e49c22135d95a00e9f6fbf30d) gta6rt: --upscaler-picker RVA[,KIND] replaces the game's choice of upscaler (FSR on Series X) - [`e6174c0`](https://github.com/ubiquitarianism/leonida/commit/e6174c0ec0ed352026305febdcf884c3e083e397) mods: an "upscaler" section, and mods/fsr_series_x (off by default) - [`db346fd`](https://github.com/ubiquitarianism/leonida/commit/db346fd1d2c3f464b9dd2f2e4a806951b286ade0) docs: point to the FSR mod from the README and the docs index - [`996c12d`](https://github.com/ubiquitarianism/leonida/commit/996c12d5ac195334f299fa0d2c19db24cb64bbc0) gta6rt: parse hook options in place, and say when an RVA has no direct call - [`0b55cf0`](https://github.com/ubiquitarianism/leonida/commit/0b55cf08b1c7711ccf84de33864d0ba95c780f73) Merge remote-tracking branch 'origin/main' into fsr-series-x ### 📊 Changes **7 files changed** (+245 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 Description > Carried over from **old PR 9885** by `AwkGrep256` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9885`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `AwkGrep256`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references 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 on `main` `7e39a81ea`. 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=1` and `LEONIDA_FFX_DIR`), and either set `"enabled": true` in `mods/fsr_series_x/mod.json` or pass `--upscaler-picker 7E93F0`. Without `LEONIDA_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): - The title's FFX calls (`ffxCreateContext`, `ffxDestroyContext`, `ffxDispatch`, `ffxQuery`; no `ffxConfigure`) all come from one class with a single static instance. - A short function returns an upscaler object by number: that instance for **7**, another static for **6**, null otherwise. - The **picker** passes it its number: 7 only when the console type is Series S (type 6, from the registry `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 returns `KIND`: the game keeps its Series X configuration and upscales through FFX, which `#9883` serves with AMD's PC upscaler. `leonida::mods::override_upscaler` / `upscaler_kind_slot` in `mods.h`; `docs/modding.md` gets 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-picker` wins over it. `mods/fsr_series_x` ships with it, **off by default**. FSR is only applied with `LEONIDA_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-lookup` and `--view-mode-getter`; the archetype `ARG` is now refused unless 0 or 1. A hook that redirects no direct call logs `not 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: - ctest `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,7` makes every pick 7; the `"upscaler"` section parses `fsr`/`game`, refuses an unknown upscaler or a missing/bad RVA, and the last enabled mod decides). - `--dry-run` with `mods/fsr_series_x` enabled: without `LEONIDA_FFX_PC` it logs `FSR 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-256 `e95020b2…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-run` on the retail executable through the real command line: `7E93F0,7` and `7E93F0,6` hook 4 calls; `7E93F0x`, `7E93F0,6x`, `7E93F0,`, `--view-mode-getter 7E93F0,1` and `--archetype-lookup 7E93F0,2` print usage (exit 2); `7E93F1` logs "not hooked: no direct call to it" for all three options. - Not tested: the effect in game. The title doesn't reach its first frame under `gta6rt` yet (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](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#205
No description provided.