From a65907c440481784971114a1e8b4322cd3df9a7b Mon Sep 17 00:00:00 2001 From: Souryo Date: Sun, 31 Jan 2016 14:28:31 -0500 Subject: [PATCH] Options: Added option to automatically pause emulation when a movie finishes playing --- Core/EmulationSettings.h | 1 + Core/Movie.cpp | 3 +++ GUI.NET/Config/PreferenceInfo.cs | 4 +++- .../Forms/Config/frmPreferences.Designer.cs | 20 ++++++++++++++++--- GUI.NET/Forms/Config/frmPreferences.cs | 2 ++ GUI.NET/InteropEmu.cs | 1 + 6 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Core/EmulationSettings.h b/Core/EmulationSettings.h index 062b2f1c..57cfc58e 100644 --- a/Core/EmulationSettings.h +++ b/Core/EmulationSettings.h @@ -12,6 +12,7 @@ enum EmulationFlags RemoveSpriteLimit = 0x10, UseHdPacks = 0x20, + PauseOnMovieEnd = 0x0100, PauseWhenInBackground = 0x0200, AllowBackgroundInput = 0x0400, ReduceSoundInBackground = 0x0800, diff --git a/Core/Movie.cpp b/Core/Movie.cpp index 6e278953..a3149a1f 100644 --- a/Core/Movie.cpp +++ b/Core/Movie.cpp @@ -48,6 +48,9 @@ uint8_t Movie::GetState(uint8_t port) //End of movie file MessageManager::DisplayMessage("Movies", "Movie ended."); MessageManager::SendNotification(ConsoleNotificationType::MovieEnded); + if(EmulationSettings::CheckFlag(EmulationFlags::PauseOnMovieEnd)) { + EmulationSettings::SetFlags(EmulationFlags::Paused); + } _playing = false; } diff --git a/GUI.NET/Config/PreferenceInfo.cs b/GUI.NET/Config/PreferenceInfo.cs index 181edeec..8f833642 100644 --- a/GUI.NET/Config/PreferenceInfo.cs +++ b/GUI.NET/Config/PreferenceInfo.cs @@ -28,6 +28,8 @@ namespace Mesen.GUI.Config public bool AssociateMmoFiles = false; public bool AssociateMstFiles = false; + public bool PauseOnMovieEnd = true; + public bool UseAlternativeMmc3Irq = false; public PreferenceInfo() @@ -63,7 +65,7 @@ namespace Mesen.GUI.Config InteropEmu.SetFlag(EmulationFlags.RemoveSpriteLimit, preferenceInfo.RemoveSpriteLimit); InteropEmu.SetFlag(EmulationFlags.FdsAutoLoadDisk, preferenceInfo.FdsAutoLoadDisk); InteropEmu.SetFlag(EmulationFlags.FdsFastForwardOnLoad, preferenceInfo.FdsFastForwardOnLoad); - + InteropEmu.SetFlag(EmulationFlags.PauseOnMovieEnd, preferenceInfo.PauseOnMovieEnd); InteropEmu.SetFlag(EmulationFlags.AllowBackgroundInput, preferenceInfo.AllowBackgroundInput); InteropEmu.SetFlag(EmulationFlags.PauseWhenInBackground, preferenceInfo.PauseWhenInBackground); } diff --git a/GUI.NET/Forms/Config/frmPreferences.Designer.cs b/GUI.NET/Forms/Config/frmPreferences.Designer.cs index d18e86f7..66840396 100644 --- a/GUI.NET/Forms/Config/frmPreferences.Designer.cs +++ b/GUI.NET/Forms/Config/frmPreferences.Designer.cs @@ -28,6 +28,7 @@ private void InitializeComponent() { this.tlpMain = new System.Windows.Forms.TableLayoutPanel(); + this.chkPauseOnMovieEnd = new System.Windows.Forms.CheckBox(); this.chkAllowBackgroundInput = new System.Windows.Forms.CheckBox(); this.chkPauseWhenInBackground = new System.Windows.Forms.CheckBox(); this.chkAutoLoadIps = new System.Windows.Forms.CheckBox(); @@ -70,15 +71,17 @@ // this.tlpMain.ColumnCount = 1; this.tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tlpMain.Controls.Add(this.chkPauseOnMovieEnd, 0, 4); this.tlpMain.Controls.Add(this.chkAllowBackgroundInput, 0, 3); this.tlpMain.Controls.Add(this.chkPauseWhenInBackground, 0, 2); this.tlpMain.Controls.Add(this.chkAutoLoadIps, 0, 1); this.tlpMain.Controls.Add(this.flowLayoutPanel6, 0, 0); - this.tlpMain.Controls.Add(this.chkDisableScreensaver, 0, 4); + this.tlpMain.Controls.Add(this.chkDisableScreensaver, 0, 5); this.tlpMain.Dock = System.Windows.Forms.DockStyle.Fill; this.tlpMain.Location = new System.Drawing.Point(3, 3); this.tlpMain.Name = "tlpMain"; - this.tlpMain.RowCount = 5; + this.tlpMain.RowCount = 6; + this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle()); @@ -87,6 +90,16 @@ this.tlpMain.Size = new System.Drawing.Size(380, 207); this.tlpMain.TabIndex = 1; // + // chkPauseOnMovieEnd + // + this.chkPauseOnMovieEnd.AutoSize = true; + this.chkPauseOnMovieEnd.Location = new System.Drawing.Point(3, 95); + this.chkPauseOnMovieEnd.Name = "chkPauseOnMovieEnd"; + this.chkPauseOnMovieEnd.Size = new System.Drawing.Size(199, 17); + this.chkPauseOnMovieEnd.TabIndex = 15; + this.chkPauseOnMovieEnd.Text = "Pause when a movie finishes playing"; + this.chkPauseOnMovieEnd.UseVisualStyleBackColor = true; + // // chkAllowBackgroundInput // this.chkAllowBackgroundInput.AutoSize = true; @@ -143,7 +156,7 @@ // this.chkDisableScreensaver.AutoSize = true; this.chkDisableScreensaver.Enabled = false; - this.chkDisableScreensaver.Location = new System.Drawing.Point(3, 95); + this.chkDisableScreensaver.Location = new System.Drawing.Point(3, 118); this.chkDisableScreensaver.Name = "chkDisableScreensaver"; this.chkDisableScreensaver.Size = new System.Drawing.Size(245, 17); this.chkDisableScreensaver.TabIndex = 11; @@ -392,5 +405,6 @@ private System.Windows.Forms.CheckBox chkFdsAutoLoadDisk; private System.Windows.Forms.CheckBox chkFdsFastForwardOnLoad; private System.Windows.Forms.CheckBox chkAllowBackgroundInput; + private System.Windows.Forms.CheckBox chkPauseOnMovieEnd; } } \ No newline at end of file diff --git a/GUI.NET/Forms/Config/frmPreferences.cs b/GUI.NET/Forms/Config/frmPreferences.cs index d0e3b837..85ba48e1 100644 --- a/GUI.NET/Forms/Config/frmPreferences.cs +++ b/GUI.NET/Forms/Config/frmPreferences.cs @@ -35,6 +35,8 @@ namespace Mesen.GUI.Forms.Config AddBinding("PauseWhenInBackground", chkPauseWhenInBackground); AddBinding("AllowBackgroundInput", chkAllowBackgroundInput); + + AddBinding("PauseOnMovieEnd", chkPauseOnMovieEnd); } protected override void OnFormClosed(FormClosedEventArgs e) diff --git a/GUI.NET/InteropEmu.cs b/GUI.NET/InteropEmu.cs index 97fb0a24..3534752c 100644 --- a/GUI.NET/InteropEmu.cs +++ b/GUI.NET/InteropEmu.cs @@ -468,6 +468,7 @@ namespace Mesen.GUI RemoveSpriteLimit = 0x10, UseHdPacks = 0x20, + PauseOnMovieEnd = 0x0100, PauseWhenInBackground = 0x0200, AllowBackgroundInput = 0x0400, ReduceSoundInBackground = 0x0800,