GCMemcard: Use std::array for DEntry.m_filename.
This commit is contained in:
parent
443729d2c3
commit
0c638ad858
|
@ -371,7 +371,7 @@ u8 GCMemcard::TitlePresent(const DEntry& d) const
|
||||||
while (i < DIRLEN)
|
while (i < DIRLEN)
|
||||||
{
|
{
|
||||||
if ((BE32(CurrentDir->m_dir_entries[i].m_gamecode) == BE32(d.m_gamecode)) &&
|
if ((BE32(CurrentDir->m_dir_entries[i].m_gamecode) == BE32(d.m_gamecode)) &&
|
||||||
(!memcmp(CurrentDir->m_dir_entries[i].m_filename, d.m_filename, 32)))
|
CurrentDir->m_dir_entries[i].m_filename == d.m_filename)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -428,7 +428,9 @@ std::string GCMemcard::DEntry_FileName(u8 index) const
|
||||||
if (!m_valid || index >= DIRLEN)
|
if (!m_valid || index >= DIRLEN)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
return std::string((const char*)CurrentDir->m_dir_entries[index].m_filename, DENTRY_STRLEN);
|
return std::string(
|
||||||
|
reinterpret_cast<const char*>(CurrentDir->m_dir_entries[index].m_filename.data()),
|
||||||
|
CurrentDir->m_dir_entries[index].m_filename.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GCMemcard::DEntry_ModTime(u8 index) const
|
u32 GCMemcard::DEntry_ModTime(u8 index) const
|
||||||
|
@ -1317,7 +1319,7 @@ s32 GCMemcard::FZEROGX_MakeSaveGameValid(const Header& cardheader, const DEntry&
|
||||||
int block = 0;
|
int block = 0;
|
||||||
|
|
||||||
// check for F-Zero GX system file
|
// check for F-Zero GX system file
|
||||||
if (strcmp(reinterpret_cast<const char*>(direntry.m_filename), "f_zero.dat") != 0)
|
if (strcmp(reinterpret_cast<const char*>(direntry.m_filename.data()), "f_zero.dat") != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// get encrypted destination memory card serial numbers
|
// get encrypted destination memory card serial numbers
|
||||||
|
@ -1371,10 +1373,10 @@ s32 GCMemcard::PSO_MakeSaveGameValid(const Header& cardheader, const DEntry& dir
|
||||||
u32 pso3offset = 0x00;
|
u32 pso3offset = 0x00;
|
||||||
|
|
||||||
// check for PSO1&2 system file
|
// check for PSO1&2 system file
|
||||||
if (strcmp(reinterpret_cast<const char*>(direntry.m_filename), "PSO_SYSTEM") != 0)
|
if (strcmp(reinterpret_cast<const char*>(direntry.m_filename.data()), "PSO_SYSTEM") != 0)
|
||||||
{
|
{
|
||||||
// check for PSO3 system file
|
// check for PSO3 system file
|
||||||
if (strcmp(reinterpret_cast<const char*>(direntry.m_filename), "PSO3_SYSTEM") == 0)
|
if (strcmp(reinterpret_cast<const char*>(direntry.m_filename.data()), "PSO3_SYSTEM") == 0)
|
||||||
{
|
{
|
||||||
// PSO3 data block size adjustment
|
// PSO3 data block size adjustment
|
||||||
pso3offset = 0x10;
|
pso3offset = 0x10;
|
||||||
|
|
|
@ -168,7 +168,8 @@ struct DEntry
|
||||||
std::string GCI_FileName() const
|
std::string GCI_FileName() const
|
||||||
{
|
{
|
||||||
std::string filename = std::string((char*)m_makercode, 2) + '-' +
|
std::string filename = std::string((char*)m_makercode, 2) + '-' +
|
||||||
std::string((char*)m_gamecode, 4) + '-' + (char*)m_filename + ".gci";
|
std::string((char*)m_gamecode, 4) + '-' +
|
||||||
|
reinterpret_cast<const char*>(m_filename.data()) + ".gci";
|
||||||
return Common::EscapeFileName(filename);
|
return Common::EscapeFileName(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +187,7 @@ struct DEntry
|
||||||
// 10 RGB5A3 banner
|
// 10 RGB5A3 banner
|
||||||
// 11 ? maybe ==00? Time Splitters 2 and 3 have it and don't have banner
|
// 11 ? maybe ==00? Time Splitters 2 and 3 have it and don't have banner
|
||||||
//
|
//
|
||||||
u8 m_filename[DENTRY_STRLEN]; // 0x08 0x20 Filename
|
std::array<u8, DENTRY_STRLEN> m_filename; // 0x08 0x20 Filename
|
||||||
Common::BigEndianValue<u32>
|
Common::BigEndianValue<u32>
|
||||||
m_modification_time; // 0x28 0x04 Time of file's last modification in seconds since
|
m_modification_time; // 0x28 0x04 Time of file's last modification in seconds since
|
||||||
// 12am, January 1st, 2000
|
// 12am, January 1st, 2000
|
||||||
|
@ -296,9 +297,11 @@ public:
|
||||||
bool LoadSaveBlocks();
|
bool LoadSaveBlocks();
|
||||||
bool HasCopyProtection() const
|
bool HasCopyProtection() const
|
||||||
{
|
{
|
||||||
if ((strcmp((char*)m_gci_header.m_filename, "PSO_SYSTEM") == 0) ||
|
if ((strcmp(reinterpret_cast<const char*>(m_gci_header.m_filename.data()), "PSO_SYSTEM") ==
|
||||||
(strcmp((char*)m_gci_header.m_filename, "PSO3_SYSTEM") == 0) ||
|
0) ||
|
||||||
(strcmp((char*)m_gci_header.m_filename, "f_zero.dat") == 0))
|
(strcmp(reinterpret_cast<const char*>(m_gci_header.m_filename.data()), "PSO3_SYSTEM") ==
|
||||||
|
0) ||
|
||||||
|
(strcmp(reinterpret_cast<const char*>(m_gci_header.m_filename.data()), "f_zero.dat") == 0))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue