From e6f6652e592cf4224e94fee2c25047ad76f638a3 Mon Sep 17 00:00:00 2001 From: Shaun Inman Date: Sun, 12 Feb 2023 16:30:07 -0500 Subject: [PATCH] fixes for cores without custom controls or options --- src/minarch/main.c | 71 ++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/src/minarch/main.c b/src/minarch/main.c index 1c05110..8b9bf92 100644 --- a/src/minarch/main.c +++ b/src/minarch/main.c @@ -618,6 +618,13 @@ static struct Config { [FE_OPT_COUNT] = {NULL} } }, + .core = (OptionList){ + .count = 0, + .options = (Option[]){ + {NULL}, + }, + }, + .controls = default_button_mapping, .shortcuts = (ButtonMapping[]){ [SHORTCUT_SAVE_STATE] = {"Save State", -1, BTN_ID_NONE, 0}, [SHORTCUT_LOAD_STATE] = {"Load State", -1, BTN_ID_NONE, 0}, @@ -1089,13 +1096,6 @@ static void input_poll_callback(void) { ignore_menu = 1; } - // TODO: tmp? - // if ((PAD_isPressed(BTN_L2) && PAD_justPressed(BTN_R2)) || PAD_isPressed(BTN_R2) && PAD_justPressed(BTN_L2)) { - // show_debug = !show_debug; - // config.frontend.options[FE_OPT_DEBUG].value = show_debug; // TODO: standardize this for all config.frontend? - // } - - // TODO: test fast_forward once implemented static int toggled_ff_on = 0; // this logic only works because TOGGLE_FF is before HOLD_FF in the menu... for (int i=0; ivalue = option->value; } } - Menu_options(&OptionEmulator_menu); + + // try to handle no options + // TODO: show a message + if (OptionEmulator_menu.items[0].name) { + Menu_options(&OptionEmulator_menu); + } + else { + Menu_message("This core doesn't have any options."); + } + return MENU_CALLBACK_NOP; } @@ -2911,27 +2942,7 @@ static int OptionSaveChanges_onConfirm(MenuList* list, int i) { break; } } - - GFX_setMode(MODE_MAIN); - - int dirty = 1; - while (1) { - GFX_startFrame(); - PAD_poll(); - - if (PAD_justPressed(BTN_A) || PAD_justPressed(BTN_B)) break; - - POW_update(&dirty, NULL, Menu_beforeSleep, Menu_afterSleep); - if (dirty) { - dirty = 0; - GFX_clear(screen); - GFX_blitMessage(message, screen, NULL); - GFX_blitButtonGroup((char*[]){ "A","OKAY", NULL }, screen, 1); - GFX_flip(screen); - } - else GFX_sync(); - } - GFX_setMode(MODE_MENU); + Menu_message(message); OptionSaveChanges_updateDesc(); return MENU_CALLBACK_EXIT; }