fix(input): apply Switch-measured controller fallback

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Andrew Quenehen
2026-08-01 03:53:27 -03:00
parent 361d4b81df
commit 560ebc5997
3 changed files with 61 additions and 4 deletions
+22
View File
@@ -0,0 +1,22 @@
-- NX raw fallback indices measured on OLED hardware (SWNX-11).
package.path = "./?.lua;./?/init.lua;" .. package.path
if not _G.love then _G.love = require("tests.love_stub") end
local T = require("tests.harness")
local eq = T.eq
local GamepadMap = require("src.core.GamepadMap")
GamepadMap._setForceNXForTests(true)
-- Phase 0 probe: Y→#3, X→#4; Nintendo B/A at #1/#2.
eq(GamepadMap.mapRawButton(3), "b", "NX raw Y (#3) maps to GB B")
eq(GamepadMap.mapRawButton(4), "a", "NX raw X (#4) maps to GB A")
eq(GamepadMap.mapRawToGamepadButton(3), "y", "NX raw #3 routes to gamepad y")
eq(GamepadMap.mapRawToGamepadButton(4), "x", "NX raw #4 routes to gamepad x")
eq(GamepadMap.mapRawButton(9), "select", "NX minus (#9) -> select")
eq(GamepadMap.mapRawButton(10), "start", "NX plus (#10) -> start")
GamepadMap._setForceNXForTests(false)
T.finish()