Navigation Menu

Skip to content

Commit

Permalink
GCMemcard: Use std::array for DEntry.m_makercode.
Browse files Browse the repository at this point in the history
  • Loading branch information
AdmiralCurtiss committed Dec 9, 2018
1 parent deadec6 commit 4175fdf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Source/Core/Core/HW/GCMemcard/GCMemcard.cpp
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/Core/HW/GCMemcard/GCMemcard.h
Expand Up @@ -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
Expand Down

0 comments on commit 4175fdf

Please sign in to comment.