diff --git a/inputsystem/inputsystem.cpp b/inputsystem/inputsystem.cpp index 6ec446d974..ec6d863711 100644 --- a/inputsystem/inputsystem.cpp +++ b/inputsystem/inputsystem.cpp @@ -11,6 +11,7 @@ #include "tier0/etwprof.h" #include "tier1/convar.h" #include "tier0/icommandline.h" +#include #if defined( USE_SDL ) #undef M_PI @@ -1461,16 +1462,15 @@ LRESULT CInputSystem::WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP { if ( m_bRawInputSupported ) { - UINT dwSize = 40; - static BYTE lpb[40]; + static RAWINPUT raw; + UINT dwSize = sizeof(raw); - pfnGetRawInputData((HRAWINPUT)lParam, RID_INPUT, lpb, &dwSize, sizeof(RAWINPUTHEADER)); + pfnGetRawInputData((HRAWINPUT)lParam, RID_INPUT, &raw, &dwSize, sizeof(RAWINPUTHEADER)); - RAWINPUT* raw = (RAWINPUT*)lpb; - if (raw->header.dwType == RIM_TYPEMOUSE) + if (raw.header.dwType == RIM_TYPEMOUSE) { - m_mouseRawAccumX += raw->data.mouse.lLastX; - m_mouseRawAccumY += raw->data.mouse.lLastY; + m_mouseRawAccumX += raw.data.mouse.lLastX; + m_mouseRawAccumY += raw.data.mouse.lLastY; } } }