Mercurial > repos > blastem
changeset 1487:6a35815cc409 nuklear_ui
Enable lock-on in Nuklear UI
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 26 Nov 2017 20:17:22 -0800 |
parents | a6881d0d76d0 |
children | f29bd94ffa76 |
files | blastem.c nuklear_ui/blastem_nuklear.c |
diffstat | 2 files changed, 24 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/blastem.c Sun Nov 26 19:22:09 2017 -0800 +++ b/blastem.c Sun Nov 26 20:17:22 2017 -0800 @@ -562,7 +562,9 @@ current_system = menu_system; menu = 1; } - current_system->resume_context(current_system); + if (!current_system->next_rom) { + current_system->resume_context(current_system); + } } else { break; }
--- a/nuklear_ui/blastem_nuklear.c Sun Nov 26 19:22:09 2017 -0800 +++ b/nuklear_ui/blastem_nuklear.c Sun Nov 26 20:17:22 2017 -0800 @@ -23,7 +23,7 @@ } -void view_load(struct nk_context *context) +void view_file_browser(struct nk_context *context, uint8_t normal_open) { static char *current_path; static dir_entry *entries; @@ -79,11 +79,16 @@ free_dir_list(entries, num_entries); entries = NULL; } else { - if (current_system) { - current_system->next_rom = full_path; - current_system->request_exit(current_system); + if(normal_open) { + if (current_system) { + current_system->next_rom = full_path; + current_system->request_exit(current_system); + } else { + init_system_with_media(full_path, SYSTEM_UNKNOWN); + free(full_path); + } } else { - init_system_with_media(full_path, SYSTEM_UNKNOWN); + lockon_media(full_path); free(full_path); } current_view = view_play; @@ -93,6 +98,16 @@ } } +void view_load(struct nk_context *context) +{ + view_file_browser(context, 1); +} + +void view_lock_on(struct nk_context *context) +{ + view_file_browser(context, 0); +} + void view_about(struct nk_context *context) { } @@ -191,6 +206,7 @@ static menu_item items[] = { {"Resume", view_play}, {"Load ROM", view_load}, + {"Lock On", view_lock_on}, {"Save State", view_save_state}, {"Load State", view_load_state}, {"Exit", NULL}