From cb07da198b78b00dd60b9c2b697778414777f85c Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 16 Aug 2014 15:05:37 -0400 Subject: [PATCH 1/4] Make the keyboard analog limiter customisable. --- Core/Config.cpp | 4 +++- Core/Config.h | 3 +++ UI/EmuScreen.cpp | 4 ++-- UI/GameSettingsScreen.cpp | 7 +++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 04ea53e84c..d4843aa36c 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -541,7 +541,9 @@ static ConfigSetting controlSettings[] = { ConfigSetting("AnalogStickX", &g_Config.fAnalogStickX, -1.0f), ConfigSetting("AnalogStickY", &g_Config.fAnalogStickY, -1.0f), ConfigSetting("AnalogStickScale", &g_Config.fAnalogStickScale, defaultControlScale), - +#if !defined(MOBILE_DEVICE) + ConfigSetting("AnalogLimiterDeadzone", &g_Config.fAnalogLimiterDeadzone, 0.5f), +#endif ConfigSetting(false), }; diff --git a/Core/Config.h b/Core/Config.h index f262a4710a..5966c87344 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -248,6 +248,9 @@ public: bool bHapticFeedback; +#if !defined(MOBILE_DEVICE) + float fAnalogLimiterDeadzone; +#endif // GLES backend-specific hacks. Not saved to the ini file, do not add checkboxes. Will be made into // proper options when good enough. // PrescaleUV: diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 22780f858c..d01cae3a31 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -372,7 +372,7 @@ void EmuScreen::onVKeyUp(int virtualKeyCode) { } inline void EmuScreen::setVKeyAnalogX(int stick, int virtualKeyMin, int virtualKeyMax) { - const float value = virtKeys[VIRTKEY_ANALOG_LIGHTLY - VIRTKEY_FIRST] ? 0.5f : 1.0f; + const float value = virtKeys[VIRTKEY_ANALOG_LIGHTLY - VIRTKEY_FIRST] ? g_Config.fAnalogLimiterDeadzone : 1.0f; float axis = 0.0f; // The down events can repeat, so just trust the virtKeys array. if (virtKeys[virtualKeyMin - VIRTKEY_FIRST]) @@ -383,7 +383,7 @@ inline void EmuScreen::setVKeyAnalogX(int stick, int virtualKeyMin, int virtualK } inline void EmuScreen::setVKeyAnalogY(int stick, int virtualKeyMin, int virtualKeyMax) { - const float value = virtKeys[VIRTKEY_ANALOG_LIGHTLY - VIRTKEY_FIRST] ? 0.5f : 1.0f; + const float value = virtKeys[VIRTKEY_ANALOG_LIGHTLY - VIRTKEY_FIRST] ? g_Config.fAnalogLimiterDeadzone : 1.0f; float axis = 0.0f; if (virtKeys[virtualKeyMin - VIRTKEY_FIRST]) axis -= value; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index c32287bb7a..45637e5378 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -350,10 +350,13 @@ void GameSettingsScreen::CreateViews() { View *style = controlsSettings->Add(new PopupMultiChoice(&g_Config.iTouchButtonStyle, c->T("Button style"), touchControlStyles, 0, ARRAY_SIZE(touchControlStyles), c, screenManager())); style->SetEnabledPtr(&g_Config.bShowTouchControls); -#if defined(USING_WIN_UI) +#if !defined(MOBILE_DEVICE) controlsSettings->Add(new ItemHeader(c->T("Keyboard", "Keyboard Control Settings"))); +#if defined(USING_WIN_UI) controlsSettings->Add(new CheckBox(&g_Config.bIgnoreWindowsKey, c->T("Ignore Windows Key"))); -#endif +#endif // #if defined(USING_WIN_UI) + controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fAnalogLimiterDeadzone, 0.0f, 1.0f, "Analog Limiter", 0.10f, screenManager())); +#endif // #if !defined(MOBILE_DEVICE) // System ViewGroup *systemSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); From 784f311d768852dbf2d360e290ba29b130b985f8 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 16 Aug 2014 15:33:05 -0400 Subject: [PATCH 2/4] Make it available for everybody. --- Common/KeyMap.cpp | 4 +--- Core/Config.cpp | 3 +-- Core/Config.h | 2 -- UI/GameSettingsScreen.cpp | 2 -- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Common/KeyMap.cpp b/Common/KeyMap.cpp index 8a31095de9..6b3bfc5bad 100644 --- a/Common/KeyMap.cpp +++ b/Common/KeyMap.cpp @@ -630,9 +630,7 @@ const KeyMap_IntStrPair psp_button_names[] = { {VIRTKEY_AXIS_Y_MIN, "An.Down"}, {VIRTKEY_AXIS_X_MIN, "An.Left"}, {VIRTKEY_AXIS_X_MAX, "An.Right"}, -#ifndef MOBILE_DEVICE - { VIRTKEY_ANALOG_LIGHTLY, "Analog limiter" }, -#endif + {VIRTKEY_ANALOG_LIGHTLY, "Analog limiter"}, {VIRTKEY_RAPID_FIRE, "RapidFire"}, {VIRTKEY_UNTHROTTLE, "Unthrottle"}, diff --git a/Core/Config.cpp b/Core/Config.cpp index d4843aa36c..09831af2ba 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -541,9 +541,8 @@ static ConfigSetting controlSettings[] = { ConfigSetting("AnalogStickX", &g_Config.fAnalogStickX, -1.0f), ConfigSetting("AnalogStickY", &g_Config.fAnalogStickY, -1.0f), ConfigSetting("AnalogStickScale", &g_Config.fAnalogStickScale, defaultControlScale), -#if !defined(MOBILE_DEVICE) ConfigSetting("AnalogLimiterDeadzone", &g_Config.fAnalogLimiterDeadzone, 0.5f), -#endif + ConfigSetting(false), }; diff --git a/Core/Config.h b/Core/Config.h index 5966c87344..a21be55426 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -248,9 +248,7 @@ public: bool bHapticFeedback; -#if !defined(MOBILE_DEVICE) float fAnalogLimiterDeadzone; -#endif // GLES backend-specific hacks. Not saved to the ini file, do not add checkboxes. Will be made into // proper options when good enough. // PrescaleUV: diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 45637e5378..073bed439f 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -350,13 +350,11 @@ void GameSettingsScreen::CreateViews() { View *style = controlsSettings->Add(new PopupMultiChoice(&g_Config.iTouchButtonStyle, c->T("Button style"), touchControlStyles, 0, ARRAY_SIZE(touchControlStyles), c, screenManager())); style->SetEnabledPtr(&g_Config.bShowTouchControls); -#if !defined(MOBILE_DEVICE) controlsSettings->Add(new ItemHeader(c->T("Keyboard", "Keyboard Control Settings"))); #if defined(USING_WIN_UI) controlsSettings->Add(new CheckBox(&g_Config.bIgnoreWindowsKey, c->T("Ignore Windows Key"))); #endif // #if defined(USING_WIN_UI) controlsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fAnalogLimiterDeadzone, 0.0f, 1.0f, "Analog Limiter", 0.10f, screenManager())); -#endif // #if !defined(MOBILE_DEVICE) // System ViewGroup *systemSettingsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT)); From 713db4ff203a3366847fb318850c33f75df094c8 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 16 Aug 2014 17:05:09 -0400 Subject: [PATCH 3/4] Update native. --- native | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native b/native index 9b038d40be..2ba8e36b2b 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 9b038d40be391d0971e6d39ab1ae1afd1115e338 +Subproject commit 2ba8e36b2bde65021c9a5c0f937a0e3892c2ad62 From 75e280e6fe73555388609145b6b377b129ee99f6 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sun, 17 Aug 2014 14:39:34 -0400 Subject: [PATCH 4/4] Default to a deadzone 0.6f (60%) instead, as suggested. --- Core/Config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 09831af2ba..d740dbae8d 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -541,7 +541,7 @@ static ConfigSetting controlSettings[] = { ConfigSetting("AnalogStickX", &g_Config.fAnalogStickX, -1.0f), ConfigSetting("AnalogStickY", &g_Config.fAnalogStickY, -1.0f), ConfigSetting("AnalogStickScale", &g_Config.fAnalogStickScale, defaultControlScale), - ConfigSetting("AnalogLimiterDeadzone", &g_Config.fAnalogLimiterDeadzone, 0.5f), + ConfigSetting("AnalogLimiterDeadzone", &g_Config.fAnalogLimiterDeadzone, 0.6f), ConfigSetting(false), };