| 1599 | } |
| 1600 | |
| 1601 | const 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 | |
| 1632 | s32 FolderMemoryCard::EraseBlock(u32 adr) |
| 1633 | { |