7#include "../FileSystemDriver.h"
8#include "WutSmbDriver.h"
9#include <mocha/disc_interface.h>
10#include "WutUsbProbe.h"
76 void pollStorageDevices(
int removedIds[MAX_STORAGE_DEVICES],
int & outRemovedCount,
bool & deviceListChanged)
override;
88 static const int slotSD = 0;
89 static const int slotUSB1 = 1;
90 static const int slotUSB2 = 2;
91 static const int slotUSB3 = 3;
92 static const int slotSMB = 4;
93 static const int slotCount = 5;
96 static const int storageSlotCount = 3;
99 static const unsigned cachePages = 512;
100 static const unsigned sectorsPerPage = 128;
103 static const int maxQuickRetries = 3;
104 static const int backoffPolls = 180;
119 int findDeviceIndex(
int deviceId)
const;
124 void refreshSmbSlot();
128 bool tryMountStorageSlot(
int slotIdx);
130 void unmountStorageSlot(
int slotIdx);
132 bool slotStillPresent(
int slotIdx);
Storage device enumeration/mount/poll backend for the SD/USB/DVD file browser.
SD: a plain WHBMountSdCard() FSA mount, done once in init().
SmbDriver * getSmb() override
bool hasRemovableStorageDevices() const override
Whether the device-checking thread should run on this platform.
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.
void shutdown() override
Unmounts every device and releases the driver's resources.
void pollStorageDevices(int removedIds[MAX_STORAGE_DEVICES], int &outRemovedCount, bool &deviceListChanged) override
Called once per device-checking thread cycle.
int enumerateStorageDevices(StorageDevice outDevices[MAX_STORAGE_DEVICES]) override
Fills outDevices (size MAX_STORAGE_DEVICES) and returns the device count.
void init() override
Initializes the driver and auto-mounts devices flagged autoMountAtStartup.
const int * getValidSaveDevices(int &outCount) const override
Devices (Device enum values, in priority order) that are offered when choosing where to save to on th...
const char * mountResultMessage(int deviceId, MountResult result) override
A short, user-displayable reason for a non-Success MountResult (eg.
bool isDevicePresent(int deviceId) const override
Lightweight, cached hardware-presence check for a single device - does NOT mount and does no invasive...
MountResult mountStorageDevice(int deviceId) override
Attempts to mount deviceId exactly once.
void invalidateStorageDevice(int deviceId) override
Marks deviceId as needing a fresh mount next time mountStorageDevice() is called, eg.
const int * getValidLoadDevices(int &outCount) const override
Devices (Device enum values, in priority order) that are offered when choosing where to load from on ...
Wii U SmbDriver built on libsmb2, registering its own smb:/ newlib devoptab.
MountResult
Result of a single mount attempt.
Description of one storage device: id, display name, mount prefix, volume label and flags such as rem...
The set of USBCLASS_STORAGE interfaces nsysuhs currently reports across every controller_num probed.
State tracker for a single storage device slot.
int id
Device enum value (DEVICE_SD, DEVICE_USB, ...)
char name[16]
human-readable base name, eg.
bool isMounted
A filesystem is currently mounted on this slot.
char volumeLabel[16]
volume label, best-effort - empty if none could be read
bool labelFetched
volume label already looked up since the last mount/removal - see getVolumeLabel()
char stablePrefix[32]
same string as prefix, but set once in init() and never cleared on unmount - this device's identity f...
bool unmountRequired
The slot was removed or invalidated and must be unmounted before the next mount attempt.
char prefix[32]
devoptab mount prefix, eg.
bool isPresent
found on the last poll
One USB mass-storage slot as Cafe OS/Mocha actually exposes it: just a DISC_INTERFACE handed to libdv...
int failCount
consecutive mount failures since the last success or hardware change - see tryMountStorageSlot()
int backoffPollsLeft
polls left to skip before the next probe attempt (0 = probe now)
const DISC_INTERFACE * iface
&Mocha_usb1_disc_interface .
const char * mountName
devoptab basename, eg.