GlosSITarget: Allow live controller type switching from overlay

pull/183/head
Peter Repukat 2 years ago
parent c3b874c1b5
commit 771de64cec

@ -65,6 +65,11 @@ void InputRedirector::run()
countcopy = 0; countcopy = 0;
} }
Settings::controller.maxControllers = countcopy; Settings::controller.maxControllers = countcopy;
if (ImGui::Checkbox("Emulate DS4 (instead of Xbox360 controller)", &Settings::controller.emulateDS4)) {
controller_settings_changed_ = true;
}
bool enable_rumbe_copy = enable_rumble_; bool enable_rumbe_copy = enable_rumble_;
ImGui::Checkbox("Enable Rumble", &enable_rumbe_copy); ImGui::Checkbox("Enable Rumble", &enable_rumbe_copy);
enable_rumble_ = enable_rumbe_copy; enable_rumble_ = enable_rumbe_copy;
@ -78,7 +83,7 @@ void InputRedirector::run()
bool use_real_copy = Settings::devices.realDeviceIds; bool use_real_copy = Settings::devices.realDeviceIds;
ImGui::Checkbox("Use real USB-IDs", &use_real_copy); ImGui::Checkbox("Use real USB-IDs", &use_real_copy);
if (Settings::devices.realDeviceIds != use_real_copy) { if (Settings::devices.realDeviceIds != use_real_copy) {
use_real_vid_pid_changed_ = true; controller_settings_changed_ = true;
} }
Settings::devices.realDeviceIds = use_real_copy; Settings::devices.realDeviceIds = use_real_copy;
} }
@ -107,9 +112,9 @@ void InputRedirector::runLoop()
} }
while (run_) { while (run_) {
#ifdef _WIN32 #ifdef _WIN32
if (use_real_vid_pid_changed_) { if (controller_settings_changed_) {
// unplug all. // unplug all.
use_real_vid_pid_changed_ = false; controller_settings_changed_ = false;
for (int i = 0; i < XUSER_MAX_COUNT; i++) { for (int i = 0; i < XUSER_MAX_COUNT; i++) {
unplugVigemPad(i); unplugVigemPad(i);
} }

@ -42,7 +42,7 @@ class InputRedirector {
// variables for overlay element; run in different thread // variables for overlay element; run in different thread
static inline std::atomic<bool> enable_rumble_ = true; static inline std::atomic<bool> enable_rumble_ = true;
static inline std::atomic<bool> use_real_vid_pid_changed_ = false; static inline std::atomic<bool> controller_settings_changed_ = false;
bool vigem_connected_; bool vigem_connected_;

Loading…
Cancel
Save