if (MAX_RAW_KEYBOARD > 0 && rnum_kb > MAX_RAW_KEYBOARD)
rnum_kb = MAX_RAW_KEYBOARD;
- write_log (_T("HID device check:\n"));
+ write_log (_T("HID device check (%d devices):\n"), gotnum);
for (int rawcnt = 0; rawcnt < gotnum; rawcnt++) {
HANDLE h = ridl[rawcnt].hDevice;
int type = ridl[rawcnt].dwType;
if (rawinput_decided) {
// must not enable rawinput later, even if rawinput capable device was plugged in
- if (type == RIM_TYPEKEYBOARD && !rawinput_enabled_keyboard)
+ if (type == RIM_TYPEKEYBOARD && !rawinput_enabled_keyboard) {
continue;
- if (type == RIM_TYPEMOUSE && !rawinput_enabled_mouse)
+ }
+ if (type == RIM_TYPEMOUSE && !rawinput_enabled_mouse) {
continue;
- if (type == RIM_TYPEHID && !rawinput_enabled_hid)
+ }
+ if (type == RIM_TYPEHID && !rawinput_enabled_hid) {
continue;
+ }
}
if (type == RIM_TYPEKEYBOARD) {
- if (num_keyboard >= rnum_kb)
+ if (num_keyboard >= rnum_kb) {
continue;
+ }
did = di_keyboard;
} else if (type == RIM_TYPEMOUSE) {
did = di_mouse;
} else if (type == RIM_TYPEHID) {
- if (!rawinput_enabled_hid)
+ if (!rawinput_enabled_hid) {
continue;
+ }
did = di_joystick;
} else
continue;
if (GetRawInputDeviceInfo (h, RIDI_DEVICENAME, NULL, &vtmp) == -1) {
- write_log (_T("%p RIDI_DEVICENAME failed\n"), h);
+ write_log (_T("%p RIDI_DEVICENAME failed %08x\n"), h, GetLastError());
continue;
}
if (vtmp >= bufsize) {
continue;
}
if (GetRawInputDeviceInfo (h, RIDI_DEVICENAME, buf1, &vtmp) == -1) {
- write_log (_T("%p RIDI_DEVICENAME %d failed\n"), h, vtmp);
+ write_log (_T("%p RIDI_DEVICENAME %d failed %08x\n"), h, vtmp, GetLastError());
continue;
}
memset (rdi, 0, sizeof (RID_DEVICE_INFO));
rdi->cbSize = sizeof (RID_DEVICE_INFO);
if (GetRawInputDeviceInfo (h, RIDI_DEVICEINFO, NULL, &vtmp) == -1) {
- write_log (_T("%p RIDI_DEVICEINFO failed\n"), h);
+ write_log (_T("%p RIDI_DEVICEINFO failed %08x\n"), h, GetLastError());
continue;
}
if (vtmp >= bufsize) {
continue;
}
if (GetRawInputDeviceInfo (h, RIDI_DEVICEINFO, buf2, &vtmp) == -1) {
- write_log (_T("%p RIDI_DEVICEINFO %d failed\n"), h, vtmp);
+ write_log (_T("%p RIDI_DEVICEINFO %d failed %08x\n"), h, vtmp, GetLastError());
continue;
}
#endif
write_log (_T("RawInput enumeration..\n"));
- if (!initialize_rawinput ())
+ if (!initialize_rawinput ()) {
rawinput_enabled_hid = 0;
+ }
if (!rawinput_decided) {
- if (!(no_rawinput & 1))
+ if (!(no_rawinput & 1)) {
rawinput_enabled_keyboard = true;
- if (!(no_rawinput & 2))
+ }
+ if (!(no_rawinput & 2)) {
rawinput_enabled_mouse = true;
+ }
rawinput_decided = true;
}
if (!rawhid_found) {
}
if (!no_directinput || !rawinput_enabled_keyboard || !rawinput_enabled_mouse) {
- hr = DirectInput8Create (hInst, DIRECTINPUT_VERSION, IID_IDirectInput8, (LPVOID *)&g_lpdi, NULL);
+ hr = DirectInput8Create (hInst, DIRECTINPUT_VERSION, IID_IDirectInput8, (LPVOID*)&g_lpdi, NULL);
if (FAILED (hr)) {
write_log (_T("DirectInput8Create failed, %s\n"), DXError (hr));
} else {