[Android] Fix multi-gamecube controller input, config changes

This commit is contained in:
Ryan Houdek 2015-09-04 20:06:01 -05:00
parent 3a04c77180
commit 9bb63bf2eb
3 changed files with 22 additions and 15 deletions

View File

@ -45,8 +45,8 @@ public final class UserPreferences
else else
editor.putString("cpuCorePref", getConfig("Dolphin.ini", "Core", "CPUCore", "3")); editor.putString("cpuCorePref", getConfig("Dolphin.ini", "Core", "CPUCore", "3"));
editor.putBoolean("dualCorePref", getConfig("Dolphin.ini", "Core", "CPUThread", "False").equals("True")); editor.putBoolean("dualCorePref", getConfig("Dolphin.ini", "Core", "CPUThread", "True").equals("True"));
editor.putBoolean("fastmemPref", getConfig("Dolphin.ini", "Core", "Fastmem", "False").equals("True")); editor.putBoolean("fastmemPref", getConfig("Dolphin.ini", "Core", "Fastmem", "True").equals("True"));
editor.putString("gpuPref", getConfig("Dolphin.ini", "Core", "GFXBackend", "OGL")); editor.putString("gpuPref", getConfig("Dolphin.ini", "Core", "GFXBackend", "OGL"));
editor.putBoolean("showFPS", getConfig("gfx_opengl.ini", "Settings", "ShowFPS", "False").equals("True")); editor.putBoolean("showFPS", getConfig("gfx_opengl.ini", "Settings", "ShowFPS", "False").equals("True"));
@ -66,6 +66,10 @@ public final class UserPreferences
editor.putBoolean("stereoSwapEyes", getConfig("gfx_opengl.ini", "Enhancements", "StereoSwapEyes", "False").equals("True")); editor.putBoolean("stereoSwapEyes", getConfig("gfx_opengl.ini", "Enhancements", "StereoSwapEyes", "False").equals("True"));
editor.putString("stereoDepth", getConfig("gfx_opengl.ini", "Enhancements", "StereoDepth", "20")); editor.putString("stereoDepth", getConfig("gfx_opengl.ini", "Enhancements", "StereoDepth", "20"));
editor.putString("stereoConvergence", getConfig("gfx_opengl.ini", "Enhancements", "StereoConvergence", "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 efbCopyOn = getConfig("gfx_opengl.ini", "Hacks", "EFBCopyEnable", "True");
String efbToTexture = getConfig("gfx_opengl.ini", "Hacks", "EFBToTextureEnable", "True"); String efbToTexture = getConfig("gfx_opengl.ini", "Hacks", "EFBToTextureEnable", "True");
@ -136,7 +140,7 @@ public final class UserPreferences
String currentEmuCore = prefs.getString("cpuCorePref", "0"); String currentEmuCore = prefs.getString("cpuCorePref", "0");
// Fastmem JIT core usage // 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. // Current video backend being used. Falls back to software rendering upon error.
String currentVideoBackend = prefs.getString("gpuPref", "Software Rendering"); String currentVideoBackend = prefs.getString("gpuPref", "Software Rendering");
@ -207,6 +211,13 @@ public final class UserPreferences
// Stereoscopy convergence // Stereoscopy convergence
String stereoscopyConvergence = prefs.getString("stereoConvergence", "20"); 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 // CPU related Settings
NativeLibrary.SetConfig("Dolphin.ini", "Core", "CPUCore", currentEmuCore); NativeLibrary.SetConfig("Dolphin.ini", "Core", "CPUCore", currentEmuCore);
NativeLibrary.SetConfig("Dolphin.ini", "Core", "CPUThread", isUsingDualCore ? "True" : "False"); 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", "StereoSwapEyes", stereoscopyEyeSwap ? "True" : "False");
NativeLibrary.SetConfig("gfx_opengl.ini", "Enhancements", "StereoDepth", stereoscopySeparation); NativeLibrary.SetConfig("gfx_opengl.ini", "Enhancements", "StereoDepth", stereoscopySeparation);
NativeLibrary.SetConfig("gfx_opengl.ini", "Enhancements", "StereoConvergence", stereoscopyConvergence); 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");
} }
} }

View File

@ -7,7 +7,7 @@
<!-- CPU Settings --> <!-- CPU Settings -->
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="true"
android:key="dualCorePref" android:key="dualCorePref"
android:summary="@string/dual_core_descrip" android:summary="@string/dual_core_descrip"
android:title="@string/dual_core"/> android:title="@string/dual_core"/>
@ -20,7 +20,7 @@
android:entryValues="@array/int_emu_cores"/> android:entryValues="@array/int_emu_cores"/>
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="true"
android:key="fastmemPref" android:key="fastmemPref"
android:summary="@string/fastmem_desc" android:summary="@string/fastmem_desc"
android:title="@string/fastmem"/> android:title="@string/fastmem"/>

View File

@ -201,20 +201,12 @@ namespace ButtonManager
auto it = m_controllers.find(dev); auto it = m_controllers.find(dev);
if (it != m_controllers.end()) if (it != m_controllers.end())
return it->second->PressEvent(button, action); 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) void GamepadAxisEvent(const std::string& dev, int axis, float value)
{ {
auto it = m_controllers.find(dev); auto it = m_controllers.find(dev);
if (it != m_controllers.end()) if (it != m_controllers.end())
{
it->second->AxisEvent(axis, value); it->second->AxisEvent(axis, value);
return;
}
m_controllers[dev] = new InputDevice(dev);
m_controllers[dev]->AxisEvent(axis, value);
} }
void Shutdown() void Shutdown()
{ {