diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2026-02-03 16:50:52 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-03 16:50:52 -0600 |
| commit | dd2b94cd4a71fb6abda72f58d27434ef2d8b0a5f (patch) | |
| tree | 5355c7878fc942b9b9ed79f2b9ca09923c5a8557 /Source/Core/UICommon | |
| parent | eac7b290423efea867c2c7f3f2b2792d05418bdd (diff) | |
| parent | 2322437f96bc53f1edcd9100daedb5b54c6e0fc4 (diff) | |
Merge pull request #13594 from jordan-woyak/state-cleanups
State: Simplify interthread communication and general cleanups.
Diffstat (limited to 'Source/Core/UICommon')
| -rw-r--r-- | Source/Core/UICommon/UICommon.cpp | 12 | ||||
| -rw-r--r-- | Source/Core/UICommon/UICommon.h | 5 |
2 files changed, 17 insertions, 0 deletions
diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp index 986177a5d2..43973a02e0 100644 --- a/Source/Core/UICommon/UICommon.cpp +++ b/Source/Core/UICommon/UICommon.cpp @@ -60,6 +60,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) { @@ -157,6 +158,17 @@ 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) { if (g_controller_interface.IsInit()) diff --git a/Source/Core/UICommon/UICommon.h b/Source/Core/UICommon/UICommon.h index f23a0005c7..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,10 @@ 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); void ShutdownControllers(); |
