mirror of
https://github.com/Polprzewodnikowy/N64FlashcartMenu.git
synced 2024-11-25 03:56:54 +01:00
Improve error conditions
This commit is contained in:
parent
d677712b51
commit
a5d9f7d069
@ -31,10 +31,10 @@ static flashcart_err_t ed64_init (void) {
|
|||||||
|
|
||||||
ed64_state_load(¤t_state);
|
ed64_state_load(¤t_state);
|
||||||
|
|
||||||
if (current_state.is_warm_start == true) {
|
if (current_state.is_expecting_save_writeback == true) {
|
||||||
|
|
||||||
// make sure next boot doesnt trigger the check changing its state.
|
// make sure next boot doesnt trigger the check changing its state.
|
||||||
current_state.is_warm_start = false;
|
current_state.is_expecting_save_writeback = false;
|
||||||
ed64_state_save(¤t_state);
|
ed64_state_save(¤t_state);
|
||||||
|
|
||||||
// Now save the content back to the SD card!
|
// Now save the content back to the SD card!
|
||||||
@ -75,6 +75,8 @@ static flashcart_err_t ed64_init (void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
current_state.is_expecting_save_writeback = false;
|
||||||
|
current_state.is_fram_save_type = false;
|
||||||
current_state.last_save_path = "";
|
current_state.last_save_path = "";
|
||||||
ed64_state_save(¤t_state);
|
ed64_state_save(¤t_state);
|
||||||
}
|
}
|
||||||
@ -214,6 +216,8 @@ static flashcart_err_t ed64_load_save (char *save_path) {
|
|||||||
return FLASHCART_ERR_LOAD;
|
return FLASHCART_ERR_LOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
current_state.is_fram_save_type = false;
|
||||||
|
|
||||||
ed64_save_type_t type = ed64_ll_get_save_type();
|
ed64_save_type_t type = ed64_ll_get_save_type();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SAVE_TYPE_EEPROM_4K:
|
case SAVE_TYPE_EEPROM_4K:
|
||||||
@ -237,7 +241,7 @@ static flashcart_err_t ed64_load_save (char *save_path) {
|
|||||||
|
|
||||||
|
|
||||||
current_state.last_save_path = save_path;
|
current_state.last_save_path = save_path;
|
||||||
current_state.is_warm_start = true;
|
current_state.is_expecting_save_writeback = true;
|
||||||
ed64_state_save(¤t_state);
|
ed64_state_save(¤t_state);
|
||||||
|
|
||||||
return FLASHCART_OK;
|
return FLASHCART_OK;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static ed64_pseudo_writeback_t init = {
|
static ed64_pseudo_writeback_t init = {
|
||||||
.is_warm_start = false,
|
.is_expecting_save_writeback = false,
|
||||||
.is_fram_save_type = false,
|
.is_fram_save_type = false,
|
||||||
.last_save_path = ""
|
.last_save_path = ""
|
||||||
};
|
};
|
||||||
@ -22,7 +22,7 @@ void ed64_state_load (ed64_pseudo_writeback_t *state) {
|
|||||||
|
|
||||||
mini_t *ini = mini_try_load(ED64_STATE_FILE_PATH);
|
mini_t *ini = mini_try_load(ED64_STATE_FILE_PATH);
|
||||||
|
|
||||||
state->is_warm_start = mini_get_bool(ini, "ed64", "is_warm_start", init.is_warm_start);
|
state->is_expecting_save_writeback = mini_get_bool(ini, "ed64", "is_expecting_save_writeback", init.is_expecting_save_writeback);
|
||||||
state->is_fram_save_type = mini_get_bool(ini, "ed64", "is_fram_save_type", init.is_fram_save_type);
|
state->is_fram_save_type = mini_get_bool(ini, "ed64", "is_fram_save_type", init.is_fram_save_type);
|
||||||
state->last_save_path = strdup(mini_get_string(ini, "ed64", "last_save_path", init.last_save_path));
|
state->last_save_path = strdup(mini_get_string(ini, "ed64", "last_save_path", init.last_save_path));
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ void ed64_state_load (ed64_pseudo_writeback_t *state) {
|
|||||||
void ed64_state_save (ed64_pseudo_writeback_t *state) {
|
void ed64_state_save (ed64_pseudo_writeback_t *state) {
|
||||||
mini_t *ini = mini_create(ED64_STATE_FILE_PATH);
|
mini_t *ini = mini_create(ED64_STATE_FILE_PATH);
|
||||||
|
|
||||||
mini_set_bool(ini, "ed64", "is_warm_start", state->is_warm_start);
|
mini_set_bool(ini, "ed64", "is_expecting_save_writeback", state->is_expecting_save_writeback);
|
||||||
mini_set_bool(ini, "ed64", "is_fram_save_type", state->is_fram_save_type);
|
mini_set_bool(ini, "ed64", "is_fram_save_type", state->is_fram_save_type);
|
||||||
mini_set_string(ini, "ed64", "last_save_path", state->last_save_path);
|
mini_set_string(ini, "ed64", "last_save_path", state->last_save_path);
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
/** @brief ED64 Pseudo Writeback Structure */
|
/** @brief ED64 Pseudo Writeback Structure */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** @brief The reset button was used */
|
/** @brief The reset button was used */
|
||||||
bool is_warm_start;
|
bool is_expecting_save_writeback;
|
||||||
/** @brief The last save type was flash ram */
|
/** @brief The last save type was flash ram */
|
||||||
bool is_fram_save_type;
|
bool is_fram_save_type;
|
||||||
/** @brief The path to the last loaded ROM */
|
/** @brief The path to the last loaded ROM */
|
||||||
|
Loading…
Reference in New Issue
Block a user