diff options
author | bunnei <bunneidev@gmail.com> | 2021-10-02 01:06:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-02 01:06:48 -0700 |
commit | ae3e51c795ea72dd1eaea64d44b94afab7d74007 (patch) | |
tree | 89860f4f5df991336bab7332a77e76bb58e1047f /src/yuzu/main.cpp | |
parent | 3a33519598063175fb7c16c67e32784ed97d5017 (diff) | |
parent | 2f5808b7ffd168e1ab3ac7e453f8936098350e58 (diff) |
Merge pull request #7093 from Morph1984/exit
core: Properly shutdown and exit the running application when ISelfController::Exit is called
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r-- | src/yuzu/main.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 3c2824362..0bd0c5b04 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1384,6 +1384,9 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t system.RegisterExecuteProgramCallback( [this](std::size_t program_index) { render_window->ExecuteProgram(program_index); }); + // Register an Exit callback such that Core can exit the currently running application. + system.RegisterExitCallback([this]() { render_window->Exit(); }); + connect(render_window, &GRenderWindow::Closed, this, &GMainWindow::OnStopGame); connect(render_window, &GRenderWindow::MouseActivity, this, &GMainWindow::OnMouseActivity); // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views @@ -2469,6 +2472,10 @@ void GMainWindow::OnExecuteProgram(std::size_t program_index) { BootGame(last_filename_booted, 0, program_index); } +void GMainWindow::OnExit() { + OnStopGame(); +} + void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) { OverlayDialog dialog(render_window, Core::System::GetInstance(), error_code, error_text, QString{}, tr("OK"), Qt::AlignLeft | Qt::AlignVCenter); |