summaryrefslogtreecommitdiff
path: root/Source/Core/UICommon
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2025-04-26 17:18:56 -0500
committerJordan Woyak <jordan.woyak@gmail.com>2026-01-19 21:56:09 -0600
commitb0652925faa54b9bfd5a17cfed8870a2b1f2759b (patch)
tree20229c7e3b6735332e4f0938d442c76c720b186c /Source/Core/UICommon
parent0ba32f7add97daf1c5ea52cf77b75e81d862676f (diff)
Core: Add a HookableEvent for UICommon::FlushUnsavedData.
Diffstat (limited to 'Source/Core/UICommon')
-rw-r--r--Source/Core/UICommon/UICommon.cpp7
-rw-r--r--Source/Core/UICommon/UICommon.h3
2 files changed, 10 insertions, 0 deletions
diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp
index 8fe882b9ad..7d3835398f 100644
--- a/Source/Core/UICommon/UICommon.cpp
+++ b/Source/Core/UICommon/UICommon.cpp
@@ -65,6 +65,7 @@
namespace UICommon
{
static Config::ConfigChangedCallbackID s_config_changed_callback_id;
+static Common::HookableEvent<> s_flush_unsaved_data_event_hook;
static void CreateDumpPath(std::string path)
{
@@ -162,9 +163,15 @@ void Shutdown()
Config::Shutdown();
}
+[[nodiscard]] Common::EventHook AddFlushUnsavedDataCallback(std::function<void()> callback)
+{
+ return s_flush_unsaved_data_event_hook.Register(std::move(callback));
+}
+
void FlushUnsavedData()
{
INFO_LOG_FMT(CORE, "Flushing unsaved data...");
+ s_flush_unsaved_data_event_hook.Trigger();
}
void InitControllers(const WindowSystemInfo& wsi)
diff --git a/Source/Core/UICommon/UICommon.h b/Source/Core/UICommon/UICommon.h
index e586283816..991f584089 100644
--- a/Source/Core/UICommon/UICommon.h
+++ b/Source/Core/UICommon/UICommon.h
@@ -6,6 +6,7 @@
#include <string>
#include "Common/CommonTypes.h"
+#include "Common/HookableEvent.h"
struct WindowSystemInfo;
@@ -14,6 +15,8 @@ namespace UICommon
void Init();
void Shutdown();
+// Triggered from the Host-thread on Android before a potential process termination.
+[[nodiscard]] Common::EventHook AddFlushUnsavedDataCallback(std::function<void()> callback);
void FlushUnsavedData();
void InitControllers(const WindowSystemInfo& wsi);