38#define __packed__ __attribute__((packed))
352#define VMUFS_OVERWRITE 1
353#define VMUFS_VMUGAME 2
354#define VMUFS_NOCOPY 4
unsigned short uint16
16-bit unsigned integer
Definition types.h:34
unsigned char uint8
8-bit unsigned integer
Definition types.h:35
int vmufs_fat_write(maple_device_t *dev, vmu_root_t *root, uint16 *fat_buf)
Given a selected VMU's root block and its FAT, write the FAT blocks back to the VMU.
int vmufs_root_read(maple_device_t *dev, vmu_root_t *root_buf)
Reads a selected VMU's root block.
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_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_file_write(maple_device_t *dev, vmu_root_t *root, uint16 *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_fat_read(maple_device_t *dev, vmu_root_t *root, uint16 *fat_buf)
Given a selected VMU's root block, read its FAT.
int vmufs_mutex_lock(void)
Lock the vmufs mutex.
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_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.
int vmufs_file_delete(vmu_root_t *root, uint16 *fat, vmu_dir_t *dir, const char *fn)
Given a previously-read FAT and directory, delete the named file.
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_file_read(maple_device_t *dev, uint16 *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_mutex_unlock(void)
Unlock the vmufs mutex.
int vmufs_fat_free(vmu_root_t *root, uint16 *fat)
Given a previously-read FAT, return the number of blocks available to write out new file data.
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:270
VMU FS Directory entries, 32 bytes each.
Definition vmufs.h:78
uint8 dirty
See header notes.
Definition vmufs.h:86
uint16 filesize
Size of the file in blocks.
Definition vmufs.h:84
uint16 hdroff
Offset of header, in blocks from start of file.
Definition vmufs.h:85
uint8 copyprotect
0x00 = copyable; 0xff = copy protected
Definition vmufs.h:80
vmu_timestamp_t timestamp
File time.
Definition vmufs.h:83
uint16 firstblk
Location of the first block in the file.
Definition vmufs.h:81
uint8 filetype
0x00 = no file; 0x33 = data; 0xcc = a game
Definition vmufs.h:79
VMU FS Root block layout.
Definition vmufs.h:58
uint16 dir_size
Directory size in blocks.
Definition vmufs.h:69
uint16 fat_loc
FAT location.
Definition vmufs.h:66
uint8 use_custom
0 = standard, 1 = custom
Definition vmufs.h:60
uint16 dir_loc
Directory location.
Definition vmufs.h:68
uint16 fat_size
FAT size in blocks.
Definition vmufs.h:67
vmu_timestamp_t timestamp
BCD timestamp.
Definition vmufs.h:63
uint16 blk_cnt
Number of user blocks.
Definition vmufs.h:71
uint16 icon_shape
Icon shape for this VMS.
Definition vmufs.h:70
BCD timestamp, used several places in the vmufs.
Definition vmufs.h:44
uint8 dow
Day of week (0 = monday, etc)
Definition vmufs.h:52
uint8 sec
Seconds.
Definition vmufs.h:51
uint8 year
Year, within century.
Definition vmufs.h:46
uint8 month
Month of the year.
Definition vmufs.h:47
uint8 hour
Hour of the day.
Definition vmufs.h:49
uint8 cent
Century.
Definition vmufs.h:45
uint8 min
Minutes.
Definition vmufs.h:50
uint8 day
Day of the month.
Definition vmufs.h:48