UI: Added pause/background/volume related options

This commit is contained in:
Sour 2019-07-17 20:31:29 -04:00
parent 4c98f8cefc
commit 1ea156ee36
21 changed files with 423 additions and 201 deletions

View file

@ -36,6 +36,8 @@
Console::Console()
{
_settings.reset(new EmuSettings());
KeyManager::SetSettings(_settings.get());
_paused = false;
_pauseOnNextFrame = false;
_stopFlag = false;

View file

@ -269,4 +269,9 @@ void EmuSettings::InitializeRam(void* data, uint32_t length)
}
break;
}
}
}
bool EmuSettings::IsInputEnabled()
{
return !CheckFlag(EmulationFlags::InBackground) || _preferences.AllowBackgroundInput;
}

View file

@ -68,4 +68,6 @@ public:
void SetDebuggerFlag(DebuggerFlags flag, bool enabled);
bool CheckDebuggerFlag(DebuggerFlags flags);
void InitializeRam(void* data, uint32_t length);
bool IsInputEnabled();
};

View file

@ -9,6 +9,7 @@ IKeyManager* KeyManager::_keyManager = nullptr;
MousePosition KeyManager::_mousePosition = { 0, 0 };
atomic<int16_t> KeyManager::_xMouseMovement;
atomic<int16_t> KeyManager::_yMouseMovement;
EmuSettings* KeyManager::_settings = nullptr;
void KeyManager::RegisterKeyManager(IKeyManager* keyManager)
{
@ -24,10 +25,15 @@ void KeyManager::RefreshKeyState()
}
}
void KeyManager::SetSettings(EmuSettings *settings)
{
_settings = settings;
}
bool KeyManager::IsKeyPressed(uint32_t keyCode)
{
if(_keyManager != nullptr) {
return _keyManager->IsKeyPressed(keyCode);
return _settings->IsInputEnabled() && _keyManager->IsKeyPressed(keyCode);
}
return false;
}
@ -35,8 +41,7 @@ bool KeyManager::IsKeyPressed(uint32_t keyCode)
bool KeyManager::IsMouseButtonPressed(MouseButton button)
{
if(_keyManager != nullptr) {
//TODO return _settings->InputEnabled() &&
return _keyManager->IsMouseButtonPressed(button);
return _settings->IsInputEnabled() && _keyManager->IsMouseButtonPressed(button);
}
return false;
}

View file

@ -3,6 +3,7 @@
#include "IKeyManager.h"
class Console;
class EmuSettings;
class KeyManager
{
@ -11,9 +12,11 @@ private:
static MousePosition _mousePosition;
static atomic<int16_t> _xMouseMovement;
static atomic<int16_t> _yMouseMovement;
static EmuSettings* _settings;
public:
static void RegisterKeyManager(IKeyManager* keyManager);
static void SetSettings(EmuSettings* settings);
static void RefreshKeyState();
static bool IsKeyPressed(uint32_t keyCode);

View file

@ -6,7 +6,9 @@ enum class EmulationFlags
{
Turbo = 1,
Rewind = 2,
MaximumSpeed = 4
TurboOrRewind = 3,
MaximumSpeed = 4,
InBackground = 8
};
enum class ScaleFilterType
@ -271,6 +273,7 @@ struct PreferencesConfig
bool ShowGameTimer = false;
bool ShowDebugInfo = false;
bool DisableOsd = false;
bool AllowBackgroundInput = false;
uint32_t RewindBufferSize = 30;

View file

@ -50,15 +50,26 @@ void SoundMixer::StopAudio(bool clearBuffer)
void SoundMixer::PlayAudioBuffer(int16_t* samples, uint32_t sampleCount)
{
AudioConfig cfg = _console->GetSettings()->GetAudioConfig();
if(cfg.EnableEqualizer) {
ProcessEqualizer(samples, sampleCount);
}
if(cfg.MasterVolume < 100) {
uint32_t masterVolume = cfg.MasterVolume;
if(_console->GetSettings()->CheckFlag(EmulationFlags::InBackground)) {
if(cfg.MuteSoundInBackground) {
masterVolume = 0;
} else if(cfg.ReduceSoundInBackground) {
masterVolume = cfg.VolumeReduction == 100 ? 0 : masterVolume * (100 - cfg.VolumeReduction) / 100;
}
} else if(cfg.ReduceSoundInFastForward && _console->GetSettings()->CheckFlag(EmulationFlags::TurboOrRewind)) {
masterVolume = cfg.VolumeReduction == 100 ? 0 : masterVolume * (100 - cfg.VolumeReduction) / 100;
}
if(masterVolume < 100) {
//Apply volume if not using the default value
for(uint32_t i = 0; i < sampleCount * 2; i++) {
samples[i] = (int32_t)samples[i] * (int32_t)cfg.MasterVolume / 100;
samples[i] = (int32_t)samples[i] * (int32_t)masterVolume / 100;
}
}

View file

@ -46,6 +46,11 @@ extern "C" {
return _returnString.c_str();
}
DllExport void __stdcall SetEmulationFlag(EmulationFlags flag, bool enabled)
{
_console->GetSettings()->SetFlagState(flag, enabled);
}
DllExport void __stdcall SetDebuggerFlag(DebuggerFlags flag, bool enabled)
{
_console->GetSettings()->SetDebuggerFlag(flag, enabled);

View file

@ -17,6 +17,11 @@ namespace Mesen.GUI.Config
public bool SingleInstance = true;
public bool AutoLoadPatches = true;
public bool PauseWhenInBackground = false;
public bool PauseWhenInMenusAndConfig = false;
public bool PauseWhenInDebuggingTools = false;
public bool AllowBackgroundInput = false;
public bool AssociateRomFiles = false;
public bool AssociateMsmFiles = false;
public bool AssociateMssFiles = false;
@ -155,6 +160,7 @@ namespace Mesen.GUI.Config
ShowGameTimer = ShowGameTimer,
ShowDebugInfo = ShowDebugInfo,
DisableOsd = DisableOsd,
AllowBackgroundInput = AllowBackgroundInput,
SaveFolderOverride = OverrideSaveDataFolder ? SaveDataFolder : "",
SaveStateFolderOverride = OverrideSaveStateFolder ? SaveStateFolder : "",
ScreenshotFolderOverride = OverrideScreenshotFolder ? ScreenshotFolder : "",
@ -170,6 +176,7 @@ namespace Mesen.GUI.Config
[MarshalAs(UnmanagedType.I1)] public bool ShowGameTimer;
[MarshalAs(UnmanagedType.I1)] public bool ShowDebugInfo;
[MarshalAs(UnmanagedType.I1)] public bool DisableOsd;
[MarshalAs(UnmanagedType.I1)] public bool AllowBackgroundInput;
public UInt32 RewindBufferSize;

View file

@ -34,7 +34,7 @@ namespace Mesen.GUI.Forms
UpdateUI();
}
protected override bool IsConfigForm { get { return true; } }
public override bool IsConfigForm { get { return true; } }
protected void UpdateUI()
{

View file

@ -21,63 +21,20 @@ namespace Mesen.GUI.Forms
private bool _iconSet = false;
protected int _inMenu = 0;
private ctrlTooltip ctrlTooltip;
private static Timer _tmrUpdateBackground;
//private static bool _needResume = false;
public BaseForm()
{
InitializeComponent();
}
protected virtual bool IsConfigForm { get { return false; } }
public virtual bool IsConfigForm { get { return false; } }
public bool InMenu { get { return _inMenu > 0; } }
public static ctrlTooltip GetPopupTooltip(Form form)
{
return (form as BaseForm).ctrlTooltip;
}
public static void StartBackgroundTimer()
{
_tmrUpdateBackground = new Timer();
_tmrUpdateBackground.Start();
_tmrUpdateBackground.Tick += tmrUpdateBackground_Tick;
}
public static void StopBackgroundTimer()
{
_tmrUpdateBackground?.Stop();
}
private static void tmrUpdateBackground_Tick(object sender, EventArgs e)
{
/*Form focusedForm = null;
foreach(Form form in Application.OpenForms) {
if(form.ContainsFocus) {
focusedForm = form;
break;
}
}
bool needPause = focusedForm == null && ConfigManager.Config.PreferenceInfo.PauseWhenInBackground;
if(focusedForm != null) {
needPause |= ConfigManager.Config.PreferenceInfo.PauseWhenInMenusAndConfig && focusedForm is BaseForm && (((BaseForm)focusedForm)._inMenu > 0 || ((BaseForm)focusedForm).IsConfigForm);
needPause |= ConfigManager.Config.PreferenceInfo.PauseWhenInMenusAndConfig && !(focusedForm is BaseInputForm) && !focusedForm.GetType().FullName.Contains("Debugger");
needPause |= ConfigManager.Config.PreferenceInfo.PauseWhenInDebuggingTools && focusedForm.GetType().FullName.Contains("Debugger");
}
if(needPause) {
if(!EmuApi.IsPaused(EmuApi.ConsoleId.Master)) {
_needResume = true;
EmuApi.Pause(EmuApi.ConsoleId.Master);
}
} else if(_needResume) {
EmuApi.Resume(EmuApi.ConsoleId.Master);
_needResume = false;
}
EmuApi.SetFlag(EmulationFlags.InBackground, focusedForm == null);*/
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
bool processed = false;

View file

@ -93,6 +93,7 @@
//
this.baseConfigPanel.Location = new System.Drawing.Point(0, 378);
this.baseConfigPanel.Size = new System.Drawing.Size(492, 29);
this.baseConfigPanel.TabIndex = 4;
//
// tabControl1
//
@ -163,7 +164,6 @@
this.lblVolumeReductionSettings.Size = new System.Drawing.Size(94, 13);
this.lblVolumeReductionSettings.TabIndex = 24;
this.lblVolumeReductionSettings.Text = "Volume Reduction";
this.lblVolumeReductionSettings.Visible = false;
//
// chkEnableAudio
//
@ -340,7 +340,6 @@
this.tableLayoutPanel8.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel8.Size = new System.Drawing.Size(453, 81);
this.tableLayoutPanel8.TabIndex = 25;
this.tableLayoutPanel8.Visible = false;
//
// chkReduceSoundInBackground
//
@ -351,6 +350,7 @@
this.chkReduceSoundInBackground.TabIndex = 13;
this.chkReduceSoundInBackground.Text = "Reduce when in background";
this.chkReduceSoundInBackground.UseVisualStyleBackColor = true;
this.chkReduceSoundInBackground.CheckedChanged += new System.EventHandler(this.chkReduceVolume_CheckedChanged);
//
// chkReduceSoundInFastForward
//
@ -361,6 +361,7 @@
this.chkReduceSoundInFastForward.TabIndex = 16;
this.chkReduceSoundInFastForward.Text = "Reduce when fast forwarding or rewinding";
this.chkReduceSoundInFastForward.UseVisualStyleBackColor = true;
this.chkReduceSoundInFastForward.CheckedChanged += new System.EventHandler(this.chkReduceVolume_CheckedChanged);
//
// trkVolumeReduction
//
@ -388,6 +389,7 @@
this.chkMuteSoundInBackground.TabIndex = 18;
this.chkMuteSoundInBackground.Text = "Mute sound when in background";
this.chkMuteSoundInBackground.UseVisualStyleBackColor = true;
this.chkMuteSoundInBackground.CheckedChanged += new System.EventHandler(this.chkMuteWhenInBackground_CheckedChanged);
//
// trkMaster
//
@ -937,6 +939,7 @@
this.tpgAdvanced.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}

View file

@ -83,5 +83,21 @@ namespace Mesen.GUI.Forms.Config
{
tlpEqualizer.Enabled = chkEnableEqualizer.Checked;
}
private void chkMuteWhenInBackground_CheckedChanged(object sender, EventArgs e)
{
UpdateVolumeOptions();
}
private void chkReduceVolume_CheckedChanged(object sender, EventArgs e)
{
UpdateVolumeOptions();
}
private void UpdateVolumeOptions()
{
chkReduceSoundInBackground.Enabled = !chkMuteSoundInBackground.Checked;
trkVolumeReduction.Enabled = chkReduceSoundInFastForward.Checked || (chkReduceSoundInBackground.Checked && chkReduceSoundInBackground.Enabled);
}
}
}

View file

@ -38,7 +38,7 @@ namespace Mesen.GUI.Forms.Config
InputApi.DisableAllKeys(true);
}
protected override bool IsConfigForm { get { return true; } }
public override bool IsConfigForm { get { return true; } }
protected override void OnFormClosing(FormClosingEventArgs e)
{

View file

@ -76,6 +76,11 @@
this.lblDataLocation = new System.Windows.Forms.Label();
this.tpgAdvanced = new System.Windows.Forms.TabPage();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.lblAdvancedMisc = new System.Windows.Forms.Label();
this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel();
this.lblRewind = new System.Windows.Forms.Label();
this.nudRewindBufferSize = new Mesen.GUI.Controls.MesenNumericUpDown();
this.lblRewindMinutes = new System.Windows.Forms.Label();
this.chkDisplayTitleBarInfo = new System.Windows.Forms.CheckBox();
this.chkShowGameTimer = new System.Windows.Forms.CheckBox();
this.chkShowFrameCounter = new System.Windows.Forms.CheckBox();
@ -85,11 +90,13 @@
this.chkAlwaysOnTop = new System.Windows.Forms.CheckBox();
this.chkShowFps = new System.Windows.Forms.CheckBox();
this.chkShowDebugInfo = new System.Windows.Forms.CheckBox();
this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel();
this.lblRewind = new System.Windows.Forms.Label();
this.nudRewindBufferSize = new Mesen.GUI.Controls.MesenNumericUpDown();
this.lblRewindMinutes = new System.Windows.Forms.Label();
this.lblAdvancedMisc = new System.Windows.Forms.Label();
this.lblPauseBackgroundSettings = new System.Windows.Forms.Label();
this.flowLayoutPanel8 = new System.Windows.Forms.FlowLayoutPanel();
this.lblPauseIn = new System.Windows.Forms.Label();
this.chkPauseWhenInBackground = new System.Windows.Forms.CheckBox();
this.chkPauseInMenuAndConfig = new System.Windows.Forms.CheckBox();
this.chkPauseInDebugger = new System.Windows.Forms.CheckBox();
this.chkAllowBackgroundInput = new System.Windows.Forms.CheckBox();
this.tabMain.SuspendLayout();
this.tpgGeneral.SuspendLayout();
this.tlpMain.SuspendLayout();
@ -109,6 +116,7 @@
this.tpgAdvanced.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.flowLayoutPanel6.SuspendLayout();
this.flowLayoutPanel8.SuspendLayout();
this.SuspendLayout();
//
// baseConfigPanel
@ -145,23 +153,29 @@
//
this.tlpMain.ColumnCount = 1;
this.tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tlpMain.Controls.Add(this.chkAutoHideMenu, 0, 5);
this.tlpMain.Controls.Add(this.chkAllowBackgroundInput, 0, 5);
this.tlpMain.Controls.Add(this.flowLayoutPanel8, 0, 4);
this.tlpMain.Controls.Add(this.lblPauseBackgroundSettings, 0, 3);
this.tlpMain.Controls.Add(this.chkAutoHideMenu, 0, 8);
this.tlpMain.Controls.Add(this.chkSingleInstance, 0, 2);
this.tlpMain.Controls.Add(this.chkAutomaticallyCheckForUpdates, 0, 1);
this.tlpMain.Controls.Add(this.flowLayoutPanel2, 0, 0);
this.tlpMain.Controls.Add(this.lblMiscSettings, 0, 3);
this.tlpMain.Controls.Add(this.chkAutoLoadPatches, 0, 4);
this.tlpMain.Controls.Add(this.tableLayoutPanel5, 0, 7);
this.tlpMain.Controls.Add(this.lblMiscSettings, 0, 6);
this.tlpMain.Controls.Add(this.chkAutoLoadPatches, 0, 7);
this.tlpMain.Controls.Add(this.tableLayoutPanel5, 0, 10);
this.tlpMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.tlpMain.Location = new System.Drawing.Point(3, 3);
this.tlpMain.Name = "tlpMain";
this.tlpMain.RowCount = 8;
this.tlpMain.RowCount = 11;
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(System.Windows.Forms.SizeType.Absolute, 20F));
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(System.Windows.Forms.SizeType.Absolute, 20F));
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(System.Windows.Forms.SizeType.Percent, 100F));
this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tlpMain.Size = new System.Drawing.Size(534, 383);
@ -170,7 +184,7 @@
// chkAutoHideMenu
//
this.chkAutoHideMenu.AutoSize = true;
this.chkAutoHideMenu.Location = new System.Drawing.Point(13, 118);
this.chkAutoHideMenu.Location = new System.Drawing.Point(13, 186);
this.chkAutoHideMenu.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.chkAutoHideMenu.Name = "chkAutoHideMenu";
this.chkAutoHideMenu.Size = new System.Drawing.Size(158, 17);
@ -233,7 +247,7 @@
this.lblMiscSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lblMiscSettings.AutoSize = true;
this.lblMiscSettings.ForeColor = System.Drawing.SystemColors.GrayText;
this.lblMiscSettings.Location = new System.Drawing.Point(0, 79);
this.lblMiscSettings.Location = new System.Drawing.Point(0, 147);
this.lblMiscSettings.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.lblMiscSettings.Name = "lblMiscSettings";
this.lblMiscSettings.Size = new System.Drawing.Size(73, 13);
@ -243,7 +257,7 @@
// chkAutoLoadPatches
//
this.chkAutoLoadPatches.AutoSize = true;
this.chkAutoLoadPatches.Location = new System.Drawing.Point(13, 95);
this.chkAutoLoadPatches.Location = new System.Drawing.Point(13, 163);
this.chkAutoLoadPatches.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.chkAutoLoadPatches.Name = "chkAutoLoadPatches";
this.chkAutoLoadPatches.Size = new System.Drawing.Size(198, 17);
@ -296,7 +310,7 @@
this.tpgShortcuts.Location = new System.Drawing.Point(4, 22);
this.tpgShortcuts.Name = "tpgShortcuts";
this.tpgShortcuts.Padding = new System.Windows.Forms.Padding(3);
this.tpgShortcuts.Size = new System.Drawing.Size(540, 389);
this.tpgShortcuts.Size = new System.Drawing.Size(540, 418);
this.tpgShortcuts.TabIndex = 7;
this.tpgShortcuts.Text = "Shortcut Keys";
this.tpgShortcuts.UseVisualStyleBackColor = true;
@ -306,7 +320,7 @@
this.ctrlEmulatorShortcuts.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlEmulatorShortcuts.Location = new System.Drawing.Point(3, 3);
this.ctrlEmulatorShortcuts.Name = "ctrlEmulatorShortcuts";
this.ctrlEmulatorShortcuts.Size = new System.Drawing.Size(534, 383);
this.ctrlEmulatorShortcuts.Size = new System.Drawing.Size(534, 412);
this.ctrlEmulatorShortcuts.TabIndex = 0;
//
// tpgFiles
@ -315,7 +329,7 @@
this.tpgFiles.Location = new System.Drawing.Point(4, 22);
this.tpgFiles.Name = "tpgFiles";
this.tpgFiles.Padding = new System.Windows.Forms.Padding(3);
this.tpgFiles.Size = new System.Drawing.Size(540, 389);
this.tpgFiles.Size = new System.Drawing.Size(540, 418);
this.tpgFiles.TabIndex = 2;
this.tpgFiles.Text = "Folders/Files";
this.tpgFiles.UseVisualStyleBackColor = true;
@ -336,7 +350,7 @@
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel6.Size = new System.Drawing.Size(534, 383);
this.tableLayoutPanel6.Size = new System.Drawing.Size(534, 412);
this.tableLayoutPanel6.TabIndex = 13;
//
// grpPathOverrides
@ -743,7 +757,7 @@
this.tpgAdvanced.Location = new System.Drawing.Point(4, 22);
this.tpgAdvanced.Name = "tpgAdvanced";
this.tpgAdvanced.Padding = new System.Windows.Forms.Padding(3);
this.tpgAdvanced.Size = new System.Drawing.Size(540, 389);
this.tpgAdvanced.Size = new System.Drawing.Size(540, 418);
this.tpgAdvanced.TabIndex = 1;
this.tpgAdvanced.Text = "Advanced";
this.tpgAdvanced.UseVisualStyleBackColor = true;
@ -779,9 +793,85 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(534, 383);
this.tableLayoutPanel1.Size = new System.Drawing.Size(534, 412);
this.tableLayoutPanel1.TabIndex = 0;
//
// lblAdvancedMisc
//
this.lblAdvancedMisc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lblAdvancedMisc.AutoSize = true;
this.lblAdvancedMisc.ForeColor = System.Drawing.SystemColors.GrayText;
this.lblAdvancedMisc.Location = new System.Drawing.Point(0, 208);
this.lblAdvancedMisc.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.lblAdvancedMisc.Name = "lblAdvancedMisc";
this.lblAdvancedMisc.Size = new System.Drawing.Size(73, 13);
this.lblAdvancedMisc.TabIndex = 36;
this.lblAdvancedMisc.Text = "Misc. Settings";
//
// flowLayoutPanel6
//
this.flowLayoutPanel6.Controls.Add(this.lblRewind);
this.flowLayoutPanel6.Controls.Add(this.nudRewindBufferSize);
this.flowLayoutPanel6.Controls.Add(this.lblRewindMinutes);
this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Top;
this.flowLayoutPanel6.Location = new System.Drawing.Point(10, 224);
this.flowLayoutPanel6.Margin = new System.Windows.Forms.Padding(10, 3, 0, 0);
this.flowLayoutPanel6.Name = "flowLayoutPanel6";
this.flowLayoutPanel6.Size = new System.Drawing.Size(524, 23);
this.flowLayoutPanel6.TabIndex = 35;
//
// lblRewind
//
this.lblRewind.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblRewind.AutoSize = true;
this.lblRewind.Location = new System.Drawing.Point(3, 4);
this.lblRewind.Name = "lblRewind";
this.lblRewind.Size = new System.Drawing.Size(142, 13);
this.lblRewind.TabIndex = 3;
this.lblRewind.Text = "Keep rewind data for the last";
//
// nudRewindBufferSize
//
this.nudRewindBufferSize.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.nudRewindBufferSize.DecimalPlaces = 0;
this.nudRewindBufferSize.Increment = new decimal(new int[] {
1,
0,
0,
0});
this.nudRewindBufferSize.Location = new System.Drawing.Point(148, 0);
this.nudRewindBufferSize.Margin = new System.Windows.Forms.Padding(0);
this.nudRewindBufferSize.Maximum = new decimal(new int[] {
900,
0,
0,
0});
this.nudRewindBufferSize.MaximumSize = new System.Drawing.Size(10000, 20);
this.nudRewindBufferSize.Minimum = new decimal(new int[] {
0,
0,
0,
0});
this.nudRewindBufferSize.MinimumSize = new System.Drawing.Size(0, 21);
this.nudRewindBufferSize.Name = "nudRewindBufferSize";
this.nudRewindBufferSize.Size = new System.Drawing.Size(42, 21);
this.nudRewindBufferSize.TabIndex = 1;
this.nudRewindBufferSize.Value = new decimal(new int[] {
30,
0,
0,
0});
//
// lblRewindMinutes
//
this.lblRewindMinutes.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblRewindMinutes.AutoSize = true;
this.lblRewindMinutes.Location = new System.Drawing.Point(193, 4);
this.lblRewindMinutes.Name = "lblRewindMinutes";
this.lblRewindMinutes.Size = new System.Drawing.Size(175, 13);
this.lblRewindMinutes.TabIndex = 2;
this.lblRewindMinutes.Text = "minutes (Memory Usage ≈5MB/min)";
//
// chkDisplayTitleBarInfo
//
this.chkDisplayTitleBarInfo.AutoSize = true;
@ -883,81 +973,82 @@
this.chkShowDebugInfo.Text = "Show debug information";
this.chkShowDebugInfo.UseVisualStyleBackColor = true;
//
// flowLayoutPanel6
// lblPauseBackgroundSettings
//
this.flowLayoutPanel6.Controls.Add(this.lblRewind);
this.flowLayoutPanel6.Controls.Add(this.nudRewindBufferSize);
this.flowLayoutPanel6.Controls.Add(this.lblRewindMinutes);
this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Top;
this.flowLayoutPanel6.Location = new System.Drawing.Point(10, 224);
this.flowLayoutPanel6.Margin = new System.Windows.Forms.Padding(10, 3, 0, 0);
this.flowLayoutPanel6.Name = "flowLayoutPanel6";
this.flowLayoutPanel6.Size = new System.Drawing.Size(524, 23);
this.flowLayoutPanel6.TabIndex = 35;
this.lblPauseBackgroundSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lblPauseBackgroundSettings.AutoSize = true;
this.lblPauseBackgroundSettings.ForeColor = System.Drawing.SystemColors.GrayText;
this.lblPauseBackgroundSettings.Location = new System.Drawing.Point(0, 79);
this.lblPauseBackgroundSettings.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.lblPauseBackgroundSettings.Name = "lblPauseBackgroundSettings";
this.lblPauseBackgroundSettings.Size = new System.Drawing.Size(141, 13);
this.lblPauseBackgroundSettings.TabIndex = 26;
this.lblPauseBackgroundSettings.Text = "Pause/Background Settings";
//
// lblRewind
// flowLayoutPanel8
//
this.lblRewind.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblRewind.AutoSize = true;
this.lblRewind.Location = new System.Drawing.Point(3, 4);
this.lblRewind.Name = "lblRewind";
this.lblRewind.Size = new System.Drawing.Size(142, 13);
this.lblRewind.TabIndex = 3;
this.lblRewind.Text = "Keep rewind data for the last";
this.flowLayoutPanel8.Controls.Add(this.lblPauseIn);
this.flowLayoutPanel8.Controls.Add(this.chkPauseWhenInBackground);
this.flowLayoutPanel8.Controls.Add(this.chkPauseInMenuAndConfig);
this.flowLayoutPanel8.Controls.Add(this.chkPauseInDebugger);
this.flowLayoutPanel8.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel8.Location = new System.Drawing.Point(7, 95);
this.flowLayoutPanel8.Margin = new System.Windows.Forms.Padding(7, 3, 0, 0);
this.flowLayoutPanel8.Name = "flowLayoutPanel8";
this.flowLayoutPanel8.Size = new System.Drawing.Size(527, 22);
this.flowLayoutPanel8.TabIndex = 29;
//
// nudRewindBufferSize
// lblPauseIn
//
this.nudRewindBufferSize.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.nudRewindBufferSize.DecimalPlaces = 0;
this.nudRewindBufferSize.Increment = new decimal(new int[] {
1,
0,
0,
0});
this.nudRewindBufferSize.Location = new System.Drawing.Point(148, 0);
this.nudRewindBufferSize.Margin = new System.Windows.Forms.Padding(0);
this.nudRewindBufferSize.Maximum = new decimal(new int[] {
900,
0,
0,
0});
this.nudRewindBufferSize.MaximumSize = new System.Drawing.Size(10000, 20);
this.nudRewindBufferSize.Minimum = new decimal(new int[] {
0,
0,
0,
0});
this.nudRewindBufferSize.MinimumSize = new System.Drawing.Size(0, 21);
this.nudRewindBufferSize.Name = "nudRewindBufferSize";
this.nudRewindBufferSize.Size = new System.Drawing.Size(42, 21);
this.nudRewindBufferSize.TabIndex = 1;
this.nudRewindBufferSize.Value = new decimal(new int[] {
30,
0,
0,
0});
this.lblPauseIn.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblPauseIn.AutoSize = true;
this.lblPauseIn.Location = new System.Drawing.Point(3, 4);
this.lblPauseIn.Margin = new System.Windows.Forms.Padding(3, 0, 3, 1);
this.lblPauseIn.Name = "lblPauseIn";
this.lblPauseIn.Size = new System.Drawing.Size(80, 13);
this.lblPauseIn.TabIndex = 0;
this.lblPauseIn.Text = "Pause when in:";
//
// lblRewindMinutes
// chkPauseWhenInBackground
//
this.lblRewindMinutes.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblRewindMinutes.AutoSize = true;
this.lblRewindMinutes.Location = new System.Drawing.Point(193, 4);
this.lblRewindMinutes.Name = "lblRewindMinutes";
this.lblRewindMinutes.Size = new System.Drawing.Size(175, 13);
this.lblRewindMinutes.TabIndex = 2;
this.lblRewindMinutes.Text = "minutes (Memory Usage ≈5MB/min)";
this.chkPauseWhenInBackground.AutoSize = true;
this.chkPauseWhenInBackground.Location = new System.Drawing.Point(89, 3);
this.chkPauseWhenInBackground.Name = "chkPauseWhenInBackground";
this.chkPauseWhenInBackground.Size = new System.Drawing.Size(84, 17);
this.chkPauseWhenInBackground.TabIndex = 13;
this.chkPauseWhenInBackground.Text = "Background";
this.chkPauseWhenInBackground.UseVisualStyleBackColor = true;
//
// lblAdvancedMisc
// chkPauseInMenuAndConfig
//
this.lblAdvancedMisc.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.lblAdvancedMisc.AutoSize = true;
this.lblAdvancedMisc.ForeColor = System.Drawing.SystemColors.GrayText;
this.lblAdvancedMisc.Location = new System.Drawing.Point(0, 208);
this.lblAdvancedMisc.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0);
this.lblAdvancedMisc.Name = "lblAdvancedMisc";
this.lblAdvancedMisc.Size = new System.Drawing.Size(73, 13);
this.lblAdvancedMisc.TabIndex = 36;
this.lblAdvancedMisc.Text = "Misc. Settings";
this.chkPauseInMenuAndConfig.AutoSize = true;
this.chkPauseInMenuAndConfig.Location = new System.Drawing.Point(179, 3);
this.chkPauseInMenuAndConfig.Name = "chkPauseInMenuAndConfig";
this.chkPauseInMenuAndConfig.Size = new System.Drawing.Size(142, 17);
this.chkPauseInMenuAndConfig.TabIndex = 16;
this.chkPauseInMenuAndConfig.Text = "Menu and config dialogs";
this.chkPauseInMenuAndConfig.UseVisualStyleBackColor = true;
//
// chkPauseInDebugger
//
this.chkPauseInDebugger.AutoSize = true;
this.chkPauseInDebugger.Location = new System.Drawing.Point(327, 3);
this.chkPauseInDebugger.Name = "chkPauseInDebugger";
this.chkPauseInDebugger.Size = new System.Drawing.Size(103, 17);
this.chkPauseInDebugger.TabIndex = 18;
this.chkPauseInDebugger.Text = "Debugging tools";
this.chkPauseInDebugger.UseVisualStyleBackColor = true;
//
// chkAllowBackgroundInput
//
this.chkAllowBackgroundInput.AutoSize = true;
this.chkAllowBackgroundInput.Location = new System.Drawing.Point(13, 120);
this.chkAllowBackgroundInput.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.chkAllowBackgroundInput.Name = "chkAllowBackgroundInput";
this.chkAllowBackgroundInput.Size = new System.Drawing.Size(177, 17);
this.chkAllowBackgroundInput.TabIndex = 30;
this.chkAllowBackgroundInput.Text = "Allow input when in background";
this.chkAllowBackgroundInput.UseVisualStyleBackColor = true;
//
// frmPreferences
//
@ -999,6 +1090,8 @@
this.tableLayoutPanel1.PerformLayout();
this.flowLayoutPanel6.ResumeLayout(false);
this.flowLayoutPanel6.PerformLayout();
this.flowLayoutPanel8.ResumeLayout(false);
this.flowLayoutPanel8.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -1069,5 +1162,12 @@
private System.Windows.Forms.Label lblRewind;
private Controls.MesenNumericUpDown nudRewindBufferSize;
private System.Windows.Forms.Label lblRewindMinutes;
private System.Windows.Forms.CheckBox chkAllowBackgroundInput;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel8;
private System.Windows.Forms.Label lblPauseIn;
private System.Windows.Forms.CheckBox chkPauseWhenInBackground;
private System.Windows.Forms.CheckBox chkPauseInMenuAndConfig;
private System.Windows.Forms.CheckBox chkPauseInDebugger;
private System.Windows.Forms.Label lblPauseBackgroundSettings;
}
}

View file

@ -33,6 +33,11 @@ namespace Mesen.GUI.Forms.Config
AddBinding(nameof(PreferencesConfig.SingleInstance), chkSingleInstance);
AddBinding(nameof(PreferencesConfig.AutoLoadPatches), chkAutoLoadPatches);
AddBinding(nameof(PreferencesConfig.PauseWhenInBackground), chkPauseWhenInBackground);
AddBinding(nameof(PreferencesConfig.PauseWhenInMenusAndConfig), chkPauseInMenuAndConfig);
AddBinding(nameof(PreferencesConfig.PauseWhenInDebuggingTools), chkPauseInDebugger);
AddBinding(nameof(PreferencesConfig.AllowBackgroundInput), chkAllowBackgroundInput);
AddBinding(nameof(PreferencesConfig.AssociateRomFiles), chkRomFormat);
AddBinding(nameof(PreferencesConfig.AssociateMsmFiles), chkMsmFormat);
AddBinding(nameof(PreferencesConfig.AssociateMssFiles), chkMssFormat);

View file

@ -44,7 +44,7 @@
this.mnuPowerCycle = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem24 = new System.Windows.Forms.ToolStripSeparator();
this.mnuPowerOff = new System.Windows.Forms.ToolStripMenuItem();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuOptions = new System.Windows.Forms.ToolStripMenuItem();
this.mnuEmulationSpeed = new System.Windows.Forms.ToolStripMenuItem();
this.mnuEmuSpeedNormal = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem8 = new System.Windows.Forms.ToolStripSeparator();
@ -110,7 +110,7 @@
this.mnuEmulationConfig = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator();
this.mnuPreferences = new System.Windows.Forms.ToolStripMenuItem();
this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuTools = new System.Windows.Forms.ToolStripMenuItem();
this.mnuSoundRecorder = new System.Windows.Forms.ToolStripMenuItem();
this.mnuWaveRecord = new System.Windows.Forms.ToolStripMenuItem();
this.mnuWaveStop = new System.Windows.Forms.ToolStripMenuItem();
@ -121,11 +121,12 @@
this.mnuLogWindow = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripSeparator();
this.mnuTakeScreenshot = new System.Windows.Forms.ToolStripMenuItem();
this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDebug = new System.Windows.Forms.ToolStripMenuItem();
this.mnuDebugger = new System.Windows.Forms.ToolStripMenuItem();
this.mnuSpcDebugger = new System.Windows.Forms.ToolStripMenuItem();
this.mnuMemoryTools = new System.Windows.Forms.ToolStripMenuItem();
this.mnuTraceLogger = new System.Windows.Forms.ToolStripMenuItem();
this.mnuScriptWindow = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem12 = new System.Windows.Forms.ToolStripSeparator();
this.mnuTilemapViewer = new System.Windows.Forms.ToolStripMenuItem();
this.mnuTileViewer = new System.Windows.Forms.ToolStripMenuItem();
@ -141,7 +142,6 @@
this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem();
this.pnlRenderer = new System.Windows.Forms.Panel();
this.ctrlRecentGames = new Mesen.GUI.Controls.ctrlRecentGames();
this.mnuScriptWindow = new System.Windows.Forms.ToolStripMenuItem();
this.mnuMain.SuspendLayout();
this.pnlRenderer.SuspendLayout();
this.SuspendLayout();
@ -158,9 +158,9 @@
this.mnuMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuFile,
this.mnuGame,
this.optionsToolStripMenuItem,
this.toolsToolStripMenuItem,
this.debugToolStripMenuItem,
this.mnuOptions,
this.mnuTools,
this.mnuDebug,
this.mnuHelp});
this.mnuMain.Location = new System.Drawing.Point(0, 0);
this.mnuMain.Name = "mnuMain";
@ -182,55 +182,57 @@
this.mnuFile.Name = "mnuFile";
this.mnuFile.Size = new System.Drawing.Size(37, 20);
this.mnuFile.Text = "File";
this.mnuFile.DropDownClosed += new System.EventHandler(this.mnu_DropDownClosed);
this.mnuFile.DropDownOpening += new System.EventHandler(this.mnuFile_DropDownOpening);
this.mnuFile.DropDownOpened += new System.EventHandler(this.mnu_DropDownOpened);
//
// mnuOpen
//
this.mnuOpen.Image = global::Mesen.GUI.Properties.Resources.Folder;
this.mnuOpen.Name = "mnuOpen";
this.mnuOpen.Size = new System.Drawing.Size(136, 22);
this.mnuOpen.Size = new System.Drawing.Size(152, 22);
this.mnuOpen.Text = "Open";
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(133, 6);
this.toolStripMenuItem2.Size = new System.Drawing.Size(149, 6);
//
// mnuSaveState
//
this.mnuSaveState.Name = "mnuSaveState";
this.mnuSaveState.Size = new System.Drawing.Size(136, 22);
this.mnuSaveState.Size = new System.Drawing.Size(152, 22);
this.mnuSaveState.Text = "Save State";
this.mnuSaveState.DropDownOpening += new System.EventHandler(this.mnuSaveState_DropDownOpening);
//
// mnuLoadState
//
this.mnuLoadState.Name = "mnuLoadState";
this.mnuLoadState.Size = new System.Drawing.Size(136, 22);
this.mnuLoadState.Size = new System.Drawing.Size(152, 22);
this.mnuLoadState.Text = "Load State";
this.mnuLoadState.DropDownOpening += new System.EventHandler(this.mnuLoadState_DropDownOpening);
//
// toolStripMenuItem10
//
this.toolStripMenuItem10.Name = "toolStripMenuItem10";
this.toolStripMenuItem10.Size = new System.Drawing.Size(133, 6);
this.toolStripMenuItem10.Size = new System.Drawing.Size(149, 6);
//
// mnuRecentFiles
//
this.mnuRecentFiles.Name = "mnuRecentFiles";
this.mnuRecentFiles.Size = new System.Drawing.Size(136, 22);
this.mnuRecentFiles.Size = new System.Drawing.Size(152, 22);
this.mnuRecentFiles.Text = "Recent Files";
//
// toolStripMenuItem6
//
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
this.toolStripMenuItem6.Size = new System.Drawing.Size(133, 6);
this.toolStripMenuItem6.Size = new System.Drawing.Size(149, 6);
//
// mnuExit
//
this.mnuExit.Image = global::Mesen.GUI.Properties.Resources.Exit;
this.mnuExit.Name = "mnuExit";
this.mnuExit.Size = new System.Drawing.Size(136, 22);
this.mnuExit.Size = new System.Drawing.Size(152, 22);
this.mnuExit.Text = "Exit";
//
// mnuGame
@ -244,13 +246,15 @@
this.mnuGame.Name = "mnuGame";
this.mnuGame.Size = new System.Drawing.Size(50, 20);
this.mnuGame.Text = "Game";
this.mnuGame.DropDownClosed += new System.EventHandler(this.mnu_DropDownClosed);
this.mnuGame.DropDownOpened += new System.EventHandler(this.mnu_DropDownOpened);
//
// mnuPause
//
this.mnuPause.Enabled = false;
this.mnuPause.Image = global::Mesen.GUI.Properties.Resources.MediaPause;
this.mnuPause.Name = "mnuPause";
this.mnuPause.Size = new System.Drawing.Size(139, 22);
this.mnuPause.Size = new System.Drawing.Size(152, 22);
this.mnuPause.Text = "Pause";
//
// mnuReset
@ -258,7 +262,7 @@
this.mnuReset.Enabled = false;
this.mnuReset.Image = global::Mesen.GUI.Properties.Resources.Refresh;
this.mnuReset.Name = "mnuReset";
this.mnuReset.Size = new System.Drawing.Size(139, 22);
this.mnuReset.Size = new System.Drawing.Size(152, 22);
this.mnuReset.Text = "Reset";
//
// mnuPowerCycle
@ -266,24 +270,24 @@
this.mnuPowerCycle.Enabled = false;
this.mnuPowerCycle.Image = global::Mesen.GUI.Properties.Resources.PowerCycle;
this.mnuPowerCycle.Name = "mnuPowerCycle";
this.mnuPowerCycle.Size = new System.Drawing.Size(139, 22);
this.mnuPowerCycle.Size = new System.Drawing.Size(152, 22);
this.mnuPowerCycle.Text = "Power Cycle";
//
// toolStripMenuItem24
//
this.toolStripMenuItem24.Name = "toolStripMenuItem24";
this.toolStripMenuItem24.Size = new System.Drawing.Size(136, 6);
this.toolStripMenuItem24.Size = new System.Drawing.Size(149, 6);
//
// mnuPowerOff
//
this.mnuPowerOff.Image = global::Mesen.GUI.Properties.Resources.MediaStop;
this.mnuPowerOff.Name = "mnuPowerOff";
this.mnuPowerOff.Size = new System.Drawing.Size(139, 22);
this.mnuPowerOff.Size = new System.Drawing.Size(152, 22);
this.mnuPowerOff.Text = "Power Off";
//
// optionsToolStripMenuItem
// mnuOptions
//
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuOptions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuEmulationSpeed,
this.mnuVideoScale,
this.mnuVideoFilter,
@ -295,9 +299,11 @@
this.mnuEmulationConfig,
this.toolStripMenuItem3,
this.mnuPreferences});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
this.optionsToolStripMenuItem.Text = "Options";
this.mnuOptions.Name = "mnuOptions";
this.mnuOptions.Size = new System.Drawing.Size(61, 20);
this.mnuOptions.Text = "Options";
this.mnuOptions.DropDownClosed += new System.EventHandler(this.mnu_DropDownClosed);
this.mnuOptions.DropDownOpened += new System.EventHandler(this.mnu_DropDownOpened);
//
// mnuEmulationSpeed
//
@ -316,7 +322,7 @@
this.mnuShowFPS});
this.mnuEmulationSpeed.Image = global::Mesen.GUI.Properties.Resources.Speed;
this.mnuEmulationSpeed.Name = "mnuEmulationSpeed";
this.mnuEmulationSpeed.Size = new System.Drawing.Size(135, 22);
this.mnuEmulationSpeed.Size = new System.Drawing.Size(152, 22);
this.mnuEmulationSpeed.Text = "Speed";
this.mnuEmulationSpeed.DropDownOpening += new System.EventHandler(this.mnuEmulationSpeed_DropDownOpening);
//
@ -403,7 +409,7 @@
this.mnuFullscreen});
this.mnuVideoScale.Image = global::Mesen.GUI.Properties.Resources.Fullscreen;
this.mnuVideoScale.Name = "mnuVideoScale";
this.mnuVideoScale.Size = new System.Drawing.Size(135, 22);
this.mnuVideoScale.Size = new System.Drawing.Size(152, 22);
this.mnuVideoScale.Text = "Video Size";
this.mnuVideoScale.DropDownOpening += new System.EventHandler(this.mnuVideoScale_DropDownOpening);
//
@ -489,7 +495,7 @@
this.mnuBilinearInterpolation});
this.mnuVideoFilter.Image = global::Mesen.GUI.Properties.Resources.VideoFilter;
this.mnuVideoFilter.Name = "mnuVideoFilter";
this.mnuVideoFilter.Size = new System.Drawing.Size(135, 22);
this.mnuVideoFilter.Size = new System.Drawing.Size(152, 22);
this.mnuVideoFilter.Text = "Video Filter";
this.mnuVideoFilter.DropDownOpening += new System.EventHandler(this.mnuVideoFilter_DropDownOpening);
//
@ -676,7 +682,7 @@
this.mnuRegionPal});
this.mnuRegion.Image = global::Mesen.GUI.Properties.Resources.WebBrowser;
this.mnuRegion.Name = "mnuRegion";
this.mnuRegion.Size = new System.Drawing.Size(135, 22);
this.mnuRegion.Size = new System.Drawing.Size(152, 22);
this.mnuRegion.Text = "Region";
this.mnuRegion.DropDownOpening += new System.EventHandler(this.mnuRegion_DropDownOpening);
//
@ -706,13 +712,13 @@
// toolStripMenuItem4
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(132, 6);
this.toolStripMenuItem4.Size = new System.Drawing.Size(149, 6);
//
// mnuAudioConfig
//
this.mnuAudioConfig.Image = global::Mesen.GUI.Properties.Resources.Audio;
this.mnuAudioConfig.Name = "mnuAudioConfig";
this.mnuAudioConfig.Size = new System.Drawing.Size(135, 22);
this.mnuAudioConfig.Size = new System.Drawing.Size(152, 22);
this.mnuAudioConfig.Text = "Audio";
this.mnuAudioConfig.Click += new System.EventHandler(this.mnuAudioConfig_Click);
//
@ -720,7 +726,7 @@
//
this.mnuInputConfig.Image = global::Mesen.GUI.Properties.Resources.Controller;
this.mnuInputConfig.Name = "mnuInputConfig";
this.mnuInputConfig.Size = new System.Drawing.Size(135, 22);
this.mnuInputConfig.Size = new System.Drawing.Size(152, 22);
this.mnuInputConfig.Text = "Input";
this.mnuInputConfig.Click += new System.EventHandler(this.mnuInputConfig_Click);
//
@ -728,7 +734,7 @@
//
this.mnuVideoConfig.Image = global::Mesen.GUI.Properties.Resources.VideoOptions;
this.mnuVideoConfig.Name = "mnuVideoConfig";
this.mnuVideoConfig.Size = new System.Drawing.Size(135, 22);
this.mnuVideoConfig.Size = new System.Drawing.Size(152, 22);
this.mnuVideoConfig.Text = "Video";
this.mnuVideoConfig.Click += new System.EventHandler(this.mnuVideoConfig_Click);
//
@ -736,36 +742,38 @@
//
this.mnuEmulationConfig.Image = global::Mesen.GUI.Properties.Resources.DipSwitches;
this.mnuEmulationConfig.Name = "mnuEmulationConfig";
this.mnuEmulationConfig.Size = new System.Drawing.Size(135, 22);
this.mnuEmulationConfig.Size = new System.Drawing.Size(152, 22);
this.mnuEmulationConfig.Text = "Emulation";
this.mnuEmulationConfig.Click += new System.EventHandler(this.mnuEmulationConfig_Click);
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(132, 6);
this.toolStripMenuItem3.Size = new System.Drawing.Size(149, 6);
//
// mnuPreferences
//
this.mnuPreferences.Image = global::Mesen.GUI.Properties.Resources.Settings;
this.mnuPreferences.Name = "mnuPreferences";
this.mnuPreferences.Size = new System.Drawing.Size(135, 22);
this.mnuPreferences.Size = new System.Drawing.Size(152, 22);
this.mnuPreferences.Text = "Preferences";
this.mnuPreferences.Click += new System.EventHandler(this.mnuPreferences_Click);
//
// toolsToolStripMenuItem
// mnuTools
//
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuTools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuSoundRecorder,
this.mnuVideoRecorder,
this.toolStripMenuItem11,
this.mnuLogWindow,
this.toolStripMenuItem7,
this.mnuTakeScreenshot});
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(47, 20);
this.toolsToolStripMenuItem.Text = "Tools";
this.toolsToolStripMenuItem.DropDownOpening += new System.EventHandler(this.toolsToolStripMenuItem_DropDownOpening);
this.mnuTools.Name = "mnuTools";
this.mnuTools.Size = new System.Drawing.Size(47, 20);
this.mnuTools.Text = "Tools";
this.mnuTools.DropDownClosed += new System.EventHandler(this.mnu_DropDownClosed);
this.mnuTools.DropDownOpening += new System.EventHandler(this.mnuTools_DropDownOpening);
this.mnuTools.DropDownOpened += new System.EventHandler(this.mnu_DropDownOpened);
//
// mnuSoundRecorder
//
@ -845,9 +853,9 @@
this.mnuTakeScreenshot.Size = new System.Drawing.Size(159, 22);
this.mnuTakeScreenshot.Text = "Take Screenshot";
//
// debugToolStripMenuItem
// mnuDebug
//
this.debugToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuDebug.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuDebugger,
this.mnuSpcDebugger,
this.mnuMemoryTools,
@ -860,9 +868,11 @@
this.mnuPaletteViewer,
this.toolStripMenuItem22,
this.mnuEventViewer});
this.debugToolStripMenuItem.Name = "debugToolStripMenuItem";
this.debugToolStripMenuItem.Size = new System.Drawing.Size(54, 20);
this.debugToolStripMenuItem.Text = "Debug";
this.mnuDebug.Name = "mnuDebug";
this.mnuDebug.Size = new System.Drawing.Size(54, 20);
this.mnuDebug.Text = "Debug";
this.mnuDebug.DropDownClosed += new System.EventHandler(this.mnu_DropDownClosed);
this.mnuDebug.DropDownOpened += new System.EventHandler(this.mnu_DropDownOpened);
//
// mnuDebugger
//
@ -892,6 +902,13 @@
this.mnuTraceLogger.Size = new System.Drawing.Size(155, 22);
this.mnuTraceLogger.Text = "Trace Logger";
//
// mnuScriptWindow
//
this.mnuScriptWindow.Image = global::Mesen.GUI.Properties.Resources.Script;
this.mnuScriptWindow.Name = "mnuScriptWindow";
this.mnuScriptWindow.Size = new System.Drawing.Size(155, 22);
this.mnuScriptWindow.Text = "Script Window";
//
// toolStripMenuItem12
//
this.toolStripMenuItem12.Name = "toolStripMenuItem12";
@ -948,6 +965,8 @@
this.mnuHelp.Name = "mnuHelp";
this.mnuHelp.Size = new System.Drawing.Size(44, 20);
this.mnuHelp.Text = "Help";
this.mnuHelp.DropDownClosed += new System.EventHandler(this.mnu_DropDownClosed);
this.mnuHelp.DropDownOpened += new System.EventHandler(this.mnu_DropDownOpened);
//
// mnuCheckForUpdates
//
@ -1003,13 +1022,6 @@
this.ctrlRecentGames.TabIndex = 1;
this.ctrlRecentGames.Visible = false;
//
// mnuScriptWindow
//
this.mnuScriptWindow.Image = global::Mesen.GUI.Properties.Resources.Script;
this.mnuScriptWindow.Name = "mnuScriptWindow";
this.mnuScriptWindow.Size = new System.Drawing.Size(155, 22);
this.mnuScriptWindow.Text = "Script Window";
//
// frmMain
//
this.AllowDrop = true;
@ -1037,7 +1049,7 @@
private Controls.ctrlRenderer ctrlRenderer;
private Controls.ctrlMesenMenuStrip mnuMain;
private System.Windows.Forms.ToolStripMenuItem debugToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuDebug;
private System.Windows.Forms.ToolStripMenuItem mnuDebugger;
private System.Windows.Forms.ToolStripMenuItem mnuTraceLogger;
private System.Windows.Forms.ToolStripMenuItem mnuFile;
@ -1045,7 +1057,7 @@
private System.Windows.Forms.ToolStripMenuItem mnuMemoryTools;
private System.Windows.Forms.ToolStripMenuItem mnuTilemapViewer;
private System.Windows.Forms.ToolStripMenuItem mnuEventViewer;
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuOptions;
private System.Windows.Forms.ToolStripMenuItem mnuVideoConfig;
private System.Windows.Forms.Panel pnlRenderer;
private System.Windows.Forms.ToolStripMenuItem mnuAudioConfig;
@ -1121,7 +1133,7 @@
private System.Windows.Forms.ToolStripMenuItem mnuReportBug;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem5;
private System.Windows.Forms.ToolStripMenuItem mnuAbout;
private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mnuTools;
private System.Windows.Forms.ToolStripMenuItem mnuLogWindow;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem7;
private System.Windows.Forms.ToolStripMenuItem mnuTakeScreenshot;

View file

@ -15,6 +15,7 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
@ -91,6 +92,7 @@ namespace Mesen.GUI.Forms
UpdateHelper.CheckForUpdates(true);
}
InBackgroundHelper.StartBackgroundTimer();
this.Resize += frmMain_Resize;
}
@ -483,7 +485,7 @@ namespace Mesen.GUI.Forms
RecordApi.AviStop();
}
private void toolsToolStripMenuItem_DropDownOpening(object sender, EventArgs e)
private void mnuTools_DropDownOpening(object sender, EventArgs e)
{
mnuVideoRecorder.Enabled = EmuRunner.IsRunning();
mnuAviRecord.Enabled = EmuRunner.IsRunning() && !RecordApi.AviIsRecording();
@ -513,5 +515,18 @@ namespace Mesen.GUI.Forms
mnuWaveRecord.Enabled = EmuRunner.IsRunning() && !RecordApi.WaveIsRecording();
mnuWaveStop.Enabled = EmuRunner.IsRunning() && RecordApi.WaveIsRecording();
}
private void mnu_DropDownOpened(object sender, EventArgs e)
{
Interlocked.Increment(ref _inMenu);
}
private void mnu_DropDownClosed(object sender, EventArgs e)
{
Task.Run(() => {
Thread.Sleep(100);
Interlocked.Decrement(ref _inMenu);
});
}
}
}

View file

@ -25,6 +25,7 @@ namespace Mesen.GUI
[DllImport(DllPath)] public static extern void SetPreferences(InteropPreferencesConfig config);
[DllImport(DllPath)] public static extern void SetShortcutKeys([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]ShortcutKeyInfo[] shortcuts, UInt32 count);
[DllImport(DllPath)] public static extern void SetEmulationFlag(EmulationFlags flag, bool enabled);
[DllImport(DllPath)] public static extern void SetDebuggerFlag(DebuggerFlags flag, bool enabled);
[DllImport(DllPath, EntryPoint = "GetAudioDevices")] private static extern IntPtr GetAudioDevicesWrapper();
@ -33,7 +34,15 @@ namespace Mesen.GUI
return new List<string>(Utf8Marshaler.PtrToStringUtf8(ConfigApi.GetAudioDevicesWrapper()).Split(new string[1] { "||" }, StringSplitOptions.RemoveEmptyEntries));
}
}
public enum EmulationFlags : UInt32
{
Turbo = 1,
Rewind = 2,
MaximumSpeed = 4,
InBackground = 8,
}
public enum DebuggerFlags : UInt32
{
BreakOnBrk = 0x01,

View file

@ -815,6 +815,7 @@
<Compile Include="Utilities\CommandLineHelper.cs" />
<Compile Include="Utilities\FolderHelper.cs" />
<Compile Include="Utilities\HexConverter.cs" />
<Compile Include="Utilities\InBackgroundHelper.cs" />
<Compile Include="Utilities\Md5Helper.cs" />
<Compile Include="Updates\UpdateHelper.cs" />
<Compile Include="Utilities\XmlColor.cs" />

View file

@ -0,0 +1,61 @@
using Mesen.GUI.Config;
using Mesen.GUI.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesen.GUI.Utilities
{
class InBackgroundHelper
{
private static Timer _tmrUpdateBackground;
private static bool _needResume = false;
public static void StartBackgroundTimer()
{
_tmrUpdateBackground = new Timer();
_tmrUpdateBackground.Start();
_tmrUpdateBackground.Tick += tmrUpdateBackground_Tick;
}
public static void StopBackgroundTimer()
{
_tmrUpdateBackground?.Stop();
}
private static void tmrUpdateBackground_Tick(object sender, EventArgs e)
{
Form focusedForm = null;
foreach(Form form in Application.OpenForms) {
if(form.ContainsFocus) {
focusedForm = form;
break;
}
}
PreferencesConfig cfg = ConfigManager.Config.Preferences;
bool needPause = focusedForm == null && cfg.PauseWhenInBackground;
if(focusedForm != null) {
needPause |= cfg.PauseWhenInMenusAndConfig && focusedForm is BaseForm && (((BaseForm)focusedForm).InMenu || ((BaseForm)focusedForm).IsConfigForm);
needPause |= cfg.PauseWhenInMenusAndConfig && !(focusedForm is BaseInputForm) && !focusedForm.GetType().FullName.Contains("Debugger");
needPause |= cfg.PauseWhenInDebuggingTools && focusedForm.GetType().FullName.Contains("Debugger");
}
if(needPause) {
if(!EmuApi.IsPaused()) {
_needResume = true;
EmuApi.Pause();
}
} else if(_needResume) {
EmuApi.Resume();
_needResume = false;
}
ConfigApi.SetEmulationFlag(EmulationFlags.InBackground, focusedForm == null);
}
}
}