Improve load_pending naming

Make their actions clear.
Works towards the ability to autoload ROMs.
This commit is contained in:
Robin Jones 2024-10-31 21:26:33 +00:00
parent 6cb3019c76
commit b5f6adc1ea
3 changed files with 24 additions and 24 deletions

View File

@ -5,8 +5,8 @@
#include "views.h"
static bool load_pending;
static bool load_rom;
static bool load_disk_file_boot_pending;
static bool load_disk_with_rom;
static component_boxart_t *boxart;
@ -31,11 +31,11 @@ static char *format_disk_region (disk_region_t region) {
static void process (menu_t *menu) {
if (menu->actions.enter) {
load_pending = true;
load_rom = false;
load_disk_file_boot_pending = true;
load_disk_with_rom = false;
} else if (menu->actions.options && menu->load.rom_path) {
load_pending = true;
load_rom = true;
load_disk_file_boot_pending = true;
load_disk_with_rom = true;
sound_play_effect(SFX_SETTING);
} else if (menu->actions.back) {
sound_play_effect(SFX_EXIT);
@ -48,7 +48,7 @@ static void draw (menu_t *menu, surface_t *d) {
component_background_draw();
if (load_pending) {
if (load_disk_file_boot_pending) {
component_loader_draw(0.0f);
} else {
component_layout_draw();
@ -119,7 +119,7 @@ static void draw_progress (float progress) {
static void load (menu_t *menu) {
cart_load_err_t err;
if (menu->load.rom_path && load_rom) {
if (menu->load.rom_path && load_disk_with_rom) {
err = cart_load_n64_rom_and_save(menu, draw_progress);
if (err != CART_LOAD_OK) {
menu_show_error(menu, cart_load_convert_error_message(err));
@ -135,7 +135,7 @@ static void load (menu_t *menu) {
menu->next_mode = MENU_MODE_BOOT;
if (load_rom) {
if (load_disk_with_rom) {
menu->boot_params->device_type = BOOT_DEVICE_TYPE_ROM;
menu->boot_params->detect_cic_seed = rom_info_get_cic_seed(&menu->load.rom_info, &menu->boot_params->cic_seed);
switch (rom_info_get_tv_type(&menu->load.rom_info)) {
@ -163,7 +163,7 @@ void view_load_disk_init (menu_t *menu) {
menu->load.disk_path = NULL;
}
load_pending = false;
load_disk_file_boot_pending = false;
menu->load.disk_path = path_clone_push(menu->browser.directory, menu->browser.entry->name);
@ -180,8 +180,8 @@ void view_load_disk_display (menu_t *menu, surface_t *display) {
draw(menu, display);
if (load_pending) {
load_pending = false;
if (load_disk_file_boot_pending) {
load_disk_file_boot_pending = false;
load(menu);
}

View File

@ -11,7 +11,7 @@ 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_pending;
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 +34,7 @@ static char *format_emulator_name (cart_load_emu_type_t emulator_info) {
static void process (menu_t *menu) {
if (menu->actions.enter) {
load_pending = true;
load_emulator_file_boot_pending = true;
} else if (menu->actions.back) {
sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
@ -46,7 +46,7 @@ static void draw (menu_t *menu, surface_t *d) {
component_background_draw();
if (load_pending) {
if (load_emulator_file_boot_pending) {
component_loader_draw(0.0f);
} else {
component_layout_draw();
@ -107,7 +107,7 @@ static void load (menu_t *menu) {
void view_load_emulator_init (menu_t *menu) {
load_pending = false;
load_emulator_file_boot_pending = false;
path_t *path = path_clone_push(menu->browser.directory, menu->browser.entry->name);
@ -133,8 +133,8 @@ void view_load_emulator_display (menu_t *menu, surface_t *display) {
draw(menu, display);
if (load_pending) {
load_pending = false;
if (load_emulator_file_boot_pending) {
load_emulator_file_boot_pending = false;
load(menu);
}
}

View File

@ -5,7 +5,7 @@
#include "views.h"
static bool show_extra_info_message = false;
static bool load_pending;
static bool load_rom_file_boot_pending;
static component_boxart_t *boxart;
@ -196,7 +196,7 @@ static void process (menu_t *menu) {
}
if (menu->actions.enter) {
load_pending = true;
load_rom_file_boot_pending = true;
} else if (menu->actions.back) {
sound_play_effect(SFX_EXIT);
menu->next_mode = MENU_MODE_BROWSER;
@ -218,7 +218,7 @@ static void draw (menu_t *menu, surface_t *d) {
component_background_draw();
if (load_pending) {
if (load_rom_file_boot_pending) {
component_loader_draw(0.0f);
} else {
component_layout_draw();
@ -342,7 +342,7 @@ static void deinit (void) {
void view_load_rom_init (menu_t *menu) {
load_pending = false;
load_rom_file_boot_pending = false;
if (menu->load.rom_path) {
path_free(menu->load.rom_path);
@ -368,8 +368,8 @@ void view_load_rom_display (menu_t *menu, surface_t *display) {
draw(menu, display);
if (load_pending) {
load_pending = false;
if (load_rom_file_boot_pending) {
load_rom_file_boot_pending = false;
load(menu);
}