Cheats: Added cheat database (Database by Mighty Mo)
This commit is contained in:
parent
c6137f4f37
commit
bebc1e04fe
12 changed files with 48704 additions and 8 deletions
|
@ -43,6 +43,7 @@ struct InteropRomInfo
|
|||
const char* PatchPath;
|
||||
CoprocessorType Coprocessor;
|
||||
SnesCartInformation Header;
|
||||
char Sha1[40];
|
||||
};
|
||||
|
||||
string _romPath;
|
||||
|
@ -113,8 +114,10 @@ extern "C" {
|
|||
DllExport void __stdcall GetRomInfo(InteropRomInfo &info)
|
||||
{
|
||||
RomInfo romInfo = {};
|
||||
string sha1;
|
||||
if(_console->GetCartridge()) {
|
||||
romInfo = _console->GetCartridge()->GetRomInfo();
|
||||
sha1 = _console->GetCartridge()->GetSha1Hash();
|
||||
}
|
||||
|
||||
_romPath = romInfo.RomFile;
|
||||
|
@ -124,6 +127,8 @@ extern "C" {
|
|||
info.RomPath = _romPath.c_str();
|
||||
info.PatchPath = _patchPath.c_str();
|
||||
info.Coprocessor = romInfo.Coprocessor;
|
||||
|
||||
memcpy(info.Sha1, sha1.c_str(), sha1.size());
|
||||
}
|
||||
|
||||
DllExport void __stdcall TakeScreenshot() { _console->GetVideoDecoder()->TakeScreenshot(); }
|
||||
|
|
48151
UI/Dependencies/CheatDb.xml
Normal file
48151
UI/Dependencies/CheatDb.xml
Normal file
File diff suppressed because it is too large
Load diff
|
@ -437,9 +437,9 @@
|
|||
<Control ID="btnImport">Import</Control>
|
||||
<Control ID="btnCancel">Cancel</Control>
|
||||
</Form>
|
||||
<Form ID="frmCheatImportFromDb" Title="Select Game...">
|
||||
<Form ID="frmCheatDbList" Title="Select Game...">
|
||||
<Control ID="lblSearch">Search:</Control>
|
||||
<Control ID="btnOK">Import</Control>
|
||||
<Control ID="btnOK">Import Cheats</Control>
|
||||
<Control ID="btnCancel">Cancel</Control>
|
||||
</Form>
|
||||
<Form ID="frmCheatList" Title="Cheats">
|
||||
|
@ -701,7 +701,7 @@
|
|||
<Message ID="InvalidPaths">The following path overrides are invalid:

{0}

Please use valid and writable folders and try again.</Message>
|
||||
<Message ID="CopyMesenDataPrompt">All files will be copied from:

{0}
to
{1}

Once the copy is completed, Mesen-S will restart.
Continue?</Message>
|
||||
|
||||
<Message ID="CheatsFound">{0} games and {1} cheats in database</Message>
|
||||
<Message ID="CheatsFound">{0} games in database</Message>
|
||||
<Message ID="CheatsImported">{0} cheats imported for {1}.</Message>
|
||||
|
||||
<Message ID="NsfNextTrack">Next Track (Hold to fast forward)</Message>
|
||||
|
|
43
UI/Forms/Tools/CheatDatabase.cs
Normal file
43
UI/Forms/Tools/CheatDatabase.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Mesen.GUI.Forms
|
||||
{
|
||||
[XmlRoot("cheats")]
|
||||
public class CheatDatabase
|
||||
{
|
||||
[XmlElement("game")]
|
||||
public List<CheatDbGameEntry> Games;
|
||||
}
|
||||
|
||||
[XmlType("game")]
|
||||
public class CheatDbGameEntry
|
||||
{
|
||||
[XmlAttribute("name")]
|
||||
public string Name;
|
||||
|
||||
[XmlAttribute("sha1")]
|
||||
public string Sha1;
|
||||
|
||||
[XmlElement("cheat")]
|
||||
public List<CheatDbCheatEntry> Cheats;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return this.Name;
|
||||
}
|
||||
}
|
||||
|
||||
public class CheatDbCheatEntry
|
||||
{
|
||||
[XmlAttribute("description")]
|
||||
public string Description;
|
||||
|
||||
[XmlElement("code")]
|
||||
public List<string> Codes;
|
||||
}
|
||||
}
|
188
UI/Forms/Tools/frmCheatDbList.Designer.cs
generated
Normal file
188
UI/Forms/Tools/frmCheatDbList.Designer.cs
generated
Normal file
|
@ -0,0 +1,188 @@
|
|||
namespace Mesen.GUI.Forms
|
||||
{
|
||||
partial class frmCheatDbList
|
||||
{
|
||||
/// <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.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.lstGames = new System.Windows.Forms.ListBox();
|
||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.btnOK = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.lblCheatCount = new System.Windows.Forms.Label();
|
||||
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.txtSearch = new System.Windows.Forms.TextBox();
|
||||
this.lblSearch = new System.Windows.Forms.Label();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.flowLayoutPanel1.SuspendLayout();
|
||||
this.tableLayoutPanel2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 2;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.lstGames, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 1, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.lblCheatCount, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 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 = 3;
|
||||
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.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(421, 390);
|
||||
this.tableLayoutPanel1.TabIndex = 1;
|
||||
//
|
||||
// lstGames
|
||||
//
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.lstGames, 2);
|
||||
this.lstGames.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lstGames.FormattingEnabled = true;
|
||||
this.lstGames.Location = new System.Drawing.Point(3, 28);
|
||||
this.lstGames.Name = "lstGames";
|
||||
this.lstGames.Size = new System.Drawing.Size(415, 330);
|
||||
this.lstGames.TabIndex = 1;
|
||||
this.lstGames.SelectedIndexChanged += new System.EventHandler(this.lstGames_SelectedIndexChanged);
|
||||
this.lstGames.DoubleClick += new System.EventHandler(this.lstGames_DoubleClick);
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.flowLayoutPanel1.AutoSize = true;
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnOK);
|
||||
this.flowLayoutPanel1.Controls.Add(this.btnCancel);
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(241, 361);
|
||||
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(180, 29);
|
||||
this.flowLayoutPanel1.TabIndex = 2;
|
||||
//
|
||||
// btnOK
|
||||
//
|
||||
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.btnOK.Enabled = false;
|
||||
this.btnOK.Location = new System.Drawing.Point(3, 3);
|
||||
this.btnOK.Name = "btnOK";
|
||||
this.btnOK.Size = new System.Drawing.Size(93, 23);
|
||||
this.btnOK.TabIndex = 0;
|
||||
this.btnOK.Text = "Import";
|
||||
this.btnOK.UseVisualStyleBackColor = true;
|
||||
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Location = new System.Drawing.Point(102, 3);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnCancel.TabIndex = 1;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// lblCheatCount
|
||||
//
|
||||
this.lblCheatCount.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.lblCheatCount.AutoSize = true;
|
||||
this.lblCheatCount.Location = new System.Drawing.Point(3, 369);
|
||||
this.lblCheatCount.Name = "lblCheatCount";
|
||||
this.lblCheatCount.Size = new System.Drawing.Size(172, 13);
|
||||
this.lblCheatCount.TabIndex = 2;
|
||||
this.lblCheatCount.Text = "### games and ### cheats found";
|
||||
//
|
||||
// tableLayoutPanel2
|
||||
//
|
||||
this.tableLayoutPanel2.ColumnCount = 2;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.tableLayoutPanel2, 2);
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel2.Controls.Add(this.txtSearch, 1, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.lblSearch, 0, 0);
|
||||
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||
this.tableLayoutPanel2.RowCount = 1;
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(421, 25);
|
||||
this.tableLayoutPanel2.TabIndex = 5;
|
||||
//
|
||||
// txtSearch
|
||||
//
|
||||
this.txtSearch.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtSearch.Location = new System.Drawing.Point(53, 3);
|
||||
this.txtSearch.Name = "txtSearch";
|
||||
this.txtSearch.Size = new System.Drawing.Size(365, 20);
|
||||
this.txtSearch.TabIndex = 1;
|
||||
this.txtSearch.TextChanged += new System.EventHandler(this.txtSearch_TextChanged);
|
||||
//
|
||||
// lblSearch
|
||||
//
|
||||
this.lblSearch.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.lblSearch.AutoSize = true;
|
||||
this.lblSearch.Location = new System.Drawing.Point(3, 6);
|
||||
this.lblSearch.Name = "lblSearch";
|
||||
this.lblSearch.Size = new System.Drawing.Size(44, 13);
|
||||
this.lblSearch.TabIndex = 3;
|
||||
this.lblSearch.Text = "Search:";
|
||||
//
|
||||
// frmCheatDbList
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(421, 390);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Name = "frmCheatDbList";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Select game";
|
||||
this.Controls.SetChildIndex(this.tableLayoutPanel1, 0);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
this.flowLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel2.ResumeLayout(false);
|
||||
this.tableLayoutPanel2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private System.Windows.Forms.ListBox lstGames;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
private System.Windows.Forms.Button btnOK;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.Label lblCheatCount;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||
private System.Windows.Forms.TextBox txtSearch;
|
||||
private System.Windows.Forms.Label lblSearch;
|
||||
}
|
||||
}
|
122
UI/Forms/Tools/frmCheatDbList.cs
Normal file
122
UI/Forms/Tools/frmCheatDbList.cs
Normal file
|
@ -0,0 +1,122 @@
|
|||
using Mesen.GUI.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Mesen.GUI.Forms
|
||||
{
|
||||
public partial class frmCheatDbList : BaseForm
|
||||
{
|
||||
private CheatDatabase _cheatDb;
|
||||
public List<CheatDbCheatEntry> ImportedCheats { get; internal set; }
|
||||
private string _previousSearch = "";
|
||||
|
||||
public frmCheatDbList()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Icon = Resources.Find;
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
base.OnShown(e);
|
||||
|
||||
_cheatDb = new CheatDatabase();
|
||||
try {
|
||||
XmlSerializer xmlSerializer = new XmlSerializer(typeof(CheatDatabase));
|
||||
using(TextReader textReader = new StreamReader(ResourceExtractor.GetZippedResource("CheatDb.xml"))) {
|
||||
_cheatDb = (CheatDatabase)xmlSerializer.Deserialize(textReader);
|
||||
}
|
||||
} catch { }
|
||||
|
||||
lblCheatCount.Text = ResourceHelper.GetMessage("CheatsFound", _cheatDb.Games.Count.ToString());
|
||||
|
||||
txtSearch.Focus();
|
||||
UpdateList();
|
||||
|
||||
string sha1 = EmuApi.GetRomInfo().Sha1;
|
||||
for(int i = 0, len = lstGames.Items.Count; i < len; i++) {
|
||||
if(((CheatDbGameEntry)lstGames.Items[i]).Sha1 == sha1) {
|
||||
lstGames.TopIndex = Math.Max(0, i - 10);
|
||||
lstGames.SelectedIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
||||
{
|
||||
if(keyData == Keys.Escape) {
|
||||
Close();
|
||||
return true;
|
||||
} else if(txtSearch.Focused) {
|
||||
if(keyData == Keys.Down || keyData == Keys.PageDown || keyData == Keys.Up || keyData == Keys.PageUp) {
|
||||
lstGames.Focus();
|
||||
if(lstGames.Items.Count > 0) {
|
||||
lstGames.SelectedIndex = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else if(lstGames.Focused && lstGames.SelectedIndex <= 0) {
|
||||
if(keyData == Keys.Up || keyData == Keys.PageUp) {
|
||||
txtSearch.Focus();
|
||||
txtSearch.SelectAll();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return base.ProcessCmdKey(ref msg, keyData);
|
||||
}
|
||||
|
||||
private void UpdateList()
|
||||
{
|
||||
lstGames.BeginUpdate();
|
||||
lstGames.Sorted = false;
|
||||
lstGames.Items.Clear();
|
||||
if(string.IsNullOrWhiteSpace(_previousSearch)) {
|
||||
lstGames.Items.AddRange(_cheatDb.Games.ToArray());
|
||||
} else {
|
||||
lstGames.Items.AddRange(_cheatDb.Games.Where(c => c.Name.IndexOf(_previousSearch, StringComparison.InvariantCultureIgnoreCase) >= 0).ToArray());
|
||||
}
|
||||
lstGames.Sorted = true;
|
||||
lstGames.EndUpdate();
|
||||
}
|
||||
|
||||
void SetImportedCheats()
|
||||
{
|
||||
this.ImportedCheats = ((CheatDbGameEntry)lstGames.SelectedItem).Cheats;
|
||||
this.DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
private void lstGames_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
btnOK.Enabled = lstGames.SelectedItems.Count > 0;
|
||||
}
|
||||
|
||||
private void lstGames_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
SetImportedCheats();
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetImportedCheats();
|
||||
}
|
||||
|
||||
private void txtSearch_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(txtSearch.Text.Trim() != _previousSearch) {
|
||||
_previousSearch = txtSearch.Text.Trim();
|
||||
UpdateList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
123
UI/Forms/Tools/frmCheatDbList.resx
Normal file
123
UI/Forms/Tools/frmCheatDbList.resx
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?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>
|
||||
</root>
|
22
UI/Forms/Tools/frmCheatList.Designer.cs
generated
22
UI/Forms/Tools/frmCheatList.Designer.cs
generated
|
@ -33,6 +33,7 @@ namespace Mesen.GUI.Forms
|
|||
this.tabCheats = new System.Windows.Forms.TabPage();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.lstCheats = new Mesen.GUI.Controls.MyListView();
|
||||
this.colEnabled = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colCheatName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.colCodes = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.contextMenuCheats = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
|
@ -45,7 +46,7 @@ namespace Mesen.GUI.Forms
|
|||
this.btnDeleteCheat = new System.Windows.Forms.ToolStripButton();
|
||||
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.chkDisableCheats = new System.Windows.Forms.CheckBox();
|
||||
this.colEnabled = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.btnImportFromDb = new System.Windows.Forms.ToolStripButton();
|
||||
this.baseConfigPanel.SuspendLayout();
|
||||
this.tabMain.SuspendLayout();
|
||||
this.tabCheats.SuspendLayout();
|
||||
|
@ -123,6 +124,11 @@ namespace Mesen.GUI.Forms
|
|||
this.lstCheats.SelectedIndexChanged += new System.EventHandler(this.lstCheats_SelectedIndexChanged);
|
||||
this.lstCheats.DoubleClick += new System.EventHandler(this.lstCheats_DoubleClick);
|
||||
//
|
||||
// colEnabled
|
||||
//
|
||||
this.colEnabled.Text = "";
|
||||
this.colEnabled.Width = 21;
|
||||
//
|
||||
// colCheatName
|
||||
//
|
||||
this.colCheatName.Name = "colCheatName";
|
||||
|
@ -177,7 +183,8 @@ namespace Mesen.GUI.Forms
|
|||
this.tsCheatActions.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.btnAddCheat,
|
||||
this.btnEditCheat,
|
||||
this.btnDeleteCheat});
|
||||
this.btnDeleteCheat,
|
||||
this.btnImportFromDb});
|
||||
this.tsCheatActions.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
|
||||
this.tsCheatActions.Location = new System.Drawing.Point(0, 0);
|
||||
this.tsCheatActions.Name = "tsCheatActions";
|
||||
|
@ -237,10 +244,14 @@ namespace Mesen.GUI.Forms
|
|||
this.chkDisableCheats.UseVisualStyleBackColor = true;
|
||||
this.chkDisableCheats.CheckedChanged += new System.EventHandler(this.chkDisableCheats_CheckedChanged);
|
||||
//
|
||||
// colEnabled
|
||||
// btnImportFromDb
|
||||
//
|
||||
this.colEnabled.Text = "";
|
||||
this.colEnabled.Width = 21;
|
||||
this.btnImportFromDb.Image = global::Mesen.GUI.Properties.Resources.Find;
|
||||
this.btnImportFromDb.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.btnImportFromDb.Name = "btnImportFromDb";
|
||||
this.btnImportFromDb.Size = new System.Drawing.Size(109, 20);
|
||||
this.btnImportFromDb.Text = "Cheat Database";
|
||||
this.btnImportFromDb.Click += new System.EventHandler(this.btnImportFromDb_Click);
|
||||
//
|
||||
// frmCheatList
|
||||
//
|
||||
|
@ -289,5 +300,6 @@ namespace Mesen.GUI.Forms
|
|||
private System.Windows.Forms.ToolStripButton btnEditCheat;
|
||||
private System.Windows.Forms.ToolStripButton btnDeleteCheat;
|
||||
private System.Windows.Forms.ColumnHeader colEnabled;
|
||||
private System.Windows.Forms.ToolStripButton btnImportFromDb;
|
||||
}
|
||||
}
|
|
@ -137,6 +137,7 @@ namespace Mesen.GUI.Forms
|
|||
lstCheats.EndUpdate();
|
||||
|
||||
ResizeColumns();
|
||||
UpdateMenuItems();
|
||||
}
|
||||
|
||||
private void mnuAddCheat_Click(object sender, EventArgs e)
|
||||
|
@ -224,5 +225,37 @@ namespace Mesen.GUI.Forms
|
|||
{
|
||||
EditCheat();
|
||||
}
|
||||
|
||||
private void btnImportFromDb_Click(object sender, EventArgs e)
|
||||
{
|
||||
using(frmCheatDbList frm = new frmCheatDbList()) {
|
||||
if(frm.ShowDialog(btnImportFromDb, this) == DialogResult.OK) {
|
||||
List<CheatCode> importedCheats = new List<CheatCode>();
|
||||
Dictionary<string, CheatCode> existingCheats = new Dictionary<string, CheatCode>();
|
||||
foreach(CheatCode cheat in _cheats) {
|
||||
existingCheats[cheat.Description] = cheat;
|
||||
}
|
||||
|
||||
foreach(CheatDbCheatEntry dbCheat in frm.ImportedCheats) {
|
||||
CheatCode cheat = new CheatCode();
|
||||
cheat.Description = dbCheat.Description;
|
||||
cheat.Enabled = false;
|
||||
cheat.Format = CheatFormat.ProActionReplay;
|
||||
foreach(string code in dbCheat.Codes) {
|
||||
cheat.Codes += code + Environment.NewLine;
|
||||
if(code.Contains('-')) {
|
||||
cheat.Format = CheatFormat.GameGenie;
|
||||
}
|
||||
}
|
||||
|
||||
if(!existingCheats.ContainsKey(cheat.Description) || existingCheats[cheat.Description].Codes != cheat.Codes) {
|
||||
//Only import cheats that don't already exist in the list
|
||||
importedCheats.Add(cheat);
|
||||
}
|
||||
}
|
||||
AddCheats(importedCheats);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,6 +104,9 @@ namespace Mesen.GUI
|
|||
public IntPtr PatchPath;
|
||||
public CoprocessorType CoprocessorType;
|
||||
public SnesCartInformation Header;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)]
|
||||
public byte[] Sha1;
|
||||
}
|
||||
|
||||
public struct RomInfo
|
||||
|
@ -112,6 +115,7 @@ namespace Mesen.GUI
|
|||
public string PatchPath;
|
||||
public CoprocessorType CoprocessorType;
|
||||
public SnesCartInformation Header;
|
||||
public string Sha1;
|
||||
|
||||
public RomInfo(InteropRomInfo romInfo)
|
||||
{
|
||||
|
@ -119,6 +123,7 @@ namespace Mesen.GUI
|
|||
PatchPath = (ResourcePath)Utf8Marshaler.GetStringFromIntPtr(romInfo.PatchPath);
|
||||
Header = romInfo.Header;
|
||||
CoprocessorType = romInfo.CoprocessorType;
|
||||
Sha1 = Encoding.UTF8.GetString(romInfo.Sha1);
|
||||
}
|
||||
|
||||
public string GetRomName()
|
||||
|
|
|
@ -50,6 +50,7 @@ namespace Mesen.GUI
|
|||
new XmlSerializer(typeof(Configuration));
|
||||
new XmlSerializer(typeof(DebugWorkspace));
|
||||
new XmlSerializer(typeof(CheatCodes));
|
||||
new XmlSerializer(typeof(CheatDatabase));
|
||||
});
|
||||
|
||||
if(Type.GetType("Mono.Runtime") != null) {
|
||||
|
|
13
UI/UI.csproj
13
UI/UI.csproj
|
@ -790,12 +790,19 @@
|
|||
<Compile Include="Forms\Config\frmRecordMovie.Designer.cs">
|
||||
<DependentUpon>frmRecordMovie.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Tools\CheatDatabase.cs" />
|
||||
<Compile Include="Forms\Tools\frmCheat.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Tools\frmCheat.Designer.cs">
|
||||
<DependentUpon>frmCheat.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Tools\frmCheatDbList.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Tools\frmCheatDbList.Designer.cs">
|
||||
<DependentUpon>frmCheatDbList.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Tools\frmCheatList.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -1097,6 +1104,9 @@
|
|||
<EmbeddedResource Include="Forms\Tools\frmCheat.resx">
|
||||
<DependentUpon>frmCheat.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Tools\frmCheatDbList.resx">
|
||||
<DependentUpon>frmCheatDbList.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Tools\frmCheatList.resx">
|
||||
<DependentUpon>frmCheatList.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -1134,6 +1144,9 @@
|
|||
<None Include="Dependencies\Font.64.spritefont">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<Content Include="Dependencies\CheatDb.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Dependencies\PixelFont.ttf">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
Loading…
Add table
Reference in a new issue