Merge pull request #827 from shanehoman/saveram_hotkey_lua

flush Saveram via hotkey or lua
This commit is contained in:
adelikat 2017-04-07 20:55:07 -05:00 committed by GitHub
commit 681ec8317e
6 changed files with 20 additions and 1 deletions

View File

@ -132,6 +132,7 @@ namespace BizHawk.Client.Common
Bind("General", "Open ROM", "Ctrl+O"), Bind("General", "Open ROM", "Ctrl+O"),
Bind("General", "Close ROM", "Ctrl+W"), Bind("General", "Close ROM", "Ctrl+W"),
Bind("General", "Load Last ROM"), Bind("General", "Load Last ROM"),
Bind("General", "Flush SRAM", "Ctrl+S"),
Bind("General", "Display FPS"), Bind("General", "Display FPS"),
Bind("General", "Frame Counter"), Bind("General", "Frame Counter"),
Bind("General", "Lag Counter"), Bind("General", "Lag Counter"),

View File

@ -894,6 +894,7 @@
this.SaveRAMSubMenu.Name = "SaveRAMSubMenu"; this.SaveRAMSubMenu.Name = "SaveRAMSubMenu";
this.SaveRAMSubMenu.Size = new System.Drawing.Size(159, 22); this.SaveRAMSubMenu.Size = new System.Drawing.Size(159, 22);
this.SaveRAMSubMenu.Text = "Save &RAM"; this.SaveRAMSubMenu.Text = "Save &RAM";
this.SaveRAMSubMenu.DropDownOpened += new System.EventHandler(this.SaveRAMSubMenu_DropDownOpened);
// //
// FlushSaveRAMMenuItem // FlushSaveRAMMenuItem
// //

View File

@ -2178,6 +2178,11 @@ namespace BizHawk.Client.EmuHawk
SaveRam(); SaveRam();
} }
private void SaveRAMSubMenu_DropDownOpened(object sender, EventArgs e)
{
this.FlushSaveRAMMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Save SRAM"].Bindings;
}
#endregion #endregion
#region Coleco #region Coleco

View File

@ -63,6 +63,9 @@ namespace BizHawk.Client.EmuHawk
case "Load Last ROM": case "Load Last ROM":
LoadRomFromRecent(Global.Config.RecentRoms.MostRecent); LoadRomFromRecent(Global.Config.RecentRoms.MostRecent);
break; break;
case "Flush SRAM":
SaveRam();
break;
case "Display FPS": case "Display FPS":
ToggleFPS(); ToggleFPS();
break; break;

View File

@ -1592,7 +1592,7 @@ namespace BizHawk.Client.EmuHawk
} }
} }
private void SaveRam() public void SaveRam()
{ {
if (Emulator.HasSaveRam()) if (Emulator.HasSaveRam())
{ {

View File

@ -533,5 +533,14 @@ namespace BizHawk.Client.EmuHawk
{ {
Global.Config.DisplayMessages = value; Global.Config.DisplayMessages = value;
} }
[LuaMethodAttributes(
"saveram",
"flushes save ram to disk"
)]
public void SaveRam()
{
GlobalWin.MainForm.SaveRam();
}
} }
} }