mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-22 10:39:20 +01:00
Fix build
This commit is contained in:
parent
d69a0c64a9
commit
7d32254146
@ -93,6 +93,8 @@ static void menu_init (boot_params_t *boot_params) {
|
|||||||
|
|
||||||
sound_use_sfx(menu->settings.sound_enabled);
|
sound_use_sfx(menu->settings.sound_enabled);
|
||||||
|
|
||||||
|
rom_info_use_config_folder(menu->settings.use_gamepak_custom_config_folder);
|
||||||
|
|
||||||
menu->browser.directory = path_init(menu->storage_prefix, menu->settings.default_directory);
|
menu->browser.directory = path_init(menu->storage_prefix, menu->settings.default_directory);
|
||||||
if (!directory_exists(path_get(menu->browser.directory))) {
|
if (!directory_exists(path_get(menu->browser.directory))) {
|
||||||
path_free(menu->browser.directory);
|
path_free(menu->browser.directory);
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
#include <mini.c/src/mini.h>
|
#include <mini.c/src/mini.h>
|
||||||
|
|
||||||
#include "views/views.h"
|
|
||||||
|
|
||||||
#include "boot/cic.h"
|
#include "boot/cic.h"
|
||||||
#include "rom_info.h"
|
#include "rom_info.h"
|
||||||
#include "utils/fs.h"
|
#include "utils/fs.h"
|
||||||
@ -612,6 +610,19 @@ static const match_t database[] = {
|
|||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
|
||||||
|
static bool gamepak_config_folder_enabled = false;
|
||||||
|
|
||||||
|
|
||||||
|
void rom_info_use_config_folder(bool state) {
|
||||||
|
if (state) {
|
||||||
|
gamepak_config_folder_enabled = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gamepak_config_folder_enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void fix_rom_header_endianness (rom_header_t *rom_header, rom_info_t *rom_info) {
|
static void fix_rom_header_endianness (rom_header_t *rom_header, rom_info_t *rom_info) {
|
||||||
uint8_t *raw = (uint8_t *) (rom_header);
|
uint8_t *raw = (uint8_t *) (rom_header);
|
||||||
|
|
||||||
@ -809,9 +820,9 @@ static bool create_gamepak_config_subdirectory (path_t *path) {
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void load_overrides (path_t *path, rom_info_t *rom_info) {
|
static void load_rom_config_overrides (path_t *path, rom_info_t *rom_info) {
|
||||||
|
|
||||||
if ( menu->settings.use_gamepak_config_folder) {
|
if ( gamepak_config_folder_enabled ) {
|
||||||
path_push_subdir(path, GAMEPAK_CONFIG_SUBDIRECTORY);
|
path_push_subdir(path, GAMEPAK_CONFIG_SUBDIRECTORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -847,9 +858,9 @@ static void load_overrides (path_t *path, rom_info_t *rom_info) {
|
|||||||
path_free(overrides_path);
|
path_free(overrides_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
static rom_err_t save_override (path_t *path, const char *id, int value, int default_value) {
|
static rom_err_t save_rom_config_overrides (path_t *path, const char *id, int value, int default_value) {
|
||||||
|
|
||||||
if ( menu->settings.use_gamepak_config_folder) {
|
if ( gamepak_config_folder_enabled ) {
|
||||||
// if the sub dir does not exist, create it
|
// if the sub dir does not exist, create it
|
||||||
// TODO: would it be quicker to check it exists first?
|
// TODO: would it be quicker to check it exists first?
|
||||||
create_gamepak_config_subdirectory(path);
|
create_gamepak_config_subdirectory(path);
|
||||||
@ -943,7 +954,7 @@ rom_err_t rom_info_override_cic_type (path_t *path, rom_info_t *rom_info, rom_ci
|
|||||||
rom_info->override.cic = (cic_type != ROM_CIC_TYPE_AUTOMATIC);
|
rom_info->override.cic = (cic_type != ROM_CIC_TYPE_AUTOMATIC);
|
||||||
rom_info->override.cic_type = cic_type;
|
rom_info->override.cic_type = cic_type;
|
||||||
|
|
||||||
return save_override(path, "cic_type", rom_info->override.cic_type, ROM_CIC_TYPE_AUTOMATIC);
|
return save_rom_config_overrides(path, "cic_type", rom_info->override.cic_type, ROM_CIC_TYPE_AUTOMATIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
rom_save_type_t rom_info_get_save_type (rom_info_t *rom_info) {
|
rom_save_type_t rom_info_get_save_type (rom_info_t *rom_info) {
|
||||||
@ -958,7 +969,7 @@ rom_err_t rom_info_override_save_type (path_t *path, rom_info_t *rom_info, rom_s
|
|||||||
rom_info->override.save = (save_type != SAVE_TYPE_AUTOMATIC);
|
rom_info->override.save = (save_type != SAVE_TYPE_AUTOMATIC);
|
||||||
rom_info->override.save_type = save_type;
|
rom_info->override.save_type = save_type;
|
||||||
|
|
||||||
return save_override(path, "save_type", rom_info->override.save_type, SAVE_TYPE_AUTOMATIC);
|
return save_rom_config_overrides(path, "save_type", rom_info->override.save_type, SAVE_TYPE_AUTOMATIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
rom_tv_type_t rom_info_get_tv_type (rom_info_t *rom_info) {
|
rom_tv_type_t rom_info_get_tv_type (rom_info_t *rom_info) {
|
||||||
@ -973,7 +984,7 @@ rom_err_t rom_info_override_tv_type (path_t *path, rom_info_t *rom_info, rom_tv_
|
|||||||
rom_info->override.tv = (tv_type != ROM_TV_TYPE_AUTOMATIC);
|
rom_info->override.tv = (tv_type != ROM_TV_TYPE_AUTOMATIC);
|
||||||
rom_info->override.tv_type = tv_type;
|
rom_info->override.tv_type = tv_type;
|
||||||
|
|
||||||
return save_override(path, "tv_type", rom_info->override.tv_type, ROM_TV_TYPE_AUTOMATIC);
|
return save_rom_config_overrides(path, "tv_type", rom_info->override.tv_type, ROM_TV_TYPE_AUTOMATIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
rom_err_t rom_info_load (path_t *path, rom_info_t *rom_info) {
|
rom_err_t rom_info_load (path_t *path, rom_info_t *rom_info) {
|
||||||
@ -998,7 +1009,7 @@ rom_err_t rom_info_load (path_t *path, rom_info_t *rom_info) {
|
|||||||
|
|
||||||
extract_rom_info(&match, &rom_header, rom_info);
|
extract_rom_info(&match, &rom_header, rom_info);
|
||||||
|
|
||||||
load_overrides(path, rom_info);
|
load_rom_config_overrides(path, rom_info);
|
||||||
|
|
||||||
return ROM_OK;
|
return ROM_OK;
|
||||||
}
|
}
|
||||||
|
@ -237,5 +237,7 @@ rom_err_t rom_info_override_tv_type (path_t *path, rom_info_t *rom_info, rom_tv_
|
|||||||
|
|
||||||
rom_err_t rom_info_load (path_t *path, rom_info_t *rom_info);
|
rom_err_t rom_info_load (path_t *path, rom_info_t *rom_info);
|
||||||
|
|
||||||
|
void rom_info_use_config_folder(bool state);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,6 +30,7 @@ static void set_use_saves_folder_type (menu_t *menu, void *arg) {
|
|||||||
|
|
||||||
static void set_use_gamepak_custom_config_folder_type (menu_t *menu, void *arg) {
|
static void set_use_gamepak_custom_config_folder_type (menu_t *menu, void *arg) {
|
||||||
menu->settings.use_gamepak_custom_config_folder = (bool) (arg);
|
menu->settings.use_gamepak_custom_config_folder = (bool) (arg);
|
||||||
|
rom_info_use_config_folder(menu->settings.use_gamepak_custom_config_folder);
|
||||||
settings_save(&menu->settings);
|
settings_save(&menu->settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user