Input: Turn off hot plugging for directinput devices

Loading a game or opening input config will still check for new DInput controllers
This commit is contained in:
Sour 2019-12-26 13:57:05 -05:00
parent bf76bb3579
commit 857caa3e20
3 changed files with 7 additions and 3 deletions

View file

@ -371,6 +371,7 @@ bool Console::LoadRom(VirtualFile romFile, VirtualFile patchFile, bool stopRom)
shared_ptr<BaseCartridge> cart = BaseCartridge::CreateCartridge(this, romFile, patchFile);
if(cart) {
if(stopRom) {
KeyManager::UpdateDevices();
Stop(false);
}

View file

@ -20,6 +20,10 @@ namespace Mesen.GUI.Forms.Config
return;
}
Task.Run(() => {
InputApi.UpdateInputDevices();
});
InputConfig cfg = ConfigManager.Config.Input.Clone();
Entity = cfg;

View file

@ -254,12 +254,11 @@ void WindowsKeyManager::StartUpdateDeviceThread()
_directInput.reset(new DirectInputManager(_console, _hWnd));
while(!_stopUpdateDeviceThread) {
//Check for newly plugged in controllers every 5 secs (this takes ~60-70ms when no new controllers are found)
//Check for newly plugged in XInput controllers every 5 secs
//Do not check for DirectInput controllers because this takes more time and sometimes causes issues/freezes
if(_xInput->NeedToUpdate()) {
_xInput->UpdateDeviceList();
}
_directInput->UpdateDeviceList();
_stopSignal.Wait(5000);
}
});