Rawinput x64 bit problem

Started by
3 comments, last by Zervoxe 10 years, 8 months ago

My problem is when I move the mouse in x64 it only moves to right, it ignores up,left and down, it also does it extremely slowly(it only registers a quarter of the mouse delta move) compared to Win32. I expect this is a result of long being 64bit in Win64, and how would I deal with this change?

WM_INPUT in main.cpp


UInt nSize = 40;
BYTE m_Buffer[40];
GetRawInputData( (HRAWINPUT)lparam, RID_INPUT, (LPVOID)m_Buffer, &nSize, sizeof(RAWINPUTHEADER));
//ASSERT( nSize <= BUFFER_SIZE );
RAWINPUT* pRaw = (RAWINPUT*) m_Buffer;

// Read keyboard and mouse data
if( pRaw->header.dwType == RIM_TYPEKEYBOARD ){Kb.GatherRawInput(&pRaw->data.keyboard );}
if( pRaw->header.dwType == RIM_TYPEMOUSE ){Ms.GatherRawInput( &pRaw->data.mouse);}

Inside MsGatherRawInput

delta is a int x,y structure.


delta.set((int)pRM->lLastX,(int)pRM->lLastY);
Advertisement
I'm unfamiliar with that part of the API but this behavior after a move from a 32bit API to a 64bit API suggests the int casts in "delta.set((int)pRM->lLastX,(int)pRM->lLastY);" might not a good idea.

UInt nSize = 40;
BYTE m_Buffer[40];

The size difference between 32bit and 64bit.

use something like:


uint8 buffer[sizeof(RAWINPUT)] = {};
uint32 size = sizeof(RAWINPUT);

I'm fairly certain that LONG is still 32 bits in win64, for legacy code reasons, LONGLONG is 64 bit?

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley



UInt nSize = 40;
BYTE m_Buffer[40];

The size difference between 32bit and 64bit.

use something like:




uint8 buffer[sizeof(RAWINPUT)] = {};
uint32 size = sizeof(RAWINPUT);

Your nick is confusing, but thank you, this worked splendidly.

Thanks for all the fast replies guys.

This topic is closed to new replies.

Advertisement