58 uint8_t custom_color[4];
348#define VMUFS_OVERWRITE 1
349#define VMUFS_VMUGAME 2
350#define VMUFS_NOCOPY 4
Various common macros used throughout the codebase.
int vmufs_file_delete(vmu_root_t *root, uint16_t *fat, vmu_dir_t *dir, const char *fn)
Given a previously-read FAT and directory, delete the named file.
int vmufs_root_read(maple_device_t *dev, vmu_root_t *root_buf)
Reads a selected VMU's root block.
int vmufs_fat_write(maple_device_t *dev, vmu_root_t *root, uint16_t *fat_buf)
Given a selected VMU's root block and its FAT, write the FAT blocks back to the VMU.
int vmufs_file_write(maple_device_t *dev, vmu_root_t *root, uint16_t *fat, vmu_dir_t *dir, vmu_dir_t *newdirent, void *filebuf, int size)
Given a pointer to a mostly-filled directory struct and a previously loaded directory and FAT,...
int vmufs_dir_blocks(vmu_root_t *root_buf)
Given a VMU's root block, return the amount of space in bytes required to hold its directory.
int vmufs_shutdown(void)
Shutdown vmufs.
int vmufs_fat_free(vmu_root_t *root, uint16_t *fat)
Given a previously-read FAT, return the number of blocks available to write out new file data.
int vmufs_dir_add(vmu_root_t *root, vmu_dir_t *dir, vmu_dir_t *newdirent)
Given a previously-read directory, add a new dirent to the dir.
int vmufs_dir_write(maple_device_t *dev, vmu_root_t *root, vmu_dir_t *dir_buf)
Given a selected VMU's root block and dir blocks, write the dirty dir blocks back to the VMU.
int vmufs_mutex_lock(void)
Lock the vmufs mutex.
int vmufs_fat_read(maple_device_t *dev, vmu_root_t *root, uint16_t *fat_buf)
Given a selected VMU's root block, read its FAT.
int vmufs_write(maple_device_t *dev, const char *fn, void *inbuf, int insize, int flags)
Write a file to the VMU.
int vmufs_delete(maple_device_t *dev, const char *fn)
Delete a file from the VMU.
int vmufs_readdir(maple_device_t *dev, vmu_dir_t **outbuf, int *outcnt)
Read the directory from a VMU.
int vmufs_free_blocks(maple_device_t *dev)
Return the number of user blocks free for file writing.
int vmufs_file_read(maple_device_t *dev, uint16_t *fat, vmu_dir_t *dirent, void *outbuf)
Given a pointer to a directory struct and a previously loaded FAT, load the indicated file from the V...
int vmufs_root_write(maple_device_t *dev, vmu_root_t *root_buf)
Writes a selected VMU's root block.
int vmufs_read_dirent(maple_device_t *dev, vmu_dir_t *dirent, void **outbuf, int *outsize)
Read a file from the VMU, using a pre-read dirent.
int vmufs_read(maple_device_t *dev, const char *fn, void **outbuf, int *outsize)
Read a file from the VMU.
void vmufs_dir_fill_time(vmu_dir_t *d)
Fill in the date on a vmu_dir_t for writing.
int vmufs_dir_read(maple_device_t *dev, vmu_root_t *root_buf, vmu_dir_t *dir_buf)
Given a selected VMU's root block, read its directory.
int vmufs_init(void)
Initialize vmufs.
int vmufs_dir_free(vmu_root_t *root, vmu_dir_t *dir)
Given a previously-read directory, return the number of dirents available for new files.
int vmufs_mutex_unlock(void)
Unlock the vmufs mutex.
int vmufs_fat_blocks(vmu_root_t *root_buf)
Given a VMU's root block, return the amount of space in bytes required to hold its FAT.
int vmufs_dir_find(vmu_root_t *root, vmu_dir_t *dir, const char *fn)
Given a previously-read directory, locate a file by filename.
Maple Bus driver interface.
POSIX directory entry structure.
Definition dirent.h:62
One maple device.
Definition maple.h:273
VMU FS Directory entries, 32 bytes each.
Definition vmufs.h:75
uint8_t dirty
See header notes.
Definition vmufs.h:83
uint8_t copyprotect
0x00 = copyable; 0xff = copy protected
Definition vmufs.h:77
uint16_t filesize
Size of the file in blocks.
Definition vmufs.h:81
uint16_t firstblk
Location of the first block in the file.
Definition vmufs.h:78
uint8_t filetype
0x00 = no file; 0x33 = data; 0xcc = a game
Definition vmufs.h:76
vmu_timestamp_t timestamp
File time.
Definition vmufs.h:80
uint16_t hdroff
Offset of header, in blocks from start of file.
Definition vmufs.h:82
VMU FS Root block layout.
Definition vmufs.h:55
uint16_t dir_size
Directory size in blocks.
Definition vmufs.h:66
uint16_t icon_shape
Icon shape for this VMS.
Definition vmufs.h:67
uint16_t blk_cnt
Number of user blocks.
Definition vmufs.h:68
uint16_t fat_loc
FAT location.
Definition vmufs.h:63
uint8_t use_custom
0 = standard, 1 = custom
Definition vmufs.h:57
uint16_t fat_size
FAT size in blocks.
Definition vmufs.h:64
vmu_timestamp_t timestamp
BCD timestamp.
Definition vmufs.h:60
uint16_t dir_loc
Directory location.
Definition vmufs.h:65
BCD timestamp, used several places in the vmufs.
Definition vmufs.h:41
uint8_t year
Year, within century.
Definition vmufs.h:43
uint8_t min
Minutes.
Definition vmufs.h:47
uint8_t sec
Seconds.
Definition vmufs.h:48
uint8_t hour
Hour of the day.
Definition vmufs.h:46
uint8_t month
Month of the year.
Definition vmufs.h:44
uint8_t dow
Day of week (0 = monday, etc)
Definition vmufs.h:49
uint8_t day
Day of the month.
Definition vmufs.h:45
uint8_t cent
Century.
Definition vmufs.h:42
char magic[6]
Definition wizard.c:80