diff --git a/SHADE_Engine/src/Input/SHInputManager.cpp b/SHADE_Engine/src/Input/SHInputManager.cpp index c665a9c9..4849a772 100644 --- a/SHADE_Engine/src/Input/SHInputManager.cpp +++ b/SHADE_Engine/src/Input/SHInputManager.cpp @@ -25,16 +25,16 @@ namespace SHADE std::map SHInputManager::bindings; unsigned SHInputManager::keyCount = 0; - bool SHInputManager::keys[MAX_KEYS]; - bool SHInputManager::keysLast[MAX_KEYS]; - double SHInputManager::keysHeldTime[MAX_KEYS]; - double SHInputManager::keysReleasedTime[MAX_KEYS]; + bool SHInputManager::keys[MAX_KEYS] = {}; + bool SHInputManager::keysLast[MAX_KEYS] = {}; + double SHInputManager::keysHeldTime[MAX_KEYS] = {}; + double SHInputManager::keysReleasedTime[MAX_KEYS] = {}; unsigned SHInputManager::keyToggleCount = 0; - bool SHInputManager::keysToggle[MAX_KEYS]; - bool SHInputManager::keysToggleLast[MAX_KEYS]; - double SHInputManager::keysToggleOnTime[MAX_KEYS]; - double SHInputManager::keysToggleOffTime[MAX_KEYS]; + bool SHInputManager::keysToggle[MAX_KEYS] = {}; + bool SHInputManager::keysToggleLast[MAX_KEYS] = {}; + double SHInputManager::keysToggleOnTime[MAX_KEYS] = {}; + double SHInputManager::keysToggleOffTime[MAX_KEYS] = {}; int SHInputManager::mouseScreenX = 0; int SHInputManager::mouseScreenY = 0; @@ -46,11 +46,11 @@ namespace SHADE int SHInputManager::mouseWheelVerticalDeltaPoll = 0; unsigned char SHInputManager::controllersConnectedCount = 0; - unsigned SHInputManager::controllersInputCount[XUSER_MAX_COUNT]; - unsigned SHInputManager::controllersButtonCount[XUSER_MAX_COUNT]; - short SHInputManager::controllers[XUSER_MAX_COUNT][MAX_CONTROLLER_INPUT]; - short SHInputManager::controllersLast[XUSER_MAX_COUNT][MAX_CONTROLLER_INPUT]; - double SHInputManager::controllersHeldTime[XUSER_MAX_COUNT][MAX_CONTROLLER_INPUT]; + unsigned SHInputManager::controllersInputCount[XUSER_MAX_COUNT] = {}; + unsigned SHInputManager::controllersButtonCount[XUSER_MAX_COUNT] = {}; + short SHInputManager::controllers[XUSER_MAX_COUNT][MAX_CONTROLLER_INPUT] = {}; + short SHInputManager::controllersLast[XUSER_MAX_COUNT][MAX_CONTROLLER_INPUT] = {}; + double SHInputManager::controllersHeldTime[XUSER_MAX_COUNT][MAX_CONTROLLER_INPUT] = {}; double SHInputManager::controllersReleasedTime[XUSER_MAX_COUNT][MAX_CONTROLLER_INPUT]; //Internal helper function for splitting between inputs @@ -106,9 +106,11 @@ namespace SHADE memcpy(keysLast, keys, sizeof(keys)); //Poll - unsigned char keyboardState[MAX_KEYS]; + unsigned char keyboardState[MAX_KEYS] = {}; + SecureZeroMemory(keyboardState, sizeof(keyboardState)); //if (GetKeyboardState(keyboardState) == false) return; - SHASSERT(GetKeyboardState(keyboardState), "SHInputManager:GetKeyboardState() failed ({})", GetLastError()); + bool keyboardStateGot = GetKeyboardState(keyboardState); + SHASSERT(keyboardStateGot, "SHInputManager:GetKeyboardState() failed ({})", GetLastError()); keyCount = 0; keyToggleCount = 0; for (size_t i = 0; i < MAX_KEYS; ++i)