mirror of
https://github.com/dborth/vbagx.git
synced 2024-12-27 11:11:50 +01:00
Fixed bug (of new menu) with saves never loading and automatically being erased.
Now when you choose a game it looks for a save with "Auto" on the end to load, and if it doesn't find one, it looks for a save with nothing on the end and loads that instead.
This commit is contained in:
parent
0fcc7edce5
commit
32fe744ae7
@ -36,6 +36,8 @@ extern "C" {
|
|||||||
#include "gcunzip.h"
|
#include "gcunzip.h"
|
||||||
#include "wiiusbsupport.h"
|
#include "wiiusbsupport.h"
|
||||||
|
|
||||||
|
void AutoLoad(int method);
|
||||||
|
|
||||||
BROWSERINFO browser;
|
BROWSERINFO browser;
|
||||||
BROWSERENTRY * browserList = NULL; // list of files/folders in browser
|
BROWSERENTRY * browserList = NULL; // list of files/folders in browser
|
||||||
|
|
||||||
@ -214,7 +216,7 @@ bool MakeFilePath(char filepath[], int type, int method, char * filename, int fi
|
|||||||
if(type == FILE_SRAM) sprintf(ext, "sav");
|
if(type == FILE_SRAM) sprintf(ext, "sav");
|
||||||
else sprintf(ext, "sgm");
|
else sprintf(ext, "sgm");
|
||||||
|
|
||||||
if(filenum >= 0)
|
if(filenum >= -1)
|
||||||
{
|
{
|
||||||
if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB)
|
if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB)
|
||||||
{
|
{
|
||||||
@ -223,7 +225,9 @@ bool MakeFilePath(char filepath[], int type, int method, char * filename, int fi
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(filenum == 0)
|
if(filenum == -1)
|
||||||
|
sprintf(file, "%s.%s", filename, ext);
|
||||||
|
else if(filenum == 0)
|
||||||
sprintf(file, "%s Auto.%s", filename, ext);
|
sprintf(file, "%s Auto.%s", filename, ext);
|
||||||
else
|
else
|
||||||
sprintf(file, "%s %i.%s", filename, filenum, ext);
|
sprintf(file, "%s %i.%s", filename, filenum, ext);
|
||||||
@ -446,6 +450,8 @@ int BrowserLoadFile(int method)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
AutoLoad(method); // Load SRAM (battery backed RAM) or save state
|
||||||
|
|
||||||
ResetBrowser();
|
ResetBrowser();
|
||||||
}
|
}
|
||||||
CancelAction();
|
CancelAction();
|
||||||
|
@ -43,7 +43,7 @@ extern bool ROMLoaded;
|
|||||||
extern char szpath[MAXPATHLEN];
|
extern char szpath[MAXPATHLEN];
|
||||||
extern bool inSz;
|
extern bool inSz;
|
||||||
|
|
||||||
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 UpdateDirName(int method);
|
||||||
int OpenGameList();
|
int OpenGameList();
|
||||||
int autoLoadMethod();
|
int autoLoadMethod();
|
||||||
|
@ -534,6 +534,32 @@ void AutoSave()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* AutoLoad
|
||||||
|
*
|
||||||
|
* Automatically loads SRAM/snapshot when choosing a game from the menu
|
||||||
|
***************************************************************************/
|
||||||
|
void AutoLoad(int method)
|
||||||
|
{
|
||||||
|
if (GCSettings.AutoLoad == 1)
|
||||||
|
{
|
||||||
|
LoadBatteryOrStateAuto(method, FILE_SRAM, SILENT); // save battery
|
||||||
|
}
|
||||||
|
else if (GCSettings.AutoLoad == 2)
|
||||||
|
{
|
||||||
|
if (WindowPrompt("Load", "Load Snapshot?", "Load", "Don't Load") )
|
||||||
|
LoadBatteryOrStateAuto(method, FILE_SNAPSHOT, NOTSILENT); // save state
|
||||||
|
}
|
||||||
|
else if (GCSettings.AutoLoad == 3)
|
||||||
|
{
|
||||||
|
if (WindowPrompt("Load", "Load SRAM and Snapshot?", "Load", "Don't Load") )
|
||||||
|
{
|
||||||
|
LoadBatteryOrStateAuto(method, FILE_SRAM, NOTSILENT); // save battery
|
||||||
|
LoadBatteryOrStateAuto(method, FILE_SNAPSHOT, NOTSILENT); // save state
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* OnScreenKeyboard
|
* OnScreenKeyboard
|
||||||
*
|
*
|
||||||
|
@ -320,7 +320,13 @@ bool LoadBatteryOrStateAuto(int method, int action, bool silent)
|
|||||||
if(!MakeFilePath(filepath, action, method, ROMFilename, 0))
|
if(!MakeFilePath(filepath, action, method, ROMFilename, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return LoadBatteryOrState(filepath, method, action, silent);
|
if (action==FILE_SRAM) {
|
||||||
|
if (!LoadBatteryOrState(filepath, method, action, SILENT)) {
|
||||||
|
if(!MakeFilePath(filepath, action, method, ROMFilename, -1))
|
||||||
|
return false;
|
||||||
|
return LoadBatteryOrState(filepath, method, action, silent);
|
||||||
|
} else return true;
|
||||||
|
} else return LoadBatteryOrState(filepath, method, action, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user