|
| 1 | +# PR_26140_091 Input Mapping V2 Gamepad Detection Source Report |
| 2 | + |
| 3 | +## Scope |
| 4 | +- Fixed Input Mapping V2 gamepad discovery so the tool does not depend on a running sample/game engine loop. |
| 5 | +- Preserved PR_26140_090 combo input behavior, fixed-action tile display, per-device capture buttons, and captured-input deletion. |
| 6 | +- Did not change schemas or sample JSON. |
| 7 | + |
| 8 | +## Sample 0104 Comparison |
| 9 | +Sample 0104 reads gamepad state from the shared engine `InputService` boundary: |
| 10 | +- `engine.input.getGamepad(0)` |
| 11 | +- `engine.input.getGamepads()` |
| 12 | + |
| 13 | +Input Mapping V2 now uses the same browser-to-engine path for tool detection: |
| 14 | +- polls `navigator.getGamepads()` through the configured `InputService` gamepad source, |
| 15 | +- calls `InputService.update()` from the tool because there is no scene update loop, |
| 16 | +- reads normalized `GamepadState` snapshots through `InputService.getGamepads()`, |
| 17 | +- uses `GamepadInputAdapter` to interpret selected-device button/axis capture. |
| 18 | + |
| 19 | +## Changes |
| 20 | +- Added a `Refresh Gamepads` action in the Capture accordion. |
| 21 | +- Added tool-owned gamepad polling so browser-exposed devices appear without Sample 0104 or a game scene loop. |
| 22 | +- Logs detected gamepad count and device names on initial refresh, manual refresh, connection events, and device-list changes. |
| 23 | +- Keeps one capture button per detected gamepad/device. |
| 24 | +- Keeps selected-device WARN logging when the device is visible but no active button/axis is pressed. |
| 25 | +- Updated Playwright coverage to mock `navigator.getGamepads()` directly, without dispatching Sample 0104 or relying on an engine frame. |
| 26 | + |
| 27 | +## Playwright Impact |
| 28 | +Yes. This PR changes Input Mapping V2 capture UI, gamepad detection timing, and status logging. |
| 29 | + |
| 30 | +Playwright now validates: |
| 31 | +- mocked `navigator.getGamepads()` detection without a Sample 0104 engine loop, |
| 32 | +- Refresh Gamepads logs detected count and device names, |
| 33 | +- per-device capture buttons remain one button per device, |
| 34 | +- combo/tile behavior from PR_26140_090 remains intact. |
| 35 | + |
| 36 | +## Validation |
| 37 | +- PASS: targeted syntax/import validation for changed Input Mapping V2 files, focused Playwright file, and Sample 0104 files. |
| 38 | +- PASS: focused Input Mapping V2 Playwright validation: |
| 39 | + `npx playwright test tests/playwright/tools/WorkspaceManagerV2.spec.mjs -g "launches Input Mapping V2 and captures keyboard mappings"` |
| 40 | +- PASS: targeted Sample 0104 launch validation with mocked `navigator.getGamepads()`; the sample page loaded, canvas appeared, and no page errors were raised. |
| 41 | +- PASS: no schema JSON changes. |
| 42 | +- PASS: no sample JSON changes. |
| 43 | +- PASS with extended timeout: the unrelated Object Vector Studio V2 test that timed out under the default suite passed with `--timeout=240000` in 2.7 minutes. |
| 44 | +- FAIL, classified unrelated timeout: `npm run test:workspace-v2` was run twice exactly as requested. Both runs completed 59 tests and timed out on `shows Object Vector Studio V2 layout shell and schema-only palette gate`, which is outside the PR_091 changed files. The same test passes with a larger timeout, indicating validation timeout debt rather than an Input Mapping V2 behavior regression. |
| 45 | + |
| 46 | +Full samples smoke test was not run, per PR scope. |
| 47 | + |
| 48 | +## Manual Validation |
| 49 | +1. Launch Input Mapping V2. |
| 50 | +2. Connect or expose a controller to the browser, then click Refresh Gamepads. |
| 51 | +3. Confirm the Status log reports the detected gamepad count and device names. |
| 52 | +4. Confirm one full-width capture button appears for each detected gamepad. |
| 53 | +5. Capture a selected device button or axis and confirm the token uses that device name/index. |
| 54 | +6. Confirm combo mappings and fixed-action tile display from PR_26140_090 still work. |
0 commit comments