Run in Background toggle

This commit is contained in:
andres.delikat 2011-05-21 03:30:32 +00:00
parent ed6ca16431
commit b019329f01
3 changed files with 65 additions and 34 deletions

View File

@ -95,6 +95,7 @@
public bool StartPaused = false;
public int MainWndx = -1; //Negative numbers will be ignored
public int MainWndy = -1;
public bool RunInBackground = true;
// Run-Control settings
public int FrameProgressDelayMs = 500; //how long until a frame advance hold turns into a frame progress?

View File

@ -188,6 +188,7 @@
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.EmuStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.runInBackgroundToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
@ -235,7 +236,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);
//
@ -247,7 +248,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);
//
@ -279,14 +280,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
//
@ -304,7 +305,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);
//
@ -406,7 +407,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);
//
@ -511,7 +512,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);
//
@ -621,7 +622,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
//
@ -636,7 +637,7 @@
this.toolStripSeparator14,
this.replayInputLogToolStripMenuItem});
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);
//
@ -733,7 +734,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
@ -753,13 +754,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);
//
@ -978,40 +979,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);
//
@ -1022,9 +1023,10 @@
this.saveWindowPositionToolStripMenuItem,
this.startPausedToolStripMenuItem,
this.enableRewindToolStripMenuItem,
this.forceGDIPPresentationToolStripMenuItem});
this.forceGDIPPresentationToolStripMenuItem,
this.runInBackgroundToolStripMenuItem});
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);
//
@ -1087,7 +1089,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);
//
@ -1230,19 +1232,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
@ -1265,59 +1267,59 @@
// toolBoxToolStripMenuItem
//
this.toolBoxToolStripMenuItem.Name = "toolBoxToolStripMenuItem";
this.toolBoxToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.toolBoxToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.toolBoxToolStripMenuItem.Text = "&Tool Box";
this.toolBoxToolStripMenuItem.Click += new System.EventHandler(this.toolBoxToolStripMenuItem_Click);
//
// toolStripSeparator12
//
this.toolStripSeparator12.Name = "toolStripSeparator12";
this.toolStripSeparator12.Size = new System.Drawing.Size(140, 6);
this.toolStripSeparator12.Size = new System.Drawing.Size(149, 6);
//
// rAMWatchToolStripMenuItem
//
this.rAMWatchToolStripMenuItem.Name = "rAMWatchToolStripMenuItem";
this.rAMWatchToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.rAMWatchToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.rAMWatchToolStripMenuItem.Text = "RAM &Watch";
this.rAMWatchToolStripMenuItem.Click += new System.EventHandler(this.RAMWatchToolStripMenuItem_Click);
//
// rAMSearchToolStripMenuItem
//
this.rAMSearchToolStripMenuItem.Name = "rAMSearchToolStripMenuItem";
this.rAMSearchToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.rAMSearchToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.rAMSearchToolStripMenuItem.Text = "RAM &Search";
this.rAMSearchToolStripMenuItem.Click += new System.EventHandler(this.rAMSearchToolStripMenuItem_Click);
//
// rAMPokeToolStripMenuItem
//
this.rAMPokeToolStripMenuItem.Name = "rAMPokeToolStripMenuItem";
this.rAMPokeToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.rAMPokeToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.rAMPokeToolStripMenuItem.Text = "RAM &Poke";
this.rAMPokeToolStripMenuItem.Click += new System.EventHandler(this.RAMPokeToolStripMenuItem_Click);
//
// hexEditorToolStripMenuItem
//
this.hexEditorToolStripMenuItem.Name = "hexEditorToolStripMenuItem";
this.hexEditorToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.hexEditorToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.hexEditorToolStripMenuItem.Text = "&Hex Editor";
this.hexEditorToolStripMenuItem.Click += new System.EventHandler(this.hexEditorToolStripMenuItem_Click);
//
// toolStripSeparator11
//
this.toolStripSeparator11.Name = "toolStripSeparator11";
this.toolStripSeparator11.Size = new System.Drawing.Size(140, 6);
this.toolStripSeparator11.Size = new System.Drawing.Size(149, 6);
//
// luaConsoleToolStripMenuItem
//
this.luaConsoleToolStripMenuItem.Name = "luaConsoleToolStripMenuItem";
this.luaConsoleToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.luaConsoleToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.luaConsoleToolStripMenuItem.Text = "Lua Console";
this.luaConsoleToolStripMenuItem.Click += new System.EventHandler(this.luaConsoleToolStripMenuItem_Click);
//
// cheatsToolStripMenuItem
//
this.cheatsToolStripMenuItem.Name = "cheatsToolStripMenuItem";
this.cheatsToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
this.cheatsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.cheatsToolStripMenuItem.Text = "Cheats";
this.cheatsToolStripMenuItem.Click += new System.EventHandler(this.cheatsToolStripMenuItem_Click);
//
@ -1443,6 +1445,13 @@
this.EmuStatus.Size = new System.Drawing.Size(143, 17);
this.EmuStatus.Text = "Currently emulating: ur mom";
//
// runInBackgroundToolStripMenuItem
//
this.runInBackgroundToolStripMenuItem.Name = "runInBackgroundToolStripMenuItem";
this.runInBackgroundToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
this.runInBackgroundToolStripMenuItem.Text = "Run in Background";
this.runInBackgroundToolStripMenuItem.Click += new System.EventHandler(this.runInBackgroundToolStripMenuItem_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F);
@ -1457,8 +1466,10 @@
this.MaximizeBox = false;
this.Name = "MainForm";
this.Text = "BizHawk";
this.Deactivate += new System.EventHandler(this.MainForm_Deactivate);
this.Load += new System.EventHandler(this.MainForm_Load);
this.Shown += new System.EventHandler(this.MainForm_Shown);
this.Activated += new System.EventHandler(this.MainForm_Activated);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.statusStrip1.ResumeLayout(false);
@ -1629,6 +1640,7 @@
private System.Windows.Forms.ToolStripMenuItem screenshotToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem screenshotF12ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem screenshotAsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem runInBackgroundToolStripMenuItem;
}
}

View File

@ -1664,7 +1664,8 @@ namespace BizHawk.MultiClient
private void gUIToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
pauseWhenMenuActivatedToolStripMenuItem.Checked = Global.Config.PauseWhenMenuActivated;
runInBackgroundToolStripMenuItem.Checked = Global.Config.RunInBackground;
pauseWhenMenuActivatedToolStripMenuItem.Checked = Global.Config.PauseWhenMenuActivated;
saveWindowPositionToolStripMenuItem.Checked = Global.Config.SaveWindowPosition;
startPausedToolStripMenuItem.Checked = Global.Config.StartPaused;
enableRewindToolStripMenuItem.Checked = Global.Config.RewindEnabled;
@ -1914,5 +1915,22 @@ namespace BizHawk.MultiClient
else
RamWatch1.Focus();
}
private void MainForm_Deactivate(object sender, EventArgs e)
{
if (!Global.Config.RunInBackground)
PauseEmulator();
}
private void MainForm_Activated(object sender, EventArgs e)
{
if (!Global.Config.RunInBackground)
UnpauseEmulator();
}
private void runInBackgroundToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.RunInBackground ^= true;
}
}
}