Add option for auto-savestates

This commit is contained in:
beirich 2011-10-15 23:17:15 +00:00
parent dcf7846d3f
commit a95957dcf6
4 changed files with 1891 additions and 1865 deletions

View File

@ -127,6 +127,7 @@
public bool InputConfigAutoTab = true;
public bool ShowLogWindow = false;
public bool BackupSavestates = true;
public bool AutoSavestates = false;
public bool SaveScreenshotWithStates = true;
public int AutofireOn = 1;
public int AutofireOff = 1;

File diff suppressed because it is too large Load Diff

View File

@ -1139,6 +1139,7 @@ namespace BizHawk.MultiClient
singleInstanceModeToolStripMenuItem.Checked = Global.Config.SingleInstanceMode;
enableContextMenuToolStripMenuItem.Checked = Global.Config.ShowContextMenu;
backupSavestatesToolStripMenuItem.Checked = Global.Config.BackupSavestates;
autoSavestatesToolStripMenuItem.Checked = Global.Config.AutoSavestates;
saveScreenshotWithSavestatesToolStripMenuItem.Checked = Global.Config.SaveScreenshotWithStates;
logWindowAsConsoleToolStripMenuItem.Checked = Global.Config.WIN32_CONSOLE;
showMenuInFullScreenToolStripMenuItem.Checked = Global.Config.ShowMenuInFullscreen;
@ -1357,6 +1358,11 @@ namespace BizHawk.MultiClient
Global.Config.BackupSavestates ^= true;
}
void autoSavestatesToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.AutoSavestates ^= true;
}
void screenshotWithSavestatesToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.SaveScreenshotWithStates ^= true;

View File

@ -1114,6 +1114,8 @@ namespace BizHawk.MultiClient
Global.Config.RecentRoms.Add(file.CanonicalFullPath);
if (File.Exists(PathManager.SaveRamPath(game)))
LoadSaveRam();
if (Global.Config.AutoSavestates)
LoadState("Auto");
////setup the throttle based on platform's specifications
////(one day later for some systems we will need to modify it at runtime as the display mode changes)
@ -1209,7 +1211,9 @@ namespace BizHawk.MultiClient
private void CloseGame()
{
if (Global.Emulator.SaveRamModified)
if (Global.Config.AutoSavestates && Global.Emulator is NullEmulator == false)
SaveState("Auto");
if (Global.Emulator.SaveRamModified)
SaveRam();
Global.Emulator.Dispose();
Global.Emulator = new NullEmulator();
@ -1362,9 +1366,14 @@ namespace BizHawk.MultiClient
Global.RenderPanel.AddMessage("Unthrottled: " + unthrottled);
break;
case "Hard Reset":
LoadRom(CurrentlyOpenRom);
break;
case "Hard Reset":
{
bool autoSaveState = Global.Config.AutoSavestates;
Global.Config.AutoSavestates = false;
LoadRom(CurrentlyOpenRom);
Global.Config.AutoSavestates = autoSaveState;
break;
}
case "Screenshot":
TakeScreenshot();
@ -2320,7 +2329,7 @@ namespace BizHawk.MultiClient
if (Global.Emulator.ControllerDefinition.BoolButtons.Contains("Reset"))
{
Global.ClickyVirtualPadController.Click("Reset");
if (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE)
if (Global.MovieSession.Movie.Mode == MOVIEMODE.INACTIVE && Global.Emulator is NES)
Global.Emulator.ResetFrameCounter();
}
}