![]() |
CHGame 0.3.0
Libraries for the CHGame handheld
|
A read-only FAT16/FAT32 reader on top of sd::read(): a file name in, the file's runs of card blocks out. More...
Namespaces | |
| namespace | fat |
| The FAT16/FAT32 reader (CHSd). | |
Classes | |
| struct | fat::Run |
| A run of consecutive card blocks holding part of a file (see runs()). More... | |
| struct | fat::File |
| A file or folder found in a directory: where it starts and how long it is. More... | |
A read-only FAT16/FAT32 reader on top of sd::read(): a file name in, the file's runs of card blocks out.
Written from the Microsoft FAT specification (BPB fields, FAT type from the cluster count, 8.3 directory entries, end-of-chain marks) and the MBR partition table layout. It only turns a file name into LBA runs: after that a file is read as raw card blocks through its run list, so there is no FAT write code, no cache and no file object. Every call borrows the caller's 512 B buffer (4-byte aligned) and clobbers it; the volume state is 24 B. What a game does not call is left out of its image by the linker.
Names are 8.3 short names as the directory stores them: 11 characters, capitals, the name and the extension padded with spaces ("WORDS DIC" for WORDS.DIC), and ? stands for any character. Long-name entries, volume labels and hidden entries are skipped; a file never matches a folder name, nor a folder a file name. Files are looked for in the root directory or in a folder of it.
gfx_wait() and the next flush. CHGfx's gfx_chunkScratch() is idle at exactly that time and makes a good buffer.