diff --git a/GUI.NET/Config/AudioInfo.cs b/GUI.NET/Config/AudioInfo.cs index 8e316da9..4aaa20af 100644 --- a/GUI.NET/Config/AudioInfo.cs +++ b/GUI.NET/Config/AudioInfo.cs @@ -13,33 +13,35 @@ namespace Mesen.GUI.Config { public string AudioDevice = ""; public bool EnableAudio = true; - public UInt32 AudioLatency = 50; - public UInt32 MasterVolume = 25; - public UInt32 Square1Volume = 100; - public UInt32 Square2Volume = 100; - public UInt32 TriangleVolume = 100; - public UInt32 NoiseVolume = 100; - public UInt32 DmcVolume = 100; - public UInt32 FdsVolume = 100; - public UInt32 Mmc5Volume = 100; - public UInt32 Vrc6Volume = 100; - public UInt32 Vrc7Volume = 100; - public UInt32 Namco163Volume = 100; - public UInt32 Sunsoft5bVolume = 100; - public Int32 Square1Panning = 0; - public Int32 Square2Panning = 0; - public Int32 TrianglePanning = 0; - public Int32 NoisePanning = 0; - public Int32 DmcPanning = 0; - public Int32 FdsPanning = 0; - public Int32 Mmc5Panning = 0; - public Int32 Vrc6Panning = 0; - public Int32 Vrc7Panning = 0; - public Int32 Namco163Panning = 0; - public Int32 Sunsoft5bPanning = 0; + [MinMax(15, 300)] public UInt32 AudioLatency = 50; - public UInt32 SampleRate = 44100; + [MinMax(0, 100)] public UInt32 MasterVolume = 25; + [MinMax(0, 100)] public UInt32 Square1Volume = 100; + [MinMax(0, 100)] public UInt32 Square2Volume = 100; + [MinMax(0, 100)] public UInt32 TriangleVolume = 100; + [MinMax(0, 100)] public UInt32 NoiseVolume = 100; + [MinMax(0, 100)] public UInt32 DmcVolume = 100; + [MinMax(0, 100)] public UInt32 FdsVolume = 100; + [MinMax(0, 100)] public UInt32 Mmc5Volume = 100; + [MinMax(0, 100)] public UInt32 Vrc6Volume = 100; + [MinMax(0, 100)] public UInt32 Vrc7Volume = 100; + [MinMax(0, 100)] public UInt32 Namco163Volume = 100; + [MinMax(0, 100)] public UInt32 Sunsoft5bVolume = 100; + + [MinMax(-100, 100)] public Int32 Square1Panning = 0; + [MinMax(-100, 100)] public Int32 Square2Panning = 0; + [MinMax(-100, 100)] public Int32 TrianglePanning = 0; + [MinMax(-100, 100)] public Int32 NoisePanning = 0; + [MinMax(-100, 100)] public Int32 DmcPanning = 0; + [MinMax(-100, 100)] public Int32 FdsPanning = 0; + [MinMax(-100, 100)] public Int32 Mmc5Panning = 0; + [MinMax(-100, 100)] public Int32 Vrc6Panning = 0; + [MinMax(-100, 100)] public Int32 Vrc7Panning = 0; + [MinMax(-100, 100)] public Int32 Namco163Panning = 0; + [MinMax(-100, 100)] public Int32 Sunsoft5bPanning = 0; + + [ValidValues(11025, 22050, 44100, 48000)] public UInt32 SampleRate = 44100; public bool ReduceSoundInBackground = true; public bool MuteSoundInBackground = false; public bool SwapDutyCycles = false; @@ -47,13 +49,13 @@ namespace Mesen.GUI.Config public bool ReduceDmcPopping = false; public bool DisableNoiseModeFlag = false; public InteropEmu.StereoFilter StereoFilter; - public Int32 StereoDelay = 15; - public Int32 StereoPanningAngle = 15; + [MinMax(0, 100)] public Int32 StereoDelay = 15; + [MinMax(-180, 180)] public Int32 StereoPanningAngle = 15; public bool ReverbEnabled = false; - public UInt32 ReverbStrength = 5; - public UInt32 ReverbDelay = 10; + [MinMax(1, 10)] public UInt32 ReverbStrength = 5; + [MinMax(1, 30)] public UInt32 ReverbDelay = 10; public bool CrossFeedEnabled = false; - public UInt32 CrossFeedRatio = 0; + [MinMax(0, 100)] public UInt32 CrossFeedRatio = 0; public AudioInfo() { diff --git a/GUI.NET/Config/ConfigAttributes.cs b/GUI.NET/Config/ConfigAttributes.cs new file mode 100644 index 00000000..230e04cd --- /dev/null +++ b/GUI.NET/Config/ConfigAttributes.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mesen.GUI.Config +{ + public class MinMaxAttribute : Attribute + { + public object Min { get; set; } + public object Max { get; set; } + + public MinMaxAttribute(object min, object max) + { + this.Min = min; + this.Max = max; + } + } + + public class ValidValuesAttribute : Attribute + { + public uint[] ValidValues { get; set; } + + public ValidValuesAttribute(params uint[] validValues) + { + this.ValidValues = validValues; + } + } +} diff --git a/GUI.NET/Config/ConfigManager.cs b/GUI.NET/Config/ConfigManager.cs index 7451ee3e..91ff3eb1 100644 --- a/GUI.NET/Config/ConfigManager.cs +++ b/GUI.NET/Config/ConfigManager.cs @@ -8,6 +8,8 @@ using System.Xml.Serialization; using System.Drawing; using System.Drawing.Imaging; using System.Drawing.Drawing2D; +using System.Text.RegularExpressions; +using System.Reflection; namespace Mesen.GUI.Config { @@ -17,6 +19,7 @@ namespace Mesen.GUI.Config private static Configuration _dirtyConfig; private static bool? _portableMode = null; private static string _portablePath = null; + public static bool DoNotSaveSettings { get; set; } private static void LoadConfig() { @@ -33,6 +36,84 @@ namespace Mesen.GUI.Config } } + private static void ApplySetting(Type type, object instance, string name, string value) + { + FieldInfo[] fields = type.GetFields(); + foreach(FieldInfo info in fields) { + if(string.Compare(info.Name, name, true) == 0) { + try { + if(info.FieldType == typeof(int) || info.FieldType == typeof(uint) || info.FieldType == typeof(double)) { + MinMaxAttribute minMaxAttribute = info.GetCustomAttribute(typeof(MinMaxAttribute)) as MinMaxAttribute; + if(minMaxAttribute != null) { + if(info.FieldType == typeof(int)) { + int result; + if(int.TryParse(value, out result)) { + if(result >= (int)minMaxAttribute.Min && result <= (int)minMaxAttribute.Max) { + info.SetValue(instance, result); + } + } + } else if(info.FieldType == typeof(uint)) { + uint result; + if(uint.TryParse(value, out result)) { + if(result >= (uint)(int)minMaxAttribute.Min && result <= (uint)(int)minMaxAttribute.Max) { + info.SetValue(instance, result); + } + } + } else if(info.FieldType == typeof(double)) { + double result; + if(double.TryParse(value, out result)) { + if(result >= (double)minMaxAttribute.Min && result <= (double)minMaxAttribute.Max) { + info.SetValue(instance, result); + } + } + } + } else { + ValidValuesAttribute validValuesAttribute = info.GetCustomAttribute(typeof(ValidValuesAttribute)) as ValidValuesAttribute; + if(validValuesAttribute != null) { + uint result; + if(uint.TryParse(value, out result)) { + if(validValuesAttribute.ValidValues.Contains(result)) { + info.SetValue(instance, result); + } + } + } + } + } else if(info.FieldType == typeof(bool)) { + if(string.Compare(value, "false", true) == 0) { + info.SetValue(instance, false); + } else if(string.Compare(value, "true", true) == 0) { + info.SetValue(instance, true); + } + } else if(info.FieldType.IsEnum) { + int indexOf = Enum.GetNames(info.FieldType).Select((enumValue) => enumValue.ToLower()).ToList().IndexOf(value.ToLower()); + if(indexOf >= 0) { + info.SetValue(instance, indexOf); + } + } + } catch { + } + break; + } + } + } + + public static void ProcessSwitches(List switches) + { + Regex regex = new Regex("/([a-z0-9_A-Z.]+)=([a-z0-9_A-Z.\\-]+)"); + foreach(string param in switches) { + Match match = regex.Match(param); + if(match.Success) { + string switchName = match.Groups[1].Value; + string switchValue = match.Groups[2].Value; + + ApplySetting(typeof(VideoInfo), Config.VideoInfo, switchName, switchValue); + ApplySetting(typeof(AudioInfo), Config.AudioInfo, switchName, switchValue); + ApplySetting(typeof(EmulationInfo), Config.EmulationInfo, switchName, switchValue); + ApplySetting(typeof(Configuration), Config, switchName, switchValue); + } + } + } + public static void SaveConfig() { _config.Save(); diff --git a/GUI.NET/Config/Configuration.cs b/GUI.NET/Config/Configuration.cs index 162999f0..a72960cd 100644 --- a/GUI.NET/Config/Configuration.cs +++ b/GUI.NET/Config/Configuration.cs @@ -119,9 +119,11 @@ namespace Mesen.GUI.Config public void Serialize(string configFile) { try { - XmlSerializer xmlSerializer = new XmlSerializer(typeof(Configuration)); - using(TextWriter textWriter = new StreamWriter(configFile)) { - xmlSerializer.Serialize(textWriter, this); + if(!ConfigManager.DoNotSaveSettings) { + XmlSerializer xmlSerializer = new XmlSerializer(typeof(Configuration)); + using(TextWriter textWriter = new StreamWriter(configFile)) { + xmlSerializer.Serialize(textWriter, this); + } } _needToSave = false; } catch { diff --git a/GUI.NET/Config/EmulationInfo.cs b/GUI.NET/Config/EmulationInfo.cs index a25a6686..3f788bd0 100644 --- a/GUI.NET/Config/EmulationInfo.cs +++ b/GUI.NET/Config/EmulationInfo.cs @@ -24,18 +24,18 @@ namespace Mesen.GUI.Config public bool UseAlternativeMmc3Irq = false; - public UInt32 OverclockRate = 100; + [MinMax(1, 1000)] public UInt32 OverclockRate = 100; public bool OverclockAdjustApu = true; - public UInt32 PpuExtraScanlinesBeforeNmi = 0; - public UInt32 PpuExtraScanlinesAfterNmi = 0; + [MinMax(0, 1000)] public UInt32 PpuExtraScanlinesBeforeNmi = 0; + [MinMax(0, 1000)] public UInt32 PpuExtraScanlinesAfterNmi = 0; public RamPowerOnState RamPowerOnState; public bool ShowLagCounter = false; - public UInt32 EmulationSpeed = 100; - public UInt32 TurboSpeed = 300; + [MinMax(0, 500)] public UInt32 EmulationSpeed = 100; + [MinMax(0, 500)] public UInt32 TurboSpeed = 300; public EmulationInfo() { diff --git a/GUI.NET/Config/PreferenceInfo.cs b/GUI.NET/Config/PreferenceInfo.cs index d17b84d3..936136dc 100644 --- a/GUI.NET/Config/PreferenceInfo.cs +++ b/GUI.NET/Config/PreferenceInfo.cs @@ -38,8 +38,6 @@ namespace Mesen.GUI.Config public bool PauseOnMovieEnd = true; public bool AutomaticallyCheckForUpdates = true; - public bool UseAlternativeMmc3Irq = false; - public bool CloudSaveIntegration = false; public DateTime CloudLastSync = DateTime.MinValue; @@ -83,7 +81,6 @@ namespace Mesen.GUI.Config FileAssociationHelper.UpdateFileAssociation("unf", preferenceInfo.AssociateUnfFiles); } - InteropEmu.SetFlag(EmulationFlags.Mmc3IrqAltBehavior, preferenceInfo.UseAlternativeMmc3Irq); InteropEmu.SetFlag(EmulationFlags.AllowInvalidInput, preferenceInfo.AllowInvalidInput); InteropEmu.SetFlag(EmulationFlags.RemoveSpriteLimit, preferenceInfo.RemoveSpriteLimit); InteropEmu.SetFlag(EmulationFlags.FdsAutoLoadDisk, preferenceInfo.FdsAutoLoadDisk); diff --git a/GUI.NET/Config/VideoInfo.cs b/GUI.NET/Config/VideoInfo.cs index b855dfdd..19f1ca2a 100644 --- a/GUI.NET/Config/VideoInfo.cs +++ b/GUI.NET/Config/VideoInfo.cs @@ -12,36 +12,36 @@ namespace Mesen.GUI.Config public class VideoInfo { public bool ShowFPS = false; - public UInt32 OverscanLeft = 0; - public UInt32 OverscanRight = 0; - public UInt32 OverscanTop = 8; - public UInt32 OverscanBottom = 8; - public double VideoScale = 2; + [MinMax(0, 100)] public UInt32 OverscanLeft = 0; + [MinMax(0, 100)] public UInt32 OverscanRight = 0; + [MinMax(0, 100)] public UInt32 OverscanTop = 8; + [MinMax(0, 100)] public UInt32 OverscanBottom = 8; + [MinMax(0.1, 10.0)] public double VideoScale = 2; public VideoFilterType VideoFilter = VideoFilterType.None; public bool UseBilinearInterpolation = false; public VideoAspectRatio AspectRatio = VideoAspectRatio.Auto; - public double CustomAspectRatio = 1.0; + [MinMax(0.1, 5.0)] public double CustomAspectRatio = 1.0; public bool VerticalSync = false; public bool UseHdPacks = false; public string PaletteData; - public Int32 Brightness = 0; - public Int32 Contrast = 0; - public Int32 Hue = 0; - public Int32 Saturation = 0; - public Int32 ScanlineIntensity = 0; + [MinMax(-100, 100)] public Int32 Brightness = 0; + [MinMax(-100, 100)] public Int32 Contrast = 0; + [MinMax(-100, 100)] public Int32 Hue = 0; + [MinMax(-100, 100)] public Int32 Saturation = 0; + [MinMax(0, 100)] public Int32 ScanlineIntensity = 0; - public Int32 NtscArtifacts = 0; - public Int32 NtscBleed = 0; - public Int32 NtscFringing = 0; - public Int32 NtscGamma = 0; - public Int32 NtscResolution = 0; - public Int32 NtscSharpness = 0; + [MinMax(-100, 100)] public Int32 NtscArtifacts = 0; + [MinMax(-100, 100)] public Int32 NtscBleed = 0; + [MinMax(-100, 100)] public Int32 NtscFringing = 0; + [MinMax(-100, 100)] public Int32 NtscGamma = 0; + [MinMax(-100, 100)] public Int32 NtscResolution = 0; + [MinMax(-100, 100)] public Int32 NtscSharpness = 0; public bool NtscMergeFields = false; - public Int32 NtscYFilterLength = 0; - public Int32 NtscIFilterLength = 50; - public Int32 NtscQFilterLength = 50; + [MinMax(-50, 400)] public Int32 NtscYFilterLength = 0; + [MinMax(0, 400)] public Int32 NtscIFilterLength = 50; + [MinMax(0, 400)] public Int32 NtscQFilterLength = 50; public bool DisableBackground = false; public bool DisableSprites = false; diff --git a/GUI.NET/Dependencies/resources.es.xml b/GUI.NET/Dependencies/resources.es.xml index 7b5d27ff..14565efc 100644 --- a/GUI.NET/Dependencies/resources.es.xml +++ b/GUI.NET/Dependencies/resources.es.xml @@ -91,6 +91,7 @@ Ayuda Buscar actualizaciones Enviar un error + Command-line options Acerca de... @@ -497,6 +498,15 @@ OK Cancelar +
+ Usage example + General + Video Options + Audio Options + Emulation Options + This will start Mesen in fullscreen mode with the "MyGame.nes" rom loaded. It will also use the NTSC filter, set at a 2x scale and configure the Overscan settings. The "DoNotSaveSettings" flag is used to prevent the command line switches from pernanently altering Mesen's settings. + /fullscreen - Start Mesen in fullscreen mode /DoNotSaveSettings - Prevent settings from being saved to the disk (useful to prevent command line options from becoming the default settings) +
Todos los tipos de archivo (*.*)|*.* diff --git a/GUI.NET/Dependencies/resources.fr.xml b/GUI.NET/Dependencies/resources.fr.xml index 8bf50356..22a38bea 100644 --- a/GUI.NET/Dependencies/resources.fr.xml +++ b/GUI.NET/Dependencies/resources.fr.xml @@ -91,6 +91,7 @@ Aide Recherche de mises-à-jour Signaler un problème + Options de ligne de commande À propos de... @@ -511,6 +512,15 @@ OK Annuler +
+ Exemple d'utilisation + Général + Options vidéo + Options audio + Options d'émulation + Cet exemple ouvrira Mesen en mode plein écran avec le jeu "MyGame.nes" de chargé. Le filtre vidéo NTSC avec un facteur d'agrandissement de 2x sera utilisé et les paramètres d'overscan seront modifiés. L'option "DoNotSaveSettings" empêche les options données en ligne de commande de devenir les options par défaut de l'émulateur. + /fullscreen - Démarre Mesen en mode plein écran /DoNotSaveSettings - Empêche la sauvegarde des paramètres sur le disque (autrement les options données en ligne de commande seront permanentes) +
Tous les fichiers (*.*)|*.* diff --git a/GUI.NET/Dependencies/resources.ja.xml b/GUI.NET/Dependencies/resources.ja.xml index c6b84ed7..04d53935 100644 --- a/GUI.NET/Dependencies/resources.ja.xml +++ b/GUI.NET/Dependencies/resources.ja.xml @@ -91,6 +91,7 @@ ヘルプ アップデートの確認 バグレポート + コマンドラインオプション Mesenとは @@ -493,6 +494,15 @@ OK キャンセル +
+ 使い方 + 全般 + 映像 + 音声 + エミュレーション + Mesenを全画面表示の状態で"MyGame.nes"を起動する. 画面エフェクトをNTSCにして、映像サイズを2xにして、オーバースキャン設定を変更する。 + /fullscreen - 全画面表示の状態で起動する /DoNotSaveSettings - 設定のセーブ機能を無効にする +
すべてのファイル (*.*)|*.* diff --git a/GUI.NET/Dependencies/resources.pt.xml b/GUI.NET/Dependencies/resources.pt.xml index edd77e08..f2f2aa27 100644 --- a/GUI.NET/Dependencies/resources.pt.xml +++ b/GUI.NET/Dependencies/resources.pt.xml @@ -91,6 +91,7 @@ Ajuda Procurar atualizações Reportar um erro + Command-line options Sobre... @@ -497,6 +498,15 @@ OK Cancelar +
+ Usage example + General + Video Options + Audio Options + Emulation Options + This will start Mesen in fullscreen mode with the "MyGame.nes" rom loaded. It will also use the NTSC filter, set at a 2x scale and configure the Overscan settings. The "DoNotSaveSettings" flag is used to prevent the command line switches from pernanently altering Mesen's settings. + /fullscreen - Start Mesen in fullscreen mode /DoNotSaveSettings - Prevent settings from being saved to the disk (useful to prevent command line options from becoming the default settings) +
Todos os tipos de arquivo (*.*)|*.* diff --git a/GUI.NET/Dependencies/resources.ru.xml b/GUI.NET/Dependencies/resources.ru.xml index d1b21774..e161c3f1 100644 --- a/GUI.NET/Dependencies/resources.ru.xml +++ b/GUI.NET/Dependencies/resources.ru.xml @@ -91,6 +91,7 @@ Помощь Проверить обновления Сообщить об ошибке + Command-line options О программе @@ -501,6 +502,15 @@ OK Отмена +
+ Usage example + General + Video Options + Audio Options + Emulation Options + This will start Mesen in fullscreen mode with the "MyGame.nes" rom loaded. It will also use the NTSC filter, set at a 2x scale and configure the Overscan settings. The "DoNotSaveSettings" flag is used to prevent the command line switches from pernanently altering Mesen's settings. + /fullscreen - Start Mesen in fullscreen mode /DoNotSaveSettings - Prevent settings from being saved to the disk (useful to prevent command line options from becoming the default settings) +
Все файлы (*.*)|*.* diff --git a/GUI.NET/Dependencies/resources.uk.xml b/GUI.NET/Dependencies/resources.uk.xml index 2a51197f..7332cb28 100644 --- a/GUI.NET/Dependencies/resources.uk.xml +++ b/GUI.NET/Dependencies/resources.uk.xml @@ -91,6 +91,7 @@ Допомога Перевірити оновлення Повідомити про помилку + Command-line options Про програму @@ -500,6 +501,15 @@ OK Вiдмiна +
+ Usage example + General + Video Options + Audio Options + Emulation Options + This will start Mesen in fullscreen mode with the "MyGame.nes" rom loaded. It will also use the NTSC filter, set at a 2x scale and configure the Overscan settings. The "DoNotSaveSettings" flag is used to prevent the command line switches from pernanently altering Mesen's settings. + /fullscreen - Start Mesen in fullscreen mode /DoNotSaveSettings - Prevent settings from being saved to the disk (useful to prevent command line options from becoming the default settings) +
Всi файли (*.*)|*.* diff --git a/GUI.NET/Forms/frmHelp.Designer.cs b/GUI.NET/Forms/frmHelp.Designer.cs new file mode 100644 index 00000000..a32989b5 --- /dev/null +++ b/GUI.NET/Forms/frmHelp.Designer.cs @@ -0,0 +1,286 @@ +namespace Mesen.GUI.Forms +{ + partial class frmHelp + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmHelp)); + this.tabCommandLineOptions = new System.Windows.Forms.TabControl(); + this.tpgGeneralOptions = new System.Windows.Forms.TabPage(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.txtGeneralOptions = new System.Windows.Forms.TextBox(); + this.grpExample = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.lblExample = new System.Windows.Forms.Label(); + this.lblExplanation = new System.Windows.Forms.Label(); + this.tpgVideoOptions = new System.Windows.Forms.TabPage(); + this.txtVideoOptions = new System.Windows.Forms.TextBox(); + this.tpgAudioOptions = new System.Windows.Forms.TabPage(); + this.txtAudioOptions = new System.Windows.Forms.TextBox(); + this.tpgEmulationOptions = new System.Windows.Forms.TabPage(); + this.txtEmulationOptions = new System.Windows.Forms.TextBox(); + this.btnClose = new System.Windows.Forms.Button(); + this.tabCommandLineOptions.SuspendLayout(); + this.tpgGeneralOptions.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.grpExample.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); + this.tpgVideoOptions.SuspendLayout(); + this.tpgAudioOptions.SuspendLayout(); + this.tpgEmulationOptions.SuspendLayout(); + this.SuspendLayout(); + // + // tabCommandLineOptions + // + this.tabCommandLineOptions.Controls.Add(this.tpgGeneralOptions); + this.tabCommandLineOptions.Controls.Add(this.tpgVideoOptions); + this.tabCommandLineOptions.Controls.Add(this.tpgAudioOptions); + this.tabCommandLineOptions.Controls.Add(this.tpgEmulationOptions); + this.tabCommandLineOptions.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabCommandLineOptions.Location = new System.Drawing.Point(0, 0); + this.tabCommandLineOptions.Name = "tabCommandLineOptions"; + this.tabCommandLineOptions.SelectedIndex = 0; + this.tabCommandLineOptions.Size = new System.Drawing.Size(582, 379); + this.tabCommandLineOptions.TabIndex = 0; + // + // tpgGeneralOptions + // + this.tpgGeneralOptions.Controls.Add(this.tableLayoutPanel1); + this.tpgGeneralOptions.Location = new System.Drawing.Point(4, 22); + this.tpgGeneralOptions.Name = "tpgGeneralOptions"; + this.tpgGeneralOptions.Size = new System.Drawing.Size(574, 353); + this.tpgGeneralOptions.TabIndex = 2; + this.tpgGeneralOptions.Text = "General"; + this.tpgGeneralOptions.UseVisualStyleBackColor = true; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.txtGeneralOptions, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.grpExample, 0, 0); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(574, 353); + this.tableLayoutPanel1.TabIndex = 3; + // + // txtGeneralOptions + // + this.txtGeneralOptions.BackColor = System.Drawing.SystemColors.ControlLightLight; + this.txtGeneralOptions.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtGeneralOptions.Location = new System.Drawing.Point(3, 140); + this.txtGeneralOptions.Multiline = true; + this.txtGeneralOptions.Name = "txtGeneralOptions"; + this.txtGeneralOptions.ReadOnly = true; + this.txtGeneralOptions.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtGeneralOptions.Size = new System.Drawing.Size(568, 210); + this.txtGeneralOptions.TabIndex = 3; + this.txtGeneralOptions.Text = "/fullscreen - Start Mesen in fullscreen mode\r\n/DoNotSaveSettings - Prevent settin" + + "gs from being saved to the disk (useful to prevent command line options from bec" + + "oming the default settings)"; + // + // grpExample + // + this.grpExample.Controls.Add(this.tableLayoutPanel2); + this.grpExample.Dock = System.Windows.Forms.DockStyle.Fill; + this.grpExample.Location = new System.Drawing.Point(3, 3); + this.grpExample.Name = "grpExample"; + this.grpExample.Size = new System.Drawing.Size(568, 131); + this.grpExample.TabIndex = 2; + this.grpExample.TabStop = false; + this.grpExample.Text = "Usage Example"; + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.ColumnCount = 1; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.Controls.Add(this.lblExample, 0, 0); + this.tableLayoutPanel2.Controls.Add(this.lblExplanation, 0, 1); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 16); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 2; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(562, 112); + this.tableLayoutPanel2.TabIndex = 1; + // + // lblExample + // + this.lblExample.AutoSize = true; + this.lblExample.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.lblExample.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.lblExample.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblExample.ForeColor = System.Drawing.SystemColors.HighlightText; + this.lblExample.Location = new System.Drawing.Point(3, 0); + this.lblExample.Name = "lblExample"; + this.lblExample.Size = new System.Drawing.Size(556, 28); + this.lblExample.TabIndex = 0; + this.lblExample.Text = "Mesen C:\\Games\\MyGame.nes /fullscreen /VideoFilter=NTSC /VideoScale=2 /OverscanTo" + + "p=8 /OverscanBottom=8 /OverscanLeft=0 /OverscanRight=0 /DoNotSaveSettings"; + // + // lblExplanation + // + this.lblExplanation.AutoSize = true; + this.lblExplanation.Location = new System.Drawing.Point(3, 28); + this.lblExplanation.Name = "lblExplanation"; + this.lblExplanation.Padding = new System.Windows.Forms.Padding(0, 5, 0, 0); + this.lblExplanation.Size = new System.Drawing.Size(551, 44); + this.lblExplanation.TabIndex = 1; + this.lblExplanation.Text = resources.GetString("lblExplanation.Text"); + // + // tpgVideoOptions + // + this.tpgVideoOptions.Controls.Add(this.txtVideoOptions); + this.tpgVideoOptions.Location = new System.Drawing.Point(4, 22); + this.tpgVideoOptions.Name = "tpgVideoOptions"; + this.tpgVideoOptions.Padding = new System.Windows.Forms.Padding(3); + this.tpgVideoOptions.Size = new System.Drawing.Size(574, 353); + this.tpgVideoOptions.TabIndex = 0; + this.tpgVideoOptions.Text = "Video Options"; + this.tpgVideoOptions.UseVisualStyleBackColor = true; + // + // txtVideoOptions + // + this.txtVideoOptions.BackColor = System.Drawing.SystemColors.ControlLightLight; + this.txtVideoOptions.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtVideoOptions.Location = new System.Drawing.Point(3, 3); + this.txtVideoOptions.Multiline = true; + this.txtVideoOptions.Name = "txtVideoOptions"; + this.txtVideoOptions.ReadOnly = true; + this.txtVideoOptions.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtVideoOptions.Size = new System.Drawing.Size(568, 347); + this.txtVideoOptions.TabIndex = 0; + // + // tpgAudioOptions + // + this.tpgAudioOptions.Controls.Add(this.txtAudioOptions); + this.tpgAudioOptions.Location = new System.Drawing.Point(4, 22); + this.tpgAudioOptions.Name = "tpgAudioOptions"; + this.tpgAudioOptions.Padding = new System.Windows.Forms.Padding(3); + this.tpgAudioOptions.Size = new System.Drawing.Size(574, 353); + this.tpgAudioOptions.TabIndex = 1; + this.tpgAudioOptions.Text = "Audio Options"; + this.tpgAudioOptions.UseVisualStyleBackColor = true; + // + // txtAudioOptions + // + this.txtAudioOptions.BackColor = System.Drawing.SystemColors.ControlLightLight; + this.txtAudioOptions.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtAudioOptions.Location = new System.Drawing.Point(3, 3); + this.txtAudioOptions.Multiline = true; + this.txtAudioOptions.Name = "txtAudioOptions"; + this.txtAudioOptions.ReadOnly = true; + this.txtAudioOptions.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtAudioOptions.Size = new System.Drawing.Size(568, 347); + this.txtAudioOptions.TabIndex = 1; + // + // tpgEmulationOptions + // + this.tpgEmulationOptions.Controls.Add(this.txtEmulationOptions); + this.tpgEmulationOptions.Location = new System.Drawing.Point(4, 22); + this.tpgEmulationOptions.Name = "tpgEmulationOptions"; + this.tpgEmulationOptions.Padding = new System.Windows.Forms.Padding(3); + this.tpgEmulationOptions.Size = new System.Drawing.Size(574, 353); + this.tpgEmulationOptions.TabIndex = 3; + this.tpgEmulationOptions.Text = "Emulation Options"; + this.tpgEmulationOptions.UseVisualStyleBackColor = true; + // + // txtEmulationOptions + // + this.txtEmulationOptions.BackColor = System.Drawing.SystemColors.ControlLightLight; + this.txtEmulationOptions.Dock = System.Windows.Forms.DockStyle.Fill; + this.txtEmulationOptions.Location = new System.Drawing.Point(3, 3); + this.txtEmulationOptions.Multiline = true; + this.txtEmulationOptions.Name = "txtEmulationOptions"; + this.txtEmulationOptions.ReadOnly = true; + this.txtEmulationOptions.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtEmulationOptions.Size = new System.Drawing.Size(568, 347); + this.txtEmulationOptions.TabIndex = 2; + // + // btnClose + // + this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnClose.Location = new System.Drawing.Point(1000, 1000); + this.btnClose.Name = "btnClose"; + this.btnClose.Size = new System.Drawing.Size(0, 0); + this.btnClose.TabIndex = 2; + this.btnClose.Text = "Close"; + this.btnClose.UseVisualStyleBackColor = true; + this.btnClose.Click += new System.EventHandler(this.btnClose_Click); + // + // frmHelp + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnClose; + this.ClientSize = new System.Drawing.Size(582, 379); + this.Controls.Add(this.tabCommandLineOptions); + this.Controls.Add(this.btnClose); + this.MinimumSize = new System.Drawing.Size(598, 417); + this.Name = "frmHelp"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Command-line options"; + this.tabCommandLineOptions.ResumeLayout(false); + this.tpgGeneralOptions.ResumeLayout(false); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.grpExample.ResumeLayout(false); + this.tableLayoutPanel2.ResumeLayout(false); + this.tableLayoutPanel2.PerformLayout(); + this.tpgVideoOptions.ResumeLayout(false); + this.tpgVideoOptions.PerformLayout(); + this.tpgAudioOptions.ResumeLayout(false); + this.tpgAudioOptions.PerformLayout(); + this.tpgEmulationOptions.ResumeLayout(false); + this.tpgEmulationOptions.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TabControl tabCommandLineOptions; + private System.Windows.Forms.TabPage tpgVideoOptions; + private System.Windows.Forms.TextBox txtVideoOptions; + private System.Windows.Forms.TabPage tpgAudioOptions; + private System.Windows.Forms.TextBox txtAudioOptions; + private System.Windows.Forms.TabPage tpgGeneralOptions; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.GroupBox grpExample; + private System.Windows.Forms.Label lblExample; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private System.Windows.Forms.Label lblExplanation; + private System.Windows.Forms.TextBox txtGeneralOptions; + private System.Windows.Forms.TabPage tpgEmulationOptions; + private System.Windows.Forms.TextBox txtEmulationOptions; + private System.Windows.Forms.Button btnClose; + } +} \ No newline at end of file diff --git a/GUI.NET/Forms/frmHelp.cs b/GUI.NET/Forms/frmHelp.cs new file mode 100644 index 00000000..9dfec899 --- /dev/null +++ b/GUI.NET/Forms/frmHelp.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Mesen.GUI.Config; +using Mesen.GUI.Controls; + +namespace Mesen.GUI.Forms +{ + public partial class frmHelp : BaseForm + { + public frmHelp() + { + InitializeComponent(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + lblExample.Font = new Font(BaseControl.MonospaceFontFamily, BaseControl.DefaultFontSize - 2); + txtAudioOptions.Font = new Font(BaseControl.MonospaceFontFamily, BaseControl.DefaultFontSize - 4); + txtEmulationOptions.Font = new Font(BaseControl.MonospaceFontFamily, BaseControl.DefaultFontSize - 4); + txtVideoOptions.Font = new Font(BaseControl.MonospaceFontFamily, BaseControl.DefaultFontSize - 4); + txtGeneralOptions.Font = new Font(BaseControl.MonospaceFontFamily, BaseControl.DefaultFontSize - 4); + + lblExample.Text = ConvertSlashes(lblExample.Text); + + StringBuilder sb = new StringBuilder(); + DisplayOptions(typeof(VideoInfo), sb); + txtVideoOptions.Text = ConvertSlashes(sb.ToString().Trim()); + + sb.Clear(); + DisplayOptions(typeof(AudioInfo), sb); + txtAudioOptions.Text = ConvertSlashes(sb.ToString().Trim()); + + sb.Clear(); + DisplayOptions(typeof(EmulationInfo), sb); + txtEmulationOptions.Text = ConvertSlashes(sb.ToString().Trim()); + + sb.Clear(); + DisplayOptions(typeof(Configuration), sb); + txtGeneralOptions.Text = ConvertSlashes(txtGeneralOptions.Text + Environment.NewLine + sb.ToString().Trim()); + } + + private string ConvertSlashes(string options) + { + if(Program.IsMono) { + return options.Replace("/", "--"); + } + return options; + } + + private void DisplayOptions(Type type, StringBuilder sb) + { + FieldInfo[] fields = type.GetFields(); + foreach(FieldInfo info in fields) { + if(info.FieldType == typeof(int) || info.FieldType == typeof(uint) || info.FieldType == typeof(double)) { + MinMaxAttribute minMaxAttribute = info.GetCustomAttribute(typeof(MinMaxAttribute)) as MinMaxAttribute; + if(minMaxAttribute != null) { + sb.AppendLine("/" + info.Name + " = [" + minMaxAttribute.Min.ToString() + ", " + minMaxAttribute.Max.ToString() + "]"); + } else { + ValidValuesAttribute validValuesAttribute = info.GetCustomAttribute(typeof(ValidValuesAttribute)) as ValidValuesAttribute; + if(validValuesAttribute != null) { + sb.AppendLine("/" + info.Name + " = " + string.Join(" | ", validValuesAttribute.ValidValues)); + } + } + } else if(info.FieldType == typeof(bool)) { + sb.AppendLine("/" + info.Name + " = true | false"); + } else if(info.FieldType.IsEnum) { + sb.AppendLine("/" + info.Name + " = " + string.Join(" | ", Enum.GetNames(info.FieldType))); + } + } + } + + private void btnClose_Click(object sender, EventArgs e) + { + this.Close(); + } + } +} diff --git a/GUI.NET/Forms/frmHelp.resx b/GUI.NET/Forms/frmHelp.resx new file mode 100644 index 00000000..ff90f1ab --- /dev/null +++ b/GUI.NET/Forms/frmHelp.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + This will start Mesen in fullscreen mode with the "MyGame.nes" rom loaded. It will also use the NTSC filter, set at a 2x scale and configure the Overscan settings. The "DoNotSaveSettings" flag is used to prevent the command line switches from pernanently altering Mesen's settings. + + \ No newline at end of file diff --git a/GUI.NET/Forms/frmMain.Designer.cs b/GUI.NET/Forms/frmMain.Designer.cs index fdc5e28c..de12e668 100644 --- a/GUI.NET/Forms/frmMain.Designer.cs +++ b/GUI.NET/Forms/frmMain.Designer.cs @@ -174,6 +174,7 @@ namespace Mesen.GUI.Forms this.toolStripMenuItem20 = new System.Windows.Forms.ToolStripSeparator(); this.mnuReportBug = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuHelpWindow = new System.Windows.Forms.ToolStripMenuItem(); this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem(); this.panelRenderer.SuspendLayout(); this.menuStrip.SuspendLayout(); @@ -267,50 +268,50 @@ namespace Mesen.GUI.Forms this.mnuOpen.Image = global::Mesen.GUI.Properties.Resources.FolderOpen; this.mnuOpen.Name = "mnuOpen"; this.mnuOpen.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.mnuOpen.Size = new System.Drawing.Size(152, 22); + this.mnuOpen.Size = new System.Drawing.Size(146, 22); this.mnuOpen.Text = "Open"; this.mnuOpen.Click += new System.EventHandler(this.mnuOpen_Click); // // toolStripMenuItem4 // this.toolStripMenuItem4.Name = "toolStripMenuItem4"; - this.toolStripMenuItem4.Size = new System.Drawing.Size(149, 6); + this.toolStripMenuItem4.Size = new System.Drawing.Size(143, 6); // // mnuSaveState // this.mnuSaveState.Name = "mnuSaveState"; - this.mnuSaveState.Size = new System.Drawing.Size(152, 22); + this.mnuSaveState.Size = new System.Drawing.Size(146, 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(152, 22); + this.mnuLoadState.Size = new System.Drawing.Size(146, 22); this.mnuLoadState.Text = "Load State"; this.mnuLoadState.DropDownOpening += new System.EventHandler(this.mnuLoadState_DropDownOpening); // // toolStripMenuItem7 // this.toolStripMenuItem7.Name = "toolStripMenuItem7"; - this.toolStripMenuItem7.Size = new System.Drawing.Size(149, 6); + this.toolStripMenuItem7.Size = new System.Drawing.Size(143, 6); // // mnuRecentFiles // this.mnuRecentFiles.Name = "mnuRecentFiles"; - this.mnuRecentFiles.Size = new System.Drawing.Size(152, 22); + this.mnuRecentFiles.Size = new System.Drawing.Size(146, 22); this.mnuRecentFiles.Text = "Recent Files"; // // toolStripMenuItem6 // this.toolStripMenuItem6.Name = "toolStripMenuItem6"; - this.toolStripMenuItem6.Size = new System.Drawing.Size(149, 6); + this.toolStripMenuItem6.Size = new System.Drawing.Size(143, 6); // // mnuExit // this.mnuExit.Image = global::Mesen.GUI.Properties.Resources.Exit; this.mnuExit.Name = "mnuExit"; - this.mnuExit.Size = new System.Drawing.Size(152, 22); + this.mnuExit.Size = new System.Drawing.Size(146, 22); this.mnuExit.Text = "Exit"; this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click); // @@ -457,7 +458,7 @@ namespace Mesen.GUI.Forms this.mnuShowFPS}); this.mnuEmulationSpeed.Image = global::Mesen.GUI.Properties.Resources.Speed; this.mnuEmulationSpeed.Name = "mnuEmulationSpeed"; - this.mnuEmulationSpeed.Size = new System.Drawing.Size(152, 22); + this.mnuEmulationSpeed.Size = new System.Drawing.Size(135, 22); this.mnuEmulationSpeed.Text = "Speed"; this.mnuEmulationSpeed.DropDownOpening += new System.EventHandler(this.mnuEmulationSpeed_DropDownOpening); // @@ -559,7 +560,7 @@ namespace Mesen.GUI.Forms this.mnuFullscreen}); this.mnuVideoScale.Image = global::Mesen.GUI.Properties.Resources.Fullscreen; this.mnuVideoScale.Name = "mnuVideoScale"; - this.mnuVideoScale.Size = new System.Drawing.Size(152, 22); + this.mnuVideoScale.Size = new System.Drawing.Size(135, 22); this.mnuVideoScale.Text = "Video Size"; // // mnuScale1x @@ -671,7 +672,7 @@ namespace Mesen.GUI.Forms this.toolStripMenuItem19, this.mnuBilinearInterpolation}); this.mnuVideoFilter.Name = "mnuVideoFilter"; - this.mnuVideoFilter.Size = new System.Drawing.Size(152, 22); + this.mnuVideoFilter.Size = new System.Drawing.Size(135, 22); this.mnuVideoFilter.Text = "Video Filter"; // // mnuNoneFilter @@ -880,7 +881,7 @@ namespace Mesen.GUI.Forms this.mnuRegionDendy}); this.mnuRegion.Image = global::Mesen.GUI.Properties.Resources.Globe; this.mnuRegion.Name = "mnuRegion"; - this.mnuRegion.Size = new System.Drawing.Size(152, 22); + this.mnuRegion.Size = new System.Drawing.Size(135, 22); this.mnuRegion.Text = "Region"; // // mnuRegionAuto @@ -914,13 +915,13 @@ namespace Mesen.GUI.Forms // toolStripMenuItem10 // this.toolStripMenuItem10.Name = "toolStripMenuItem10"; - this.toolStripMenuItem10.Size = new System.Drawing.Size(149, 6); + this.toolStripMenuItem10.Size = new System.Drawing.Size(132, 6); // // mnuAudioConfig // this.mnuAudioConfig.Image = global::Mesen.GUI.Properties.Resources.Audio; this.mnuAudioConfig.Name = "mnuAudioConfig"; - this.mnuAudioConfig.Size = new System.Drawing.Size(152, 22); + this.mnuAudioConfig.Size = new System.Drawing.Size(135, 22); this.mnuAudioConfig.Text = "Audio"; this.mnuAudioConfig.Click += new System.EventHandler(this.mnuAudioConfig_Click); // @@ -928,7 +929,7 @@ namespace Mesen.GUI.Forms // this.mnuInput.Image = global::Mesen.GUI.Properties.Resources.Controller; this.mnuInput.Name = "mnuInput"; - this.mnuInput.Size = new System.Drawing.Size(152, 22); + this.mnuInput.Size = new System.Drawing.Size(135, 22); this.mnuInput.Text = "Input"; this.mnuInput.Click += new System.EventHandler(this.mnuInput_Click); // @@ -936,7 +937,7 @@ namespace Mesen.GUI.Forms // this.mnuVideoConfig.Image = global::Mesen.GUI.Properties.Resources.Video; this.mnuVideoConfig.Name = "mnuVideoConfig"; - this.mnuVideoConfig.Size = new System.Drawing.Size(152, 22); + this.mnuVideoConfig.Size = new System.Drawing.Size(135, 22); this.mnuVideoConfig.Text = "Video"; this.mnuVideoConfig.Click += new System.EventHandler(this.mnuVideoConfig_Click); // @@ -944,20 +945,20 @@ namespace Mesen.GUI.Forms // this.mnuEmulationConfig.Image = global::Mesen.GUI.Properties.Resources.DipSwitches; this.mnuEmulationConfig.Name = "mnuEmulationConfig"; - this.mnuEmulationConfig.Size = new System.Drawing.Size(152, 22); + this.mnuEmulationConfig.Size = new System.Drawing.Size(135, 22); this.mnuEmulationConfig.Text = "Emulation"; this.mnuEmulationConfig.Click += new System.EventHandler(this.mnuEmulationConfig_Click); // // toolStripMenuItem11 // this.toolStripMenuItem11.Name = "toolStripMenuItem11"; - this.toolStripMenuItem11.Size = new System.Drawing.Size(149, 6); + this.toolStripMenuItem11.Size = new System.Drawing.Size(132, 6); // // mnuPreferences // this.mnuPreferences.Image = global::Mesen.GUI.Properties.Resources.Cog; this.mnuPreferences.Name = "mnuPreferences"; - this.mnuPreferences.Size = new System.Drawing.Size(152, 22); + this.mnuPreferences.Size = new System.Drawing.Size(135, 22); this.mnuPreferences.Text = "Preferences"; this.mnuPreferences.Click += new System.EventHandler(this.mnuPreferences_Click); // @@ -1097,7 +1098,7 @@ namespace Mesen.GUI.Forms // this.mnuPlayMovie.Image = global::Mesen.GUI.Properties.Resources.Play; this.mnuPlayMovie.Name = "mnuPlayMovie"; - this.mnuPlayMovie.Size = new System.Drawing.Size(152, 22); + this.mnuPlayMovie.Size = new System.Drawing.Size(149, 22); this.mnuPlayMovie.Text = "Play..."; this.mnuPlayMovie.Click += new System.EventHandler(this.mnuPlayMovie_Click); // @@ -1108,7 +1109,7 @@ namespace Mesen.GUI.Forms this.mnuRecordFromNow}); this.mnuRecordFrom.Image = global::Mesen.GUI.Properties.Resources.Record; this.mnuRecordFrom.Name = "mnuRecordFrom"; - this.mnuRecordFrom.Size = new System.Drawing.Size(152, 22); + this.mnuRecordFrom.Size = new System.Drawing.Size(149, 22); this.mnuRecordFrom.Text = "Record from..."; // // mnuRecordFromStart @@ -1129,7 +1130,7 @@ namespace Mesen.GUI.Forms // this.mnuStopMovie.Image = global::Mesen.GUI.Properties.Resources.Stop; this.mnuStopMovie.Name = "mnuStopMovie"; - this.mnuStopMovie.Size = new System.Drawing.Size(152, 22); + this.mnuStopMovie.Size = new System.Drawing.Size(149, 22); this.mnuStopMovie.Text = "Stop"; this.mnuStopMovie.Click += new System.EventHandler(this.mnuStopMovie_Click); // @@ -1331,6 +1332,7 @@ namespace Mesen.GUI.Forms this.toolStripMenuItem20, this.mnuReportBug, this.toolStripMenuItem5, + this.mnuHelpWindow, this.mnuAbout}); this.mnuHelp.Name = "mnuHelp"; this.mnuHelp.Size = new System.Drawing.Size(44, 20); @@ -1340,32 +1342,40 @@ namespace Mesen.GUI.Forms // this.mnuCheckForUpdates.Image = global::Mesen.GUI.Properties.Resources.SoftwareUpdate; this.mnuCheckForUpdates.Name = "mnuCheckForUpdates"; - this.mnuCheckForUpdates.Size = new System.Drawing.Size(170, 22); + this.mnuCheckForUpdates.Size = new System.Drawing.Size(198, 22); this.mnuCheckForUpdates.Text = "Check for updates"; this.mnuCheckForUpdates.Click += new System.EventHandler(this.mnuCheckForUpdates_Click); // // toolStripMenuItem20 // this.toolStripMenuItem20.Name = "toolStripMenuItem20"; - this.toolStripMenuItem20.Size = new System.Drawing.Size(167, 6); + this.toolStripMenuItem20.Size = new System.Drawing.Size(195, 6); // // mnuReportBug // this.mnuReportBug.Name = "mnuReportBug"; - this.mnuReportBug.Size = new System.Drawing.Size(170, 22); + this.mnuReportBug.Size = new System.Drawing.Size(198, 22); this.mnuReportBug.Text = "Report a bug"; this.mnuReportBug.Click += new System.EventHandler(this.mnuReportBug_Click); // // toolStripMenuItem5 // this.toolStripMenuItem5.Name = "toolStripMenuItem5"; - this.toolStripMenuItem5.Size = new System.Drawing.Size(167, 6); + this.toolStripMenuItem5.Size = new System.Drawing.Size(195, 6); + // + // mnuHelpWindow + // + this.mnuHelpWindow.Image = global::Mesen.GUI.Properties.Resources.CommandLine; + this.mnuHelpWindow.Name = "mnuHelpWindow"; + this.mnuHelpWindow.Size = new System.Drawing.Size(198, 22); + this.mnuHelpWindow.Text = "Command-line options"; + this.mnuHelpWindow.Click += new System.EventHandler(this.mnuHelpWindow_Click); // // mnuAbout // this.mnuAbout.Image = global::Mesen.GUI.Properties.Resources.Help; this.mnuAbout.Name = "mnuAbout"; - this.mnuAbout.Size = new System.Drawing.Size(170, 22); + this.mnuAbout.Size = new System.Drawing.Size(198, 22); this.mnuAbout.Text = "About"; this.mnuAbout.Click += new System.EventHandler(this.mnuAbout_Click); // @@ -1539,6 +1549,7 @@ namespace Mesen.GUI.Forms private System.Windows.Forms.ToolStripMenuItem mnuVideoRecorder; private System.Windows.Forms.ToolStripMenuItem mnuAviRecord; private System.Windows.Forms.ToolStripMenuItem mnuAviStop; + private System.Windows.Forms.ToolStripMenuItem mnuHelpWindow; } } diff --git a/GUI.NET/Forms/frmMain.cs b/GUI.NET/Forms/frmMain.cs index 89ab0890..2faed0bc 100644 --- a/GUI.NET/Forms/frmMain.cs +++ b/GUI.NET/Forms/frmMain.cs @@ -56,20 +56,28 @@ namespace Mesen.GUI.Forms public void ProcessCommandLineArguments(string[] args, bool forStartup) { - if(forStartup) { - var switches = new List(); - for(int i = 0; i < args.Length; i++) { - switches.Add(args[i].ToLowerInvariant().Replace("-", "/")); - } + var switches = new List(); + for(int i = 0; i < args.Length; i++) { + switches.Add(args[i].ToLowerInvariant().Replace("--", "/").Replace("-", "/").Replace("=/", "=-")); + } + if(forStartup) { _noVideo = switches.Contains("/novideo"); _noAudio = switches.Contains("/noaudio"); _noInput = switches.Contains("/noinput"); - if(switches.Contains("/fullscreen")) { - this.SetFullscreenState(true); - } } + if(switches.Contains("/fullscreen")) { + this.SetFullscreenState(true); + } + if(switches.Contains("/donotsavesettings")) { + ConfigManager.DoNotSaveSettings = true; + } + ConfigManager.ProcessSwitches(switches); + } + + public void LoadGameFromCommandLine(string[] args) + { if(args.Length > 0) { foreach(string arg in args) { string path = arg; @@ -102,6 +110,8 @@ namespace Mesen.GUI.Forms _notifListener.OnNotification += _notifListener_OnNotification; menuTimer.Start(); + + this.ProcessCommandLineArguments(_commandLineArgs, true); VideoInfo.ApplyConfig(); InitializeVsSystemMenu(); @@ -121,7 +131,7 @@ namespace Mesen.GUI.Forms Task.Run(() => CloudSyncHelper.Sync()); } - this.ProcessCommandLineArguments(_commandLineArgs, true); + this.LoadGameFromCommandLine(_commandLineArgs); if(ConfigManager.Config.PreferenceInfo.AutomaticallyCheckForUpdates) { CheckForUpdates(false); @@ -1641,5 +1651,12 @@ namespace Mesen.GUI.Forms LoadFile(randomGame); } } + + private void mnuHelpWindow_Click(object sender, EventArgs e) + { + using(frmHelp frm = new frmHelp()) { + frm.ShowDialog(sender, this); + } + } } } diff --git a/GUI.NET/GUI.NET.csproj b/GUI.NET/GUI.NET.csproj index 04e26a33..162d1667 100644 --- a/GUI.NET/GUI.NET.csproj +++ b/GUI.NET/GUI.NET.csproj @@ -146,6 +146,9 @@ false + + + False @@ -205,6 +208,7 @@ + @@ -602,6 +606,12 @@ frmDownloadProgress.cs + + Form + + + frmHelp.cs + Form @@ -829,6 +839,9 @@ frmDownloadProgress.cs + + frmHelp.cs + frmLogWindow.cs @@ -947,6 +960,7 @@ Always + diff --git a/GUI.NET/Program.cs b/GUI.NET/Program.cs index fc52f4e2..8af0d8e6 100644 --- a/GUI.NET/Program.cs +++ b/GUI.NET/Program.cs @@ -122,6 +122,7 @@ namespace Mesen.GUI singleInstance.ArgumentsReceived += (object sender, ArgumentsReceivedEventArgs e) => { frmMain.BeginInvoke((MethodInvoker)(() => { frmMain.ProcessCommandLineArguments(e.Args, false); + frmMain.LoadGameFromCommandLine(e.Args); })); }; } diff --git a/GUI.NET/Properties/Resources.Designer.cs b/GUI.NET/Properties/Resources.Designer.cs index 4420231a..9cce7fd9 100644 --- a/GUI.NET/Properties/Resources.Designer.cs +++ b/GUI.NET/Properties/Resources.Designer.cs @@ -190,6 +190,16 @@ namespace Mesen.GUI.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap CommandLine { + get { + object obj = ResourceManager.GetObject("CommandLine", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/GUI.NET/Properties/Resources.resx b/GUI.NET/Properties/Resources.resx index f3dddf33..3b66eefe 100644 --- a/GUI.NET/Properties/Resources.resx +++ b/GUI.NET/Properties/Resources.resx @@ -292,4 +292,7 @@ ..\Resources\Copy.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\CommandLine.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/GUI.NET/Resources/CommandLine.png b/GUI.NET/Resources/CommandLine.png new file mode 100644 index 00000000..4efd07a4 Binary files /dev/null and b/GUI.NET/Resources/CommandLine.png differ