There's already some in dinput, but this is a more appropriate location.
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
With the Sekiro test from last time, but injecting 2kHz mouse events to
better show the differences, brings the normal FPS from ~=50fps (the
missing esync series hurts badly here) down to ~=20fps on average with
some catch up moments, probably when LL hooks start to timeout in batch.
Patch #4 helps by doing less work in the LL hooks and using rawinput
messages instead, and bring it up to ~=30fps on average, but still with
the catch up moments.
And with patch #5 it holds the load much better, with a steady ~=45fps
thanks to the ll-hook removal.
dlls/user32/tests/input.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index 3130f3987e3..0607f300871 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -1757,6 +1757,7 @@ static void test_RegisterRawInputDevices(void)
{
HWND hwnd;
RAWINPUTDEVICE raw_devices[1];
+ UINT count, raw_devices_count;
BOOL res;
raw_devices[0].usUsagePage = 0x01;
@@ -1783,6 +1784,42 @@ static void test_RegisterRawInputDevices(void)
ok(res == TRUE, "RegisterRawInputDevices failed\n");
ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
+ SetLastError(0xdeadbeef);
+ count = GetRegisteredRawInputDevices(NULL, NULL, 0);
+ todo_wine
+ ok(count == ~0U, "GetRegisteredRawInputDevices returned %u\n", count);
+ todo_wine
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRegisteredRawInputDevices unexpected error %08x\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ raw_devices_count = 0;
+ count = GetRegisteredRawInputDevices(NULL, &raw_devices_count, 0);
+ todo_wine
+ ok(count == ~0U, "GetRegisteredRawInputDevices returned %u\n", count);
+ ok(raw_devices_count == 0, "Unexpected registered devices count: %u\n", raw_devices_count);
+ todo_wine
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetRegisteredRawInputDevices unexpected error %08x\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ raw_devices_count = 0;
+ count = GetRegisteredRawInputDevices(NULL, &raw_devices_count, sizeof(RAWINPUTDEVICE));
+ ok(count == 0, "GetRegisteredRawInputDevices returned %u\n", count);
+ todo_wine
+ ok(raw_devices_count == 1, "Unexpected registered devices count: %u\n", raw_devices_count);
+ ok(GetLastError() == 0xdeadbeef, "GetRegisteredRawInputDevices unexpected error %08x\n", GetLastError());
+
+ SetLastError(0xdeadbeef);
+ memset(raw_devices, 0, sizeof(raw_devices));
+ raw_devices_count = ARRAY_SIZE(raw_devices);
+ count = GetRegisteredRawInputDevices(raw_devices, &raw_devices_count, sizeof(RAWINPUTDEVICE));
+ todo_wine
+ ok(count == 1, "GetRegisteredRawInputDevices returned %u\n", count);
+ ok(raw_devices_count == 1, "Unexpected registered devices count: %u\n", raw_devices_count);
+ ok(GetLastError() == 0xdeadbeef, "GetRegisteredRawInputDevices unexpected error %08x\n", GetLastError());
+ todo_wine
+ ok(raw_devices[0].usUsagePage == 0x01, "Unexpected usage page: %x\n", raw_devices[0].usUsagePage);
+ todo_wine
+ ok(raw_devices[0].usUsage == 0x05, "Unexpected usage: %x\n", raw_devices[0].usUsage);
/* RIDEV_REMOVE requires hwndTarget == NULL */
raw_devices[0].dwFlags = RIDEV_REMOVE;
--
2.27.0