libretro: Fix DualShock analog mode auto-enable

This commit is contained in:
Connor McLaughlin 2020-07-05 00:05:14 +10:00
parent c76bb5eb6a
commit b0b3901722
4 changed files with 14 additions and 2 deletions

View File

@ -478,6 +478,7 @@ void HostInterface::CheckForSettingsChanges(const Settings& old_settings)
if (m_system && !controllers_updated) if (m_system && !controllers_updated)
{ {
m_system->UpdateControllers(); m_system->UpdateControllers();
m_system->ResetControllers();
UpdateSoftwareCursor(); UpdateSoftwareCursor();
controllers_updated = true; controllers_updated = true;
} }

View File

@ -850,6 +850,16 @@ void System::UpdateControllerSettings()
} }
} }
void System::ResetControllers()
{
for (u32 i = 0; i < NUM_CONTROLLER_AND_CARD_PORTS; i++)
{
Controller* controller = m_pad->GetController(i);
if (controller)
controller->Reset();
}
}
void System::UpdateMemoryCards() void System::UpdateMemoryCards()
{ {
const Settings& settings = m_host_interface->GetSettings(); const Settings& settings = m_host_interface->GetSettings();

View File

@ -140,6 +140,7 @@ public:
Controller* GetController(u32 slot) const; Controller* GetController(u32 slot) const;
void UpdateControllers(); void UpdateControllers();
void UpdateControllerSettings(); void UpdateControllerSettings();
void ResetControllers();
void UpdateMemoryCards(); void UpdateMemoryCards();
bool HasMedia() const; bool HasMedia() const;

View File

@ -448,7 +448,7 @@ static std::array<retro_core_option_definition, 22> s_option_definitions = {{
{"PlayStationMouse", "PlayStation Mouse"}, {"PlayStationMouse", "PlayStation Mouse"},
{"NeGcon", "NeGcon"}}, {"NeGcon", "NeGcon"}},
"DigitalController"}, "DigitalController"},
{"Controller1.Type", {"Controller1.AutoEnableAnalog",
"Controller 1 Auto Analog Mode", "Controller 1 Auto Analog Mode",
"Automatically enables analog mode in supported controllers at start/reset.", "Automatically enables analog mode in supported controllers at start/reset.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},
@ -463,7 +463,7 @@ static std::array<retro_core_option_definition, 22> s_option_definitions = {{
{"PlayStationMouse", "PlayStation Mouse"}, {"PlayStationMouse", "PlayStation Mouse"},
{"NeGcon", "NeGcon"}}, {"NeGcon", "NeGcon"}},
"None"}, "None"},
{"Controller2.Type", {"Controller2.AutoEnableAnalog",
"Controller 2 Auto Analog Mode", "Controller 2 Auto Analog Mode",
"Automatically enables analog mode in supported controllers at start/reset.", "Automatically enables analog mode in supported controllers at start/reset.",
{{"true", "Enabled"}, {"false", "Disabled"}}, {{"true", "Enabled"}, {"false", "Disabled"}},