Core: Add a HookableEvent for UICommon::FlushUnsavedData.

This commit is contained in:
Jordan Woyak
2026-01-19 21:56:09 -06:00
parent 0ba32f7add
commit b0652925fa
2 changed files with 10 additions and 0 deletions
+7
View File
@@ -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)
+3
View File
@@ -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);