This commit is contained in:
alyosha-tas 2018-11-12 09:29:23 -06:00
commit a3e0a9818e
1 changed files with 28 additions and 16 deletions

View File

@ -30,7 +30,7 @@ namespace BizHawk.Client.EmuHawk
set set
{ {
_recent_fld = value; _recent_fld = value;
if (_recent_fld.AutoLoad) if (_recent_fld.AutoLoad && !_recent_fld.Empty)
{ {
LoadFile(_recent.MostRecent); LoadFile(_recent.MostRecent);
SetCurrentFilename(_recent.MostRecent); SetCurrentFilename(_recent.MostRecent);
@ -189,23 +189,28 @@ namespace BizHawk.Client.EmuHawk
return true; return true;
//try auto-saving if appropriate //try auto-saving if appropriate
if (Global.Config.CDLAutoSave) if (!Global.Config.CDLAutoSave)
{ 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);
if (result == DialogResult.No)
return true;
if (string.IsNullOrWhiteSpace(_currentFilename)) //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);
if (!RunSaveAs()) if (result == DialogResult.No)
return false; {
} ShutdownCDL();
else return true;
{ }
RunSave();
if (string.IsNullOrWhiteSpace(_currentFilename))
{
if (RunSaveAs())
return true; return true;
} else return false;
}
else
{
RunSave();
ShutdownCDL();
return true;
} }
return true; return true;
@ -432,9 +437,16 @@ namespace BizHawk.Client.EmuHawk
private void ExitMenuItem_Click(object sender, EventArgs e) private void ExitMenuItem_Click(object sender, EventArgs e)
{ {
ShutdownCDL();
Close(); Close();
} }
void ShutdownCDL()
{
_cdl = null;
CodeDataLogger.SetCDL(null);
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e) protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{ {
if (!AskSaveChanges()) if (!AskSaveChanges())