diff --git a/src/core/analog_controller.cpp b/src/core/analog_controller.cpp index dc0e9ac6e..f165cf0a3 100644 --- a/src/core/analog_controller.cpp +++ b/src/core/analog_controller.cpp @@ -102,22 +102,7 @@ void AnalogController::SetButtonState(Button button, bool pressed) { // analog toggle if (pressed) - { - if (m_analog_locked) - { - g_host_interface->AddFormattedOSDMessage( - 5.0f, - m_analog_mode ? g_host_interface->TranslateString("AnalogController", - "Controller %u is locked to analog mode by the game.") : - g_host_interface->TranslateString("AnalogController", - "Controller %u is locked to digital mode by the game."), - m_index + 1u); - } - else - { - SetAnalogMode(!m_analog_mode); - } - } + m_analog_toggle_queued = true; return; } @@ -158,6 +143,25 @@ float AnalogController::GetVibrationMotorStrength(u32 motor) void AnalogController::ResetTransferState() { + if (m_analog_toggle_queued) + { + if (m_analog_locked) + { + g_host_interface->AddFormattedOSDMessage( + 5.0f, + m_analog_mode ? + g_host_interface->TranslateString("AnalogController", "Controller %u is locked to analog mode by the game.") : + g_host_interface->TranslateString("AnalogController", "Controller %u is locked to digital mode by the game."), + m_index + 1u); + } + else + { + SetAnalogMode(!m_analog_mode); + } + + m_analog_toggle_queued = false; + } + m_state = State::Idle; } diff --git a/src/core/analog_controller.h b/src/core/analog_controller.h index 2cf96fae1..21cbe635f 100644 --- a/src/core/analog_controller.h +++ b/src/core/analog_controller.h @@ -149,6 +149,8 @@ private: std::array(Axis::Count)> m_axis_state{}; + bool m_analog_toggle_queued = false; + // buttons are active low u16 m_button_state = UINT16_C(0xFFFF);