-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Labels
bugA bug: incorrect behaviour in the webpage or the emulation itselfA bug: incorrect behaviour in the webpage or the emulation itselfinputIssues with input, keyboard, mouse, etcIssues with input, keyboard, mouse, etc
Description
Issue Description
There's an inconsistency in how button2 is mapped for joystick fire buttons in the VIA gamepad handling code (around line 679 in src/via.js).
Current Behavior
In SysVia.getJoysticks():
- button1: Always uses
pad.buttons[10](first gamepad, FIRE1) - button2:
- If 2 gamepads: Uses
pad2.buttons[10](second gamepad's FIRE1) - If 1 gamepad: Uses
pad.buttons[11](first gamepad's FIRE2)
- If 2 gamepads: Uses
Code Location
// src/via.js line ~679
button2 = button2 || (pad2 ? pad2.buttons[10].pressed : pad.buttons[11].pressed);Expected Behavior (to be clarified)
The mapping should be consistent. Possible approaches:
- Option A: Always use button index 10 for both scenarios
- Option B: Always use button index 11 for button2 in both scenarios
- Option C: Current behavior is intentional and should be documented
Context
From the gamepad mapping in gamepads.js:
- Button 10 = FIRE1
- Button 11 = FIRE2
Impact
This inconsistency may confuse users when switching between single and dual gamepad setups, as button2 maps to different physical buttons depending on the setup.
Next Steps
- Clarify if current behavior is intentional
- Add documentation explaining the mapping logic
- Consider standardizing the mapping
- Add tests to verify intended behavior
Note: This is existing behavior, not introduced by recent changes.
Metadata
Metadata
Assignees
Labels
bugA bug: incorrect behaviour in the webpage or the emulation itselfA bug: incorrect behaviour in the webpage or the emulation itselfinputIssues with input, keyboard, mouse, etcIssues with input, keyboard, mouse, etc