minor bugfixes

This commit is contained in:
dborth 2009-04-09 07:49:28 +00:00
parent 734a557da5
commit cfbbe9a21d
7 changed files with 72 additions and 21 deletions

View File

@ -53,15 +53,18 @@ extern uint8 FDSBIOS[8192];
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
}
unsigned char * nesrom = NULL;
static uint8 *xbsave=NULL;
static int fskipc = 0;
static int videoReset = 0;
static int currentMode = 0;
static int ResetRequested = 0;
int ConfigRequested = 0;
int ShutdownRequested = 0;
int ResetRequested = 0;
int ExitRequested = 0;
char appPath[1024];
FreeTypeGX *fontSystem;
uint8 *xbsave=NULL;
int frameskip = 0;
unsigned char * nesrom = NULL;
/****************************************************************************
* Shutdown / Reboot / Exit
@ -274,6 +277,8 @@ int main(int argc, char *argv[])
else
MainMenu(MENU_GAME);
videoReset = -1;
currentMode = GCSettings.render;
ConfigRequested = 0;
SwitchAudioMode(0);
@ -286,7 +291,7 @@ int main(int argc, char *argv[])
setFrameTimer(); // set frametimer method before emulation
SetPalette();
static int fskipc=0;
fskipc=0;
while(1) // emulation loop
{
@ -313,10 +318,21 @@ int main(int argc, char *argv[])
}
if(ConfigRequested)
{
TakeScreenshot();
ResetVideo_Menu();
ConfigRequested = 0;
break; // leave emulation loop
if((GCSettings.render != 0 && videoReset == -1) || videoReset == 0)
{
TakeScreenshot();
ResetVideo_Menu();
ConfigRequested = 0;
GCSettings.render = currentMode;
break; // leave emulation loop
}
else if(videoReset == -1)
{
GCSettings.render = 2;
videoReset = 2;
ResetVideo_Emu();
}
videoReset--;
}
} // emulation loop
} // main loop

View File

@ -182,10 +182,29 @@ LoadRAMAuto (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_RAM, method, romFilename, 0))
return false;
return LoadRAM(filepath, method, silent);
if (LoadRAM(filepath, method, silent))
return true;
// look for file with no number or Auto appended
if(!MakeFilePath(filepath2, action, method, romFilename, -1))
return false;
if(LoadRAM(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

@ -211,16 +211,30 @@ bool MakeFilePath(char filepath[], int type, int method, char * filename, int fi
if(type == FILE_RAM) sprintf(ext, "sav");
else sprintf(ext, "fcs");
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);
@ -394,8 +408,11 @@ int BrowserLoadSz(int method)
return 0;
// add device to filepath
sprintf(filepath, "%s%s", rootdir, szpath);
memcpy(szpath, filepath, MAXPATHLEN);
if(method != METHOD_DVD)
{
sprintf(filepath, "%s%s", rootdir, szpath);
memcpy(szpath, filepath, MAXPATHLEN);
}
int szfiles = SzParse(szpath, method);
if(szfiles)

View File

@ -42,7 +42,7 @@ extern char rootdir[10];
extern char romFilename[];
extern int nesGameType;
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

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

View File

@ -609,8 +609,7 @@ static void OnScreenKeyboard(char * var, u32 maxlen)
if(save)
{
strncpy(var, keyboard.kbtextstr, 100);
var[100] = 0;
snprintf(var, maxlen, "%s", keyboard.kbtextstr);
}
HaltGui();

View File

@ -258,7 +258,7 @@ decodePrefsData (int method)
verMinor >= 0 && verMinor <= 9 &&
verPoint >= 0 && verPoint <= 9))
result = false;
else if(verMajor <= 3) // less than version 3.0.0
else if(verMajor < 3) // less than version 3.0.0
result = false; // reset settings
else if(verMajor > curMajor || verMinor > curMinor || verPoint > curPoint) // some future version
result = false; // reset settings