Sign in to follow this  
Zervoxe

Rawinput x64 bit problem

Recommended Posts

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);

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites


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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this