mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-22 10:39:18 +01:00
fix memory card saves
This commit is contained in:
parent
993a3eb00f
commit
e0f60f7ba6
@ -218,8 +218,20 @@ bool MakeFilePath(char filepath[], int type, int method, char * filename, int fi
|
||||
{
|
||||
if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB)
|
||||
{
|
||||
filename[26] = 0; // truncate filename
|
||||
sprintf(file, "%s%i.%s", filename, filenum, ext);
|
||||
if(filenum > 9)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(filenum == -1)
|
||||
{
|
||||
filename[27] = 0; // truncate filename
|
||||
sprintf(file, "%s.%s", filename, ext);
|
||||
}
|
||||
else
|
||||
{
|
||||
filename[26] = 0; // truncate filename
|
||||
sprintf(file, "%s%i.%s", filename, filenum, ext);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -325,27 +325,22 @@ bool LoadBatteryOrStateAuto(int method, int action, bool silent)
|
||||
|
||||
if (action==FILE_SRAM)
|
||||
{
|
||||
if (!LoadBatteryOrState(filepath, method, action, SILENT))
|
||||
{
|
||||
if(!MakeFilePath(filepath2, action, method, ROMFilename, -1))
|
||||
return false;
|
||||
if(LoadBatteryOrState(filepath2, method, action, silent))
|
||||
{
|
||||
// rename this file - append Auto
|
||||
sprintf(fullpath, "%s%s", rootdir, filepath); // add device to path
|
||||
sprintf(fullpath2, "%s%s", rootdir, filepath2); // add device to path
|
||||
rename(fullpath2, fullpath); // rename file (to avoid duplicates)
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (LoadBatteryOrState(filepath, method, action, SILENT))
|
||||
return true;
|
||||
|
||||
// look for file with no number or Auto appended
|
||||
if(!MakeFilePath(filepath2, action, method, ROMFilename, -1))
|
||||
return false;
|
||||
|
||||
if(LoadBatteryOrState(filepath2, method, action, silent))
|
||||
{
|
||||
// rename this file - append Auto
|
||||
sprintf(fullpath, "%s%s", rootdir, filepath); // add device to path
|
||||
sprintf(fullpath2, "%s%s", rootdir, filepath2); // add device to path
|
||||
rename(fullpath2, fullpath); // rename file (to avoid duplicates)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user