From 9672701743805b894327db82c7f3c214727415f6 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sun, 1 Jun 2014 18:25:35 -0400 Subject: [PATCH 1/3] Win32 buildfix and warning fix. I don't know how many pads are supposed to be supported, but I went with a reasonable number until the proper amount is committed. --- Windows/DinputDevice.cpp | 4 +++- Windows/DinputDevice.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Windows/DinputDevice.cpp b/Windows/DinputDevice.cpp index f25559bc6c..518106258b 100644 --- a/Windows/DinputDevice.cpp +++ b/Windows/DinputDevice.cpp @@ -143,6 +143,8 @@ DinputDevice::DinputDevice(int devnum) { return; } + const int MAX_NUM_PADS = 4; + if (devnum >= MAX_NUM_PADS) { return; @@ -318,7 +320,7 @@ void DinputDevice::ApplyButtons(DIJOYSTATE2 &state, InputState &input_state) { } } -int DinputDevice::getNumPads() +size_t DinputDevice::getNumPads() { if (devices.empty()) { diff --git a/Windows/DinputDevice.h b/Windows/DinputDevice.h index e27bd66840..d3f56df9d1 100644 --- a/Windows/DinputDevice.h +++ b/Windows/DinputDevice.h @@ -32,7 +32,7 @@ public: ~DinputDevice(); virtual int UpdateState(InputState &input_state); virtual bool IsPad() { return true; } - static int getNumPads(); + static size_t getNumPads(); private: void ApplyButtons(DIJOYSTATE2 &state, InputState &input_state); //unfortunate and unclean way to keep only one DirectInput instance around From 58411136ee3eb954dbdf2656f7977c05e806fba8 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sun, 1 Jun 2014 18:32:14 -0400 Subject: [PATCH 2/3] Remove the const int, and fix another warning. --- Windows/DinputDevice.cpp | 2 -- Windows/WindowsHost.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Windows/DinputDevice.cpp b/Windows/DinputDevice.cpp index 518106258b..7ed812392a 100644 --- a/Windows/DinputDevice.cpp +++ b/Windows/DinputDevice.cpp @@ -143,8 +143,6 @@ DinputDevice::DinputDevice(int devnum) { return; } - const int MAX_NUM_PADS = 4; - if (devnum >= MAX_NUM_PADS) { return; diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index 3a3b751e9a..62a661cdb0 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -87,7 +87,7 @@ WindowsHost::WindowsHost(HWND mainWindow) { //add first XInput device to respond input.push_back(std::shared_ptr(new XinputDevice())); //find all connected DInput devices of class GamePad - int numDInputDevs = DinputDevice::getNumPads(); + size_t numDInputDevs = DinputDevice::getNumPads(); for (int i = 0; i < numDInputDevs; i++) { input.push_back(std::shared_ptr(new DinputDevice(i))); From 1059f99d69a09a6b9173ab52d58a90d57c1d6c4c Mon Sep 17 00:00:00 2001 From: The Dax Date: Sun, 1 Jun 2014 18:53:35 -0400 Subject: [PATCH 3/3] One more warning fix. --- Windows/WindowsHost.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index 62a661cdb0..bf6ca575ae 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -88,9 +88,9 @@ WindowsHost::WindowsHost(HWND mainWindow) { input.push_back(std::shared_ptr(new XinputDevice())); //find all connected DInput devices of class GamePad size_t numDInputDevs = DinputDevice::getNumPads(); - for (int i = 0; i < numDInputDevs; i++) + for (size_t i = 0; i < numDInputDevs; i++) { - input.push_back(std::shared_ptr(new DinputDevice(i))); + input.push_back(std::shared_ptr(new DinputDevice(static_cast(i)))); } keyboard = std::shared_ptr(new KeyboardDevice()); input.push_back(keyboard);