Skip to content

Commit 5f6d7a8

Browse files
committed
(WiiU) Support WFS-formatted USB drives
Some users like to use native-format drives to store their data alongside Wii U games. Use libmocha to support this. Note Mocha_MountFS claims success even if the mounted folder doesn't exist.
1 parent 4405bc4 commit 5f6d7a8

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

frontend/drivers/platform_wiiu.c

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
#define WIIU_VOL_CONTENT_PATH "fs:/vol/content/"
8484
#define WIIU_SD_FAT_PATH "sd:/"
8585
#define WIIU_USB_FAT_PATH "usb:/"
86+
#define WIIU_USB_WFS_PATH "storage_usb:/"
8687

8788
/**
8889
* The Wii U frontend driver, along with the main() method.
@@ -92,6 +93,7 @@
9293
static enum frontend_fork wiiu_fork_mode = FRONTEND_FORK_NONE;
9394
static bool have_libfat_usb = false;
9495
static bool have_libfat_sdcard = false;
96+
static bool have_wfs_usb = false;
9597
#endif
9698
static bool in_exec = false;
9799

@@ -244,6 +246,12 @@ static int frontend_wiiu_parse_drive_list(void *data, bool load_content)
244246
enum_idx,
245247
FILE_TYPE_DIRECTORY, 0, 0, NULL);
246248

249+
if (have_wfs_usb)
250+
menu_entries_append(list, WIIU_USB_WFS_PATH,
251+
msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR),
252+
enum_idx,
253+
FILE_TYPE_DIRECTORY, 0, 0, NULL);
254+
247255
#endif
248256
return 0;
249257
}
@@ -672,27 +680,42 @@ static void main_loop(void)
672680

673681
static void init_filesystems(void)
674682
{
675-
#if defined(HAVE_LIBMOCHA) && defined(HAVE_LIBFAT)
683+
#if defined(HAVE_LIBMOCHA)
676684
if (Mocha_InitLibrary() == MOCHA_RESULT_SUCCESS)
677685
{
686+
if (Mocha_MountFS("storage_usb", NULL, "/vol/storage_usb01") == MOCHA_RESULT_SUCCESS) {
687+
if (exists(WIIU_USB_WFS_PATH))
688+
have_wfs_usb = true;
689+
else /* Liar! */
690+
Mocha_UnmountFS("storage_usb");
691+
}
692+
693+
694+
#if defined(HAVE_LIBFAT)
678695
have_libfat_usb = fatMount("usb", &Mocha_usb_disc_interface, 0, 512, 128);
679696
/* Mounting SD card with libfat is unsafe under Aroma */
680697
if (!in_aroma)
681698
have_libfat_sdcard = fatMount("sd", &Mocha_sdio_disc_interface, 0, 512, 128);
699+
#endif /* HAVE_LIBFAT */
682700
}
683-
#endif
701+
#endif /* HAVE_LIBMOCHA */
684702
}
685703

686704
static void deinit_filesystems(void)
687705
{
688-
#if defined(HAVE_LIBMOCHA) && defined(HAVE_LIBFAT)
706+
#if defined(HAVE_LIBMOCHA)
707+
if (have_wfs_usb)
708+
Mocha_UnmountFS("storage_usb");
709+
710+
#if defined(HAVE_LIBFAT)
689711
if (have_libfat_usb)
690712
fatUnmount("usb");
691713
if (have_libfat_sdcard)
692714
fatUnmount("sd");
715+
#endif /* HAVE_LIBFAT */
693716

694717
Mocha_DeInitLibrary();
695-
#endif
718+
#endif /* HAVE_LIBMOCHA */
696719
}
697720

698721
static devoptab_t dotab_stdout =

0 commit comments

Comments
 (0)