Core: Add a HookableEvent for UICommon::FlushUnsavedData.
This commit is contained in:
@@ -65,6 +65,7 @@
|
|||||||
namespace UICommon
|
namespace UICommon
|
||||||
{
|
{
|
||||||
static Config::ConfigChangedCallbackID s_config_changed_callback_id;
|
static Config::ConfigChangedCallbackID s_config_changed_callback_id;
|
||||||
|
static Common::HookableEvent<> s_flush_unsaved_data_event_hook;
|
||||||
|
|
||||||
static void CreateDumpPath(std::string path)
|
static void CreateDumpPath(std::string path)
|
||||||
{
|
{
|
||||||
@@ -162,9 +163,15 @@ void Shutdown()
|
|||||||
Config::Shutdown();
|
Config::Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] Common::EventHook AddFlushUnsavedDataCallback(std::function<void()> callback)
|
||||||
|
{
|
||||||
|
return s_flush_unsaved_data_event_hook.Register(std::move(callback));
|
||||||
|
}
|
||||||
|
|
||||||
void FlushUnsavedData()
|
void FlushUnsavedData()
|
||||||
{
|
{
|
||||||
INFO_LOG_FMT(CORE, "Flushing unsaved data...");
|
INFO_LOG_FMT(CORE, "Flushing unsaved data...");
|
||||||
|
s_flush_unsaved_data_event_hook.Trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitControllers(const WindowSystemInfo& wsi)
|
void InitControllers(const WindowSystemInfo& wsi)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
#include "Common/HookableEvent.h"
|
||||||
|
|
||||||
struct WindowSystemInfo;
|
struct WindowSystemInfo;
|
||||||
|
|
||||||
@@ -14,6 +15,8 @@ namespace UICommon
|
|||||||
void Init();
|
void Init();
|
||||||
void Shutdown();
|
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 FlushUnsavedData();
|
||||||
|
|
||||||
void InitControllers(const WindowSystemInfo& wsi);
|
void InitControllers(const WindowSystemInfo& wsi);
|
||||||
|
|||||||
Reference in New Issue
Block a user