Skip to content

Commit

Permalink
gui-allegro: Fix ROM menu not updating after a model change.
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Fosdick committed May 20, 2019
1 parent 371fba4 commit 555abd9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/gui-allegro.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ static ALLEGRO_MENU *create_rom_menu(void)
menu = al_create_menu();
for (slot = ROM_NSLOT-1; slot >= 0; slot--) {
gen_rom_label(slot, label);
log_debug("gui-allegro: create_rom_menu, slot %d label %s", slot, label);
sub = al_create_menu();
al_append_menu_item(sub, "Load...", menu_id_num(IDM_ROMS_LOAD, slot), 0, NULL, NULL);
al_append_menu_item(sub, "Clear", menu_id_num(IDM_ROMS_CLEAR, slot), 0, NULL, NULL);
Expand All @@ -237,6 +236,18 @@ static ALLEGRO_MENU *create_rom_menu(void)
return menu;
}

static void update_rom_menu(void)
{
ALLEGRO_MENU *menu = rom_menu;
int slot;
char label[ROM_LABEL_LEN];

for (slot = ROM_NSLOT-1; slot >= 0; slot--) {
gen_rom_label(slot, label);
al_set_menu_item_caption(menu, slot-ROM_NSLOT+1, label);
}
}

static ALLEGRO_MENU *create_model_menu(void)
{
ALLEGRO_MENU *menu = al_create_menu();
Expand Down Expand Up @@ -856,6 +867,7 @@ static void change_model(ALLEGRO_EVENT *event)
oldmodel = curmodel;
curmodel = menu_get_num(event);
main_restart();
update_rom_menu();
}

static void change_tube(ALLEGRO_EVENT *event)
Expand Down

0 comments on commit 555abd9

Please sign in to comment.