Shutdown NoGUI build properly in linux.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5202 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-03-16 13:18:52 +00:00
parent 6723a91664
commit d6b9a2ec81
2 changed files with 18 additions and 7 deletions

View File

@ -58,7 +58,14 @@ void Host_NotifyMapLoaded(){}
void Host_ShowJitResults(unsigned int address){} 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(){} void Host_UpdateLogDisplay(){}
@ -66,7 +73,6 @@ void Host_UpdateLogDisplay(){}
void Host_UpdateDisasmDialog(){} void Host_UpdateDisasmDialog(){}
Common::Event updateMainFrameEvent;
void Host_UpdateMainFrame() void Host_UpdateMainFrame()
{ {
updateMainFrameEvent.Set(); updateMainFrameEvent.Set();
@ -238,11 +244,17 @@ int main(int argc, char* argv[])
if (BootManager::BootCore(bootFile)) //no use running the loop when booting fails 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();
} updateMainFrameEvent.Wait();
Core::Stop();
#else
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
updateMainFrameEvent.Wait();
#endif
} }
updateMainFrameEvent.Shutdown();
CPluginManager::Shutdown(); CPluginManager::Shutdown();
SConfig::Shutdown(); SConfig::Shutdown();

View File

@ -259,8 +259,7 @@ THREAD_RETURN XEventThread(void *pArg)
{ {
XEvent event; XEvent event;
KeySym key; KeySym key;
int num_events; for (int num_events = XPending(GLWin.dpy); num_events > 0; num_events--) {
for (num_events = XPending(GLWin.dpy);num_events > 0;num_events--) {
XNextEvent(GLWin.dpy, &event); XNextEvent(GLWin.dpy, &event);
switch(event.type) { switch(event.type) {
case KeyPress: case KeyPress: