more cdlogger ux improvements; fixes #1346

This commit is contained in:
zeromus 2018-11-13 02:06:39 -05:00
parent 872af8517f
commit 026bd3e1e5
3 changed files with 42 additions and 10 deletions

View File

@ -132,7 +132,7 @@ namespace BizHawk.Client.Common
public DateTime? Update_LastCheckTimeUTC = null;
public string Update_LatestVersion = "";
public string Update_IgnoreVersion = "";
public bool CDLAutoSave = true, CDLAutoStart = true;
public bool CDLAutoSave = true, CDLAutoStart = true, CDLAutoResume = true;
/// <summary>
/// Makes a .bak file before any saveram-writing operation (could be extended to make timestamped backups)

View File

@ -30,11 +30,6 @@ namespace BizHawk.Client.EmuHawk
set
{
_recent_fld = value;
//if (_recent_fld.AutoLoad && !_recent_fld.Empty)
//{
// LoadFile(_recent.MostRecent);
// SetCurrentFilename(_recent.MostRecent);
//}
}
}
@ -189,8 +184,12 @@ namespace BizHawk.Client.EmuHawk
return true;
//try auto-saving if appropriate
if (!Global.Config.CDLAutoSave)
if (Global.Config.CDLAutoSave)
{
RunSave();
ShutdownCDL();
return true;
}
//TODO - I dont like this system. It's hard to figure out how to use it. It should be done in multiple passes.
var result = MessageBox.Show("Save changes to CDL session?", "CDL Auto Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
@ -255,7 +254,10 @@ namespace BizHawk.Client.EmuHawk
_cdl = newCDL;
CodeDataLogger.SetCDL(null);
if (tsbLoggingActive.Checked || Global.Config.CDLAutoStart)
{
tsbLoggingActive.Checked = true;
CodeDataLogger.SetCDL(_cdl);
}
SetCurrentFilename(path);
}
@ -274,6 +276,7 @@ namespace BizHawk.Client.EmuHawk
miAutoSave.Checked = Global.Config.CDLAutoSave;
miAutoStart.Checked = Global.Config.CDLAutoStart;
miAutoResume.Checked = Global.Config.CDLAutoResume;
}
private void RecentSubMenu_DropDownOpened(object sender, EventArgs e)
@ -487,6 +490,23 @@ namespace BizHawk.Client.EmuHawk
private void CDL_Load(object sender, EventArgs e)
{
if (Global.Config.CDLAutoResume)
{
try
{
autoloading = true;
var autoresume_file = PathManager.FilesystemSafeName(Global.Game) + ".cdl";
var autoresume_dir = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null);
var autoresume_path = Path.Combine(autoresume_dir, autoresume_file);
if (File.Exists(autoresume_path))
LoadFile(autoresume_path);
}
finally
{
autoloading = false;
}
}
if (_recent_fld.AutoLoad && !_recent_fld.Empty)
{
if (File.Exists(_recent.MostRecent))
@ -567,6 +587,9 @@ namespace BizHawk.Client.EmuHawk
Global.Config.CDLAutoStart ^= true;
}
private void miAutoResume_Click(object sender, EventArgs e)
{
Global.Config.CDLAutoResume ^= true;
}
}
}

View File

@ -66,6 +66,7 @@
this.colFlag20 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag40 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.colFlag80 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.miAutoResume = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
@ -92,6 +93,7 @@
this.RecentSubMenu,
this.miAutoStart,
this.miAutoSave,
this.miAutoResume,
this.toolStripSeparator2,
this.ClearMenuItem,
this.DisassembleMenuItem,
@ -366,6 +368,13 @@
//
this.colFlag80.Text = "0x80";
//
// miAutoResume
//
this.miAutoResume.Name = "miAutoResume";
this.miAutoResume.Size = new System.Drawing.Size(193, 22);
this.miAutoResume.Text = "Auto-Resume";
this.miAutoResume.Click += new System.EventHandler(this.miAutoResume_Click);
//
// CDL
//
this.AllowDrop = true;
@ -431,7 +440,7 @@
private System.Windows.Forms.ToolStripButton tsbExportText;
private System.Windows.Forms.ToolStripMenuItem miAutoStart;
private System.Windows.Forms.ToolStripMenuItem miAutoSave;
private ToolStripEx toolStrip1;
private ToolStripEx toolStrip1;
private System.Windows.Forms.ToolStripMenuItem miAutoResume;
}
}