Debugger: Lua - Add option to auto-restart scripts after power cycling or reloading the rom
This commit is contained in:
parent
9772aa006f
commit
527db70316
3 changed files with 42 additions and 12 deletions
|
@ -372,6 +372,7 @@ namespace Mesen.GUI.Config
|
|||
public int ScriptCodeWindowHeight = 0;
|
||||
public List<string> RecentScripts = new List<string>();
|
||||
public bool SaveScriptBeforeRun = true;
|
||||
public bool AutoRestartScript = true;
|
||||
public ScriptStartupBehavior ScriptStartupBehavior = ScriptStartupBehavior.ShowTutorial;
|
||||
public bool AutoLoadLastScript = true;
|
||||
public string ScriptFontFamily = BaseControl.MonospaceFontFamily;
|
||||
|
|
25
GUI.NET/Debugger/frmScript.Designer.cs
generated
25
GUI.NET/Debugger/frmScript.Designer.cs
generated
|
@ -80,6 +80,7 @@
|
|||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.lblScriptActive = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.mnuAutoRestart = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuMain.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.txtScriptContent)).BeginInit();
|
||||
this.contextMenu.SuspendLayout();
|
||||
|
@ -263,6 +264,7 @@
|
|||
this.mnuSetScriptTimeout,
|
||||
this.toolStripMenuItem3,
|
||||
this.mnuSaveBeforeRun,
|
||||
this.mnuAutoRestart,
|
||||
this.mnuAutoReload,
|
||||
this.onStartupToolStripMenuItem});
|
||||
this.scriptToolStripMenuItem.Name = "scriptToolStripMenuItem";
|
||||
|
@ -401,6 +403,7 @@
|
|||
this.txtScriptContent.Cursor = System.Windows.Forms.Cursors.IBeam;
|
||||
this.txtScriptContent.DisabledColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));
|
||||
this.txtScriptContent.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtScriptContent.Font = new System.Drawing.Font("Courier New", 9.75F);
|
||||
this.txtScriptContent.IsReplaceMode = false;
|
||||
this.txtScriptContent.Language = FastColoredTextBoxNS.Language.Lua;
|
||||
this.txtScriptContent.LeftBracket = '(';
|
||||
|
@ -426,13 +429,13 @@
|
|||
this.toolStripMenuItem5,
|
||||
this.mnuSelectAll});
|
||||
this.contextMenu.Name = "contextMenu";
|
||||
this.contextMenu.Size = new System.Drawing.Size(153, 120);
|
||||
this.contextMenu.Size = new System.Drawing.Size(123, 98);
|
||||
//
|
||||
// mnuCopy
|
||||
//
|
||||
this.mnuCopy.Image = global::Mesen.GUI.Properties.Resources.Copy;
|
||||
this.mnuCopy.Name = "mnuCopy";
|
||||
this.mnuCopy.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuCopy.Size = new System.Drawing.Size(122, 22);
|
||||
this.mnuCopy.Text = "Copy";
|
||||
this.mnuCopy.Click += new System.EventHandler(this.mnuCopy_Click);
|
||||
//
|
||||
|
@ -440,7 +443,7 @@
|
|||
//
|
||||
this.mnuCut.Image = global::Mesen.GUI.Properties.Resources.Cut;
|
||||
this.mnuCut.Name = "mnuCut";
|
||||
this.mnuCut.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuCut.Size = new System.Drawing.Size(122, 22);
|
||||
this.mnuCut.Text = "Cut";
|
||||
this.mnuCut.Click += new System.EventHandler(this.mnuCut_Click);
|
||||
//
|
||||
|
@ -448,20 +451,20 @@
|
|||
//
|
||||
this.mnuPaste.Image = global::Mesen.GUI.Properties.Resources.Paste;
|
||||
this.mnuPaste.Name = "mnuPaste";
|
||||
this.mnuPaste.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuPaste.Size = new System.Drawing.Size(122, 22);
|
||||
this.mnuPaste.Text = "Paste";
|
||||
this.mnuPaste.Click += new System.EventHandler(this.mnuPaste_Click);
|
||||
//
|
||||
// toolStripMenuItem5
|
||||
//
|
||||
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
|
||||
this.toolStripMenuItem5.Size = new System.Drawing.Size(149, 6);
|
||||
this.toolStripMenuItem5.Size = new System.Drawing.Size(119, 6);
|
||||
//
|
||||
// mnuSelectAll
|
||||
//
|
||||
this.mnuSelectAll.Image = global::Mesen.GUI.Properties.Resources.SelectAll;
|
||||
this.mnuSelectAll.Name = "mnuSelectAll";
|
||||
this.mnuSelectAll.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuSelectAll.Size = new System.Drawing.Size(122, 22);
|
||||
this.mnuSelectAll.Text = "Select All";
|
||||
this.mnuSelectAll.Click += new System.EventHandler(this.mnuSelectAll_Click);
|
||||
//
|
||||
|
@ -532,6 +535,13 @@
|
|||
this.lblScriptActive.Text = "Script is running";
|
||||
this.lblScriptActive.Visible = false;
|
||||
//
|
||||
// mnuAutoRestart
|
||||
//
|
||||
this.mnuAutoRestart.CheckOnClick = true;
|
||||
this.mnuAutoRestart.Name = "mnuAutoRestart";
|
||||
this.mnuAutoRestart.Size = new System.Drawing.Size(258, 22);
|
||||
this.mnuAutoRestart.Text = "Auto-restart after reload";
|
||||
//
|
||||
// frmScript
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -611,5 +621,6 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem mnuApiReference;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem7;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuSetScriptTimeout;
|
||||
}
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuAutoRestart;
|
||||
}
|
||||
}
|
|
@ -109,6 +109,7 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
RestoreLocation(config.ScriptWindowLocation, config.ScriptWindowSize);
|
||||
mnuSaveBeforeRun.Checked = config.SaveScriptBeforeRun;
|
||||
mnuAutoRestart.Checked = config.AutoRestartScript;
|
||||
|
||||
if(config.ScriptCodeWindowHeight >= ctrlSplit.Panel1MinSize) {
|
||||
if(config.ScriptCodeWindowHeight == Int32.MaxValue) {
|
||||
|
@ -151,11 +152,27 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
|
||||
{
|
||||
if(e.NotificationType == InteropEmu.ConsoleNotificationType.GameStopped) {
|
||||
this._scriptId = -1;
|
||||
this.BeginInvoke((Action)(() => {
|
||||
lblScriptActive.Visible = false;
|
||||
}));
|
||||
switch(e.NotificationType) {
|
||||
case InteropEmu.ConsoleNotificationType.EmulationStopped:
|
||||
this._scriptId = -1;
|
||||
break;
|
||||
|
||||
case InteropEmu.ConsoleNotificationType.GameStopped:
|
||||
if(e.Parameter == IntPtr.Zero) {
|
||||
this._scriptId = -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case InteropEmu.ConsoleNotificationType.GameInitCompleted:
|
||||
bool wasRunning = this._scriptId >= 0;
|
||||
this._scriptId = -1;
|
||||
this.BeginInvoke((Action)(() => {
|
||||
lblScriptActive.Visible = false;
|
||||
if(e.NotificationType == InteropEmu.ConsoleNotificationType.GameInitCompleted && wasRunning && mnuAutoRestart.Checked) {
|
||||
RunScript();
|
||||
}
|
||||
}));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,6 +202,7 @@ namespace Mesen.GUI.Debugger
|
|||
ConfigManager.Config.DebugInfo.ScriptFontStyle = txtScriptContent.OriginalFont.Style;
|
||||
ConfigManager.Config.DebugInfo.ScriptFontSize = txtScriptContent.OriginalFont.Size;
|
||||
ConfigManager.Config.DebugInfo.AutoLoadLastScript = mnuAutoLoadLastScript.Checked;
|
||||
ConfigManager.Config.DebugInfo.AutoRestartScript = mnuAutoRestart.Checked;
|
||||
ConfigManager.ApplyChanges();
|
||||
|
||||
base.OnClosing(e);
|
||||
|
|
Loading…
Add table
Reference in a new issue