From f2d4f10fc9deb75d8dfe6da1d71326d50afc0e99 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 11 Jul 2014 08:07:41 -0400 Subject: [PATCH] ControllerEmu: Remove support for the "Square Stick" option It was only used for really old joypads which we really don't want to support. If users have these joypads, they should look into using something at the OS level, as games shouldn't need to have this transformation; it should be done by the OS and driver. --- Source/Core/InputCommon/ControllerEmu.cpp | 2 -- Source/Core/InputCommon/ControllerEmu.h | 20 ++------------------ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/Source/Core/InputCommon/ControllerEmu.cpp b/Source/Core/InputCommon/ControllerEmu.cpp index 6d58e23e9b..e01ab90fb9 100644 --- a/Source/Core/InputCommon/ControllerEmu.cpp +++ b/Source/Core/InputCommon/ControllerEmu.cpp @@ -140,8 +140,6 @@ ControllerEmu::AnalogStick::AnalogStick(const char* const _name) : ControlGroup( settings.emplace_back(new Setting(_trans("Radius"), 0.7f, 0, 100)); settings.emplace_back(new Setting(_trans("Dead Zone"), 0, 0, 50)); - settings.emplace_back(new Setting(_trans("Square Stick"), 0)); - } ControllerEmu::Buttons::Buttons(const std::string& _name) : ControlGroup(_name, GROUP_TYPE_BUTTONS) diff --git a/Source/Core/InputCommon/ControllerEmu.h b/Source/Core/InputCommon/ControllerEmu.h index ebfd98294a..4cfc75b235 100644 --- a/Source/Core/InputCommon/ControllerEmu.h +++ b/Source/Core/InputCommon/ControllerEmu.h @@ -37,7 +37,6 @@ enum { SETTING_RADIUS, SETTING_DEADZONE, - SETTING_SQUARE, }; const char* const named_directions[] = @@ -132,7 +131,6 @@ public: ControlState radius = settings[SETTING_RADIUS]->value; ControlState deadzone = settings[SETTING_DEADZONE]->value; - ControlState square = settings[SETTING_SQUARE]->value; ControlState m = controls[4]->control_ref->State(); // modifier code @@ -142,32 +140,18 @@ public: xx = (fabsf(xx)>deadzone) * sign(xx) * (m + deadzone/2); } - // deadzone / square stick code - if (radius != 1 || deadzone || square) + if (radius != 1 || deadzone) { - // this section might be all wrong, but its working good enough, I think - ControlState ang = atan2(yy, xx); ControlState ang_sin = sin(ang); ControlState ang_cos = cos(ang); - // the amt a full square stick would have at current angle - ControlState square_full = std::min(ang_sin ? 1/fabsf(ang_sin) : 2, ang_cos ? 1/fabsf(ang_cos) : 2); - - // the amt a full stick would have that was ( user setting squareness) at current angle - // I think this is more like a pointed circle rather than a rounded square like it should be - ControlState stick_full = (1 + (square_full - 1) * square); - ControlState dist = sqrt(xx*xx + yy*yy); // dead zone code - dist = std::max(0.0f, dist - deadzone * stick_full); + dist = std::max(0.0f, dist - deadzone); dist /= (1 - deadzone); - // square stick code - ControlState amt = dist / stick_full; - dist -= ((square_full - 1) * amt * square); - // radius dist *= radius;