From eda27ee39799080ee652b4de332ff532c08a00a2 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 21 Mar 2017 15:29:00 -0400 Subject: [PATCH 1/3] FifoPlayer: In-class initialize member variables where applicable --- Source/Core/Core/FifoPlayer/FifoPlayer.cpp | 12 ++++-------- Source/Core/Core/FifoPlayer/FifoPlayer.h | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp index 036e2581c2..b6e7ab60ef 100644 --- a/Source/Core/Core/FifoPlayer/FifoPlayer.cpp +++ b/Source/Core/Core/FifoPlayer/FifoPlayer.cpp @@ -31,6 +31,10 @@ bool IsPlayingBackFifologWithBrokenEFBCopies = false; +FifoPlayer::FifoPlayer() : m_Loop{SConfig::GetInstance().bLoopFifoReplay} +{ +} + FifoPlayer::~FifoPlayer() { } @@ -205,14 +209,6 @@ FifoPlayer& FifoPlayer::GetInstance() return instance; } -FifoPlayer::FifoPlayer() - : m_CurrentFrame(0), m_FrameRangeStart(0), m_FrameRangeEnd(0), m_ObjectRangeStart(0), - m_ObjectRangeEnd(10000), m_EarlyMemoryUpdates(false), m_FileLoadedCb(nullptr), - m_FrameWrittenCb(nullptr), m_File(nullptr) -{ - m_Loop = SConfig::GetInstance().bLoopFifoReplay; -} - void FifoPlayer::WriteFrame(const FifoFrameInfo& frame, const AnalyzedFrameInfo& info) { // Core timing information diff --git a/Source/Core/Core/FifoPlayer/FifoPlayer.h b/Source/Core/Core/FifoPlayer/FifoPlayer.h index cdbb72669d..1751a2f997 100644 --- a/Source/Core/Core/FifoPlayer/FifoPlayer.h +++ b/Source/Core/Core/FifoPlayer/FifoPlayer.h @@ -130,21 +130,21 @@ private: bool m_Loop; - u32 m_CurrentFrame; - u32 m_FrameRangeStart; - u32 m_FrameRangeEnd; + u32 m_CurrentFrame = 0; + u32 m_FrameRangeStart = 0; + u32 m_FrameRangeEnd = 0; - u32 m_ObjectRangeStart; - u32 m_ObjectRangeEnd; + u32 m_ObjectRangeStart = 0; + u32 m_ObjectRangeEnd = 10000; - bool m_EarlyMemoryUpdates; + bool m_EarlyMemoryUpdates = false; - u64 m_CyclesPerFrame; - u32 m_ElapsedCycles; - u32 m_FrameFifoSize; + u64 m_CyclesPerFrame = 0; + u32 m_ElapsedCycles = 0; + u32 m_FrameFifoSize = 0; - CallbackFunc m_FileLoadedCb; - CallbackFunc m_FrameWrittenCb; + CallbackFunc m_FileLoadedCb = nullptr; + CallbackFunc m_FrameWrittenCb = nullptr; std::unique_ptr m_File; From 4e5e7cff0a1de0bdef693edee02a7e1ee0f48322 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 21 Mar 2017 15:34:04 -0400 Subject: [PATCH 2/3] FifoRecorder: In-class initialize member variables where applicable --- Source/Core/Core/FifoPlayer/FifoRecorder.cpp | 6 +----- Source/Core/Core/FifoPlayer/FifoRecorder.h | 18 +++++++++--------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp index 5a55b9f459..378ad29290 100644 --- a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp +++ b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp @@ -17,11 +17,7 @@ static FifoRecorder instance; static std::recursive_mutex sMutex; -FifoRecorder::FifoRecorder() - : m_IsRecording(false), m_WasRecording(false), m_RequestedRecordingEnd(false), - m_RecordFramesRemaining(0), m_FinishedCb(nullptr), m_File(nullptr), m_SkipNextData(true), - m_SkipFutureData(true), m_FrameEnded(false), m_Ram(Memory::RAM_SIZE), - m_ExRam(Memory::EXRAM_SIZE) +FifoRecorder::FifoRecorder() : m_Ram(Memory::RAM_SIZE), m_ExRam(Memory::EXRAM_SIZE) { } diff --git a/Source/Core/Core/FifoPlayer/FifoRecorder.h b/Source/Core/Core/FifoPlayer/FifoRecorder.h index 63ce93eaf7..ba0ab38fa6 100644 --- a/Source/Core/Core/FifoPlayer/FifoRecorder.h +++ b/Source/Core/Core/FifoPlayer/FifoRecorder.h @@ -47,20 +47,20 @@ private: // Accessed from both GUI and video threads // True if video thread should send data - volatile bool m_IsRecording; + volatile bool m_IsRecording = false; // True if m_IsRecording was true during last frame - volatile bool m_WasRecording; - volatile bool m_RequestedRecordingEnd; - volatile s32 m_RecordFramesRemaining; - volatile CallbackFunc m_FinishedCb; + volatile bool m_WasRecording = false; + volatile bool m_RequestedRecordingEnd = false; + volatile s32 m_RecordFramesRemaining = 0; + volatile CallbackFunc m_FinishedCb = nullptr; - FifoDataFile* volatile m_File; + FifoDataFile* volatile m_File = nullptr; // Accessed only from video thread - bool m_SkipNextData; - bool m_SkipFutureData; - bool m_FrameEnded; + bool m_SkipNextData = true; + bool m_SkipFutureData = true; + bool m_FrameEnded = false; FifoFrameInfo m_CurrentFrame; std::vector m_FifoData; std::vector m_Ram; From 780dffcb139d027ca85f1bfc0cd605432ec3bea4 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 21 Mar 2017 15:35:48 -0400 Subject: [PATCH 3/3] FifoDataFile: In-class initialize member variables where applicable --- Source/Core/Core/FifoPlayer/FifoDataFile.cpp | 8 ++------ Source/Core/Core/FifoPlayer/FifoDataFile.h | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp index 231f8cb82d..5a1fd476a3 100644 --- a/Source/Core/Core/FifoPlayer/FifoDataFile.cpp +++ b/Source/Core/Core/FifoPlayer/FifoDataFile.cpp @@ -13,13 +13,9 @@ using namespace FifoFileStruct; -FifoDataFile::FifoDataFile() : m_Flags(0) -{ -} +FifoDataFile::FifoDataFile() = default; -FifoDataFile::~FifoDataFile() -{ -} +FifoDataFile::~FifoDataFile() = default; bool FifoDataFile::HasBrokenEFBCopies() const { diff --git a/Source/Core/Core/FifoPlayer/FifoDataFile.h b/Source/Core/Core/FifoPlayer/FifoDataFile.h index f3c8e92eb3..f57f2fcf4a 100644 --- a/Source/Core/Core/FifoPlayer/FifoDataFile.h +++ b/Source/Core/Core/FifoPlayer/FifoDataFile.h @@ -94,8 +94,8 @@ private: u32 m_XFRegs[XF_REGS_SIZE]; u8 m_TexMem[TEX_MEM_SIZE]; - u32 m_Flags; - u32 m_Version; + u32 m_Flags = 0; + u32 m_Version = 0; std::vector m_Frames; };