Merge pull request #964 from shanehoman/flushsaveram
Timed SaveRAM flush to disk
This commit is contained in:
commit
a7cbdd7dab
|
@ -266,6 +266,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
return Path.Combine(MakeAbsolutePath(pathEntry.Path, game.System), name) + ".SaveRAM";
|
||||
}
|
||||
|
||||
public static string AutoSaveRamPath(GameInfo game)
|
||||
{
|
||||
var path = SaveRamPath(game);
|
||||
return path.Insert(path.Length - 8, ".AutoSaveRAM");
|
||||
}
|
||||
|
||||
public static string RetroSaveRAMDirectory(GameInfo game)
|
||||
{
|
||||
|
|
|
@ -114,6 +114,8 @@ namespace BizHawk.Client.Common
|
|||
public bool ShowLogWindow = false;
|
||||
public bool BackupSavestates = true;
|
||||
public bool BackupSaveram = true;
|
||||
private int _flushSaveRAMFrames = 5 * 60 * 60;
|
||||
private bool _autosaveSaveRAM = false;
|
||||
public bool SaveScreenshotWithStates = true;
|
||||
public int BigScreenshotSize = 128 * 1024;
|
||||
public bool NoLowResLargeScreenshotWithStates = false;
|
||||
|
@ -134,6 +136,8 @@ namespace BizHawk.Client.Common
|
|||
public string Update_IgnoreVersion = "";
|
||||
public bool CDLAutoSave = true, CDLAutoStart = true;
|
||||
|
||||
public int FlushSaveRamFrames { get { return _flushSaveRAMFrames; } set { _flushSaveRAMFrames = value; } }
|
||||
public bool AutosaveSaveRAM { get { return _autosaveSaveRAM; } set { _autosaveSaveRAM = value; } }
|
||||
//check CurrentDomain_AssemblyResolve if you change the defaults or name of this key
|
||||
public bool UseNLua = true; // Whether or not to use a good, reliable, memory-leak-free lua interface that is slower than the original luainterface
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
this.LoadCurrentSlotMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SaveRAMSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.FlushSaveRAMMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.MovieSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ReadonlyMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator();
|
||||
|
@ -238,8 +238,9 @@
|
|||
this.coreToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.quickNESToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.nesHawkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator34 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.NESPPUViewerMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator34 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.toolStripSeparator35 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.NESPPUViewerMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.NESNametableViewerMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.NESGameGenieCodesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.musicRipperToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -329,7 +330,6 @@
|
|||
this.SnesOptionsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ColecoSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ColecoControllerSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator35 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.ColecoSkipBiosMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.N64SubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.N64PluginSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -902,26 +902,26 @@
|
|||
this.LoadCurrentSlotMenuItem.Size = new System.Drawing.Size(178, 22);
|
||||
this.LoadCurrentSlotMenuItem.Text = "Load Current Slot";
|
||||
this.LoadCurrentSlotMenuItem.Click += new System.EventHandler(this.LoadCurrentSlotMenuItem_Click);
|
||||
//
|
||||
// SaveRAMSubMenu
|
||||
//
|
||||
this.SaveRAMSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.FlushSaveRAMMenuItem});
|
||||
this.SaveRAMSubMenu.Name = "SaveRAMSubMenu";
|
||||
this.SaveRAMSubMenu.Size = new System.Drawing.Size(159, 22);
|
||||
this.SaveRAMSubMenu.Text = "Save &RAM";
|
||||
this.SaveRAMSubMenu.DropDownOpened += new System.EventHandler(this.FlushSaveRAMSubMenu_DropDownOpened);
|
||||
//
|
||||
// FlushSaveRAMMenuItem
|
||||
//
|
||||
this.FlushSaveRAMMenuItem.Name = "FlushSaveRAMMenuItem";
|
||||
this.FlushSaveRAMMenuItem.Size = new System.Drawing.Size(156, 22);
|
||||
this.FlushSaveRAMMenuItem.Text = "&Flush Save Ram";
|
||||
this.FlushSaveRAMMenuItem.Click += new System.EventHandler(this.FlushSaveRAMMenuItem_Click);
|
||||
//
|
||||
// toolStripMenuItem2
|
||||
//
|
||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||
|
||||
//
|
||||
// SaveRAMSubMenu
|
||||
//
|
||||
this.SaveRAMSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.FlushSaveRAMMenuItem});
|
||||
this.SaveRAMSubMenu.Name = "SaveRAMSubMenu";
|
||||
this.SaveRAMSubMenu.Size = new System.Drawing.Size(159, 22);
|
||||
this.SaveRAMSubMenu.Text = "Save &RAM";
|
||||
this.SaveRAMSubMenu.DropDownOpened += new System.EventHandler(this.SaveRAMSubMenu_DropDownOpened);
|
||||
//
|
||||
// FlushSaveRAMMenuItem
|
||||
//
|
||||
this.FlushSaveRAMMenuItem.Name = "FlushSaveRAMMenuItem";
|
||||
this.FlushSaveRAMMenuItem.Size = new System.Drawing.Size(156, 22);
|
||||
this.FlushSaveRAMMenuItem.Text = "&Flush Save Ram";
|
||||
this.FlushSaveRAMMenuItem.Click += new System.EventHandler(this.FlushSaveRAMMenuItem_Click);
|
||||
// toolStripMenuItem2
|
||||
//
|
||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(156, 6);
|
||||
//
|
||||
// MovieSubMenu
|
||||
|
@ -4309,6 +4309,7 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem quickNESToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem nesHawkToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator34;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator35;
|
||||
private System.Windows.Forms.ToolStripMenuItem GBACoreSelectionSubMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem GBAmGBAMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem GBAVBANextMenuItem;
|
||||
|
@ -4358,7 +4359,6 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem IntvSubMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem IntVControllerSettingsMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SNESControllerConfigurationMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator35;
|
||||
private System.Windows.Forms.ToolStripMenuItem C64DisksSubMenu;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator36;
|
||||
private System.Windows.Forms.ToolStripMenuItem sNESToolStripMenuItem;
|
||||
|
|
|
@ -226,9 +226,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void FlushSaveRAMSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
private void SaveRAMSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
FlushSaveRAMMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Flush SRAM"].Bindings;
|
||||
FlushSaveRAMMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Flush SaveRAM"].Bindings;
|
||||
}
|
||||
|
||||
private void MovieSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
|
|
|
@ -405,7 +405,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
PauseEmulator();
|
||||
}
|
||||
|
||||
|
||||
// start dumping, if appropriate
|
||||
if (argParse.cmdDumpType != null && argParse.cmdDumpName != null)
|
||||
{
|
||||
|
@ -1415,6 +1415,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public PresentationPanel PresentationPanel { get; }
|
||||
|
||||
private int _flushSaveRamIn;
|
||||
public int FlushSaveRamIn { get { return _flushSaveRamIn; } set { _flushSaveRamIn = value; } }
|
||||
#endregion
|
||||
|
||||
#region Private methods
|
||||
|
@ -1567,6 +1569,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
try // zero says: this is sort of sketchy... but this is no time for rearchitecting
|
||||
{
|
||||
if (Global.Config.AutosaveSaveRAM)
|
||||
{
|
||||
var saveram = new FileInfo(PathManager.SaveRamPath(Global.Game));
|
||||
var autosave = new FileInfo(PathManager.AutoSaveRamPath(Global.Game));
|
||||
if (autosave.Exists && autosave.LastWriteTime > saveram.LastWriteTime)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("AutoSaveRAM is newer than last saved SaveRAM");
|
||||
}
|
||||
}
|
||||
|
||||
byte[] sram;
|
||||
|
||||
// GBA meteor core might not know how big the saveram ought to be, so just send it the whole file
|
||||
|
@ -1596,47 +1608,66 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
Emulator.AsSaveRam().StoreSaveRam(sram);
|
||||
_flushSaveRamIn = Global.Config.FlushSaveRamFrames;
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("An error occurred while loading Sram");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void FlushSaveRAM()
|
||||
public void FlushSaveRAM(bool autosave = false)
|
||||
{
|
||||
if (Emulator.HasSaveRam())
|
||||
{
|
||||
var path = PathManager.SaveRamPath(Global.Game);
|
||||
var f = new FileInfo(path);
|
||||
if (f.Directory != null && !f.Directory.Exists)
|
||||
string path;
|
||||
if (autosave)
|
||||
{
|
||||
f.Directory.Create();
|
||||
path = PathManager.AutoSaveRamPath(Global.Game);
|
||||
_flushSaveRamIn = Global.Config.FlushSaveRamFrames;
|
||||
}
|
||||
else
|
||||
{
|
||||
path = PathManager.SaveRamPath(Global.Game);
|
||||
}
|
||||
var file = new FileInfo(path);
|
||||
var newPath = path + ".new";
|
||||
var newFile = new FileInfo(newPath);
|
||||
var backupPath = path + ".bak";
|
||||
var backupFile = new FileInfo(backupPath);
|
||||
if (file.Directory != null && !file.Directory.Exists)
|
||||
{
|
||||
file.Directory.Create();
|
||||
}
|
||||
|
||||
// Make backup first
|
||||
if (Global.Config.BackupSaveram && f.Exists)
|
||||
{
|
||||
var backup = path + ".bak";
|
||||
var backupFile = new FileInfo(backup);
|
||||
if (backupFile.Exists)
|
||||
{
|
||||
backupFile.Delete();
|
||||
}
|
||||
|
||||
f.CopyTo(backup);
|
||||
}
|
||||
|
||||
var writer = new BinaryWriter(new FileStream(path, FileMode.Create, FileAccess.Write));
|
||||
var writer = new BinaryWriter(new FileStream(newPath, FileMode.Create, FileAccess.Write));
|
||||
var saveram = Emulator.AsSaveRam().CloneSaveRam();
|
||||
|
||||
if (saveram != null)
|
||||
{
|
||||
writer.Write(saveram, 0, saveram.Length);
|
||||
}
|
||||
|
||||
writer.Close();
|
||||
|
||||
if (file.Exists)
|
||||
{
|
||||
if (Global.Config.BackupSaveram)
|
||||
{
|
||||
if (backupFile.Exists)
|
||||
{
|
||||
backupFile.Delete();
|
||||
}
|
||||
|
||||
file.MoveTo(backupPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
file.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
newFile.MoveTo(path);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2906,6 +2937,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Global.MovieSession.HandleMovieOnFrameLoop();
|
||||
|
||||
if (Global.Config.AutosaveSaveRAM)
|
||||
{
|
||||
if (FlushSaveRamIn-- <= 0)
|
||||
{
|
||||
FlushSaveRAM(true);
|
||||
}
|
||||
}
|
||||
// why not skip audio if the user doesnt want sound
|
||||
bool renderSound = (Global.Config.SoundEnabled && !IsTurboing) || (_currAviWriter?.UsesAudio ?? false);
|
||||
if (!renderSound)
|
||||
|
@ -3620,9 +3658,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
JumpLists.AddRecentItem(loaderName, ioa.DisplayName);
|
||||
|
||||
// Don't load Save Ram if a movie is being loaded
|
||||
if (!Global.MovieSession.MovieIsQueued && File.Exists(PathManager.SaveRamPath(loader.Game)))
|
||||
if (!Global.MovieSession.MovieIsQueued)
|
||||
{
|
||||
LoadSaveRam();
|
||||
if (File.Exists(PathManager.SaveRamPath(loader.Game)))
|
||||
{
|
||||
LoadSaveRam();
|
||||
}
|
||||
else if (Global.Config.AutosaveSaveRAM && File.Exists(PathManager.AutoSaveRamPath(loader.Game)))
|
||||
{
|
||||
GlobalWin.OSD.AddMessage("AutoSaveRAM found, but SaveRAM was not saved");
|
||||
}
|
||||
}
|
||||
|
||||
GlobalWin.Tools.Restart();
|
||||
|
|
|
@ -48,6 +48,17 @@
|
|||
this.EnableContextMenuCheckbox = new System.Windows.Forms.CheckBox();
|
||||
this.PauseWhenMenuActivatedCheckbox = new System.Windows.Forms.CheckBox();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.AutosaveSRAMtextBox = new System.Windows.Forms.NumericUpDown();
|
||||
this.AutosaveSRAMradioButton1 = new System.Windows.Forms.RadioButton();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.AutosaveSRAMradioButton2 = new System.Windows.Forms.RadioButton();
|
||||
this.AutosaveSRAMradioButton3 = new System.Windows.Forms.RadioButton();
|
||||
this.AutosaveSRAMCheckbox = new System.Windows.Forms.CheckBox();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.LuaInterfaceRadio = new System.Windows.Forms.RadioButton();
|
||||
this.NLuaRadio = new System.Windows.Forms.RadioButton();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.cbMoviesInAWE = new System.Windows.Forms.CheckBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
|
@ -56,20 +67,18 @@
|
|||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.FrameAdvSkipLagCheckbox = new System.Windows.Forms.CheckBox();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.BackupSRamCheckbox = new System.Windows.Forms.CheckBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.LogWindowAsConsoleCheckbox = new System.Windows.Forms.CheckBox();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.NLuaRadio = new System.Windows.Forms.RadioButton();
|
||||
this.LuaInterfaceRadio = new System.Windows.Forms.RadioButton();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.tabPage3.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.AutosaveSRAMtextBox)).BeginInit();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
@ -123,7 +132,7 @@
|
|||
this.tabPage1.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(386, 368);
|
||||
this.tabPage1.Size = new System.Drawing.Size(386, 376);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "General";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
|
@ -270,6 +279,8 @@
|
|||
//
|
||||
// tabPage3
|
||||
//
|
||||
this.tabPage3.Controls.Add(this.groupBox2);
|
||||
this.tabPage3.Controls.Add(this.AutosaveSRAMCheckbox);
|
||||
this.tabPage3.Controls.Add(this.panel1);
|
||||
this.tabPage3.Controls.Add(this.label6);
|
||||
this.tabPage3.Controls.Add(this.cbMoviesInAWE);
|
||||
|
@ -279,8 +290,6 @@
|
|||
this.tabPage3.Controls.Add(this.label12);
|
||||
this.tabPage3.Controls.Add(this.label13);
|
||||
this.tabPage3.Controls.Add(this.FrameAdvSkipLagCheckbox);
|
||||
this.tabPage3.Controls.Add(this.label9);
|
||||
this.tabPage3.Controls.Add(this.label10);
|
||||
this.tabPage3.Controls.Add(this.BackupSRamCheckbox);
|
||||
this.tabPage3.Controls.Add(this.label4);
|
||||
this.tabPage3.Controls.Add(this.LogWindowAsConsoleCheckbox);
|
||||
|
@ -291,6 +300,128 @@
|
|||
this.tabPage3.Text = "Advanced";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.label10);
|
||||
this.groupBox2.Controls.Add(this.label9);
|
||||
this.groupBox2.Controls.Add(this.AutosaveSRAMtextBox);
|
||||
this.groupBox2.Controls.Add(this.AutosaveSRAMradioButton1);
|
||||
this.groupBox2.Controls.Add(this.label8);
|
||||
this.groupBox2.Controls.Add(this.AutosaveSRAMradioButton2);
|
||||
this.groupBox2.Controls.Add(this.AutosaveSRAMradioButton3);
|
||||
this.groupBox2.Location = new System.Drawing.Point(27, 59);
|
||||
this.groupBox2.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(265, 60);
|
||||
this.groupBox2.TabIndex = 27;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "AutoSaveRAM";
|
||||
//
|
||||
// AutosaveSRAMtextBox
|
||||
//
|
||||
this.AutosaveSRAMtextBox.Location = new System.Drawing.Point(151, 33);
|
||||
this.AutosaveSRAMtextBox.Maximum = new decimal(new int[] {
|
||||
100000,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.AutosaveSRAMtextBox.Name = "AutosaveSRAMtextBox";
|
||||
this.AutosaveSRAMtextBox.Size = new System.Drawing.Size(50, 20);
|
||||
this.AutosaveSRAMtextBox.TabIndex = 27;
|
||||
//
|
||||
// AutosaveSRAMradioButton1
|
||||
//
|
||||
this.AutosaveSRAMradioButton1.AutoSize = true;
|
||||
this.AutosaveSRAMradioButton1.Location = new System.Drawing.Point(48, 33);
|
||||
this.AutosaveSRAMradioButton1.Name = "AutosaveSRAMradioButton1";
|
||||
this.AutosaveSRAMradioButton1.Size = new System.Drawing.Size(36, 17);
|
||||
this.AutosaveSRAMradioButton1.TabIndex = 22;
|
||||
this.AutosaveSRAMradioButton1.TabStop = true;
|
||||
this.AutosaveSRAMradioButton1.Text = "5s";
|
||||
this.AutosaveSRAMradioButton1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(202, 35);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(12, 13);
|
||||
this.label8.TabIndex = 26;
|
||||
this.label8.Text = "s";
|
||||
//
|
||||
// AutosaveSRAMradioButton2
|
||||
//
|
||||
this.AutosaveSRAMradioButton2.AutoSize = true;
|
||||
this.AutosaveSRAMradioButton2.Location = new System.Drawing.Point(90, 34);
|
||||
this.AutosaveSRAMradioButton2.Name = "AutosaveSRAMradioButton2";
|
||||
this.AutosaveSRAMradioButton2.Size = new System.Drawing.Size(39, 17);
|
||||
this.AutosaveSRAMradioButton2.TabIndex = 23;
|
||||
this.AutosaveSRAMradioButton2.TabStop = true;
|
||||
this.AutosaveSRAMradioButton2.Text = "5m";
|
||||
this.AutosaveSRAMradioButton2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// AutosaveSRAMradioButton3
|
||||
//
|
||||
this.AutosaveSRAMradioButton3.AutoSize = true;
|
||||
this.AutosaveSRAMradioButton3.Location = new System.Drawing.Point(131, 35);
|
||||
this.AutosaveSRAMradioButton3.Name = "AutosaveSRAMradioButton3";
|
||||
this.AutosaveSRAMradioButton3.Size = new System.Drawing.Size(14, 13);
|
||||
this.AutosaveSRAMradioButton3.TabIndex = 24;
|
||||
this.AutosaveSRAMradioButton3.TabStop = true;
|
||||
this.AutosaveSRAMradioButton3.UseVisualStyleBackColor = true;
|
||||
this.AutosaveSRAMradioButton3.CheckedChanged += new System.EventHandler(this.AutosaveSRAMradioButton3_CheckedChanged);
|
||||
//
|
||||
// AutosaveSRAMCheckbox
|
||||
//
|
||||
this.AutosaveSRAMCheckbox.AutoSize = true;
|
||||
this.AutosaveSRAMCheckbox.Location = new System.Drawing.Point(6, 62);
|
||||
this.AutosaveSRAMCheckbox.Name = "AutosaveSRAMCheckbox";
|
||||
this.AutosaveSRAMCheckbox.Size = new System.Drawing.Size(15, 14);
|
||||
this.AutosaveSRAMCheckbox.TabIndex = 21;
|
||||
this.AutosaveSRAMCheckbox.UseVisualStyleBackColor = true;
|
||||
this.AutosaveSRAMCheckbox.CheckedChanged += new System.EventHandler(this.AutosaveSRAMCheckbox_CheckedChanged);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.label7);
|
||||
this.panel1.Controls.Add(this.LuaInterfaceRadio);
|
||||
this.panel1.Controls.Add(this.NLuaRadio);
|
||||
this.panel1.Location = new System.Drawing.Point(6, 312);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(377, 61);
|
||||
this.panel1.TabIndex = 20;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(3, 1);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(50, 13);
|
||||
this.label7.TabIndex = 2;
|
||||
this.label7.Text = "Lua Core";
|
||||
//
|
||||
// LuaInterfaceRadio
|
||||
//
|
||||
this.LuaInterfaceRadio.AutoSize = true;
|
||||
this.LuaInterfaceRadio.Location = new System.Drawing.Point(4, 36);
|
||||
this.LuaInterfaceRadio.Name = "LuaInterfaceRadio";
|
||||
this.LuaInterfaceRadio.Size = new System.Drawing.Size(338, 17);
|
||||
this.LuaInterfaceRadio.TabIndex = 1;
|
||||
this.LuaInterfaceRadio.TabStop = true;
|
||||
this.LuaInterfaceRadio.Text = "Lua+LuaInterface - Faster but memory leaks, use at your own risk!";
|
||||
this.LuaInterfaceRadio.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// NLuaRadio
|
||||
//
|
||||
this.NLuaRadio.AutoSize = true;
|
||||
this.NLuaRadio.Location = new System.Drawing.Point(4, 17);
|
||||
this.NLuaRadio.Name = "NLuaRadio";
|
||||
this.NLuaRadio.Size = new System.Drawing.Size(194, 17);
|
||||
this.NLuaRadio.TabIndex = 0;
|
||||
this.NLuaRadio.TabStop = true;
|
||||
this.NLuaRadio.Text = "NLua+KopiLua - Reliable but slower";
|
||||
this.NLuaRadio.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
|
@ -335,7 +466,7 @@
|
|||
// LuaDuringTurboCheckbox
|
||||
//
|
||||
this.LuaDuringTurboCheckbox.AutoSize = true;
|
||||
this.LuaDuringTurboCheckbox.Location = new System.Drawing.Point(6, 174);
|
||||
this.LuaDuringTurboCheckbox.Location = new System.Drawing.Point(6, 178);
|
||||
this.LuaDuringTurboCheckbox.Name = "LuaDuringTurboCheckbox";
|
||||
this.LuaDuringTurboCheckbox.Size = new System.Drawing.Size(166, 17);
|
||||
this.LuaDuringTurboCheckbox.TabIndex = 15;
|
||||
|
@ -345,7 +476,7 @@
|
|||
// label12
|
||||
//
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(24, 149);
|
||||
this.label12.Location = new System.Drawing.Point(24, 162);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(231, 13);
|
||||
this.label12.TabIndex = 14;
|
||||
|
@ -354,7 +485,7 @@
|
|||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(24, 136);
|
||||
this.label13.Location = new System.Drawing.Point(24, 149);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(268, 13);
|
||||
this.label13.TabIndex = 13;
|
||||
|
@ -363,45 +494,27 @@
|
|||
// FrameAdvSkipLagCheckbox
|
||||
//
|
||||
this.FrameAdvSkipLagCheckbox.AutoSize = true;
|
||||
this.FrameAdvSkipLagCheckbox.Location = new System.Drawing.Point(6, 116);
|
||||
this.FrameAdvSkipLagCheckbox.Location = new System.Drawing.Point(6, 129);
|
||||
this.FrameAdvSkipLagCheckbox.Name = "FrameAdvSkipLagCheckbox";
|
||||
this.FrameAdvSkipLagCheckbox.Size = new System.Drawing.Size(241, 17);
|
||||
this.FrameAdvSkipLagCheckbox.TabIndex = 12;
|
||||
this.FrameAdvSkipLagCheckbox.Text = "Frame advance button skips non-input frames";
|
||||
this.FrameAdvSkipLagCheckbox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(24, 94);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(99, 13);
|
||||
this.label9.TabIndex = 11;
|
||||
this.label9.Text = "before overwriting it";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(24, 81);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(277, 13);
|
||||
this.label10.TabIndex = 10;
|
||||
this.label10.Text = "When set, the client will make a backup copy of saveram";
|
||||
//
|
||||
// BackupSRamCheckbox
|
||||
//
|
||||
this.BackupSRamCheckbox.AutoSize = true;
|
||||
this.BackupSRamCheckbox.Location = new System.Drawing.Point(6, 61);
|
||||
this.BackupSRamCheckbox.Location = new System.Drawing.Point(6, 39);
|
||||
this.BackupSRamCheckbox.Name = "BackupSRamCheckbox";
|
||||
this.BackupSRamCheckbox.Size = new System.Drawing.Size(108, 17);
|
||||
this.BackupSRamCheckbox.Size = new System.Drawing.Size(203, 17);
|
||||
this.BackupSRamCheckbox.TabIndex = 9;
|
||||
this.BackupSRamCheckbox.Text = "Backup Saveram";
|
||||
this.BackupSRamCheckbox.Text = "Backup SaveRAM to .SaveRAM.bak";
|
||||
this.BackupSRamCheckbox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(24, 37);
|
||||
this.label4.Location = new System.Drawing.Point(24, 23);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(234, 13);
|
||||
this.label4.TabIndex = 2;
|
||||
|
@ -410,53 +523,30 @@
|
|||
// LogWindowAsConsoleCheckbox
|
||||
//
|
||||
this.LogWindowAsConsoleCheckbox.AutoSize = true;
|
||||
this.LogWindowAsConsoleCheckbox.Location = new System.Drawing.Point(6, 17);
|
||||
this.LogWindowAsConsoleCheckbox.Location = new System.Drawing.Point(6, 3);
|
||||
this.LogWindowAsConsoleCheckbox.Name = "LogWindowAsConsoleCheckbox";
|
||||
this.LogWindowAsConsoleCheckbox.Size = new System.Drawing.Size(233, 17);
|
||||
this.LogWindowAsConsoleCheckbox.TabIndex = 1;
|
||||
this.LogWindowAsConsoleCheckbox.Text = "Create the log window as a console window";
|
||||
this.LogWindowAsConsoleCheckbox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// panel1
|
||||
// label9
|
||||
//
|
||||
this.panel1.Controls.Add(this.label7);
|
||||
this.panel1.Controls.Add(this.LuaInterfaceRadio);
|
||||
this.panel1.Controls.Add(this.NLuaRadio);
|
||||
this.panel1.Location = new System.Drawing.Point(6, 312);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(377, 61);
|
||||
this.panel1.TabIndex = 20;
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(6, 16);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(225, 13);
|
||||
this.label9.TabIndex = 28;
|
||||
this.label9.Text = "Save SaveRAM to .AutoSaveRAM.SaveRAM";
|
||||
//
|
||||
// NLuaRadio
|
||||
// label10
|
||||
//
|
||||
this.NLuaRadio.AutoSize = true;
|
||||
this.NLuaRadio.Location = new System.Drawing.Point(4, 17);
|
||||
this.NLuaRadio.Name = "NLuaRadio";
|
||||
this.NLuaRadio.Size = new System.Drawing.Size(194, 17);
|
||||
this.NLuaRadio.TabIndex = 0;
|
||||
this.NLuaRadio.TabStop = true;
|
||||
this.NLuaRadio.Text = "NLua+KopiLua - Reliable but slower";
|
||||
this.NLuaRadio.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// LuaInterfaceRadio
|
||||
//
|
||||
this.LuaInterfaceRadio.AutoSize = true;
|
||||
this.LuaInterfaceRadio.Location = new System.Drawing.Point(4, 36);
|
||||
this.LuaInterfaceRadio.Name = "LuaInterfaceRadio";
|
||||
this.LuaInterfaceRadio.Size = new System.Drawing.Size(338, 17);
|
||||
this.LuaInterfaceRadio.TabIndex = 1;
|
||||
this.LuaInterfaceRadio.TabStop = true;
|
||||
this.LuaInterfaceRadio.Text = "Lua+LuaInterface - Faster but memory leaks, use at your own risk!";
|
||||
this.LuaInterfaceRadio.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(3, 1);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(50, 13);
|
||||
this.label7.TabIndex = 2;
|
||||
this.label7.Text = "Lua Core";
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(9, 34);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(33, 13);
|
||||
this.label10.TabIndex = 29;
|
||||
this.label10.Text = "every";
|
||||
//
|
||||
// EmuHawkOptions
|
||||
//
|
||||
|
@ -480,6 +570,9 @@
|
|||
this.groupBox1.PerformLayout();
|
||||
this.tabPage3.ResumeLayout(false);
|
||||
this.tabPage3.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.AutosaveSRAMtextBox)).EndInit();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
@ -508,8 +601,6 @@
|
|||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
private System.Windows.Forms.CheckBox BackupSRamCheckbox;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.CheckBox FrameAdvSkipLagCheckbox;
|
||||
private System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.Label label13;
|
||||
|
@ -525,5 +616,14 @@
|
|||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.RadioButton LuaInterfaceRadio;
|
||||
private System.Windows.Forms.RadioButton NLuaRadio;
|
||||
private System.Windows.Forms.CheckBox AutosaveSRAMCheckbox;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.RadioButton AutosaveSRAMradioButton3;
|
||||
private System.Windows.Forms.RadioButton AutosaveSRAMradioButton2;
|
||||
private System.Windows.Forms.RadioButton AutosaveSRAMradioButton1;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.NumericUpDown AutosaveSRAMtextBox;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.Label label9;
|
||||
}
|
||||
}
|
|
@ -7,6 +7,34 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public partial class EmuHawkOptions : Form
|
||||
{
|
||||
public int AutosaveSaveRAMSeconds {
|
||||
get {
|
||||
if (AutosaveSRAMradioButton1.Checked)
|
||||
return 5;
|
||||
if (AutosaveSRAMradioButton2.Checked)
|
||||
return 5 * 60;
|
||||
return (int)AutosaveSRAMtextBox.Value;
|
||||
}
|
||||
set {
|
||||
switch (value)
|
||||
{
|
||||
case 5:
|
||||
AutosaveSRAMradioButton1.Checked = true;
|
||||
AutosaveSRAMtextBox.Enabled = false;
|
||||
break;
|
||||
case 5 * 60:
|
||||
AutosaveSRAMradioButton2.Checked = true;
|
||||
AutosaveSRAMtextBox.Enabled = false;
|
||||
break;
|
||||
default:
|
||||
AutosaveSRAMradioButton3.Checked = true;
|
||||
AutosaveSRAMtextBox.Enabled = true;
|
||||
break;
|
||||
}
|
||||
AutosaveSRAMtextBox.Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public EmuHawkOptions()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -25,6 +53,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
SingleInstanceModeCheckbox.Checked = Global.Config.SingleInstanceMode;
|
||||
|
||||
BackupSRamCheckbox.Checked = Global.Config.BackupSaveram;
|
||||
AutosaveSRAMCheckbox.Checked = Global.Config.AutosaveSaveRAM;
|
||||
groupBox2.Enabled = AutosaveSRAMCheckbox.Checked;
|
||||
AutosaveSaveRAMSeconds = Global.Config.FlushSaveRamFrames / 60;
|
||||
FrameAdvSkipLagCheckbox.Checked = Global.Config.SkipLagFrame;
|
||||
LogWindowAsConsoleCheckbox.Checked = Global.Config.WIN32_CONSOLE;
|
||||
LuaDuringTurboCheckbox.Checked = Global.Config.RunLuaDuringTurbo;
|
||||
|
@ -56,6 +87,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.Config.SingleInstanceMode = SingleInstanceModeCheckbox.Checked;
|
||||
|
||||
Global.Config.BackupSaveram = BackupSRamCheckbox.Checked;
|
||||
Global.Config.AutosaveSaveRAM = AutosaveSRAMCheckbox.Checked;
|
||||
Global.Config.FlushSaveRamFrames = AutosaveSaveRAMSeconds * 60;
|
||||
if (GlobalWin.MainForm.FlushSaveRamIn > Global.Config.FlushSaveRamFrames)
|
||||
GlobalWin.MainForm.FlushSaveRamIn = Global.Config.FlushSaveRamFrames;
|
||||
Global.Config.SkipLagFrame = FrameAdvSkipLagCheckbox.Checked;
|
||||
Global.Config.WIN32_CONSOLE = LogWindowAsConsoleCheckbox.Checked;
|
||||
Global.Config.RunLuaDuringTurbo = LuaDuringTurboCheckbox.Checked;
|
||||
|
@ -77,5 +112,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
DialogResult = DialogResult.Cancel;
|
||||
GlobalWin.OSD.AddMessage("Customizing aborted.");
|
||||
}
|
||||
|
||||
private void AutosaveSRAMCheckbox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
groupBox2.Enabled = AutosaveSRAMCheckbox.Checked;
|
||||
}
|
||||
|
||||
private void AutosaveSRAMradioButton3_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
AutosaveSRAMtextBox.Enabled = AutosaveSRAMradioButton3.Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue