CommonHostInterface: Fix crash when there's no controller interface

This commit is contained in:
Connor McLaughlin 2020-07-26 23:56:58 +10:00
parent cdab84e210
commit 8665a24eee
1 changed files with 9 additions and 7 deletions

View File

@ -1058,6 +1058,8 @@ void CommonHostInterface::UpdateControllerInputMap(SettingsInterface& si)
AddRumbleToInputMap(binding, controller_index, num_motors); AddRumbleToInputMap(binding, controller_index, num_motors);
} }
if (m_controller_interface)
{
const float axis_scale = si.GetFloatValue(category, "AxisScale", 1.00f); const float axis_scale = si.GetFloatValue(category, "AxisScale", 1.00f);
m_controller_interface->SetControllerAxisScale(controller_index, m_controller_interface->SetControllerAxisScale(controller_index,
(ctype == ControllerType::AnalogController) ? axis_scale : 1.00f); (ctype == ControllerType::AnalogController) ? axis_scale : 1.00f);
@ -1065,6 +1067,7 @@ void CommonHostInterface::UpdateControllerInputMap(SettingsInterface& si)
const float deadzone_size = si.GetFloatValue(category, "Deadzone", 0.25f); const float deadzone_size = si.GetFloatValue(category, "Deadzone", 0.25f);
m_controller_interface->SetControllerDeadzone(controller_index, deadzone_size); m_controller_interface->SetControllerDeadzone(controller_index, deadzone_size);
} }
}
} }
void CommonHostInterface::UpdateHotkeyInputMap(SettingsInterface& si) void CommonHostInterface::UpdateHotkeyInputMap(SettingsInterface& si)
@ -2000,8 +2003,7 @@ bool CommonHostInterface::SaveScreenshot(const char* filename /* = nullptr */, b
} }
m_system->GetGPU()->ResetGraphicsAPIState(); m_system->GetGPU()->ResetGraphicsAPIState();
const bool screenshot_saved = const bool screenshot_saved = m_display->WriteDisplayTextureToFile(filename, full_resolution, apply_aspect_ratio);
m_display->WriteDisplayTextureToFile(filename, full_resolution, apply_aspect_ratio);
m_system->GetGPU()->RestoreGraphicsAPIState(); m_system->GetGPU()->RestoreGraphicsAPIState();
if (!screenshot_saved) if (!screenshot_saved)
{ {