diff --git a/src/menu/settings.c b/src/menu/settings.c index f600ad42..b935301b 100644 --- a/src/menu/settings.c +++ b/src/menu/settings.c @@ -15,11 +15,11 @@ static settings_t init = { .use_saves_folder = true, .sound_enabled = true, .rom_autoload_enabled = false, + .disk_autoload_enabled = false, .rom_autoload_path = "", .disk_autoload_path = "", .rom_autoload_filename = "", .disk_autoload_filename = "", - .autoload_disk_uses_rom = false, /* Beta feature flags (should always init to off) */ .bgm_enabled = false, @@ -48,11 +48,11 @@ void settings_load (settings_t *settings) { settings->sound_enabled = mini_get_bool(ini, "menu", "sound_enabled", init.sound_enabled); settings->rom_autoload_enabled = mini_get_bool(ini, "menu", "autoload_rom_enabled", init.rom_autoload_enabled); + settings->disk_autoload_enabled = mini_get_bool(ini, "menu", "autoload_rom_enabled", init.rom_autoload_enabled); settings->rom_autoload_path = strdup(mini_get_string(ini, "autoload", "rom_path", init.rom_autoload_path)); settings->disk_autoload_path = strdup(mini_get_string(ini, "autoload", "disk_path", init.disk_autoload_path)); settings->rom_autoload_filename = strdup(mini_get_string(ini, "autoload", "rom_filename", init.rom_autoload_filename)); settings->disk_autoload_filename = strdup(mini_get_string(ini, "autoload", "disk_filename", init.disk_autoload_filename)); - settings->autoload_disk_uses_rom = mini_get_bool(ini, "autoload", "disk_uses_rom", init.autoload_disk_uses_rom); /* Beta feature flags, they might not be in the file */ settings->bgm_enabled = mini_get_bool(ini, "menu_beta_flag", "bgm_enabled", init.bgm_enabled); @@ -70,11 +70,11 @@ void settings_save (settings_t *settings) { mini_set_bool(ini, "menu", "use_saves_folder", settings->use_saves_folder); mini_set_bool(ini, "menu", "sound_enabled", settings->sound_enabled); mini_set_bool(ini, "menu", "autoload_rom_enabled", settings->rom_autoload_enabled); + mini_set_bool(ini, "menu", "autoload_disk_enabled", settings->disk_autoload_enabled); mini_set_string(ini, "autoload", "rom_path", settings->rom_autoload_path); mini_set_string(ini, "autoload", "disk_path", settings->disk_autoload_path); mini_set_string(ini, "autoload", "rom_filename", settings->rom_autoload_filename); mini_set_string(ini, "autoload", "disk_filename", settings->disk_autoload_filename); - mini_set_bool(ini, "autoload", "disk_uses_rom", settings->autoload_disk_uses_rom); /* Beta feature flags, they should not save until production ready! */ // mini_set_bool(ini, "menu_beta_flag", "bgm_enabled", settings->bgm_enabled); diff --git a/src/menu/settings.h b/src/menu/settings.h index 6ce34af4..40c66f85 100644 --- a/src/menu/settings.h +++ b/src/menu/settings.h @@ -34,6 +34,9 @@ typedef struct { /** @brief Enable the ability to bypass the menu and instantly load a ROM */ bool rom_autoload_enabled; + /** @brief Enable the ability to bypass the menu and instantly load a Disk (with ROM if also enabled) */ + bool disk_autoload_enabled; + /** @brief A path to the autoloaded ROM */ char *rom_autoload_path; @@ -46,9 +49,6 @@ typedef struct { /** @brief A filename of the autoloaded DD image */ char *disk_autoload_filename; - /** @brief Load a DD image with a ROM compatible with expansion */ - bool autoload_disk_uses_rom; - } settings_t; diff --git a/src/menu/views/load_disk.c b/src/menu/views/load_disk.c index 026cbc79..414fdfd1 100644 --- a/src/menu/views/load_disk.c +++ b/src/menu/views/load_disk.c @@ -35,7 +35,7 @@ static void set_autoload_type (menu_t *menu, void *arg) { free(menu->settings.disk_autoload_filename); menu->settings.disk_autoload_filename = strdup(menu->browser.entry->name); // FIXME: add a confirmation box here! (press start on reboot) - menu->settings.rom_autoload_enabled = true; + menu->settings.disk_autoload_enabled = true; settings_save(&menu->settings); menu->browser.reload = true; } diff --git a/src/menu/views/startup.c b/src/menu/views/startup.c index c12a9045..61d73c0c 100644 --- a/src/menu/views/startup.c +++ b/src/menu/views/startup.c @@ -14,10 +14,13 @@ void view_startup_init (menu_t *menu) { joypad_poll(); joypad_buttons_t b_held = joypad_get_buttons_held(port); - if (menu->settings.rom_autoload_enabled && b_held.start) { + if ((menu->settings.rom_autoload_enabled || menu->settings.disk_autoload_enabled) && b_held.start) { menu->settings.rom_autoload_enabled = false; + menu->settings.disk_autoload_enabled = false; menu->settings.rom_autoload_path = ""; + menu->settings.disk_autoload_path = ""; menu->settings.rom_autoload_filename = ""; + menu->settings.disk_autoload_filename = ""; settings_save(&menu->settings); } } @@ -29,6 +32,14 @@ void view_startup_init (menu_t *menu) { return; } + else if (menu->settings.disk_autoload_enabled) { + 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; + menu->next_mode = MENU_MODE_LOAD_DISK; + + return; + } menu->next_mode = MENU_MODE_BROWSER; }