diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index 9a0b7fd607..1794bad903 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -8,6 +8,7 @@ public string LastRomPath = "."; public bool AutoLoadMostRecentRom = false; //TODO: eventually make a class or struct for all the auto-loads, which will include recent roms, movies, etc, as well as autoloading any modeless dialog public RecentFiles RecentRoms = new RecentFiles(8); + public bool PauseWhenMenuActivated = true; // Display options public bool DisplayFPS = false; diff --git a/BizHawk.MultiClient/MainForm.Designer.cs b/BizHawk.MultiClient/MainForm.Designer.cs index 6e6a24f40b..d0e85a6cea 100644 --- a/BizHawk.MultiClient/MainForm.Designer.cs +++ b/BizHawk.MultiClient/MainForm.Designer.cs @@ -111,11 +111,14 @@ this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.displayFPSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.displayFrameCounterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.displayInputToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.displayLagCounterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.displayInputToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.configToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.controllersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.hotkeysToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); + this.gUIToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.pauseWhenMenuActivatedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.rAMWatchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.rAMSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -125,9 +128,6 @@ this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); - this.gUIToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.pauseWhenMenuActivatedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -145,6 +145,8 @@ this.menuStrip1.Size = new System.Drawing.Size(470, 24); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; + this.menuStrip1.MenuDeactivate += new System.EventHandler(this.menuStrip1_MenuDeactivate); + this.menuStrip1.MenuActivate += new System.EventHandler(this.menuStrip1_MenuActivate); // // fileToolStripMenuItem // @@ -806,13 +808,6 @@ this.displayFrameCounterToolStripMenuItem.Text = "Display FrameCounter"; this.displayFrameCounterToolStripMenuItem.Click += new System.EventHandler(this.displayFrameCounterToolStripMenuItem_Click); // - // displayInputToolStripMenuItem - // - this.displayInputToolStripMenuItem.Name = "displayInputToolStripMenuItem"; - this.displayInputToolStripMenuItem.Size = new System.Drawing.Size(191, 22); - this.displayInputToolStripMenuItem.Text = "Display Input"; - this.displayInputToolStripMenuItem.Click += new System.EventHandler(this.displayInputToolStripMenuItem_Click); - // // displayLagCounterToolStripMenuItem // this.displayLagCounterToolStripMenuItem.Name = "displayLagCounterToolStripMenuItem"; @@ -820,6 +815,13 @@ this.displayLagCounterToolStripMenuItem.Text = "Display Lag Counter"; this.displayLagCounterToolStripMenuItem.Click += new System.EventHandler(this.displayLagCounterToolStripMenuItem_Click); // + // displayInputToolStripMenuItem + // + this.displayInputToolStripMenuItem.Name = "displayInputToolStripMenuItem"; + this.displayInputToolStripMenuItem.Size = new System.Drawing.Size(191, 22); + this.displayInputToolStripMenuItem.Text = "Display Input"; + this.displayInputToolStripMenuItem.Click += new System.EventHandler(this.displayInputToolStripMenuItem_Click); + // // configToolStripMenuItem // this.configToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -834,7 +836,7 @@ // controllersToolStripMenuItem // this.controllersToolStripMenuItem.Name = "controllersToolStripMenuItem"; - this.controllersToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.controllersToolStripMenuItem.Size = new System.Drawing.Size(137, 22); this.controllersToolStripMenuItem.Text = "&Controllers"; this.controllersToolStripMenuItem.Click += new System.EventHandler(this.controllersToolStripMenuItem_Click); // @@ -842,10 +844,31 @@ // this.hotkeysToolStripMenuItem.Enabled = false; this.hotkeysToolStripMenuItem.Name = "hotkeysToolStripMenuItem"; - this.hotkeysToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.hotkeysToolStripMenuItem.Size = new System.Drawing.Size(137, 22); this.hotkeysToolStripMenuItem.Text = "&Hotkeys"; this.hotkeysToolStripMenuItem.Click += new System.EventHandler(this.hotkeysToolStripMenuItem_Click); // + // toolStripSeparator9 + // + this.toolStripSeparator9.Name = "toolStripSeparator9"; + this.toolStripSeparator9.Size = new System.Drawing.Size(134, 6); + // + // gUIToolStripMenuItem + // + this.gUIToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.pauseWhenMenuActivatedToolStripMenuItem}); + this.gUIToolStripMenuItem.Name = "gUIToolStripMenuItem"; + this.gUIToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.gUIToolStripMenuItem.Text = "GUI"; + this.gUIToolStripMenuItem.DropDownOpened += new System.EventHandler(this.gUIToolStripMenuItem_DropDownOpened); + // + // pauseWhenMenuActivatedToolStripMenuItem + // + this.pauseWhenMenuActivatedToolStripMenuItem.Name = "pauseWhenMenuActivatedToolStripMenuItem"; + this.pauseWhenMenuActivatedToolStripMenuItem.Size = new System.Drawing.Size(220, 22); + this.pauseWhenMenuActivatedToolStripMenuItem.Text = "Pause when menu activated"; + this.pauseWhenMenuActivatedToolStripMenuItem.Click += new System.EventHandler(this.pauseWhenMenuActivatedToolStripMenuItem_Click); + // // toolsToolStripMenuItem // this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -918,25 +941,6 @@ this.aboutToolStripMenuItem.Text = "&About"; this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); // - // toolStripSeparator9 - // - this.toolStripSeparator9.Name = "toolStripSeparator9"; - this.toolStripSeparator9.Size = new System.Drawing.Size(149, 6); - // - // gUIToolStripMenuItem - // - this.gUIToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.pauseWhenMenuActivatedToolStripMenuItem}); - this.gUIToolStripMenuItem.Name = "gUIToolStripMenuItem"; - this.gUIToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.gUIToolStripMenuItem.Text = "GUI"; - // - // pauseWhenMenuActivatedToolStripMenuItem - // - this.pauseWhenMenuActivatedToolStripMenuItem.Name = "pauseWhenMenuActivatedToolStripMenuItem"; - this.pauseWhenMenuActivatedToolStripMenuItem.Size = new System.Drawing.Size(220, 22); - this.pauseWhenMenuActivatedToolStripMenuItem.Text = "Pause when menu activated"; - // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index 18573f9ae9..c412a7982c 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -18,6 +18,7 @@ namespace BizHawk.MultiClient private RetainedViewportPanel retainedPanel; private string CurrentlyOpenRom; private int SaveSlot = 0; //Saveslot sytem + private bool wasPaused = false; //For handling automatic pausing when entering the menu private bool EmulatorPaused = false; RamWatch RamWatch1 = new RamWatch(); @@ -535,13 +536,11 @@ namespace BizHawk.MultiClient { Global.Sound.StartSound(); EmulatorPaused = false; - pauseToolStripMenuItem.Checked = false; } else { Global.Sound.StopSound(); EmulatorPaused = true; - pauseToolStripMenuItem.Checked = true; } } @@ -708,6 +707,7 @@ namespace BizHawk.MultiClient enableFMChipToolStripMenuItem.Checked = Global.Config.SmsEnableFM; overclockWhenKnownSafeToolStripMenuItem.Checked = Global.Config.SmsAllowOverlock; forceStereoSeparationToolStripMenuItem.Checked = Global.Config.SmsForceStereoSeparation; + pauseToolStripMenuItem.Checked = EmulatorPaused; } private void clearToolStripMenuItem_Click(object sender, EventArgs e) @@ -1006,26 +1006,11 @@ namespace BizHawk.MultiClient private void viewToolStripMenuItem_DropDownOpened(object sender, EventArgs e) { - if (Global.Config.DisplayFPS == true) - displayFPSToolStripMenuItem.Checked = true; - else - displayFPSToolStripMenuItem.Checked = false; - - if (Global.Config.DisplayFrameCounter == true) - displayFrameCounterToolStripMenuItem.Checked = true; - else - displayFrameCounterToolStripMenuItem.Checked = false; - - if (Global.Config.DisplayLagCounter == true) - displayLagCounterToolStripMenuItem.Checked = true; - else - displayLagCounterToolStripMenuItem.Checked = false; - - if (Global.Config.DisplayInput == true) - displayInputToolStripMenuItem.Checked = true; - else - displayInputToolStripMenuItem.Checked = false; - + displayFPSToolStripMenuItem.Checked = Global.Config.DisplayFPS; + displayFrameCounterToolStripMenuItem.Checked = Global.Config.DisplayFrameCounter; + displayLagCounterToolStripMenuItem.Checked = Global.Config.DisplayLagCounter; + displayInputToolStripMenuItem.Checked = Global.Config.DisplayInput; + x1MenuItem.Checked = false; x2MenuItem.Checked = false; x3MenuItem.Checked = false; @@ -1041,5 +1026,40 @@ namespace BizHawk.MultiClient case 10: mzMenuItem.Checked = true; break; } } + + private void menuStrip1_MenuActivate(object sender, EventArgs e) + { + if (Global.Config.PauseWhenMenuActivated) + { + Global.Sound.StopSound(); + if (EmulatorPaused) + wasPaused = true; + else + wasPaused = false; + EmulatorPaused = true; + } + } + + private void menuStrip1_MenuDeactivate(object sender, EventArgs e) + { + if (!wasPaused) + { + Global.Sound.StartSound(); + EmulatorPaused = false; + } + } + + private void gUIToolStripMenuItem_DropDownOpened(object sender, EventArgs e) + { + pauseWhenMenuActivatedToolStripMenuItem.Checked = Global.Config.PauseWhenMenuActivated; + } + + private void pauseWhenMenuActivatedToolStripMenuItem_Click(object sender, EventArgs e) + { + if (Global.Config.PauseWhenMenuActivated == true) + Global.Config.PauseWhenMenuActivated = false; + else + Global.Config.PauseWhenMenuActivated = true; + } } } \ No newline at end of file