From 016ef43b27970126058ce3a7819446703772e025 Mon Sep 17 00:00:00 2001 From: spycrab Date: Tue, 27 Mar 2018 16:24:36 +0200 Subject: [PATCH] Core: Check for initialized GCPad before resetting rumble --- Source/Core/Core/Core.cpp | 2 ++ Source/Core/Core/HW/GCPad.cpp | 5 +++++ Source/Core/Core/HW/GCPad.h | 1 + 3 files changed, 8 insertions(+) diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp index 74ae5d3e5f..99e306cb80 100644 --- a/Source/Core/Core/Core.cpp +++ b/Source/Core/Core/Core.cpp @@ -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 diff --git a/Source/Core/Core/HW/GCPad.cpp b/Source/Core/Core/HW/GCPad.cpp index 170e2b4f0e..1ac2a6c3bb 100644 --- a/Source/Core/Core/HW/GCPad.cpp +++ b/Source/Core/Core/HW/GCPad.cpp @@ -45,6 +45,11 @@ void LoadConfig() s_config.LoadConfig(true); } +bool IsInitialized() +{ + return !s_config.ControllersNeedToBeCreated(); +} + GCPadStatus GetStatus(int pad_num) { return static_cast(s_config.GetController(pad_num))->GetInput(); diff --git a/Source/Core/Core/HW/GCPad.h b/Source/Core/Core/HW/GCPad.h index d3a9572d8c..1594fc9b5d 100644 --- a/Source/Core/Core/HW/GCPad.h +++ b/Source/Core/Core/HW/GCPad.h @@ -21,6 +21,7 @@ namespace Pad void Shutdown(); void Initialize(); void LoadConfig(); +bool IsInitialized(); InputConfig* GetConfig();