FifoPlayer: Store early memory updates option in the config
Now, early memory updates is persisted across runs, and can be toggled before starting a fifolog.
This commit is contained in:
parent
193ca92cb8
commit
575062a612
|
@ -354,6 +354,8 @@ const Info<bool> MAIN_GAMELIST_COLUMN_TAGS{{System::Main, "GameList", "ColumnTag
|
||||||
// Main.FifoPlayer
|
// Main.FifoPlayer
|
||||||
|
|
||||||
const Info<bool> MAIN_FIFOPLAYER_LOOP_REPLAY{{System::Main, "FifoPlayer", "LoopReplay"}, true};
|
const Info<bool> MAIN_FIFOPLAYER_LOOP_REPLAY{{System::Main, "FifoPlayer", "LoopReplay"}, true};
|
||||||
|
const Info<bool> MAIN_FIFOPLAYER_EARLY_MEMORY_UPDATES{
|
||||||
|
{System::Main, "FifoPlayer", "EarlyMemoryUpdates"}, false};
|
||||||
|
|
||||||
// Main.AutoUpdate
|
// Main.AutoUpdate
|
||||||
|
|
||||||
|
|
|
@ -254,6 +254,7 @@ extern const Info<bool> MAIN_GAMELIST_COLUMN_TAGS;
|
||||||
// Main.FifoPlayer
|
// Main.FifoPlayer
|
||||||
|
|
||||||
extern const Info<bool> MAIN_FIFOPLAYER_LOOP_REPLAY;
|
extern const Info<bool> MAIN_FIFOPLAYER_LOOP_REPLAY;
|
||||||
|
extern const Info<bool> MAIN_FIFOPLAYER_EARLY_MEMORY_UPDATES;
|
||||||
|
|
||||||
// Main.AutoUpdate
|
// Main.AutoUpdate
|
||||||
|
|
||||||
|
|
|
@ -165,10 +165,13 @@ bool IsPlayingBackFifologWithBrokenEFBCopies = false;
|
||||||
|
|
||||||
FifoPlayer::FifoPlayer() : m_Loop{Config::Get(Config::MAIN_FIFOPLAYER_LOOP_REPLAY)}
|
FifoPlayer::FifoPlayer() : m_Loop{Config::Get(Config::MAIN_FIFOPLAYER_LOOP_REPLAY)}
|
||||||
{
|
{
|
||||||
|
m_config_changed_callback_id = Config::AddConfigChangedCallback([this] { RefreshConfig(); });
|
||||||
|
RefreshConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
FifoPlayer::~FifoPlayer()
|
FifoPlayer::~FifoPlayer()
|
||||||
{
|
{
|
||||||
|
Config::RemoveConfigChangedCallback(m_config_changed_callback_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FifoPlayer::Open(const std::string& filename)
|
bool FifoPlayer::Open(const std::string& filename)
|
||||||
|
@ -298,6 +301,11 @@ std::unique_ptr<CPUCoreBase> FifoPlayer::GetCPUCore()
|
||||||
return std::make_unique<CPUCore>(this);
|
return std::make_unique<CPUCore>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FifoPlayer::RefreshConfig()
|
||||||
|
{
|
||||||
|
m_EarlyMemoryUpdates = Config::Get(Config::MAIN_FIFOPLAYER_EARLY_MEMORY_UPDATES);
|
||||||
|
}
|
||||||
|
|
||||||
void FifoPlayer::SetFileLoadedCallback(CallbackFunc callback)
|
void FifoPlayer::SetFileLoadedCallback(CallbackFunc callback)
|
||||||
{
|
{
|
||||||
m_FileLoadedCb = std::move(callback);
|
m_FileLoadedCb = std::move(callback);
|
||||||
|
|
|
@ -122,9 +122,7 @@ public:
|
||||||
void SetObjectRangeStart(u32 start) { m_ObjectRangeStart = start; }
|
void SetObjectRangeStart(u32 start) { m_ObjectRangeStart = start; }
|
||||||
u32 GetObjectRangeEnd() const { return m_ObjectRangeEnd; }
|
u32 GetObjectRangeEnd() const { return m_ObjectRangeEnd; }
|
||||||
void SetObjectRangeEnd(u32 end) { m_ObjectRangeEnd = end; }
|
void SetObjectRangeEnd(u32 end) { m_ObjectRangeEnd = end; }
|
||||||
// If enabled then all memory updates happen at once before the first frame
|
|
||||||
// Default is disabled
|
|
||||||
void SetEarlyMemoryUpdates(bool enabled) { m_EarlyMemoryUpdates = enabled; }
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
void SetFileLoadedCallback(CallbackFunc callback);
|
void SetFileLoadedCallback(CallbackFunc callback);
|
||||||
void SetFrameWrittenCallback(CallbackFunc callback) { m_FrameWrittenCb = std::move(callback); }
|
void SetFrameWrittenCallback(CallbackFunc callback) { m_FrameWrittenCb = std::move(callback); }
|
||||||
|
@ -172,7 +170,11 @@ private:
|
||||||
static bool IsIdleSet();
|
static bool IsIdleSet();
|
||||||
static bool IsHighWatermarkSet();
|
static bool IsHighWatermarkSet();
|
||||||
|
|
||||||
|
void RefreshConfig();
|
||||||
|
|
||||||
bool m_Loop;
|
bool m_Loop;
|
||||||
|
// If enabled then all memory updates happen at once before the first frame
|
||||||
|
bool m_EarlyMemoryUpdates = false;
|
||||||
|
|
||||||
u32 m_CurrentFrame = 0;
|
u32 m_CurrentFrame = 0;
|
||||||
u32 m_FrameRangeStart = 0;
|
u32 m_FrameRangeStart = 0;
|
||||||
|
@ -181,14 +183,13 @@ private:
|
||||||
u32 m_ObjectRangeStart = 0;
|
u32 m_ObjectRangeStart = 0;
|
||||||
u32 m_ObjectRangeEnd = 10000;
|
u32 m_ObjectRangeEnd = 10000;
|
||||||
|
|
||||||
bool m_EarlyMemoryUpdates = false;
|
|
||||||
|
|
||||||
u64 m_CyclesPerFrame = 0;
|
u64 m_CyclesPerFrame = 0;
|
||||||
u32 m_ElapsedCycles = 0;
|
u32 m_ElapsedCycles = 0;
|
||||||
u32 m_FrameFifoSize = 0;
|
u32 m_FrameFifoSize = 0;
|
||||||
|
|
||||||
CallbackFunc m_FileLoadedCb = nullptr;
|
CallbackFunc m_FileLoadedCb = nullptr;
|
||||||
CallbackFunc m_FrameWrittenCb = nullptr;
|
CallbackFunc m_FrameWrittenCb = nullptr;
|
||||||
|
size_t m_config_changed_callback_id;
|
||||||
|
|
||||||
std::unique_ptr<FifoDataFile> m_File;
|
std::unique_ptr<FifoDataFile> m_File;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "Core/FifoPlayer/FifoPlayer.h"
|
#include "Core/FifoPlayer/FifoPlayer.h"
|
||||||
#include "Core/FifoPlayer/FifoRecorder.h"
|
#include "Core/FifoPlayer/FifoRecorder.h"
|
||||||
|
|
||||||
|
#include "DolphinQt/Config/ToolTipControls/ToolTipCheckBox.h"
|
||||||
#include "DolphinQt/FIFO/FIFOAnalyzer.h"
|
#include "DolphinQt/FIFO/FIFOAnalyzer.h"
|
||||||
#include "DolphinQt/QtUtils/DolphinFileDialog.h"
|
#include "DolphinQt/QtUtils/DolphinFileDialog.h"
|
||||||
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
#include "DolphinQt/QtUtils/ModalMessageBox.h"
|
||||||
|
@ -38,6 +39,7 @@ FIFOPlayerWindow::FIFOPlayerWindow(QWidget* parent) : QWidget(parent)
|
||||||
|
|
||||||
CreateWidgets();
|
CreateWidgets();
|
||||||
ConnectWidgets();
|
ConnectWidgets();
|
||||||
|
AddDescriptions();
|
||||||
|
|
||||||
UpdateInfo();
|
UpdateInfo();
|
||||||
|
|
||||||
|
@ -116,7 +118,7 @@ void FIFOPlayerWindow::CreateWidgets()
|
||||||
// Playback Options
|
// Playback Options
|
||||||
auto* playback_group = new QGroupBox(tr("Playback Options"));
|
auto* playback_group = new QGroupBox(tr("Playback Options"));
|
||||||
auto* playback_layout = new QGridLayout;
|
auto* playback_layout = new QGridLayout;
|
||||||
m_early_memory_updates = new QCheckBox(tr("Early Memory Updates"));
|
m_early_memory_updates = new ToolTipCheckBox(tr("Early Memory Updates"));
|
||||||
|
|
||||||
playback_layout->addWidget(object_range_group, 0, 0);
|
playback_layout->addWidget(object_range_group, 0, 0);
|
||||||
playback_layout->addWidget(frame_range_group, 0, 1);
|
playback_layout->addWidget(frame_range_group, 0, 1);
|
||||||
|
@ -166,6 +168,11 @@ void FIFOPlayerWindow::CreateWidgets()
|
||||||
setLayout(tab_layout);
|
setLayout(tab_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FIFOPlayerWindow::LoadSettings()
|
||||||
|
{
|
||||||
|
m_early_memory_updates->setChecked(Config::Get(Config::MAIN_FIFOPLAYER_EARLY_MEMORY_UPDATES));
|
||||||
|
}
|
||||||
|
|
||||||
void FIFOPlayerWindow::ConnectWidgets()
|
void FIFOPlayerWindow::ConnectWidgets()
|
||||||
{
|
{
|
||||||
connect(m_load, &QPushButton::clicked, this, &FIFOPlayerWindow::LoadRecording);
|
connect(m_load, &QPushButton::clicked, this, &FIFOPlayerWindow::LoadRecording);
|
||||||
|
@ -173,8 +180,8 @@ void FIFOPlayerWindow::ConnectWidgets()
|
||||||
connect(m_record, &QPushButton::clicked, this, &FIFOPlayerWindow::StartRecording);
|
connect(m_record, &QPushButton::clicked, this, &FIFOPlayerWindow::StartRecording);
|
||||||
connect(m_stop, &QPushButton::clicked, this, &FIFOPlayerWindow::StopRecording);
|
connect(m_stop, &QPushButton::clicked, this, &FIFOPlayerWindow::StopRecording);
|
||||||
connect(m_button_box, &QDialogButtonBox::rejected, this, &FIFOPlayerWindow::hide);
|
connect(m_button_box, &QDialogButtonBox::rejected, this, &FIFOPlayerWindow::hide);
|
||||||
connect(m_early_memory_updates, &QCheckBox::toggled, this,
|
connect(m_early_memory_updates, &QCheckBox::toggled, this, &FIFOPlayerWindow::OnConfigChanged);
|
||||||
&FIFOPlayerWindow::OnEarlyMemoryUpdatesChanged);
|
|
||||||
connect(m_frame_range_from, qOverload<int>(&QSpinBox::valueChanged), this,
|
connect(m_frame_range_from, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||||
&FIFOPlayerWindow::OnLimitsChanged);
|
&FIFOPlayerWindow::OnLimitsChanged);
|
||||||
connect(m_frame_range_to, qOverload<int>(&QSpinBox::valueChanged), this,
|
connect(m_frame_range_to, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||||
|
@ -186,6 +193,16 @@ void FIFOPlayerWindow::ConnectWidgets()
|
||||||
&FIFOPlayerWindow::OnLimitsChanged);
|
&FIFOPlayerWindow::OnLimitsChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FIFOPlayerWindow::AddDescriptions()
|
||||||
|
{
|
||||||
|
static const char TR_MEMORY_UPDATES_DESCRIPTION[] = QT_TR_NOOP(
|
||||||
|
"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>");
|
||||||
|
|
||||||
|
m_early_memory_updates->SetDescription(tr(TR_MEMORY_UPDATES_DESCRIPTION));
|
||||||
|
}
|
||||||
|
|
||||||
void FIFOPlayerWindow::LoadRecording()
|
void FIFOPlayerWindow::LoadRecording()
|
||||||
{
|
{
|
||||||
QString path = DolphinFileDialog::getOpenFileName(this, tr("Open FIFO log"), QString(),
|
QString path = DolphinFileDialog::getOpenFileName(this, tr("Open FIFO log"), QString(),
|
||||||
|
@ -324,9 +341,10 @@ void FIFOPlayerWindow::OnFIFOLoaded()
|
||||||
m_analyzer->Update();
|
m_analyzer->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FIFOPlayerWindow::OnEarlyMemoryUpdatesChanged(bool enabled)
|
void FIFOPlayerWindow::OnConfigChanged()
|
||||||
{
|
{
|
||||||
FifoPlayer::GetInstance().SetEarlyMemoryUpdates(enabled);
|
Config::SetBase(Config::MAIN_FIFOPLAYER_EARLY_MEMORY_UPDATES,
|
||||||
|
m_early_memory_updates->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FIFOPlayerWindow::OnLimitsChanged()
|
void FIFOPlayerWindow::OnLimitsChanged()
|
||||||
|
@ -363,8 +381,6 @@ void FIFOPlayerWindow::UpdateControls()
|
||||||
m_object_range_to->setEnabled(is_playing);
|
m_object_range_to->setEnabled(is_playing);
|
||||||
m_object_range_to_label->setEnabled(is_playing);
|
m_object_range_to_label->setEnabled(is_playing);
|
||||||
|
|
||||||
m_early_memory_updates->setEnabled(is_playing);
|
|
||||||
|
|
||||||
bool enable_frame_record_count = !is_playing && !is_recording;
|
bool enable_frame_record_count = !is_playing && !is_recording;
|
||||||
|
|
||||||
m_frame_record_count_label->setEnabled(enable_frame_record_count);
|
m_frame_record_count_label->setEnabled(enable_frame_record_count);
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
|
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
|
|
||||||
class QCheckBox;
|
|
||||||
class QDialogButtonBox;
|
class QDialogButtonBox;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class QSpinBox;
|
class QSpinBox;
|
||||||
class QTabWidget;
|
class QTabWidget;
|
||||||
|
class ToolTipCheckBox;
|
||||||
class FIFOAnalyzer;
|
class FIFOAnalyzer;
|
||||||
|
|
||||||
class FIFOPlayerWindow : public QWidget
|
class FIFOPlayerWindow : public QWidget
|
||||||
|
@ -27,7 +27,9 @@ signals:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateWidgets();
|
void CreateWidgets();
|
||||||
|
void LoadSettings();
|
||||||
void ConnectWidgets();
|
void ConnectWidgets();
|
||||||
|
void AddDescriptions();
|
||||||
|
|
||||||
void LoadRecording();
|
void LoadRecording();
|
||||||
void SaveRecording();
|
void SaveRecording();
|
||||||
|
@ -37,9 +39,9 @@ private:
|
||||||
void OnEmulationStarted();
|
void OnEmulationStarted();
|
||||||
void OnEmulationStopped();
|
void OnEmulationStopped();
|
||||||
void OnLimitsChanged();
|
void OnLimitsChanged();
|
||||||
void OnEarlyMemoryUpdatesChanged(bool enabled);
|
|
||||||
void OnRecordingDone();
|
void OnRecordingDone();
|
||||||
void OnFIFOLoaded();
|
void OnFIFOLoaded();
|
||||||
|
void OnConfigChanged();
|
||||||
|
|
||||||
void UpdateControls();
|
void UpdateControls();
|
||||||
void UpdateInfo();
|
void UpdateInfo();
|
||||||
|
@ -62,7 +64,7 @@ private:
|
||||||
QLabel* m_object_range_from_label;
|
QLabel* m_object_range_from_label;
|
||||||
QSpinBox* m_object_range_to;
|
QSpinBox* m_object_range_to;
|
||||||
QLabel* m_object_range_to_label;
|
QLabel* m_object_range_to_label;
|
||||||
QCheckBox* m_early_memory_updates;
|
ToolTipCheckBox* m_early_memory_updates;
|
||||||
QDialogButtonBox* m_button_box;
|
QDialogButtonBox* m_button_box;
|
||||||
|
|
||||||
QWidget* m_main_widget;
|
QWidget* m_main_widget;
|
||||||
|
|
Loading…
Reference in New Issue