Skip to content
This repository was archived by the owner on Jun 12, 2022. It is now read-only.
This repository was archived by the owner on Jun 12, 2022. It is now read-only.

FAT fragmentation is not handled at all #1

Description

@parasyte

When the file system on SD gets fragmented (by adding and removing small files) alt64 will be unable to read some files correctly, especially when loading ROMs. See:

alt64/menu.c

Lines 1315 to 1322 in 3ba0910

if(mb<=32){
resp = diskRead(begin_sector, (void *)0xb0000000, file_sectors); //2048 cluster 1Mb
}
else{
resp = diskRead(begin_sector, (void *)0xb0000000, lower_half);
sleep(10);
resp = diskRead(begin_sector+lower_half, (void *)0xb2000000, file_sectors-lower_half);
}

The issue is that the code assumes there is no fragmentation, so it just does a pure DMA from SD, starting with the first sector in the FAT.

A fragmented ROM will be read incorrectly, and usually will not boot. (Or it may boot and crash later, or have other strange errors.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions