enable auto loading and renaming of SRAM saves w/o Auto appended, fix for letterboxing for PAL users

This commit is contained in:
dborth 2009-04-09 07:43:59 +00:00
parent a2f42c3fcc
commit 9a65b6c3f7
5 changed files with 42 additions and 9 deletions

View File

@ -229,7 +229,7 @@ done you can proceed to run the emulator via the Homebrew Channel.
•˜———–—––-- - —————————––––– ———–—––-- - —————————––––– ———–—––-- - ————————•
If you are upgrading from a previous version you will need to remove the
"settings.xml" file from "\apps\Snes9x GX" directory on your SD Card. If you
"settings.xml" file from "\apps\Snes9xGX" directory on your SD Card. If you
are not upgrading then don't worry about it.
The first time you run Snes9x GX it will create a new "settings.xml" file on

View File

@ -222,16 +222,30 @@ bool MakeFilePath(char filepath[], int type, int method, char * filename, int fi
if(type == FILE_SRAM) sprintf(ext, "srm");
else sprintf(ext, "frz");
if(filenum >= 0)
if(filenum >= -1)
{
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
{
if(filenum == 0)
if(filenum == -1)
sprintf(file, "%s.%s", filename, ext);
else if(filenum == 0)
sprintf(file, "%s Auto.%s", filename, ext);
else
sprintf(file, "%s %i.%s", filename, filenum, ext);

View File

@ -44,7 +44,7 @@ extern char rootdir[10];
extern unsigned long SNESROMSize;
bool MakeFilePath(char filepath[], int type, int method, char * filename = NULL, int filenum = -1);
bool MakeFilePath(char filepath[], int type, int method, char * filename = NULL, int filenum = -2);
int UpdateDirName(int method);
int OpenGameList();
int autoLoadMethod();

View File

@ -94,12 +94,31 @@ LoadSRAMAuto (int method, bool silent)
if(method == METHOD_AUTO)
return false;
char filepath[1024];
char filepath[MAXPATHLEN];
char fullpath[MAXPATHLEN];
char filepath2[MAXPATHLEN];
char fullpath2[MAXPATHLEN];
// look for Auto save file
if(!MakeFilePath(filepath, FILE_SRAM, method, Memory.ROMFilename, 0))
return false;
return LoadSRAM(filepath, method, silent);
if (LoadSRAM(filepath, method, silent))
return true;
// look for file with no number or Auto appended
if(!MakeFilePath(filepath2, FILE_SRAM, method, Memory.ROMFilename, -1))
return false;
if(LoadSRAM(filepath2, method, 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;
}
/****************************************************************************

View File

@ -589,7 +589,7 @@ InitGCVideo ()
VIDEO_Configure (vmode);
screenheight = vmode->xfbHeight;
screenheight = 480;
screenwidth = vmode->fbWidth;
// Allocate the video buffers