Fixed m_rawinput

This commit is contained in:
unknown 2024-08-28 01:25:32 +02:00
parent 956d26bcb3
commit 21f48090c3

View file

@ -11,6 +11,7 @@
#include "tier0/etwprof.h" #include "tier0/etwprof.h"
#include "tier1/convar.h" #include "tier1/convar.h"
#include "tier0/icommandline.h" #include "tier0/icommandline.h"
#include <winuser.h>
#if defined( USE_SDL ) #if defined( USE_SDL )
#undef M_PI #undef M_PI
@ -1461,16 +1462,15 @@ LRESULT CInputSystem::WindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP
{ {
if ( m_bRawInputSupported ) if ( m_bRawInputSupported )
{ {
UINT dwSize = 40; static RAWINPUT raw;
static BYTE lpb[40]; 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_mouseRawAccumX += raw.data.mouse.lLastX;
m_mouseRawAccumY += raw->data.mouse.lLastY; m_mouseRawAccumY += raw.data.mouse.lLastY;
} }
} }
} }