| 9120e874 Andy McCall |
1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
#ifndef SDCARD_FAT_H |
| 9 |
#define SDCARD_FAT_H |
| 10 |
|
| 11 |
#include <stdbool.h> |
| 12 |
#include <stdint.h> |
| 13 |
|
| 14 |
#ifdef __cplusplus |
| 15 |
extern "C" { |
| 16 |
#endif |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
struct x16file; |
| 21 |
|
| 22 |
|
| 23 |
typedef enum { |
| 24 |
SDCARD_FAT_REGION_UNKNOWN = 0, |
| 25 |
SDCARD_FAT_REGION_MBR, |
| 26 |
SDCARD_FAT_REGION_RESERVED, |
| 27 |
SDCARD_FAT_REGION_FAT, |
| 28 |
SDCARD_FAT_REGION_ROOTDIR, |
| 29 |
SDCARD_FAT_REGION_FILE, |
| 30 |
SDCARD_FAT_REGION_DIR, |
| 31 |
SDCARD_FAT_REGION_FREE, |
| 32 |
} sdcard_fat_region_t; |
| 33 |
|
| 34 |
|
| 35 |
typedef struct { |
| 36 |
const char *path; |
| 37 |
uint32_t size; |
| 38 |
uint32_t first_cluster; |
| 39 |
bool is_dir; |
| 40 |
uint64_t bytes_read; |
| 41 |
uint64_t bytes_written; |
| 42 |
} sdcard_fat_file_t; |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
bool sdcard_fat_build(struct x16file *img); |
| 53 |
|
| 54 |
|
| 55 |
void sdcard_fat_free(void); |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
extern bool sdcard_fat_autoindex; |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
bool sdcard_fat_ready(void); |
| 66 |
bool sdcard_fat_is_stale(void); |
| 67 |
void sdcard_fat_mark_stale(void); |
| 68 |
bool sdcard_fat_truncated(void); |
| 69 |
const char *sdcard_fat_type_name(void); |
| 70 |
uint32_t sdcard_fat_bytes_per_cluster(void); |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
sdcard_fat_region_t sdcard_fat_lookup(uint32_t lba, |
| 75 |
const sdcard_fat_file_t **out_file, |
| 76 |
uint64_t *out_offset); |
| 77 |
|
| 78 |
void sdcard_fat_note_access(uint32_t lba, bool is_write, uint32_t bytes); |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
int sdcard_fat_file_count(void); |
| 83 |
const sdcard_fat_file_t *sdcard_fat_file_at(int i); |
| 84 |
|
| 85 |
#ifdef __cplusplus |
| 86 |
} |
| 87 |
#endif |
| 88 |
|
| 89 |
#endif |