summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2018-11-19 00:12:07 +0100
committerAdmiral H. Curtiss <pikachu025@gmail.com>2018-12-09 22:28:57 +0100
commit88bdab6fe69e72bef474bd992d3518e485d04f79 (patch)
tree604f70fc74b8c23b2961595bcd5d30e0ea94efa6 /Source/Core
parent0f776fb09147c5907fa2eae213d7193d67a63aa3 (diff)
GCMemcard: Use BigEndianValue for BlockAlloc.m_update_counter.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/GCMemcard/GCMemcard.cpp6
-rw-r--r--Source/Core/Core/HW/GCMemcard/GCMemcard.h12
-rw-r--r--Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp2
3 files changed, 10 insertions, 10 deletions
diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcard.cpp b/Source/Core/Core/HW/GCMemcard/GCMemcard.cpp
index a6b91b4892..25af228b23 100644
--- a/Source/Core/Core/HW/GCMemcard/GCMemcard.cpp
+++ b/Source/Core/Core/HW/GCMemcard/GCMemcard.cpp
@@ -219,7 +219,7 @@ void GCMemcard::InitDirBatPointers()
CurrentDir = &dir_backup;
PreviousDir = &dir;
}
- if (BE16(bat.m_update_counter) > BE16(bat_backup.m_update_counter))
+ if (bat.m_update_counter > bat_backup.m_update_counter)
{
CurrentBat = &bat;
PreviousBat = &bat_backup;
@@ -730,7 +730,7 @@ u32 GCMemcard::ImportFile(const DEntry& direntry, std::vector<GCMBlock>& saveBlo
}
UpdatedBat.m_free_blocks = BE16(BE16(UpdatedBat.m_free_blocks) - fileBlocks);
- UpdatedBat.m_update_counter = BE16(BE16(UpdatedBat.m_update_counter) + 1);
+ UpdatedBat.m_update_counter = UpdatedBat.m_update_counter + 1;
*PreviousBat = UpdatedBat;
if (PreviousBat == &bat)
{
@@ -761,7 +761,7 @@ u32 GCMemcard::RemoveFile(u8 index) // index in the directory array
BlockAlloc UpdatedBat = *CurrentBat;
if (!UpdatedBat.ClearBlocks(startingblock, numberofblocks))
return DELETE_FAIL;
- UpdatedBat.m_update_counter = BE16(BE16(UpdatedBat.m_update_counter) + 1);
+ UpdatedBat.m_update_counter = UpdatedBat.m_update_counter + 1;
*PreviousBat = UpdatedBat;
if (PreviousBat == &bat)
{
diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcard.h b/Source/Core/Core/HW/GCMemcard/GCMemcard.h
index 1475ad254c..fc8bc702c0 100644
--- a/Source/Core/Core/HW/GCMemcard/GCMemcard.h
+++ b/Source/Core/Core/HW/GCMemcard/GCMemcard.h
@@ -253,12 +253,12 @@ static_assert(sizeof(Directory) == BLOCK_SIZE);
struct BlockAlloc
{
- u16 m_checksum; // 0x0000 2 Additive Checksum
- u16 m_checksum_inv; // 0x0002 2 Inverse Checksum
- u16 m_update_counter; // 0x0004 2 Update Counter
- u16 m_free_blocks; // 0x0006 2 Free Blocks
- u16 m_last_allocated_block; // 0x0008 2 Last allocated Block
- u16 m_map[BAT_SIZE]; // 0x000a 0x1ff8 Map of allocated Blocks
+ u16 m_checksum; // 0x0000 2 Additive Checksum
+ u16 m_checksum_inv; // 0x0002 2 Inverse Checksum
+ Common::BigEndianValue<u16> m_update_counter; // 0x0004 2 Update Counter
+ u16 m_free_blocks; // 0x0006 2 Free Blocks
+ u16 m_last_allocated_block; // 0x0008 2 Last allocated Block
+ u16 m_map[BAT_SIZE]; // 0x000a 0x1ff8 Map of allocated Blocks
u16 GetNextBlock(u16 Block) const;
u16 NextFreeBlock(u16 MaxBlock, u16 StartingBlock = MC_FST_BLOCKS) const;
bool ClearBlocks(u16 StartingBlock, u16 Length);
diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp b/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp
index c2cd7d3746..4d18f221aa 100644
--- a/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp
+++ b/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp
@@ -549,7 +549,7 @@ s32 GCMemcardDirectory::DirectoryWrite(u32 dest_address, u32 length, const u8* s
bool GCMemcardDirectory::SetUsedBlocks(int save_index)
{
BlockAlloc* current_bat;
- if (BE16(m_bat2.m_update_counter) > BE16(m_bat1.m_update_counter))
+ if (m_bat2.m_update_counter > m_bat1.m_update_counter)
current_bat = &m_bat2;
else
current_bat = &m_bat1;