forgot some important pipes!

This commit is contained in:
Robin Jones 2017-10-20 17:28:40 +01:00
parent a73b73c3d5
commit d4dd1f5595
2 changed files with 66 additions and 58 deletions

View File

@ -1091,7 +1091,7 @@ void loadgbrom(display_context_t disp, u8 *buff)
FRESULT result;
FIL file;
UINT bytesread;
result = f_open(&file, gb_sram_file, FA_OPEN_ALWAYS);
result = f_open(&file, gb_sram_file, FA_WRITE | FA_OPEN_ALWAYS);
if (result == FR_OK)
{
@ -1556,7 +1556,7 @@ int backupSaveData(display_context_t disp)
FRESULT result;
FIL file;
UINT bytesread;
result = f_open(&file, config_file_path, FA_OPEN_ALWAYS);
result = f_open(&file, config_file_path, FA_READ | FA_WRITE | FA_OPEN_ALWAYS);
if (result == FR_OK)
{
@ -1573,11 +1573,17 @@ int backupSaveData(display_context_t disp)
&bytesread /* [OUT] Number of bytes read */
);
TRACEF(disp, "FAT_ReadFile returned: %i", result);
if (bytesread > 0)
{
//split in save type and cart-id
save_format = cfg_data[0];
int last_cic = cfg_data[1];
scopy(cfg_data + 2, rom_filename); //string copy
TRACE(disp, "copied last played game string");
//set savetype to 0 disable for next boot
if (save_format != 0)
{
@ -1622,15 +1628,16 @@ int backupSaveData(display_context_t disp)
}
}
}
else //TODO: check required! I am pretty sure it is not!
else
{
TRACE(disp, "No previous ROM loaded - the file 'last.crt' was not found!");
TRACE(disp, "No previous ROM loaded!");
printText("...ready", 3, -1, disp);
return 0;
}
}
//reset with save request
if (save_after_reboot)
@ -1723,7 +1730,7 @@ int saveTypeToSd(display_context_t disp, char *rom_name, int stype)
FRESULT result;
FIL file;
UINT bytesread;
result = f_open(&file, fname, FA_OPEN_ALWAYS); //Could use FA_CREATE_ALWAYS but this could lead to the posibility of the file being emptied
result = f_open(&file, fname, FA_WRITE | FA_OPEN_ALWAYS); //Could use FA_CREATE_ALWAYS but this could lead to the posibility of the file being emptied
if (result == FR_OK)
{
@ -1855,11 +1862,11 @@ void initFilesystem(void)
FRESULT result = f_mount(fs,"",1);
if(result != FR_OK)
{
fat_initialized = 1;
//printText("mount error", 11, -1, disp);
}
else
{
//printText("mount error", 11, -1, disp);
fat_initialized = 1;
}
fatInitRam();
@ -2232,7 +2239,7 @@ void bootRom(display_context_t disp, int silent)
FRESULT result;
FIL file;
result = f_open(&file, cfg_file, FA_OPEN_ALWAYS);
result = f_open(&file, cfg_file, FA_WRITE | FA_OPEN_ALWAYS);
if (result == FR_OK)
{
@ -3121,7 +3128,7 @@ void loadFile(display_context_t disp)
FRESULT result;
FIL file;
UINT bytesread;
result = f_open(&file, "/ED64/LASTROM.CFG", FA_OPEN_ALWAYS);
result = f_open(&file, "/ED64/LASTROM.CFG", FA_WRITE | FA_OPEN_ALWAYS);
if (result == FR_OK)
{
@ -4111,7 +4118,7 @@ void handleInput(display_context_t disp, sprite_t *contr)
FRESULT result;
FIL file;
result = f_open(&file, rom_cfg_file, FA_OPEN_ALWAYS);
result = f_open(&file, rom_cfg_file, FA_WRITE | FA_OPEN_ALWAYS);
if (result == FR_OK)
{

View File

@ -8,6 +8,7 @@
#include <string.h>
#include <stdio.h>
#include "types.h"
#include "mempak.h"
#include "memorypak.h"
#include "ff.h"
#include "menu.h"
@ -413,7 +414,7 @@ void mpk_to_file(display_context_t disp, char *mpk_filename, int quick)
FRESULT result;
FIL file;
result = f_open(&file, buff, FA_OPEN_ALWAYS);
result = f_open(&file, buff, FA_WRITE | FA_OPEN_ALWAYS);
if (result == FR_OK)
{