diff --git a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp index e8438f3002..3bf070acb5 100644 --- a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp +++ b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp @@ -168,6 +168,17 @@ std::unique_ptr FifoPlayer::GetCPUCore() return std::make_unique(this); } +void FifoPlayer::SetFileLoadedCallback(CallbackFunc callback) +{ + m_FileLoadedCb = std::move(callback); + + // Trigger the callback immediatly if the file is already loaded. + if (GetFile() != nullptr) + { + m_FileLoadedCb(); + } +} + bool FifoPlayer::IsRunningWithFakeVideoInterfaceUpdates() const { if (!m_File || m_File->GetFrameCount() == 0) diff --git a/Source/Core/Core/FifoPlayer/FifoPlayer.h b/Source/Core/Core/FifoPlayer/FifoPlayer.h index 48b6b5db7d..bb36795d47 100644 --- a/Source/Core/Core/FifoPlayer/FifoPlayer.h +++ b/Source/Core/Core/FifoPlayer/FifoPlayer.h @@ -93,8 +93,8 @@ public: // Default is disabled void SetEarlyMemoryUpdates(bool enabled) { m_EarlyMemoryUpdates = enabled; } // Callbacks - void SetFileLoadedCallback(CallbackFunc callback) { m_FileLoadedCb = callback; } - void SetFrameWrittenCallback(CallbackFunc callback) { m_FrameWrittenCb = callback; } + void SetFileLoadedCallback(CallbackFunc callback); + void SetFrameWrittenCallback(CallbackFunc callback) { m_FrameWrittenCb = std::move(callback); } static FifoPlayer& GetInstance(); bool IsRunningWithFakeVideoInterfaceUpdates() const;