diff menu.c @ 875:54ffba3768d6

Make menu stuff work on Android (theoretically)
author Michael Pavone <pavone@retrodev.com>
date Sun, 08 Nov 2015 22:03:34 -0800
parents b6842dfb8edf
children 75453bf2ffac
line wrap: on
line diff
--- a/menu.c	Sun Nov 08 18:38:33 2015 -0800
+++ b/menu.c	Sun Nov 08 22:03:34 2015 -0800
@@ -59,7 +59,15 @@
 	if (!menu) {
 		gen->extra = menu = calloc(1, sizeof(menu_context));
 		menu->curpath = tern_find_path(config, "ui\0initial_path\0").ptrval;
-		menu->curpath = menu->curpath ? strdup(menu->curpath) : strdup(get_home_dir());
+		if (menu->curpath) {
+			menu->curpath = strdup(menu->curpath);
+		} else {
+#ifdef __ANDROID__
+			menu->curpath = strdup(SDL_AndroidGetExternalStoragePath());
+#else
+			menu->curpath = strdup(get_home_dir());
+#endif
+		}
 	}
 	if (menu->state) {
 		uint32_t dst = menu->latch << 16 | value;
@@ -141,7 +149,6 @@
 			char *pieces[] = {menu->curpath, "/", buf};
 			gen->next_rom = alloc_concat_m(3, pieces);
 			m68k->should_return = 1;
-			fprintf(stderr, "MENU: Selected ROM %s\n", buf);
 			break;
 		}
 		default: