Support mouse bindings for actions

Fixes #2525
This commit is contained in:
Luke Street
2026-09-25 00:01:56 -06:00
parent ccc8d415d1
commit 3a1b863dc6
+10 -4
View File
@@ -75,10 +75,16 @@ void updateActionBindings() {
// If keyboard is active for this port
u32 count = 0;
if (PADGetKeyButtonBindings(port, &count) != nullptr) {
int numKeys = 0;
const bool* kbState = SDL_GetKeyboardState(&numKeys);
if (kbState[button]) {
actionPressData[port][static_cast<int>(action)].pressedCurFrame = true;
if (button <= PAD_KEY_MOUSE_LEFT && button >= PAD_KEY_MOUSE_X2) {
const auto mouseButtons = SDL_GetMouseState(nullptr, nullptr);
actionPressData[port][static_cast<int>(action)].pressedCurFrame =
(mouseButtons & SDL_BUTTON_MASK(-button - 1)) != 0;
} else {
int numKeys = 0;
const bool* kbState = SDL_GetKeyboardState(&numKeys);
if (button >= 0 && button < numKeys && kbState[button]) {
actionPressData[port][static_cast<int>(action)].pressedCurFrame = true;
}
}
} else {
// If controller is active