Merge pull request #8729 from JosJuice/android-touch-ir-default
Android: Use touch emulation of IR by default
This commit is contained in:
commit
88ae4c7914
|
@ -905,7 +905,7 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase);
|
||||||
builder.setTitle(R.string.emulation_motion_controls);
|
builder.setTitle(R.string.emulation_motion_controls);
|
||||||
builder.setSingleChoiceItems(R.array.motionControlsEntries,
|
builder.setSingleChoiceItems(R.array.motionControlsEntries,
|
||||||
mPreferences.getInt("motionControlsEnabled", 0),
|
mPreferences.getInt("motionControlsEnabled", 1),
|
||||||
(dialog, indexSelected) ->
|
(dialog, indexSelected) ->
|
||||||
{
|
{
|
||||||
editor.putInt("motionControlsEnabled", indexSelected);
|
editor.putInt("motionControlsEnabled", indexSelected);
|
||||||
|
|
|
@ -162,7 +162,7 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (group->can_be_disabled)
|
if (group->default_value != ControllerEmu::ControlGroup::DefaultValue::AlwaysEnabled)
|
||||||
{
|
{
|
||||||
QLabel* group_enable_label = new QLabel(tr("Enable"));
|
QLabel* group_enable_label = new QLabel(tr("Enable"));
|
||||||
QCheckBox* group_enable_checkbox = new QCheckBox();
|
QCheckBox* group_enable_checkbox = new QCheckBox();
|
||||||
|
|
|
@ -16,16 +16,15 @@
|
||||||
|
|
||||||
namespace ControllerEmu
|
namespace ControllerEmu
|
||||||
{
|
{
|
||||||
ControlGroup::ControlGroup(std::string name_, const GroupType type_, CanBeDisabled can_be_disabled_)
|
ControlGroup::ControlGroup(std::string name_, const GroupType type_, DefaultValue default_value_)
|
||||||
: name(name_), ui_name(std::move(name_)), type(type_),
|
: name(name_), ui_name(std::move(name_)), type(type_), default_value(default_value_)
|
||||||
can_be_disabled(can_be_disabled_ == CanBeDisabled::Yes)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlGroup::ControlGroup(std::string name_, std::string ui_name_, const GroupType type_,
|
ControlGroup::ControlGroup(std::string name_, std::string ui_name_, const GroupType type_,
|
||||||
CanBeDisabled can_be_disabled_)
|
DefaultValue default_value_)
|
||||||
: name(std::move(name_)), ui_name(std::move(ui_name_)), type(type_),
|
: name(std::move(name_)), ui_name(std::move(ui_name_)), type(type_),
|
||||||
can_be_disabled(can_be_disabled_ == CanBeDisabled::Yes)
|
default_value(default_value_)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +47,8 @@ void ControlGroup::LoadConfig(IniFile::Section* sec, const std::string& defdev,
|
||||||
const std::string group(base + name + "/");
|
const std::string group(base + name + "/");
|
||||||
|
|
||||||
// enabled
|
// enabled
|
||||||
if (can_be_disabled)
|
if (default_value != DefaultValue::AlwaysEnabled)
|
||||||
sec->Get(group + "Enabled", &enabled, true);
|
sec->Get(group + "Enabled", &enabled, default_value == DefaultValue::Enabled);
|
||||||
|
|
||||||
for (auto& setting : numeric_settings)
|
for (auto& setting : numeric_settings)
|
||||||
setting->LoadFromIni(*sec, group);
|
setting->LoadFromIni(*sec, group);
|
||||||
|
|
|
@ -49,16 +49,17 @@ enum class GroupType
|
||||||
class ControlGroup
|
class ControlGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class CanBeDisabled
|
enum class DefaultValue
|
||||||
{
|
{
|
||||||
No,
|
AlwaysEnabled,
|
||||||
Yes,
|
Enabled,
|
||||||
|
Disabled,
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit ControlGroup(std::string name, GroupType type = GroupType::Other,
|
explicit ControlGroup(std::string name, GroupType type = GroupType::Other,
|
||||||
CanBeDisabled can_be_disabled = CanBeDisabled::No);
|
DefaultValue default_value = DefaultValue::AlwaysEnabled);
|
||||||
ControlGroup(std::string name, std::string ui_name, GroupType type = GroupType::Other,
|
ControlGroup(std::string name, std::string ui_name, GroupType type = GroupType::Other,
|
||||||
CanBeDisabled can_be_disabled = CanBeDisabled::No);
|
DefaultValue default_value = DefaultValue::AlwaysEnabled);
|
||||||
virtual ~ControlGroup();
|
virtual ~ControlGroup();
|
||||||
|
|
||||||
virtual void LoadConfig(IniFile::Section* sec, const std::string& defdev = "",
|
virtual void LoadConfig(IniFile::Section* sec, const std::string& defdev = "",
|
||||||
|
@ -92,7 +93,7 @@ public:
|
||||||
const std::string name;
|
const std::string name;
|
||||||
const std::string ui_name;
|
const std::string ui_name;
|
||||||
const GroupType type;
|
const GroupType type;
|
||||||
const bool can_be_disabled;
|
const DefaultValue default_value;
|
||||||
|
|
||||||
bool enabled = true;
|
bool enabled = true;
|
||||||
std::vector<std::unique_ptr<Control>> controls;
|
std::vector<std::unique_ptr<Control>> controls;
|
||||||
|
|
|
@ -17,8 +17,15 @@
|
||||||
namespace ControllerEmu
|
namespace ControllerEmu
|
||||||
{
|
{
|
||||||
IMUCursor::IMUCursor(std::string name, std::string ui_name)
|
IMUCursor::IMUCursor(std::string name, std::string ui_name)
|
||||||
: ControlGroup(std::move(name), std::move(ui_name), GroupType::IMUCursor,
|
: ControlGroup(
|
||||||
ControlGroup::CanBeDisabled::Yes)
|
std::move(name), std::move(ui_name), GroupType::IMUCursor,
|
||||||
|
#ifdef ANDROID
|
||||||
|
// Enabling this on Android devices which have an accelerometer and gyroscope prevents
|
||||||
|
// touch controls from being used for pointing, and touch controls generally work better
|
||||||
|
ControlGroup::DefaultValue::Disabled)
|
||||||
|
#else
|
||||||
|
ControlGroup::DefaultValue::Enabled)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
AddInput(Translate, _trans("Recenter"));
|
AddInput(Translate, _trans("Recenter"));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue