diff options
Diffstat (limited to 'src/citra_qt/bootmanager.cpp')
| -rw-r--r-- | src/citra_qt/bootmanager.cpp | 43 |
1 files changed, 5 insertions, 38 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index fa4e976f4..1e902a8b6 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp | |||
| @@ -28,9 +28,8 @@ | |||
| 28 | #define COPYRIGHT "Copyright (C) 2013-2014 Citra Team" | 28 | #define COPYRIGHT "Copyright (C) 2013-2014 Citra Team" |
| 29 | 29 | ||
| 30 | EmuThread::EmuThread(GRenderWindow* render_window) : | 30 | EmuThread::EmuThread(GRenderWindow* render_window) : |
| 31 | exec_cpu_step(false), cpu_running(false), stop_run(false), render_window(render_window) { | 31 | exec_step(false), running(false), stop_run(false), render_window(render_window) { |
| 32 | 32 | ||
| 33 | shutdown_event.Reset(); | ||
| 34 | connect(this, SIGNAL(started()), render_window, SLOT(moveContext())); | 33 | connect(this, SIGNAL(started()), render_window, SLOT(moveContext())); |
| 35 | } | 34 | } |
| 36 | 35 | ||
| @@ -42,20 +41,20 @@ void EmuThread::run() { | |||
| 42 | // next execution step | 41 | // next execution step |
| 43 | bool was_active = false; | 42 | bool was_active = false; |
| 44 | while (!stop_run) { | 43 | while (!stop_run) { |
| 45 | if (cpu_running) { | 44 | if (running) { |
| 46 | if (!was_active) | 45 | if (!was_active) |
| 47 | emit DebugModeLeft(); | 46 | emit DebugModeLeft(); |
| 48 | 47 | ||
| 49 | Core::RunLoop(); | 48 | Core::RunLoop(); |
| 50 | 49 | ||
| 51 | was_active = cpu_running || exec_cpu_step; | 50 | was_active = running || exec_step; |
| 52 | if (!was_active) | 51 | if (!was_active) |
| 53 | emit DebugModeEntered(); | 52 | emit DebugModeEntered(); |
| 54 | } else if (exec_cpu_step) { | 53 | } else if (exec_step) { |
| 55 | if (!was_active) | 54 | if (!was_active) |
| 56 | emit DebugModeLeft(); | 55 | emit DebugModeLeft(); |
| 57 | 56 | ||
| 58 | exec_cpu_step = false; | 57 | exec_step = false; |
| 59 | Core::SingleStep(); | 58 | Core::SingleStep(); |
| 60 | emit DebugModeEntered(); | 59 | emit DebugModeEntered(); |
| 61 | yieldCurrentThread(); | 60 | yieldCurrentThread(); |
| @@ -65,40 +64,8 @@ void EmuThread::run() { | |||
| 65 | } | 64 | } |
| 66 | 65 | ||
| 67 | render_window->moveContext(); | 66 | render_window->moveContext(); |
| 68 | |||
| 69 | shutdown_event.Set(); | ||
| 70 | } | 67 | } |
| 71 | 68 | ||
| 72 | void EmuThread::Stop() { | ||
| 73 | if (!isRunning()) { | ||
| 74 | LOG_WARNING(Frontend, "EmuThread::Stop called while emu thread wasn't running, returning..."); | ||
| 75 | return; | ||
| 76 | } | ||
| 77 | stop_run = true; | ||
| 78 | |||
| 79 | // Release emu threads from any breakpoints, so that this doesn't hang forever. | ||
| 80 | Pica::g_debug_context->ClearBreakpoints(); | ||
| 81 | |||
| 82 | //core::g_state = core::SYS_DIE; | ||
| 83 | |||
| 84 | // TODO: Waiting here is just a bad workaround for retarded shutdown logic. | ||
| 85 | wait(1000); | ||
| 86 | if (isRunning()) { | ||
| 87 | LOG_WARNING(Frontend, "EmuThread still running, terminating..."); | ||
| 88 | quit(); | ||
| 89 | |||
| 90 | // TODO: Waiting 50 seconds can be necessary if the logging subsystem has a lot of spam | ||
| 91 | // queued... This should be fixed. | ||
| 92 | wait(50000); | ||
| 93 | if (isRunning()) { | ||
| 94 | LOG_CRITICAL(Frontend, "EmuThread STILL running, something is wrong here..."); | ||
| 95 | terminate(); | ||
| 96 | } | ||
| 97 | } | ||
| 98 | LOG_INFO(Frontend, "EmuThread stopped"); | ||
| 99 | } | ||
| 100 | |||
| 101 | |||
| 102 | // This class overrides paintEvent and resizeEvent to prevent the GUI thread from stealing GL context. | 69 | // This class overrides paintEvent and resizeEvent to prevent the GUI thread from stealing GL context. |
| 103 | // The corresponding functionality is handled in EmuThread instead | 70 | // The corresponding functionality is handled in EmuThread instead |
| 104 | class GGLWidgetInternal : public QGLWidget | 71 | class GGLWidgetInternal : public QGLWidget |