mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-26 04:24:16 +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)
|
if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB)
|
||||||
{
|
{
|
||||||
filename[26] = 0; // truncate filename
|
if(filenum > 9)
|
||||||
sprintf(file, "%s%i.%s", filename, filenum, ext);
|
{
|
||||||
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -325,27 +325,22 @@ bool LoadBatteryOrStateAuto(int method, int action, bool silent)
|
|||||||
|
|
||||||
if (action==FILE_SRAM)
|
if (action==FILE_SRAM)
|
||||||
{
|
{
|
||||||
if (!LoadBatteryOrState(filepath, method, action, SILENT))
|
if (LoadBatteryOrState(filepath, method, action, SILENT))
|
||||||
{
|
return true;
|
||||||
if(!MakeFilePath(filepath2, action, method, ROMFilename, -1))
|
|
||||||
return false;
|
// look for file with no number or Auto appended
|
||||||
if(LoadBatteryOrState(filepath2, method, action, silent))
|
if(!MakeFilePath(filepath2, action, method, ROMFilename, -1))
|
||||||
{
|
return false;
|
||||||
// rename this file - append Auto
|
|
||||||
sprintf(fullpath, "%s%s", rootdir, filepath); // add device to path
|
if(LoadBatteryOrState(filepath2, method, action, silent))
|
||||||
sprintf(fullpath2, "%s%s", rootdir, filepath2); // add device to path
|
|
||||||
rename(fullpath2, fullpath); // rename file (to avoid duplicates)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
// 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 true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user