i say sorry in advance because this is a really specific question... one which even google cannot answer...
im currently trying to read gamepads / joysticks through the WM_INPUT message in windows. I had registered the two device types:
RAWINPUTDEVICE rid[2];
rid[0].usUsagePage = 0x01;
rid[0].usUsage = 0x05;
rid[0].dwFlags = RIDEV_INPUTSINK;
rid[0].hwndTarget = hWnd;
rid[1].usUsagePage = 0x01;
rid[1].usUsage = 0x04;
rid[1].dwFlags = RIDEV_INPUTSINK;
rid[1].hwndTarget = hWnd;
RegisterRawInputDevices(rid,2,sizeof(rid[0]));
and have started grabbing and translating the information as its received through the WNDPROC:
LRESULT CALLBACK WndProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam){
if(uMsg == WM_INPUT){
RAWINPUT raw;
UINT dwSize = sizeof(raw);
GetRawInputData(hRawInput,RID_INPUT,&raw,&dwSize,sizeof(RAWINPUTHEADER));
if(raw.header.dwType == RIM_TYPEHID){
BYTE* test = new BYTE[raw.data.hid.dwCount * raw.data.hid.dwSizeHid];
test = &raw.data.hid.bRawData;
}
}
return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
and this works perfectly with 2 of my 3 available gamepads...
my cheap 8 button, 2 axis gamepad works, my psp (running FuSa) works... however my USB connected PS3 controller does not...
instead it sends itself as RIM_TYPEMOUSE (instead of RIM_TYPEHID) and gives garbled data regardless of what i read it as (mouse, keyboard or hid)
im assuming this is not only the case for PS3 controllers, but also for other controllers that i havnt got at hand.
If i use the standard windows mmsystem to read gamepad input, the PS3 controller works as expected... however i must use the RAW_INPUT model to comply with my current layout...
does anyone know what im doing wrong, or any fixes to this issue?