diff --git a/Makefile b/Makefile index 33ae7a2e..97f41c9e 100644 --- a/Makefile +++ b/Makefile @@ -161,7 +161,7 @@ endif ifeq ($(EXFAT),1) EE_OBJS += bdm_irx.o bdmfs_fatfs_irx.o usbmass_bd_irx.o - EE_CFLAGS += -DEXFAT + EE_CFLAGS += -DEXFAT -DBDM HAS_EXFAT = -EXFAT else EE_OBJS += usbhdfsd_irx.o diff --git a/include/launchelf.h b/include/launchelf.h index c8ff7ab9..f41d1fa7 100644 --- a/include/launchelf.h +++ b/include/launchelf.h @@ -471,7 +471,45 @@ extern int Check_ESR_Disc(void); #define USB_MASS_MAX_DRIVES 10 -extern char USB_mass_ix[10]; +enum bdmtypes { + BD_UNKNOWN = 0, + BD_USB, + BD_MX4SIO, + BD_IEEE1394, + BD_UDPBD, + BD_ATAD, + + BD_COUNT, +}; + +const char* bdmnames[BD_COUNT] { + "", + "usb", + "sdc", + "sd", + "udp", + "ata", +}; + +char* bdmpaths[BD_COUNT] { + "mass?", + "usb?:", + "mx4sio?:", + "iLink?:", + "udpbd?:", + "bdm_hdd?", +}; +int bdmpathsindx[BD_COUNT] { + 4, + 3, + 6, + 5, + 5, + 7, +}; + +extern char USB_mass_ix[USB_MASS_MAX_DRIVES]; +extern char USB_mass_bx[USB_MASS_MAX_DRIVES]; extern int USB_mass_max_drives; extern u64 USB_mass_scan_time; extern int USB_mass_scanned; diff --git a/src/filer.c b/src/filer.c index 72da7110..87a12a20 100644 --- a/src/filer.c +++ b/src/filer.c @@ -74,9 +74,6 @@ char mountedDVRPParty[MOUNT_LIMIT][MAX_NAME]; int latestDVRPMount = -1; #endif -#ifdef MX4SIO -int mx4sio_idx = -1; // To keep track of wich mass#:/ device represents MX4SIO -#endif int file_show = 1; //dlanor: 0==name_only, 1==name+size+time, 2==title+size+time int file_sort = 1; //dlanor: 0==none, 1==name, 2==title, 3==mtime @@ -170,7 +167,8 @@ typedef struct int PSU_content; //Used to count PSU content headers for the main header //USB_mass definitions for multiple drive usage -char USB_mass_ix[10] = {'0', 0, 0, 0, 0, 0, 0, 0, 0, 0}; +char USB_mass_ix[USB_MASS_MAX_DRIVES] = {'0', 0, 0, 0, 0, 0, 0, 0, 0, 0}; +char USB_mass_bx[USB_MASS_MAX_DRIVES] = {BD_UNKNOWN, BD_UNKNOWN, BD_UNKNOWN, BD_UNKNOWN, BD_UNKNOWN, BD_UNKNOWN, BD_UNKNOWN, BD_UNKNOWN, BD_UNKNOWN, BD_UNKNOWN}; int USB_mass_max_drives = USB_MASS_MAX_DRIVES; u64 USB_mass_scan_time = 0; int USB_mass_scanned = 0; //0==Not_found_OR_No_Multi 1==found_Multi_mass_once @@ -1292,36 +1290,40 @@ int readXFROM(const char *path, FILEINFO *info, int max) #endif void scan_USB_mass(void) { -#ifdef MX4SIO +#ifdef BDM static char DEVID[5]; #endif - int i, dd; + int i, dd, x; iox_stat_t chk_stat; char mass_path[8] = "mass0:/"; if ((USB_mass_max_drives < 2) //No need for dynamic lists with only one drive || (USB_mass_scanned && ((Timer() - USB_mass_scan_time) < 5000))) return; -#ifdef MX4SIO - mx4sio_idx = -1; //assume none is mx4sio // this MUST ALWAYS be after the USB_mass_scan_time check -#endif - for (i = 0; i < USB_mass_max_drives; i++) { mass_path[4] = '0' + i; +#ifdef BDM + USB_mass_bx[i] = BD_UNKNOWN; +#endif if (fileXioGetStat(mass_path, &chk_stat) < 0) { USB_mass_ix[i] = 0; continue; } -#ifdef MX4SIO +#ifdef BDM if ((dd = fileXioDopen(mass_path)) >= 0) { int *intptr_ctl = (int *)DEVID; *intptr_ctl = fileXioIoctl(dd, USBMASS_IOCTL_GET_DRIVERNAME, ""); fileXioDclose(dd); - if (!strncmp(DEVID, "sdc", 3)) - { - mx4sio_idx = i; - DPRINTF("%s: Found MX4SIO device at mass%d:/\n", __func__, i); - } + for (x = BD_USB; x < BD_COUNT; x++) + { + if (!strcmp(DEVID, bdmnames[x])) + { + USB_mass_bx[x] = i; + DPRINTF("%s: Found %s device at mass%d:/\n", __func__, bdmnames[x], i); + break; + } + } + } #endif USB_mass_ix[i] = '0' + i; @@ -4370,19 +4372,26 @@ int getFilePath(char *out, int cnfmode) else if ((file_show == 2) && files[top + i].title[0] != 0) { mcTitle = files[top + i].title; } else { //Show normal file/folder names -#ifdef MX4SIO +#ifdef BDM if (path[0] == 0) { // we are on root. apply the unique "alias" here - if ((!strncmp(files[top + i].name, "mass", 4)) // - && (files[top + i].name[4] == ('0' + mx4sio_idx) || (mx4sio_idx == 0 && files[top + i].name[4] == ':')) //index corresponds to mx4sio index, also assume that if device path index 4 is equal to ':' then it is index 0 - ) - strcpy(tmp, "mx4sio:"); + if ((!strncmp(files[top + i].name, "mass", 4))) { + int msindex = 0; + if (isdigit(files[top + i].name[4])) + msindex = files[top + i].name[4] - '0'; + + if (USB_mass_bx[msindex] > BD_UNKNOWN) { + bdmpaths[USB_mass_bx[msindex]][bdmpathsindx[USB_mass_bx[msindex]]] = '0'+msindex; + strcpy(tmp, bdmpaths[msindex]); + } else + strcpy(tmp, files[top + i].name); + } else strcpy(tmp, files[top + i].name); - } else { - strcpy(tmp, files[top + i].name); - } + } else { + strcpy(tmp, files[top + i].name); + } #else - strcpy(tmp, files[top + i].name); + strcpy(tmp, files[top + i].name); #endif if (file_show > 0) { //Does display mode include file details ? name_limit = 43 * 8;