From d6b9a2ec814565b2e1ca4c42782a98b303b11e91 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Tue, 16 Mar 2010 13:18:52 +0000 Subject: [PATCH] Shutdown NoGUI build properly in linux. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5202 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/MainNoGUI.cpp | 22 ++++++++++++++----- Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp | 3 +-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Source/Core/DolphinWX/Src/MainNoGUI.cpp b/Source/Core/DolphinWX/Src/MainNoGUI.cpp index 3d7256931f..d30ab1113e 100644 --- a/Source/Core/DolphinWX/Src/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/Src/MainNoGUI.cpp @@ -58,7 +58,14 @@ void Host_NotifyMapLoaded(){} void Host_ShowJitResults(unsigned int address){} -void Host_Message(int Id){} +Common::Event updateMainFrameEvent; +void Host_Message(int Id) +{ +#if defined(HAVE_X11) && HAVE_X11 + if (Id == WM_USER_STOP) + updateMainFrameEvent.Set(); +#endif +} void Host_UpdateLogDisplay(){} @@ -66,7 +73,6 @@ void Host_UpdateLogDisplay(){} void Host_UpdateDisasmDialog(){} -Common::Event updateMainFrameEvent; void Host_UpdateMainFrame() { updateMainFrameEvent.Set(); @@ -238,11 +244,17 @@ int main(int argc, char* argv[]) if (BootManager::BootCore(bootFile)) //no use running the loop when booting fails { - while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN) - { +#if defined(HAVE_X11) && HAVE_X11 + while (Core::GetState() == Core::CORE_UNINITIALIZED) updateMainFrameEvent.Wait(); - } + updateMainFrameEvent.Wait(); + Core::Stop(); +#else + while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN) + updateMainFrameEvent.Wait(); +#endif } + updateMainFrameEvent.Shutdown(); CPluginManager::Shutdown(); SConfig::Shutdown(); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index 73a353ce79..53e35c690a 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -259,8 +259,7 @@ THREAD_RETURN XEventThread(void *pArg) { XEvent event; KeySym key; - int num_events; - for (num_events = XPending(GLWin.dpy);num_events > 0;num_events--) { + for (int num_events = XPending(GLWin.dpy); num_events > 0; num_events--) { XNextEvent(GLWin.dpy, &event); switch(event.type) { case KeyPress: