Feature Request: SDL3 backend for GameInput shim (DualSense, trigger rumble, gyro & dynamic controller glyphs) #187

Open
opened 2026-11-26 03:53:52 +00:00 by github-bot · 1 comment
Owner

@⁠Kabosune on GitHub · 2026-11-24 01:15 UTC · original

Summary

Since VIctory currently backs its HLE gameinput.dll shim (crates/victory-hle/src/modules/gameinput.rs) with XInput, would you consider adding/switching to an SDL3 backend? Moving to SDL3 would unlock three closely related improvements:

  1. Native multi-controller support, trigger rumble, and sensor access (DualSense, DualShock 4, Switch Pro, Xbox, Steam Deck, etc. out of the box).
  2. Future gyro aiming once camera/mouse look hooks are in place.
  3. Custom PlayStation, Nintendo, and Steam Controller/Deck button glyphs (including live on-the-spot switching) using open/CC0 icon sets — no copyrighted assets required.

1. SDL3 Backend for the GameInput Shim

  • Native multi-controller support: DualSense, DualShock 4, Switch Pro, Xbox, Steam Deck, etc. work out of the box without needing DS4Windows or Steam Input.
  • Trigger rumble: SDL3 exposes SDL_RumbleGamepadTriggers() natively (which is currently listed under Input "Needs" in the README).
  • Sensor & DualSense features: SDL3 exposes SDL_SENSOR_GYRO / SDL_SENSOR_ACCEL (plus rumble/LEDs/touchpad) through a single unified API, whereas XInput / Windows GameInput don't expose gyro on most third-party controllers.

2. Future Gyro Aiming

Simply swapping the GameInput backend to SDL3 won't automatically give the game gyro (since the Xbox binary itself doesn't read GameInputMotionState for aiming), so this would be a two-step progression:

  1. Back the gameinput.dll shim with SDL3 for broad controller support and sensor access.
  2. Down the line (once camera/mouse look hooks are in place), optionally feed SDL_SENSOR_GYRO deltas directly into the camera/aiming input (or mouse look) for true mouse-like gyro aiming — with a simple toggle/sensitivity config (e.g., gyro active on ADS/L2).

3. Dynamic PlayStation / Nintendo / Steam Controller Glyphs

Because the Xbox Series X|S build only ships the platform_xbsx controller glyphs (PlayStation glyphs are omitted), having SDL3 detect the active gamepad makes it possible to support custom PlayStation, Nintendo, and Steam Controller/Deck glyphs — including live on-the-spot switching — using open/CC0 icon sets.

Technical Findings (Xbox Series X|S Dump)

Controller button art lives in two places:

  1. In-game button prompts (HUD, menus, weapon wheel, map) — Pure Vector Scaleform GFx

    • Location: data.rpf @ 0x117D7000 (input_icons.gfx, 28,148 bytes decompressed, inside the nested platform_xbsx RPF9 at 0x11757000).
    • Format: Standard GFX* (SWF) containing 131 DefineShape3 vector shapes and 38 DefineSprite symbols (platform_xbsx.input_icons.Main_Button_4–39, 58, 59). There are no .dds textures referenced by input_icons.gfx.
    • Runtime lookup (rockstar.input_icons:InputIconV2): generic_movie, hud, and map_scripted_movie build platformPackagePath ("platform_" + <platform>), load input_icons.gfx once via loadAssets() (assetsLoaded = true), and instantiate glyphs via:
      applicationDomain.getDefinition(platformPackagePath + ".input_icons.Main_Button_" + id)
      
  2. Settings → Controls diagram (IMG_Gamepad) — Single TTDB Texture

    • Location: data/ttdb/ui/platform.ttpf
    • Format: Single 1024×512 BC7_UNORM texture (64KB_S swizzled, atHash64 = 0xA55E8BE9366FB118).

Proposed Architecture for VIctory

  1. SDL3 Active-Controller Detection

    • Track the active glyph profile (xbox, ps, nintendo, steam) using SDL_GetGamepadType() (XBOX360/XBOXONE, PS4/PS5, NINTENDO_SWITCH_PRO, plus Valve VID 0x28DE for Steam Controller / Steam Deck) on SDL_EVENT_GAMEPAD_ADDED / REMOVED and last-active input events.
  2. Moddable Glyph Packs (No Copyrighted Assets)

    • Community/CC0 vector icons (e.g., Xelu/Kenney) can be compiled into drop-in input_icons.gfx replacements keeping the exact platform_xbsx.input_icons.Main_Button_<id> class names, alongside matching 1024×512 BC7 platform.ttpf controller diagrams.
  3. Switching Strategies

    • Option A — VFS Override (Simple): Intercept reads of input_icons.gfx and data/ttdb/ui/platform.ttpf in the VFS layer and serve mods/glyphs/<profile>/. Because InputIconV2 caches assetsLoaded = true, this applies on movie load/reload unless a reload is triggered on controller switch.
    • Option B — True On-the-Spot Hot-Swap (Multi-Frame input_icons.gfx): Pack all profiles as frames inside each Main_Button_<id> MovieClip (Frame 1 = Xbox, 2 = PS, 3 = Nintendo, 4 = Steam). When SDL3 detects a controller switch, push the active frame index into Scaleform (gotoAndStop(profileFrame)) so every visible prompt updates on the next frame with zero reload, and swap platform.ttpf via VFS + texture cache invalidation.

Thanks for all the work on VIctory!

**@⁠Kabosune** on GitHub · 2026-11-24 01:15 UTC · [original](https://github.com/Marvisak/VIctory/issues/187) ### Summary Since VIctory currently backs its HLE `gameinput.dll` shim (`crates/victory-hle/src/modules/gameinput.rs`) with XInput, would you consider adding/switching to an **SDL3** backend? Moving to SDL3 would unlock three closely related improvements: 1. **Native multi-controller support, trigger rumble, and sensor access** (DualSense, DualShock 4, Switch Pro, Xbox, Steam Deck, etc. out of the box). 2. **Future gyro aiming** once camera/mouse look hooks are in place. 3. **Custom PlayStation, Nintendo, and Steam Controller/Deck button glyphs** (including live on-the-spot switching) using open/CC0 icon sets — no copyrighted assets required. --- ### 1. SDL3 Backend for the `GameInput` Shim - **Native multi-controller support:** DualSense, DualShock 4, Switch Pro, Xbox, Steam Deck, etc. work out of the box without needing DS4Windows or Steam Input. - **Trigger rumble:** SDL3 exposes `SDL_RumbleGamepadTriggers()` natively (which is currently listed under Input "Needs" in the README). - **Sensor & DualSense features:** SDL3 exposes `SDL_SENSOR_GYRO` / `SDL_SENSOR_ACCEL` (plus rumble/LEDs/touchpad) through a single unified API, whereas XInput / Windows GameInput don't expose gyro on most third-party controllers. --- ### 2. Future Gyro Aiming Simply swapping the `GameInput` backend to SDL3 won't automatically give the game gyro (since the Xbox binary itself doesn't read `GameInputMotionState` for aiming), so this would be a two-step progression: 1. Back the `gameinput.dll` shim with SDL3 for broad controller support and sensor access. 2. Down the line (once camera/mouse look hooks are in place), optionally feed `SDL_SENSOR_GYRO` deltas directly into the camera/aiming input (or mouse look) for true mouse-like gyro aiming — with a simple toggle/sensitivity config (e.g., gyro active on ADS/L2). --- ### 3. Dynamic PlayStation / Nintendo / Steam Controller Glyphs Because the Xbox Series X|S build only ships the `platform_xbsx` controller glyphs (PlayStation glyphs are omitted), having SDL3 detect the active gamepad makes it possible to support custom **PlayStation, Nintendo, and Steam Controller/Deck** glyphs — including live on-the-spot switching — using open/CC0 icon sets. #### Technical Findings (Xbox Series X|S Dump) Controller button art lives in two places: 1. **In-game button prompts (HUD, menus, weapon wheel, map) — Pure Vector Scaleform GFx** - **Location:** `data.rpf` @ `0x117D7000` (`input_icons.gfx`, 28,148 bytes decompressed, inside the nested `platform_xbsx` RPF9 at `0x11757000`). - **Format:** Standard `GFX*` (SWF) containing **131 `DefineShape3` vector shapes** and **38 `DefineSprite` symbols** (`platform_xbsx.input_icons.Main_Button_4`–`39`, `58`, `59`). There are **no `.dds` textures** referenced by `input_icons.gfx`. - **Runtime lookup (`rockstar.input_icons:InputIconV2`):** `generic_movie`, `hud`, and `map_scripted_movie` build `platformPackagePath` (`"platform_" + <platform>`), load `input_icons.gfx` once via `loadAssets()` (`assetsLoaded = true`), and instantiate glyphs via: ```actionscript applicationDomain.getDefinition(platformPackagePath + ".input_icons.Main_Button_" + id) ``` 2. **Settings → Controls diagram (`IMG_Gamepad`) — Single TTDB Texture** - **Location:** `data/ttdb/ui/platform.ttpf` - **Format:** Single `1024×512` `BC7_UNORM` texture (`64KB_S` swizzled, `atHash64 = 0xA55E8BE9366FB118`). #### Proposed Architecture for VIctory 1. **SDL3 Active-Controller Detection** - Track the active glyph profile (`xbox`, `ps`, `nintendo`, `steam`) using `SDL_GetGamepadType()` (`XBOX360`/`XBOXONE`, `PS4`/`PS5`, `NINTENDO_SWITCH_PRO`, plus Valve VID `0x28DE` for Steam Controller / Steam Deck) on `SDL_EVENT_GAMEPAD_ADDED` / `REMOVED` and last-active input events. 2. **Moddable Glyph Packs (No Copyrighted Assets)** - Community/CC0 vector icons (e.g., Xelu/Kenney) can be compiled into drop-in `input_icons.gfx` replacements keeping the exact `platform_xbsx.input_icons.Main_Button_<id>` class names, alongside matching `1024×512 BC7` `platform.ttpf` controller diagrams. 3. **Switching Strategies** - **Option A — VFS Override (Simple):** Intercept reads of `input_icons.gfx` and `data/ttdb/ui/platform.ttpf` in the VFS layer and serve `mods/glyphs/<profile>/`. Because `InputIconV2` caches `assetsLoaded = true`, this applies on movie load/reload unless a reload is triggered on controller switch. - **Option B — True On-the-Spot Hot-Swap (Multi-Frame `input_icons.gfx`):** Pack all profiles as frames inside each `Main_Button_<id>` `MovieClip` (Frame 1 = Xbox, 2 = PS, 3 = Nintendo, 4 = Steam). When SDL3 detects a controller switch, push the active frame index into Scaleform (`gotoAndStop(profileFrame)`) so every visible prompt updates on the next frame with zero reload, and swap `platform.ttpf` via VFS + texture cache invalidation. Thanks for all the work on VIctory!
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:53:52 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:47 UTC · original

Automated triage for the maintainers.

The description of main here is accurate: crates/victory-hle/src/modules/gameinput.rs takes gamepads from XInput, drops trigger motors (the shortcut note near the rumble code), and the README lists trigger rumble under what Input still needs. A different host input backend for DualSense, DualShock 4, trigger rumble and sensors fits the project's scope (Windows hosts, offline). Several open PRs already work on this: #312 (an SDL3 gamepad backend for the gameinput shim), #150 and #1517 (DualSense), #1786 (DualShock 4 over HID) and #1357 (trigger haptics through Windows.Gaming.Input). The glyph-replacement part means serving substitute title assets, which goes beyond what the project does today; whether to take that on is for the maintainers.

One request: the "Technical Findings" section describes the contents of the title's files (archive offsets, internal names and code). Material taken from the game must not be posted in this repository.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:47 UTC · [original](https://github.com/Marvisak/VIctory/issues/187#issuecomment-7149969165) <!-- victory-issue-triage v1 verdict=tracked seen=2026-11-24T01:15:56Z at=2026-11-25T01:47:48Z --> Automated triage for the maintainers. The description of `main` here is accurate: `crates/victory-hle/src/modules/gameinput.rs` takes gamepads from XInput, drops trigger motors (the `shortcut` note near the rumble code), and the README lists trigger rumble under what Input still needs. A different host input backend for DualSense, DualShock 4, trigger rumble and sensors fits the project's scope (Windows hosts, offline). Several open PRs already work on this: #312 (an SDL3 gamepad backend for the gameinput shim), #150 and #1517 (DualSense), #1786 (DualShock 4 over HID) and #1357 (trigger haptics through Windows.Gaming.Input). The glyph-replacement part means serving substitute title assets, which goes beyond what the project does today; whether to take that on is for the maintainers. One request: the "Technical Findings" section describes the contents of the title's files (archive offsets, internal names and code). Material taken from the game must not be posted in this repository. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
No milestone
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
github/Marvisak--VIctory#187
No description provided.