FifoPlayer: Allow changing loop option at runtime

This option has always existed since it's used by FifoCI, but now it can be changed at runtime.  Looping is something that should almost always be on, but it can be useful to turn it off when frame-dumping is enabled so that hundreds of copies of the same frame aren't created.  Before, turning it off required restarting Dolphin.
This commit is contained in:
Pokechu22 2022-01-06 14:47:36 -08:00
parent 575062a612
commit 29df17d422
4 changed files with 15 additions and 3 deletions

View File

@ -163,7 +163,7 @@ void FifoPlaybackAnalyzer::OnCommand(const u8* data, u32 size)
bool IsPlayingBackFifologWithBrokenEFBCopies = false;
FifoPlayer::FifoPlayer() : m_Loop{Config::Get(Config::MAIN_FIFOPLAYER_LOOP_REPLAY)}
FifoPlayer::FifoPlayer()
{
m_config_changed_callback_id = Config::AddConfigChangedCallback([this] { RefreshConfig(); });
RefreshConfig();
@ -303,6 +303,7 @@ std::unique_ptr<CPUCoreBase> FifoPlayer::GetCPUCore()
void FifoPlayer::RefreshConfig()
{
m_Loop = Config::Get(Config::MAIN_FIFOPLAYER_LOOP_REPLAY);
m_EarlyMemoryUpdates = Config::Get(Config::MAIN_FIFOPLAYER_EARLY_MEMORY_UPDATES);
}

View File

@ -172,7 +172,7 @@ private:
void RefreshConfig();
bool m_Loop;
bool m_Loop = true;
// If enabled then all memory updates happen at once before the first frame
bool m_EarlyMemoryUpdates = false;

View File

@ -119,10 +119,12 @@ void FIFOPlayerWindow::CreateWidgets()
auto* playback_group = new QGroupBox(tr("Playback Options"));
auto* playback_layout = new QGridLayout;
m_early_memory_updates = new ToolTipCheckBox(tr("Early Memory Updates"));
m_loop = new ToolTipCheckBox(tr("Loop"));
playback_layout->addWidget(object_range_group, 0, 0);
playback_layout->addWidget(frame_range_group, 0, 1);
playback_layout->addWidget(m_early_memory_updates, 1, 0, 1, -1);
playback_layout->addWidget(m_early_memory_updates, 1, 0);
playback_layout->addWidget(m_loop, 1, 1);
playback_group->setLayout(playback_layout);
// Recording Options
@ -171,6 +173,7 @@ void FIFOPlayerWindow::CreateWidgets()
void FIFOPlayerWindow::LoadSettings()
{
m_early_memory_updates->setChecked(Config::Get(Config::MAIN_FIFOPLAYER_EARLY_MEMORY_UPDATES));
m_loop->setChecked(Config::Get(Config::MAIN_FIFOPLAYER_LOOP_REPLAY));
}
void FIFOPlayerWindow::ConnectWidgets()
@ -181,6 +184,7 @@ void FIFOPlayerWindow::ConnectWidgets()
connect(m_stop, &QPushButton::clicked, this, &FIFOPlayerWindow::StopRecording);
connect(m_button_box, &QDialogButtonBox::rejected, this, &FIFOPlayerWindow::hide);
connect(m_early_memory_updates, &QCheckBox::toggled, this, &FIFOPlayerWindow::OnConfigChanged);
connect(m_loop, &QCheckBox::toggled, this, &FIFOPlayerWindow::OnConfigChanged);
connect(m_frame_range_from, qOverload<int>(&QSpinBox::valueChanged), this,
&FIFOPlayerWindow::OnLimitsChanged);
@ -199,8 +203,13 @@ void FIFOPlayerWindow::AddDescriptions()
"If enabled, then all memory updates happen at once before the first frame.<br><br>"
"Causes issues with many fifologs, but can be useful for testing.<br><br>"
"<dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>");
static const char TR_LOOP_DESCRIPTION[] =
QT_TR_NOOP("If unchecked, then playback of the fifolog stops after the final frame.<br><br>"
"This is generally only useful when a frame-dumping option is enabled.<br><br>"
"<dolphin_emphasis>If unsure, leave this checked.</dolphin_emphasis>");
m_early_memory_updates->SetDescription(tr(TR_MEMORY_UPDATES_DESCRIPTION));
m_loop->SetDescription(tr(TR_LOOP_DESCRIPTION));
}
void FIFOPlayerWindow::LoadRecording()
@ -345,6 +354,7 @@ void FIFOPlayerWindow::OnConfigChanged()
{
Config::SetBase(Config::MAIN_FIFOPLAYER_EARLY_MEMORY_UPDATES,
m_early_memory_updates->isChecked());
Config::SetBase(Config::MAIN_FIFOPLAYER_LOOP_REPLAY, m_loop->isChecked());
}
void FIFOPlayerWindow::OnLimitsChanged()

View File

@ -65,6 +65,7 @@ private:
QSpinBox* m_object_range_to;
QLabel* m_object_range_to_label;
ToolTipCheckBox* m_early_memory_updates;
ToolTipCheckBox* m_loop;
QDialogButtonBox* m_button_box;
QWidget* m_main_widget;