diff menu.c @ 874:b6842dfb8edf

ROM is now run after being selected in menu. Initial path for menu is read from config file.
author Michael Pavone <pavone@retrodev.com>
date Sun, 08 Nov 2015 18:38:33 -0800
parents 91bf4d905eba
children 54ffba3768d6
line wrap: on
line diff
--- a/menu.c	Sun Nov 08 15:58:36 2015 -0800
+++ b/menu.c	Sun Nov 08 18:38:33 2015 -0800
@@ -58,7 +58,8 @@
 	menu_context *menu = gen->extra;
 	if (!menu) {
 		gen->extra = menu = calloc(1, sizeof(menu_context));
-		menu->curpath = strdup(get_home_dir());
+		menu->curpath = tern_find_path(config, "ui\0initial_path\0").ptrval;
+		menu->curpath = menu->curpath ? strdup(menu->curpath) : strdup(get_home_dir());
 	}
 	if (menu->state) {
 		uint32_t dst = menu->latch << 16 | value;
@@ -137,6 +138,8 @@
 		case 2: {
 			char buf[4096];
 			copy_string_from_guest(m68k, dst, buf, sizeof(buf));
+			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;