libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
FileSystemDriver Class Referenceabstract

Storage device enumeration/mount/poll backend for the SD/USB/DVD file browser. More...

#include <FileSystemDriver.h>

Inheritance diagram for FileSystemDriver:
[legend]

Public Member Functions

virtual void init ()=0
 Initializes the driver and auto-mounts devices flagged autoMountAtStartup.
 
virtual void shutdown ()=0
 Unmounts every device and releases the driver's resources.
 
virtual int enumerateStorageDevices (StorageDevice outDevices[MAX_STORAGE_DEVICES])=0
 Fills outDevices (size MAX_STORAGE_DEVICES) and returns the device count.
 
virtual MountResult mountStorageDevice (int deviceId)=0
 Attempts to mount deviceId exactly once.
 
virtual const char * mountResultMessage (int deviceId, MountResult result)=0
 A short, user-displayable reason for a non-Success MountResult (eg.
 
virtual void invalidateStorageDevice (int deviceId)=0
 Marks deviceId as needing a fresh mount next time mountStorageDevice() is called, eg.
 
virtual void pollStorageDevices (int removedIds[MAX_STORAGE_DEVICES], int &outRemovedCount, bool &deviceListChanged)=0
 Called once per device-checking thread cycle.
 
virtual bool hasRemovableStorageDevices () const =0
 Whether the device-checking thread should run on this platform.
 
virtual bool isDevicePresent (int deviceId) const =0
 Lightweight, cached hardware-presence check for a single device - does NOT mount and does no invasive I/O.
 
virtual const char * getDevicePrefix (int device) const =0
 The devoptab prefix this device would use (eg.
 
virtual const char * getMountPath (int device) const =0
 devoptab-style mount path for device (eg.
 
template<size_t N>
void getPath (char(&out)[N], int device, const char *suffix) const
 Writes getMountPath(device) + suffix into out (bounds-checked to sizeof(out) via the array-reference template parameter N).
 
template<size_t N>
void getPath (char(&out)[N], int device, const char *folder, const char *file) const
 Joins a folder and a filename with '/' after the mount path.
 
void getPath (char *out, size_t outSize, int device, const char *suffix) const
 Explicit-size equivalents of the two templates above, for call sites where the destination buffer arrives as a char * function parameter rather than a fixed array.
 
void getPath (char *out, size_t outSize, int device, const char *folder, const char *file) const
 Joins folder and file with '/' after the mount path, as in the template above.
 
virtual const int * getValidLoadDevices (int &outCount) const =0
 Devices (Device enum values, in priority order) that are offered when choosing where to load from on this platform.
 
virtual const int * getValidSaveDevices (int &outCount) const =0
 Devices (Device enum values, in priority order) that are offered when choosing where to save to on this platform.
 
virtual SmbDriver * getSmb ()=0
 

Detailed Description

Storage device enumeration/mount/poll backend for the SD/USB/DVD file browser.

Exactly one driver implements this and assigns the single global Platform instance.

Definition at line 60 of file FileSystemDriver.h.

Member Function Documentation

◆ enumerateStorageDevices()

virtual int FileSystemDriver::enumerateStorageDevices ( StorageDevice outDevices[MAX_STORAGE_DEVICES])
pure virtual

Fills outDevices (size MAX_STORAGE_DEVICES) and returns the device count.

Implemented in OgcFileSystemDriver, and WutFileSystemDriver.

◆ getDevicePrefix()

virtual const char * FileSystemDriver::getDevicePrefix ( int device) const
pure virtual

The devoptab prefix this device would use (eg.

"usb:/"), regardless of whether it is currently mounted.

Implemented in OgcFileSystemDriver, and WutFileSystemDriver.

◆ getMountPath()

virtual const char * FileSystemDriver::getMountPath ( int device) const
pure virtual

devoptab-style mount path for device (eg.

"sd:/"), or "" if device isn't recognized or currently mounted on this platform. Only for "is this usable already?" call sites - use getDevicePrefix() to map a path back to a device id.

Implemented in OgcFileSystemDriver, and WutFileSystemDriver.

◆ getPath() [1/4]

void FileSystemDriver::getPath ( char * out,
size_t outSize,
int device,
const char * folder,
const char * file ) const
inline

Joins folder and file with '/' after the mount path, as in the template above.

Definition at line 137 of file FileSystemDriver.h.

◆ getPath() [2/4]

void FileSystemDriver::getPath ( char * out,
size_t outSize,
int device,
const char * suffix ) const
inline

Explicit-size equivalents of the two templates above, for call sites where the destination buffer arrives as a char * function parameter rather than a fixed array.

Definition at line 130 of file FileSystemDriver.h.

◆ getPath() [3/4]

template<size_t N>
void FileSystemDriver::getPath ( char(&) out[N],
int device,
const char * folder,
const char * file ) const
inline

Joins a folder and a filename with '/' after the mount path.

Definition at line 122 of file FileSystemDriver.h.

◆ getPath() [4/4]

template<size_t N>
void FileSystemDriver::getPath ( char(&) out[N],
int device,
const char * suffix ) const
inline

Writes getMountPath(device) + suffix into out (bounds-checked to sizeof(out) via the array-reference template parameter N).

Definition at line 115 of file FileSystemDriver.h.

◆ getSmb()

virtual SmbDriver * FileSystemDriver::getSmb ( )
pure virtual
Returns
this platform's network-share driver (see SmbDriver)

Implemented in OgcFileSystemDriver, and WutFileSystemDriver.

◆ getValidLoadDevices()

virtual const int * FileSystemDriver::getValidLoadDevices ( int & outCount) const
pure virtual

Devices (Device enum values, in priority order) that are offered when choosing where to load from on this platform.

Parameters
outCountreceives the number of entries in the returned array
Returns
a static array owned by the driver

Implemented in GameCubeFileSystemDriver, WiiFileSystemDriver, and WutFileSystemDriver.

◆ getValidSaveDevices()

virtual const int * FileSystemDriver::getValidSaveDevices ( int & outCount) const
pure virtual

Devices (Device enum values, in priority order) that are offered when choosing where to save to on this platform.

Differs from the load list in that read-only devices such as DVD are left out.

Parameters
outCountreceives the number of entries in the returned array
Returns
a static array owned by the driver

Implemented in GameCubeFileSystemDriver, WiiFileSystemDriver, and WutFileSystemDriver.

◆ hasRemovableStorageDevices()

virtual bool FileSystemDriver::hasRemovableStorageDevices ( ) const
pure virtual

Whether the device-checking thread should run on this platform.

Implemented in OgcFileSystemDriver, and WutFileSystemDriver.

◆ init()

virtual void FileSystemDriver::init ( )
pure virtual

Initializes the driver and auto-mounts devices flagged autoMountAtStartup.

Implemented in GameCubeFileSystemDriver, WiiFileSystemDriver, and WutFileSystemDriver.

◆ invalidateStorageDevice()

virtual void FileSystemDriver::invalidateStorageDevice ( int deviceId)
pure virtual

Marks deviceId as needing a fresh mount next time mountStorageDevice() is called, eg.

after a read/write failure suggests the underlying media went away. Does no I/O itself.

Implemented in OgcFileSystemDriver, and WutFileSystemDriver.

◆ isDevicePresent()

virtual bool FileSystemDriver::isDevicePresent ( int deviceId) const
pure virtual

Lightweight, cached hardware-presence check for a single device - does NOT mount and does no invasive I/O.

Backed by whatever pollStorageDevices() last observed

Implemented in OgcFileSystemDriver, and WutFileSystemDriver.

◆ mountResultMessage()

virtual const char * FileSystemDriver::mountResultMessage ( int deviceId,
MountResult result )
pure virtual

A short, user-displayable reason for a non-Success MountResult (eg.

"SD card not found!"). Never returns nullptr.

Implemented in OgcFileSystemDriver, and WutFileSystemDriver.

◆ mountStorageDevice()

virtual MountResult FileSystemDriver::mountStorageDevice ( int deviceId)
pure virtual

Attempts to mount deviceId exactly once.

No retry, no prompts, no-ops (returns Success) if already mounted.

Implemented in OgcFileSystemDriver, and WutFileSystemDriver.

◆ pollStorageDevices()

virtual void FileSystemDriver::pollStorageDevices ( int removedIds[MAX_STORAGE_DEVICES],
int & outRemovedCount,
bool & deviceListChanged )
pure virtual

Called once per device-checking thread cycle.

removedIds/outRemovedCount: devices that were mounted and have now disappeared (already invalidated internally - callers just need to react, eg. abort an in-progress directory parse). deviceListChanged: true if enumerateStorageDevices() should be re-run because the device table itself changed shape.

Implemented in OgcFileSystemDriver, and WutFileSystemDriver.

◆ shutdown()

virtual void FileSystemDriver::shutdown ( )
pure virtual

Unmounts every device and releases the driver's resources.

Implemented in OgcFileSystemDriver, and WutFileSystemDriver.


The documentation for this class was generated from the following file: