Jump to content

  • Log In with Google      Sign In   
  • Create Account


Rawinput x64 bit problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Zervoxe   Members   -  Reputation: 483

Like
0Likes
Like

Posted 26 August 2013 - 06:17 AM

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


Sponsor:

#2 BitMaster   Crossbones+   -  Reputation: 3771

Like
1Likes
Like

Posted 26 August 2013 - 06:19 AM

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.

#3 Yourself   Crossbones+   -  Reputation: 1066

Like
2Likes
Like

Posted 26 August 2013 - 06:37 AM

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


#4 Paradigm Shifter   Crossbones+   -  Reputation: 5213

Like
1Likes
Like

Posted 26 August 2013 - 06:37 AM

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

#5 Zervoxe   Members   -  Reputation: 483

Like
1Likes
Like

Posted 26 August 2013 - 06:59 AM



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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS