From 647bec4c17235c543ec2bc3f5c64757b96bab4a3 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 14 Mar 2017 22:57:40 -0400 Subject: [PATCH] GCMemcard: Amend variable naming for MemoryCardBase --- Source/Core/Core/HW/GCMemcard/GCMemcard.h | 18 ++++----- .../Core/HW/GCMemcard/GCMemcardDirectory.cpp | 3 +- .../Core/Core/HW/GCMemcard/GCMemcardRaw.cpp | 37 ++++++++++--------- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcard.h b/Source/Core/Core/HW/GCMemcard/GCMemcard.h index 25dd196f45..31f8eebc12 100644 --- a/Source/Core/Core/HW/GCMemcard/GCMemcard.h +++ b/Source/Core/Core/HW/GCMemcard/GCMemcard.h @@ -70,22 +70,22 @@ enum class MemoryCardBase { public: - explicit MemoryCardBase(int _card_index = 0, int sizeMb = MemCard2043Mb) - : card_index(_card_index), nintendo_card_id(sizeMb) + explicit MemoryCardBase(int card_index = 0, int size_mbits = MemCard2043Mb) + : m_card_index(card_index), m_nintendo_card_id(size_mbits) { } virtual ~MemoryCardBase() {} - virtual s32 Read(u32 address, s32 length, u8* destaddress) = 0; - virtual s32 Write(u32 destaddress, s32 length, const u8* srcaddress) = 0; + virtual s32 Read(u32 src_address, s32 length, u8* dest_address) = 0; + virtual s32 Write(u32 dest_address, s32 length, const u8* src_address) = 0; virtual void ClearBlock(u32 address) = 0; virtual void ClearAll() = 0; virtual void DoState(PointerWrap& p) = 0; - u32 GetCardId() const { return nintendo_card_id; } - bool IsAddressInBounds(u32 address) const { return address <= (memory_card_size - 1); } + u32 GetCardId() const { return m_nintendo_card_id; } + bool IsAddressInBounds(u32 address) const { return address <= (m_memory_card_size - 1); } protected: - int card_index; - u16 nintendo_card_id; - u32 memory_card_size; + int m_card_index; + u16 m_nintendo_card_id; + u32 m_memory_card_size; }; struct GCMBlock diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp b/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp index a80181427a..ec620b18ec 100644 --- a/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp +++ b/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp @@ -185,7 +185,8 @@ void GCMemcardDirectory::FlushThread() return; } - Common::SetCurrentThreadName(StringFromFormat("Memcard %d flushing thread", card_index).c_str()); + Common::SetCurrentThreadName( + StringFromFormat("Memcard %d flushing thread", m_card_index).c_str()); while (true) { diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.cpp b/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.cpp index f14eb2e03e..10f65dbdef 100644 --- a/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.cpp +++ b/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.cpp @@ -29,31 +29,31 @@ MemoryCard::MemoryCard(const std::string& filename, int _card_index, u16 sizeMb) if (pFile) { // Measure size of the existing memcard file. - memory_card_size = (u32)pFile.GetSize(); - nintendo_card_id = memory_card_size / SIZE_TO_Mb; - m_memcard_data = std::make_unique(memory_card_size); - memset(&m_memcard_data[0], 0xFF, memory_card_size); + m_memory_card_size = (u32)pFile.GetSize(); + m_nintendo_card_id = m_memory_card_size / SIZE_TO_Mb; + m_memcard_data = std::make_unique(m_memory_card_size); + memset(&m_memcard_data[0], 0xFF, m_memory_card_size); INFO_LOG(EXPANSIONINTERFACE, "Reading memory card %s", m_filename.c_str()); - pFile.ReadBytes(&m_memcard_data[0], memory_card_size); + pFile.ReadBytes(&m_memcard_data[0], m_memory_card_size); } else { // Create a new 128Mb memcard - nintendo_card_id = sizeMb; - memory_card_size = sizeMb * SIZE_TO_Mb; + m_nintendo_card_id = sizeMb; + m_memory_card_size = sizeMb * SIZE_TO_Mb; - m_memcard_data = std::make_unique(memory_card_size); + m_memcard_data = std::make_unique(m_memory_card_size); // Fills in MC_HDR_SIZE bytes GCMemcard::Format(&m_memcard_data[0], m_filename.find(".JAP.raw") != std::string::npos, sizeMb); - memset(&m_memcard_data[MC_HDR_SIZE], 0xFF, memory_card_size - MC_HDR_SIZE); + memset(&m_memcard_data[MC_HDR_SIZE], 0xFF, m_memory_card_size - MC_HDR_SIZE); INFO_LOG(EXPANSIONINTERFACE, "No memory card found. A new one was created instead."); } // Class members (including inherited ones) have now been initialized, so // it's safe to startup the flush thread (which reads them). - m_flush_buffer = std::make_unique(memory_card_size); + m_flush_buffer = std::make_unique(m_memory_card_size); m_flush_thread = std::thread(&MemoryCard::FlushThread, this); } @@ -74,7 +74,8 @@ void MemoryCard::FlushThread() return; } - Common::SetCurrentThreadName(StringFromFormat("Memcard %d flushing thread", card_index).c_str()); + Common::SetCurrentThreadName( + StringFromFormat("Memcard %d flushing thread", m_card_index).c_str()); const auto flush_interval = std::chrono::seconds(15); @@ -124,14 +125,14 @@ void MemoryCard::FlushThread() { std::unique_lock l(m_flush_mutex); - memcpy(&m_flush_buffer[0], &m_memcard_data[0], memory_card_size); + memcpy(&m_flush_buffer[0], &m_memcard_data[0], m_memory_card_size); } - pFile.WriteBytes(&m_flush_buffer[0], memory_card_size); + pFile.WriteBytes(&m_flush_buffer[0], m_memory_card_size); if (!do_exit) { Core::DisplayMessage(StringFromFormat("Wrote memory card %c contents to %s", - card_index ? 'B' : 'A', m_filename.c_str()) + m_card_index ? 'B' : 'A', m_filename.c_str()) .c_str(), 4000); } @@ -194,14 +195,14 @@ void MemoryCard::ClearAll() { { std::unique_lock l(m_flush_mutex); - memset(&m_memcard_data[0], 0xFF, memory_card_size); + memset(&m_memcard_data[0], 0xFF, m_memory_card_size); } MakeDirty(); } void MemoryCard::DoState(PointerWrap& p) { - p.Do(card_index); - p.Do(memory_card_size); - p.DoArray(&m_memcard_data[0], memory_card_size); + p.Do(m_card_index); + p.Do(m_memory_card_size); + p.DoArray(&m_memcard_data[0], m_memory_card_size); }