Single Instance mode feature, currently though Bizhawk crashes on exit when in single instance mode
This commit is contained in:
parent
36a0580dca
commit
18a32d35e6
|
@ -57,6 +57,7 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>.\LuaInterface.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="Newtonsoft.Json, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Newtonsoft.Json.dll</HintPath>
|
||||
|
|
|
@ -97,6 +97,7 @@
|
|||
public int MainWndy = -1;
|
||||
public bool RunInBackground = true;
|
||||
public bool AcceptBackgroundInput = false;
|
||||
public bool SingleInstanceMode = false;
|
||||
|
||||
// Run-Control settings
|
||||
public int FrameProgressDelayMs = 500; //how long until a frame advance hold turns into a frame progress?
|
||||
|
|
|
@ -172,6 +172,7 @@
|
|||
this.rAMSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.rAMPokeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.hexEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tAStudioToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.luaConsoleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cheatsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -190,7 +191,7 @@
|
|||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.EmuStatus = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.tAStudioToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.singleInstanceModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
@ -238,7 +239,7 @@
|
|||
// openROMToolStripMenuItem
|
||||
//
|
||||
this.openROMToolStripMenuItem.Name = "openROMToolStripMenuItem";
|
||||
this.openROMToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.openROMToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.openROMToolStripMenuItem.Text = "Open ROM";
|
||||
this.openROMToolStripMenuItem.Click += new System.EventHandler(this.openROMToolStripMenuItem_Click);
|
||||
//
|
||||
|
@ -250,7 +251,7 @@
|
|||
this.clearToolStripMenuItem,
|
||||
this.autoloadMostRecentToolStripMenuItem});
|
||||
this.recentROMToolStripMenuItem.Name = "recentROMToolStripMenuItem";
|
||||
this.recentROMToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.recentROMToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.recentROMToolStripMenuItem.Text = "Recent ROM";
|
||||
this.recentROMToolStripMenuItem.DropDownOpened += new System.EventHandler(this.recentROMToolStripMenuItem_DropDownOpened);
|
||||
//
|
||||
|
@ -282,14 +283,14 @@
|
|||
// closeROMToolStripMenuItem
|
||||
//
|
||||
this.closeROMToolStripMenuItem.Name = "closeROMToolStripMenuItem";
|
||||
this.closeROMToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.closeROMToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.closeROMToolStripMenuItem.Text = "&Close ROM";
|
||||
this.closeROMToolStripMenuItem.Click += new System.EventHandler(this.closeROMToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripMenuItem1
|
||||
//
|
||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6);
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(142, 6);
|
||||
//
|
||||
// saveStateToolStripMenuItem
|
||||
//
|
||||
|
@ -307,7 +308,7 @@
|
|||
this.toolStripSeparator6,
|
||||
this.saveNamedStateToolStripMenuItem});
|
||||
this.saveStateToolStripMenuItem.Name = "saveStateToolStripMenuItem";
|
||||
this.saveStateToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.saveStateToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.saveStateToolStripMenuItem.Text = "Save State";
|
||||
this.saveStateToolStripMenuItem.DropDownOpened += new System.EventHandler(this.saveStateToolStripMenuItem_DropDownOpened);
|
||||
//
|
||||
|
@ -409,7 +410,7 @@
|
|||
this.toolStripSeparator7,
|
||||
this.loadNamedStateToolStripMenuItem});
|
||||
this.loadStateToolStripMenuItem.Name = "loadStateToolStripMenuItem";
|
||||
this.loadStateToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.loadStateToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.loadStateToolStripMenuItem.Text = "Load State";
|
||||
this.loadStateToolStripMenuItem.DropDownOpened += new System.EventHandler(this.loadStateToolStripMenuItem_DropDownOpened);
|
||||
//
|
||||
|
@ -514,7 +515,7 @@
|
|||
this.saveToCurrentSlotToolStripMenuItem,
|
||||
this.loadCurrentSlotToolStripMenuItem});
|
||||
this.saveSlotToolStripMenuItem.Name = "saveSlotToolStripMenuItem";
|
||||
this.saveSlotToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.saveSlotToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.saveSlotToolStripMenuItem.Text = "SaveSlot";
|
||||
this.saveSlotToolStripMenuItem.DropDownOpened += new System.EventHandler(this.saveSlotToolStripMenuItem_DropDownOpened);
|
||||
//
|
||||
|
@ -624,7 +625,7 @@
|
|||
// toolStripMenuItem2
|
||||
//
|
||||
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(149, 6);
|
||||
this.toolStripMenuItem2.Size = new System.Drawing.Size(142, 6);
|
||||
//
|
||||
// movieToolStripMenuItem
|
||||
//
|
||||
|
@ -639,7 +640,7 @@
|
|||
this.toolStripSeparator14,
|
||||
this.bindSavestatesToMoviesToolStripMenuItem});
|
||||
this.movieToolStripMenuItem.Name = "movieToolStripMenuItem";
|
||||
this.movieToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.movieToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.movieToolStripMenuItem.Text = "Movie";
|
||||
this.movieToolStripMenuItem.DropDownOpened += new System.EventHandler(this.movieToolStripMenuItem_DropDownOpened);
|
||||
//
|
||||
|
@ -736,7 +737,7 @@
|
|||
this.screenshotF12ToolStripMenuItem,
|
||||
this.screenshotAsToolStripMenuItem});
|
||||
this.screenshotToolStripMenuItem.Name = "screenshotToolStripMenuItem";
|
||||
this.screenshotToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.screenshotToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.screenshotToolStripMenuItem.Text = "Screenshot";
|
||||
//
|
||||
// screenshotF12ToolStripMenuItem
|
||||
|
@ -756,13 +757,13 @@
|
|||
// toolStripSeparator4
|
||||
//
|
||||
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
||||
this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6);
|
||||
this.toolStripSeparator4.Size = new System.Drawing.Size(142, 6);
|
||||
//
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||
this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
|
||||
this.exitToolStripMenuItem.Text = "Exit";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||
//
|
||||
|
@ -783,33 +784,33 @@
|
|||
// pauseToolStripMenuItem
|
||||
//
|
||||
this.pauseToolStripMenuItem.Name = "pauseToolStripMenuItem";
|
||||
this.pauseToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||
this.pauseToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.pauseToolStripMenuItem.Text = "&Pause";
|
||||
this.pauseToolStripMenuItem.Click += new System.EventHandler(this.pauseToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(141, 6);
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// powerToolStripMenuItem
|
||||
//
|
||||
this.powerToolStripMenuItem.Name = "powerToolStripMenuItem";
|
||||
this.powerToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||
this.powerToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.powerToolStripMenuItem.Text = "Power Cycle";
|
||||
this.powerToolStripMenuItem.Click += new System.EventHandler(this.powerToolStripMenuItem_Click);
|
||||
//
|
||||
// resetToolStripMenuItem
|
||||
//
|
||||
this.resetToolStripMenuItem.Name = "resetToolStripMenuItem";
|
||||
this.resetToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||
this.resetToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.resetToolStripMenuItem.Text = "&Reset";
|
||||
this.resetToolStripMenuItem.Click += new System.EventHandler(this.resetToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator8
|
||||
//
|
||||
this.toolStripSeparator8.Name = "toolStripSeparator8";
|
||||
this.toolStripSeparator8.Size = new System.Drawing.Size(141, 6);
|
||||
this.toolStripSeparator8.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// sega8bitToolStripMenuItem
|
||||
//
|
||||
|
@ -818,7 +819,7 @@
|
|||
this.overclockWhenKnownSafeToolStripMenuItem,
|
||||
this.forceStereoSeparationToolStripMenuItem});
|
||||
this.sega8bitToolStripMenuItem.Name = "sega8bitToolStripMenuItem";
|
||||
this.sega8bitToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||
this.sega8bitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.sega8bitToolStripMenuItem.Text = "Sega 8-bit";
|
||||
//
|
||||
// enableFMChipToolStripMenuItem
|
||||
|
@ -981,40 +982,40 @@
|
|||
// controllersToolStripMenuItem
|
||||
//
|
||||
this.controllersToolStripMenuItem.Name = "controllersToolStripMenuItem";
|
||||
this.controllersToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
||||
this.controllersToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.controllersToolStripMenuItem.Text = "&Controllers...";
|
||||
this.controllersToolStripMenuItem.Click += new System.EventHandler(this.controllersToolStripMenuItem_Click);
|
||||
//
|
||||
// hotkeysToolStripMenuItem
|
||||
//
|
||||
this.hotkeysToolStripMenuItem.Name = "hotkeysToolStripMenuItem";
|
||||
this.hotkeysToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
||||
this.hotkeysToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.hotkeysToolStripMenuItem.Text = "&Hotkeys...";
|
||||
this.hotkeysToolStripMenuItem.Click += new System.EventHandler(this.hotkeysToolStripMenuItem_Click);
|
||||
//
|
||||
// messagesToolStripMenuItem
|
||||
//
|
||||
this.messagesToolStripMenuItem.Name = "messagesToolStripMenuItem";
|
||||
this.messagesToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
||||
this.messagesToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.messagesToolStripMenuItem.Text = "&Messages...";
|
||||
this.messagesToolStripMenuItem.Click += new System.EventHandler(this.messagesToolStripMenuItem_Click);
|
||||
//
|
||||
// pathsToolStripMenuItem
|
||||
//
|
||||
this.pathsToolStripMenuItem.Name = "pathsToolStripMenuItem";
|
||||
this.pathsToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
||||
this.pathsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.pathsToolStripMenuItem.Text = "Paths...";
|
||||
this.pathsToolStripMenuItem.Click += new System.EventHandler(this.pathsToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator9
|
||||
//
|
||||
this.toolStripSeparator9.Name = "toolStripSeparator9";
|
||||
this.toolStripSeparator9.Size = new System.Drawing.Size(146, 6);
|
||||
this.toolStripSeparator9.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// soundToolStripMenuItem
|
||||
//
|
||||
this.soundToolStripMenuItem.Name = "soundToolStripMenuItem";
|
||||
this.soundToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
||||
this.soundToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.soundToolStripMenuItem.Text = "&Sound";
|
||||
this.soundToolStripMenuItem.Click += new System.EventHandler(this.soundToolStripMenuItem_Click);
|
||||
//
|
||||
|
@ -1027,9 +1028,10 @@
|
|||
this.enableRewindToolStripMenuItem,
|
||||
this.forceGDIPPresentationToolStripMenuItem,
|
||||
this.runInBackgroundToolStripMenuItem,
|
||||
this.acceptBackgroundInputToolStripMenuItem});
|
||||
this.acceptBackgroundInputToolStripMenuItem,
|
||||
this.singleInstanceModeToolStripMenuItem});
|
||||
this.gUIToolStripMenuItem.Name = "gUIToolStripMenuItem";
|
||||
this.gUIToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
||||
this.gUIToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.gUIToolStripMenuItem.Text = "GUI";
|
||||
this.gUIToolStripMenuItem.DropDownOpened += new System.EventHandler(this.gUIToolStripMenuItem_DropDownOpened);
|
||||
//
|
||||
|
@ -1106,7 +1108,7 @@
|
|||
this.miSpeed150,
|
||||
this.miSpeed200});
|
||||
this.frameSkipToolStripMenuItem.Name = "frameSkipToolStripMenuItem";
|
||||
this.frameSkipToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
||||
this.frameSkipToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.frameSkipToolStripMenuItem.Text = "Speed/Skip";
|
||||
this.frameSkipToolStripMenuItem.DropDownOpened += new System.EventHandler(this.frameSkipToolStripMenuItem_DropDownOpened);
|
||||
//
|
||||
|
@ -1249,19 +1251,19 @@
|
|||
// toolStripSeparator10
|
||||
//
|
||||
this.toolStripSeparator10.Name = "toolStripSeparator10";
|
||||
this.toolStripSeparator10.Size = new System.Drawing.Size(146, 6);
|
||||
this.toolStripSeparator10.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// saveConfigToolStripMenuItem
|
||||
//
|
||||
this.saveConfigToolStripMenuItem.Name = "saveConfigToolStripMenuItem";
|
||||
this.saveConfigToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
||||
this.saveConfigToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.saveConfigToolStripMenuItem.Text = "Save Config";
|
||||
this.saveConfigToolStripMenuItem.Click += new System.EventHandler(this.saveConfigToolStripMenuItem_Click);
|
||||
//
|
||||
// loadConfigToolStripMenuItem
|
||||
//
|
||||
this.loadConfigToolStripMenuItem.Name = "loadConfigToolStripMenuItem";
|
||||
this.loadConfigToolStripMenuItem.Size = new System.Drawing.Size(149, 22);
|
||||
this.loadConfigToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.loadConfigToolStripMenuItem.Text = "Load Config";
|
||||
//
|
||||
// toolsToolStripMenuItem
|
||||
|
@ -1322,6 +1324,13 @@
|
|||
this.hexEditorToolStripMenuItem.Text = "&Hex Editor";
|
||||
this.hexEditorToolStripMenuItem.Click += new System.EventHandler(this.hexEditorToolStripMenuItem_Click);
|
||||
//
|
||||
// tAStudioToolStripMenuItem
|
||||
//
|
||||
this.tAStudioToolStripMenuItem.Name = "tAStudioToolStripMenuItem";
|
||||
this.tAStudioToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.tAStudioToolStripMenuItem.Text = "&TAStudio";
|
||||
this.tAStudioToolStripMenuItem.Click += new System.EventHandler(this.tAStudioToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator11
|
||||
//
|
||||
this.toolStripSeparator11.Name = "toolStripSeparator11";
|
||||
|
@ -1463,12 +1472,12 @@
|
|||
this.EmuStatus.Size = new System.Drawing.Size(143, 17);
|
||||
this.EmuStatus.Text = "Currently emulating: ur mom";
|
||||
//
|
||||
// tAStudioToolStripMenuItem
|
||||
// singleInstanceModeToolStripMenuItem
|
||||
//
|
||||
this.tAStudioToolStripMenuItem.Name = "tAStudioToolStripMenuItem";
|
||||
this.tAStudioToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.tAStudioToolStripMenuItem.Text = "&TAStudio";
|
||||
this.tAStudioToolStripMenuItem.Click += new System.EventHandler(this.tAStudioToolStripMenuItem_Click);
|
||||
this.singleInstanceModeToolStripMenuItem.Name = "singleInstanceModeToolStripMenuItem";
|
||||
this.singleInstanceModeToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
|
||||
this.singleInstanceModeToolStripMenuItem.Text = "Single Instance Mode";
|
||||
this.singleInstanceModeToolStripMenuItem.Click += new System.EventHandler(this.singleInstanceModeToolStripMenuItem_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
|
@ -1661,6 +1670,7 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem bindSavestatesToMoviesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem acceptBackgroundInputToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem tAStudioToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem singleInstanceModeToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1740,6 +1740,7 @@ namespace BizHawk.MultiClient
|
|||
enableRewindToolStripMenuItem.Checked = Global.Config.RewindEnabled;
|
||||
forceGDIPPresentationToolStripMenuItem.Checked = Global.Config.ForceGDI;
|
||||
acceptBackgroundInputToolStripMenuItem.Checked = Global.Config.AcceptBackgroundInput;
|
||||
singleInstanceModeToolStripMenuItem.Checked = Global.Config.SingleInstanceMode;
|
||||
}
|
||||
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
|
@ -2012,5 +2013,10 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
LoadTAStudio();
|
||||
}
|
||||
|
||||
private void singleInstanceModeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.SingleInstanceMode ^= true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
using System.Windows.Forms;
|
||||
using SlimDX.Direct3D9;
|
||||
using SlimDX.DirectSound;
|
||||
using Microsoft.VisualBasic.ApplicationServices;
|
||||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
|
@ -29,9 +30,17 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
|
||||
try {
|
||||
var mf = new MainForm(args);
|
||||
mf.Show();
|
||||
mf.ProgramRunLoop();
|
||||
if (Global.Config.SingleInstanceMode)
|
||||
{
|
||||
SingleInstanceController controller = new SingleInstanceController(args);
|
||||
controller.Run(args);
|
||||
}
|
||||
else
|
||||
{
|
||||
var mf = new MainForm(args);
|
||||
mf.Show();
|
||||
mf.ProgramRunLoop();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
MessageBox.Show(e.ToString(), "Oh, no, a terrible thing happened!\n\n" + e.ToString());
|
||||
} finally {
|
||||
|
@ -40,6 +49,35 @@ namespace BizHawk.MultiClient
|
|||
if (Global.Direct3D != null && Global.Direct3D.Disposed == false)
|
||||
Global.Direct3D.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class SingleInstanceController : WindowsFormsApplicationBase
|
||||
{
|
||||
MainForm mf;
|
||||
string[] cmdArgs;
|
||||
public SingleInstanceController(string[] args)
|
||||
{
|
||||
cmdArgs = args;
|
||||
IsSingleInstance = true;
|
||||
StartupNextInstance += this_StartupNextInstance;
|
||||
|
||||
}
|
||||
|
||||
void this_StartupNextInstance(object sender, StartupNextInstanceEventArgs e)
|
||||
{
|
||||
mf.LoadRom(e.CommandLine[0]);
|
||||
}
|
||||
|
||||
protected override void OnCreateMainForm()
|
||||
{
|
||||
MainForm = new RamWatch();
|
||||
|
||||
mf = new MainForm(cmdArgs);
|
||||
MainForm = mf;
|
||||
mf.Show();
|
||||
mf.ProgramRunLoop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue