diff --git a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp index 00d140de6b..fcd86afdd2 100644 --- a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp +++ b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp @@ -145,7 +145,7 @@ std::unique_ptr FifoPlayer::GetCPUCore() return std::make_unique(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 diff --git a/Source/Core/Core/FifoPlayer/FifoPlayer.h b/Source/Core/Core/FifoPlayer/FifoPlayer.h index 29e53a0bca..e1c285ff43 100644 --- a/Source/Core/Core/FifoPlayer/FifoPlayer.h +++ b/Source/Core/Core/FifoPlayer/FifoPlayer.h @@ -65,8 +65,8 @@ public: // PowerPC state. std::unique_ptr 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); diff --git a/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.cpp b/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.cpp index d08314b3e2..46019f7124 100644 --- a/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.cpp +++ b/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.cpp @@ -13,7 +13,7 @@ using namespace FifoAnalyzer; -void FifoRecordAnalyzer::Initialize(u32* cpMem) +void FifoRecordAnalyzer::Initialize(const u32* cpMem) { s_DrawingObject = false; diff --git a/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.h b/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.h index d64d25f0fd..b991337b6a 100644 --- a/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.h +++ b/Source/Core/Core/FifoPlayer/FifoRecordAnalyzer.h @@ -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); diff --git a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp index fd3be97e5a..8617b8b700 100644 --- a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp +++ b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp @@ -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 lk(sMutex); diff --git a/Source/Core/Core/FifoPlayer/FifoRecorder.h b/Source/Core/Core/FifoPlayer/FifoRecorder.h index aafb701611..49ef79dae5 100644 --- a/Source/Core/Core/FifoPlayer/FifoRecorder.h +++ b/Source/Core/Core/FifoPlayer/FifoRecorder.h @@ -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; } diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 07854ba42f..baddf67867 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -597,15 +597,14 @@ void Renderer::CheckFifoRecording() void Renderer::RecordVideoMemory() { - u32* bpmem_ptr = (u32*)&bpmem; - u32 cpmem[256]; + const u32* bpmem_ptr = reinterpret_cast(&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(&xfmem); + const u32* xfregs_ptr = reinterpret_cast(&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);