Skip to content

Commit

Permalink
move load_disk_with_rom to menu_state
Browse files Browse the repository at this point in the history
allows better use.
  • Loading branch information
networkfusion committed Dec 4, 2024
1 parent b70729c commit 46806cb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/menu/menu_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ typedef struct {
rom_info_t rom_info;
path_t *disk_path;
disk_info_t disk_info;
bool combined_disk_rom;
} load;

struct {
Expand Down
9 changes: 4 additions & 5 deletions src/menu/views/load_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "utils/fs.h"


static bool load_disk_with_rom;
static component_boxart_t *boxart;


Expand Down Expand Up @@ -42,7 +41,7 @@ static void set_autoload_type (menu_t *menu, void *arg) {

static void set_load_with_rom_type(menu_t *menu, void *arg) {
menu->boot_pending.disk_file = true;
load_disk_with_rom = true;
menu->load.combined_disk_rom = true;
}

static component_context_menu_t options_context_menu = { .list = {
Expand All @@ -55,7 +54,7 @@ static component_context_menu_t options_context_menu = { .list = {
static void process (menu_t *menu) {
if (menu->actions.enter) {
menu->boot_pending.disk_file = true;
load_disk_with_rom = false;
menu->load.combined_disk_rom = false;
} else if (menu->actions.options) {
ui_components_context_menu_show(&options_context_menu);
sound_play_effect(SFX_SETTING);
Expand Down Expand Up @@ -151,7 +150,7 @@ static void load (menu_t *menu) {
return;
}

if (menu->load.rom_path && load_disk_with_rom) {
if (menu->load.rom_path && menu->load.combined_disk_rom) {
// FIXME: if the ROM is not a DD expansion ROM, it will just load the ROM. We need to check and warn!
// something involving: menu->load.rom_info.game_code[0] != 'C' or 'E' or homebrew ...
err = cart_load_n64_rom_and_save(menu, draw_progress);
Expand All @@ -163,7 +162,7 @@ static void load (menu_t *menu) {

menu->next_mode = MENU_MODE_BOOT;

if (load_disk_with_rom) {
if (menu->load.combined_disk_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)) {
Expand Down
5 changes: 5 additions & 0 deletions src/menu/views/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ void view_startup_init (menu_t *menu) {
menu->browser.directory = path_init(menu->storage_prefix, menu->settings.disk_autoload_path);
menu->load.disk_path = path_clone_push(menu->browser.directory, menu->settings.disk_autoload_filename);
menu->boot_pending.disk_file = true;
if (menu->settings.rom_autoload_enabled) {
menu->browser.directory = path_init(menu->storage_prefix, menu->settings.rom_autoload_path);
menu->load.rom_path = path_clone_push(menu->browser.directory, menu->settings.rom_autoload_filename);
menu->load.combined_disk_rom = true;
}
menu->next_mode = MENU_MODE_LOAD_DISK;

return;
Expand Down

0 comments on commit 46806cb

Please sign in to comment.