Command line: Added command line options for most settings (and help window to document them)

This commit is contained in:
Souryo 2017-03-19 13:05:33 -04:00
parent 4d96c13334
commit b9a62d96b7
23 changed files with 824 additions and 97 deletions

View File

@ -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()
{

View File

@ -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;
}
}
}

View File

@ -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<string> 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();

View File

@ -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 {

View File

@ -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()
{

View File

@ -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);

View File

@ -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;

View File

@ -91,6 +91,7 @@
<Control ID="mnuHelp">Ayuda</Control>
<Control ID="mnuCheckForUpdates">Buscar actualizaciones</Control>
<Control ID="mnuReportBug">Enviar un error</Control>
<Control ID="mnuHelpWindow">Command-line options</Control>
<Control ID="mnuAbout">Acerca de...</Control>
<!-- Archive Load Message -->
@ -497,6 +498,15 @@
<Control ID="btnOK">OK</Control>
<Control ID="btnCancel">Cancelar</Control>
</Form>
<Form ID="frmHelp" Title="Command-line Options">
<Control ID="grpExample">Usage example</Control>
<Control ID="tpgGeneral">General</Control>
<Control ID="tpgVideoOptions">Video Options</Control>
<Control ID="tpgAudioOptions">Audio Options</Control>
<Control ID="tpgEmulationOptions">Emulation Options</Control>
<Control ID="lblExplanation">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.</Control>
<Control ID="txtGeneralOptions">/fullscreen - Start Mesen in fullscreen mode&#13;&#10;/DoNotSaveSettings - Prevent settings from being saved to the disk (useful to prevent command line options from becoming the default settings)</Control>
</Form>
</Forms>
<Messages>
<Message ID="FilterAll">Todos los tipos de archivo (*.*)|*.*</Message>

View File

@ -91,6 +91,7 @@
<Control ID="mnuHelp">Aide</Control>
<Control ID="mnuCheckForUpdates">Recherche de mises-à-jour</Control>
<Control ID="mnuReportBug">Signaler un problème</Control>
<Control ID="mnuHelpWindow">Options de ligne de commande</Control>
<Control ID="mnuAbout">À propos de...</Control>
<!-- Archive Load Message -->
@ -511,6 +512,15 @@
<Control ID="btnOK">OK</Control>
<Control ID="btnCancel">Annuler</Control>
</Form>
<Form ID="frmHelp" Title="Options de ligne de commande">
<Control ID="grpExample">Exemple d'utilisation</Control>
<Control ID="tpgGeneral">Général</Control>
<Control ID="tpgVideoOptions">Options vidéo</Control>
<Control ID="tpgAudioOptions">Options audio</Control>
<Control ID="tpgEmulationOptions">Options d'émulation</Control>
<Control ID="lblExplanation">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.</Control>
<Control ID="txtGeneralOptions">/fullscreen - Démarre Mesen en mode plein écran&#13;&#10;/DoNotSaveSettings - Empêche la sauvegarde des paramètres sur le disque (autrement les options données en ligne de commande seront permanentes)</Control>
</Form>
</Forms>
<Messages>
<Message ID="FilterAll">Tous les fichiers (*.*)|*.*</Message>

View File

@ -91,6 +91,7 @@
<Control ID="mnuHelp">ヘルプ</Control>
<Control ID="mnuCheckForUpdates">アップデートの確認</Control>
<Control ID="mnuReportBug">バグレポート</Control>
<Control ID="mnuHelpWindow">コマンドラインオプション</Control>
<Control ID="mnuAbout">Mesenとは</Control>
<!-- Archive Load Message -->
@ -493,6 +494,15 @@
<Control ID="btnOK">OK</Control>
<Control ID="btnCancel">キャンセル</Control>
</Form>
<Form ID="frmHelp" Title="コマンドラインオプション">
<Control ID="grpExample">使い方</Control>
<Control ID="tpgGeneral">全般</Control>
<Control ID="tpgVideoOptions">映像</Control>
<Control ID="tpgAudioOptions">音声</Control>
<Control ID="tpgEmulationOptions">エミュレーション</Control>
<Control ID="lblExplanation">Mesenを全画面表示の状態で"MyGame.nes"を起動する. 画面エフェクトをNTSCにして、映像サイズを2xにして、オーバースキャン設定を変更する。</Control>
<Control ID="txtGeneralOptions">/fullscreen - 全画面表示の状態で起動する&#13;&#10;/DoNotSaveSettings - 設定のセーブ機能を無効にする</Control>
</Form>
</Forms>
<Messages>
<Message ID="FilterAll">すべてのファイル (*.*)|*.*</Message>

View File

@ -91,6 +91,7 @@
<Control ID="mnuHelp">Ajuda</Control>
<Control ID="mnuCheckForUpdates">Procurar atualizações</Control>
<Control ID="mnuReportBug">Reportar um erro</Control>
<Control ID="mnuHelpWindow">Command-line options</Control>
<Control ID="mnuAbout">Sobre...</Control>
<!-- Archive Load Message -->
@ -497,6 +498,15 @@
<Control ID="btnOK">OK</Control>
<Control ID="btnCancel">Cancelar</Control>
</Form>
<Form ID="frmHelp" Title="Command-line Options">
<Control ID="grpExample">Usage example</Control>
<Control ID="tpgGeneral">General</Control>
<Control ID="tpgVideoOptions">Video Options</Control>
<Control ID="tpgAudioOptions">Audio Options</Control>
<Control ID="tpgEmulationOptions">Emulation Options</Control>
<Control ID="lblExplanation">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.</Control>
<Control ID="txtGeneralOptions">/fullscreen - Start Mesen in fullscreen mode&#13;&#10;/DoNotSaveSettings - Prevent settings from being saved to the disk (useful to prevent command line options from becoming the default settings)</Control>
</Form>
</Forms>
<Messages>
<Message ID="FilterAll">Todos os tipos de arquivo (*.*)|*.*</Message>

View File

@ -91,6 +91,7 @@
<Control ID="mnuHelp">Помощь</Control>
<Control ID="mnuCheckForUpdates">Проверить обновления</Control>
<Control ID="mnuReportBug">Сообщить об ошибке</Control>
<Control ID="mnuHelpWindow">Command-line options</Control>
<Control ID="mnuAbout">О программе</Control>
<!-- Archive Load Message -->
@ -501,6 +502,15 @@
<Control ID="btnOK">OK</Control>
<Control ID="btnCancel">Отмена</Control>
</Form>
<Form ID="frmHelp" Title="Command-line Options">
<Control ID="grpExample">Usage example</Control>
<Control ID="tpgGeneral">General</Control>
<Control ID="tpgVideoOptions">Video Options</Control>
<Control ID="tpgAudioOptions">Audio Options</Control>
<Control ID="tpgEmulationOptions">Emulation Options</Control>
<Control ID="lblExplanation">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.</Control>
<Control ID="txtGeneralOptions">/fullscreen - Start Mesen in fullscreen mode&#13;&#10;/DoNotSaveSettings - Prevent settings from being saved to the disk (useful to prevent command line options from becoming the default settings)</Control>
</Form>
</Forms>
<Messages>
<Message ID="FilterAll">Все файлы (*.*)|*.*</Message>

View File

@ -91,6 +91,7 @@
<Control ID="mnuHelp">Допомога</Control>
<Control ID="mnuCheckForUpdates">Перевірити оновлення</Control>
<Control ID="mnuReportBug">Повідомити про помилку</Control>
<Control ID="mnuHelpWindow">Command-line options</Control>
<Control ID="mnuAbout">Про програму</Control>
<!-- Archive Load Message -->
@ -500,6 +501,15 @@
<Control ID="btnOK">OK</Control>
<Control ID="btnCancel">Вiдмiна</Control>
</Form>
<Form ID="frmHelp" Title="Command-line Options">
<Control ID="grpExample">Usage example</Control>
<Control ID="tpgGeneral">General</Control>
<Control ID="tpgVideoOptions">Video Options</Control>
<Control ID="tpgAudioOptions">Audio Options</Control>
<Control ID="tpgEmulationOptions">Emulation Options</Control>
<Control ID="lblExplanation">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.</Control>
<Control ID="txtGeneralOptions">/fullscreen - Start Mesen in fullscreen mode&#13;&#10;/DoNotSaveSettings - Prevent settings from being saved to the disk (useful to prevent command line options from becoming the default settings)</Control>
</Form>
</Forms>
<Messages>
<Message ID="FilterAll">Всi файли (*.*)|*.*</Message>

286
GUI.NET/Forms/frmHelp.Designer.cs generated Normal file
View File

@ -0,0 +1,286 @@
namespace Mesen.GUI.Forms
{
partial class frmHelp
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

87
GUI.NET/Forms/frmHelp.cs Normal file
View File

@ -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();
}
}
}

126
GUI.NET/Forms/frmHelp.resx Normal file
View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="lblExplanation.Text" xml:space="preserve">
<value>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.</value>
</data>
</root>

View File

@ -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;
}
}

View File

@ -56,20 +56,28 @@ namespace Mesen.GUI.Forms
public void ProcessCommandLineArguments(string[] args, bool forStartup)
{
if(forStartup) {
var switches = new List<string>();
for(int i = 0; i < args.Length; i++) {
switches.Add(args[i].ToLowerInvariant().Replace("-", "/"));
}
var switches = new List<string>();
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);
}
}
}
}

View File

@ -146,6 +146,9 @@
<PropertyGroup>
<SignManifests>false</SignManifests>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.7.4137.9688, Culture=neutral, PublicKeyToken=a4292a325f69b123, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@ -205,6 +208,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Config\ConfigAttributes.cs" />
<Compile Include="Config\AviRecordInfo.cs" />
<Compile Include="Config\DebugInfo.cs" />
<Compile Include="Config\EmulationInfo.cs" />
@ -602,6 +606,12 @@
<Compile Include="Forms\frmDownloadProgress.Designer.cs">
<DependentUpon>frmDownloadProgress.cs</DependentUpon>
</Compile>
<Compile Include="Forms\frmHelp.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\frmHelp.Designer.cs">
<DependentUpon>frmHelp.cs</DependentUpon>
</Compile>
<Compile Include="Forms\frmLogWindow.cs">
<SubType>Form</SubType>
</Compile>
@ -829,6 +839,9 @@
<EmbeddedResource Include="Forms\frmDownloadProgress.resx">
<DependentUpon>frmDownloadProgress.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\frmHelp.resx">
<DependentUpon>frmHelp.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\frmLogWindow.resx">
<DependentUpon>frmLogWindow.cs</DependentUpon>
</EmbeddedResource>
@ -947,6 +960,7 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Icon.ico" />
<None Include="Resources\CommandLine.png" />
<None Include="Resources\Copy.png" />
<None Include="Resources\StepOut.png" />
<None Include="Resources\StepInto.png" />

View File

@ -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);
}));
};
}

View File

@ -190,6 +190,16 @@ namespace Mesen.GUI.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap CommandLine {
get {
object obj = ResourceManager.GetObject("CommandLine", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@ -292,4 +292,7 @@
<data name="Copy" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Copy.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="CommandLine" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\CommandLine.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B