mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-05 01:38:36 +00:00
SWORD25: Fix out of bounds writes when pressing keys like ctrl or F-keys
This fixes a crash one got by quitting via the GMM. svn-id: r53876
This commit is contained in:
parent
9ab69ab6f4
commit
b5e41b3a82
@ -169,6 +169,7 @@ void InputEngine::testForLeftDoubleClick() {
|
||||
}
|
||||
|
||||
void InputEngine::alterKeyboardState(int keycode, byte newState) {
|
||||
assert(keycode < ARRAYSIZE(_keyboardState[_currentState]));
|
||||
_keyboardState[_currentState][keycode] = newState;
|
||||
}
|
||||
|
||||
@ -193,10 +194,12 @@ int InputEngine::getMouseY() {
|
||||
}
|
||||
|
||||
bool InputEngine::isKeyDown(uint keyCode) {
|
||||
assert(keyCode < ARRAYSIZE(_keyboardState[_currentState]));
|
||||
return (_keyboardState[_currentState][keyCode] & 0x80) != 0;
|
||||
}
|
||||
|
||||
bool InputEngine::wasKeyDown(uint keyCode) {
|
||||
assert(keyCode < ARRAYSIZE(_keyboardState[_currentState]));
|
||||
return ((_keyboardState[_currentState][keyCode] & 0x80) == 0) &&
|
||||
((_keyboardState[_currentState ^ 1][keyCode] & 0x80) != 0);
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ private:
|
||||
void testForLeftDoubleClick();
|
||||
void alterKeyboardState(int keycode, byte newState);
|
||||
|
||||
byte _keyboardState[2][256];
|
||||
byte _keyboardState[2][512];
|
||||
bool _leftMouseState[2];
|
||||
bool _rightMouseState[2];
|
||||
uint _currentState;
|
||||
|
Loading…
x
Reference in New Issue
Block a user