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& 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 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;