Cheat Dialog - fix listview, show on/off status, double click toggled on/off status
This commit is contained in:
parent
3cdd222f51
commit
92b6e6ed1d
|
@ -9,7 +9,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
public string name { get; set; }
|
public string name { get; set; }
|
||||||
public int address { get; set; }
|
public int address { get; set; }
|
||||||
public int value { get; set; }
|
public byte value { get; set; }
|
||||||
public bool enabled { get; set; }
|
public bool enabled { get; set; }
|
||||||
|
|
||||||
public Cheat()
|
public Cheat()
|
||||||
|
@ -28,7 +28,7 @@ namespace BizHawk.MultiClient
|
||||||
enabled = c.enabled;
|
enabled = c.enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cheat(string cname, int addr, int val, int comp, bool e)
|
public Cheat(string cname, int addr, byte val, int comp, bool e)
|
||||||
{
|
{
|
||||||
name = cname;
|
name = cname;
|
||||||
address = addr;
|
address = addr;
|
||||||
|
|
|
@ -42,6 +42,10 @@
|
||||||
this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.appendFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.appendFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.recentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.recentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.autoLoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.cheatsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.cheatsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
@ -79,10 +83,6 @@
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.NumCheatsLabel = new System.Windows.Forms.Label();
|
this.NumCheatsLabel = new System.Windows.Forms.Label();
|
||||||
this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
|
|
||||||
this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.autoLoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.CheatsMenu.SuspendLayout();
|
this.CheatsMenu.SuspendLayout();
|
||||||
this.toolStrip1.SuspendLayout();
|
this.toolStrip1.SuspendLayout();
|
||||||
this.AddCheatGroup.SuspendLayout();
|
this.AddCheatGroup.SuspendLayout();
|
||||||
|
@ -111,6 +111,7 @@
|
||||||
this.CheatListView.TabIndex = 0;
|
this.CheatListView.TabIndex = 0;
|
||||||
this.CheatListView.UseCompatibleStateImageBehavior = false;
|
this.CheatListView.UseCompatibleStateImageBehavior = false;
|
||||||
this.CheatListView.View = System.Windows.Forms.View.Details;
|
this.CheatListView.View = System.Windows.Forms.View.Details;
|
||||||
|
this.CheatListView.DoubleClick += new System.EventHandler(this.CheatListView_DoubleClick);
|
||||||
//
|
//
|
||||||
// CheatName
|
// CheatName
|
||||||
//
|
//
|
||||||
|
@ -207,6 +208,29 @@
|
||||||
this.recentToolStripMenuItem.Text = "Recent";
|
this.recentToolStripMenuItem.Text = "Recent";
|
||||||
this.recentToolStripMenuItem.DropDownOpened += new System.EventHandler(this.recentToolStripMenuItem_DropDownOpened);
|
this.recentToolStripMenuItem.DropDownOpened += new System.EventHandler(this.recentToolStripMenuItem_DropDownOpened);
|
||||||
//
|
//
|
||||||
|
// noneToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.noneToolStripMenuItem.Name = "noneToolStripMenuItem";
|
||||||
|
this.noneToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
|
||||||
|
this.noneToolStripMenuItem.Text = "None";
|
||||||
|
//
|
||||||
|
// toolStripSeparator4
|
||||||
|
//
|
||||||
|
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
||||||
|
this.toolStripSeparator4.Size = new System.Drawing.Size(129, 6);
|
||||||
|
//
|
||||||
|
// clearToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.clearToolStripMenuItem.Name = "clearToolStripMenuItem";
|
||||||
|
this.clearToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
|
||||||
|
this.clearToolStripMenuItem.Text = "Clear";
|
||||||
|
//
|
||||||
|
// autoLoadToolStripMenuItem
|
||||||
|
//
|
||||||
|
this.autoLoadToolStripMenuItem.Name = "autoLoadToolStripMenuItem";
|
||||||
|
this.autoLoadToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
|
||||||
|
this.autoLoadToolStripMenuItem.Text = "Auto-load";
|
||||||
|
//
|
||||||
// toolStripSeparator1
|
// toolStripSeparator1
|
||||||
//
|
//
|
||||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||||
|
@ -536,29 +560,6 @@
|
||||||
this.NumCheatsLabel.TabIndex = 5;
|
this.NumCheatsLabel.TabIndex = 5;
|
||||||
this.NumCheatsLabel.Text = "0 Cheats";
|
this.NumCheatsLabel.Text = "0 Cheats";
|
||||||
//
|
//
|
||||||
// noneToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.noneToolStripMenuItem.Name = "noneToolStripMenuItem";
|
|
||||||
this.noneToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.noneToolStripMenuItem.Text = "None";
|
|
||||||
//
|
|
||||||
// toolStripSeparator4
|
|
||||||
//
|
|
||||||
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
|
||||||
this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6);
|
|
||||||
//
|
|
||||||
// clearToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.clearToolStripMenuItem.Name = "clearToolStripMenuItem";
|
|
||||||
this.clearToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.clearToolStripMenuItem.Text = "Clear";
|
|
||||||
//
|
|
||||||
// autoLoadToolStripMenuItem
|
|
||||||
//
|
|
||||||
this.autoLoadToolStripMenuItem.Name = "autoLoadToolStripMenuItem";
|
|
||||||
this.autoLoadToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.autoLoadToolStripMenuItem.Text = "Auto-load";
|
|
||||||
//
|
|
||||||
// Cheats
|
// Cheats
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
|
|
@ -13,14 +13,13 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
public partial class Cheats : Form
|
public partial class Cheats : Form
|
||||||
{
|
{
|
||||||
//TODO: Get vlist display working
|
|
||||||
//Input validation on address & value boxes
|
//Input validation on address & value boxes
|
||||||
//Remove compare column? make it conditional? Think about this
|
|
||||||
//Set address box text load based on memory domain size
|
//Set address box text load based on memory domain size
|
||||||
//Memory domains
|
//Memory domains
|
||||||
//File format - saving & loading
|
//File format - saving & loading
|
||||||
//Shortcuts for Cheat menu items
|
//Shortcuts for Cheat menu items
|
||||||
//Edit button enabled conditionally on highlighted listview item
|
//Edit button enabled conditionally on highlighted listview item
|
||||||
|
//ListView click event should update add cheat box
|
||||||
|
|
||||||
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
|
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
|
||||||
int defaultHeight;
|
int defaultHeight;
|
||||||
|
@ -58,6 +57,8 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
if (cheatList[index].address < 0)
|
if (cheatList[index].address < 0)
|
||||||
color = this.BackColor;
|
color = this.BackColor;
|
||||||
|
else if (cheatList[index].enabled)
|
||||||
|
color = Color.Pink;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheatListView_QueryItemText(int index, int column, out string text)
|
private void CheatListView_QueryItemText(int index, int column, out string text)
|
||||||
|
@ -73,24 +74,21 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
if (column == 2) //Value
|
if (column == 2) //Value
|
||||||
{
|
{
|
||||||
text = String.Format("{0:2X", cheatList[index].value);
|
text = String.Format("{0:X2}", cheatList[index].value);
|
||||||
}
|
}
|
||||||
if (column == 3) //Enabled
|
if (column == 3) //Enabled
|
||||||
{
|
{
|
||||||
//TODO
|
if (cheatList[index].enabled)
|
||||||
|
text = "*";
|
||||||
|
else
|
||||||
|
text = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GetNumDigits(Int32 i)
|
private int GetNumDigits(Int32 i)
|
||||||
{
|
{
|
||||||
//if (i == 0) return 0;
|
|
||||||
//if (i < 0x10) return 1;
|
|
||||||
//if (i < 0x100) return 2;
|
|
||||||
//if (i < 0x1000) return 3; //adelikat: commenting these out because I decided that regardless of domain, 4 digits should be the minimum
|
|
||||||
if (i < 0x10000) return 4;
|
if (i < 0x10000) return 4;
|
||||||
//if (i < 0x100000) return 5;
|
|
||||||
if (i < 0x1000000) return 6;
|
if (i < 0x1000000) return 6;
|
||||||
//if (i < 0x10000000) return 7;
|
|
||||||
else return 8;
|
else return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -505,7 +503,7 @@ namespace BizHawk.MultiClient
|
||||||
Cheat c = new Cheat();
|
Cheat c = new Cheat();
|
||||||
c.name = NameBox.Text;
|
c.name = NameBox.Text;
|
||||||
c.address = int.Parse(AddressBox.Text, NumberStyles.HexNumber); //TODO: validation
|
c.address = int.Parse(AddressBox.Text, NumberStyles.HexNumber); //TODO: validation
|
||||||
c.value = int.Parse(ValueBox.Text, NumberStyles.HexNumber);
|
c.value = (byte)(int.Parse(ValueBox.Text, NumberStyles.HexNumber));
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,5 +585,15 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
DuplicateCheat();
|
DuplicateCheat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CheatListView_DoubleClick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ListView.SelectedIndexCollection indexes = CheatListView.SelectedIndices;
|
||||||
|
if (indexes.Count > 0)
|
||||||
|
{
|
||||||
|
cheatList[indexes[0]].enabled ^= true;
|
||||||
|
CheatListView.Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue