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

This commit is contained in:
Admiral H. Curtiss 2018-11-18 23:53:00 +01:00
parent deadec608e
commit 4175fdf28d
2 changed files with 7 additions and 5 deletions

View File

@ -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

View File

@ -168,7 +168,7 @@ 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);
@ -177,7 +177,7 @@ struct DEntry
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
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