mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
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.
This commit is contained in:
@ -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<void*>(win));
|
||||
Pad::Initialize(reinterpret_cast<void*>(win));
|
||||
Keyboard::Initialize(reinterpret_cast<void*>(win));
|
||||
#else
|
||||
HotkeyManagerEmu::Initialize(reinterpret_cast<void*>(GetHandle()));
|
||||
Pad::Initialize(reinterpret_cast<void*>(GetHandle()));
|
||||
Keyboard::Initialize(reinterpret_cast<void*>(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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user