hominem_te_esse avatar hominem_te_esse committed 928dc9c

fix for the "alternate device mode" that was failing to re-read the configuration files from "mass" device

Comments (0)

Files changed (4)

 			result = submenuAppendItem(item->menu.subMenu, item->submenu.icon_id,
 					item->submenu.text, item->submenu.id, item->submenu.text_id);
 
-			if (!item->menu.menu->submenu)
+			if (!item->menu.menu->submenu) {
 				item->menu.menu->submenu = *item->menu.subMenu;
+				item->menu.menu->current = *item->menu.subMenu;
+			}
 
 			if (item->submenu.selected)
 				item->menu.menu->current = result;
 		return;
 
 	submenu_list_t *cur = selected_item->item->current;
-
 	if (cur) {
 		while (cur->next)
 			cur = cur->next; // go to end
 	if (!selected_item)
 		selected_item = menu;
 
-	if (!selected_item->item->current)
-		selected_item->item->current = selected_item->item->submenu;
-
-	submenu_list_t* cur = selected_item->item->current;
-
 	theme_element_t* elem = gTheme->mainElems.first;
 	while (elem) {
 		if (elem->drawElem)
-			elem->drawElem(selected_item, cur, NULL, elem);
+			elem->drawElem(selected_item, selected_item->item->current, NULL, elem);
 
 		elem = elem->next;
 	}
 }
 
 void menuRenderInfo() {
-	submenu_list_t* cur = selected_item->item->current;
-
 	menuRequestConfig();
 
 	theme_element_t* elem = gTheme->infoElems.first;
 	while (elem) {
 		if (elem->drawElem)
-			elem->drawElem(selected_item, cur, itemConfig, elem);
+			elem->drawElem(selected_item, selected_item->item->current, itemConfig, elem);
 
 		elem = elem->next;
 	}
 	strncpy(gExitPath, "", 32);
 	// default menu
 	gDefaultDevice = APP_MODE;
-	// autosort defaults to zero
-	gAutosort = 0;
+	gAutosort = 1;
 	gAutoRefresh = 1;
 	//Default disable debug colors
 	gDisableDebug = 0;
 	gEnableDandR = 0;
 	gRememberLastPlayed = 0;
-	gCheckUSBFragmentation = 0;
+	gCheckUSBFragmentation = 1;
 	gUSBDelay = 3;
 	strncpy(gUSBPrefix, "", 32);
 	gUseInfoScreen = 0;
 	char path[255];
 
 	for(i=0; i<5; i++) {
-		sprintf(path, "mass%d:%s/%s", i, gUSBPrefix, name);
+		if (gUSBPrefix[0] != '\0')
+			sprintf(path, "mass%d:%s/%s", i, gUSBPrefix, name);
+		else
+			sprintf(path, "mass%d:%s", i, name);
 		fd = fioOpen(path, O_RDONLY);
 
 		if(fd >= 0) {
-			sprintf(target, "mass%d:%s/", i, gUSBPrefix);
+			if (gUSBPrefix[0] != '\0')
+				sprintf(target, "mass%d:%s/", i, gUSBPrefix);
+			else
+				sprintf(target, "mass%d:", i);
 			fioClose(fd);
 			return 1;
 		}
 	}
 
 	// default to first partition (for themes, ...)
-	sprintf(target, "mass0:%s/", gUSBPrefix);
+	if (gUSBPrefix[0] != '\0')
+		sprintf(target, "mass0:%s/", gUSBPrefix);
+	else
+		sprintf(target, "mass0:");
 	return 0;
 }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.