Add Wiimote support to the Android backend.
Not actually wired up to the Android UI for configuration.
This commit is contained in:
parent
c8d1824eb0
commit
a8227ad9b1
|
@ -0,0 +1,84 @@
|
||||||
|
[Wiimote1]
|
||||||
|
Device = Android/4/Touchscreen
|
||||||
|
Buttons/A = `Button 22`
|
||||||
|
Buttons/B = `Button 23`
|
||||||
|
Buttons/1 = `Button 27`
|
||||||
|
Buttons/2 = `Button 28`
|
||||||
|
Buttons/- = `Button 24`
|
||||||
|
Buttons/+ = `Button 25`
|
||||||
|
Buttons/Home = `Button 26`
|
||||||
|
IR/Up =
|
||||||
|
IR/Down =
|
||||||
|
IR/Left =
|
||||||
|
IR/Right =
|
||||||
|
Shake/X =
|
||||||
|
Shake/Y =
|
||||||
|
Shake/Z =
|
||||||
|
D-Pad/Up = `Button 29`
|
||||||
|
D-Pad/Down = `Button 30`
|
||||||
|
D-Pad/Left = `Button 31`
|
||||||
|
D-Pad/Right = `Button 32`
|
||||||
|
Source = 1
|
||||||
|
[Wiimote2]
|
||||||
|
Device = Android/5/Touchscreen
|
||||||
|
Buttons/A = `Button 22`
|
||||||
|
Buttons/B = `Button 23`
|
||||||
|
Buttons/1 = `Button 27`
|
||||||
|
Buttons/2 = `Button 28`
|
||||||
|
Buttons/- = `Button 24`
|
||||||
|
Buttons/+ = `Button 25`
|
||||||
|
Buttons/Home = `Button 26`
|
||||||
|
IR/Up =
|
||||||
|
IR/Down =
|
||||||
|
IR/Left =
|
||||||
|
IR/Right =
|
||||||
|
Shake/X =
|
||||||
|
Shake/Y =
|
||||||
|
Shake/Z =
|
||||||
|
D-Pad/Up = `Button 29`
|
||||||
|
D-Pad/Down = `Button 30`
|
||||||
|
D-Pad/Left = `Button 31`
|
||||||
|
D-Pad/Right = `Button 32`
|
||||||
|
Source = 1
|
||||||
|
[Wiimote3]
|
||||||
|
Device = Android/6/Touchscreen
|
||||||
|
Buttons/A = `Button 22`
|
||||||
|
Buttons/B = `Button 23`
|
||||||
|
Buttons/1 = `Button 27`
|
||||||
|
Buttons/2 = `Button 28`
|
||||||
|
Buttons/- = `Button 24`
|
||||||
|
Buttons/+ = `Button 25`
|
||||||
|
Buttons/Home = `Button 26`
|
||||||
|
IR/Up =
|
||||||
|
IR/Down =
|
||||||
|
IR/Left =
|
||||||
|
IR/Right =
|
||||||
|
Shake/X =
|
||||||
|
Shake/Y =
|
||||||
|
Shake/Z =
|
||||||
|
D-Pad/Up = `Button 29`
|
||||||
|
D-Pad/Down = `Button 30`
|
||||||
|
D-Pad/Left = `Button 31`
|
||||||
|
D-Pad/Right = `Button 32`
|
||||||
|
Source = 1
|
||||||
|
[Wiimote4]
|
||||||
|
Device = Android/7/Touchscreen
|
||||||
|
Buttons/A = `Button 22`
|
||||||
|
Buttons/B = `Button 23`
|
||||||
|
Buttons/1 = `Button 27`
|
||||||
|
Buttons/2 = `Button 28`
|
||||||
|
Buttons/- = `Button 24`
|
||||||
|
Buttons/+ = `Button 25`
|
||||||
|
Buttons/Home = `Button 26`
|
||||||
|
IR/Up =
|
||||||
|
IR/Down =
|
||||||
|
IR/Left =
|
||||||
|
IR/Right =
|
||||||
|
Shake/X =
|
||||||
|
Shake/Y =
|
||||||
|
Shake/Z =
|
||||||
|
D-Pad/Up = `Button 29`
|
||||||
|
D-Pad/Down = `Button 30`
|
||||||
|
D-Pad/Left = `Button 31`
|
||||||
|
D-Pad/Right = `Button 32`
|
||||||
|
Source = 1
|
|
@ -25,28 +25,39 @@ public final class NativeLibrary
|
||||||
*/
|
*/
|
||||||
public static final class ButtonType
|
public static final class ButtonType
|
||||||
{
|
{
|
||||||
public static final int BUTTON_A = 0;
|
public static final int BUTTON_A = 0;
|
||||||
public static final int BUTTON_B = 1;
|
public static final int BUTTON_B = 1;
|
||||||
public static final int BUTTON_START = 2;
|
public static final int BUTTON_START = 2;
|
||||||
public static final int BUTTON_X = 3;
|
public static final int BUTTON_X = 3;
|
||||||
public static final int BUTTON_Y = 4;
|
public static final int BUTTON_Y = 4;
|
||||||
public static final int BUTTON_Z = 5;
|
public static final int BUTTON_Z = 5;
|
||||||
public static final int BUTTON_UP = 6;
|
public static final int BUTTON_UP = 6;
|
||||||
public static final int BUTTON_DOWN = 7;
|
public static final int BUTTON_DOWN = 7;
|
||||||
public static final int BUTTON_LEFT = 8;
|
public static final int BUTTON_LEFT = 8;
|
||||||
public static final int BUTTON_RIGHT = 9;
|
public static final int BUTTON_RIGHT = 9;
|
||||||
public static final int STICK_MAIN = 10;
|
public static final int STICK_MAIN = 10;
|
||||||
public static final int STICK_MAIN_UP = 11;
|
public static final int STICK_MAIN_UP = 11;
|
||||||
public static final int STICK_MAIN_DOWN = 12;
|
public static final int STICK_MAIN_DOWN = 12;
|
||||||
public static final int STICK_MAIN_LEFT = 13;
|
public static final int STICK_MAIN_LEFT = 13;
|
||||||
public static final int STICK_MAIN_RIGHT = 14;
|
public static final int STICK_MAIN_RIGHT = 14;
|
||||||
public static final int STICK_C = 15;
|
public static final int STICK_C = 15;
|
||||||
public static final int STICK_C_UP = 16;
|
public static final int STICK_C_UP = 16;
|
||||||
public static final int STICK_C_DOWN = 17;
|
public static final int STICK_C_DOWN = 17;
|
||||||
public static final int STICK_C_LEFT = 18;
|
public static final int STICK_C_LEFT = 18;
|
||||||
public static final int STICK_C_RIGHT = 19;
|
public static final int STICK_C_RIGHT = 19;
|
||||||
public static final int TRIGGER_L = 20;
|
public static final int TRIGGER_L = 20;
|
||||||
public static final int TRIGGER_R = 21;
|
public static final int TRIGGER_R = 21;
|
||||||
|
public static final int WIIMOTE_BUTTON_A = 22;
|
||||||
|
public static final int WIIMOTE_BUTTON_B = 23;
|
||||||
|
public static final int WIIMOTE_BUTTON_MINUS = 24;
|
||||||
|
public static final int WIIMOTE_BUTTON_PLUS = 25;
|
||||||
|
public static final int WIIMOTE_BUTTON_HOME = 26;
|
||||||
|
public static final int WIIMOTE_BUTTON_1 = 27;
|
||||||
|
public static final int WIIMOTE_BUTTON_2 = 28;
|
||||||
|
public static final int WIIMOTE_UP = 29;
|
||||||
|
public static final int WIIMOTE_DOWN = 30;
|
||||||
|
public static final int WIIMOTE_LEFT = 31;
|
||||||
|
public static final int WIIMOTE_RIGHT = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -61,6 +61,7 @@ public final class AssetCopyService extends IntentService
|
||||||
// Always copy over the GCPad config in case of change or corruption.
|
// Always copy over the GCPad config in case of change or corruption.
|
||||||
// Not a user configurable file.
|
// Not a user configurable file.
|
||||||
copyAsset("GCPadNew.ini", ConfigDir + File.separator + "GCPadNew.ini");
|
copyAsset("GCPadNew.ini", ConfigDir + File.separator + "GCPadNew.ini");
|
||||||
|
copyAsset("WiimoteNew.ini", ConfigDir + File.separator + "WiimoteNew.ini");
|
||||||
|
|
||||||
// Load the configuration keys set in the Dolphin ini and gfx ini files
|
// Load the configuration keys set in the Dolphin ini and gfx ini files
|
||||||
// into the application's shared preferences.
|
// into the application's shared preferences.
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace ButtonManager
|
||||||
const std::string touchScreenKey = "Touchscreen";
|
const std::string touchScreenKey = "Touchscreen";
|
||||||
std::unordered_map<std::string, InputDevice*> m_controllers;
|
std::unordered_map<std::string, InputDevice*> m_controllers;
|
||||||
std::vector<std::string> configStrings = {
|
std::vector<std::string> configStrings = {
|
||||||
|
// GC
|
||||||
"InputA",
|
"InputA",
|
||||||
"InputB",
|
"InputB",
|
||||||
"InputStart",
|
"InputStart",
|
||||||
|
@ -33,9 +34,22 @@ namespace ButtonManager
|
||||||
"CStickLeft",
|
"CStickLeft",
|
||||||
"CStickRight",
|
"CStickRight",
|
||||||
"InputL",
|
"InputL",
|
||||||
"InputR"
|
"InputR",
|
||||||
|
// Wiimote
|
||||||
|
"WiimoteA",
|
||||||
|
"WiimoteB",
|
||||||
|
"WiimoteMinus",
|
||||||
|
"WiimotePlus",
|
||||||
|
"WiimoteHome",
|
||||||
|
"Wiimote1",
|
||||||
|
"Wiimote2",
|
||||||
|
"WiimoteUp",
|
||||||
|
"WiimoteDown",
|
||||||
|
"WiimoteLeft",
|
||||||
|
"WiimoteRight",
|
||||||
};
|
};
|
||||||
std::vector<ButtonType> configTypes = {
|
std::vector<ButtonType> configTypes = {
|
||||||
|
// GC
|
||||||
BUTTON_A,
|
BUTTON_A,
|
||||||
BUTTON_B,
|
BUTTON_B,
|
||||||
BUTTON_START,
|
BUTTON_START,
|
||||||
|
@ -55,7 +69,19 @@ namespace ButtonManager
|
||||||
STICK_C_LEFT,
|
STICK_C_LEFT,
|
||||||
STICK_C_RIGHT,
|
STICK_C_RIGHT,
|
||||||
TRIGGER_L,
|
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)
|
static void AddBind(const std::string& dev, sBind *bind)
|
||||||
|
@ -73,8 +99,9 @@ namespace ButtonManager
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
// Initialize our touchScreenKey buttons
|
// 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_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_B, BIND_BUTTON, BUTTON_B, 1.0f));
|
||||||
AddBind(touchScreenKey, new sBind(a, BUTTON_START, BIND_BUTTON, BUTTON_START, 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, 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_L, BIND_AXIS, TRIGGER_L, 1.0f));
|
||||||
AddBind(touchScreenKey, new sBind(a, TRIGGER_R, BIND_AXIS, TRIGGER_R, 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
|
// Init our controller bindings
|
||||||
IniFile ini;
|
IniFile ini;
|
||||||
ini.Load(File::GetUserPath(D_CONFIG_IDX) + std::string("Dolphin.ini"));
|
ini.Load(File::GetUserPath(D_CONFIG_IDX) + std::string("Dolphin.ini"));
|
||||||
for (u32 a = 0; a < configStrings.size(); ++a)
|
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;
|
std::ostringstream config;
|
||||||
config << configStrings[a] << "_" << padID;
|
config << configStrings[a] << "_" << padID;
|
||||||
|
|
|
@ -11,6 +11,7 @@ namespace ButtonManager
|
||||||
{
|
{
|
||||||
enum ButtonType
|
enum ButtonType
|
||||||
{
|
{
|
||||||
|
// GC
|
||||||
BUTTON_A = 0,
|
BUTTON_A = 0,
|
||||||
BUTTON_B = 1,
|
BUTTON_B = 1,
|
||||||
BUTTON_START = 2,
|
BUTTON_START = 2,
|
||||||
|
@ -33,6 +34,18 @@ namespace ButtonManager
|
||||||
STICK_C_RIGHT = 19,
|
STICK_C_RIGHT = 19,
|
||||||
TRIGGER_L = 20,
|
TRIGGER_L = 20,
|
||||||
TRIGGER_R = 21,
|
TRIGGER_R = 21,
|
||||||
|
// Wiimote
|
||||||
|
WIIMOTE_BUTTON_A = 22,
|
||||||
|
WIIMOTE_BUTTON_B = 23,
|
||||||
|
WIIMOTE_BUTTON_MINUS = 24,
|
||||||
|
WIIMOTE_BUTTON_PLUS = 25,
|
||||||
|
WIIMOTE_BUTTON_HOME = 26,
|
||||||
|
WIIMOTE_BUTTON_1 = 27,
|
||||||
|
WIIMOTE_BUTTON_2 = 28,
|
||||||
|
WIIMOTE_UP = 29,
|
||||||
|
WIIMOTE_DOWN = 30,
|
||||||
|
WIIMOTE_LEFT = 31,
|
||||||
|
WIIMOTE_RIGHT = 32,
|
||||||
};
|
};
|
||||||
enum ButtonState
|
enum ButtonState
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,6 +17,10 @@ void Init( std::vector<Core::Device*>& devices )
|
||||||
devices.push_back(new Touchscreen(1));
|
devices.push_back(new Touchscreen(1));
|
||||||
devices.push_back(new Touchscreen(2));
|
devices.push_back(new Touchscreen(2));
|
||||||
devices.push_back(new Touchscreen(3));
|
devices.push_back(new Touchscreen(3));
|
||||||
|
devices.push_back(new Touchscreen(4));
|
||||||
|
devices.push_back(new Touchscreen(5));
|
||||||
|
devices.push_back(new Touchscreen(6));
|
||||||
|
devices.push_back(new Touchscreen(7));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Touchscreens and stuff
|
// Touchscreens and stuff
|
||||||
|
@ -37,6 +41,7 @@ int Touchscreen::GetId() const
|
||||||
Touchscreen::Touchscreen(int padID)
|
Touchscreen::Touchscreen(int padID)
|
||||||
: _padID(padID)
|
: _padID(padID)
|
||||||
{
|
{
|
||||||
|
// GC
|
||||||
AddInput(new Button(_padID, ButtonManager::BUTTON_A));
|
AddInput(new Button(_padID, ButtonManager::BUTTON_A));
|
||||||
AddInput(new Button(_padID, ButtonManager::BUTTON_B));
|
AddInput(new Button(_padID, ButtonManager::BUTTON_B));
|
||||||
AddInput(new Button(_padID, ButtonManager::BUTTON_START));
|
AddInput(new Button(_padID, ButtonManager::BUTTON_START));
|
||||||
|
@ -53,6 +58,19 @@ Touchscreen::Touchscreen(int padID)
|
||||||
AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_UP), new Axis(_padID, ButtonManager::STICK_C_DOWN));
|
AddAnalogInputs(new Axis(_padID, ButtonManager::STICK_C_UP), new Axis(_padID, ButtonManager::STICK_C_DOWN));
|
||||||
AddAnalogInputs(new Axis(_padID, ButtonManager::TRIGGER_L), new Axis(_padID, ButtonManager::TRIGGER_L));
|
AddAnalogInputs(new Axis(_padID, ButtonManager::TRIGGER_L), new Axis(_padID, ButtonManager::TRIGGER_L));
|
||||||
AddAnalogInputs(new Axis(_padID, ButtonManager::TRIGGER_R), new Axis(_padID, ButtonManager::TRIGGER_R));
|
AddAnalogInputs(new Axis(_padID, ButtonManager::TRIGGER_R), new Axis(_padID, ButtonManager::TRIGGER_R));
|
||||||
|
|
||||||
|
// Wiimote
|
||||||
|
AddInput(new Button(_padID, ButtonManager::WIIMOTE_BUTTON_A));
|
||||||
|
AddInput(new Button(_padID, ButtonManager::WIIMOTE_BUTTON_B));
|
||||||
|
AddInput(new Button(_padID, ButtonManager::WIIMOTE_BUTTON_MINUS));
|
||||||
|
AddInput(new Button(_padID, ButtonManager::WIIMOTE_BUTTON_PLUS));
|
||||||
|
AddInput(new Button(_padID, ButtonManager::WIIMOTE_BUTTON_HOME));
|
||||||
|
AddInput(new Button(_padID, ButtonManager::WIIMOTE_BUTTON_1));
|
||||||
|
AddInput(new Button(_padID, ButtonManager::WIIMOTE_BUTTON_2));
|
||||||
|
AddInput(new Button(_padID, ButtonManager::WIIMOTE_UP));
|
||||||
|
AddInput(new Button(_padID, ButtonManager::WIIMOTE_DOWN));
|
||||||
|
AddInput(new Button(_padID, ButtonManager::WIIMOTE_LEFT));
|
||||||
|
AddInput(new Button(_padID, ButtonManager::WIIMOTE_RIGHT));
|
||||||
}
|
}
|
||||||
// Buttons and stuff
|
// Buttons and stuff
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue