FifoPlayer: Move instance to System.

This commit is contained in:
Admiral H. Curtiss committed 2024-01-05 20:15:18 +01:00
1 parent 2f7f7afe6d
commit fc2ec826d4
13 files changed
+76 -56

No files matched your search

+3 -9
View File
@@ -172,7 +172,7 @@ void FifoPlaybackAnalyzer::OnCommand(const u8* data, u32 size)
bool IsPlayingBackFifologWithBrokenEFBCopies = false;
FifoPlayer::FifoPlayer()
FifoPlayer::FifoPlayer(Core::System& system) : m_system(system)
{
m_config_changed_callback_id = Config::AddConfigChangedCallback([this] { RefreshConfig(); });
RefreshConfig();
@@ -401,12 +401,6 @@ void FifoPlayer::SetFrameRangeEnd(u32 end)
}
}
FifoPlayer& FifoPlayer::GetInstance()
{
static FifoPlayer instance;
return instance;
}
void FifoPlayer::WriteFrame(const FifoFrameInfo& frame, const AnalyzedFrameInfo& info)
{
// Core timing information
@@ -821,14 +815,14 @@ bool FifoPlayer::ShouldLoadXF(u8 reg)
(address >= XFMEM_UNKNOWN_GROUP_3_START && address <= XFMEM_UNKNOWN_GROUP_3_END));
}
bool FifoPlayer::IsIdleSet()
bool FifoPlayer::IsIdleSet() const
{
CommandProcessor::UCPStatusReg status =
Core::System::GetInstance().GetMMU().Read_U16(0xCC000000 | CommandProcessor::STATUS_REGISTER);
return status.CommandIdle;
}
bool FifoPlayer::IsHighWatermarkSet()
bool FifoPlayer::IsHighWatermarkSet() const
{
CommandProcessor::UCPStatusReg status =
Core::System::GetInstance().GetMMU().Read_U16(0xCC000000 | CommandProcessor::STATUS_REGISTER);
+13 -4
View File
@@ -19,6 +19,10 @@
class FifoDataFile;
struct MemoryUpdate;
namespace Core
{
class System;
}
namespace CPU
{
enum class State;
@@ -91,6 +95,11 @@ class FifoPlayer
public:
using CallbackFunc = std::function<void()>;
explicit FifoPlayer(Core::System& system);
FifoPlayer(const FifoPlayer&) = delete;
FifoPlayer(FifoPlayer&&) = delete;
FifoPlayer& operator=(const FifoPlayer&) = delete;
FifoPlayer& operator=(FifoPlayer&&) = delete;
~FifoPlayer();
bool Open(const std::string& filename);
@@ -127,13 +136,11 @@ public:
// Callbacks
void SetFileLoadedCallback(CallbackFunc callback);
void SetFrameWrittenCallback(CallbackFunc callback) { m_FrameWrittenCb = std::move(callback); }
static FifoPlayer& GetInstance();
bool IsRunningWithFakeVideoInterfaceUpdates() const;
private:
class CPUCore;
FifoPlayer();
CPU::State AdvanceFrame();
@@ -168,11 +175,13 @@ private:
bool ShouldLoadBP(u8 address);
bool ShouldLoadXF(u8 address);
static bool IsIdleSet();
static bool IsHighWatermarkSet();
bool IsIdleSet() const;
bool IsHighWatermarkSet() const;
void RefreshConfig();
Core::System& m_system;
bool m_Loop = true;
// If enabled then all memory updates happen at once before the first frame
bool m_EarlyMemoryUpdates = false;