add a Close and Clear SRAM context menu option that is visible when the game has an existing sram file
This commit is contained in:
parent
f090fff176
commit
3fb1900040
|
@ -341,7 +341,10 @@
|
|||
this.cmiScreenshot = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cmiScreenshotClipboard = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cmiCloseRom = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ClearSRAMContextSeparator = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.ClearSRAMContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cmiShowMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ShowMenuContextMenuSeparator = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.StatusSlot0.SuspendLayout();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
|
@ -2748,9 +2751,12 @@
|
|||
this.cmiScreenshot,
|
||||
this.cmiScreenshotClipboard,
|
||||
this.cmiCloseRom,
|
||||
this.ClearSRAMContextSeparator,
|
||||
this.ClearSRAMContextMenuItem,
|
||||
this.ShowMenuContextMenuSeparator,
|
||||
this.cmiShowMenu});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(217, 440);
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(217, 496);
|
||||
this.contextMenuStrip1.Closing += new System.Windows.Forms.ToolStripDropDownClosingEventHandler(this.contextMenuStrip1_Closing);
|
||||
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
|
||||
//
|
||||
|
@ -2970,6 +2976,18 @@
|
|||
this.cmiCloseRom.Text = "Close ROM";
|
||||
this.cmiCloseRom.Click += new System.EventHandler(this.closeROMToolStripMenuItem1_Click);
|
||||
//
|
||||
// ClearSRAMContextSeparator
|
||||
//
|
||||
this.ClearSRAMContextSeparator.Name = "ClearSRAMContextSeparator";
|
||||
this.ClearSRAMContextSeparator.Size = new System.Drawing.Size(213, 6);
|
||||
//
|
||||
// ClearSRAMContextMenuItem
|
||||
//
|
||||
this.ClearSRAMContextMenuItem.Name = "ClearSRAMContextMenuItem";
|
||||
this.ClearSRAMContextMenuItem.Size = new System.Drawing.Size(216, 22);
|
||||
this.ClearSRAMContextMenuItem.Text = "Close and Clear SRAM";
|
||||
this.ClearSRAMContextMenuItem.Click += new System.EventHandler(this.clearSRAMToolStripMenuItem_Click);
|
||||
//
|
||||
// cmiShowMenu
|
||||
//
|
||||
this.cmiShowMenu.Name = "cmiShowMenu";
|
||||
|
@ -2977,6 +2995,11 @@
|
|||
this.cmiShowMenu.Text = "Show Menu";
|
||||
this.cmiShowMenu.Click += new System.EventHandler(this.showMenuToolStripMenuItem_Click);
|
||||
//
|
||||
// ShowMenuContextMenuSeparator
|
||||
//
|
||||
this.ShowMenuContextMenuSeparator.Name = "ShowMenuContextMenuSeparator";
|
||||
this.ShowMenuContextMenuSeparator.Size = new System.Drawing.Size(213, 6);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F);
|
||||
|
@ -3331,6 +3354,9 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem rewindToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem firmwaresToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem loadTIFileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ClearSRAMContextMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator ClearSRAMContextSeparator;
|
||||
private System.Windows.Forms.ToolStripSeparator ShowMenuContextMenuSeparator;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -889,6 +889,10 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void contextMenuStrip1_Opening(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
ClearSRAMContextSeparator.Visible =
|
||||
ClearSRAMContextMenuItem.Visible
|
||||
= File.Exists(PathManager.SaveRamPath(Global.Game));
|
||||
|
||||
wasPaused = EmulatorPaused;
|
||||
didMenuPause = true;
|
||||
PauseEmulator();
|
||||
|
@ -918,6 +922,7 @@ namespace BizHawk.MultiClient
|
|||
cmiScreenshotClipboard.Visible = false;
|
||||
cmiCloseRom.Visible = false;
|
||||
cmiShowMenu.Visible = false;
|
||||
ShowMenuContextMenuSeparator.Visible = false;
|
||||
saveMovieToolStripMenuItem1.Visible = false;
|
||||
}
|
||||
else
|
||||
|
@ -1004,7 +1009,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
if (InFullscreen)
|
||||
{
|
||||
cmiShowMenu.Visible = true;
|
||||
ShowMenuContextMenuSeparator.Visible = cmiShowMenu.Visible = true;
|
||||
if (MainMenuStrip.Visible)
|
||||
cmiShowMenu.Text = "Hide Menu";
|
||||
else
|
||||
|
@ -1012,17 +1017,10 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
else
|
||||
{
|
||||
cmiShowMenu.Visible = false;
|
||||
ShowMenuContextMenuSeparator.Visible = cmiShowMenu.Visible = false;
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.HasChanges)
|
||||
{
|
||||
ContextMenuStopMovieNoSaving.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ContextMenuStopMovieNoSaving.Visible = false;
|
||||
}
|
||||
ContextMenuStopMovieNoSaving.Visible = Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.HasChanges;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2601,24 +2599,24 @@ namespace BizHawk.MultiClient
|
|||
new RewindConfig().ShowDialog();
|
||||
}
|
||||
|
||||
private void loadTIFileToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog OFD = new OpenFileDialog();
|
||||
private void loadTIFileToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog OFD = new OpenFileDialog();
|
||||
|
||||
if (OFD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
(Global.Emulator as TI83).LinkPort.SendFileToCalc(File.OpenRead(OFD.FileName), true);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
string Message = string.Format("Invalid file format. Reason: {0} \nForce transfer? This may cause the calculator to crash.", ex.Message);
|
||||
if (OFD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
try
|
||||
{
|
||||
(Global.Emulator as TI83).LinkPort.SendFileToCalc(File.OpenRead(OFD.FileName), true);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
string Message = string.Format("Invalid file format. Reason: {0} \nForce transfer? This may cause the calculator to crash.", ex.Message);
|
||||
|
||||
if (MessageBox.Show(Message, "Upload Failed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
|
||||
(Global.Emulator as TI83).LinkPort.SendFileToCalc(File.OpenRead(OFD.FileName), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (MessageBox.Show(Message, "Upload Failed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
|
||||
(Global.Emulator as TI83).LinkPort.SendFileToCalc(File.OpenRead(OFD.FileName), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3257,12 +3257,27 @@ namespace BizHawk.MultiClient
|
|||
//whats the difference between these two methods??
|
||||
//its very tricky. rename to be more clear or combine them.
|
||||
|
||||
private void CloseGame()
|
||||
private void CloseGame(bool clearSRAM = false)
|
||||
{
|
||||
if (Global.Config.AutoSavestates && Global.Emulator is NullEmulator == false)
|
||||
{
|
||||
SaveState("Auto");
|
||||
if (Global.Emulator.SaveRamModified)
|
||||
}
|
||||
|
||||
if (clearSRAM)
|
||||
{
|
||||
string path = PathManager.SaveRamPath(Global.Game);
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
Global.OSD.AddMessage("SRAM cleared.");
|
||||
}
|
||||
}
|
||||
else if (Global.Emulator.SaveRamModified)
|
||||
{
|
||||
SaveRam();
|
||||
}
|
||||
|
||||
StopAVI();
|
||||
Global.Emulator.Dispose();
|
||||
Global.CoreComm = new CoreComm();
|
||||
|
@ -3275,9 +3290,9 @@ namespace BizHawk.MultiClient
|
|||
SetRebootIconStatus();
|
||||
}
|
||||
|
||||
public void CloseROM()
|
||||
public void CloseROM(bool clearSRAM = false)
|
||||
{
|
||||
CloseGame();
|
||||
CloseGame(clearSRAM);
|
||||
Global.CoreComm = new CoreComm();
|
||||
SyncCoreCommInputSignals();
|
||||
Global.Emulator = new NullEmulator(Global.CoreComm);
|
||||
|
@ -4272,5 +4287,10 @@ namespace BizHawk.MultiClient
|
|||
RamWatch1.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void clearSRAMToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
CloseROM(clearSRAM: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue