Single Instance mode feature, currently though Bizhawk crashes on exit when in single instance mode

This commit is contained in:
andres.delikat 2011-05-23 00:33:05 +00:00
parent 36a0580dca
commit 18a32d35e6
5 changed files with 95 additions and 39 deletions

View File

@ -57,6 +57,7 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>.\LuaInterface.dll</HintPath> <HintPath>.\LuaInterface.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="Newtonsoft.Json, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\Newtonsoft.Json.dll</HintPath> <HintPath>..\Newtonsoft.Json.dll</HintPath>

View File

@ -97,6 +97,7 @@
public int MainWndy = -1; public int MainWndy = -1;
public bool RunInBackground = true; public bool RunInBackground = true;
public bool AcceptBackgroundInput = false; public bool AcceptBackgroundInput = false;
public bool SingleInstanceMode = false;
// Run-Control settings // Run-Control settings
public int FrameProgressDelayMs = 500; //how long until a frame advance hold turns into a frame progress? public int FrameProgressDelayMs = 500; //how long until a frame advance hold turns into a frame progress?

View File

@ -172,6 +172,7 @@
this.rAMSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.rAMSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.rAMPokeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.rAMPokeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.hexEditorToolStripMenuItem = 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.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
this.luaConsoleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.luaConsoleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.cheatsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.cheatsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -190,7 +191,7 @@
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.EmuStatus = new System.Windows.Forms.ToolStripStatusLabel(); 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.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -238,7 +239,7 @@
// openROMToolStripMenuItem // openROMToolStripMenuItem
// //
this.openROMToolStripMenuItem.Name = "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.Text = "Open ROM";
this.openROMToolStripMenuItem.Click += new System.EventHandler(this.openROMToolStripMenuItem_Click); this.openROMToolStripMenuItem.Click += new System.EventHandler(this.openROMToolStripMenuItem_Click);
// //
@ -250,7 +251,7 @@
this.clearToolStripMenuItem, this.clearToolStripMenuItem,
this.autoloadMostRecentToolStripMenuItem}); this.autoloadMostRecentToolStripMenuItem});
this.recentROMToolStripMenuItem.Name = "recentROMToolStripMenuItem"; 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.Text = "Recent ROM";
this.recentROMToolStripMenuItem.DropDownOpened += new System.EventHandler(this.recentROMToolStripMenuItem_DropDownOpened); this.recentROMToolStripMenuItem.DropDownOpened += new System.EventHandler(this.recentROMToolStripMenuItem_DropDownOpened);
// //
@ -282,14 +283,14 @@
// closeROMToolStripMenuItem // closeROMToolStripMenuItem
// //
this.closeROMToolStripMenuItem.Name = "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.Text = "&Close ROM";
this.closeROMToolStripMenuItem.Click += new System.EventHandler(this.closeROMToolStripMenuItem_Click); this.closeROMToolStripMenuItem.Click += new System.EventHandler(this.closeROMToolStripMenuItem_Click);
// //
// toolStripMenuItem1 // toolStripMenuItem1
// //
this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6); this.toolStripMenuItem1.Size = new System.Drawing.Size(142, 6);
// //
// saveStateToolStripMenuItem // saveStateToolStripMenuItem
// //
@ -307,7 +308,7 @@
this.toolStripSeparator6, this.toolStripSeparator6,
this.saveNamedStateToolStripMenuItem}); this.saveNamedStateToolStripMenuItem});
this.saveStateToolStripMenuItem.Name = "saveStateToolStripMenuItem"; 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.Text = "Save State";
this.saveStateToolStripMenuItem.DropDownOpened += new System.EventHandler(this.saveStateToolStripMenuItem_DropDownOpened); this.saveStateToolStripMenuItem.DropDownOpened += new System.EventHandler(this.saveStateToolStripMenuItem_DropDownOpened);
// //
@ -409,7 +410,7 @@
this.toolStripSeparator7, this.toolStripSeparator7,
this.loadNamedStateToolStripMenuItem}); this.loadNamedStateToolStripMenuItem});
this.loadStateToolStripMenuItem.Name = "loadStateToolStripMenuItem"; 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.Text = "Load State";
this.loadStateToolStripMenuItem.DropDownOpened += new System.EventHandler(this.loadStateToolStripMenuItem_DropDownOpened); this.loadStateToolStripMenuItem.DropDownOpened += new System.EventHandler(this.loadStateToolStripMenuItem_DropDownOpened);
// //
@ -514,7 +515,7 @@
this.saveToCurrentSlotToolStripMenuItem, this.saveToCurrentSlotToolStripMenuItem,
this.loadCurrentSlotToolStripMenuItem}); this.loadCurrentSlotToolStripMenuItem});
this.saveSlotToolStripMenuItem.Name = "saveSlotToolStripMenuItem"; 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.Text = "SaveSlot";
this.saveSlotToolStripMenuItem.DropDownOpened += new System.EventHandler(this.saveSlotToolStripMenuItem_DropDownOpened); this.saveSlotToolStripMenuItem.DropDownOpened += new System.EventHandler(this.saveSlotToolStripMenuItem_DropDownOpened);
// //
@ -624,7 +625,7 @@
// toolStripMenuItem2 // toolStripMenuItem2
// //
this.toolStripMenuItem2.Name = "toolStripMenuItem2"; this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(149, 6); this.toolStripMenuItem2.Size = new System.Drawing.Size(142, 6);
// //
// movieToolStripMenuItem // movieToolStripMenuItem
// //
@ -639,7 +640,7 @@
this.toolStripSeparator14, this.toolStripSeparator14,
this.bindSavestatesToMoviesToolStripMenuItem}); this.bindSavestatesToMoviesToolStripMenuItem});
this.movieToolStripMenuItem.Name = "movieToolStripMenuItem"; 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.Text = "Movie";
this.movieToolStripMenuItem.DropDownOpened += new System.EventHandler(this.movieToolStripMenuItem_DropDownOpened); this.movieToolStripMenuItem.DropDownOpened += new System.EventHandler(this.movieToolStripMenuItem_DropDownOpened);
// //
@ -736,7 +737,7 @@
this.screenshotF12ToolStripMenuItem, this.screenshotF12ToolStripMenuItem,
this.screenshotAsToolStripMenuItem}); this.screenshotAsToolStripMenuItem});
this.screenshotToolStripMenuItem.Name = "screenshotToolStripMenuItem"; 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"; this.screenshotToolStripMenuItem.Text = "Screenshot";
// //
// screenshotF12ToolStripMenuItem // screenshotF12ToolStripMenuItem
@ -756,13 +757,13 @@
// toolStripSeparator4 // toolStripSeparator4
// //
this.toolStripSeparator4.Name = "toolStripSeparator4"; this.toolStripSeparator4.Name = "toolStripSeparator4";
this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6); this.toolStripSeparator4.Size = new System.Drawing.Size(142, 6);
// //
// exitToolStripMenuItem // exitToolStripMenuItem
// //
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4))); 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.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
// //
@ -783,33 +784,33 @@
// pauseToolStripMenuItem // pauseToolStripMenuItem
// //
this.pauseToolStripMenuItem.Name = "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.Text = "&Pause";
this.pauseToolStripMenuItem.Click += new System.EventHandler(this.pauseToolStripMenuItem_Click); this.pauseToolStripMenuItem.Click += new System.EventHandler(this.pauseToolStripMenuItem_Click);
// //
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
// //
// powerToolStripMenuItem // powerToolStripMenuItem
// //
this.powerToolStripMenuItem.Name = "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.Text = "Power Cycle";
this.powerToolStripMenuItem.Click += new System.EventHandler(this.powerToolStripMenuItem_Click); this.powerToolStripMenuItem.Click += new System.EventHandler(this.powerToolStripMenuItem_Click);
// //
// resetToolStripMenuItem // resetToolStripMenuItem
// //
this.resetToolStripMenuItem.Name = "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.Text = "&Reset";
this.resetToolStripMenuItem.Click += new System.EventHandler(this.resetToolStripMenuItem_Click); this.resetToolStripMenuItem.Click += new System.EventHandler(this.resetToolStripMenuItem_Click);
// //
// toolStripSeparator8 // toolStripSeparator8
// //
this.toolStripSeparator8.Name = "toolStripSeparator8"; this.toolStripSeparator8.Name = "toolStripSeparator8";
this.toolStripSeparator8.Size = new System.Drawing.Size(141, 6); this.toolStripSeparator8.Size = new System.Drawing.Size(149, 6);
// //
// sega8bitToolStripMenuItem // sega8bitToolStripMenuItem
// //
@ -818,7 +819,7 @@
this.overclockWhenKnownSafeToolStripMenuItem, this.overclockWhenKnownSafeToolStripMenuItem,
this.forceStereoSeparationToolStripMenuItem}); this.forceStereoSeparationToolStripMenuItem});
this.sega8bitToolStripMenuItem.Name = "sega8bitToolStripMenuItem"; 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"; this.sega8bitToolStripMenuItem.Text = "Sega 8-bit";
// //
// enableFMChipToolStripMenuItem // enableFMChipToolStripMenuItem
@ -981,40 +982,40 @@
// controllersToolStripMenuItem // controllersToolStripMenuItem
// //
this.controllersToolStripMenuItem.Name = "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.Text = "&Controllers...";
this.controllersToolStripMenuItem.Click += new System.EventHandler(this.controllersToolStripMenuItem_Click); this.controllersToolStripMenuItem.Click += new System.EventHandler(this.controllersToolStripMenuItem_Click);
// //
// hotkeysToolStripMenuItem // hotkeysToolStripMenuItem
// //
this.hotkeysToolStripMenuItem.Name = "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.Text = "&Hotkeys...";
this.hotkeysToolStripMenuItem.Click += new System.EventHandler(this.hotkeysToolStripMenuItem_Click); this.hotkeysToolStripMenuItem.Click += new System.EventHandler(this.hotkeysToolStripMenuItem_Click);
// //
// messagesToolStripMenuItem // messagesToolStripMenuItem
// //
this.messagesToolStripMenuItem.Name = "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.Text = "&Messages...";
this.messagesToolStripMenuItem.Click += new System.EventHandler(this.messagesToolStripMenuItem_Click); this.messagesToolStripMenuItem.Click += new System.EventHandler(this.messagesToolStripMenuItem_Click);
// //
// pathsToolStripMenuItem // pathsToolStripMenuItem
// //
this.pathsToolStripMenuItem.Name = "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.Text = "Paths...";
this.pathsToolStripMenuItem.Click += new System.EventHandler(this.pathsToolStripMenuItem_Click); this.pathsToolStripMenuItem.Click += new System.EventHandler(this.pathsToolStripMenuItem_Click);
// //
// toolStripSeparator9 // toolStripSeparator9
// //
this.toolStripSeparator9.Name = "toolStripSeparator9"; this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(146, 6); this.toolStripSeparator9.Size = new System.Drawing.Size(149, 6);
// //
// soundToolStripMenuItem // soundToolStripMenuItem
// //
this.soundToolStripMenuItem.Name = "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.Text = "&Sound";
this.soundToolStripMenuItem.Click += new System.EventHandler(this.soundToolStripMenuItem_Click); this.soundToolStripMenuItem.Click += new System.EventHandler(this.soundToolStripMenuItem_Click);
// //
@ -1027,9 +1028,10 @@
this.enableRewindToolStripMenuItem, this.enableRewindToolStripMenuItem,
this.forceGDIPPresentationToolStripMenuItem, this.forceGDIPPresentationToolStripMenuItem,
this.runInBackgroundToolStripMenuItem, this.runInBackgroundToolStripMenuItem,
this.acceptBackgroundInputToolStripMenuItem}); this.acceptBackgroundInputToolStripMenuItem,
this.singleInstanceModeToolStripMenuItem});
this.gUIToolStripMenuItem.Name = "gUIToolStripMenuItem"; 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.Text = "GUI";
this.gUIToolStripMenuItem.DropDownOpened += new System.EventHandler(this.gUIToolStripMenuItem_DropDownOpened); this.gUIToolStripMenuItem.DropDownOpened += new System.EventHandler(this.gUIToolStripMenuItem_DropDownOpened);
// //
@ -1106,7 +1108,7 @@
this.miSpeed150, this.miSpeed150,
this.miSpeed200}); this.miSpeed200});
this.frameSkipToolStripMenuItem.Name = "frameSkipToolStripMenuItem"; 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.Text = "Speed/Skip";
this.frameSkipToolStripMenuItem.DropDownOpened += new System.EventHandler(this.frameSkipToolStripMenuItem_DropDownOpened); this.frameSkipToolStripMenuItem.DropDownOpened += new System.EventHandler(this.frameSkipToolStripMenuItem_DropDownOpened);
// //
@ -1249,19 +1251,19 @@
// toolStripSeparator10 // toolStripSeparator10
// //
this.toolStripSeparator10.Name = "toolStripSeparator10"; this.toolStripSeparator10.Name = "toolStripSeparator10";
this.toolStripSeparator10.Size = new System.Drawing.Size(146, 6); this.toolStripSeparator10.Size = new System.Drawing.Size(149, 6);
// //
// saveConfigToolStripMenuItem // saveConfigToolStripMenuItem
// //
this.saveConfigToolStripMenuItem.Name = "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.Text = "Save Config";
this.saveConfigToolStripMenuItem.Click += new System.EventHandler(this.saveConfigToolStripMenuItem_Click); this.saveConfigToolStripMenuItem.Click += new System.EventHandler(this.saveConfigToolStripMenuItem_Click);
// //
// loadConfigToolStripMenuItem // loadConfigToolStripMenuItem
// //
this.loadConfigToolStripMenuItem.Name = "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"; this.loadConfigToolStripMenuItem.Text = "Load Config";
// //
// toolsToolStripMenuItem // toolsToolStripMenuItem
@ -1322,6 +1324,13 @@
this.hexEditorToolStripMenuItem.Text = "&Hex Editor"; this.hexEditorToolStripMenuItem.Text = "&Hex Editor";
this.hexEditorToolStripMenuItem.Click += new System.EventHandler(this.hexEditorToolStripMenuItem_Click); 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 // toolStripSeparator11
// //
this.toolStripSeparator11.Name = "toolStripSeparator11"; this.toolStripSeparator11.Name = "toolStripSeparator11";
@ -1463,12 +1472,12 @@
this.EmuStatus.Size = new System.Drawing.Size(143, 17); this.EmuStatus.Size = new System.Drawing.Size(143, 17);
this.EmuStatus.Text = "Currently emulating: ur mom"; this.EmuStatus.Text = "Currently emulating: ur mom";
// //
// tAStudioToolStripMenuItem // singleInstanceModeToolStripMenuItem
// //
this.tAStudioToolStripMenuItem.Name = "tAStudioToolStripMenuItem"; this.singleInstanceModeToolStripMenuItem.Name = "singleInstanceModeToolStripMenuItem";
this.tAStudioToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.singleInstanceModeToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
this.tAStudioToolStripMenuItem.Text = "&TAStudio"; this.singleInstanceModeToolStripMenuItem.Text = "Single Instance Mode";
this.tAStudioToolStripMenuItem.Click += new System.EventHandler(this.tAStudioToolStripMenuItem_Click); this.singleInstanceModeToolStripMenuItem.Click += new System.EventHandler(this.singleInstanceModeToolStripMenuItem_Click);
// //
// MainForm // MainForm
// //
@ -1661,6 +1670,7 @@
private System.Windows.Forms.ToolStripMenuItem bindSavestatesToMoviesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem bindSavestatesToMoviesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem acceptBackgroundInputToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem acceptBackgroundInputToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem tAStudioToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem tAStudioToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem singleInstanceModeToolStripMenuItem;
} }
} }

View File

@ -1740,6 +1740,7 @@ namespace BizHawk.MultiClient
enableRewindToolStripMenuItem.Checked = Global.Config.RewindEnabled; enableRewindToolStripMenuItem.Checked = Global.Config.RewindEnabled;
forceGDIPPresentationToolStripMenuItem.Checked = Global.Config.ForceGDI; forceGDIPPresentationToolStripMenuItem.Checked = Global.Config.ForceGDI;
acceptBackgroundInputToolStripMenuItem.Checked = Global.Config.AcceptBackgroundInput; acceptBackgroundInputToolStripMenuItem.Checked = Global.Config.AcceptBackgroundInput;
singleInstanceModeToolStripMenuItem.Checked = Global.Config.SingleInstanceMode;
} }
private void MainForm_Load(object sender, EventArgs e) private void MainForm_Load(object sender, EventArgs e)
@ -2012,5 +2013,10 @@ namespace BizHawk.MultiClient
{ {
LoadTAStudio(); LoadTAStudio();
} }
private void singleInstanceModeToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.SingleInstanceMode ^= true;
}
} }
} }

View File

@ -2,6 +2,7 @@
using System.Windows.Forms; using System.Windows.Forms;
using SlimDX.Direct3D9; using SlimDX.Direct3D9;
using SlimDX.DirectSound; using SlimDX.DirectSound;
using Microsoft.VisualBasic.ApplicationServices;
namespace BizHawk.MultiClient namespace BizHawk.MultiClient
{ {
@ -29,9 +30,17 @@ namespace BizHawk.MultiClient
} }
try { try {
if (Global.Config.SingleInstanceMode)
{
SingleInstanceController controller = new SingleInstanceController(args);
controller.Run(args);
}
else
{
var mf = new MainForm(args); var mf = new MainForm(args);
mf.Show(); mf.Show();
mf.ProgramRunLoop(); mf.ProgramRunLoop();
}
} catch (Exception e) { } catch (Exception e) {
MessageBox.Show(e.ToString(), "Oh, no, a terrible thing happened!\n\n" + e.ToString()); MessageBox.Show(e.ToString(), "Oh, no, a terrible thing happened!\n\n" + e.ToString());
} finally { } finally {
@ -40,6 +49,35 @@ namespace BizHawk.MultiClient
if (Global.Direct3D != null && Global.Direct3D.Disposed == false) if (Global.Direct3D != null && Global.Direct3D.Disposed == false)
Global.Direct3D.Dispose(); 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();
}
} }
} }
} }