summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/core.cpp13
-rw-r--r--src/core/core.h12
2 files changed, 25 insertions, 0 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 50d5dab4b..bb268a319 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -421,6 +421,7 @@ struct System::Impl {
421 bool is_async_gpu{}; 421 bool is_async_gpu{};
422 422
423 ExecuteProgramCallback execute_program_callback; 423 ExecuteProgramCallback execute_program_callback;
424 ExitCallback exit_callback;
424 425
425 std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{}; 426 std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{};
426 std::array<MicroProfileToken, Core::Hardware::NUM_CPU_CORES> microprofile_dynarmic{}; 427 std::array<MicroProfileToken, Core::Hardware::NUM_CPU_CORES> microprofile_dynarmic{};
@@ -798,6 +799,18 @@ void System::ExecuteProgram(std::size_t program_index) {
798 } 799 }
799} 800}
800 801
802void System::RegisterExitCallback(ExitCallback&& callback) {
803 impl->exit_callback = std::move(callback);
804}
805
806void System::Exit() {
807 if (impl->exit_callback) {
808 impl->exit_callback();
809 } else {
810 LOG_CRITICAL(Core, "exit_callback must be initialized by the frontend");
811 }
812}
813
801void System::ApplySettings() { 814void System::ApplySettings() {
802 if (IsPoweredOn()) { 815 if (IsPoweredOn()) {
803 Renderer().RefreshBaseSettings(); 816 Renderer().RefreshBaseSettings();
diff --git a/src/core/core.h b/src/core/core.h
index 715ab88e7..a796472b2 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -387,6 +387,18 @@ public:
387 */ 387 */
388 void ExecuteProgram(std::size_t program_index); 388 void ExecuteProgram(std::size_t program_index);
389 389
390 /// Type used for the frontend to designate a callback for System to exit the application.
391 using ExitCallback = std::function<void()>;
392
393 /**
394 * Registers a callback from the frontend for System to exit the application.
395 * @param callback Callback from the frontend to exit the application.
396 */
397 void RegisterExitCallback(ExitCallback&& callback);
398
399 /// Instructs the frontend to exit the application.
400 void Exit();
401
390 /// Applies any changes to settings to this core instance. 402 /// Applies any changes to settings to this core instance.
391 void ApplySettings(); 403 void ApplySettings();
392 404