Mercurial > repos > blastem
comparison 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 |
comparison
equal
deleted
inserted
replaced
873:91bf4d905eba | 874:b6842dfb8edf |
---|---|
56 m68k_context *m68k = context; | 56 m68k_context *m68k = context; |
57 genesis_context *gen = m68k->system; | 57 genesis_context *gen = m68k->system; |
58 menu_context *menu = gen->extra; | 58 menu_context *menu = gen->extra; |
59 if (!menu) { | 59 if (!menu) { |
60 gen->extra = menu = calloc(1, sizeof(menu_context)); | 60 gen->extra = menu = calloc(1, sizeof(menu_context)); |
61 menu->curpath = strdup(get_home_dir()); | 61 menu->curpath = tern_find_path(config, "ui\0initial_path\0").ptrval; |
62 menu->curpath = menu->curpath ? strdup(menu->curpath) : strdup(get_home_dir()); | |
62 } | 63 } |
63 if (menu->state) { | 64 if (menu->state) { |
64 uint32_t dst = menu->latch << 16 | value; | 65 uint32_t dst = menu->latch << 16 | value; |
65 switch (address >> 2) | 66 switch (address >> 2) |
66 { | 67 { |
135 break; | 136 break; |
136 } | 137 } |
137 case 2: { | 138 case 2: { |
138 char buf[4096]; | 139 char buf[4096]; |
139 copy_string_from_guest(m68k, dst, buf, sizeof(buf)); | 140 copy_string_from_guest(m68k, dst, buf, sizeof(buf)); |
141 char *pieces[] = {menu->curpath, "/", buf}; | |
142 gen->next_rom = alloc_concat_m(3, pieces); | |
140 m68k->should_return = 1; | 143 m68k->should_return = 1; |
141 fprintf(stderr, "MENU: Selected ROM %s\n", buf); | 144 fprintf(stderr, "MENU: Selected ROM %s\n", buf); |
142 break; | 145 break; |
143 } | 146 } |
144 default: | 147 default: |