From 46f4f69cfd62231f37b7924070a98c5d3ff4b282 Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Mon, 9 Sep 2019 09:50:47 +1200 Subject: [PATCH] QtFifoPlayer: handle fifo load before window creation Fixes a bug where if you loaded a fifo before opening the fifo player window (which you can do by dragging a .dff onto dolphin's main window) then the player's widgets wouldn't be initilized correctly. Importantly, the object range widgets would be broken. --- Source/Core/Core/FifoPlayer/FifoPlayer.cpp | 11 +++++++++++ Source/Core/Core/FifoPlayer/FifoPlayer.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp index e8438f3002..5fcb2acda3 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 = 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..1b22eb2849 100644 --- a/Source/Core/Core/FifoPlayer/FifoPlayer.h +++ b/Source/Core/Core/FifoPlayer/FifoPlayer.h @@ -93,7 +93,7 @@ public: // Default is disabled void SetEarlyMemoryUpdates(bool enabled) { m_EarlyMemoryUpdates = enabled; } // Callbacks - void SetFileLoadedCallback(CallbackFunc callback) { m_FileLoadedCb = callback; } + void SetFileLoadedCallback(CallbackFunc callback); void SetFrameWrittenCallback(CallbackFunc callback) { m_FrameWrittenCb = callback; } static FifoPlayer& GetInstance();