From 931a31decae90efdd18b763030c9e07630339a47 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Wed, 31 Aug 2011 20:46:04 -0500 Subject: [PATCH 1/3] Untested attempt to fix real gcpad sticks not being detected by the input configuration dialogs. --- .../Src/ControllerInterface/ControllerInterface.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp index a995ae415a..e6f2f508d2 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp @@ -18,7 +18,10 @@ #include "Thread.h" -#define INPUT_DETECT_THRESHOLD 0.85f +namespace +{ +const float INPUT_DETECT_THRESHOLD = 0.65f; +} ControllerInterface g_controller_interface; From 27bda2c054f38cdd8b6a04fe939ea006535ae532 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Tue, 13 Dec 2011 02:02:31 +0100 Subject: [PATCH 2/3] Fixed range check on TryParse() for u32, again. The code from 748be364e5ee incorrectly accepted -0x100000000 on x86_64. Also if ERANGE is returned by strtoul(), reject the parsed value regardless of what that value is. This fixes invalid values being returned when compiling with Visual C++. Thanks to "cotton" for testing this. --- Source/Core/Common/Src/StringUtil.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index 94f01e66f8..cdd1016210 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -130,12 +130,13 @@ bool TryParse(const std::string &str, u32 *const output) if (!endptr || *endptr) return false; - if (value == ULONG_MAX && errno == ERANGE) + if (errno == ERANGE) return false; if (ULONG_MAX > UINT_MAX) { - // Leading bits must be either all 0 or all 1. - if ((~value | UINT_MAX) != ULONG_MAX && (value | UINT_MAX) != ULONG_MAX) + // Note: The typecasts avoid GCC warnings when long is 32 bits wide. + if (value >= static_cast(0x100000000ull) + && value <= static_cast(0xFFFFFFFF00000000ull)) return false; } From 09d2301fed1f55989e937bcc45897426347e3b44 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 12 Dec 2011 23:24:10 -0600 Subject: [PATCH 3/3] detect input at 55% to catch silly c-stick range --- .../InputCommon/Src/ControllerInterface/ControllerInterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp index e6f2f508d2..82cfe2469e 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.cpp @@ -20,7 +20,7 @@ namespace { -const float INPUT_DETECT_THRESHOLD = 0.65f; +const float INPUT_DETECT_THRESHOLD = 0.55f; } ControllerInterface g_controller_interface;