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/core/core.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/core/core.cpp')
-rw-r--r-- | src/core/core.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 50d5dab4ba..bb268a3197 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -421,6 +421,7 @@ struct System::Impl { bool is_async_gpu{}; ExecuteProgramCallback execute_program_callback; + ExitCallback exit_callback; std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{}; std::array<MicroProfileToken, Core::Hardware::NUM_CPU_CORES> microprofile_dynarmic{}; @@ -798,6 +799,18 @@ void System::ExecuteProgram(std::size_t program_index) { } } +void System::RegisterExitCallback(ExitCallback&& callback) { + impl->exit_callback = std::move(callback); +} + +void System::Exit() { + if (impl->exit_callback) { + impl->exit_callback(); + } else { + LOG_CRITICAL(Core, "exit_callback must be initialized by the frontend"); + } +} + void System::ApplySettings() { if (IsPoweredOn()) { Renderer().RefreshBaseSettings(); |