summaryrefslogtreecommitdiffhomepage
path: root/dinput
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-04-02 11:20:54 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-04-05 00:16:14 +0200
commit43f082e9de6cacab40b7df63ca4ea40a63a8440d (patch)
tree9aa7b320a3e8a3b5cff6cc0a94aa92d426a66941 /dinput
parent93bb0f6acb6c99fe5748f118daccfa75dbcde0c3 (diff)
dinput: try fix cpu usage
I forgot who reported this, sorry.
Diffstat (limited to 'dinput')
-rw-r--r--dinput/keybinding-worker.cpp2
-rw-r--r--dinput/keybinding-worker.hpp2
-rw-r--r--dinput/win32-joystick.cpp3
-rw-r--r--dinput/win32-joystick.hpp3
4 files changed, 5 insertions, 5 deletions
diff --git a/dinput/keybinding-worker.cpp b/dinput/keybinding-worker.cpp
index 30d21534..adcd9a96 100644
--- a/dinput/keybinding-worker.cpp
+++ b/dinput/keybinding-worker.cpp
@@ -194,7 +194,7 @@ void KeybindingWorker::run()
}
}
- Sleep(100);
+ Sleep(25);
}
}
diff --git a/dinput/keybinding-worker.hpp b/dinput/keybinding-worker.hpp
index 407b0107..2596bda0 100644
--- a/dinput/keybinding-worker.hpp
+++ b/dinput/keybinding-worker.hpp
@@ -61,7 +61,7 @@ private:
void remove_receiver(fun* pos);
~KeybindingWorker();
- static constexpr int num_keyboard_states = 128;
+ static constexpr int num_keyboard_states = 16;
DIDEVICEOBJECTDATA keyboard_states[num_keyboard_states];
KeybindingWorker(const KeybindingWorker&) = delete;
diff --git a/dinput/win32-joystick.cpp b/dinput/win32-joystick.cpp
index 9127b6a8..c20aefce 100644
--- a/dinput/win32-joystick.cpp
+++ b/dinput/win32-joystick.cpp
@@ -12,8 +12,7 @@
#include <QDebug>
// XXX how many axis update events can we reasonably get in a short time frame?
-enum { num_buffers = 256 };
-DIDEVICEOBJECTDATA win32_joy_ctx::joy::keystate_buffers[num_buffers];
+DIDEVICEOBJECTDATA win32_joy_ctx::joy::keystate_buffers[win32_joy_ctx::joy::num_buffers];
QMutex win32_joy_ctx::enum_state::mtx;
win32_joy_ctx::enum_state win32_joy_ctx::enumerator;
diff --git a/dinput/win32-joystick.hpp b/dinput/win32-joystick.hpp
index 42ecf57f..f7ea1302 100644
--- a/dinput/win32-joystick.hpp
+++ b/dinput/win32-joystick.hpp
@@ -47,7 +47,8 @@ struct OTR_DINPUT_EXPORT win32_joy_ctx
//bool pressed[num_pressed_keys] {};
Timer first_timer;
- static DIDEVICEOBJECTDATA keystate_buffers[256];
+ static constexpr int num_buffers = 16;
+ static DIDEVICEOBJECTDATA keystate_buffers[num_buffers];
joy(LPDIRECTINPUTDEVICE8 handle, const QString& guid, const QString& name);
~joy();