From 6c5c26e914c2f515f1ca678fa32ab78750b8a4b5 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 30 Aug 2015 06:26:03 +0200 Subject: win32-joystick: allow for unique selection of joysticks Distinguish joystick GUIDs to allow selecting one of several with the same name. Issue: #230 --- ftnoir_tracker_joystick/ftnoir_tracker_joystick.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'ftnoir_tracker_joystick/ftnoir_tracker_joystick.h') diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h index 0958246a..ab32ec56 100644 --- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h +++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.h @@ -30,11 +30,12 @@ using namespace options; struct settings : opts { - value joyid; + value joyid, guid; value joy_1, joy_2, joy_3, joy_4, joy_5, joy_6; settings() : opts("tracker-joystick"), joyid(b, "joy-id", ""), + guid(b, "joy-guid", ""), joy_1(b, "axis-map-1", 1), joy_2(b, "axis-map-2", 2), joy_3(b, "axis-map-3", 3), @@ -44,6 +45,18 @@ struct settings : opts { {} }; +template +QString guid_to_string(const GUID guid) +{ + char buf[40] = {0}; + wchar_t szGuidW[40] = {0}; + + StringFromGUID2(guid, szGuidW, 40); + WideCharToMultiByte(0, 0, szGuidW, -1, buf, 40, NULL, NULL); + + return QString(buf); +} + class FTNoIR_Tracker : public ITracker { public: @@ -59,6 +72,7 @@ public: DIDEVICEINSTANCE def; int iter; // XXX bad style settings s; + QString guid_to_check; static constexpr int AXIS_MAX = 65535; }; -- cgit v1.2.3