Fixed the crash that would occur when the Refresh button was pressed in the controllers config.

- Simplified the locking mechanism when controllers were updated
- Reloaded the config of the controls instead of re-initialising the control plugins
- Fixed controls being unresponsive after the Refresh button was pressed
- Disables the hotkeys while the controller config is open
This commit is contained in:
skidau
2015-03-05 19:49:10 +11:00
parent b446ea0132
commit 780eef68f6
16 changed files with 93 additions and 104 deletions

View File

@ -45,6 +45,11 @@ void Initialize(void* const hwnd)
s_config.LoadConfig(true);
}
void LoadConfig()
{
s_config.LoadConfig(true);
}
void GetStatus(u8 _port, KeyboardStatus* _pKeyboardStatus)
{
memset(_pKeyboardStatus, 0, sizeof(*_pKeyboardStatus));
@ -52,19 +57,6 @@ void GetStatus(u8 _port, KeyboardStatus* _pKeyboardStatus)
std::unique_lock<std::recursive_mutex> lk(s_config.controls_lock, std::try_to_lock);
if (!lk.owns_lock())
{
// if gui has lock (messing with controls), skip this input cycle
// center axes and return
_pKeyboardStatus->key0x = 0;
_pKeyboardStatus->key1x = 0;
_pKeyboardStatus->key2x = 0;
_pKeyboardStatus->key3x = 0;
_pKeyboardStatus->key4x = 0;
_pKeyboardStatus->key5x = 0;
return;
}
// get input
((GCKeyboard*)s_config.controllers[_port])->GetInput(_pKeyboardStatus);
}