Merge pull request #665 from ggrtk/analog-controller

AnalogController: Expose axis scale setting to frontend
This commit is contained in:
Connor McLaughlin 2020-07-26 23:57:40 +10:00 committed by GitHub
commit 7c54129409
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -481,9 +481,13 @@ u32 AnalogController::StaticGetVibrationMotorCount()
Controller::SettingList AnalogController::StaticGetSettings()
{
static constexpr std::array<SettingInfo, 1> settings = {
static constexpr std::array<SettingInfo, 2> settings = {
{{SettingInfo::Type::Boolean, "AutoEnableAnalog", "Enable Analog Mode on Reset",
"Automatically enables analog mode when the console is reset/powered on.", "false"}}};
"Automatically enables analog mode when the console is reset/powered on.", "false"},
{SettingInfo::Type::Float, "AxisScale", "Analog Axis Scale",
"Sets the analog stick axis scaling factor. A value between 1.30 and 1.40 is recommended when using recent "
"controllers, e.g. DualShock 4, Xbox One Controller.",
"1.00f", "0.01f", "1.50f", "0.01f"}}};
return SettingList(settings.begin(), settings.end());
}

View file

@ -1059,7 +1059,8 @@ void CommonHostInterface::UpdateControllerInputMap(SettingsInterface& si)
}
const float axis_scale = si.GetFloatValue(category, "AxisScale", 1.00f);
m_controller_interface->SetControllerAxisScale(controller_index, axis_scale);
m_controller_interface->SetControllerAxisScale(controller_index,
(ctype == ControllerType::AnalogController) ? axis_scale : 1.00f);
const float deadzone_size = si.GetFloatValue(category, "Deadzone", 0.25f);
m_controller_interface->SetControllerDeadzone(controller_index, deadzone_size);