Shared GameCube/Wii FileSystemDriver base: FAT slot enumeration, mounting and polling. More...
#include <OgcFileSystemDriver.h>
Public Member Functions | |
| void | shutdown () override |
| Unmounts every device and releases the driver's resources. | |
| int | enumerateStorageDevices (StorageDevice outDevices[MAX_STORAGE_DEVICES]) override |
| Fills outDevices (size MAX_STORAGE_DEVICES) and returns the device count. | |
| MountResult | mountStorageDevice (int deviceId) override |
| Attempts to mount deviceId exactly once. | |
| const char * | mountResultMessage (int deviceId, MountResult result) override |
| A short, user-displayable reason for a non-Success MountResult (eg. | |
| void | invalidateStorageDevice (int deviceId) override |
| Marks deviceId as needing a fresh mount next time mountStorageDevice() is called, eg. | |
| void | pollStorageDevices (int removedIds[MAX_STORAGE_DEVICES], int &outRemovedCount, bool &deviceListChanged) override |
| Called once per device-checking thread cycle. | |
| bool | hasRemovableStorageDevices () const override |
| Whether the device-checking thread should run on this platform. | |
| bool | isDevicePresent (int deviceId) const override |
| Lightweight, cached hardware-presence check for a single device - does NOT mount and does no invasive I/O. | |
| const char * | getDevicePrefix (int device) const override |
| The devoptab prefix this device would use (eg. | |
| const char * | getMountPath (int device) const override |
| devoptab-style mount path for device (eg. | |
| SmbDriver * | getSmb () override |
Public Member Functions inherited from FileSystemDriver | |
| virtual void | init ()=0 |
| Initializes the driver and auto-mounts devices flagged autoMountAtStartup. | |
| 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. | |
Protected Member Functions | |
| void | initFatSlotsAndAutoMount () |
| Runs the shared boot-time pass: probe every pollable fatSlots[] entry once for isPresentCache, then auto-mount whatever enumerateStorageDevices() marks autoMountAtStartup. | |
| virtual void | shutdownPlatform () |
| Platform-specific extra teardown beyond the shared per-slot fatUnmount() pass (eg. | |
| virtual bool | pollPlatformExtra () |
| Platform-specific extra polling that must run before the shared per-slot presence check (eg. | |
| virtual void | prepareMount (int deviceId) |
| Platform-specific work that must run immediately before a user-initiated mount attempt on deviceId, so the attempt sees current hardware topology instead of whatever the last poll cycle happened to observe. | |
| MountResult | mountFAT (int deviceId) |
| Mounts the FAT filesystem on a slot with fatMountSimple(), unmounting first if unmountRequired is set. | |
| MountResult | mountDVD () |
| Mounts the DVD as ISO9660 if a disc is inserted. | |
| MountResult | attemptFatMount (int deviceId) |
| Single mountFAT() attempt that also records the outcome in mountFailed. | |
| const OgcFatSlotDescriptor * | findFatSlot (int deviceId) const |
Protected Attributes | |
| const OgcFatSlotDescriptor * | fatSlots = nullptr |
| Table of FAT slots this platform supports; set by the concrete driver. | |
| int | fatSlotCount = 0 |
| Number of entries in fatSlots. | |
| DISC_INTERFACE * | dvdDisc = nullptr |
| Disc interface used to mount the DVD drive, or nullptr if the platform has none. | |
| const char * | unsupportedFormatMessage = "Unsupported format." |
| Text returned by mountResultMessage() when a present device fails to mount. | |
| bool | isMounted [MAX_STORAGE_DEVICES] = { false } |
| A filesystem is currently mounted for this device. | |
| bool | unmountRequired [MAX_STORAGE_DEVICES] = { false } |
| A stale mount must be torn down before the next mount attempt. | |
| bool | isPresentCache [MAX_STORAGE_DEVICES] = { false } |
| raw hardware insertion only - see isDevicePresent()'s comment for why this is no longer what it returns | |
| bool | mountFailed [MAX_STORAGE_DEVICES] = { false } |
| set by a real MountFailed; cleared on removal/reinsertion - see attemptFatMount() | |
| bool | labelFetched [MAX_STORAGE_DEVICES] = { false } |
| fetched since the last mount/removal - see mountFAT()/invalidateStorageDevice() | |
| char | volumeLabel [MAX_STORAGE_DEVICES][16] = { { 0 } } |
| Volume label cached for each device. | |
| OgcSmbDriver | smbDriver |
| The network-share driver returned by getSmb() | |
Shared GameCube/Wii FileSystemDriver base: FAT slot enumeration, mounting and polling.
DVD is deliberately never probed while polling.
Definition at line 39 of file OgcFileSystemDriver.h.
|
protected |
Single mountFAT() attempt that also records the outcome in mountFailed.
Definition at line 167 of file OgcFileSystemDriver.cpp.
|
overridevirtual |
Fills outDevices (size MAX_STORAGE_DEVICES) and returns the device count.
Implements FileSystemDriver.
Definition at line 56 of file OgcFileSystemDriver.cpp.
|
protected |
Definition at line 13 of file OgcFileSystemDriver.cpp.
|
overridevirtual |
The devoptab prefix this device would use (eg.
"usb:/"), regardless of whether it is currently mounted.
Implements FileSystemDriver.
Definition at line 290 of file OgcFileSystemDriver.cpp.
|
overridevirtual |
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.
Implements FileSystemDriver.
Definition at line 305 of file OgcFileSystemDriver.cpp.
|
inlineoverridevirtual |
Implements FileSystemDriver.
Definition at line 55 of file OgcFileSystemDriver.h.
|
inlineoverridevirtual |
Whether the device-checking thread should run on this platform.
Implements FileSystemDriver.
Definition at line 49 of file OgcFileSystemDriver.h.
|
protected |
Runs the shared boot-time pass: probe every pollable fatSlots[] entry once for isPresentCache, then auto-mount whatever enumerateStorageDevices() marks autoMountAtStartup.
Definition at line 21 of file OgcFileSystemDriver.cpp.
|
overridevirtual |
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.
Implements FileSystemDriver.
Definition at line 213 of file OgcFileSystemDriver.cpp.
|
overridevirtual |
Lightweight, cached hardware-presence check for a single device - does NOT mount and does no invasive I/O.
Backed by whatever pollStorageDevices() last observed
Implements FileSystemDriver.
Definition at line 275 of file OgcFileSystemDriver.cpp.
|
protected |
Mounts the DVD as ISO9660 if a disc is inserted.
Definition at line 137 of file OgcFileSystemDriver.cpp.
|
protected |
Mounts the FAT filesystem on a slot with fatMountSimple(), unmounting first if unmountRequired is set.
Definition at line 91 of file OgcFileSystemDriver.cpp.
|
overridevirtual |
A short, user-displayable reason for a non-Success MountResult (eg.
"SD card not found!"). Never returns nullptr.
Implements FileSystemDriver.
Definition at line 198 of file OgcFileSystemDriver.cpp.
|
overridevirtual |
Attempts to mount deviceId exactly once.
No retry, no prompts, no-ops (returns Success) if already mounted.
Implements FileSystemDriver.
Definition at line 174 of file OgcFileSystemDriver.cpp.
|
inlineprotectedvirtual |
Platform-specific extra polling that must run before the shared per-slot presence check (eg.
Wii's WiiUsbMulti::scan(), which re-resolves which physical interface each USB slot's getDisc() currently points at). Returns true if this alone constitutes a device-list change. No-op/false by default.
Reimplemented in WiiFileSystemDriver.
Definition at line 81 of file OgcFileSystemDriver.h.
|
overridevirtual |
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.
Implements FileSystemDriver.
Definition at line 234 of file OgcFileSystemDriver.cpp.
|
inlineprotectedvirtual |
Platform-specific work that must run immediately before a user-initiated mount attempt on deviceId, so the attempt sees current hardware topology instead of whatever the last poll cycle happened to observe.
Reimplemented in WiiFileSystemDriver.
Definition at line 87 of file OgcFileSystemDriver.h.
|
overridevirtual |
Unmounts every device and releases the driver's resources.
Implements FileSystemDriver.
Definition at line 42 of file OgcFileSystemDriver.cpp.
|
inlineprotectedvirtual |
Platform-specific extra teardown beyond the shared per-slot fatUnmount() pass (eg.
Wii's WiiUsbMulti/USBStorage/DI_Close()).
Reimplemented in WiiFileSystemDriver.
Definition at line 74 of file OgcFileSystemDriver.h.
|
protected |
Disc interface used to mount the DVD drive, or nullptr if the platform has none.
Definition at line 63 of file OgcFileSystemDriver.h.
|
protected |
Number of entries in fatSlots.
Definition at line 61 of file OgcFileSystemDriver.h.
|
protected |
Table of FAT slots this platform supports; set by the concrete driver.
Definition at line 59 of file OgcFileSystemDriver.h.
|
protected |
A filesystem is currently mounted for this device.
Definition at line 99 of file OgcFileSystemDriver.h.
|
protected |
raw hardware insertion only - see isDevicePresent()'s comment for why this is no longer what it returns
Definition at line 101 of file OgcFileSystemDriver.h.
|
protected |
fetched since the last mount/removal - see mountFAT()/invalidateStorageDevice()
Definition at line 103 of file OgcFileSystemDriver.h.
|
protected |
set by a real MountFailed; cleared on removal/reinsertion - see attemptFatMount()
Definition at line 102 of file OgcFileSystemDriver.h.
|
protected |
The network-share driver returned by getSmb()
Definition at line 107 of file OgcFileSystemDriver.h.
|
protected |
A stale mount must be torn down before the next mount attempt.
Definition at line 100 of file OgcFileSystemDriver.h.
|
protected |
Text returned by mountResultMessage() when a present device fails to mount.
Definition at line 65 of file OgcFileSystemDriver.h.
|
protected |
Volume label cached for each device.
Definition at line 104 of file OgcFileSystemDriver.h.