From 9bb63bf2eb66a13705ca67f449d4819cbfcdf053 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Fri, 4 Sep 2015 20:06:01 -0500 Subject: [PATCH] [Android] Fix multi-gamecube controller input, config changes --- .../dolphinemu/utils/UserPreferences.java | 25 +++++++++++++++---- .../app/src/main/res/xml/preferences.xml | 4 +-- .../Core/DolphinWX/Android/ButtonManager.cpp | 8 ------ 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/UserPreferences.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/UserPreferences.java index 168bd2dd93..59573132a4 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/UserPreferences.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/UserPreferences.java @@ -45,14 +45,14 @@ public final class UserPreferences else editor.putString("cpuCorePref", getConfig("Dolphin.ini", "Core", "CPUCore", "3")); - editor.putBoolean("dualCorePref", getConfig("Dolphin.ini", "Core", "CPUThread", "False").equals("True")); - editor.putBoolean("fastmemPref", getConfig("Dolphin.ini", "Core", "Fastmem", "False").equals("True")); + editor.putBoolean("dualCorePref", getConfig("Dolphin.ini", "Core", "CPUThread", "True").equals("True")); + editor.putBoolean("fastmemPref", getConfig("Dolphin.ini", "Core", "Fastmem", "True").equals("True")); editor.putString("gpuPref", getConfig("Dolphin.ini", "Core", "GFXBackend", "OGL")); editor.putBoolean("showFPS", getConfig("gfx_opengl.ini", "Settings", "ShowFPS", "False").equals("True")); editor.putBoolean("drawOnscreenControls", getConfig("Dolphin.ini", "Android", "ScreenControls", "True").equals("True")); - editor.putString("internalResolution", getConfig("gfx_opengl.ini", "Settings", "EFBScale", "2") ); + editor.putString("internalResolution", getConfig("gfx_opengl.ini", "Settings", "EFBScale", "2")); editor.putString("FSAA", getConfig("gfx_opengl.ini", "Settings", "MSAA", "0")); editor.putString("anisotropicFiltering", getConfig("gfx_opengl.ini", "Enhancements", "MaxAnisotropy", "0")); editor.putString("postProcessingShader", getConfig("gfx_opengl.ini", "Enhancements", "PostProcessingShader", "")); @@ -62,10 +62,14 @@ public final class UserPreferences editor.putBoolean("disableFog", getConfig("gfx_opengl.ini", "Settings", "DisableFog", "False").equals("True")); editor.putBoolean("skipEFBAccess", getConfig("gfx_opengl.ini", "Hacks", "EFBAccessEnable", "False").equals("True")); editor.putBoolean("ignoreFormatChanges", getConfig("gfx_opengl.ini", "Hacks", "EFBEmulateFormatChanges", "False").equals("True")); - editor.putString("stereoscopyMode", getConfig("gfx_opengl.ini", "Enhancements", "StereoMode", "0")); + editor.putString("stereoscopyMode", getConfig("gfx_opengl.ini", "Enhancements", "StereoMode", "0")); editor.putBoolean("stereoSwapEyes", getConfig("gfx_opengl.ini", "Enhancements", "StereoSwapEyes", "False").equals("True")); editor.putString("stereoDepth", getConfig("gfx_opengl.ini", "Enhancements", "StereoDepth", "20")); editor.putString("stereoConvergence", getConfig("gfx_opengl.ini", "Enhancements", "StereoConvergence", "20")); + editor.putBoolean("enableController1", getConfig("Dolphin.ini", "Settings", "SIDevice0", "6") == "6"); + editor.putBoolean("enableController2", getConfig("Dolphin.ini", "Settings", "SIDevice1", "0") == "6"); + editor.putBoolean("enableController3", getConfig("Dolphin.ini", "Settings", "SIDevice2", "0") == "6"); + editor.putBoolean("enableController4", getConfig("Dolphin.ini", "Settings", "SIDevice3", "0") == "6"); String efbCopyOn = getConfig("gfx_opengl.ini", "Hacks", "EFBCopyEnable", "True"); String efbToTexture = getConfig("gfx_opengl.ini", "Hacks", "EFBToTextureEnable", "True"); @@ -136,7 +140,7 @@ public final class UserPreferences String currentEmuCore = prefs.getString("cpuCorePref", "0"); // Fastmem JIT core usage - boolean isUsingFastmem = prefs.getBoolean("fastmemPref", false); + boolean isUsingFastmem = prefs.getBoolean("fastmemPref", true); // Current video backend being used. Falls back to software rendering upon error. String currentVideoBackend = prefs.getString("gpuPref", "Software Rendering"); @@ -207,6 +211,13 @@ public final class UserPreferences // Stereoscopy convergence String stereoscopyConvergence = prefs.getString("stereoConvergence", "20"); + // Controllers + // Controller 1 never gets disconnected due to touch screen + //boolean enableController1 = prefs.getBoolean("enableController1", true); + boolean enableController2 = prefs.getBoolean("enableController2", false); + boolean enableController3 = prefs.getBoolean("enableController3", false); + boolean enableController4 = prefs.getBoolean("enableController4", false); + // CPU related Settings NativeLibrary.SetConfig("Dolphin.ini", "Core", "CPUCore", currentEmuCore); NativeLibrary.SetConfig("Dolphin.ini", "Core", "CPUThread", isUsingDualCore ? "True" : "False"); @@ -280,5 +291,9 @@ public final class UserPreferences NativeLibrary.SetConfig("gfx_opengl.ini", "Enhancements", "StereoSwapEyes", stereoscopyEyeSwap ? "True" : "False"); NativeLibrary.SetConfig("gfx_opengl.ini", "Enhancements", "StereoDepth", stereoscopySeparation); NativeLibrary.SetConfig("gfx_opengl.ini", "Enhancements", "StereoConvergence", stereoscopyConvergence); + NativeLibrary.SetConfig("Dolphin.ini", "Settings", "SIDevice0", "6"); + NativeLibrary.SetConfig("Dolphin.ini", "Settings", "SIDevice1", enableController2 ? "6" : "0"); + NativeLibrary.SetConfig("Dolphin.ini", "Settings", "SIDevice2", enableController3 ? "6" : "0"); + NativeLibrary.SetConfig("Dolphin.ini", "Settings", "SIDevice3", enableController4 ? "6" : "0"); } } diff --git a/Source/Android/app/src/main/res/xml/preferences.xml b/Source/Android/app/src/main/res/xml/preferences.xml index b4b5efd365..878689c2a8 100644 --- a/Source/Android/app/src/main/res/xml/preferences.xml +++ b/Source/Android/app/src/main/res/xml/preferences.xml @@ -7,7 +7,7 @@ @@ -20,7 +20,7 @@ android:entryValues="@array/int_emu_cores"/> diff --git a/Source/Core/DolphinWX/Android/ButtonManager.cpp b/Source/Core/DolphinWX/Android/ButtonManager.cpp index 5b5d8242fa..cede1887d4 100644 --- a/Source/Core/DolphinWX/Android/ButtonManager.cpp +++ b/Source/Core/DolphinWX/Android/ButtonManager.cpp @@ -201,20 +201,12 @@ namespace ButtonManager auto it = m_controllers.find(dev); if (it != m_controllers.end()) return it->second->PressEvent(button, action); - - m_controllers[dev] = new InputDevice(dev); - return m_controllers[dev]->PressEvent(button, action); } void GamepadAxisEvent(const std::string& dev, int axis, float value) { auto it = m_controllers.find(dev); if (it != m_controllers.end()) - { it->second->AxisEvent(axis, value); - return; - } - m_controllers[dev] = new InputDevice(dev); - m_controllers[dev]->AxisEvent(axis, value); } void Shutdown() {