ui: so refreshing the device combo box no longer wipes the user's mappings back to defaults. (#406)

This commit is contained in:
NullVector 2026-10-11 22:09:54 +10:30 committed by GitHub
parent d1c5791fb0
commit a71795a915
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 2 deletions

View File

@ -716,7 +716,10 @@ bool InputConfigPlayer::OnStateChange(SCITER_ELEMENT elem, uint32_t /*eventReaso
}
else if (m_page.GetElementByID("comboDevices") == elem)
{
UpdateMappingWithDefaults();
if (!m_suppressDeviceAutomap)
{
UpdateMappingWithDefaults();
}
}
else if (m_analogMapDeadzoneSlider[0] == elem)
{
@ -1046,6 +1049,18 @@ void InputConfigPlayer::UpdateInputDeviceCombobox(void)
{
return;
}
struct SuppressDeviceAutomap
{
bool & flag;
explicit SuppressDeviceAutomap(bool & flag_) : flag(flag_)
{
flag = true;
}
~SuppressDeviceAutomap()
{
flag = false;
}
} suppress(m_suppressDeviceAutomap);
// Skip input device persistence if "Input Devices" is set to "Any".
if (m_comboDevices->CurrentIndex() == 0)
@ -1561,7 +1576,7 @@ void InputConfigPlayer::UpdateMappingWithDefaults()
for (int i = 0, n = (uint32_t)NativeMotionValues::NumMotions; i < n; i++)
{
if (m_motionMap[i].IsValid())
if (!m_motionMap[i].IsValid())
{
continue;
}

View File

@ -130,4 +130,5 @@ private:
std::chrono::steady_clock::time_point m_motionUiThrottleLast;
NpadStyleIndex m_displayedControllerLayout;
bool m_callbackEnabled;
bool m_suppressDeviceAutomap{};
};