MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / FindEquivalent

Method FindEquivalent

pcsx2/SIO/Memcard/MemoryCardFolder.cpp:1601–1630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1599}
1600
1601const MemoryCardFileEntry* FolderMemoryCard::FindEquivalent(const MemoryCardFileEntry* searchEntry, const u32 cluster, const u32 fileCount)
1602{
1603 const MemoryCardFileEntryCluster* entryCluster = &m_fileEntryDict[cluster];
1604 u32 fileCluster = cluster;
1605
1606 for (size_t i = 0; i < fileCount; ++i)
1607 {
1608 const MemoryCardFileEntry* entry = &entryCluster->entries[i % 2];
1609
1610 if (entry->IsValid() && entry->IsUsed())
1611 {
1612 if (entry->IsFile() == searchEntry->IsFile() && entry->IsDir() == searchEntry->IsDir() && strncmp((const char*)searchEntry->entry.data.name, (const char*)entry->entry.data.name, sizeof(entry->entry.data.name)) == 0)
1613 {
1614 return entry;
1615 }
1616 }
1617
1618 if (i % 2 == 1)
1619 {
1620 fileCluster = m_fat.data[0][0][fileCluster] & 0x7FFFFFFFu;
1621 if (fileCluster == 0x7FFFFFFFu)
1622 {
1623 return nullptr;
1624 }
1625 entryCluster = &m_fileEntryDict[fileCluster];
1626 }
1627 }
1628
1629 return nullptr;
1630}
1631
1632s32 FolderMemoryCard::EraseBlock(u32 adr)
1633{

Callers

nothing calls this directly

Calls 4

IsFileMethod · 0.80
IsDirMethod · 0.80
IsValidMethod · 0.45
IsUsedMethod · 0.45

Tested by

no test coverage detected