HostInterface: Notify host when controller types change
This commit is contained in:
parent
b0c846388e
commit
5f3be68028
|
@ -521,6 +521,8 @@ void HostInterface::OnSystemPerformanceCountersUpdated() {}
|
|||
|
||||
void HostInterface::OnRunningGameChanged() {}
|
||||
|
||||
void HostInterface::OnControllerTypeChanged(u32 slot) {}
|
||||
|
||||
void HostInterface::SetUserDirectory()
|
||||
{
|
||||
const std::string program_path = FileSystem::GetProgramPath();
|
||||
|
@ -726,6 +728,7 @@ void HostInterface::UpdateSettings(const std::function<void()>& apply_callback)
|
|||
const bool old_audio_sync_enabled = m_settings.audio_sync_enabled;
|
||||
const bool old_speed_limiter_enabled = m_settings.speed_limiter_enabled;
|
||||
const bool old_display_linear_filtering = m_settings.display_linear_filtering;
|
||||
std::array<ControllerType, NUM_CONTROLLER_AND_CARD_PORTS> old_controller_types = m_settings.controller_types;
|
||||
|
||||
apply_callback();
|
||||
|
||||
|
@ -773,6 +776,12 @@ void HostInterface::UpdateSettings(const std::function<void()>& apply_callback)
|
|||
}
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < NUM_CONTROLLER_AND_CARD_PORTS; i++)
|
||||
{
|
||||
if (m_settings.controller_types[i] != old_controller_types[i])
|
||||
OnControllerTypeChanged(i);
|
||||
}
|
||||
|
||||
if (m_display && m_settings.display_linear_filtering != old_display_linear_filtering)
|
||||
m_display->SetDisplayLinearFiltering(m_settings.display_linear_filtering);
|
||||
}
|
||||
|
|
|
@ -104,6 +104,7 @@ protected:
|
|||
virtual void OnSystemDestroyed();
|
||||
virtual void OnSystemPerformanceCountersUpdated();
|
||||
virtual void OnRunningGameChanged();
|
||||
virtual void OnControllerTypeChanged(u32 slot);
|
||||
|
||||
void SetUserDirectory();
|
||||
|
||||
|
|
|
@ -314,6 +314,13 @@ void QtHostInterface::OnRunningGameChanged()
|
|||
}
|
||||
}
|
||||
|
||||
void QtHostInterface::OnControllerTypeChanged(u32 slot)
|
||||
{
|
||||
HostInterface::OnControllerTypeChanged(slot);
|
||||
|
||||
updateInputMap();
|
||||
}
|
||||
|
||||
void QtHostInterface::updateInputMap()
|
||||
{
|
||||
if (!isOnWorkerThread())
|
||||
|
|
|
@ -102,6 +102,7 @@ protected:
|
|||
void OnSystemDestroyed() override;
|
||||
void OnSystemPerformanceCountersUpdated() override;
|
||||
void OnRunningGameChanged() override;
|
||||
void OnControllerTypeChanged(u32 slot) override;
|
||||
|
||||
private:
|
||||
using InputButtonHandler = std::function<void(bool)>;
|
||||
|
|
|
@ -189,6 +189,14 @@ void SDLHostInterface::OnSystemDestroyed()
|
|||
HostInterface::OnSystemDestroyed();
|
||||
}
|
||||
|
||||
void SDLHostInterface::OnControllerTypeChanged(u32 slot)
|
||||
{
|
||||
HostInterface::OnControllerTypeChanged(slot);
|
||||
|
||||
UpdateKeyboardControllerMapping();
|
||||
UpdateControllerControllerMapping();
|
||||
}
|
||||
|
||||
void SDLHostInterface::SaveSettings()
|
||||
{
|
||||
SDLSettingsInterface si(GetSettingsFileName().c_str());
|
||||
|
|
|
@ -37,6 +37,7 @@ protected:
|
|||
void OnSystemCreated() override;
|
||||
void OnSystemPaused(bool paused) override;
|
||||
void OnSystemDestroyed();
|
||||
void OnControllerTypeChanged(u32 slot) override;
|
||||
|
||||
private:
|
||||
enum class KeyboardControllerAction
|
||||
|
|
Loading…
Reference in New Issue