GCMemcard: Use BigEndianValue for Header.m_size_mb.
This commit is contained in:
parent
bfbfcc72a2
commit
8eabcbf294
|
@ -93,7 +93,7 @@ GCMemcard::GCMemcard(const std::string& filename, bool forceCreation, bool shift
|
|||
PanicAlertT("Failed to read header correctly\n(0x0000-0x1FFF)");
|
||||
return;
|
||||
}
|
||||
if (m_sizeMb != BE16(hdr.m_size_mb))
|
||||
if (m_sizeMb != hdr.m_size_mb)
|
||||
{
|
||||
PanicAlertT("Memory card file size does not match the header size");
|
||||
return;
|
||||
|
|
|
@ -110,7 +110,7 @@ struct Header // Offset Size Description
|
|||
// end Serial in libogc
|
||||
Common::BigEndianValue<u16>
|
||||
m_device_id; // 0x0020 2 0 if formated in slot A 1 if formated in slot B
|
||||
u8 m_size_mb[2]; // 0x0022 2 Size of memcard in Mbits
|
||||
Common::BigEndianValue<u16> m_size_mb; // 0x0022 2 Size of memcard in Mbits
|
||||
u16 m_encoding; // 0x0024 2 Encoding (Windows-1252 or Shift JIS)
|
||||
u8 m_unused_1[468]; // 0x0026 468 Unused (0xff)
|
||||
u16 m_update_counter; // 0x01fa 2 Update Counter (?, probably unused)
|
||||
|
@ -137,7 +137,7 @@ struct Header // Offset Size Description
|
|||
explicit Header(int slot = 0, u16 sizeMb = MemCard2043Mb, bool shift_jis = false)
|
||||
{
|
||||
memset(this, 0xFF, BLOCK_SIZE);
|
||||
*(u16*)m_size_mb = BE16(sizeMb);
|
||||
m_size_mb = sizeMb;
|
||||
m_encoding = BE16(shift_jis ? 1 : 0);
|
||||
u64 rand = Common::Timer::GetLocalTimeSinceJan1970() - ExpansionInterface::CEXIIPL::GC_EPOCH;
|
||||
m_format_time = rand;
|
||||
|
|
|
@ -89,7 +89,7 @@ int GCMemcardDirectory::LoadGCI(const std::string& file_name, bool current_game_
|
|||
{
|
||||
return NO_INDEX;
|
||||
}
|
||||
int total_blocks = BE16(m_hdr.m_size_mb) * MBIT_TO_BLOCKS - MC_FST_BLOCKS;
|
||||
int total_blocks = m_hdr.m_size_mb * MBIT_TO_BLOCKS - MC_FST_BLOCKS;
|
||||
int free_blocks = BE16(m_bat1.m_free_blocks);
|
||||
if (total_blocks > free_blocks * 10)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue