Skip to content

Input: apply VICTORY_KEYS to a connected host pad too - #197

Merged
Marvisak merged 1 commit into
Marvisak:mainfrom
Alpaca-exe:fix/victory-keys-with-connected-pad
Nov 25, 2026
Merged

Marvisak merged 1 commit into
Marvisak:mainfrom
Alpaca-exe:fix/victory-keys-with-connected-pad

Conversation

@Alpaca-exe

Copy link
Copy Markdown
Contributor

Problem

In crates/victory-hle/src/modules/gameinput.rs, VICTORY_KEYS (enabled in diagnostics builds) is injected only via Host::keys(). State::poll() then maps keyboard keys onto the stand-in gamepad (FALLBACK) only when !any_pad.

When an XInput controller (physical or virtual) is connected on the host, FALLBACK is disconnected (DEVICE_DISCONNECTED), so VICTORY_KEYS=30:Enter,35:X feeds the keyboard device only and never presses gamepad buttons in the title.

Change

  • Added Source::scripted_keys (gated on cfg(any(test, feature = diagnostics))) so Host exposes VICTORY_KEYS separately from physical keyboard input, independent of window focus.
  • Added merge_pad / merge_scripted to map scripted keys with allback(...) and merge them onto the first connected host pad in Hub::poll().
  • Kept non-diagnostics builds unchanged.
  • Added unit test scripted_keys_merge_into_connected_host_pad in crates/victory-hle/src/modules/gameinput.rs.

Verification

  • cargo test -p victory-hle --lib (87 passed, 0 failed)
  • cargo test -p victory-hle --lib --features diagnostics (87 passed, 0 failed)
  • cargo clippy -p victory-hle --all-targets and --features diagnostics (0 warnings in gameinput.rs; 1 pre-existing warning in xmem.rs)
  • cargo build --profile diag -p victory --features diagnostics
  • cargo xtask policy (policy: ok)

@DaviTostes

Copy link
Copy Markdown

Tested 64484b4 under Wine 11.22 + vkd3d-proton 3.1 (Arch Linux x86_64, AMD RX 9060 XT, RADV 26.3.1), Windows build of victory-hle: pass.

No game data used.

@jimokulou2-ops

Copy link
Copy Markdown

Tested 64484b4 natively on Windows with a physical XInput pad connected: pass. It fixes the problem the description names. Written by Claude Code (Claude Opus 5.5), which ran the commands; the title ran on my machine.

Setup: Windows 11 Pro 10.0.26300, AMD RX 9070 XT (RDNA4, Adrenalin 26.11.2), Rust 1.98.1 (rust-toolchain.toml), cargo build --profile diag -p victory --features diagnostics. The pad is connected in both runs (input device device=0 connected=true). The title is v1.0.2.1, Series X mode.

Before / after. Both runs use the same VICTORY_KEYS: Enter every 4 s from 10 s on. They also use VICTORY_D3D12_WARP=1 and start from a fresh data folder (first boot).

build result
main d2a4bae The keys never reach the title. It stays on its first screen for the whole 420 s run (21 draws/frame, 11 shaders translated).
d2a4bae + 64484b4 (local merge, no conflicts) The keys reach the pad. The title goes through the intro video and the first-boot screens, and the frame captured at frame 1024 (~78 s) shows "FINISH SETUP?".

That run then ends at 152 s with a WARP device removal (0x887A0004). It happens right after WARP refuses a batch of compute pipelines (0x80070057), as world loading starts, and it is unrelated to input.

Tests on d2a4bae + 64484b4, debug:

  • cargo test -p victory-hle: 87 passed, 0 failed (including scripted_keys_merge_into_connected_host_pad)
  • cargo test --workspace --no-fail-fast: 265 passed, 0 failed, 4 ignored (main alone: 264 / 0 / 4)

Not tested: a physical pad held while scripted keys fire (I did not touch the pad during the runs); more than one connected pad; NVIDIA / Intel.

@zGLados

zGLados commented Nov 24, 2026

Copy link
Copy Markdown

Tested 64484b4 on Windows with an XInput pad connected in slot 0: pass. It fixes the problem the description names.

Setup: Windows 11 Pro 10.0.26300, AMD RX 7700 XT (RDNA3, driver 32.0.32015.7029), Ryzen 7 7700X, 32 GB, title 1.0.2.1. #197 merged onto main at ffe310e (clean merge).

  • cargo test -p victory-hle --lib --features diagnostics: 95 passed, 0 failed (incl. scripted_keys_merge_into_connected_host_pad)
  • cargo build --profile diag -p victory --features diagnostics: ok
  • Without Input: apply VICTORY_KEYS to a connected host pad too #197 (main ffe310e, diag build, VICTORY_KEYS = Enter every 6 s from 10 s to 100 s): stays on the start screen for the whole 4-minute run. The log shows the host pad connected and the stand-in pad disconnected.
  • With Input: apply VICTORY_KEYS to a connected host pad too #197, same keys: the presses reach the title. It goes past the start screen, through the menus and onto the loading screen (frame capture), same as a local run that hides the host pad.

Written by Claude Code (Claude Opus 5.5), which ran the commands; the title ran on my machine.

@dcastell1

Copy link
Copy Markdown

Data point from a Windows/5090 run of the retail title, because this is exactly the variable in question.

Build: 4740e19 (the #185 merge into ffe310e, aycow#4) + MIN_DYNAMIC = 1 << 18 (#747), cargo build --profile diag -p victory --features diagnostics, Rust 1.98.1, MSVC 14.44.35207, Windows 11 10.0.26300, RTX 5090 driver 621.24, no pad attached.

What the title does: it presents at 30.0 fps / 33.3 ms from the start (13 draws/frame), and the first-run screens advance on their own: the accessibility screen, then the player selector, then the legal/copyright page (text read back from the presented frame with OCR, so the screen is identified, not guessed). It stops on LEGALES … Siguiente and stays there.

What does not move it: VICTORY_KEYS at a 4 s Enter cadence from 15 s to 300 s; 20 Down presses before the Enters; and native SendInput (window foregrounded with SetForegroundWindow) with 1.5 s and 3 s holds of Enter. draws/frame does not change across any of those, on any of the three screens.

Since the screens advanced without input, I cannot use the progression as evidence that the keys arrive: the honest reading is that nothing the keys do reaches this title's UI, which matches the title of this issue (VICTORY_KEYS only feeds the stand-in pad). If the stand-in pad is meant to be what the title reads for a GAMEPAD_KIND device, then on this title it is not being consumed: the log shows input device device=4 connected=true, device=5 connected=true and input device callback kind=0x40000 enumeration=2 devices=1, and the screen still waits.

No game data in this comment — screen labels, counts and the environment only. Happy to run a patched build on this box if someone wants the other half of the experiment.

@dcastell1

Copy link
Copy Markdown

Refinement after more attempts on the same box (5090, 1.0.2.1, build 4740e19 + MIN_DYNAMIC = 1 << 18, diag): navigation reaches the title, accept does not.

  • Down held for 8 s on the LEGALES / Copyright page scrolled it and moved the selection onto SIGUIENTE (its tooltip appeared: "Continua a la siguiente pantalla"); draws/frame changed 38 → 33. So arrow keys are consumed.
  • On the next page (CONDICIONES Y POLÍTICAS LEGALES, two checkboxes and Confirmar), Down/Up move the highlight and its tooltip says "Confirma la configuración y empieza a jugar", but Enter (A) never activates it: 3 spaced presses and a 3 s hold change nothing, and the screen stays.
  • Enter earlier did move one screen (SIGUIENTE → the legal page), so I cannot tell that apart from the title advancing on its own after a delay.

That splits the report: the keyboard path (arrows) is delivered, and the stand-in pads A either is not delivered or is delivered to a device the UI does not read. If a real pad is plugged in on this box, I can say which half is broken in one run.

AI-assisted (opencode).

@pfhandler

Copy link
Copy Markdown

Local patches for two issues hit while running GTA VI 1.0.2.1 through VIctory on Linux (GE-Proton 11-14, vkd3d-proton 3.2.0, RTX 4060 Ti 8 GB):

  • VICTORY_NO_HOST_PAD=1 — a connected host pad (e.g. DualShock appearing as XInput pad 0) keeps the keyboard stand-in pad from being enumerated. Hiding the host pad lets VICTORY_KEYS drive the title again.
  • VICTORY_MODE=1920x1080 — the DXGI output mode list is fixed at the console's 3840x2160. Reporting 1920x1080 instead keeps the title's render targets and VRAM use down on smaller hosts (Series S profile + 1080p settled around 3.5 GB VRAM here).

Both are local uncommitted diffs, posted here for reuse. Tested only on the configuration above.

diff --git a/crates/victory-gpu/src/dxgi.rs b/crates/victory-gpu/src/dxgi.rs
index c7f7c45..2535b68 100644
--- a/crates/victory-gpu/src/dxgi.rs
+++ b/crates/victory-gpu/src/dxgi.rs
@@ -219,6 +219,19 @@ struct Mode {
 }
 const _: () = assert!(size_of::<Mode>() == 32);
 
+/// The console's fixed output mode, overridable for hosts smaller than the
+/// console's 4K target: `VICTORY_MODE=1920x1080` reports that instead.
+fn mode_size() -> (u32, u32) {
+    const DEFAULT: (u32, u32) = (3840, 2160);
+    let Some(text) = std::env::var_os("VICTORY_MODE") else {
+        return DEFAULT;
+    };
+    let text = text.to_string_lossy();
+    text.split_once('x')
+        .and_then(|(w, h)| Some((w.trim().parse().ok()?, h.trim().parse().ok()?)))
+        .unwrap_or(DEFAULT)
+}
+
 /// The console's mode list: one 4K mode at 60 Hz (Grand Theft Auto VI looks
 /// for a 120 Hz one to allow 120 Hz frame intervals).
 /// shortcut: fixed mode, not the host display's; report the host's rates if
@@ -242,9 +255,10 @@ extern "system" fn modes(
         return MORE_DATA;
     }
     *count = 1;
+    let (width, height) = mode_size();
     let mode = Mode {
-        width: 3840,
-        height: 2160,
+        width,
+        height,
         refresh: [60, 1],
         format: 0,
         scanlines: 1, // progressive
diff --git a/crates/victory-hle/src/modules/gameinput.rs b/crates/victory-hle/src/modules/gameinput.rs
index a411bd0..da8d66c 100644
--- a/crates/victory-hle/src/modules/gameinput.rs
+++ b/crates/victory-hle/src/modules/gameinput.rs
@@ -1134,6 +1134,11 @@ mod host {
 
     impl Source for Host {
         fn pad(&mut self, slot: usize) -> Option<PadState> {
+            // The keyboard stand-in pad only exists while no host pad is
+            // connected; this hides a host pad the title mis-handles.
+            if std::env::var_os("VICTORY_NO_HOST_PAD").is_some() {
+                return None;
+            }
             if self.empty_until[slot].is_some_and(|until| Instant::now() < until) {
                 return None;
             }

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
@Marvisak
Marvisak merged commit a3169a1 into Marvisak:main Nov 25, 2026

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. On main, VICTORY_KEYS only reaches the stand-in pad, which State::poll disconnects whenever a host pad is connected, so scripted keys do nothing on a machine with a controller. The PR adds Source::scripted_keys (built only with test or diagnostics), maps the keys through the existing fallback() table and ORs them onto the first connected host pad (merge_pad/merge_scripted in crates/victory-hle/src/modules/gameinput.rs); release builds are unchanged. The test matches FALLBACK_BUTTONS and the stick/trigger keys of fallback() and checks the physical pad's state comes back when the script ends.

CI: no check runs on the head commit.


Generated by Claude Code

crashbashash added a commit to crashbashash/VIctory-proton that referenced this pull request Nov 25, 2026
`VICTORY_KEYS` is a schedule fixed at start. With
`VICTORY_KEYS_FILE=<path>`, lines appended to the file while the game
runs are pressed too: `<key>[+<key>...][:<ms>]`, the same key names,
held 200 ms unless given, one line after another; the file is looked
at every 50 ms and lines already there at start are skipped. They
merge onto a connected controller as `VICTORY_KEYS` does (Marvisak#197), so
someone can play with a pad while a script sends keys.
crashbashash added a commit to crashbashash/VIctory-proton that referenced this pull request Nov 25, 2026
`VICTORY_KEYS` is a schedule fixed at start. With
`VICTORY_KEYS_FILE=<path>`, lines appended to the file while the game
runs are pressed too: `<key>[+<key>...][:<ms>]`, the same key names,
held 200 ms unless given, one line after another; the file is looked
at every 50 ms and lines already there at start are skipped. They
merge onto a connected controller as `VICTORY_KEYS` does (Marvisak#197), so
someone can play with a pad while a script sends keys.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants