diff options
author | bunnei <bunneidev@gmail.com> | 2015-09-14 21:23:08 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-09-14 21:23:08 +0200 |
commit | d6e56b8c88b46f4f85f44b26bff00422e31a6e57 (patch) | |
tree | f476fa88654be86b6d768bfee9b29d5875a17f63 | |
parent | Merge pull request #1152 from lioncash/nullptr (diff) | |
parent | Stop emulation when render window is closed (diff) | |
download | yuzu-d6e56b8c88b46f4f85f44b26bff00422e31a6e57.tar yuzu-d6e56b8c88b46f4f85f44b26bff00422e31a6e57.tar.gz yuzu-d6e56b8c88b46f4f85f44b26bff00422e31a6e57.tar.bz2 yuzu-d6e56b8c88b46f4f85f44b26bff00422e31a6e57.tar.lz yuzu-d6e56b8c88b46f4f85f44b26bff00422e31a6e57.tar.xz yuzu-d6e56b8c88b46f4f85f44b26bff00422e31a6e57.tar.zst yuzu-d6e56b8c88b46f4f85f44b26bff00422e31a6e57.zip |
Diffstat (limited to '')
-rw-r--r-- | src/citra_qt/bootmanager.cpp | 5 | ||||
-rw-r--r-- | src/citra_qt/bootmanager.h | 6 | ||||
-rw-r--r-- | src/citra_qt/main.cpp | 4 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 610707411..7a1360d34 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -219,6 +219,11 @@ QByteArray GRenderWindow::saveGeometry() return geometry; } +void GRenderWindow::closeEvent(QCloseEvent* event) { + emit Closed(); + QWidget::closeEvent(event); +} + void GRenderWindow::keyPressEvent(QKeyEvent* event) { this->KeyPressed({event->key(), keyboard_id}); diff --git a/src/citra_qt/bootmanager.h b/src/citra_qt/bootmanager.h index 5b52a0a58..dc422358e 100644 --- a/src/citra_qt/bootmanager.h +++ b/src/citra_qt/bootmanager.h @@ -110,6 +110,8 @@ public: void restoreGeometry(const QByteArray& geometry); // overridden QByteArray saveGeometry(); // overridden + void closeEvent(QCloseEvent* event) override; + void keyPressEvent(QKeyEvent* event) override; void keyReleaseEvent(QKeyEvent* event) override; @@ -129,6 +131,10 @@ public slots: void OnEmulationStarting(EmuThread* emu_thread); void OnEmulationStopping(); +signals: + /// Emitted when the window is closed + void Closed(); + private: void OnMinimalClientAreaChangeRequest(const std::pair<unsigned,unsigned>& minimal_size) override; diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index d2c7459a4..01841b33c 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -252,6 +252,7 @@ void GMainWindow::BootGame(const std::string& filename) { render_window->moveContext(); emu_thread->start(); + connect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame())); // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues connect(emu_thread.get(), SIGNAL(DebugModeEntered()), disasmWidget, SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection); connect(emu_thread.get(), SIGNAL(DebugModeEntered()), registersWidget, SLOT(OnDebugModeEntered()), Qt::BlockingQueuedConnection); @@ -284,6 +285,9 @@ void GMainWindow::ShutdownGame() { emu_thread->wait(); emu_thread = nullptr; + // The emulation is stopped, so closing the window or not does not matter anymore + disconnect(render_window, SIGNAL(Closed()), this, SLOT(OnStopGame())); + // Update the GUI ui.action_Start->setEnabled(false); ui.action_Start->setText(tr("Start")); |