]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
More logging added
authorToni Wilen <twilen@winuae.net>
Wed, 15 Oct 2025 15:01:57 +0000 (18:01 +0300)
committerToni Wilen <twilen@winuae.net>
Wed, 15 Oct 2025 15:01:57 +0000 (18:01 +0300)
od-win32/dinput.cpp

index 62629d1b6123283280398c08ec8d564b47aa574e..046fbaac935a2c8dd6fdfd64ade545b5d35a388c 100644 (file)
@@ -1627,7 +1627,7 @@ static bool initialize_rawinput (void)
        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;
@@ -1640,28 +1640,33 @@ static bool initialize_rawinput (void)
 
                        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) {
@@ -1669,7 +1674,7 @@ static bool initialize_rawinput (void)
                                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;
                        }
 
@@ -1677,7 +1682,7 @@ static bool initialize_rawinput (void)
                        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) {
@@ -1685,7 +1690,7 @@ static bool initialize_rawinput (void)
                                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;
                        }
 
@@ -3373,14 +3378,17 @@ static int di_do_init (void)
 #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) {
@@ -3390,7 +3398,7 @@ static int di_do_init (void)
        }
 
        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 {