refactor(host/W6.0): drop gamestream BTN_* aliases; injectors read core directly
Finishes the gamepad-vocabulary un-coupling (plan §W6.0): the Linux uinput button map now names BTN_* straight from punktfunk_core::input::gamepad instead of the crate::gamestream re-export aliases, so pf-inject will carry no edge into the gamestream junk drawer for gamepad constants. Removes the now-dead alias block; the wire-bit pinning test (gamepad_wire_bits_are_pinned) pins core directly (equally strong — core is the single source). gamestream keeps only the decode path, which imports the types from core. Verified: Linux (home-worker-5) clippy --all-targets -D warnings + gamepad tests green; Windows (192.168.1.158) clippy -p punktfunk-host --features nvenc,amf-qsv --all-targets green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1449,38 +1449,38 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
/// Freeze the gamepad wire contract: every button bit + axis id pinned to its exact value, read
|
||||
/// through the GameStream namespace (`crate::gamestream::gamepad`, which re-exports
|
||||
/// `punktfunk_core::input::gamepad` — the punktfunk/1 native wire and the GameStream/Limelight
|
||||
/// wire are one and the same). Renumbering a bit in core, or dropping one from that re-export,
|
||||
/// Freeze the gamepad wire contract: every button bit + axis id pinned to its exact value in
|
||||
/// `punktfunk_core::input::gamepad` — the single source both the punktfunk/1 native wire and the
|
||||
/// GameStream/Limelight wire read from (they are one and the same). Renumbering a bit in core
|
||||
/// silently breaks every already-shipped client, so it must fail here first. This is the host
|
||||
/// counterpart to the client-side C-ABI cross-checks in the Apple/Android gamepad tests.
|
||||
#[test]
|
||||
fn gamepad_wire_bits_are_pinned() {
|
||||
use crate::gamestream::gamepad as gm;
|
||||
use punktfunk_core::input::gamepad as pf;
|
||||
// buttonFlags — low 16 bits, named via the GameStream re-export the injectors use.
|
||||
assert_eq!(gm::BTN_DPAD_UP, 0x0000_0001);
|
||||
assert_eq!(gm::BTN_DPAD_DOWN, 0x0000_0002);
|
||||
assert_eq!(gm::BTN_DPAD_LEFT, 0x0000_0004);
|
||||
assert_eq!(gm::BTN_DPAD_RIGHT, 0x0000_0008);
|
||||
assert_eq!(gm::BTN_START, 0x0000_0010);
|
||||
assert_eq!(gm::BTN_BACK, 0x0000_0020);
|
||||
assert_eq!(gm::BTN_LS_CLICK, 0x0000_0040);
|
||||
assert_eq!(gm::BTN_RS_CLICK, 0x0000_0080);
|
||||
assert_eq!(gm::BTN_LB, 0x0000_0100);
|
||||
assert_eq!(gm::BTN_RB, 0x0000_0200);
|
||||
assert_eq!(gm::BTN_GUIDE, 0x0000_0400);
|
||||
assert_eq!(gm::BTN_A, 0x0000_1000);
|
||||
assert_eq!(gm::BTN_B, 0x0000_2000);
|
||||
assert_eq!(gm::BTN_X, 0x0000_4000);
|
||||
assert_eq!(gm::BTN_Y, 0x0000_8000);
|
||||
// buttonFlags2 — high 16 bits: back-grip paddles (re-exported), plus the touchpad-click /
|
||||
// Share bits the DualSense/DS4 protos consume straight from core.
|
||||
assert_eq!(gm::BTN_PADDLE1, 0x0001_0000);
|
||||
assert_eq!(gm::BTN_PADDLE2, 0x0002_0000);
|
||||
assert_eq!(gm::BTN_PADDLE3, 0x0004_0000);
|
||||
assert_eq!(gm::BTN_PADDLE4, 0x0008_0000);
|
||||
// buttonFlags — low 16 bits. The injectors now name these straight from core::input::gamepad
|
||||
// (the GameStream junk-drawer aliases were removed in the pf-inject un-coupling), so this pins
|
||||
// core directly.
|
||||
assert_eq!(pf::BTN_DPAD_UP, 0x0000_0001);
|
||||
assert_eq!(pf::BTN_DPAD_DOWN, 0x0000_0002);
|
||||
assert_eq!(pf::BTN_DPAD_LEFT, 0x0000_0004);
|
||||
assert_eq!(pf::BTN_DPAD_RIGHT, 0x0000_0008);
|
||||
assert_eq!(pf::BTN_START, 0x0000_0010);
|
||||
assert_eq!(pf::BTN_BACK, 0x0000_0020);
|
||||
assert_eq!(pf::BTN_LS_CLICK, 0x0000_0040);
|
||||
assert_eq!(pf::BTN_RS_CLICK, 0x0000_0080);
|
||||
assert_eq!(pf::BTN_LB, 0x0000_0100);
|
||||
assert_eq!(pf::BTN_RB, 0x0000_0200);
|
||||
assert_eq!(pf::BTN_GUIDE, 0x0000_0400);
|
||||
assert_eq!(pf::BTN_A, 0x0000_1000);
|
||||
assert_eq!(pf::BTN_B, 0x0000_2000);
|
||||
assert_eq!(pf::BTN_X, 0x0000_4000);
|
||||
assert_eq!(pf::BTN_Y, 0x0000_8000);
|
||||
// buttonFlags2 — high 16 bits: back-grip paddles, plus the touchpad-click / Share bits the
|
||||
// DualSense/DS4 protos consume.
|
||||
assert_eq!(pf::BTN_PADDLE1, 0x0001_0000);
|
||||
assert_eq!(pf::BTN_PADDLE2, 0x0002_0000);
|
||||
assert_eq!(pf::BTN_PADDLE3, 0x0004_0000);
|
||||
assert_eq!(pf::BTN_PADDLE4, 0x0008_0000);
|
||||
assert_eq!(pf::BTN_TOUCHPAD, 0x0010_0000);
|
||||
assert_eq!(pf::BTN_MISC1, 0x0020_0000);
|
||||
// Axis ids — dense, 0-based.
|
||||
|
||||
Reference in New Issue
Block a user