mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-22 10:39:20 +01:00
move boot_pending vars to menu_state
works towards ability to autoload ROMs
This commit is contained in:
parent
b5f6adc1ea
commit
4eca91798c
@ -104,6 +104,12 @@ typedef struct {
|
|||||||
path_t *disk_path;
|
path_t *disk_path;
|
||||||
disk_info_t disk_info;
|
disk_info_t disk_info;
|
||||||
} load;
|
} load;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bool rom_file;
|
||||||
|
bool disk_file;
|
||||||
|
bool emulator_file;
|
||||||
|
} boot_pending;
|
||||||
} menu_t;
|
} menu_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "views.h"
|
#include "views.h"
|
||||||
|
|
||||||
|
|
||||||
static bool load_disk_file_boot_pending;
|
|
||||||
static bool load_disk_with_rom;
|
static bool load_disk_with_rom;
|
||||||
static component_boxart_t *boxart;
|
static component_boxart_t *boxart;
|
||||||
|
|
||||||
@ -31,10 +30,10 @@ static char *format_disk_region (disk_region_t region) {
|
|||||||
|
|
||||||
static void process (menu_t *menu) {
|
static void process (menu_t *menu) {
|
||||||
if (menu->actions.enter) {
|
if (menu->actions.enter) {
|
||||||
load_disk_file_boot_pending = true;
|
menu->boot_pending.disk_file = true;
|
||||||
load_disk_with_rom = false;
|
load_disk_with_rom = false;
|
||||||
} else if (menu->actions.options && menu->load.rom_path) {
|
} 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;
|
load_disk_with_rom = true;
|
||||||
sound_play_effect(SFX_SETTING);
|
sound_play_effect(SFX_SETTING);
|
||||||
} else if (menu->actions.back) {
|
} else if (menu->actions.back) {
|
||||||
@ -48,7 +47,7 @@ static void draw (menu_t *menu, surface_t *d) {
|
|||||||
|
|
||||||
component_background_draw();
|
component_background_draw();
|
||||||
|
|
||||||
if (load_disk_file_boot_pending) {
|
if (menu->boot_pending.disk_file) {
|
||||||
component_loader_draw(0.0f);
|
component_loader_draw(0.0f);
|
||||||
} else {
|
} else {
|
||||||
component_layout_draw();
|
component_layout_draw();
|
||||||
@ -163,7 +162,7 @@ void view_load_disk_init (menu_t *menu) {
|
|||||||
menu->load.disk_path = NULL;
|
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);
|
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);
|
draw(menu, display);
|
||||||
|
|
||||||
if (load_disk_file_boot_pending) {
|
if (menu->boot_pending.disk_file) {
|
||||||
load_disk_file_boot_pending = false;
|
menu->boot_pending.disk_file = false;
|
||||||
load(menu);
|
load(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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_gameboy_color_rom_extensions[] = { "gbc", NULL };
|
||||||
static const char *emu_sega_8bit_rom_extensions[] = { "sms", "gg", "sg", 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 cart_load_emu_type_t emu_type;
|
||||||
|
|
||||||
static char *format_emulator_name (cart_load_emu_type_t emulator_info) {
|
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) {
|
static void process (menu_t *menu) {
|
||||||
if (menu->actions.enter) {
|
if (menu->actions.enter) {
|
||||||
load_emulator_file_boot_pending = true;
|
menu->boot_pending.emulator_file = true;
|
||||||
} else if (menu->actions.back) {
|
} else if (menu->actions.back) {
|
||||||
sound_play_effect(SFX_EXIT);
|
sound_play_effect(SFX_EXIT);
|
||||||
menu->next_mode = MENU_MODE_BROWSER;
|
menu->next_mode = MENU_MODE_BROWSER;
|
||||||
@ -46,7 +45,7 @@ static void draw (menu_t *menu, surface_t *d) {
|
|||||||
|
|
||||||
component_background_draw();
|
component_background_draw();
|
||||||
|
|
||||||
if (load_emulator_file_boot_pending) {
|
if (menu->boot_pending.emulator_file) {
|
||||||
component_loader_draw(0.0f);
|
component_loader_draw(0.0f);
|
||||||
} else {
|
} else {
|
||||||
component_layout_draw();
|
component_layout_draw();
|
||||||
@ -107,7 +106,7 @@ static void load (menu_t *menu) {
|
|||||||
|
|
||||||
|
|
||||||
void view_load_emulator_init (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);
|
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);
|
draw(menu, display);
|
||||||
|
|
||||||
if (load_emulator_file_boot_pending) {
|
if (menu->boot_pending.emulator_file) {
|
||||||
load_emulator_file_boot_pending = false;
|
menu->boot_pending.emulator_file = false;
|
||||||
load(menu);
|
load(menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,10 +5,8 @@
|
|||||||
#include "views.h"
|
#include "views.h"
|
||||||
|
|
||||||
static bool show_extra_info_message = false;
|
static bool show_extra_info_message = false;
|
||||||
static bool load_rom_file_boot_pending;
|
|
||||||
static component_boxart_t *boxart;
|
static component_boxart_t *boxart;
|
||||||
|
|
||||||
|
|
||||||
static char *convert_error_message (rom_err_t err) {
|
static char *convert_error_message (rom_err_t err) {
|
||||||
switch (err) {
|
switch (err) {
|
||||||
case ROM_ERR_LOAD_IO: return "I/O error during loading ROM information and/or options";
|
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) {
|
if (menu->actions.enter) {
|
||||||
load_rom_file_boot_pending = true;
|
menu->boot_pending.rom_file = true;
|
||||||
} else if (menu->actions.back) {
|
} else if (menu->actions.back) {
|
||||||
sound_play_effect(SFX_EXIT);
|
sound_play_effect(SFX_EXIT);
|
||||||
menu->next_mode = MENU_MODE_BROWSER;
|
menu->next_mode = MENU_MODE_BROWSER;
|
||||||
@ -218,7 +216,7 @@ static void draw (menu_t *menu, surface_t *d) {
|
|||||||
|
|
||||||
component_background_draw();
|
component_background_draw();
|
||||||
|
|
||||||
if (load_rom_file_boot_pending) {
|
if (menu->boot_pending.rom_file) {
|
||||||
component_loader_draw(0.0f);
|
component_loader_draw(0.0f);
|
||||||
} else {
|
} else {
|
||||||
component_layout_draw();
|
component_layout_draw();
|
||||||
@ -342,7 +340,7 @@ static void deinit (void) {
|
|||||||
|
|
||||||
|
|
||||||
void view_load_rom_init (menu_t *menu) {
|
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) {
|
if (menu->load.rom_path) {
|
||||||
path_free(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);
|
draw(menu, display);
|
||||||
|
|
||||||
if (load_rom_file_boot_pending) {
|
if (menu->boot_pending.rom_file) {
|
||||||
load_rom_file_boot_pending = false;
|
menu->boot_pending.rom_file = false;
|
||||||
load(menu);
|
load(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user