Skip to content
Permalink
Browse files

GCMemcard: Use std::array for DEntry.m_makercode.

  • Loading branch information...
AdmiralCurtiss committed Nov 18, 2018
1 parent deadec6 commit 4175fdf28d7e05125a3eeaa9a95ebd314b957c1a
Showing with 7 additions and 5 deletions.
  1. +3 −1 Source/Core/Core/HW/GCMemcard/GCMemcard.cpp
  2. +4 −4 Source/Core/Core/HW/GCMemcard/GCMemcard.h
@@ -408,7 +408,9 @@ std::string GCMemcard::DEntry_Makercode(u8 index) const
if (!m_valid || index >= DIRLEN)
return "";

return std::string((const char*)CurrentDir->m_dir_entries[index].m_makercode, 2);
return std::string(
reinterpret_cast<const char*>(CurrentDir->m_dir_entries[index].m_makercode.data()),
CurrentDir->m_dir_entries[index].m_makercode.size());
}

std::string GCMemcard::DEntry_BIFlags(u8 index) const
@@ -168,17 +168,17 @@ struct DEntry
std::string GCI_FileName() const
{
std::string filename =
std::string((char*)m_makercode, 2) + '-' +
std::string(reinterpret_cast<const char*>(m_makercode.data()), m_makercode.size()) + '-' +
std::string(reinterpret_cast<const char*>(m_gamecode.data()), m_gamecode.size()) + '-' +
reinterpret_cast<const char*>(m_filename.data()) + ".gci";
return Common::EscapeFileName(filename);
}

static constexpr std::array<u8, 4> UNINITIALIZED_GAMECODE = {0xFF, 0xFF, 0xFF, 0xFF};

std::array<u8, 4> m_gamecode; // 0x00 0x04 Gamecode
u8 m_makercode[2]; // 0x04 0x02 Makercode
u8 m_unused_1; // 0x06 0x01 reserved/unused (always 0xff, has no effect)
std::array<u8, 4> m_gamecode; // 0x00 0x04 Gamecode
std::array<u8, 2> m_makercode; // 0x04 0x02 Makercode
u8 m_unused_1; // 0x06 0x01 reserved/unused (always 0xff, has no effect)
u8 m_banner_and_icon_flags; // 0x07 0x01 banner gfx format and icon animation (Image Key)
// Bit(s) Description
// 2 Icon Animation 0: forward 1: ping-pong

0 comments on commit 4175fdf

Please sign in to comment.
You can’t perform that action at this time.