Minor comment improvements and fixes

This commit is contained in:
Robin Jones 2024-05-01 22:16:52 +01:00
parent 7e2b503ee5
commit 57dba3d73d

View File

@ -34,14 +34,14 @@ static flashcart_err_t ed64_init (void) {
// older everdrives cannot save during gameplay so we need to the reset method. // older everdrives cannot save during gameplay so we need to the reset method.
// works by checking if a file exists. // works by checking if a file exists.
// FIXME: should put the file in the OS dir, but different if a clone (ED64P). // FIXME: should put the file in the OS dir (ED64_OS_DIRECTORY), but different if a clone (ED64P).
char *state_path = "sd:/menu/"ED64_STATE_FILE; char *state_path = "sd:/menu/"ED64_STATE_FILE;
ed64_state_init(state_path); ed64_state_init(state_path);
ed64_state_load(&current_state); ed64_state_load(&current_state);
if (current_state.is_expecting_save_writeback == true) { if (current_state.is_expecting_save_writeback == true) {
// make sure next boot doesnt trigger the check changing its state. // make sure next boot does not trigger the check changing its state.
current_state.is_expecting_save_writeback = false; current_state.is_expecting_save_writeback = false;
ed64_state_save(&current_state); ed64_state_save(&current_state);
@ -55,7 +55,7 @@ static flashcart_err_t ed64_init (void) {
int save_size = file_get_size(current_state.last_save_path); int save_size = file_get_size(current_state.last_save_path);
if ((f_open(&fil, strip_fs_prefix(current_state.last_save_path), FA_CREATE_ALWAYS | FA_READ | FA_WRITE)) != FR_OK) { if ((f_open(&fil, strip_fs_prefix(current_state.last_save_path), FA_CREATE_ALWAYS | FA_WRITE)) != FR_OK) {
return FLASHCART_ERR_LOAD; return FLASHCART_ERR_LOAD;
} }
@ -94,6 +94,8 @@ static flashcart_err_t ed64_init (void) {
static flashcart_err_t ed64_deinit (void) { static flashcart_err_t ed64_deinit (void) {
// save the state file.
ed64_state_save(&current_state);
// For the moment, just use libCart exit. // For the moment, just use libCart exit.
ed_exit(); ed_exit();
@ -223,7 +225,6 @@ static flashcart_err_t ed64_load_save (char *save_path) {
UINT br; UINT br;
if (f_open(&fil, strip_fs_prefix(save_path), FA_READ) != FR_OK) { if (f_open(&fil, strip_fs_prefix(save_path), FA_READ) != FR_OK) {
f_close(&fil);
return FLASHCART_ERR_LOAD; return FLASHCART_ERR_LOAD;
} }