Merge pull request #4077 from lioncash/const
FifoPlayer: const correctness
This commit is contained in:
commit
84c936cab8
|
@ -145,7 +145,7 @@ std::unique_ptr<CPUCoreBase> FifoPlayer::GetCPUCore()
|
|||
return std::make_unique<CPUCore>(this);
|
||||
}
|
||||
|
||||
u32 FifoPlayer::GetFrameObjectCount()
|
||||
u32 FifoPlayer::GetFrameObjectCount() const
|
||||
{
|
||||
if (m_CurrentFrame < m_FrameInfo.size())
|
||||
{
|
||||
|
@ -413,7 +413,7 @@ void FifoPlayer::LoadMemory()
|
|||
|
||||
SetupFifo();
|
||||
|
||||
u32* regs = m_File->GetBPMem();
|
||||
const u32* regs = m_File->GetBPMem();
|
||||
for (int i = 0; i < FifoDataFile::BP_MEM_SIZE; ++i)
|
||||
{
|
||||
if (ShouldLoadBP(i))
|
||||
|
@ -494,7 +494,7 @@ void FifoPlayer::LoadXFReg(u16 reg, u32 value)
|
|||
GPFifo::Write32(value);
|
||||
}
|
||||
|
||||
void FifoPlayer::LoadXFMem16(u16 address, u32* data)
|
||||
void FifoPlayer::LoadXFMem16(u16 address, const u32* data)
|
||||
{
|
||||
// Loads 16 * 4 bytes in xf memory starting at address
|
||||
GPFifo::Write8(0x10); // load XF reg
|
||||
|
|
|
@ -65,8 +65,8 @@ public:
|
|||
// PowerPC state.
|
||||
std::unique_ptr<CPUCoreBase> GetCPUCore();
|
||||
|
||||
FifoDataFile* GetFile() { return m_File.get(); }
|
||||
u32 GetFrameObjectCount();
|
||||
FifoDataFile* GetFile() const { return m_File.get(); }
|
||||
u32 GetFrameObjectCount() const;
|
||||
u32 GetCurrentFrameNum() const { return m_CurrentFrame; }
|
||||
const AnalyzedFrameInfo& GetAnalyzedFrameInfo(u32 frame) const { return m_FrameInfo[frame]; }
|
||||
// Frame range
|
||||
|
@ -119,7 +119,7 @@ private:
|
|||
void LoadBPReg(u8 reg, u32 value);
|
||||
void LoadCPReg(u8 reg, u32 value);
|
||||
void LoadXFReg(u16 reg, u32 value);
|
||||
void LoadXFMem16(u16 address, u32* data);
|
||||
void LoadXFMem16(u16 address, const u32* data);
|
||||
|
||||
bool ShouldLoadBP(u8 address);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
using namespace FifoAnalyzer;
|
||||
|
||||
void FifoRecordAnalyzer::Initialize(u32* cpMem)
|
||||
void FifoRecordAnalyzer::Initialize(const u32* cpMem)
|
||||
{
|
||||
s_DrawingObject = false;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
namespace FifoRecordAnalyzer
|
||||
{
|
||||
// Must call this before analyzing Fifo commands with FifoAnalyzer::AnalyzeCommand()
|
||||
void Initialize(u32* cpMem);
|
||||
void Initialize(const u32* cpMem);
|
||||
|
||||
void ProcessLoadIndexedXf(u32 val, int array);
|
||||
void WriteVertexArray(int arrayIndex, const u8* vertexData, int vertexSize, int numVertices);
|
||||
|
|
|
@ -59,7 +59,7 @@ void FifoRecorder::StopRecording()
|
|||
m_RequestedRecordingEnd = true;
|
||||
}
|
||||
|
||||
void FifoRecorder::WriteGPCommand(u8* data, u32 size)
|
||||
void FifoRecorder::WriteGPCommand(const u8* data, u32 size)
|
||||
{
|
||||
if (!m_SkipNextData)
|
||||
{
|
||||
|
@ -181,7 +181,8 @@ void FifoRecorder::EndFrame(u32 fifoStart, u32 fifoEnd)
|
|||
}
|
||||
}
|
||||
|
||||
void FifoRecorder::SetVideoMemory(u32* bpMem, u32* cpMem, u32* xfMem, u32* xfRegs, u32 xfRegsSize)
|
||||
void FifoRecorder::SetVideoMemory(const u32* bpMem, const u32* cpMem, const u32* xfMem,
|
||||
const u32* xfRegs, u32 xfRegsSize)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lk(sMutex);
|
||||
|
||||
|
|
|
@ -19,11 +19,11 @@ public:
|
|||
void StartRecording(s32 numFrames, CallbackFunc finishedCb);
|
||||
void StopRecording();
|
||||
|
||||
FifoDataFile* GetRecordedFile() { return m_File; }
|
||||
FifoDataFile* GetRecordedFile() const { return m_File; }
|
||||
// Called from video thread
|
||||
|
||||
// Must write one full GP command at a time
|
||||
void WriteGPCommand(u8* data, u32 size);
|
||||
void WriteGPCommand(const u8* data, u32 size);
|
||||
|
||||
// Track memory that has been used and write it to the fifolog if it has changed.
|
||||
// If memory is updated by the video backend (dynamicUpdate == true) take special care to make
|
||||
|
@ -36,7 +36,8 @@ public:
|
|||
// This function must be called before writing GP commands
|
||||
// bpMem must point to the actual bp mem array used by the plugin because it will be read as fifo
|
||||
// data is recorded
|
||||
void SetVideoMemory(u32* bpMem, u32* cpMem, u32* xfMem, u32* xfRegs, u32 xfRegsSize);
|
||||
void SetVideoMemory(const u32* bpMem, const u32* cpMem, const u32* xfMem, const u32* xfRegs,
|
||||
u32 xfRegsSize);
|
||||
|
||||
// Checked once per frame prior to callng EndFrame()
|
||||
bool IsRecording() const { return m_IsRecording; }
|
||||
|
|
|
@ -597,15 +597,14 @@ void Renderer::CheckFifoRecording()
|
|||
|
||||
void Renderer::RecordVideoMemory()
|
||||
{
|
||||
u32* bpmem_ptr = (u32*)&bpmem;
|
||||
u32 cpmem[256];
|
||||
const u32* bpmem_ptr = reinterpret_cast<const u32*>(&bpmem);
|
||||
u32 cpmem[256] = {};
|
||||
// The FIFO recording format splits XF memory into xfmem and xfregs; follow
|
||||
// that split here.
|
||||
u32* xfmem_ptr = (u32*)&xfmem;
|
||||
u32* xfregs_ptr = (u32*)&xfmem + FifoDataFile::XF_MEM_SIZE;
|
||||
const u32* xfmem_ptr = reinterpret_cast<const u32*>(&xfmem);
|
||||
const u32* xfregs_ptr = reinterpret_cast<const u32*>(&xfmem) + FifoDataFile::XF_MEM_SIZE;
|
||||
u32 xfregs_size = sizeof(XFMemory) / 4 - FifoDataFile::XF_MEM_SIZE;
|
||||
|
||||
memset(cpmem, 0, 256 * 4);
|
||||
FillCPMemoryArray(cpmem);
|
||||
|
||||
FifoRecorder::GetInstance().SetVideoMemory(bpmem_ptr, cpmem, xfmem_ptr, xfregs_ptr, xfregs_size);
|
||||
|
|
Loading…
Reference in New Issue