diff options
Diffstat (limited to 'Source/Core/DolphinWX/Android/ButtonManager.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/Android/ButtonManager.cpp | 56 |
1 files changed, 44 insertions, 12 deletions
diff --git a/Source/Core/DolphinWX/Android/ButtonManager.cpp b/Source/Core/DolphinWX/Android/ButtonManager.cpp index c48ecc11a1..cede1887d4 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<std::string, InputDevice*> m_controllers; std::vector<std::string> 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<ButtonType> 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; @@ -161,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() { |
