From a8227ad9b1430d8891f1c6221374dadd94a3a534 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Tue, 21 Jul 2015 21:28:32 -0500 Subject: Add Wiimote support to the Android backend. Not actually wired up to the Android UI for configuration. --- Source/Core/DolphinWX/Android/ButtonManager.cpp | 48 ++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 4 deletions(-) (limited to 'Source/Core/DolphinWX/Android/ButtonManager.cpp') diff --git a/Source/Core/DolphinWX/Android/ButtonManager.cpp b/Source/Core/DolphinWX/Android/ButtonManager.cpp index c48ecc11a1..5b5d8242fa 100644 --- a/Source/Core/DolphinWX/Android/ButtonManager.cpp +++ b/Source/Core/DolphinWX/Android/ButtonManager.cpp @@ -14,6 +14,7 @@ namespace ButtonManager const std::string touchScreenKey = "Touchscreen"; std::unordered_map m_controllers; std::vector configStrings = { + // GC "InputA", "InputB", "InputStart", @@ -33,9 +34,22 @@ namespace ButtonManager "CStickLeft", "CStickRight", "InputL", - "InputR" + "InputR", + // Wiimote + "WiimoteA", + "WiimoteB", + "WiimoteMinus", + "WiimotePlus", + "WiimoteHome", + "Wiimote1", + "Wiimote2", + "WiimoteUp", + "WiimoteDown", + "WiimoteLeft", + "WiimoteRight", }; std::vector configTypes = { + // GC BUTTON_A, BUTTON_B, BUTTON_START, @@ -55,7 +69,19 @@ namespace ButtonManager STICK_C_LEFT, STICK_C_RIGHT, TRIGGER_L, - TRIGGER_R + TRIGGER_R, + // Wiimote + WIIMOTE_BUTTON_A, + WIIMOTE_BUTTON_B, + WIIMOTE_BUTTON_MINUS, + WIIMOTE_BUTTON_PLUS, + WIIMOTE_BUTTON_HOME, + WIIMOTE_BUTTON_1, + WIIMOTE_BUTTON_2, + WIIMOTE_UP, + WIIMOTE_DOWN, + WIIMOTE_LEFT, + WIIMOTE_RIGHT, }; static void AddBind(const std::string& dev, sBind *bind) @@ -73,8 +99,9 @@ namespace ButtonManager void Init() { // Initialize our touchScreenKey buttons - for (int a = 0; a < 4; ++a) + for (int a = 0; a < 8; ++a) { + // GC AddBind(touchScreenKey, new sBind(a, BUTTON_A, BIND_BUTTON, BUTTON_A, 1.0f)); AddBind(touchScreenKey, new sBind(a, BUTTON_B, BIND_BUTTON, BUTTON_B, 1.0f)); AddBind(touchScreenKey, new sBind(a, BUTTON_START, BIND_BUTTON, BUTTON_START, 1.0f)); @@ -96,13 +123,26 @@ namespace ButtonManager AddBind(touchScreenKey, new sBind(a, STICK_C_RIGHT, BIND_AXIS, STICK_C_RIGHT, 1.0f)); AddBind(touchScreenKey, new sBind(a, TRIGGER_L, BIND_AXIS, TRIGGER_L, 1.0f)); AddBind(touchScreenKey, new sBind(a, TRIGGER_R, BIND_AXIS, TRIGGER_R, 1.0f)); + + // Wiimote + AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_A, BIND_BUTTON, WIIMOTE_BUTTON_A, 1.0f)); + AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_B, BIND_BUTTON, WIIMOTE_BUTTON_B, 1.0f)); + AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_MINUS, BIND_BUTTON, WIIMOTE_BUTTON_MINUS, 1.0f)); + AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_PLUS, BIND_BUTTON, WIIMOTE_BUTTON_PLUS, 1.0f)); + AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_HOME, BIND_BUTTON, WIIMOTE_BUTTON_HOME, 1.0f)); + AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_1, BIND_BUTTON, WIIMOTE_BUTTON_1, 1.0f)); + AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_2, BIND_BUTTON, WIIMOTE_BUTTON_2, 1.0f)); + AddBind(touchScreenKey, new sBind(a, WIIMOTE_UP, BIND_BUTTON, WIIMOTE_UP, 1.0f)); + AddBind(touchScreenKey, new sBind(a, WIIMOTE_DOWN, BIND_BUTTON, WIIMOTE_DOWN, 1.0f)); + AddBind(touchScreenKey, new sBind(a, WIIMOTE_LEFT, BIND_BUTTON, WIIMOTE_LEFT, 1.0f)); + AddBind(touchScreenKey, new sBind(a, WIIMOTE_RIGHT, BIND_BUTTON, WIIMOTE_RIGHT, 1.0f)); } // Init our controller bindings IniFile ini; ini.Load(File::GetUserPath(D_CONFIG_IDX) + std::string("Dolphin.ini")); for (u32 a = 0; a < configStrings.size(); ++a) { - for (int padID = 0; padID < 4; ++padID) + for (int padID = 0; padID < 8; ++padID) { std::ostringstream config; config << configStrings[a] << "_" << padID; -- cgit v1.2.3 From 9bb63bf2eb66a13705ca67f449d4819cbfcdf053 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Fri, 4 Sep 2015 20:06:01 -0500 Subject: [Android] Fix multi-gamecube controller input, config changes --- Source/Core/DolphinWX/Android/ButtonManager.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'Source/Core/DolphinWX/Android/ButtonManager.cpp') 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() { -- cgit v1.2.3