Skip to content

Commit

Permalink
Merge pull request #6540 from spycrab/gcpad_segfault
Browse files Browse the repository at this point in the history
Core: Check for initialized GCPad before resetting rumble
  • Loading branch information
stenzek committed Mar 27, 2018
2 parents 3c61ee5 + 016ef43 commit 92e7830
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Source/Core/Core/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Source/Core/Core/HW/GCPad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/HW/GCPad.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace Pad
void Shutdown();
void Initialize();
void LoadConfig();
bool IsInitialized();

InputConfig* GetConfig();

Expand Down

0 comments on commit 92e7830

Please sign in to comment.