mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
[Android-overlay] Add the new overlay icons. Support configuring them. Disable hardfloat since it has issues since Dalvik doesn't understand passing floats due to ABI differences.
This commit is contained in:
@ -86,8 +86,8 @@ namespace ButtonManager
|
||||
m_axises[std::make_pair(a, STICK_C_DOWN)] = new Axis();
|
||||
m_axises[std::make_pair(a, STICK_C_LEFT)] = new Axis();
|
||||
m_axises[std::make_pair(a, STICK_C_RIGHT)] = new Axis();
|
||||
m_axises[std::make_pair(a, TRIGGER_L)] = new Axis();
|
||||
m_axises[std::make_pair(a, TRIGGER_R)] = new Axis();
|
||||
m_buttons[std::make_pair(a, TRIGGER_L)] = new Button();
|
||||
m_buttons[std::make_pair(a, TRIGGER_R)] = new Button();
|
||||
}
|
||||
// Init our controller bindings
|
||||
IniFile ini;
|
||||
@ -137,19 +137,17 @@ namespace ButtonManager
|
||||
}
|
||||
float GetAxisValue(int padID, ButtonType axis)
|
||||
{
|
||||
float value = 0.0f;
|
||||
value = m_axises[std::make_pair(padID, axis)]->AxisValue();
|
||||
|
||||
float value = m_axises[std::make_pair(padID, axis)]->AxisValue();
|
||||
auto it = m_controllers.begin();
|
||||
if (it == m_controllers.end())
|
||||
return value;
|
||||
return it->second->AxisValue(padID, axis);
|
||||
}
|
||||
void TouchEvent(int padID, int button, int action)
|
||||
void TouchEvent(int padID, ButtonType button, int action)
|
||||
{
|
||||
m_buttons[std::make_pair(padID, button)]->SetState(action ? BUTTON_PRESSED : BUTTON_RELEASED);
|
||||
}
|
||||
void TouchAxisEvent(int padID, int axis, float value)
|
||||
void TouchAxisEvent(int padID, ButtonType axis, float value)
|
||||
{
|
||||
m_axises[std::make_pair(padID, axis)]->SetValue(value);
|
||||
}
|
||||
@ -188,35 +186,39 @@ namespace ButtonManager
|
||||
// InputDevice
|
||||
void InputDevice::PressEvent(ButtonType button, int action)
|
||||
{
|
||||
m_buttons[m_binds[button]->m_bind] = action == 0 ? true : false;
|
||||
if (_binds.find(button) == _binds.end())
|
||||
return;
|
||||
_buttons[_binds[button]->_bind] = action == 0 ? true : false;
|
||||
}
|
||||
void InputDevice::AxisEvent(ButtonType axis, float value)
|
||||
{
|
||||
m_axises[m_binds[axis]->m_bind] = value;
|
||||
if (_binds.find(axis) == _binds.end())
|
||||
return;
|
||||
_axises[_binds[axis]->_bind] = value;
|
||||
}
|
||||
bool InputDevice::ButtonValue(int padID, ButtonType button)
|
||||
{
|
||||
auto it = m_binds.find(button);
|
||||
if (it == m_binds.end())
|
||||
auto it = _binds.find(button);
|
||||
if (it == _binds.end())
|
||||
return false;
|
||||
if (it->second->m_padID != padID)
|
||||
if (it->second->_padID != padID)
|
||||
return false;
|
||||
if (it->second->m_bindtype == BIND_BUTTON)
|
||||
return m_buttons[it->second->m_bind];
|
||||
if (it->second->_bindtype == BIND_BUTTON)
|
||||
return _buttons[it->second->_bind];
|
||||
else
|
||||
return AxisValue(padID, button);
|
||||
}
|
||||
float InputDevice::AxisValue(int padID, ButtonType axis)
|
||||
{
|
||||
auto it = m_binds.find(axis);
|
||||
if (it == m_binds.end())
|
||||
auto it = _binds.find(axis);
|
||||
if (it == _binds.end())
|
||||
return 0.0f;
|
||||
if (it->second->m_padID != padID)
|
||||
if (it->second->_padID != padID)
|
||||
return 0.0f;
|
||||
if (it->second->m_bindtype == BIND_BUTTON)
|
||||
if (it->second->_bindtype == BIND_BUTTON)
|
||||
return ButtonValue(padID, axis);
|
||||
else
|
||||
return m_axises[it->second->m_bind] * it->second->m_neg;
|
||||
return _axises[it->second->_bind] * it->second->_neg;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -85,13 +85,13 @@ namespace ButtonManager
|
||||
|
||||
struct sBind
|
||||
{
|
||||
const int m_padID;
|
||||
const ButtonType m_buttontype;
|
||||
const BindType m_bindtype;
|
||||
const int m_bind;
|
||||
const float m_neg;
|
||||
const int _padID;
|
||||
const ButtonType _buttontype;
|
||||
const BindType _bindtype;
|
||||
const int _bind;
|
||||
const float _neg;
|
||||
sBind(int padID, ButtonType buttontype, BindType bindtype, int bind, float neg)
|
||||
: m_padID(padID), m_buttontype(buttontype), m_bindtype(bindtype), m_bind(bind), m_neg(neg)
|
||||
: _padID(padID), _buttontype(buttontype), _bindtype(bindtype), _bind(bind), _neg(neg)
|
||||
{}
|
||||
};
|
||||
|
||||
@ -99,21 +99,19 @@ namespace ButtonManager
|
||||
class InputDevice
|
||||
{
|
||||
private:
|
||||
std::string m_dev;
|
||||
std::map<int, bool> m_buttons;
|
||||
std::map<int, float> m_axises;
|
||||
std::map<ButtonType, sBind*> m_binds;
|
||||
const std::string _dev;
|
||||
std::map<int, bool> _buttons;
|
||||
std::map<int, float> _axises;
|
||||
std::map<ButtonType, sBind*> _binds;
|
||||
public:
|
||||
InputDevice(std::string dev)
|
||||
{
|
||||
m_dev = dev;
|
||||
}
|
||||
: _dev(dev) {}
|
||||
~InputDevice()
|
||||
{
|
||||
for (auto it = m_binds.begin(); it != m_binds.end(); ++it)
|
||||
for (auto it = _binds.begin(); it != _binds.end(); ++it)
|
||||
delete it->second;
|
||||
}
|
||||
void AddBind(sBind *bind) { m_binds[bind->m_buttontype] = bind; }
|
||||
void AddBind(sBind *bind) { _binds[bind->_buttontype] = bind; }
|
||||
void PressEvent(ButtonType button, int action);
|
||||
void AxisEvent(ButtonType axis, float value);
|
||||
bool ButtonValue(int padID, ButtonType button);
|
||||
@ -123,8 +121,8 @@ namespace ButtonManager
|
||||
void Init();
|
||||
bool GetButtonPressed(int padID, ButtonType button);
|
||||
float GetAxisValue(int padID, ButtonType axis);
|
||||
void TouchEvent(int padID, int button, int action);
|
||||
void TouchAxisEvent(int padID, int axis, float value);
|
||||
void TouchEvent(int padID, ButtonType button, int action);
|
||||
void TouchAxisEvent(int padID, ButtonType axis, float value);
|
||||
void GamepadEvent(std::string dev, ButtonType button, int action);
|
||||
void GamepadAxisEvent(std::string dev, ButtonType axis, float value);
|
||||
void Shutdown();
|
||||
|
@ -239,11 +239,11 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulatio
|
||||
}
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onTouchEvent(JNIEnv *env, jobject obj, jint padID, jint Button, jint Action)
|
||||
{
|
||||
ButtonManager::TouchEvent(padID, Button, Action);
|
||||
ButtonManager::TouchEvent(padID, (ButtonManager::ButtonType)Button, Action);
|
||||
}
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onTouchAxisEvent(JNIEnv *env, jobject obj, jint padID, jint Button, jfloat Action)
|
||||
{
|
||||
ButtonManager::TouchAxisEvent(padID, Button, Action);
|
||||
ButtonManager::TouchAxisEvent(padID, (ButtonManager::ButtonType)Button, Action);
|
||||
}
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadEvent(JNIEnv *env, jobject obj, jstring jDevice, jint Button, jint Action)
|
||||
{
|
||||
|
Reference in New Issue
Block a user