GCMemcard: DEntry: Move code out of header.

This commit is contained in:
Admiral H. Curtiss 2019-04-21 17:40:35 +02:00
parent 17da22a84f
commit 6e04e4dd6a
2 changed files with 18 additions and 9 deletions

View File

@ -1470,6 +1470,20 @@ void Header::CalculateSerial(u32* serial1, u32* serial2) const
*serial2 = serial[1] ^ serial[3] ^ serial[5] ^ serial[7]; *serial2 = serial[1] ^ serial[3] ^ serial[5] ^ serial[7];
} }
DEntry::DEntry()
{
memset(this, 0xFF, DENTRY_SIZE);
}
std::string DEntry::GCI_FileName() const
{
std::string filename =
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);
}
Directory::Directory() Directory::Directory()
{ {
memset(this, 0xFF, BLOCK_SIZE); memset(this, 0xFF, BLOCK_SIZE);

View File

@ -154,15 +154,10 @@ static_assert(sizeof(Header) == BLOCK_SIZE);
struct DEntry struct DEntry
{ {
DEntry() { memset(this, 0xFF, DENTRY_SIZE); } DEntry();
std::string GCI_FileName() const
{ // TODO: This probably shouldn't be here at all?
std::string filename = std::string GCI_FileName() const;
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}}; static constexpr std::array<u8, 4> UNINITIALIZED_GAMECODE{{0xFF, 0xFF, 0xFF, 0xFF}};