mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 16:19:28 +01:00
GCMemcard: Use BigEndianValue for Directory.m_update_counter.
This commit is contained in:
parent
2d77096d63
commit
0f776fb091
@ -173,7 +173,7 @@ GCMemcard::GCMemcard(const std::string& filename, bool forceCreation, bool shift
|
||||
// the backup should be copied?
|
||||
// }
|
||||
//
|
||||
// if (BE16(dir_backup.m_update_counter) > BE16(dir.m_update_counter)) //check if the backup is newer
|
||||
// if (dir_backup.m_update_counter > dir.m_update_counter) //check if the backup is newer
|
||||
// {
|
||||
// dir = dir_backup;
|
||||
// bat = bat_backup; // needed?
|
||||
@ -209,7 +209,7 @@ GCMemcard::GCMemcard(const std::string& filename, bool forceCreation, bool shift
|
||||
|
||||
void GCMemcard::InitDirBatPointers()
|
||||
{
|
||||
if (BE16(dir.m_update_counter) > (BE16(dir_backup.m_update_counter)))
|
||||
if (dir.m_update_counter > dir_backup.m_update_counter)
|
||||
{
|
||||
CurrentDir = &dir;
|
||||
PreviousDir = &dir_backup;
|
||||
@ -694,7 +694,7 @@ u32 GCMemcard::ImportFile(const DEntry& direntry, std::vector<GCMBlock>& saveBlo
|
||||
break;
|
||||
}
|
||||
}
|
||||
UpdatedDir.m_update_counter = BE16(BE16(UpdatedDir.m_update_counter) + 1);
|
||||
UpdatedDir.m_update_counter = UpdatedDir.m_update_counter + 1;
|
||||
*PreviousDir = UpdatedDir;
|
||||
if (PreviousDir == &dir)
|
||||
{
|
||||
@ -797,7 +797,7 @@ u32 GCMemcard::RemoveFile(u8 index) // index in the directory array
|
||||
}
|
||||
*/
|
||||
memset(&(UpdatedDir.m_dir_entries[index]), 0xFF, DENTRY_SIZE);
|
||||
UpdatedDir.m_update_counter = BE16(BE16(UpdatedDir.m_update_counter) + 1);
|
||||
UpdatedDir.m_update_counter = UpdatedDir.m_update_counter + 1;
|
||||
*PreviousDir = UpdatedDir;
|
||||
if (PreviousDir == &dir)
|
||||
{
|
||||
|
@ -232,9 +232,9 @@ struct Directory
|
||||
{
|
||||
std::array<DEntry, DIRLEN> m_dir_entries; // 0x0000 Directory Entries (max 127)
|
||||
std::array<u8, 0x3a> m_padding;
|
||||
u16 m_update_counter; // 0x1ffa 2 Update Counter
|
||||
u16 m_checksum; // 0x1ffc 2 Additive Checksum
|
||||
u16 m_checksum_inv; // 0x1ffe 2 Inverse Checksum
|
||||
Common::BigEndianValue<u16> m_update_counter; // 0x1ffa 2 Update Counter
|
||||
u16 m_checksum; // 0x1ffc 2 Additive Checksum
|
||||
u16 m_checksum_inv; // 0x1ffe 2 Inverse Checksum
|
||||
Directory()
|
||||
{
|
||||
memset(this, 0xFF, BLOCK_SIZE);
|
||||
|
@ -429,7 +429,7 @@ inline void GCMemcardDirectory::SyncSaves()
|
||||
{
|
||||
Directory* current = &m_dir2;
|
||||
|
||||
if (BE16(m_dir1.m_update_counter) > BE16(m_dir2.m_update_counter))
|
||||
if (m_dir1.m_update_counter > m_dir2.m_update_counter)
|
||||
{
|
||||
current = &m_dir1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user