diff --git a/src/flashcart/ed64/ed64.c b/src/flashcart/ed64/ed64.c index 626e1e2a..fe02f682 100644 --- a/src/flashcart/ed64/ed64.c +++ b/src/flashcart/ed64/ed64.c @@ -34,14 +34,14 @@ static flashcart_err_t ed64_init (void) { // older everdrives cannot save during gameplay so we need to the reset method. // 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; ed64_state_init(state_path); ed64_state_load(¤t_state); 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; ed64_state_save(¤t_state); @@ -55,7 +55,7 @@ static flashcart_err_t ed64_init (void) { 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; } @@ -94,6 +94,8 @@ static flashcart_err_t ed64_init (void) { static flashcart_err_t ed64_deinit (void) { + // save the state file. + ed64_state_save(¤t_state); // For the moment, just use libCart exit. ed_exit(); @@ -223,7 +225,6 @@ static flashcart_err_t ed64_load_save (char *save_path) { UINT br; if (f_open(&fil, strip_fs_prefix(save_path), FA_READ) != FR_OK) { - f_close(&fil); return FLASHCART_ERR_LOAD; }