1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-12-22 16:42:11 +00:00

ums: implement umsUnmountDevice

Other changes include:

* libs: update libusbhsfs to latest commit
* nxdt_rw_poc: fix UMS device unmounting, change output XCI naming scheme.
This commit is contained in:
Pablo Curiel 2023-06-29 00:12:51 +02:00
parent af0db8b0ee
commit 3071cee3bd
4 changed files with 23 additions and 4 deletions

View file

@ -31,7 +31,7 @@
#define BLOCK_SIZE USB_TRANSFER_BUFFER_SIZE
#define WAIT_TIME_LIMIT 30
#define OUTDIR "nxdt_rw_poc"
#define OUTDIR APP_TITLE
/* Type definitions. */
@ -1322,7 +1322,7 @@ int main(int argc, char *argv[])
} else
if ((btn_down & HidNpadButton_X) && g_umsDeviceCount)
{
for(u32 i = 0; i < g_umsDeviceCount; i++) usbHsFsUnmountDevice(&(g_umsDevices[i]), false);
for(u32 i = 0; i < g_umsDeviceCount; i++) umsUnmountDevice(&(g_umsDevices[i]));
updateStorageList();
} else
if (((btn_down & (HidNpadButton_L)) || (btn_held & HidNpadButton_ZL)) && (cur_menu->id == MenuId_NSP || cur_menu->id == MenuId_Ticket || cur_menu->id == MenuId_Nca) && title_info->previous)
@ -2223,7 +2223,7 @@ static bool saveGameCardImage(void *userdata)
consolePrint("gamecard size (with key area): 0x%lX\n", gc_size);
}
snprintf(path, MAX_ELEMENTS(path), " (%s) (%s) (%s).xci", prepend_key_area ? "keyarea" : "keyarealess", keep_certificate ? "cert" : "certless", trim_dump ? "trimmed" : "untrimmed");
snprintf(path, MAX_ELEMENTS(path), " [%s][%s][%s].xci", prepend_key_area ? "KA" : "NKA", keep_certificate ? "C" : "NC", trim_dump ? "T" : "NT");
filename = generateOutputGameCardFileName("Gamecard", path, true);
if (!filename) goto end;

View file

@ -43,6 +43,10 @@ bool umsIsDeviceInfoUpdated(void);
/// Returns NULL if an error occurs.
UsbHsFsDevice *umsGetDevices(u32 *out_count);
/// Unmounts a USB Mass Storage device using a UsbHsFsDevice element.
/// If successful, USB Mass Storage device info will be automatically reloaded, and the next call to umsIsDeviceInfoUpdated() shall return true.
bool umsUnmountDevice(const UsbHsFsDevice *device);
#ifdef __cplusplus
}
#endif

@ -1 +1 @@
Subproject commit 68da93049d85e890c7388f4fc14805dedf55af94
Subproject commit 972bddf8967e801569d809b776a8d1c9acb606c2

View file

@ -109,6 +109,21 @@ UsbHsFsDevice *umsGetDevices(u32 *out_count)
return devices;
}
bool umsUnmountDevice(const UsbHsFsDevice *device)
{
if (!device)
{
LOG_MSG_ERROR("Invalid parameters!");
return false;
}
/* Unmount USB Mass Storage device. If successful, let libusbhsfs automatically call our populate callback. */
bool ret = usbHsFsUnmountDevice(device, true);
if (!ret) LOG_MSG_ERROR("Failed to unmount UMS device \"%s\"!", device->name);
return ret;
}
static void umsFreeDeviceData(void)
{
/* Free devices buffer. */