mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-25 03:56:54 +01:00
Add settings (not used yet).
Improve comments for ED64 saves.
This commit is contained in:
parent
8b3d092ac6
commit
db7809d812
@ -13,6 +13,14 @@
|
||||
#include "ed64.h"
|
||||
|
||||
|
||||
// #include "../menu/settings.h"
|
||||
|
||||
// // This is a trial hack before using the settings API.
|
||||
// #ifndef LAST_ROM_FILE_PATH
|
||||
// #define LAST_ROM_FILE_PATH "/ed64/last_rom.txt"
|
||||
// #endif
|
||||
|
||||
|
||||
extern int ed_exit(void);
|
||||
|
||||
static flashcart_err_t ed64_init (void) {
|
||||
@ -22,9 +30,26 @@ static flashcart_err_t ed64_init (void) {
|
||||
// FIXME: Update firmware if needed.
|
||||
// FIXME: Enable RTC if available.
|
||||
|
||||
// FIXME: retrive a config file from (probably SRAM) that might have been set.
|
||||
// FIXME: Retrive a config file from the SD card that might have been set.
|
||||
// This should include the location of the ROM and its save type.
|
||||
// Then, if it is valid, perform a save.
|
||||
// FIL lrp_fil;
|
||||
// UINT lrp_br;
|
||||
|
||||
// if (f_open(&lrp_fil, LAST_ROM_PATH_FILE, FA_READ) != FR_OK) {
|
||||
// return FLASHCART_ERR_LOAD;
|
||||
// }
|
||||
|
||||
// if (f_read(&lrp_fil, lrp_path, 1024, &lrp_br) != FR_OK) {
|
||||
// f_close(&lrp_fil);
|
||||
// return FLASHCART_ERR_LOAD;
|
||||
// }
|
||||
|
||||
// if (f_close(&lrp_fil) != FR_OK) {
|
||||
// return FLASHCART_ERR_LOAD;
|
||||
// }
|
||||
|
||||
// Now save the content back to the SD!
|
||||
|
||||
return FLASHCART_OK;
|
||||
}
|
||||
@ -52,10 +77,6 @@ static flashcart_err_t ed64_load_rom (char *rom_path, flashcart_progress_callbac
|
||||
return FLASHCART_ERR_LOAD;
|
||||
}
|
||||
|
||||
// FIXME: set the required actions for retriving the save file later (probably SRAM).
|
||||
// This would involve creating some content in an area of RAM that would include
|
||||
// the ROM location and its save type. This information will be used on init to perform a "save writeback".
|
||||
|
||||
fix_file_size(&fil);
|
||||
|
||||
size_t rom_size = f_size(&fil);
|
||||
@ -90,6 +111,26 @@ static flashcart_err_t ed64_load_rom (char *rom_path, flashcart_progress_callbac
|
||||
return FLASHCART_ERR_LOAD;
|
||||
}
|
||||
|
||||
|
||||
// Set the required actions for retriving the save file later.
|
||||
// Given there is no good place in RAM...
|
||||
// This would involve creating some content to a file on the SD card that includes:
|
||||
// the ROM name and location and possibly its save type. This information will be used on init to perform a "save writeback".
|
||||
// Actually, we should be using the settings API, so this is just a trial hack.
|
||||
// FIL lrp_fil;
|
||||
// UINT lrp_bw;
|
||||
|
||||
// if (f_open(&lrp_fil, LAST_ROM_FILE_PATH, FA_CREATE_ALWAYS) != FR_OK) {
|
||||
// return FLASHCART_ERR_LOAD;
|
||||
// }
|
||||
// if (f_write(&lrp_fil, rom_path, strlen(rom_path) + 1, &lrp_bw) != FR_OK) {
|
||||
// f_close(&lrp_fil);
|
||||
// return FLASHCART_ERR_LOAD;
|
||||
// }
|
||||
// if (f_close(&lrp_fil) != FR_OK) {
|
||||
// return FLASHCART_ERR_LOAD;
|
||||
// }
|
||||
|
||||
return FLASHCART_OK;
|
||||
}
|
||||
|
||||
|
@ -14,10 +14,14 @@ static settings_t init = {
|
||||
.default_directory = "/",
|
||||
.use_saves_folder = true,
|
||||
|
||||
/* flashcart specific feature flags */
|
||||
.last_rom_path = "/",
|
||||
|
||||
/* Beta feature flags */
|
||||
.bgm_enabled = false,
|
||||
.sound_enabled = false,
|
||||
.rumble_enabled = true,
|
||||
.auto_firmware_update_enabled = false,
|
||||
};
|
||||
|
||||
|
||||
@ -32,11 +36,16 @@ void settings_load (settings_t *settings) {
|
||||
settings->hidden_files_enabled = mini_get_bool(ini, "menu", "show_hidden_files", init.hidden_files_enabled);
|
||||
settings->default_directory = strdup(mini_get_string(ini, "menu", "default_directory", init.default_directory));
|
||||
settings->use_saves_folder = mini_get_bool(ini, "menu", "use_saves_folder", init.use_saves_folder);
|
||||
|
||||
/* flashcart specific feature flags */
|
||||
settings->last_rom_path = strdup(mini_get_string(ini, "menu", "last_rom_path", init.last_rom_path));
|
||||
|
||||
|
||||
/* 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);
|
||||
settings->sound_enabled = mini_get_bool(ini, "menu_beta_flag", "sound_enabled", init.sound_enabled);
|
||||
settings->rumble_enabled = mini_get_bool(ini, "menu_beta_flag", "rumble_enabled", init.rumble_enabled);
|
||||
settings->auto_firmware_update_enabled = mini_get_bool(ini, "menu_beta_flag", "auto_firmware_update_enabled", init.auto_firmware_update_enabled);
|
||||
|
||||
|
||||
mini_free(ini);
|
||||
@ -49,11 +58,15 @@ void settings_save (settings_t *settings) {
|
||||
mini_set_bool(ini, "menu", "show_hidden_files", settings->hidden_files_enabled);
|
||||
mini_set_string(ini, "menu", "default_directory", settings->default_directory);
|
||||
mini_set_bool(ini, "menu", "use_saves_folder", settings->use_saves_folder);
|
||||
|
||||
/* flashcart specific feature flags */
|
||||
mini_set_string(ini, "menu", "last_rom_path", init.last_rom_path);
|
||||
|
||||
/* Beta feature flags, they should not save until production ready! */
|
||||
// mini_set_bool(ini, "menu_beta_flag", "bgm_enabled", init.bgm_enabled);
|
||||
// mini_set_bool(ini, "menu_beta_flag", "sound_enabled", init.sound_enabled);
|
||||
// mini_set_bool(ini, "menu_beta_flag", "rumble_enabled", init.rumble_enabled);
|
||||
// mini_set_bool(ini, "menu_beta_flag", "auto_firmware_update_enabled", init.auto_firmware_update_enabled);
|
||||
|
||||
mini_save(ini);
|
||||
|
||||
|
@ -31,6 +31,12 @@ typedef struct {
|
||||
/** @brief Enable rumble feedback */
|
||||
bool rumble_enabled;
|
||||
|
||||
/** @brief filepath of last ROM (for save writeback emulation if required) */
|
||||
char *last_rom_path;
|
||||
|
||||
/** @brief Enable auto firmware updates */
|
||||
bool auto_firmware_update_enabled;
|
||||
|
||||
} settings_t;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user