mirror of
https://github.com/libretro/Mesen.git
synced 2025-01-31 13:52:19 +00:00
Archives: Improved recent files list (now lists the file selected in the archive and relods it automatically) + Added progress bar when extraction files, since large archives can take a while to extract
This commit is contained in:
parent
da261861f1
commit
100c08c2e3
@ -18,7 +18,7 @@ namespace Mesen.GUI.Config
|
||||
public VideoInfo VideoInfo;
|
||||
public InputInfo InputInfo;
|
||||
public EmulationInfo EmulationInfo;
|
||||
public List<string> RecentFiles;
|
||||
public List<RecentItem> RecentFiles;
|
||||
public List<VsConfigInfo> VsConfig;
|
||||
public List<CheatInfo> Cheats;
|
||||
public bool ShowOnlyCheatsForCurrentGame;
|
||||
@ -37,7 +37,7 @@ namespace Mesen.GUI.Config
|
||||
VideoInfo = new VideoInfo();
|
||||
PreferenceInfo = new PreferenceInfo();
|
||||
EmulationInfo = new EmulationInfo();
|
||||
RecentFiles = new List<string>();
|
||||
RecentFiles = new List<RecentItem>();
|
||||
InputInfo = new InputInfo();
|
||||
Cheats = new List<CheatInfo>();
|
||||
VsConfig = new List<VsConfigInfo>();
|
||||
@ -60,12 +60,15 @@ namespace Mesen.GUI.Config
|
||||
InputInfo.InitializeDefaults();
|
||||
}
|
||||
|
||||
public void AddRecentFile(string filepath)
|
||||
public void AddRecentFile(string filepath, string romName, int archiveFileIndex)
|
||||
{
|
||||
if(RecentFiles.Contains(filepath)) {
|
||||
RecentFiles.Remove(filepath);
|
||||
RecentItem existingItem = RecentFiles.Where((item) => item.Path == filepath && item.ArchiveFileIndex == archiveFileIndex).FirstOrDefault();
|
||||
if(existingItem != null) {
|
||||
RecentFiles.Remove(existingItem);
|
||||
}
|
||||
RecentFiles.Insert(0, filepath);
|
||||
RecentItem recentItem = new RecentItem { RomName = romName, Path = filepath, ArchiveFileIndex = archiveFileIndex };
|
||||
|
||||
RecentFiles.Insert(0, recentItem);
|
||||
if(RecentFiles.Count > Configuration.MaxRecentFiles) {
|
||||
RecentFiles.RemoveAt(Configuration.MaxRecentFiles);
|
||||
}
|
||||
@ -108,4 +111,10 @@ namespace Mesen.GUI.Config
|
||||
}
|
||||
}
|
||||
|
||||
public class RecentItem
|
||||
{
|
||||
public string Path;
|
||||
public string RomName;
|
||||
public int ArchiveFileIndex;
|
||||
}
|
||||
}
|
||||
|
96
GUI.NET/Controls/ctrlLoadingRom.Designer.cs
generated
Normal file
96
GUI.NET/Controls/ctrlLoadingRom.Designer.cs
generated
Normal file
@ -0,0 +1,96 @@
|
||||
namespace Mesen.GUI.Controls
|
||||
{
|
||||
partial class ctrlLoadingRom
|
||||
{
|
||||
/// <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.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.pbLoading = new System.Windows.Forms.ProgressBar();
|
||||
this.lblExtractingFile = new System.Windows.Forms.Label();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 3;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 200F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.pbLoading, 1, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.lblExtractingFile, 0, 2);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 4;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(261, 107);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// pbLoading
|
||||
//
|
||||
this.pbLoading.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pbLoading.Location = new System.Drawing.Point(33, 35);
|
||||
this.pbLoading.Name = "pbLoading";
|
||||
this.pbLoading.Size = new System.Drawing.Size(194, 23);
|
||||
this.pbLoading.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
|
||||
this.pbLoading.TabIndex = 0;
|
||||
//
|
||||
// lblExtractingFile
|
||||
//
|
||||
this.lblExtractingFile.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.lblExtractingFile.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.lblExtractingFile, 3);
|
||||
this.lblExtractingFile.ForeColor = System.Drawing.Color.White;
|
||||
this.lblExtractingFile.Location = new System.Drawing.Point(61, 61);
|
||||
this.lblExtractingFile.Name = "lblExtractingFile";
|
||||
this.lblExtractingFile.Size = new System.Drawing.Size(138, 13);
|
||||
this.lblExtractingFile.TabIndex = 1;
|
||||
this.lblExtractingFile.Text = "Extracting file, please wait...";
|
||||
//
|
||||
// ctrlLoadingRom
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Black;
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Name = "ctrlLoadingRom";
|
||||
this.Size = new System.Drawing.Size(261, 107);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.ProgressBar pbLoading;
|
||||
private System.Windows.Forms.Label lblExtractingFile;
|
||||
}
|
||||
}
|
20
GUI.NET/Controls/ctrlLoadingRom.cs
Normal file
20
GUI.NET/Controls/ctrlLoadingRom.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Mesen.GUI.Controls
|
||||
{
|
||||
public partial class ctrlLoadingRom : UserControl
|
||||
{
|
||||
public ctrlLoadingRom()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
120
GUI.NET/Controls/ctrlLoadingRom.resx
Normal file
120
GUI.NET/Controls/ctrlLoadingRom.resx
Normal 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>
|
@ -88,6 +88,9 @@
|
||||
<Control ID="mnuCheckForUpdates">Recherche de mises-à-jour</Control>
|
||||
<Control ID="mnuAbout">À propos de...</Control>
|
||||
|
||||
<!-- Archive Load Message -->
|
||||
<Control ID="lblExtractingFile">Extraction en cours, veuillez patienter...</Control>
|
||||
|
||||
<!-- NSF Player -->
|
||||
<Control ID="lblTitle">Titre</Control>
|
||||
<Control ID="lblArtist">Artiste</Control>
|
||||
|
@ -88,6 +88,9 @@
|
||||
<Control ID="mnuCheckForUpdates">アップデートの確認</Control>
|
||||
<Control ID="mnuAbout">Mesenとは</Control>
|
||||
|
||||
<!-- Archive Load Message -->
|
||||
<Control ID="lblExtractingFile">ファイルを抽出中です。しばらく待ってください。</Control>
|
||||
|
||||
<!-- NSF Player -->
|
||||
<Control ID="lblTitle">タイトル</Control>
|
||||
<Control ID="lblArtist">作者</Control>
|
||||
|
@ -73,8 +73,8 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
|
||||
private void LoadGame(string romPath)
|
||||
{
|
||||
int archiveFileIndex;
|
||||
if(frmSelectRom.SelectRom(romPath, out archiveFileIndex)) {
|
||||
int archiveFileIndex = -1;
|
||||
if(frmSelectRom.SelectRom(romPath, ref archiveFileIndex)) {
|
||||
RomInfo romInfo = InteropEmu.GetRomInfo(romPath, archiveFileIndex);
|
||||
_gameCrc = romInfo.GetCrcString();
|
||||
if(_gameCrc != null) {
|
||||
|
77
GUI.NET/Forms/frmMain.Designer.cs
generated
77
GUI.NET/Forms/frmMain.Designer.cs
generated
@ -33,8 +33,8 @@ namespace Mesen.GUI.Forms
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.menuTimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.panelRenderer = new System.Windows.Forms.Panel();
|
||||
this.ctrlRenderer = new Mesen.GUI.Controls.ctrlRenderer();
|
||||
this.ctrlNsfPlayer = new Mesen.GUI.Controls.ctrlNsfPlayer();
|
||||
this.ctrlRenderer = new Mesen.GUI.Controls.ctrlRenderer();
|
||||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.mnuFile = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuOpen = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@ -158,6 +158,7 @@ namespace Mesen.GUI.Forms
|
||||
this.mnuCheckForUpdates = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ctrlLoading = new Mesen.GUI.Controls.ctrlLoadingRom();
|
||||
this.panelRenderer.SuspendLayout();
|
||||
this.menuStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@ -169,17 +170,28 @@ namespace Mesen.GUI.Forms
|
||||
// panelRenderer
|
||||
//
|
||||
this.panelRenderer.BackColor = System.Drawing.Color.Black;
|
||||
this.panelRenderer.Controls.Add(this.ctrlLoading);
|
||||
this.panelRenderer.Controls.Add(this.ctrlNsfPlayer);
|
||||
this.panelRenderer.Controls.Add(this.ctrlRenderer);
|
||||
this.panelRenderer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panelRenderer.Location = new System.Drawing.Point(0, 24);
|
||||
this.panelRenderer.Name = "panelRenderer";
|
||||
this.panelRenderer.Size = new System.Drawing.Size(304, 218);
|
||||
this.panelRenderer.Size = new System.Drawing.Size(360, 239);
|
||||
this.panelRenderer.TabIndex = 2;
|
||||
this.panelRenderer.Click += new System.EventHandler(this.panelRenderer_Click);
|
||||
this.panelRenderer.DoubleClick += new System.EventHandler(this.ctrlRenderer_DoubleClick);
|
||||
this.panelRenderer.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ctrlRenderer_MouseMove);
|
||||
//
|
||||
// ctrlNsfPlayer
|
||||
//
|
||||
this.ctrlNsfPlayer.BackColor = System.Drawing.Color.Black;
|
||||
this.ctrlNsfPlayer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlNsfPlayer.Location = new System.Drawing.Point(0, 0);
|
||||
this.ctrlNsfPlayer.Name = "ctrlNsfPlayer";
|
||||
this.ctrlNsfPlayer.Size = new System.Drawing.Size(360, 239);
|
||||
this.ctrlNsfPlayer.TabIndex = 2;
|
||||
this.ctrlNsfPlayer.Visible = false;
|
||||
//
|
||||
// ctrlRenderer
|
||||
//
|
||||
this.ctrlRenderer.BackColor = System.Drawing.Color.Black;
|
||||
@ -193,15 +205,6 @@ namespace Mesen.GUI.Forms
|
||||
this.ctrlRenderer.MouseClick += new System.Windows.Forms.MouseEventHandler(this.ctrlRenderer_MouseClick);
|
||||
this.ctrlRenderer.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ctrlRenderer_MouseMove);
|
||||
//
|
||||
// ctrlNsfPlayer
|
||||
//
|
||||
this.ctrlNsfPlayer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlNsfPlayer.Location = new System.Drawing.Point(0, 0);
|
||||
this.ctrlNsfPlayer.Name = "ctrlNsfPlayer";
|
||||
this.ctrlNsfPlayer.Size = new System.Drawing.Size(304, 218);
|
||||
this.ctrlNsfPlayer.TabIndex = 2;
|
||||
this.ctrlNsfPlayer.Visible = false;
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
@ -212,7 +215,7 @@ namespace Mesen.GUI.Forms
|
||||
this.mnuHelp});
|
||||
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip.Name = "menuStrip";
|
||||
this.menuStrip.Size = new System.Drawing.Size(304, 24);
|
||||
this.menuStrip.Size = new System.Drawing.Size(360, 24);
|
||||
this.menuStrip.TabIndex = 0;
|
||||
this.menuStrip.Text = "menuStrip1";
|
||||
this.menuStrip.VisibleChanged += new System.EventHandler(this.menuStrip_VisibleChanged);
|
||||
@ -238,50 +241,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(146, 22);
|
||||
this.mnuOpen.Size = new System.Drawing.Size(152, 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(143, 6);
|
||||
this.toolStripMenuItem4.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// mnuSaveState
|
||||
//
|
||||
this.mnuSaveState.Name = "mnuSaveState";
|
||||
this.mnuSaveState.Size = new System.Drawing.Size(146, 22);
|
||||
this.mnuSaveState.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuSaveState.Text = "Save State";
|
||||
this.mnuSaveState.DropDownOpening += new System.EventHandler(this.mnuSaveState_DropDownOpening);
|
||||
//
|
||||
// mnuLoadState
|
||||
//
|
||||
this.mnuLoadState.Name = "mnuLoadState";
|
||||
this.mnuLoadState.Size = new System.Drawing.Size(146, 22);
|
||||
this.mnuLoadState.Size = new System.Drawing.Size(152, 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(143, 6);
|
||||
this.toolStripMenuItem7.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// mnuRecentFiles
|
||||
//
|
||||
this.mnuRecentFiles.Name = "mnuRecentFiles";
|
||||
this.mnuRecentFiles.Size = new System.Drawing.Size(146, 22);
|
||||
this.mnuRecentFiles.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuRecentFiles.Text = "Recent Files";
|
||||
//
|
||||
// toolStripMenuItem6
|
||||
//
|
||||
this.toolStripMenuItem6.Name = "toolStripMenuItem6";
|
||||
this.toolStripMenuItem6.Size = new System.Drawing.Size(143, 6);
|
||||
this.toolStripMenuItem6.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// mnuExit
|
||||
//
|
||||
this.mnuExit.Image = global::Mesen.GUI.Properties.Resources.Exit;
|
||||
this.mnuExit.Name = "mnuExit";
|
||||
this.mnuExit.Size = new System.Drawing.Size(146, 22);
|
||||
this.mnuExit.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuExit.Text = "Exit";
|
||||
this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click);
|
||||
//
|
||||
@ -426,7 +429,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(135, 22);
|
||||
this.mnuEmulationSpeed.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuEmulationSpeed.Text = "Speed";
|
||||
//
|
||||
// mnuEmuSpeedNormal
|
||||
@ -527,7 +530,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(135, 22);
|
||||
this.mnuVideoScale.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuVideoScale.Text = "Video Size";
|
||||
//
|
||||
// mnuScale1x
|
||||
@ -631,7 +634,7 @@ namespace Mesen.GUI.Forms
|
||||
this.toolStripMenuItem19,
|
||||
this.mnuBilinearInterpolation});
|
||||
this.mnuVideoFilter.Name = "mnuVideoFilter";
|
||||
this.mnuVideoFilter.Size = new System.Drawing.Size(135, 22);
|
||||
this.mnuVideoFilter.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuVideoFilter.Text = "Video Filter";
|
||||
//
|
||||
// mnuNoneFilter
|
||||
@ -788,7 +791,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(135, 22);
|
||||
this.mnuRegion.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuRegion.Text = "Region";
|
||||
//
|
||||
// mnuRegionAuto
|
||||
@ -822,13 +825,13 @@ namespace Mesen.GUI.Forms
|
||||
// toolStripMenuItem10
|
||||
//
|
||||
this.toolStripMenuItem10.Name = "toolStripMenuItem10";
|
||||
this.toolStripMenuItem10.Size = new System.Drawing.Size(132, 6);
|
||||
this.toolStripMenuItem10.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// mnuAudioConfig
|
||||
//
|
||||
this.mnuAudioConfig.Image = global::Mesen.GUI.Properties.Resources.Audio;
|
||||
this.mnuAudioConfig.Name = "mnuAudioConfig";
|
||||
this.mnuAudioConfig.Size = new System.Drawing.Size(135, 22);
|
||||
this.mnuAudioConfig.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuAudioConfig.Text = "Audio";
|
||||
this.mnuAudioConfig.Click += new System.EventHandler(this.mnuAudioConfig_Click);
|
||||
//
|
||||
@ -836,7 +839,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(135, 22);
|
||||
this.mnuInput.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuInput.Text = "Input";
|
||||
this.mnuInput.Click += new System.EventHandler(this.mnuInput_Click);
|
||||
//
|
||||
@ -844,7 +847,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(135, 22);
|
||||
this.mnuVideoConfig.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuVideoConfig.Text = "Video";
|
||||
this.mnuVideoConfig.Click += new System.EventHandler(this.mnuVideoConfig_Click);
|
||||
//
|
||||
@ -852,20 +855,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(135, 22);
|
||||
this.mnuEmulationConfig.Size = new System.Drawing.Size(152, 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(132, 6);
|
||||
this.toolStripMenuItem11.Size = new System.Drawing.Size(149, 6);
|
||||
//
|
||||
// mnuPreferences
|
||||
//
|
||||
this.mnuPreferences.Image = global::Mesen.GUI.Properties.Resources.Cog;
|
||||
this.mnuPreferences.Name = "mnuPreferences";
|
||||
this.mnuPreferences.Size = new System.Drawing.Size(135, 22);
|
||||
this.mnuPreferences.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuPreferences.Text = "Preferences";
|
||||
this.mnuPreferences.Click += new System.EventHandler(this.mnuPreferences_Click);
|
||||
//
|
||||
@ -1209,13 +1212,22 @@ namespace Mesen.GUI.Forms
|
||||
this.mnuAbout.Text = "About";
|
||||
this.mnuAbout.Click += new System.EventHandler(this.mnuAbout_Click);
|
||||
//
|
||||
// ctrlLoading
|
||||
//
|
||||
this.ctrlLoading.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ctrlLoading.Location = new System.Drawing.Point(0, 0);
|
||||
this.ctrlLoading.Name = "ctrlLoading";
|
||||
this.ctrlLoading.Size = new System.Drawing.Size(360, 239);
|
||||
this.ctrlLoading.TabIndex = 4;
|
||||
this.ctrlLoading.Visible = false;
|
||||
//
|
||||
// frmMain
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Maroon;
|
||||
this.ClientSize = new System.Drawing.Size(304, 242);
|
||||
this.ClientSize = new System.Drawing.Size(360, 263);
|
||||
this.Controls.Add(this.panelRenderer);
|
||||
this.Controls.Add(this.menuStrip);
|
||||
this.MainMenuStrip = this.menuStrip;
|
||||
@ -1362,6 +1374,7 @@ namespace Mesen.GUI.Forms
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuLogWindow;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuEmulationConfig;
|
||||
private Controls.ctrlNsfPlayer ctrlNsfPlayer;
|
||||
private Controls.ctrlLoadingRom ctrlLoading;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,8 @@ namespace Mesen.GUI.Forms
|
||||
private double _regularScale = ConfigManager.Config.VideoInfo.VideoScale;
|
||||
private bool _needScaleUpdate = false;
|
||||
private bool _isNsfPlayerMode = false;
|
||||
private object _loadRomLock = new object();
|
||||
private int _romLoadCounter = 0;
|
||||
|
||||
public frmMain(string[] args)
|
||||
{
|
||||
@ -141,8 +143,8 @@ namespace Mesen.GUI.Forms
|
||||
void InitializeEmu()
|
||||
{
|
||||
InteropEmu.InitializeEmu(ConfigManager.HomeFolder, this.Handle, this.ctrlRenderer.Handle);
|
||||
foreach(string romPath in ConfigManager.Config.RecentFiles) {
|
||||
InteropEmu.AddKnowGameFolder(Path.GetDirectoryName(romPath).ToLowerInvariant());
|
||||
foreach(RecentItem recentItem in ConfigManager.Config.RecentFiles) {
|
||||
InteropEmu.AddKnowGameFolder(Path.GetDirectoryName(recentItem.Path).ToLowerInvariant());
|
||||
}
|
||||
|
||||
ConfigManager.Config.ApplyConfig();
|
||||
@ -379,7 +381,7 @@ namespace Mesen.GUI.Forms
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = ResourceHelper.GetMessage("FilterRomIps");
|
||||
if(ConfigManager.Config.RecentFiles.Count > 0) {
|
||||
ofd.InitialDirectory = Path.GetDirectoryName(ConfigManager.Config.RecentFiles[0]);
|
||||
ofd.InitialDirectory = Path.GetDirectoryName(ConfigManager.Config.RecentFiles[0].Path);
|
||||
}
|
||||
if(ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
|
||||
LoadFile(ofd.FileName);
|
||||
@ -420,7 +422,7 @@ namespace Mesen.GUI.Forms
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = ResourceHelper.GetMessage("FilterRom");
|
||||
if(ConfigManager.Config.RecentFiles.Count > 0) {
|
||||
ofd.InitialDirectory = Path.GetDirectoryName(ConfigManager.Config.RecentFiles[0]);
|
||||
ofd.InitialDirectory = Path.GetDirectoryName(ConfigManager.Config.RecentFiles[0].Path);
|
||||
}
|
||||
if(ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
|
||||
LoadROM(ofd.FileName);
|
||||
@ -433,21 +435,41 @@ namespace Mesen.GUI.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadROM(string filename, bool autoLoadIps = false)
|
||||
private void LoadROM(string filename, bool autoLoadIps = false, int archiveFileIndex = -1)
|
||||
{
|
||||
_romToLoad = filename;
|
||||
if(File.Exists(filename)) {
|
||||
ConfigManager.Config.AddRecentFile(filename);
|
||||
|
||||
int archiveFileIndex;
|
||||
if(frmSelectRom.SelectRom(filename, out archiveFileIndex)) {
|
||||
InteropEmu.LoadROM(filename, archiveFileIndex);
|
||||
UpdateRecentFiles();
|
||||
|
||||
string ipsFile = Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename)) + ".ips";
|
||||
if(File.Exists(ipsFile)) {
|
||||
InteropEmu.ApplyIpsPatch(ipsFile);
|
||||
string romName;
|
||||
if(frmSelectRom.SelectRom(filename, ref archiveFileIndex, out romName)) {
|
||||
if(archiveFileIndex >= 0) {
|
||||
Interlocked.Increment(ref _romLoadCounter);
|
||||
ctrlNsfPlayer.Visible = false;
|
||||
ctrlLoading.Visible = true;
|
||||
}
|
||||
|
||||
Task loadRomTask = new Task(() => {
|
||||
lock(_loadRomLock) {
|
||||
InteropEmu.LoadROM(filename, archiveFileIndex);
|
||||
}
|
||||
});
|
||||
|
||||
loadRomTask.ContinueWith((Task prevTask) => {
|
||||
this.BeginInvoke((MethodInvoker)(() => {
|
||||
if(archiveFileIndex >= 0) {
|
||||
Interlocked.Decrement(ref _romLoadCounter);
|
||||
}
|
||||
|
||||
string ipsFile = Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename)) + ".ips";
|
||||
if(File.Exists(ipsFile)) {
|
||||
InteropEmu.ApplyIpsPatch(ipsFile);
|
||||
}
|
||||
|
||||
ConfigManager.Config.AddRecentFile(filename, romName, archiveFileIndex);
|
||||
UpdateRecentFiles();
|
||||
}));
|
||||
});
|
||||
|
||||
loadRomTask.Start();
|
||||
}
|
||||
} else {
|
||||
MesenMsgBox.Show("FileNotFound", MessageBoxButtons.OK, MessageBoxIcon.Error, filename);
|
||||
@ -479,6 +501,8 @@ namespace Mesen.GUI.Forms
|
||||
if(this.InvokeRequired) {
|
||||
this.BeginInvoke((MethodInvoker)(() => this.UpdateMenus()));
|
||||
} else {
|
||||
ctrlLoading.Visible = (_romLoadCounter > 0);
|
||||
|
||||
UpdateFocusFlag();
|
||||
|
||||
if(string.IsNullOrWhiteSpace(_currentGame)) {
|
||||
@ -571,11 +595,11 @@ namespace Mesen.GUI.Forms
|
||||
private void UpdateRecentFiles()
|
||||
{
|
||||
mnuRecentFiles.DropDownItems.Clear();
|
||||
foreach(string filepath in ConfigManager.Config.RecentFiles) {
|
||||
foreach(RecentItem recentItem in ConfigManager.Config.RecentFiles) {
|
||||
ToolStripMenuItem tsmi = new ToolStripMenuItem();
|
||||
tsmi.Text = Path.GetFileName(filepath);
|
||||
tsmi.Text = recentItem.RomName;
|
||||
tsmi.Click += (object sender, EventArgs args) => {
|
||||
LoadROM(filepath);
|
||||
LoadROM(recentItem.Path, false, recentItem.ArchiveFileIndex);
|
||||
};
|
||||
mnuRecentFiles.DropDownItems.Add(tsmi);
|
||||
}
|
||||
|
@ -72,18 +72,34 @@ namespace Mesen.GUI.Forms
|
||||
txtSearch.Focus();
|
||||
}
|
||||
|
||||
public static bool SelectRom(string filename, out int archiveFileIndex)
|
||||
public static bool SelectRom(string filename, ref int archiveFileIndex)
|
||||
{
|
||||
archiveFileIndex = -1;
|
||||
string romName;
|
||||
return SelectRom(filename, ref archiveFileIndex, out romName);
|
||||
}
|
||||
|
||||
public static bool SelectRom(string filename, ref int archiveFileIndex, out string romName)
|
||||
{
|
||||
romName = "";
|
||||
|
||||
List<string> archiveRomList = InteropEmu.GetArchiveRomList(filename);
|
||||
if(archiveRomList.Count > 1) {
|
||||
frmSelectRom frm = new frmSelectRom(archiveRomList);
|
||||
if(frm.ShowDialog(null, Application.OpenForms[0]) == DialogResult.OK) {
|
||||
archiveFileIndex = frm.SelectedIndex;
|
||||
if(archiveFileIndex >= 0 && archiveFileIndex < archiveRomList.Count) {
|
||||
romName = System.IO.Path.GetFileName(archiveRomList[archiveFileIndex]);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
frmSelectRom frm = new frmSelectRom(archiveRomList);
|
||||
if(frm.ShowDialog(null, Application.OpenForms[0]) == DialogResult.OK) {
|
||||
archiveFileIndex = frm.SelectedIndex;
|
||||
romName = System.IO.Path.GetFileName(frm.lstRoms.SelectedItem.ToString());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if(archiveRomList.Count == 1) {
|
||||
romName = System.IO.Path.GetFileName(archiveRomList[0]);
|
||||
} else {
|
||||
romName = System.IO.Path.GetFileName(filename);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -227,6 +227,12 @@
|
||||
<Compile Include="Controls\ctrlHorizontalTrackbar.Designer.cs">
|
||||
<DependentUpon>ctrlHorizontalTrackbar.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ctrlLoadingRom.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ctrlLoadingRom.Designer.cs">
|
||||
<DependentUpon>ctrlLoadingRom.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ctrlNsfPlayer.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
@ -514,6 +520,9 @@
|
||||
<EmbeddedResource Include="Controls\ctrlHorizontalTrackbar.resx">
|
||||
<DependentUpon>ctrlHorizontalTrackbar.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Controls\ctrlLoadingRom.resx">
|
||||
<DependentUpon>ctrlLoadingRom.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Controls\ctrlNsfPlayer.resx">
|
||||
<DependentUpon>ctrlNsfPlayer.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -144,6 +144,10 @@ namespace InteropEmu {
|
||||
_returnString = romData.RomName;
|
||||
romInfo.RomName = _returnString.c_str();
|
||||
romInfo.Crc32 = romData.Crc32;
|
||||
} else {
|
||||
_returnString = "";
|
||||
romInfo.RomName = _returnString.c_str();
|
||||
romInfo.Crc32 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user