diff options
Diffstat (limited to 'src/citra_qt/bootmanager.cpp')
| -rw-r--r-- | src/citra_qt/bootmanager.cpp | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index c2b7ba0e2..fa4e976f4 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp | |||
| @@ -30,21 +30,19 @@ | |||
| 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_cpu_step(false), cpu_running(false), stop_run(false), render_window(render_window) { |
| 32 | 32 | ||
| 33 | shutdown_event.Reset(); | ||
| 33 | connect(this, SIGNAL(started()), render_window, SLOT(moveContext())); | 34 | connect(this, SIGNAL(started()), render_window, SLOT(moveContext())); |
| 34 | } | 35 | } |
| 35 | 36 | ||
| 36 | void EmuThread::run() | 37 | void EmuThread::run() { |
| 37 | { | ||
| 38 | stop_run = false; | 38 | stop_run = false; |
| 39 | 39 | ||
| 40 | // holds whether the cpu was running during the last iteration, | 40 | // holds whether the cpu was running during the last iteration, |
| 41 | // so that the DebugModeLeft signal can be emitted before the | 41 | // so that the DebugModeLeft signal can be emitted before the |
| 42 | // next execution step | 42 | // next execution step |
| 43 | bool was_active = false; | 43 | bool was_active = false; |
| 44 | while (!stop_run) | 44 | while (!stop_run) { |
| 45 | { | 45 | if (cpu_running) { |
| 46 | if (cpu_running) | ||
| 47 | { | ||
| 48 | if (!was_active) | 46 | if (!was_active) |
| 49 | emit DebugModeLeft(); | 47 | emit DebugModeLeft(); |
| 50 | 48 | ||
| @@ -53,9 +51,7 @@ void EmuThread::run() | |||
| 53 | was_active = cpu_running || exec_cpu_step; | 51 | was_active = cpu_running || exec_cpu_step; |
| 54 | if (!was_active) | 52 | if (!was_active) |
| 55 | emit DebugModeEntered(); | 53 | emit DebugModeEntered(); |
| 56 | } | 54 | } else if (exec_cpu_step) { |
| 57 | else if (exec_cpu_step) | ||
| 58 | { | ||
| 59 | if (!was_active) | 55 | if (!was_active) |
| 60 | emit DebugModeLeft(); | 56 | emit DebugModeLeft(); |
| 61 | 57 | ||
| @@ -67,15 +63,14 @@ void EmuThread::run() | |||
| 67 | was_active = false; | 63 | was_active = false; |
| 68 | } | 64 | } |
| 69 | } | 65 | } |
| 66 | |||
| 70 | render_window->moveContext(); | 67 | render_window->moveContext(); |
| 71 | 68 | ||
| 72 | Core::Stop(); | 69 | shutdown_event.Set(); |
| 73 | } | 70 | } |
| 74 | 71 | ||
| 75 | void EmuThread::Stop() | 72 | void EmuThread::Stop() { |
| 76 | { | 73 | if (!isRunning()) { |
| 77 | if (!isRunning()) | ||
| 78 | { | ||
| 79 | LOG_WARNING(Frontend, "EmuThread::Stop called while emu thread wasn't running, returning..."); | 74 | LOG_WARNING(Frontend, "EmuThread::Stop called while emu thread wasn't running, returning..."); |
| 80 | return; | 75 | return; |
| 81 | } | 76 | } |
| @@ -88,23 +83,19 @@ void EmuThread::Stop() | |||
| 88 | 83 | ||
| 89 | // TODO: Waiting here is just a bad workaround for retarded shutdown logic. | 84 | // TODO: Waiting here is just a bad workaround for retarded shutdown logic. |
| 90 | wait(1000); | 85 | wait(1000); |
| 91 | if (isRunning()) | 86 | if (isRunning()) { |
| 92 | { | ||
| 93 | LOG_WARNING(Frontend, "EmuThread still running, terminating..."); | 87 | LOG_WARNING(Frontend, "EmuThread still running, terminating..."); |
| 94 | quit(); | 88 | quit(); |
| 95 | 89 | ||
| 96 | // TODO: Waiting 50 seconds can be necessary if the logging subsystem has a lot of spam | 90 | // TODO: Waiting 50 seconds can be necessary if the logging subsystem has a lot of spam |
| 97 | // queued... This should be fixed. | 91 | // queued... This should be fixed. |
| 98 | wait(50000); | 92 | wait(50000); |
| 99 | if (isRunning()) | 93 | if (isRunning()) { |
| 100 | { | ||
| 101 | LOG_CRITICAL(Frontend, "EmuThread STILL running, something is wrong here..."); | 94 | LOG_CRITICAL(Frontend, "EmuThread STILL running, something is wrong here..."); |
| 102 | terminate(); | 95 | terminate(); |
| 103 | } | 96 | } |
| 104 | } | 97 | } |
| 105 | LOG_INFO(Frontend, "EmuThread stopped"); | 98 | LOG_INFO(Frontend, "EmuThread stopped"); |
| 106 | |||
| 107 | System::Shutdown(); | ||
| 108 | } | 99 | } |
| 109 | 100 | ||
| 110 | 101 | ||