input: restore original defaults when changing pad handlers

This fixes the vibration threshold being 0 when going to DS3 and back.
Probably also fixes a lot of other tiny bugs.
This commit is contained in:
Megamouse
2025-09-10 19:31:08 +02:00
parent 735588aa1a
commit b3d5493a6b
5 changed files with 102 additions and 23 deletions
+4
View File
@@ -200,6 +200,10 @@ void PadHandlerBase::init_configs()
{
for (u32 i = 0; i < MAX_GAMEPADS; i++)
{
// We need to restore the original defaults first.
m_pad_configs[i].restore_defaults();
// Set and apply actual defaults depending on pad handler
init_config(&m_pad_configs[i]);
}
}
+8 -4
View File
@@ -234,14 +234,18 @@ std::shared_ptr<PadHandlerBase> gui_pad_thread::GetHandler(pad_handler type)
void gui_pad_thread::InitPadConfig(cfg_pad& cfg, pad_handler type, std::shared_ptr<PadHandlerBase>& handler)
{
// We need to restore the original defaults first.
cfg.restore_defaults();
if (!handler)
{
handler = GetHandler(type);
}
if (handler)
{
handler->init_config(&cfg);
}
if (handler)
{
// Set and apply actual defaults depending on pad handler
handler->init_config(&cfg);
}
}
+5
View File
@@ -883,12 +883,17 @@ std::shared_ptr<PadHandlerBase> pad_thread::GetHandler(pad_handler type)
void pad_thread::InitPadConfig(cfg_pad& cfg, pad_handler type, std::shared_ptr<PadHandlerBase>& handler)
{
// We need to restore the original defaults first.
cfg.restore_defaults();
if (!handler)
{
handler = GetHandler(type);
}
ensure(!!handler);
// Set and apply actual defaults depending on pad handler
handler->init_config(&cfg);
}