New Cheats - progress on cheat editor

This commit is contained in:
adelikat 2013-10-05 15:45:39 +00:00
parent 0e758ab1a2
commit 56b8642f4c
9 changed files with 777 additions and 26 deletions

View File

@ -484,6 +484,12 @@
<Compile Include="N64tools\N64VideoPluginconfig.Designer.cs">
<DependentUpon>N64VideoPluginconfig.cs</DependentUpon>
</Compile>
<Compile Include="tools\Cheats\CheatEdit.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="tools\Cheats\CheatEdit.Designer.cs">
<DependentUpon>CheatEdit.cs</DependentUpon>
</Compile>
<Compile Include="tools\Cheats\CheatList.cs" />
<Compile Include="tools\Cheats\NewCheat.cs" />
<Compile Include="tools\Cheats\NewCheatForm.cs">
@ -818,6 +824,9 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="tools\Cheats\CheatEdit.resx">
<DependentUpon>CheatEdit.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\Cheats\NewCheatForm.resx">
<DependentUpon>NewCheatForm.cs</DependentUpon>
</EmbeddedResource>

View File

@ -486,6 +486,12 @@
<Compile Include="SNESTools\SNESOptions.Designer.cs">
<DependentUpon>SNESOptions.cs</DependentUpon>
</Compile>
<Compile Include="tools\Cheats\CheatEdit.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="tools\Cheats\CheatEdit.Designer.cs">
<DependentUpon>CheatEdit.cs</DependentUpon>
</Compile>
<Compile Include="tools\Cheats\CheatList.cs" />
<Compile Include="tools\Cheats\NewCheat.cs" />
<Compile Include="tools\Cheats\NewCheatForm.cs">
@ -818,6 +824,9 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="tools\Cheats\CheatEdit.resx">
<DependentUpon>CheatEdit.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\Cheats\NewCheatForm.resx">
<DependentUpon>NewCheatForm.cs</DependentUpon>
</EmbeddedResource>

View File

@ -0,0 +1,305 @@
namespace BizHawk.MultiClient
{
partial class CheatEdit
{
/// <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.NameBox = new System.Windows.Forms.TextBox();
this.NameLabel = new System.Windows.Forms.Label();
this.AddressLabel = new System.Windows.Forms.Label();
this.AddressHexIndLabel = new System.Windows.Forms.Label();
this.AddressBox = new BizHawk.HexTextBox();
this.ValueBox = new BizHawk.MultiClient.WatchValueBox();
this.ValueHexIndLabel = new System.Windows.Forms.Label();
this.ValueLabel = new System.Windows.Forms.Label();
this.CompareBox = new BizHawk.MultiClient.WatchValueBox();
this.CompareHexIndLabel = new System.Windows.Forms.Label();
this.CompareLabel = new System.Windows.Forms.Label();
this.DomainLabel = new System.Windows.Forms.Label();
this.DomainDropDown = new System.Windows.Forms.ComboBox();
this.SizeLabel = new System.Windows.Forms.Label();
this.SizeDropDown = new System.Windows.Forms.ComboBox();
this.DisplayTypeLael = new System.Windows.Forms.Label();
this.DisplayTypeDropDown = new System.Windows.Forms.ComboBox();
this.BigEndianCheckBox = new System.Windows.Forms.CheckBox();
this.AddButton = new System.Windows.Forms.Button();
this.EditButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// NameBox
//
this.NameBox.Location = new System.Drawing.Point(70, 15);
this.NameBox.Name = "NameBox";
this.NameBox.Size = new System.Drawing.Size(108, 20);
this.NameBox.TabIndex = 5;
//
// NameLabel
//
this.NameLabel.AutoSize = true;
this.NameLabel.Location = new System.Drawing.Point(12, 18);
this.NameLabel.Name = "NameLabel";
this.NameLabel.Size = new System.Drawing.Size(35, 13);
this.NameLabel.TabIndex = 4;
this.NameLabel.Text = "Name";
//
// AddressLabel
//
this.AddressLabel.AutoSize = true;
this.AddressLabel.Location = new System.Drawing.Point(38, 45);
this.AddressLabel.Name = "AddressLabel";
this.AddressLabel.Size = new System.Drawing.Size(45, 13);
this.AddressLabel.TabIndex = 6;
this.AddressLabel.Text = "Address";
//
// AddressHexIndLabel
//
this.AddressHexIndLabel.AutoSize = true;
this.AddressHexIndLabel.Location = new System.Drawing.Point(89, 45);
this.AddressHexIndLabel.Name = "AddressHexIndLabel";
this.AddressHexIndLabel.Size = new System.Drawing.Size(18, 13);
this.AddressHexIndLabel.TabIndex = 8;
this.AddressHexIndLabel.Text = "0x";
//
// AddressBox
//
this.AddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.AddressBox.Location = new System.Drawing.Point(113, 42);
this.AddressBox.MaxLength = 8;
this.AddressBox.Name = "AddressBox";
this.AddressBox.Size = new System.Drawing.Size(65, 20);
this.AddressBox.TabIndex = 9;
//
// ValueBox
//
this.ValueBox.ByteSize = BizHawk.MultiClient.Watch.WatchSize.Byte;
this.ValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.ValueBox.Location = new System.Drawing.Point(113, 68);
this.ValueBox.MaxLength = 2;
this.ValueBox.Name = "ValueBox";
this.ValueBox.Size = new System.Drawing.Size(65, 20);
this.ValueBox.TabIndex = 12;
this.ValueBox.Type = BizHawk.MultiClient.Watch.DisplayType.Hex;
//
// ValueHexIndLabel
//
this.ValueHexIndLabel.AutoSize = true;
this.ValueHexIndLabel.Location = new System.Drawing.Point(89, 71);
this.ValueHexIndLabel.Name = "ValueHexIndLabel";
this.ValueHexIndLabel.Size = new System.Drawing.Size(18, 13);
this.ValueHexIndLabel.TabIndex = 11;
this.ValueHexIndLabel.Text = "0x";
//
// ValueLabel
//
this.ValueLabel.AutoSize = true;
this.ValueLabel.Location = new System.Drawing.Point(38, 71);
this.ValueLabel.Name = "ValueLabel";
this.ValueLabel.Size = new System.Drawing.Size(34, 13);
this.ValueLabel.TabIndex = 10;
this.ValueLabel.Text = "Value";
//
// CompareBox
//
this.CompareBox.ByteSize = BizHawk.MultiClient.Watch.WatchSize.Byte;
this.CompareBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.CompareBox.Location = new System.Drawing.Point(113, 94);
this.CompareBox.MaxLength = 2;
this.CompareBox.Name = "CompareBox";
this.CompareBox.Size = new System.Drawing.Size(65, 20);
this.CompareBox.TabIndex = 15;
this.CompareBox.Type = BizHawk.MultiClient.Watch.DisplayType.Hex;
//
// CompareHexIndLabel
//
this.CompareHexIndLabel.AutoSize = true;
this.CompareHexIndLabel.Location = new System.Drawing.Point(89, 97);
this.CompareHexIndLabel.Name = "CompareHexIndLabel";
this.CompareHexIndLabel.Size = new System.Drawing.Size(18, 13);
this.CompareHexIndLabel.TabIndex = 14;
this.CompareHexIndLabel.Text = "0x";
//
// CompareLabel
//
this.CompareLabel.AutoSize = true;
this.CompareLabel.Location = new System.Drawing.Point(38, 97);
this.CompareLabel.Name = "CompareLabel";
this.CompareLabel.Size = new System.Drawing.Size(49, 13);
this.CompareLabel.TabIndex = 13;
this.CompareLabel.Text = "Compare";
//
// DomainLabel
//
this.DomainLabel.AutoSize = true;
this.DomainLabel.Location = new System.Drawing.Point(12, 124);
this.DomainLabel.Name = "DomainLabel";
this.DomainLabel.Size = new System.Drawing.Size(43, 13);
this.DomainLabel.TabIndex = 16;
this.DomainLabel.Text = "Domain";
//
// DomainDropDown
//
this.DomainDropDown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.DomainDropDown.FormattingEnabled = true;
this.DomainDropDown.Location = new System.Drawing.Point(78, 121);
this.DomainDropDown.Name = "DomainDropDown";
this.DomainDropDown.Size = new System.Drawing.Size(100, 21);
this.DomainDropDown.TabIndex = 17;
this.DomainDropDown.SelectedIndexChanged += new System.EventHandler(this.DomainDropDown_SelectedIndexChanged);
//
// SizeLabel
//
this.SizeLabel.AutoSize = true;
this.SizeLabel.Location = new System.Drawing.Point(20, 150);
this.SizeLabel.Name = "SizeLabel";
this.SizeLabel.Size = new System.Drawing.Size(27, 13);
this.SizeLabel.TabIndex = 18;
this.SizeLabel.Text = "Size";
//
// SizeDropDown
//
this.SizeDropDown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.SizeDropDown.FormattingEnabled = true;
this.SizeDropDown.Items.AddRange(new object[] {
"1 Byte",
"2 Byte",
"4 Byte"});
this.SizeDropDown.Location = new System.Drawing.Point(78, 147);
this.SizeDropDown.Name = "SizeDropDown";
this.SizeDropDown.Size = new System.Drawing.Size(100, 21);
this.SizeDropDown.TabIndex = 19;
this.SizeDropDown.SelectedIndexChanged += new System.EventHandler(this.SizeDropDown_SelectedIndexChanged);
//
// DisplayTypeLael
//
this.DisplayTypeLael.AutoSize = true;
this.DisplayTypeLael.Location = new System.Drawing.Point(4, 174);
this.DisplayTypeLael.Name = "DisplayTypeLael";
this.DisplayTypeLael.Size = new System.Drawing.Size(68, 13);
this.DisplayTypeLael.TabIndex = 20;
this.DisplayTypeLael.Text = "Display Type";
//
// DisplayTypeDropDown
//
this.DisplayTypeDropDown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.DisplayTypeDropDown.FormattingEnabled = true;
this.DisplayTypeDropDown.Items.AddRange(new object[] {
"1 Byte",
"2 Byte",
"4 Byte"});
this.DisplayTypeDropDown.Location = new System.Drawing.Point(78, 171);
this.DisplayTypeDropDown.Name = "DisplayTypeDropDown";
this.DisplayTypeDropDown.Size = new System.Drawing.Size(100, 21);
this.DisplayTypeDropDown.TabIndex = 21;
//
// BigEndianCheckBox
//
this.BigEndianCheckBox.AutoSize = true;
this.BigEndianCheckBox.Location = new System.Drawing.Point(101, 198);
this.BigEndianCheckBox.Name = "BigEndianCheckBox";
this.BigEndianCheckBox.Size = new System.Drawing.Size(77, 17);
this.BigEndianCheckBox.TabIndex = 22;
this.BigEndianCheckBox.Text = "Big Endian";
this.BigEndianCheckBox.UseVisualStyleBackColor = true;
//
// AddButton
//
this.AddButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.AddButton.Enabled = false;
this.AddButton.Location = new System.Drawing.Point(7, 226);
this.AddButton.Name = "AddButton";
this.AddButton.Size = new System.Drawing.Size(65, 23);
this.AddButton.TabIndex = 23;
this.AddButton.Text = "&Add";
this.AddButton.UseVisualStyleBackColor = true;
//
// EditButton
//
this.EditButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.EditButton.Enabled = false;
this.EditButton.Location = new System.Drawing.Point(113, 226);
this.EditButton.Name = "EditButton";
this.EditButton.Size = new System.Drawing.Size(65, 23);
this.EditButton.TabIndex = 24;
this.EditButton.Text = "&Edit";
this.EditButton.UseVisualStyleBackColor = true;
//
// CheatEdit
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.EditButton);
this.Controls.Add(this.AddButton);
this.Controls.Add(this.BigEndianCheckBox);
this.Controls.Add(this.DisplayTypeDropDown);
this.Controls.Add(this.DisplayTypeLael);
this.Controls.Add(this.SizeDropDown);
this.Controls.Add(this.SizeLabel);
this.Controls.Add(this.DomainDropDown);
this.Controls.Add(this.DomainLabel);
this.Controls.Add(this.CompareBox);
this.Controls.Add(this.CompareHexIndLabel);
this.Controls.Add(this.CompareLabel);
this.Controls.Add(this.ValueBox);
this.Controls.Add(this.ValueHexIndLabel);
this.Controls.Add(this.ValueLabel);
this.Controls.Add(this.AddressBox);
this.Controls.Add(this.AddressHexIndLabel);
this.Controls.Add(this.AddressLabel);
this.Controls.Add(this.NameBox);
this.Controls.Add(this.NameLabel);
this.Name = "CheatEdit";
this.Size = new System.Drawing.Size(200, 266);
this.Load += new System.EventHandler(this.CheatEdit_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox NameBox;
private System.Windows.Forms.Label NameLabel;
private System.Windows.Forms.Label AddressLabel;
private System.Windows.Forms.Label AddressHexIndLabel;
private HexTextBox AddressBox;
private WatchValueBox ValueBox;
private System.Windows.Forms.Label ValueHexIndLabel;
private System.Windows.Forms.Label ValueLabel;
private WatchValueBox CompareBox;
private System.Windows.Forms.Label CompareHexIndLabel;
private System.Windows.Forms.Label CompareLabel;
private System.Windows.Forms.Label DomainLabel;
private System.Windows.Forms.ComboBox DomainDropDown;
private System.Windows.Forms.Label SizeLabel;
private System.Windows.Forms.ComboBox SizeDropDown;
private System.Windows.Forms.Label DisplayTypeLael;
private System.Windows.Forms.ComboBox DisplayTypeDropDown;
private System.Windows.Forms.CheckBox BigEndianCheckBox;
private System.Windows.Forms.Button AddButton;
private System.Windows.Forms.Button EditButton;
}
}

View File

@ -0,0 +1,221 @@
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 BizHawk.MultiClient
{
public partial class CheatEdit : UserControl
{
//TODO:
private NewCheat _cheat;
private const string HexInd = "0x";
private bool _loading = false;
public CheatEdit()
{
InitializeComponent();
}
private void CheatEdit_Load(object sender, EventArgs e)
{
ToolHelpers.PopulateMemoryDomainDropdown(ref DomainDropDown, Global.Emulator.MainMemory);
SetFormToDefault();
}
private void SetFormToCheat()
{
_loading = true;
SetSizeSelected(_cheat.Size);
PopulateTypeDropdown();
SetTypeSelected(_cheat.Type);
SetDomainSelected(_cheat.Domain);
AddressBox.SetHexProperties(_cheat.Domain.Size);
NameBox.Text = _cheat.Name;
AddressBox.Text = _cheat.AddressStr;
ValueBox.Text = _cheat.ValueStr;
CompareBox.Text = _cheat.Compare.HasValue ? _cheat.CompareStr : String.Empty;
ValueBox.ByteSize =
CompareBox.ByteSize =
_cheat.Size;
ValueBox.Type =
CompareBox.Type =
_cheat.Type;
ValueHexIndLabel.Text =
CompareHexIndLabel.Text =
_cheat.Type == Watch.DisplayType.Hex ? HexInd : String.Empty;
BigEndianCheckBox.Checked = _cheat.BigEndian.Value;
CheckFormState();
_loading = false;
}
private void SetFormToDefault()
{
_loading = true;
SetSizeSelected(Watch.WatchSize.Byte);
PopulateTypeDropdown();
NameBox.Text = String.Empty;
AddressBox.SetHexProperties(Global.Emulator.MainMemory.Size);
ValueBox.ByteSize =
CompareBox.ByteSize =
Watch.WatchSize.Byte;
ValueBox.Type =
CompareBox.Type =
Watch.DisplayType.Hex;
ValueBox.ResetText();
CompareBox.ResetText();
ValueHexIndLabel.Text =
CompareHexIndLabel.Text =
HexInd;
BigEndianCheckBox.Checked = false;
CheckFormState();
_loading = false;
}
private void SetSizeSelected(Watch.WatchSize size)
{
switch (size)
{
default:
case Watch.WatchSize.Byte:
SizeDropDown.SelectedIndex = 0;
break;
case Watch.WatchSize.Word:
SizeDropDown.SelectedIndex = 1;
break;
case Watch.WatchSize.DWord:
SizeDropDown.SelectedIndex = 2;
break;
}
}
private void SetTypeSelected(Watch.DisplayType type)
{
foreach (var item in DisplayTypeDropDown.Items)
{
if (item.ToString() == Watch.DisplayTypeToString(type))
{
DisplayTypeDropDown.SelectedItem = item;
return;
}
}
}
private void SetDomainSelected(MemoryDomain domain)
{
foreach (var item in DomainDropDown.Items)
{
if (item.ToString() == domain.Name)
{
DomainDropDown.SelectedItem = item;
return;
}
}
}
private void PopulateTypeDropdown()
{
DisplayTypeDropDown.Items.Clear();
switch (SizeDropDown.SelectedIndex)
{
default:
case 0:
DisplayTypeDropDown.Items.AddRange(ByteWatch.ValidTypes.ConvertAll<string>(e => Watch.DisplayTypeToString(e)).ToArray());
break;
case 1:
DisplayTypeDropDown.Items.AddRange(WordWatch.ValidTypes.ConvertAll<string>(e => Watch.DisplayTypeToString(e)).ToArray());
break;
case 2:
DisplayTypeDropDown.Items.AddRange(DWordWatch.ValidTypes.ConvertAll<string>(e => Watch.DisplayTypeToString(e)).ToArray());
break;
}
DisplayTypeDropDown.SelectedItem = DisplayTypeDropDown.Items[0];
}
private void CheckFormState()
{
AddButton.Enabled =
EditButton.Enabled =
(!String.IsNullOrWhiteSpace(AddressBox.Text) && !String.IsNullOrWhiteSpace(ValueBox.Text));
}
private void SizeDropDown_SelectedIndexChanged(object sender, EventArgs e)
{
if (!_loading)
{
PopulateTypeDropdown();
ValueBox.ByteSize =
CompareBox.ByteSize =
GetCurrentSize();
}
}
private void DomainDropDown_SelectedIndexChanged(object sender, EventArgs e)
{
if (!_loading)
{
var domain = ToolHelpers.DomainByName(DomainDropDown.SelectedItem.ToString());
AddressBox.SetHexProperties(domain.Size);
}
}
private Watch.WatchSize GetCurrentSize()
{
switch (SizeDropDown.SelectedIndex)
{
default:
case 0:
return Watch.WatchSize.Byte;
case 1:
return Watch.WatchSize.Word;
case 2:
return Watch.WatchSize.DWord;
}
}
#region API
public void SetCheat(NewCheat cheat)
{
_cheat = cheat;
if (cheat.IsSeparator)
{
SetFormToDefault();
}
else
{
SetFormToCheat();
}
}
//Add Cheat Callback
//Edit Cheat Callback
#endregion
}
}

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

@ -62,8 +62,8 @@
this.MoveDownMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SelectAllMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
this.DisableAllCheatsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToggleMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.DisableAllCheatsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.GameGenieSeparator = new System.Windows.Forms.ToolStripSeparator();
this.OpenGameGenieEncoderDecoderMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
@ -100,17 +100,19 @@
this.LoadGameGenieToolbarItem = new System.Windows.Forms.ToolStripButton();
this.TotalLabel = new System.Windows.Forms.Label();
this.MessageLabel = new System.Windows.Forms.Label();
this.CheatGroupBox = new System.Windows.Forms.GroupBox();
this.CheatEditor = new BizHawk.MultiClient.CheatEdit();
this.contextMenuStrip1.SuspendLayout();
this.CheatsMenu.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.CheatGroupBox.SuspendLayout();
this.SuspendLayout();
//
// CheatListView
//
this.CheatListView.AllowColumnReorder = true;
this.CheatListView.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.CheatListView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.CheatListView.AutoArrange = false;
this.CheatListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.CheatName,
@ -128,7 +130,7 @@
this.CheatListView.Location = new System.Drawing.Point(12, 72);
this.CheatListView.Name = "CheatListView";
this.CheatListView.selectedItem = -1;
this.CheatListView.Size = new System.Drawing.Size(376, 236);
this.CheatListView.Size = new System.Drawing.Size(414, 278);
this.CheatListView.TabIndex = 1;
this.CheatListView.UseCompatibleStateImageBehavior = false;
this.CheatListView.View = System.Windows.Forms.View.Details;
@ -177,7 +179,7 @@
this.toggleToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Refresh1;
this.toggleToolStripMenuItem.Name = "toggleToolStripMenuItem";
this.toggleToolStripMenuItem.ShortcutKeyDisplayString = "Enter";
this.toggleToolStripMenuItem.Size = new System.Drawing.Size(204, 22);
this.toggleToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.toggleToolStripMenuItem.Text = "&Toggle";
this.toggleToolStripMenuItem.Click += new System.EventHandler(this.ToggleMenuItem_Click);
//
@ -194,7 +196,7 @@
//
this.disableAllCheatsToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Stop;
this.disableAllCheatsToolStripMenuItem.Name = "disableAllCheatsToolStripMenuItem";
this.disableAllCheatsToolStripMenuItem.Size = new System.Drawing.Size(204, 22);
this.disableAllCheatsToolStripMenuItem.Size = new System.Drawing.Size(157, 22);
this.disableAllCheatsToolStripMenuItem.Text = "&Disable All";
this.disableAllCheatsToolStripMenuItem.Click += new System.EventHandler(this.DisableAllCheatsMenuItem_Click);
//
@ -208,7 +210,7 @@
this.ColumnsSubMenu});
this.CheatsMenu.Location = new System.Drawing.Point(0, 0);
this.CheatsMenu.Name = "CheatsMenu";
this.CheatsMenu.Size = new System.Drawing.Size(587, 24);
this.CheatsMenu.Size = new System.Drawing.Size(646, 24);
this.CheatsMenu.TabIndex = 2;
this.CheatsMenu.Text = "menuStrip1";
//
@ -390,14 +392,6 @@
this.toolStripSeparator6.Name = "toolStripSeparator6";
this.toolStripSeparator6.Size = new System.Drawing.Size(230, 6);
//
// DisableAllCheatsMenuItem
//
this.DisableAllCheatsMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Stop;
this.DisableAllCheatsMenuItem.Name = "DisableAllCheatsMenuItem";
this.DisableAllCheatsMenuItem.Size = new System.Drawing.Size(233, 22);
this.DisableAllCheatsMenuItem.Text = "Disable all";
this.DisableAllCheatsMenuItem.Click += new System.EventHandler(this.DisableAllCheatsMenuItem_Click);
//
// ToggleMenuItem
//
this.ToggleMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Refresh1;
@ -407,6 +401,14 @@
this.ToggleMenuItem.Text = "&Toggle";
this.ToggleMenuItem.Click += new System.EventHandler(this.ToggleMenuItem_Click);
//
// DisableAllCheatsMenuItem
//
this.DisableAllCheatsMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Stop;
this.DisableAllCheatsMenuItem.Name = "DisableAllCheatsMenuItem";
this.DisableAllCheatsMenuItem.Size = new System.Drawing.Size(233, 22);
this.DisableAllCheatsMenuItem.Text = "Disable all";
this.DisableAllCheatsMenuItem.Click += new System.EventHandler(this.DisableAllCheatsMenuItem_Click);
//
// GameGenieSeparator
//
this.GameGenieSeparator.Name = "GameGenieSeparator";
@ -587,7 +589,7 @@
this.LoadGameGenieToolbarItem});
this.toolStrip1.Location = new System.Drawing.Point(0, 24);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(587, 25);
this.toolStrip1.Size = new System.Drawing.Size(646, 25);
this.toolStrip1.TabIndex = 3;
this.toolStrip1.Text = "toolStrip1";
//
@ -710,17 +712,39 @@
//
this.MessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.MessageLabel.AutoSize = true;
this.MessageLabel.Location = new System.Drawing.Point(13, 312);
this.MessageLabel.Location = new System.Drawing.Point(13, 354);
this.MessageLabel.Name = "MessageLabel";
this.MessageLabel.Size = new System.Drawing.Size(31, 13);
this.MessageLabel.TabIndex = 7;
this.MessageLabel.Text = " ";
//
// CheatGroupBox
//
this.CheatGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.CheatGroupBox.Controls.Add(this.CheatEditor);
this.CheatGroupBox.Location = new System.Drawing.Point(432, 72);
this.CheatGroupBox.Name = "CheatGroupBox";
this.CheatGroupBox.Size = new System.Drawing.Size(202, 278);
this.CheatGroupBox.TabIndex = 8;
this.CheatGroupBox.TabStop = false;
this.CheatGroupBox.Text = "Cheat";
//
// CheatEditor
//
this.CheatEditor.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.CheatEditor.Location = new System.Drawing.Point(6, 14);
this.CheatEditor.Name = "CheatEditor";
this.CheatEditor.Size = new System.Drawing.Size(190, 264);
this.CheatEditor.TabIndex = 0;
//
// NewCheatForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(587, 328);
this.ClientSize = new System.Drawing.Size(646, 370);
this.Controls.Add(this.CheatGroupBox);
this.Controls.Add(this.MessageLabel);
this.Controls.Add(this.TotalLabel);
this.Controls.Add(this.toolStrip1);
@ -736,6 +760,7 @@
this.CheatsMenu.PerformLayout();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.CheatGroupBox.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@ -813,5 +838,7 @@
private System.Windows.Forms.ToolStripMenuItem toggleToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem removeSelectedToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem disableAllCheatsToolStripMenuItem;
private System.Windows.Forms.GroupBox CheatGroupBox;
private CheatEdit CheatEditor;
}
}

View File

@ -41,6 +41,22 @@ namespace BizHawk.MultiClient
return items.ToArray();
}
public static void PopulateMemoryDomainDropdown(ref ComboBox dropdown, MemoryDomain startDomain)
{
dropdown.Items.Clear();
if (Global.Emulator.MemoryDomains.Count > 0)
{
foreach (var domain in Global.Emulator.MemoryDomains)
{
var result = dropdown.Items.Add(domain.ToString());
if (domain.Name == startDomain.Name)
{
dropdown.SelectedIndex = result;
}
}
}
}
public static void UnfreezeAll()
{
Global.MainForm.Cheats1.RemoveAllCheats();

View File

@ -13,6 +13,32 @@ namespace BizHawk.MultiClient
CharacterCasing = CharacterCasing.Upper;
}
public override void ResetText()
{
switch (Type)
{
default:
case Watch.DisplayType.Signed:
case Watch.DisplayType.Unsigned:
Text = "0";
break;
case Watch.DisplayType.Hex:
string formatstr = "{0:X" + MaxLength.ToString() + "}";
Text = String.Format(formatstr, 0);
break;
case Watch.DisplayType.FixedPoint_12_4:
case Watch.DisplayType.FixedPoint_20_12:
case Watch.DisplayType.Float:
Text = "0.0";
break;
case Watch.DisplayType.Binary:
Text = "0".PadLeft(((int)_size) * 8);
break;
}
}
public Watch.WatchSize ByteSize
{
get { return _size; }
@ -322,7 +348,7 @@ namespace BizHawk.MultiClient
}
else
{
hexVal++;
hexVal--;
}
string formatstr = "{0:X" + MaxLength.ToString() + "}";
Text = String.Format(formatstr, hexVal);

View File

@ -11,6 +11,20 @@ namespace BizHawk
public class HexTextBox : TextBox, INumberBox
{
private string _addressFormatStr = "{0:X4}";
public void SetHexProperties(int domainSize)
{
MaxLength = IntHelpers.GetNumDigits(domainSize - 1);
_addressFormatStr = "{0:X" + MaxLength.ToString() + "}";
ResetText();
}
public override void ResetText()
{
Text = String.Format(_addressFormatStr, 0);
}
public HexTextBox()
{
CharacterCasing = CharacterCasing.Upper;
@ -44,8 +58,8 @@ namespace BizHawk
{
val++;
}
string formatstr = "{0:X" + MaxLength.ToString() + "}";
Text = String.Format(formatstr, val);
Text = String.Format(_addressFormatStr, val);
}
}
else if (e.KeyCode == Keys.Down)
@ -62,8 +76,7 @@ namespace BizHawk
val--;
}
string formatstr = "{0:X" + MaxLength.ToString() + "}";
Text = String.Format(formatstr, val);
Text = String.Format(_addressFormatStr, val);
}
}
else
@ -76,7 +89,7 @@ namespace BizHawk
{
if (String.IsNullOrWhiteSpace(Text))
{
Text = "0";
ResetText();
}
}
@ -112,6 +125,11 @@ namespace BizHawk
}
}
public override void ResetText()
{
Text = "0";
}
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.KeyCode == Keys.Up)
@ -158,7 +176,7 @@ namespace BizHawk
{
if (String.IsNullOrWhiteSpace(Text))
{
Text = "0";
ResetText();
}
}