Input: Turn off hot plugging for directinput devices

Loading, resetting a game or opening input config will still check for new DInput controllers
This commit is contained in:
Sour 2019-11-16 22:32:06 -05:00
parent ae0547df65
commit 27d512e02f
3 changed files with 7 additions and 8 deletions

View file

@ -1,5 +1,6 @@
#include "stdafx.h"
#include <random>
#include <future>
#include <thread>
#include "Console.h"
#include "CPU.h"
@ -396,7 +397,6 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
GetDebugger();
}
ResetComponents(false);
//Reset components before creating rewindmanager, otherwise the first save state it takes will be invalid
@ -605,7 +605,7 @@ void Console::ResetComponents(bool softReset)
_resetRunTimers = true;
KeyManager::UpdateDevices();
std::async(std::launch::async, KeyManager::UpdateDevices);
//This notification MUST be sent before the UpdateInputState() below to allow MovieRecorder to grab the first frame's worth of inputs
_notificationManager->SendNotification(softReset ? ConsoleNotificationType::GameReset : ConsoleNotificationType::GameLoaded);

View file

@ -22,7 +22,9 @@ namespace Mesen.GUI.Forms.Config
tlpControllers.Enabled = !InteropEmu.MoviePlaying() && !InteropEmu.MovieRecording();
InteropEmu.UpdateInputDevices();
Task.Run(() => {
InteropEmu.UpdateInputDevices();
});
Entity = ConfigManager.Config.InputInfo;

View file

@ -256,12 +256,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 times and sometimes causes issues/freezes
if(_xInput->NeedToUpdate()) {
_xInput->UpdateDeviceList();
}
_directInput->UpdateDeviceList();
_stopSignal.Wait(5000);
}
});
@ -375,10 +374,8 @@ void WindowsKeyManager::UpdateDevices()
return;
}
_console->Pause();
_xInput->UpdateDeviceList();
_directInput->UpdateDeviceList();
_console->Resume();
}
void WindowsKeyManager::SetKeyState(uint16_t scanCode, bool state)