diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 4b109b34a8..d7c35ecfb8 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -23,6 +23,7 @@ #include "Thread.h" #include "Timer.h" +#include "Common.h" #include "Console.h" #include "Core.h" @@ -55,6 +56,7 @@ #include "MemTools.h" #include "Host.h" #include "LogManager.h" +#include "EventHandler.h" #include "State.h" @@ -66,6 +68,8 @@ // glXMakeCurrent/ wglMakeCurrent takes a context and makes it current on the current thread. // So it's fine to init ogl on one thread, and then make it current and start blasting on another. +EventHandler *eventHandler = NULL;; + namespace Core { // forwarding @@ -100,6 +104,7 @@ SCoreStartupParameter g_CoreStartupParameter; //uck Common::Event emuThreadGoing; + bool PanicAlertToVideo(const char* text, bool yes_no) { DisplayMessage(text, 3000); @@ -118,6 +123,11 @@ bool Init(const SCoreStartupParameter _CoreParameter) Host_SetWaitCursor(true); g_CoreStartupParameter = _CoreParameter; + +#if defined GLTEST && GLTEST + // init the event handler + eventHandler = new EventHandler(); +#endif // start the thread again _dbg_assert_(HLE, g_pThread == NULL); @@ -391,6 +401,9 @@ THREAD_RETURN EmuThread(void *pArg) PluginVideo::Video_Shutdown(); PluginVideo::UnloadPlugin(); + if (eventHandler) + delete eventHandler; + HW::Shutdown(); LOG(MASTER_LOG, "EmuThread exited"); diff --git a/Source/Core/Core/Src/EventHandler.cpp b/Source/Core/Core/Src/EventHandler.cpp index a6a6bb76da..a8770fc153 100644 --- a/Source/Core/Core/Src/EventHandler.cpp +++ b/Source/Core/Core/Src/EventHandler.cpp @@ -1,5 +1,8 @@ #include "EventHandler.h" + +#if defined HAVE_WX && HAVE_WX #include +#endif bool EventHandler::RegisterEventListener(listenFuncPtr func, Keys key) { if (key.inputType == KeyboardInput) { @@ -57,7 +60,8 @@ bool EventHandler::TestEvent (Keys k, sf::Event e) } return (false); } - + +#if defined HAVE_WX && HAVE_WX // Taken from wxw source code sf::Key::Code EventHandler::wxCharCodeToSF(int id) { @@ -145,6 +149,7 @@ sf::Key::Code EventHandler::wxCharCodeToSF(int id) return sfKey; } +#endif void EventHandler::SFKeyToString(sf::Key::Code keycode, char *keyStr) { switch (keycode) { diff --git a/Source/Core/Core/Src/EventHandler.h b/Source/Core/Core/Src/EventHandler.h index 1de00ecb75..88fa24b8f5 100644 --- a/Source/Core/Core/Src/EventHandler.h +++ b/Source/Core/Core/Src/EventHandler.h @@ -1,5 +1,6 @@ #ifndef EVENTHANDER_H #define EVENTHANDER_H 1 +#include "Common.h" #include #include "Event.hpp" @@ -39,7 +40,9 @@ public: void Update(); bool addEvent(sf::Event *e); static bool TestEvent (Keys k, sf::Event e); +#if defined HAVE_WX && HAVE_WX static sf::Key::Code wxCharCodeToSF(int id); +#endif static void SFKeyToString(sf::Key::Code keycode, char *keyStr); };