From 444dce4aebe2e0e5a8cedb27036677be914a612c Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 29 Jun 2022 13:39:39 +1000 Subject: [PATCH] PAD: Fix incorrect MAX_KEYS check --- pcsx2/PAD/Host/Global.h | 5 ++--- pcsx2/PAD/Host/PAD.cpp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pcsx2/PAD/Host/Global.h b/pcsx2/PAD/Host/Global.h index 63ebcf0813..3fb8755615 100644 --- a/pcsx2/PAD/Host/Global.h +++ b/pcsx2/PAD/Host/Global.h @@ -17,8 +17,6 @@ #include "common/Pcsx2Defs.h" -static const u32 MAX_KEYS = 25; - enum gamePadValues { PAD_UP, // Directional pad ↑ @@ -46,7 +44,8 @@ enum gamePadValues PAD_R_UP, // Right joystick (Up) ↑ PAD_R_RIGHT, // Right joystick (Right) → PAD_R_DOWN, // Right joystick (Down) ↓ - PAD_R_LEFT // Right joystick (Left) ← + PAD_R_LEFT, // Right joystick (Left) ← + MAX_KEYS, }; static inline bool IsAnalogKey(int index) diff --git a/pcsx2/PAD/Host/PAD.cpp b/pcsx2/PAD/Host/PAD.cpp index bd07d4b0c7..19d748bc03 100644 --- a/pcsx2/PAD/Host/PAD.cpp +++ b/pcsx2/PAD/Host/PAD.cpp @@ -546,7 +546,7 @@ bool PAD::MapController(SettingsInterface& si, u32 controller, void PAD::SetControllerState(u32 controller, u32 bind, float value) { - if (controller >= NUM_CONTROLLER_PORTS || bind >= MAX_KEYS) + if (controller >= NUM_CONTROLLER_PORTS || bind > MAX_KEYS) return; g_key_status.Set(controller, bind, value);