aboutsummaryrefslogtreecommitdiff
path: root/src/core/core.cpp
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2021-09-25 23:14:49 -0400
committerMorph <39850852+Morph1984@users.noreply.github.com>2021-10-01 23:39:54 -0400
commitd8467ca6c0eff0ea0fc619043893abb0a2cebf9f (patch)
treea41258ebddf8f93e8e3c3259157584af1ac0781f /src/core/core.cpp
parent3a33519598063175fb7c16c67e32784ed97d5017 (diff)
core: Add Exit and ExitCallback
This allows ISelfController::Exit to stop the currently running application. This is typically used by homebrew to exit back to the homebrew menu after calling consoleExit with libnx.
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r--src/core/core.cpp13
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();