KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
vmufs.h File Reference

Low-level VMU filesystem driver. More...

#include <sys/cdefs.h>
#include <dc/maple.h>

Go to the source code of this file.

Data Structures

struct  vmu_timestamp_t
 BCD timestamp, used several places in the vmufs. More...
 
struct  vmu_root_t
 VMU FS Root block layout. More...
 
struct  vmu_dir_t
 VMU FS Directory entries, 32 bytes each. More...
 

Macros

#define VMUFS_OVERWRITE   1
 Overwrite existing files.
 
#define VMUFS_VMUGAME   2
 This file is a VMU game.
 
#define VMUFS_NOCOPY   4
 Set the no-copy flag.
 

Functions

void vmufs_dir_fill_time (vmu_dir_t *d)
 Fill in the date on a vmu_dir_t for writing.
 
int vmufs_root_read (maple_device_t *dev, vmu_root_t *root_buf)
 Reads a selected VMU's root block.
 
int vmufs_root_write (maple_device_t *dev, vmu_root_t *root_buf)
 Writes 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_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_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_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_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_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_dir_find (vmu_root_t *root, vmu_dir_t *dir, const char *fn)
 Given a previously-read directory, locate a file by filename.
 
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_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 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, write the indicated file to 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.
 
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_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_lock (void)
 Lock the vmufs mutex.
 
int vmufs_mutex_unlock (void)
 Unlock the vmufs mutex.
 
int vmufs_readdir (maple_device_t *dev, vmu_dir_t **outbuf, int *outcnt)
 Read the directory from a VMU.
 
int vmufs_read (maple_device_t *dev, const char *fn, void **outbuf, int *outsize)
 Read a file from the VMU.
 
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_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_free_blocks (maple_device_t *dev)
 Return the number of user blocks free for file writing.
 
int vmufs_init (void)
 Initialize vmufs.
 
int vmufs_shutdown (void)
 Shutdown vmufs.
 

Detailed Description

Low-level VMU filesystem driver.

The VMU filesystem driver mounts itself on /vmu of the VFS. Each memory card has its own subdirectory off of that directory (i.e, /vmu/a1 for slot 1 of the first controller). VMUs themselves have no subdirectories, so the driver itself is fairly simple.

Files on a VMU must be multiples of 512 bytes in size, and should have a header attached so that they show up in the BIOS menu.

Author
Megan Potter
See also
dc/vmu_pkg.h
dc/fs_vmu.h