Input mapping specification v1: full pad -> keyboard + mouse (implements #154) #159

Closed
opened 2026-11-26 08:31:34 +00:00 by github-bot · 1 comment
Owner

@⁠bailu12300 on GitHub · 2026-11-26 08:26 UTC · original

Follow-up to #154, this time as a specification rather than a bug report, so it can be implemented by anyone.

Motivation: on a 32-lane NVIDIA host with no pad, the game is playable up to the equipment wheel, and that wheel cannot be operated. Reviewing gameinput.rs shows the 14 title buttons are all reachable, but two structural gaps remain: (a) triggers only exist as analog axes Z/C with no digital "held" channel, and (b) the mouse is deliberately excluded (Host::keys() starts at x08), so there is no look, no fire, and no menu pointer.

Below is the full mapping and the acceptance tests. I am implementing a first cut on my side (9c23e8d) and will send a patch series if you want it.


VIctory 全手柄 → 键盘 + 鼠标 输入映射规范(v1)

适用:avatarmanz/VIctory-7900XTX 及同源分支,crates/victory-hle/src/modules/gameinput.rs。
目标:主机没有手柄、只有键鼠时,标题的每一个 pad 控件都能按到,所有"按住 + 方向"的菜单手势也能在键盘上完成。

1. 标题侧的 pad 位(源码已确认)

位 名称 值
1 MENU(Start) 0x1
2 VIEW(Back) 0x2
3 A 0x4
4 B 0x8
5 X 0x10
6 Y 0x20
7 UP 0x40
8 DOWN 0x80
9 LEFT 0x100
10 RIGHT 0x200
11 LEFT_SHOULDER (LB) 0x400
12 RIGHT_SHOULDER (RB) 0x800
13 LEFT_STICK 按下 (LS) 0x1000
14 RIGHT_STICK 按下 (RS) 0x2000

模拟量:left_trigger / right_trigger 0..1,left_x/left_y/right_x/right_y -1..1(上为正)。

现状问题:14 个位都有键位,但 左右扳机只有 Z/C 两个模拟量,没有"按下阈值 → 数字触发"的通道;鼠标完全未接入(keys() 从 0x08 起,明确排除鼠标键);手柄扳机在菜单里常被当作"按住才出现转盘"的按钮,模拟量在 0.2~0.4 时标题收不到"按住"。

2. 建议的默认映射(键鼠 → pad)

2.1 按钮

pad 键盘 鼠标
MENU (Start) Esc 中键(可选)
VIEW (Back) Tab —
A Enter 左键单击(可选,仅菜单)
B Backspace 右键(可选,仅菜单)
X X —
Y Y —
UP / DOWN / LEFT / RIGHT 方向键 滚轮上下 / 侧键
LB Q X1(后退键)
RB E X2(前进键)
LS 按下 F 中键
RS 按下 H —

2.2 扳机(必须两条通道)

pad 键盘(模拟) 键盘(数字,阈值 0.5) 鼠标
LT Z Z 按住即 1.0 右键
RT C C 按住即 1.0 左键

规则:

  • 数字通道 = axis > 0.5 时同时把该扳机视作"按住",供菜单/转盘使用;射击仍是模拟值。
  • 允许 VICTORY_TRIGGER_DIGITAL=1 强制数字化(无模拟手柄时的默认)。

2.3 摇杆

pad 键盘 鼠标
左摇杆 W/A/S/D —
右摇杆(视角) I/J/K/L 光标增量:dx/dy 除以灵敏度后钳制到 ±1,取完回中

鼠标视角参数建议:VICTORY_LOOK_SCALE(像素满偏,默认 320)、VICTORY_LOOK_INVERT(Y 轴反向,默认 0)、VICTORY_MOUSE(总开关,默认 1)。

3. 手势必须能复现

游戏动作 手柄 键鼠等价
开武器/装备转盘 按住 RB 按住 E
转盘里选 右摇杆方向 I/J/K/L(或鼠标移动)
确认 松开 RB 或 A 松开 E,或按 Enter
取消 B Backspace
打开背包/菜单 MENU 或 VIEW Esc / Tab
翻页 左摇杆 / dpad W/S / 方向键

验收点:只用键盘,能完成 开转盘 → 选到任意一格 → 确认 → 关闭;只用鼠标,能完成 转视角 → 开火 → 开转盘 → 选中 → 确认。

4. 实现落点

  1. FALLBACK_BUTTONS:补全为 14 位全覆盖 + 扳机数字通道常量表。
  2. Host::keys():范围改为 0x01..=0xFE,包含鼠标键(0x01 左、0x02 右、0x04 中、0x05/0x06 X1/X2),但仍排除 0x10..=0x12 修饰键重复上报。
  3. fallback(keys):left_trigger = max(Z, 0x02)、right_trigger = max(C, 0x01);新增 digital_triggers() 让菜单能拿到"按住"。
  4. Host 新增 look():GetCursorPos 取增量 → 右摇杆;仅在标题窗口位于前台时取,取完可选回中(VICTORY_LOOK_RECENTER=1,默认 1)。
  5. 文档:README 增加上面两张表;--print-inputs 之类的小工具打印当前读数,方便用户自查。

5. 待确认(需上游回答)

  • 转盘到底读 RB + 右摇杆,还是读 RT 模拟量 + 右摇杆?这决定扳机是按钮还是轴。
  • 标题的 UI 是否依赖 MENU 长按(Esc 按住 0.5s 才生效)?
  • 是否接受把鼠标键并入 keys() 上报(标题可能把它们当普通按键)。
**@⁠bailu12300** on GitHub · 2026-11-26 08:26 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/159) Follow-up to #154, this time as a specification rather than a bug report, so it can be implemented by anyone. Motivation: on a 32-lane NVIDIA host with no pad, the game is playable up to the equipment wheel, and that wheel cannot be operated. Reviewing gameinput.rs shows the 14 title buttons are all reachable, but two structural gaps remain: (a) triggers only exist as analog axes Z/C with no digital "held" channel, and (b) the mouse is deliberately excluded (Host::keys() starts at x08), so there is no look, no fire, and no menu pointer. Below is the full mapping and the acceptance tests. I am implementing a first cut on my side (9c23e8d) and will send a patch series if you want it. --- # VIctory 全手柄 → 键盘 + 鼠标 输入映射规范(v1) 适用:`avatarmanz/VIctory-7900XTX` 及同源分支,`crates/victory-hle/src/modules/gameinput.rs`。 目标:主机没有手柄、只有键鼠时,**标题的每一个 pad 控件都能按到**,所有"按住 + 方向"的菜单手势也能在键盘上完成。 ## 1. 标题侧的 pad 位(源码已确认) | 位 | 名称 | 值 | |---|---|---| | 1 | MENU(Start) | 0x1 | | 2 | VIEW(Back) | 0x2 | | 3 | A | 0x4 | | 4 | B | 0x8 | | 5 | X | 0x10 | | 6 | Y | 0x20 | | 7 | UP | 0x40 | | 8 | DOWN | 0x80 | | 9 | LEFT | 0x100 | | 10 | RIGHT | 0x200 | | 11 | LEFT_SHOULDER (LB) | 0x400 | | 12 | RIGHT_SHOULDER (RB) | 0x800 | | 13 | LEFT_STICK 按下 (LS) | 0x1000 | | 14 | RIGHT_STICK 按下 (RS) | 0x2000 | 模拟量:`left_trigger` / `right_trigger` 0..1,`left_x`/`left_y`/`right_x`/`right_y` -1..1(上为正)。 现状问题:14 个位都有键位,但 **左右扳机只有 Z/C 两个模拟量,没有"按下阈值 → 数字触发"的通道**;**鼠标完全未接入**(`keys()` 从 0x08 起,明确排除鼠标键);手柄扳机在菜单里常被当作"按住才出现转盘"的按钮,模拟量在 0.2~0.4 时标题收不到"按住"。 ## 2. 建议的默认映射(键鼠 → pad) ### 2.1 按钮 | pad | 键盘 | 鼠标 | |---|---|---| | MENU (Start) | Esc | 中键(可选) | | VIEW (Back) | Tab | — | | A | Enter | 左键单击(可选,仅菜单) | | B | Backspace | 右键(可选,仅菜单) | | X | X | — | | Y | Y | — | | UP / DOWN / LEFT / RIGHT | 方向键 | 滚轮上下 / 侧键 | | LB | Q | X1(后退键) | | RB | E | X2(前进键) | | LS 按下 | F | 中键 | | RS 按下 | H | — | ### 2.2 扳机(必须两条通道) | pad | 键盘(模拟) | 键盘(数字,阈值 0.5) | 鼠标 | |---|---|---|---| | LT | Z | Z 按住即 1.0 | 右键 | | RT | C | C 按住即 1.0 | 左键 | 规则: - 数字通道 = `axis > 0.5` 时同时把该扳机视作"按住",供菜单/转盘使用;射击仍是模拟值。 - 允许 `VICTORY_TRIGGER_DIGITAL=1` 强制数字化(无模拟手柄时的默认)。 ### 2.3 摇杆 | pad | 键盘 | 鼠标 | |---|---|---| | 左摇杆 | W/A/S/D | — | | 右摇杆(视角) | I/J/K/L | 光标增量:`dx/dy` 除以灵敏度后钳制到 ±1,取完回中 | 鼠标视角参数建议:`VICTORY_LOOK_SCALE`(像素满偏,默认 320)、`VICTORY_LOOK_INVERT`(Y 轴反向,默认 0)、`VICTORY_MOUSE`(总开关,默认 1)。 ## 3. 手势必须能复现 | 游戏动作 | 手柄 | 键鼠等价 | |---|---|---| | 开武器/装备转盘 | 按住 RB | 按住 E | | 转盘里选 | 右摇杆方向 | I/J/K/L(或鼠标移动) | | 确认 | 松开 RB 或 A | 松开 E,或按 Enter | | 取消 | B | Backspace | | 打开背包/菜单 | MENU 或 VIEW | Esc / Tab | | 翻页 | 左摇杆 / dpad | W/S / 方向键 | **验收点**:只用键盘,能完成 开转盘 → 选到任意一格 → 确认 → 关闭;只用鼠标,能完成 转视角 → 开火 → 开转盘 → 选中 → 确认。 ## 4. 实现落点 1. `FALLBACK_BUTTONS`:补全为 14 位全覆盖 + 扳机数字通道常量表。 2. `Host::keys()`:范围改为 `0x01..=0xFE`,包含鼠标键(0x01 左、0x02 右、0x04 中、0x05/0x06 X1/X2),但仍排除 0x10..=0x12 修饰键重复上报。 3. `fallback(keys)`:`left_trigger = max(Z, 0x02)`、`right_trigger = max(C, 0x01)`;新增 `digital_triggers()` 让菜单能拿到"按住"。 4. `Host` 新增 `look()`:`GetCursorPos` 取增量 → 右摇杆;仅在标题窗口位于前台时取,取完可选回中(`VICTORY_LOOK_RECENTER=1`,默认 1)。 5. 文档:README 增加上面两张表;`--print-inputs` 之类的小工具打印当前读数,方便用户自查。 ## 5. 待确认(需上游回答) - 转盘到底读 `RB + 右摇杆`,还是读 `RT 模拟量 + 右摇杆`?这决定扳机是按钮还是轴。 - 标题的 UI 是否依赖 `MENU` 长按(Esc 按住 0.5s 才生效)? - 是否接受把鼠标键并入 `keys()` 上报(标题可能把它们当普通按键)。
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:31:34 +00:00
Author
Owner

@⁠bailu12300 on GitHub · 2026-11-26 10:05 UTC · original

Withdrawn - the mapping proposed here does not belong in the project. Closing it.

**@⁠bailu12300** on GitHub · 2026-11-26 10:05 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/159#issuecomment-7188889685) Withdrawn - the mapping proposed here does not belong in the project. Closing it.
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/avatarmanz--VIctory-7900XTX#159
No description provided.