Add Wiimote support to the Android backend.

Not actually wired up to the Android UI for configuration.
This commit is contained in:
Ryan Houdek
2015-07-21 21:28:32 -05:00
parent c8d1824eb0
commit a8227ad9b1
6 changed files with 193 additions and 26 deletions

View File

@ -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;