Merge pull request #6540 from spycrab/gcpad_segfault

Core: Check for initialized GCPad before resetting rumble
This commit is contained in:
Stenzek 2018-03-28 02:40:53 +10:00 committed by GitHub
commit 92e7830be9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View File

@ -250,6 +250,8 @@ static void ResetRumble()
GCAdapter::ResetRumble();
#endif
#if defined(CIFACE_USE_XINPUT) || defined(CIFACE_USE_DINPUT)
if (!Pad::IsInitialized())
return;
for (int i = 0; i < 4; ++i)
Pad::ResetRumble(i);
#endif

View File

@ -45,6 +45,11 @@ void LoadConfig()
s_config.LoadConfig(true);
}
bool IsInitialized()
{
return !s_config.ControllersNeedToBeCreated();
}
GCPadStatus GetStatus(int pad_num)
{
return static_cast<GCPad*>(s_config.GetController(pad_num))->GetInput();

View File

@ -21,6 +21,7 @@ namespace Pad
void Shutdown();
void Initialize();
void LoadConfig();
bool IsInitialized();
InputConfig* GetConfig();