mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-27 21:14:21 +01:00
use srm file without "auto", if found
This commit is contained in:
parent
bb3ed94c1b
commit
6b870179cf
@ -45,7 +45,6 @@
|
|||||||
#include "snes9xGX.h"
|
#include "snes9xGX.h"
|
||||||
#include "networkop.h"
|
#include "networkop.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "s9xconfig.h"
|
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "sram.h"
|
#include "sram.h"
|
||||||
|
@ -34,7 +34,7 @@ LoadSRAM (char * filepath, bool silent)
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
int device;
|
int device;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if(!FindDevice(filepath, &device))
|
if(!FindDevice(filepath, &device))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -70,7 +70,6 @@ bool
|
|||||||
LoadSRAMAuto (bool silent)
|
LoadSRAMAuto (bool silent)
|
||||||
{
|
{
|
||||||
char filepath[MAXPATHLEN];
|
char filepath[MAXPATHLEN];
|
||||||
char filepath2[MAXPATHLEN];
|
|
||||||
|
|
||||||
// look for Auto save file
|
// look for Auto save file
|
||||||
if(!MakeFilePath(filepath, FILE_SRAM, Memory.ROMFilename, 0))
|
if(!MakeFilePath(filepath, FILE_SRAM, Memory.ROMFilename, 0))
|
||||||
@ -80,15 +79,12 @@ LoadSRAMAuto (bool silent)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
// look for file with no number or Auto appended
|
// look for file with no number or Auto appended
|
||||||
if(!MakeFilePath(filepath2, FILE_SRAM, Memory.ROMFilename, -1))
|
if(!MakeFilePath(filepath, FILE_SRAM, Memory.ROMFilename, -1))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(LoadSRAM(filepath2, silent))
|
if(LoadSRAM(filepath, silent))
|
||||||
{
|
|
||||||
// rename this file - append Auto
|
|
||||||
rename(filepath2, filepath); // rename file (to avoid duplicates)
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,9 +137,22 @@ SaveSRAMAuto (bool silent)
|
|||||||
{
|
{
|
||||||
char filepath[1024];
|
char filepath[1024];
|
||||||
|
|
||||||
if(!MakeFilePath(filepath, FILE_SRAM, Memory.ROMFilename, 0))
|
// look for file with no number or Auto appended
|
||||||
|
if(!MakeFilePath(filepath, FILE_SRAM, Memory.ROMFilename, -1))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
FILE * fp = fopen (filepath, "rb");
|
||||||
|
|
||||||
|
if(fp) // file found
|
||||||
|
{
|
||||||
|
fclose (fp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!MakeFilePath(filepath, FILE_SRAM, Memory.ROMFilename, 0))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return SaveSRAM(filepath, silent);
|
return SaveSRAM(filepath, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user