From b2bf666510ae7e4d4fa71f7ab2de4728a050ef3c Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sun, 28 Jan 2024 21:14:10 +0100 Subject: Fixed crash due to SDL2 porting issue SDL_GetKeyState used to return an array that is indexed by SDLKey, but its equivalant, SDL_GetKeyboardState, returns an array that is supposed to be indexed using SDL_Scancode. --- src/keyboardconfig.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp index dfd461db..3632acf9 100644 --- a/src/keyboardconfig.cpp +++ b/src/keyboardconfig.cpp @@ -228,7 +228,8 @@ bool KeyboardConfig::isKeyActive(int index) const { if (!mActiveKeys) return false; - return mActiveKeys[mKey[index].value]; + int scanCode = SDL_GetScancodeFromKey(mKey[index].value); + return mActiveKeys[scanCode]; } void KeyboardConfig::refreshActiveKeys() -- cgit v1.2.3-70-g09d2