Add a Extension Preferences dialog in the Config menu, currently it will show .bin and .rom and allow the user to pick a platform or pick "ask me on load" to be asked every time (the default)

This commit is contained in:
adelikat 2014-04-14 16:48:45 +00:00
parent a32ba998f2
commit 267441cc37
11 changed files with 698 additions and 58 deletions

View File

@ -28,13 +28,6 @@ namespace BizHawk.Client.Common
{
public class RomLoader
{
// These extensions will invoke a platform chooser if not found in the database
private readonly List<string> GenericExtensions = new List<string>
{
".bin",
".rom",
};
// helper methods for the settings events
private object GetCoreSettings<T>()
where T : IEmulator
@ -126,6 +119,16 @@ namespace BizHawk.Client.Common
}
}
private bool PreferredPlatformIsDefined(string extension)
{
if (Global.Config.PreferredPlatformsForExtensions.ContainsKey(extension))
{
return !string.IsNullOrEmpty(Global.Config.PreferredPlatformsForExtensions[extension]);
}
return false;
}
public bool LoadRom(string path, CoreComm nextComm)
{
if (path == null)
@ -276,12 +279,11 @@ namespace BizHawk.Client.Common
if (string.IsNullOrEmpty(rom.GameInfo.System))
{
// Has the user picked a preference for this extension?
if (!string.IsNullOrEmpty(Global.Config.PreferredPlatformsForExtensions[rom.Extension.ToLower()]))
if (PreferredPlatformIsDefined(rom.Extension.ToLower()))
{
rom.GameInfo.System = Global.Config.PreferredPlatformsForExtensions[rom.Extension.ToLower()];
}
else if (GenericExtensions.Contains(rom.Extension.ToLower()) &&
ChoosePlatform != null)
else if (ChoosePlatform != null)
{
rom.GameInfo.System = ChoosePlatform(rom);
}

View File

@ -197,6 +197,18 @@
<Compile Include="config\DisplayConfigLite.Designer.cs">
<DependentUpon>DisplayConfigLite.cs</DependentUpon>
</Compile>
<Compile Include="config\FileExtensionPreferences.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="config\FileExtensionPreferences.Designer.cs">
<DependentUpon>FileExtensionPreferences.cs</DependentUpon>
</Compile>
<Compile Include="config\FileExtensionPreferencesPicker.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="config\FileExtensionPreferencesPicker.Designer.cs">
<DependentUpon>FileExtensionPreferencesPicker.cs</DependentUpon>
</Compile>
<Compile Include="config\FirmwaresConfig.cs">
<SubType>Form</SubType>
</Compile>
@ -936,6 +948,12 @@
<EmbeddedResource Include="config\DisplayConfigLite.resx">
<DependentUpon>DisplayConfigLite.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="config\FileExtensionPreferences.resx">
<DependentUpon>FileExtensionPreferences.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="config\FileExtensionPreferencesPicker.resx">
<DependentUpon>FileExtensionPreferencesPicker.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="config\FirmwaresConfig.resx">
<DependentUpon>FirmwaresConfig.cs</DependentUpon>
</EmbeddedResource>

View File

@ -134,6 +134,7 @@
this.MessagesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AutofireMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.RewindOptionsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.extensionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
this.ConfigEnableSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.EnableContextMenuMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -388,7 +389,7 @@
this.MainformMenu.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
this.MainformMenu.Location = new System.Drawing.Point(0, 0);
this.MainformMenu.Name = "MainformMenu";
this.MainformMenu.Size = new System.Drawing.Size(470, 42);
this.MainformMenu.Size = new System.Drawing.Size(470, 61);
this.MainformMenu.TabIndex = 0;
this.MainformMenu.Text = "menuStrip1";
this.MainformMenu.MenuActivate += new System.EventHandler(this.MainformMenu_MenuActivate);
@ -1238,6 +1239,7 @@
this.MessagesMenuItem,
this.AutofireMenuItem,
this.RewindOptionsMenuItem,
this.extensionsToolStripMenuItem,
this.toolStripSeparator9,
this.ConfigEnableSubMenu,
this.GuiSubMenu,
@ -1258,7 +1260,7 @@
//
this.ControllersMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.GameController;
this.ControllersMenuItem.Name = "ControllersMenuItem";
this.ControllersMenuItem.Size = new System.Drawing.Size(152, 22);
this.ControllersMenuItem.Size = new System.Drawing.Size(159, 22);
this.ControllersMenuItem.Text = "&Controllers...";
this.ControllersMenuItem.Click += new System.EventHandler(this.ControllersMenuItem_Click);
//
@ -1266,7 +1268,7 @@
//
this.HotkeysMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.HotKeys;
this.HotkeysMenuItem.Name = "HotkeysMenuItem";
this.HotkeysMenuItem.Size = new System.Drawing.Size(152, 22);
this.HotkeysMenuItem.Size = new System.Drawing.Size(159, 22);
this.HotkeysMenuItem.Text = "&Hotkeys...";
this.HotkeysMenuItem.Click += new System.EventHandler(this.HotkeysMenuItem_Click);
//
@ -1274,7 +1276,7 @@
//
this.DisplayConfigMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("DisplayConfigMenuItem.Image")));
this.DisplayConfigMenuItem.Name = "DisplayConfigMenuItem";
this.DisplayConfigMenuItem.Size = new System.Drawing.Size(152, 22);
this.DisplayConfigMenuItem.Size = new System.Drawing.Size(159, 22);
this.DisplayConfigMenuItem.Text = "Display...";
this.DisplayConfigMenuItem.Click += new System.EventHandler(this.DisplayConfigMenuItem_Click);
//
@ -1282,7 +1284,7 @@
//
this.SoundMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.AudioHS;
this.SoundMenuItem.Name = "SoundMenuItem";
this.SoundMenuItem.Size = new System.Drawing.Size(152, 22);
this.SoundMenuItem.Size = new System.Drawing.Size(159, 22);
this.SoundMenuItem.Text = "&Sound...";
this.SoundMenuItem.Click += new System.EventHandler(this.SoundMenuItem_Click);
//
@ -1290,7 +1292,7 @@
//
this.PathsMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.CopyFolderHS;
this.PathsMenuItem.Name = "PathsMenuItem";
this.PathsMenuItem.Size = new System.Drawing.Size(152, 22);
this.PathsMenuItem.Size = new System.Drawing.Size(159, 22);
this.PathsMenuItem.Text = "Paths...";
this.PathsMenuItem.Click += new System.EventHandler(this.PathsMenuItem_Click);
//
@ -1298,7 +1300,7 @@
//
this.FirmwaresMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("FirmwaresMenuItem.Image")));
this.FirmwaresMenuItem.Name = "FirmwaresMenuItem";
this.FirmwaresMenuItem.Size = new System.Drawing.Size(152, 22);
this.FirmwaresMenuItem.Size = new System.Drawing.Size(159, 22);
this.FirmwaresMenuItem.Text = "&Firmwares";
this.FirmwaresMenuItem.Click += new System.EventHandler(this.FirmwaresMenuItem_Click);
//
@ -1306,7 +1308,7 @@
//
this.MessagesMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.MessageConfig;
this.MessagesMenuItem.Name = "MessagesMenuItem";
this.MessagesMenuItem.Size = new System.Drawing.Size(152, 22);
this.MessagesMenuItem.Size = new System.Drawing.Size(159, 22);
this.MessagesMenuItem.Text = "&Messages...";
this.MessagesMenuItem.Click += new System.EventHandler(this.MessagesMenuItem_Click);
//
@ -1314,7 +1316,7 @@
//
this.AutofireMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Lightning;
this.AutofireMenuItem.Name = "AutofireMenuItem";
this.AutofireMenuItem.Size = new System.Drawing.Size(152, 22);
this.AutofireMenuItem.Size = new System.Drawing.Size(159, 22);
this.AutofireMenuItem.Text = "&Autofire...";
this.AutofireMenuItem.Click += new System.EventHandler(this.AutofireMenuItem_Click);
//
@ -1322,14 +1324,21 @@
//
this.RewindOptionsMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Previous;
this.RewindOptionsMenuItem.Name = "RewindOptionsMenuItem";
this.RewindOptionsMenuItem.Size = new System.Drawing.Size(152, 22);
this.RewindOptionsMenuItem.Size = new System.Drawing.Size(159, 22);
this.RewindOptionsMenuItem.Text = "&Rewind...";
this.RewindOptionsMenuItem.Click += new System.EventHandler(this.RewindOptionsMenuItem_Click);
//
// extensionsToolStripMenuItem
//
this.extensionsToolStripMenuItem.Name = "extensionsToolStripMenuItem";
this.extensionsToolStripMenuItem.Size = new System.Drawing.Size(159, 22);
this.extensionsToolStripMenuItem.Text = "File Extensions...";
this.extensionsToolStripMenuItem.Click += new System.EventHandler(this.extensionsToolStripMenuItem_Click);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(149, 6);
this.toolStripSeparator9.Size = new System.Drawing.Size(156, 6);
//
// ConfigEnableSubMenu
//
@ -1341,7 +1350,7 @@
this.FrameAdvanceSkipLagMenuItem,
this.BackupSaveramMenuItem});
this.ConfigEnableSubMenu.Name = "ConfigEnableSubMenu";
this.ConfigEnableSubMenu.Size = new System.Drawing.Size(152, 22);
this.ConfigEnableSubMenu.Size = new System.Drawing.Size(159, 22);
this.ConfigEnableSubMenu.Text = "&Enable";
this.ConfigEnableSubMenu.DropDownOpened += new System.EventHandler(this.EnableMenuItem_DropDownOpened);
//
@ -1403,7 +1412,7 @@
this.toolStripSeparator23,
this.LogWindowAsConsoleMenuItem});
this.GuiSubMenu.Name = "GuiSubMenu";
this.GuiSubMenu.Size = new System.Drawing.Size(152, 22);
this.GuiSubMenu.Size = new System.Drawing.Size(159, 22);
this.GuiSubMenu.Text = "GUI";
this.GuiSubMenu.DropDownOpened += new System.EventHandler(this.GuiSubMenu_DropDownOpened);
//
@ -1514,7 +1523,7 @@
this.Speed150MenuItem,
this.Speed200MenuItem});
this.SpeedSkipSubMenu.Name = "SpeedSkipSubMenu";
this.SpeedSkipSubMenu.Size = new System.Drawing.Size(152, 22);
this.SpeedSkipSubMenu.Size = new System.Drawing.Size(159, 22);
this.SpeedSkipSubMenu.Text = "Speed/Skip";
this.SpeedSkipSubMenu.DropDownOpened += new System.EventHandler(this.FrameSkipMenuItem_DropDownOpened);
//
@ -1680,7 +1689,7 @@
this.InputOverHkMenuItem,
this.HkOverInputMenuItem});
this.KeyPrioritySubMenu.Name = "KeyPrioritySubMenu";
this.KeyPrioritySubMenu.Size = new System.Drawing.Size(152, 22);
this.KeyPrioritySubMenu.Size = new System.Drawing.Size(159, 22);
this.KeyPrioritySubMenu.Text = "Key Priority";
this.KeyPrioritySubMenu.DropDownOpened += new System.EventHandler(this.KeyPriorityMenuItem_DropDownOpened);
//
@ -1712,7 +1721,7 @@
this.SavestateBinaryMenuItem,
this.SavestateTextMenuItem});
this.SavestateTypeSubMenu.Name = "SavestateTypeSubMenu";
this.SavestateTypeSubMenu.Size = new System.Drawing.Size(152, 22);
this.SavestateTypeSubMenu.Size = new System.Drawing.Size(159, 22);
this.SavestateTypeSubMenu.Text = "Savestate Type";
this.SavestateTypeSubMenu.DropDownOpened += new System.EventHandler(this.SavestateTypeMenuItem_DropDownOpened);
//
@ -1740,13 +1749,13 @@
// toolStripSeparator10
//
this.toolStripSeparator10.Name = "toolStripSeparator10";
this.toolStripSeparator10.Size = new System.Drawing.Size(149, 6);
this.toolStripSeparator10.Size = new System.Drawing.Size(156, 6);
//
// SaveConfigMenuItem
//
this.SaveConfigMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Save;
this.SaveConfigMenuItem.Name = "SaveConfigMenuItem";
this.SaveConfigMenuItem.Size = new System.Drawing.Size(152, 22);
this.SaveConfigMenuItem.Size = new System.Drawing.Size(159, 22);
this.SaveConfigMenuItem.Text = "Save Config";
this.SaveConfigMenuItem.Click += new System.EventHandler(this.SaveConfigMenuItem_Click);
//
@ -1754,14 +1763,14 @@
//
this.LoadConfigMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.LoadConfig;
this.LoadConfigMenuItem.Name = "LoadConfigMenuItem";
this.LoadConfigMenuItem.Size = new System.Drawing.Size(152, 22);
this.LoadConfigMenuItem.Size = new System.Drawing.Size(159, 22);
this.LoadConfigMenuItem.Text = "Load Config";
this.LoadConfigMenuItem.Click += new System.EventHandler(this.LoadConfigMenuItem_Click);
//
// toolStripSeparator8
//
this.toolStripSeparator8.Name = "toolStripSeparator8";
this.toolStripSeparator8.Size = new System.Drawing.Size(149, 6);
this.toolStripSeparator8.Size = new System.Drawing.Size(156, 6);
//
// coreSelectionToolStripMenuItem
//
@ -1769,7 +1778,7 @@
this.gBInSGBToolStripMenuItem,
this.nESInQuickNESToolStripMenuItem});
this.coreSelectionToolStripMenuItem.Name = "coreSelectionToolStripMenuItem";
this.coreSelectionToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.coreSelectionToolStripMenuItem.Size = new System.Drawing.Size(159, 22);
this.coreSelectionToolStripMenuItem.Text = "Core Selection";
this.coreSelectionToolStripMenuItem.DropDownOpened += new System.EventHandler(this.coreSelectionToolStripMenuItem_DropDownOpened);
this.coreSelectionToolStripMenuItem.Click += new System.EventHandler(this.coreSelectionToolStripMenuItem_Click);
@ -3485,6 +3494,7 @@
private System.Windows.Forms.ToolStripMenuItem SMSdisplayPalToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem SMSdisplayAutoToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator26;
private System.Windows.Forms.ToolStripMenuItem extensionsToolStripMenuItem;
}
}

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
@ -492,6 +493,45 @@ namespace BizHawk.Client.EmuHawk
public bool UpdateFrame = false;
public bool EmulatorPaused { get; private set; }
// Because we don't have enough places where we list SystemID's
public Dictionary<string, string> SupportedPlatforms
{
get
{
var released = new Dictionary<string, string>
{
{ "A26", "Atari 2600" },
{ "A78", "Atari 7800" },
{ "NES", "Nintendo Entertainment System/Famicom" },
{ "SNES", "Super Nintendo" },
{ "N64", "Nintendo 64" },
{ "GB", "Game Boy" },
{ "GBC", "Game Boy Color" },
{ "SMS", "Sega Master System" },
{ "GG", "Sega Game Gear" },
{ "SG", "SG-1000" },
{ "GEN", "Sega Genesis/Megadrive" },
{ "SAT", "Sega Saturn" },
{ "PCE", "PC Engine/TurboGrafx 16" },
{ "Coleco", "Colecovision" },
{ "TI83", "TI-83 Calculator" }
};
if (VersionInfo.INTERIM)
{
released.Add("GBA", "Gameboy Advance");
released.Add("C64", "Commodore 64");
}
return released;
}
}
#endregion
#region Public Methods
@ -3118,5 +3158,10 @@ namespace BizHawk.Client.EmuHawk
{
GlobalWin.Tools.Load<GenVDPViewer>();
}
private void extensionsToolStripMenuItem_Click(object sender, EventArgs e)
{
new FileExtensionPreferences().ShowDialog();
}
}
}

View File

@ -13,31 +13,6 @@ namespace BizHawk.Client.EmuHawk
{
public partial class PlatformChooser : Form
{
// Because we don't have enough places where we list SystemID's
private readonly Dictionary<string, string> Platforms = new Dictionary<string,string>
{
{ "A26", "Atari 2600" },
{ "A78", "Atari 7800" },
{ "NES", "Nintendo Entertainment System" },
{ "SNES", "Super Nintendo" },
{ "N64", "Nintendo 64" },
{ "GB", "Game Boy" },
{ "GBC", "Game Boy Color" },
{ "PCE", "PC Engine/TurboGrafx 16" },
{ "SGX", "Super Grafx" },
{ "SMS", "Sega Master System" },
{ "GG", "Sega Game Gear" },
{ "SG", "SG-1000" },
{ "GEN", "Sega Genesis" },
{ "Coleco", "Colecovision" },
};
public RomGame RomGame { get; set; }
public string PlatformChoice { get; set; }
@ -69,7 +44,7 @@ namespace BizHawk.Client.EmuHawk
int count = 0;
int spacing = 25;
foreach (var platform in Platforms)
foreach (var platform in GlobalWin.MainForm.SupportedPlatforms)
{
var radio = new RadioButton
{
@ -96,7 +71,7 @@ namespace BizHawk.Client.EmuHawk
private void OkBtn_Click(object sender, EventArgs e)
{
var selectedValue = SelectedRadio != null ? SelectedRadio.Text : string.Empty;
PlatformChoice = Platforms.FirstOrDefault(x => x.Value == selectedValue).Key;
PlatformChoice = GlobalWin.MainForm.SupportedPlatforms.FirstOrDefault(x => x.Value == selectedValue).Key;
if (AlwaysCheckbox.Checked)
{

View File

@ -0,0 +1,131 @@
namespace BizHawk.Client.EmuHawk
{
partial class FileExtensionPreferences
{
/// <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()
{
this.OkBtn = new System.Windows.Forms.Button();
this.CancelBtn = new System.Windows.Forms.Button();
this.PrefPanel = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// OkBtn
//
this.OkBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.OkBtn.Location = new System.Drawing.Point(232, 187);
this.OkBtn.Name = "OkBtn";
this.OkBtn.Size = new System.Drawing.Size(60, 23);
this.OkBtn.TabIndex = 0;
this.OkBtn.Text = "&Ok";
this.OkBtn.UseVisualStyleBackColor = true;
this.OkBtn.Click += new System.EventHandler(this.OkBtn_Click);
//
// CancelBtn
//
this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.CancelBtn.Location = new System.Drawing.Point(298, 187);
this.CancelBtn.Name = "CancelBtn";
this.CancelBtn.Size = new System.Drawing.Size(60, 23);
this.CancelBtn.TabIndex = 1;
this.CancelBtn.Text = "&Cancel";
this.CancelBtn.UseVisualStyleBackColor = true;
this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
//
// PrefPanel
//
this.PrefPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PrefPanel.Location = new System.Drawing.Point(12, 55);
this.PrefPanel.Name = "PrefPanel";
this.PrefPanel.Size = new System.Drawing.Size(346, 126);
this.PrefPanel.TabIndex = 2;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(296, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Select a preferred Platform to run for the given file extensions.";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(352, 13);
this.label2.TabIndex = 4;
this.label2.Text = "Note: The game database overrides these options. They only take effect";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 39);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(245, 13);
this.label3.TabIndex = 5;
this.label3.Text = "when a Rom is unable to be found in the database";
//
// FileExtensionPreferences
//
this.AcceptButton = this.OkBtn;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.CancelBtn;
this.ClientSize = new System.Drawing.Size(370, 222);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.PrefPanel);
this.Controls.Add(this.CancelBtn);
this.Controls.Add(this.OkBtn);
this.Name = "FileExtensionPreferences";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "File Extension Preferences";
this.Load += new System.EventHandler(this.FileExtensionPreferences_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button OkBtn;
private System.Windows.Forms.Button CancelBtn;
private System.Windows.Forms.Panel PrefPanel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
}
}

View File

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class FileExtensionPreferences : Form
{
public FileExtensionPreferences()
{
InitializeComponent();
}
private void FileExtensionPreferences_Load(object sender, EventArgs e)
{
int spacing = 30;
int count = 0;
foreach (var kvp in Global.Config.PreferredPlatformsForExtensions)
{
FileExtensionPreferencesPicker picker = new FileExtensionPreferencesPicker
{
FileExtension = kvp.Key,
OriginalPreference = kvp.Value,
Location = new Point(15, 15 + (spacing * count))
};
count++;
PrefPanel.Controls.Add(picker);
}
}
private void OkBtn_Click(object sender, EventArgs e)
{
foreach (var picker in PrefPanel.Controls.OfType<FileExtensionPreferencesPicker>())
{
Global.Config.PreferredPlatformsForExtensions[picker.FileExtension] = picker.CurrentlySelectedSystemId;
}
GlobalWin.OSD.AddMessage("Rom Extension Preferences changed");
Close();
}
private void CancelBtn_Click(object sender, EventArgs e)
{
GlobalWin.OSD.AddMessage("Rom Extension Preferences cancelled");
Close();
}
}
}

View File

@ -0,0 +1,120 @@
<?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>
</root>

View File

@ -0,0 +1,72 @@
namespace BizHawk.Client.EmuHawk
{
partial class FileExtensionPreferencesPicker
{
/// <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 Component 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()
{
this.FileExtensionLabel = new System.Windows.Forms.Label();
this.PlatformDropdown = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// FileExtensionLabel
//
this.FileExtensionLabel.AutoSize = true;
this.FileExtensionLabel.Location = new System.Drawing.Point(3, 5);
this.FileExtensionLabel.Name = "FileExtensionLabel";
this.FileExtensionLabel.Size = new System.Drawing.Size(24, 13);
this.FileExtensionLabel.TabIndex = 0;
this.FileExtensionLabel.Text = ".bin";
//
// PlatformDropdown
//
this.PlatformDropdown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.PlatformDropdown.FormattingEnabled = true;
this.PlatformDropdown.Location = new System.Drawing.Point(37, 2);
this.PlatformDropdown.Name = "PlatformDropdown";
this.PlatformDropdown.Size = new System.Drawing.Size(142, 21);
this.PlatformDropdown.TabIndex = 1;
//
// FileExtensionPreferencesPicker
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.PlatformDropdown);
this.Controls.Add(this.FileExtensionLabel);
this.Name = "FileExtensionPreferencesPicker";
this.Size = new System.Drawing.Size(182, 29);
this.Load += new System.EventHandler(this.FileExtensionPreferencesPicker_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label FileExtensionLabel;
private System.Windows.Forms.ComboBox PlatformDropdown;
}
}

View File

@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class FileExtensionPreferencesPicker : UserControl
{
public FileExtensionPreferencesPicker()
{
InitializeComponent();
}
public string FileExtension { get; set; }
public string OriginalPreference { get; set; }
public string CurrentlySelectedSystemId
{
get
{
if (PlatformDropdown.SelectedIndex > 0)
{
return GlobalWin.MainForm.SupportedPlatforms
.FirstOrDefault(x => x.Value == PlatformDropdown.SelectedItem.ToString()).Key;
}
return string.Empty;
}
}
private void PopulatePlatforms()
{
PlatformDropdown.Items.Add("Ask me on load");
foreach (var platform in GlobalWin.MainForm.SupportedPlatforms)
{
PlatformDropdown.Items.Add(platform.Value);
}
}
private IEnumerable<string> DropdownSystemIds
{
get
{
var dispVals = PlatformDropdown.Items.OfType<string>();
foreach (var val in dispVals)
{
yield return GlobalWin.MainForm.SupportedPlatforms.FirstOrDefault(x => x.Value == val).Key ?? string.Empty;
}
}
}
private void FileExtensionPreferencesPicker_Load(object sender, EventArgs e)
{
PopulatePlatforms();
var selectedSystemId = Global.Config.PreferredPlatformsForExtensions[FileExtension];
if (!string.IsNullOrEmpty(selectedSystemId))
{
var selectedDispString = GlobalWin.MainForm.SupportedPlatforms[selectedSystemId];
var selectedItem = PlatformDropdown.Items
.OfType<string>()
.FirstOrDefault(item => item == selectedDispString);
if (selectedItem != null)
{
PlatformDropdown.SelectedItem = selectedItem;
}
else
{
PlatformDropdown.SelectedIndex = 0;
}
}
else
{
PlatformDropdown.SelectedIndex = 0;
}
FileExtensionLabel.Text = FileExtension;
}
}
}

View File

@ -0,0 +1,120 @@
<?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>
</root>