From b9fb6ad3e8aa8ae1350d7dd4e9bd5cbec4e334ce Mon Sep 17 00:00:00 2001 From: skidau Date: Wed, 4 Feb 2015 18:05:22 +1100 Subject: Initialised all controller interfaces together on CFrame construction to fix the crash that would occur if the controller config were opened before a game was started. --- Source/Core/DolphinWX/Frame.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Source/Core/DolphinWX/Frame.cpp') diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 83ad8f8afc..e65747cc07 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -50,6 +50,8 @@ #include "Core/Movie.h" #include "Core/State.h" #include "Core/HW/DVDInterface.h" +#include "Core/HW/GCKeyboard.h" +#include "Core/HW/GCPad.h" #include "DolphinWX/Frame.h" #include "DolphinWX/GameListCtrl.h" @@ -345,15 +347,19 @@ END_EVENT_TABLE() // Creation and close, quit functions -bool CFrame::InitHotkeys() +bool CFrame::InitControllers() { if (!g_controller_interface.IsInit()) { #if defined(HAVE_X11) && HAVE_X11 Window win = X11Utils::XWindowFromHandle(GetHandle()); HotkeyManagerEmu::Initialize(reinterpret_cast(win)); + Pad::Initialize(reinterpret_cast(win)); + Keyboard::Initialize(reinterpret_cast(win)); #else HotkeyManagerEmu::Initialize(reinterpret_cast(GetHandle())); + Pad::Initialize(reinterpret_cast(GetHandle())); + Keyboard::Initialize(reinterpret_cast(GetHandle())); #endif return true; } @@ -497,7 +503,7 @@ CFrame::CFrame(wxFrame* parent, g_pCodeWindow->UpdateButtonStates(); // check if game is running - m_bHotkeysInit = InitHotkeys(); + m_bHotkeysInit = InitControllers(); m_poll_hotkey_timer = new wxTimer(this); Bind(wxEVT_TIMER, &CFrame::PollHotkeys, this); @@ -511,6 +517,9 @@ CFrame::~CFrame() if (m_bHotkeysInit) { HotkeyManagerEmu::Shutdown(); + Keyboard::Shutdown(); + Pad::Shutdown(); + m_bHotkeysInit = false; } drives.clear(); @@ -1261,7 +1270,7 @@ void CFrame::PollHotkeys(wxTimerEvent& event) { if (Core::GetState() == Core::CORE_UNINITIALIZED || Core::GetState() == Core::CORE_PAUSE) { - InitHotkeys(); + m_bHotkeysInit = InitControllers(); g_controller_interface.UpdateInput(); } -- cgit v1.2.3