mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-04-30 16:01:09 -04:00
Common: Make HookableEvent use non-static data.
Co-authored-by: Dentomologist <dentomologist@gmail.com>
This commit is contained in:
@@ -38,6 +38,7 @@ VideoConfig g_ActiveConfig;
|
||||
BackendInfo g_backend_info;
|
||||
static std::optional<CPUThreadConfigCallback::ConfigChangedCallbackID>
|
||||
s_config_changed_callback_id = std::nullopt;
|
||||
static Common::EventHook s_check_config_event;
|
||||
|
||||
static bool IsVSyncActive(bool enabled)
|
||||
{
|
||||
@@ -218,8 +219,16 @@ void VideoConfig::VerifyValidity()
|
||||
}
|
||||
}
|
||||
|
||||
void VideoConfig::Init()
|
||||
{
|
||||
s_check_config_event = GetVideoEvents().after_frame_event.Register(
|
||||
[](Core::System&) { CheckForConfigChanges(); }, "CheckForConfigChanges");
|
||||
}
|
||||
|
||||
void VideoConfig::Shutdown()
|
||||
{
|
||||
s_check_config_event.reset();
|
||||
|
||||
if (!s_config_changed_callback_id.has_value())
|
||||
return;
|
||||
|
||||
@@ -390,10 +399,7 @@ void CheckForConfigChanges()
|
||||
}
|
||||
|
||||
// Notify all listeners
|
||||
ConfigChangedEvent::Trigger(changed_bits);
|
||||
GetVideoEvents().config_changed_event.Trigger(changed_bits);
|
||||
|
||||
// TODO: Move everything else to the ConfigChanged event
|
||||
}
|
||||
|
||||
static Common::EventHook s_check_config_event = AfterFrameEvent::Register(
|
||||
[](Core::System&) { CheckForConfigChanges(); }, "CheckForConfigChanges");
|
||||
|
||||
Reference in New Issue
Block a user