diff --git a/src/menu/menu_state.h b/src/menu/menu_state.h index 0d6aa459..eaeb83ec 100644 --- a/src/menu/menu_state.h +++ b/src/menu/menu_state.h @@ -104,6 +104,12 @@ typedef struct { path_t *disk_path; disk_info_t disk_info; } load; + + struct { + bool rom_file; + bool disk_file; + bool emulator_file; + } boot_pending; } menu_t; diff --git a/src/menu/views/load_disk.c b/src/menu/views/load_disk.c index 580401eb..781ebe27 100644 --- a/src/menu/views/load_disk.c +++ b/src/menu/views/load_disk.c @@ -5,7 +5,6 @@ #include "views.h" -static bool load_disk_file_boot_pending; static bool load_disk_with_rom; static component_boxart_t *boxart; @@ -31,10 +30,10 @@ static char *format_disk_region (disk_region_t region) { static void process (menu_t *menu) { if (menu->actions.enter) { - load_disk_file_boot_pending = true; + menu->boot_pending.disk_file = true; load_disk_with_rom = false; } else if (menu->actions.options && menu->load.rom_path) { - load_disk_file_boot_pending = true; + menu->boot_pending.disk_file = true; load_disk_with_rom = true; sound_play_effect(SFX_SETTING); } else if (menu->actions.back) { @@ -48,7 +47,7 @@ static void draw (menu_t *menu, surface_t *d) { component_background_draw(); - if (load_disk_file_boot_pending) { + if (menu->boot_pending.disk_file) { component_loader_draw(0.0f); } else { component_layout_draw(); @@ -163,7 +162,7 @@ void view_load_disk_init (menu_t *menu) { menu->load.disk_path = NULL; } - load_disk_file_boot_pending = false; + menu->boot_pending.disk_file = false; menu->load.disk_path = path_clone_push(menu->browser.directory, menu->browser.entry->name); @@ -180,8 +179,8 @@ void view_load_disk_display (menu_t *menu, surface_t *display) { draw(menu, display); - if (load_disk_file_boot_pending) { - load_disk_file_boot_pending = false; + if (menu->boot_pending.disk_file) { + menu->boot_pending.disk_file = false; load(menu); } diff --git a/src/menu/views/load_emulator.c b/src/menu/views/load_emulator.c index 5b13ba24..3a131722 100644 --- a/src/menu/views/load_emulator.c +++ b/src/menu/views/load_emulator.c @@ -11,7 +11,6 @@ static const char *emu_gameboy_rom_extensions[] = { "gb", NULL }; static const char *emu_gameboy_color_rom_extensions[] = { "gbc", NULL }; static const char *emu_sega_8bit_rom_extensions[] = { "sms", "gg", "sg", NULL }; -static bool load_emulator_file_boot_pending; static cart_load_emu_type_t emu_type; static char *format_emulator_name (cart_load_emu_type_t emulator_info) { @@ -34,7 +33,7 @@ static char *format_emulator_name (cart_load_emu_type_t emulator_info) { static void process (menu_t *menu) { if (menu->actions.enter) { - load_emulator_file_boot_pending = true; + menu->boot_pending.emulator_file = true; } else if (menu->actions.back) { sound_play_effect(SFX_EXIT); menu->next_mode = MENU_MODE_BROWSER; @@ -46,7 +45,7 @@ static void draw (menu_t *menu, surface_t *d) { component_background_draw(); - if (load_emulator_file_boot_pending) { + if (menu->boot_pending.emulator_file) { component_loader_draw(0.0f); } else { component_layout_draw(); @@ -107,7 +106,7 @@ static void load (menu_t *menu) { void view_load_emulator_init (menu_t *menu) { - load_emulator_file_boot_pending = false; + menu->boot_pending.emulator_file = false; path_t *path = path_clone_push(menu->browser.directory, menu->browser.entry->name); @@ -133,8 +132,8 @@ void view_load_emulator_display (menu_t *menu, surface_t *display) { draw(menu, display); - if (load_emulator_file_boot_pending) { - load_emulator_file_boot_pending = false; + if (menu->boot_pending.emulator_file) { + menu->boot_pending.emulator_file = false; load(menu); } } diff --git a/src/menu/views/load_rom.c b/src/menu/views/load_rom.c index ef2d26bd..1e8c4dc1 100644 --- a/src/menu/views/load_rom.c +++ b/src/menu/views/load_rom.c @@ -5,10 +5,8 @@ #include "views.h" static bool show_extra_info_message = false; -static bool load_rom_file_boot_pending; static component_boxart_t *boxart; - static char *convert_error_message (rom_err_t err) { switch (err) { case ROM_ERR_LOAD_IO: return "I/O error during loading ROM information and/or options"; @@ -196,7 +194,7 @@ static void process (menu_t *menu) { } if (menu->actions.enter) { - load_rom_file_boot_pending = true; + menu->boot_pending.rom_file = true; } else if (menu->actions.back) { sound_play_effect(SFX_EXIT); menu->next_mode = MENU_MODE_BROWSER; @@ -218,7 +216,7 @@ static void draw (menu_t *menu, surface_t *d) { component_background_draw(); - if (load_rom_file_boot_pending) { + if (menu->boot_pending.rom_file) { component_loader_draw(0.0f); } else { component_layout_draw(); @@ -342,7 +340,7 @@ static void deinit (void) { void view_load_rom_init (menu_t *menu) { - load_rom_file_boot_pending = false; + menu->boot_pending.rom_file = false; if (menu->load.rom_path) { path_free(menu->load.rom_path); @@ -368,8 +366,8 @@ void view_load_rom_display (menu_t *menu, surface_t *display) { draw(menu, display); - if (load_rom_file_boot_pending) { - load_rom_file_boot_pending = false; + if (menu->boot_pending.rom_file) { + menu->boot_pending.rom_file = false; load(menu); }