* fixed "Auto-resume old play session", for some reason NSFs don't allow loading savestate right after opening the ROM

* updated docs

[[Split portion of a mixed commit.]]
This commit is contained in:
ansstuff 2012-12-16 13:07:50 +00:00
parent 2ab5891589
commit e1ef50ac14
10 changed files with 26 additions and 20 deletions

View File

@ -1,3 +1,4 @@
15-Dec-2012 - AnS - win32: added Config->Enable->Auto-resume old play session
13-Dec-2012 - AnS - win32: added Emulation Speed->Set custom speed for FrameAdvance 13-Dec-2012 - AnS - win32: added Emulation Speed->Set custom speed for FrameAdvance
13-Dec-2012 - AnS - win32: added NES->Emulation Speed->Set FrameAdvance Delay 13-Dec-2012 - AnS - win32: added NES->Emulation Speed->Set FrameAdvance Delay
13-Dec-2012 - AnS - win32: added NES->Emulation Speed->Set Custom Speed 13-Dec-2012 - AnS - win32: added NES->Emulation Speed->Set Custom Speed

View File

@ -413,7 +413,7 @@ void DrawTextTransWH(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor, i
if (max_w > 256) max_w = 256; if (max_w > 256) max_w = 256;
if (max_h > 64) max_h = 64; if (max_h > 64) max_h = 64;
int ch, wid, nx, ny, max_x = x, offs; int ch = 0, wid = 0, nx = 0, ny = 0, max_x = x, offs = 0;
int pixel_color; int pixel_color;
for(; *textmsg; ++textmsg) for(; *textmsg; ++textmsg)
{ {

View File

@ -96,11 +96,11 @@ void FCEUI_SetRenderPlanes(bool sprites, bool bg);
void FCEUI_GetRenderPlanes(bool& sprites, bool& bg); void FCEUI_GetRenderPlanes(bool& sprites, bool& bg);
//name=path and file to load. returns null if it failed //name=path and file to load. returns null if it failed
FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode); FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode, bool silent = false);
//same as FCEUI_LoadGame, except that it can load from a tempfile. //same as FCEUI_LoadGame, except that it can load from a tempfile.
//name is the logical path to open; archiveFilename is the archive which contains name //name is the logical path to open; archiveFilename is the archive which contains name
FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode); FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silent = false);
//general purpose emulator initialization. returns true if successful //general purpose emulator initialization. returns true if successful
bool FCEUI_Initialize(); bool FCEUI_Initialize();

Binary file not shown.

View File

@ -760,7 +760,7 @@ int main(int argc,char *argv[])
} else } else
{ {
if (AutoResumePlay && rom_name_when_closing_emulator && rom_name_when_closing_emulator[0]) if (AutoResumePlay && rom_name_when_closing_emulator && rom_name_when_closing_emulator[0])
ALoad(rom_name_when_closing_emulator); ALoad(rom_name_when_closing_emulator, 0, true);
if (eoptions & EO_FOAFTERSTART) if (eoptions & EO_FOAFTERSTART)
LoadNewGamey(hAppWnd, 0); LoadNewGamey(hAppWnd, 0);
} }

View File

@ -148,8 +148,8 @@ BEGIN
MENUITEM SEPARATOR MENUITEM SEPARATOR
POPUP "PPU" POPUP "PPU"
BEGIN BEGIN
MENUITEM "New PPU", ID_NEWPPU
MENUITEM "Old PPU", ID_OLDPPU MENUITEM "Old PPU", ID_OLDPPU
MENUITEM "New PPU (slow!)", ID_NEWPPU
END END
MENUITEM "&Directories...", MENU_DIRECTORIES MENUITEM "&Directories...", MENU_DIRECTORIES
MENUITEM "&GUI...", MENU_GUI_OPTIONS MENUITEM "&GUI...", MENU_GUI_OPTIONS

View File

@ -1018,13 +1018,13 @@ void CloseGame()
} }
} }
bool ALoad(const char *nameo, char* innerFilename) bool ALoad(const char *nameo, char* innerFilename, bool silent)
{ {
int oldPaused = EmulationPaused; int oldPaused = EmulationPaused;
if (GameInfo) FCEUI_CloseGame(); if (GameInfo) FCEUI_CloseGame();
if(FCEUI_LoadGameVirtual(nameo, 1)) if (FCEUI_LoadGameVirtual(nameo, 1, silent))
{ {
pal_emulation = FCEUI_GetCurrentVidSystem(0, 0); pal_emulation = FCEUI_GetCurrentVidSystem(0, 0);

View File

@ -32,7 +32,7 @@ void ByebyeWindow();
void DoTimingConfigFix(); void DoTimingConfigFix();
int CreateMainWindow(); int CreateMainWindow();
void UpdateCheckedMenuItems(); void UpdateCheckedMenuItems();
bool ALoad(const char* nameo, char* innerFilename=0); bool ALoad(const char* nameo, char* innerFilename = 0, bool silent = false);
void LoadNewGamey(HWND hParent, const char *initialdir); void LoadNewGamey(HWND hParent, const char *initialdir);
int BrowseForFolder(HWND hParent, const char *htext, char *buf); int BrowseForFolder(HWND hParent, const char *htext, char *buf);
void SetMainWindowStuff(); void SetMainWindowStuff();

View File

@ -139,7 +139,7 @@ static void FCEU_CloseGame(void)
{ {
if (GameInfo) if (GameInfo)
{ {
if (AutoResumePlay) if (AutoResumePlay && (GameInfo->type != GIT_NSF))
{ {
// save "-resume" savestate // save "-resume" savestate
FCEUSS_Save(FCEU_MakeFName(FCEUMKF_RESUMESTATE, 0, 0).c_str()); FCEUSS_Save(FCEU_MakeFName(FCEUMKF_RESUMESTATE, 0, 0).c_str());
@ -378,7 +378,7 @@ int NSFLoad(const char *name, FCEUFILE *fp);
//char lastLoadedGameName [2048] = {0,}; // hack for movie WRAM clearing on record from poweron //char lastLoadedGameName [2048] = {0,}; // hack for movie WRAM clearing on record from poweron
//name should be UTF-8, hopefully, or else there may be trouble //name should be UTF-8, hopefully, or else there may be trouble
FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode) FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silent)
{ {
//---------- //----------
//attempt to open the files //attempt to open the files
@ -389,7 +389,9 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode)
const char* romextensions[] = { "nes", "fds", 0 }; const char* romextensions[] = { "nes", "fds", 0 };
fp = FCEU_fopen(name, 0, "rb", 0, -1, romextensions); fp = FCEU_fopen(name, 0, "rb", 0, -1, romextensions);
if (!fp) { if (!fp)
{
if (!silent)
FCEU_PrintError("Error opening \"%s\"!", name); FCEU_PrintError("Error opening \"%s\"!", name);
return 0; return 0;
} }
@ -439,6 +441,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode)
if (FDSLoad(name, fp)) if (FDSLoad(name, fp))
goto endlseq; goto endlseq;
if (!silent)
FCEU_PrintError("An error occurred while loading the file."); FCEU_PrintError("An error occurred while loading the file.");
FCEU_fclose(fp); FCEU_fclose(fp);
@ -457,6 +460,7 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode)
extern int loadDebugDataFailed; extern int loadDebugDataFailed;
if ((loadDebugDataFailed = loadPreferences(LoadedRomFName))) if ((loadDebugDataFailed = loadPreferences(LoadedRomFName)))
if (!silent)
FCEU_printf("Couldn't load debugging data.\n"); FCEU_printf("Couldn't load debugging data.\n");
// ################################## End of SP CODE ########################### // ################################## End of SP CODE ###########################
@ -482,13 +486,13 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode)
DoDebuggerDataReload(); // Reloads data without reopening window DoDebuggerDataReload(); // Reloads data without reopening window
#endif #endif
if (AutoResumePlay) if (AutoResumePlay && (GameInfo->type != GIT_NSF))
{ {
// load "-resume" savestate // load "-resume" savestate
if (FCEUSS_Load(FCEU_MakeFName(FCEUMKF_RESUMESTATE, 0, 0).c_str())) if (FCEUSS_Load(FCEU_MakeFName(FCEUMKF_RESUMESTATE, 0, 0).c_str()))
FCEU_DispMessage("Game resumed from savestate.", 0); FCEU_DispMessage("Old play session resumed.", 0);
else else
FCEU_DispMessage("Couldn't resume game from savestate.", 0); FCEU_DispMessage("", 0);
} }
ResetScreenshotsCounter(); ResetScreenshotsCounter();
@ -496,8 +500,9 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode)
return GameInfo; return GameInfo;
} }
FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode) { FCEUGI *FCEUI_LoadGame(const char *name, int OverwriteVidMode, bool silent)
return FCEUI_LoadGameVirtual(name, OverwriteVidMode); {
return FCEUI_LoadGameVirtual(name, OverwriteVidMode, silent);
} }

Binary file not shown.