summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2015-02-04 18:48:19 +1100
committerskidau <skidau@gmail.com>2015-02-04 18:48:19 +1100
commit3709a1ce3af08d5fdcf653fb81c2a6a7e2bbd2ae (patch)
treebed79b3d477f858b12f85f24669811c8889bb76b
parentfc8ea9c3b3e31e0882fb660a376dc795f7080de6 (diff)
Fixed the crash which occurred when opening Wiimote configuration before a game was started.
-rw-r--r--Source/Core/Core/Core.cpp3
-rw-r--r--Source/Core/Core/HW/Wiimote.cpp5
-rw-r--r--Source/Core/DolphinWX/Frame.cpp6
3 files changed, 9 insertions, 5 deletions
diff --git a/Source/Core/Core/Core.cpp b/Source/Core/Core/Core.cpp
index d2ee643bdf..30d64b6d38 100644
--- a/Source/Core/Core/Core.cpp
+++ b/Source/Core/Core/Core.cpp
@@ -484,10 +484,9 @@ void EmuThread()
HW::Shutdown();
INFO_LOG(CONSOLE, "%s", StopMessage(false, "HW shutdown").c_str());
- Wiimote::Shutdown();
-
if (init_controllers)
{
+ Wiimote::Shutdown();
Keyboard::Shutdown();
Pad::Shutdown();
init_controllers = false;
diff --git a/Source/Core/Core/HW/Wiimote.cpp b/Source/Core/Core/HW/Wiimote.cpp
index e7636b3429..357b3b1fea 100644
--- a/Source/Core/Core/HW/Wiimote.cpp
+++ b/Source/Core/Core/HW/Wiimote.cpp
@@ -40,8 +40,9 @@ void Shutdown()
void Initialize(void* const hwnd, bool wait)
{
// add 4 Wiimotes
- for (unsigned int i = WIIMOTE_CHAN_0; i<MAX_BBMOTES; ++i)
- s_config.controllers.push_back(new WiimoteEmu::Wiimote(i));
+ if (s_config.controllers.empty())
+ for (unsigned int i = WIIMOTE_CHAN_0; i < MAX_BBMOTES; ++i)
+ s_config.controllers.push_back(new WiimoteEmu::Wiimote(i));
g_controller_interface.Initialize(hwnd);
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index dc6aa79ac1..2446cb4cd3 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -52,6 +52,7 @@
#include "Core/HW/DVDInterface.h"
#include "Core/HW/GCKeyboard.h"
#include "Core/HW/GCPad.h"
+#include "Core/HW/Wiimote.h"
#include "DolphinWX/Frame.h"
#include "DolphinWX/GameListCtrl.h"
@@ -356,10 +357,12 @@ bool CFrame::InitControllers()
HotkeyManagerEmu::Initialize(reinterpret_cast<void*>(win));
Pad::Initialize(reinterpret_cast<void*>(win));
Keyboard::Initialize(reinterpret_cast<void*>(win));
+ Wiimote::Initialize(reinterpret_cast<void*>(win));
#else
HotkeyManagerEmu::Initialize(reinterpret_cast<void*>(GetHandle()));
Pad::Initialize(reinterpret_cast<void*>(GetHandle()));
Keyboard::Initialize(reinterpret_cast<void*>(GetHandle()));
+ Wiimote::Initialize(reinterpret_cast<void*>(GetHandle()));
#endif
return true;
}
@@ -516,9 +519,10 @@ CFrame::~CFrame()
if (m_bHotkeysInit)
{
- HotkeyManagerEmu::Shutdown();
+ Wiimote::Shutdown();
Keyboard::Shutdown();
Pad::Shutdown();
+ HotkeyManagerEmu::Shutdown();
m_bHotkeysInit = false;
}