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.
This commit is contained in:
Scott Mansell 2019-09-09 09:50:47 +12:00
parent 828dc0f204
commit 46f4f69cfd
2 changed files with 12 additions and 1 deletions

View File

@ -168,6 +168,17 @@ std::unique_ptr<CPUCoreBase> FifoPlayer::GetCPUCore()
return std::make_unique<CPUCore>(this); return std::make_unique<CPUCore>(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 bool FifoPlayer::IsRunningWithFakeVideoInterfaceUpdates() const
{ {
if (!m_File || m_File->GetFrameCount() == 0) if (!m_File || m_File->GetFrameCount() == 0)

View File

@ -93,7 +93,7 @@ public:
// Default is disabled // Default is disabled
void SetEarlyMemoryUpdates(bool enabled) { m_EarlyMemoryUpdates = enabled; } void SetEarlyMemoryUpdates(bool enabled) { m_EarlyMemoryUpdates = enabled; }
// Callbacks // Callbacks
void SetFileLoadedCallback(CallbackFunc callback) { m_FileLoadedCb = callback; } void SetFileLoadedCallback(CallbackFunc callback);
void SetFrameWrittenCallback(CallbackFunc callback) { m_FrameWrittenCb = callback; } void SetFrameWrittenCallback(CallbackFunc callback) { m_FrameWrittenCb = callback; }
static FifoPlayer& GetInstance(); static FifoPlayer& GetInstance();