From 63f371a032f25a30bdcb811d888a9a730761e7b9 Mon Sep 17 00:00:00 2001 From: TheFloW Date: Tue, 19 Jun 2018 22:52:56 +0200 Subject: [PATCH] Added ability to mount xmc0: and added said partition to list --- file.c | 1 + language.c | 2 ++ language.h | 2 ++ main_context.c | 38 ++++++++++++++++++++++++++++++-------- resources/english_us.txt | 2 ++ 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/file.c b/file.c index 04d9c265..a9c69481 100644 --- a/file.c +++ b/file.c @@ -39,6 +39,7 @@ static char *devices[] = { "ux0:", "vd0:", "vs0:", + "xmc0:", "host0:", }; diff --git a/language.c b/language.c index 5a74f590..707e2bdb 100644 --- a/language.c +++ b/language.c @@ -106,6 +106,7 @@ void loadLanguage(int id) { LANGUAGE_ENTRY(REFRESH_LICENSE_DB), LANGUAGE_ENTRY(MOUNT_UMA0), LANGUAGE_ENTRY(MOUNT_IMC0), + LANGUAGE_ENTRY(MOUNT_XMC0), LANGUAGE_ENTRY(MOUNT_USB_UX0), LANGUAGE_ENTRY(UMOUNT_USB_UX0), LANGUAGE_ENTRY(MOUNT_GAMECARD_UX0), @@ -253,6 +254,7 @@ void loadLanguage(int id) { // Others LANGUAGE_ENTRY(IMC0_MOUNTED), + LANGUAGE_ENTRY(XMC0_MOUNTED), LANGUAGE_ENTRY(SAFE_MODE), LANGUAGE_ENTRY(UNSAFE_MODE), LANGUAGE_ENTRY(PLEASE_WAIT), diff --git a/language.h b/language.h index 50a00f1a..2396307a 100644 --- a/language.h +++ b/language.h @@ -65,6 +65,7 @@ enum LanguageContainer { REFRESH_LICENSE_DB, MOUNT_UMA0, MOUNT_IMC0, + MOUNT_XMC0, MOUNT_USB_UX0, UMOUNT_USB_UX0, MOUNT_GAMECARD_UX0, @@ -212,6 +213,7 @@ enum LanguageContainer { // Others IMC0_MOUNTED, + XMC0_MOUNTED, SAFE_MODE, UNSAFE_MODE, PLEASE_WAIT, diff --git a/main_context.c b/main_context.c index b0d20d4d..1ee632bf 100644 --- a/main_context.c +++ b/main_context.c @@ -38,6 +38,7 @@ enum MenuHomeEntrys { MENU_HOME_ENTRY_REFRESH_LICENSE_DB, MENU_HOME_ENTRY_MOUNT_UMA0, MENU_HOME_ENTRY_MOUNT_IMC0, + MENU_HOME_ENTRY_MOUNT_XMC0, MENU_HOME_ENTRY_MOUNT_USB_UX0, MENU_HOME_ENTRY_UMOUNT_USB_UX0, MENU_HOME_ENTRY_MOUNT_GAMECARD_UX0, @@ -45,14 +46,15 @@ enum MenuHomeEntrys { }; MenuEntry menu_home_entries[] = { - { REFRESH_LIVEAREA, 0, 0, CTX_INVISIBLE }, - { REFRESH_LICENSE_DB, 1, 0, CTX_INVISIBLE }, - { MOUNT_UMA0, 2, 0, CTX_INVISIBLE }, - { MOUNT_IMC0, 3, 0, CTX_INVISIBLE }, - { MOUNT_USB_UX0, 5, 0, CTX_INVISIBLE }, - { UMOUNT_USB_UX0, 6, 0, CTX_INVISIBLE }, - { MOUNT_GAMECARD_UX0, 8, 0, CTX_INVISIBLE }, - { UMOUNT_GAMECARD_UX0,9, 0, CTX_INVISIBLE }, + { REFRESH_LIVEAREA, 0, 0, CTX_INVISIBLE }, + { REFRESH_LICENSE_DB, 1, 0, CTX_INVISIBLE }, + { MOUNT_UMA0, 3, 0, CTX_INVISIBLE }, + { MOUNT_IMC0, 4, 0, CTX_INVISIBLE }, + { MOUNT_XMC0, 5, 0, CTX_INVISIBLE }, + { MOUNT_USB_UX0, 7, 0, CTX_INVISIBLE }, + { UMOUNT_USB_UX0, 8, 0, CTX_INVISIBLE }, + { MOUNT_GAMECARD_UX0, 10, 0, CTX_INVISIBLE }, + { UMOUNT_GAMECARD_UX0, 11, 0, CTX_INVISIBLE }, }; #define N_MENU_HOME_ENTRIES (sizeof(menu_home_entries) / sizeof(MenuEntry)) @@ -352,6 +354,10 @@ void setContextMenuHomeVisibilities() { if (!checkFileExist("sdstor0:int-lp-ign-userext") || checkFolderExist("imc0:")) menu_home_entries[MENU_HOME_ENTRY_MOUNT_IMC0].visibility = CTX_INVISIBLE; + // Invisible if already mounted or there is no Memory Card + if (!checkFileExist("sdstor0:xmc-lp-ign-userext") || checkFolderExist("xmc0:")) + menu_home_entries[MENU_HOME_ENTRY_MOUNT_XMC0].visibility = CTX_INVISIBLE; + // Go to first entry for (i = 0; i < N_MENU_HOME_ENTRIES; i++) { if (menu_home_entries[i].visibility == CTX_VISIBLE) { @@ -661,6 +667,22 @@ static int contextMenuHomeEnterCallback(int sel, void *context) { break; } + case MENU_HOME_ENTRY_MOUNT_XMC0: + { + if (is_safe_mode) { + infoDialog(language_container[EXTENDED_PERMISSIONS_REQUIRED]); + } else { + int res = vshIoMount(0xE00, NULL, 2, 0, 0, 0); + if (res < 0) + errorDialog(res); + else + infoDialog(language_container[XMC0_MOUNTED]); + refreshFileList(); + } + + break; + } + case MENU_HOME_ENTRY_MOUNT_USB_UX0: { if (mountUsbUx0() >= 0) { diff --git a/resources/english_us.txt b/resources/english_us.txt index 294ff9b7..f2ce178c 100644 --- a/resources/english_us.txt +++ b/resources/english_us.txt @@ -46,6 +46,7 @@ REFRESH_LIVEAREA = "Refresh LiveArea™" REFRESH_LICENSE_DB = "Refresh license database" MOUNT_UMA0 = "Mount uma0:" MOUNT_IMC0 = "Mount imc0:" +MOUNT_XMC0 = "Mount xmc0:" MOUNT_USB_UX0 = "Mount USB ux0:" UMOUNT_USB_UX0 = "Umount USB ux0:" MOUNT_GAMECARD_UX0 = "Mount gamecard ux0:" @@ -193,6 +194,7 @@ ADHOC_CLIENT_DECLINED = "The client has declined your request." # Others IMC0_MOUNTED = "imc0: mounted." +XMC0_MOUNTED = "xmc0: mounted." SAFE_MODE = "SAFE MODE" UNSAFE_MODE = "UNSAFE MODE" PLEASE_WAIT = "Please wait..."