Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/core/FatSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,15 +312,14 @@ bool FatSystem::validCluster(unsigned int cluster)

unsigned long long FatSystem::clusterAddress(unsigned int cluster, bool isRoot)
{
if (type == FAT32 || !isRoot) {
cluster -= 2;
}

unsigned long long addr = (dataStart + bytesPerSector*sectorsPerCluster*cluster);

if (type == FAT16 && !isRoot) {
addr += rootEntries * FAT_ENTRY_SIZE;
}
if (type == FAT32 || !isRoot) {
addr -= bytesPerSector*sectorsPerCluster*2;
}

return addr;
}
Expand Down