Cheat Window - .cht file saving (no file loading yet), shorcut keys for Cheat menu items, Show number of active cheats, Fix bug in enable/disabling of cheats, small tweaks

This commit is contained in:
andres.delikat 2011-03-17 21:20:59 +00:00
parent fa29daab13
commit 2989f8396e
2 changed files with 130 additions and 107 deletions

View File

@ -29,12 +29,6 @@
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Cheats)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Cheats));
this.CheatListView = new BizHawk.VirtualListView();
this.CheatName = new System.Windows.Forms.ColumnHeader();
this.Address = new System.Windows.Forms.ColumnHeader();
this.Value = new System.Windows.Forms.ColumnHeader();
this.Domain = new System.Windows.Forms.ColumnHeader();
this.On = new System.Windows.Forms.ColumnHeader();
this.CheatsMenu = new System.Windows.Forms.MenuStrip(); this.CheatsMenu = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -61,6 +55,7 @@
this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.findAndLoadCheatFileByGameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.findAndLoadCheatFileByGameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.autoTurnOnCheatsOnLoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.autoTurnOnCheatsOnLoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.newToolStripButton = new System.Windows.Forms.ToolStripButton(); this.newToolStripButton = new System.Windows.Forms.ToolStripButton();
this.openToolStripButton = new System.Windows.Forms.ToolStripButton(); this.openToolStripButton = new System.Windows.Forms.ToolStripButton();
@ -74,6 +69,7 @@
this.toolStripButtonMoveDown = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonMoveDown = new System.Windows.Forms.ToolStripButton();
this.MessageLabel = new System.Windows.Forms.Label(); this.MessageLabel = new System.Windows.Forms.Label();
this.AddCheatGroup = new System.Windows.Forms.GroupBox(); this.AddCheatGroup = new System.Windows.Forms.GroupBox();
this.EditButton = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.DomainComboBox = new System.Windows.Forms.ComboBox(); this.DomainComboBox = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
@ -86,67 +82,18 @@
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.EditButton = new System.Windows.Forms.Button(); this.CheatListView = new BizHawk.VirtualListView();
this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.CheatName = new System.Windows.Forms.ColumnHeader();
this.Address = new System.Windows.Forms.ColumnHeader();
this.Value = new System.Windows.Forms.ColumnHeader();
this.Domain = new System.Windows.Forms.ColumnHeader();
this.On = new System.Windows.Forms.ColumnHeader();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.CheatsMenu.SuspendLayout(); this.CheatsMenu.SuspendLayout();
this.toolStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout();
this.AddCheatGroup.SuspendLayout(); this.AddCheatGroup.SuspendLayout();
this.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.AutoArrange = false;
this.CheatListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.CheatName,
this.Address,
this.Value,
this.Domain,
this.On});
this.CheatListView.FullRowSelect = true;
this.CheatListView.GridLines = true;
this.CheatListView.ItemCount = 0;
this.CheatListView.LabelEdit = true;
this.CheatListView.Location = new System.Drawing.Point(12, 72);
this.CheatListView.Name = "CheatListView";
this.CheatListView.selectedItem = -1;
this.CheatListView.Size = new System.Drawing.Size(298, 277);
this.CheatListView.TabIndex = 0;
this.CheatListView.UseCompatibleStateImageBehavior = false;
this.CheatListView.View = System.Windows.Forms.View.Details;
this.CheatListView.Click += new System.EventHandler(this.CheatListView_Click);
this.CheatListView.SelectedIndexChanged += new System.EventHandler(this.CheatListView_SelectedIndexChanged);
this.CheatListView.DoubleClick += new System.EventHandler(this.CheatListView_DoubleClick);
this.CheatListView.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.CheatListView_AfterLabelEdit);
//
// CheatName
//
this.CheatName.Text = "Name";
this.CheatName.Width = 104;
//
// Address
//
this.Address.Text = "Address";
this.Address.Width = 52;
//
// Value
//
this.Value.Text = "Value";
this.Value.Width = 40;
//
// Domain
//
this.Domain.Text = "Domain";
this.Domain.Width = 58;
//
// On
//
this.On.Text = "On";
this.On.Width = 40;
//
// CheatsMenu // CheatsMenu
// //
this.CheatsMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.CheatsMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -277,47 +224,52 @@
// addCheatToolStripMenuItem // addCheatToolStripMenuItem
// //
this.addCheatToolStripMenuItem.Name = "addCheatToolStripMenuItem"; this.addCheatToolStripMenuItem.Name = "addCheatToolStripMenuItem";
this.addCheatToolStripMenuItem.Size = new System.Drawing.Size(165, 22); this.addCheatToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
this.addCheatToolStripMenuItem.Text = "&Add Cheat"; this.addCheatToolStripMenuItem.Text = "&Add Cheat";
this.addCheatToolStripMenuItem.Click += new System.EventHandler(this.addCheatToolStripMenuItem_Click); this.addCheatToolStripMenuItem.Click += new System.EventHandler(this.addCheatToolStripMenuItem_Click);
// //
// removeCheatToolStripMenuItem // removeCheatToolStripMenuItem
// //
this.removeCheatToolStripMenuItem.Name = "removeCheatToolStripMenuItem"; this.removeCheatToolStripMenuItem.Name = "removeCheatToolStripMenuItem";
this.removeCheatToolStripMenuItem.Size = new System.Drawing.Size(165, 22); this.removeCheatToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R)));
this.removeCheatToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
this.removeCheatToolStripMenuItem.Text = "&Remove Cheat"; this.removeCheatToolStripMenuItem.Text = "&Remove Cheat";
this.removeCheatToolStripMenuItem.Click += new System.EventHandler(this.removeCheatToolStripMenuItem_Click); this.removeCheatToolStripMenuItem.Click += new System.EventHandler(this.removeCheatToolStripMenuItem_Click);
// //
// duplicateToolStripMenuItem // duplicateToolStripMenuItem
// //
this.duplicateToolStripMenuItem.Name = "duplicateToolStripMenuItem"; this.duplicateToolStripMenuItem.Name = "duplicateToolStripMenuItem";
this.duplicateToolStripMenuItem.Size = new System.Drawing.Size(165, 22); this.duplicateToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
this.duplicateToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.duplicateToolStripMenuItem.Text = "&Duplicate"; this.duplicateToolStripMenuItem.Text = "&Duplicate";
this.duplicateToolStripMenuItem.Click += new System.EventHandler(this.duplicateToolStripMenuItem_Click); this.duplicateToolStripMenuItem.Click += new System.EventHandler(this.duplicateToolStripMenuItem_Click);
// //
// insertSeparatorToolStripMenuItem // insertSeparatorToolStripMenuItem
// //
this.insertSeparatorToolStripMenuItem.Name = "insertSeparatorToolStripMenuItem"; this.insertSeparatorToolStripMenuItem.Name = "insertSeparatorToolStripMenuItem";
this.insertSeparatorToolStripMenuItem.Size = new System.Drawing.Size(165, 22); this.insertSeparatorToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I)));
this.insertSeparatorToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.insertSeparatorToolStripMenuItem.Text = "Insert Separator"; this.insertSeparatorToolStripMenuItem.Text = "Insert Separator";
this.insertSeparatorToolStripMenuItem.Click += new System.EventHandler(this.insertSeparatorToolStripMenuItem_Click); this.insertSeparatorToolStripMenuItem.Click += new System.EventHandler(this.insertSeparatorToolStripMenuItem_Click);
// //
// toolStripSeparator3 // toolStripSeparator3
// //
this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(162, 6); this.toolStripSeparator3.Size = new System.Drawing.Size(192, 6);
// //
// moveUpToolStripMenuItem // moveUpToolStripMenuItem
// //
this.moveUpToolStripMenuItem.Name = "moveUpToolStripMenuItem"; this.moveUpToolStripMenuItem.Name = "moveUpToolStripMenuItem";
this.moveUpToolStripMenuItem.Size = new System.Drawing.Size(165, 22); this.moveUpToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.U)));
this.moveUpToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.moveUpToolStripMenuItem.Text = "Move &Up"; this.moveUpToolStripMenuItem.Text = "Move &Up";
this.moveUpToolStripMenuItem.Click += new System.EventHandler(this.moveUpToolStripMenuItem_Click); this.moveUpToolStripMenuItem.Click += new System.EventHandler(this.moveUpToolStripMenuItem_Click);
// //
// moveDownToolStripMenuItem // moveDownToolStripMenuItem
// //
this.moveDownToolStripMenuItem.Name = "moveDownToolStripMenuItem"; this.moveDownToolStripMenuItem.Name = "moveDownToolStripMenuItem";
this.moveDownToolStripMenuItem.Size = new System.Drawing.Size(165, 22); this.moveDownToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
this.moveDownToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.moveDownToolStripMenuItem.Text = "Move &Down"; this.moveDownToolStripMenuItem.Text = "Move &Down";
this.moveDownToolStripMenuItem.Click += new System.EventHandler(this.moveDownToolStripMenuItem_Click); this.moveDownToolStripMenuItem.Click += new System.EventHandler(this.moveDownToolStripMenuItem_Click);
// //
@ -327,6 +279,7 @@
this.saveWindowPositionToolStripMenuItem, this.saveWindowPositionToolStripMenuItem,
this.findAndLoadCheatFileByGameToolStripMenuItem, this.findAndLoadCheatFileByGameToolStripMenuItem,
this.autoTurnOnCheatsOnLoadToolStripMenuItem, this.autoTurnOnCheatsOnLoadToolStripMenuItem,
this.toolStripSeparator5,
this.restoreWindowSizeToolStripMenuItem}); this.restoreWindowSizeToolStripMenuItem});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20); this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
@ -352,6 +305,13 @@
this.autoTurnOnCheatsOnLoadToolStripMenuItem.Size = new System.Drawing.Size(248, 22); this.autoTurnOnCheatsOnLoadToolStripMenuItem.Size = new System.Drawing.Size(248, 22);
this.autoTurnOnCheatsOnLoadToolStripMenuItem.Text = "Auto Turn on Cheats on Load"; this.autoTurnOnCheatsOnLoadToolStripMenuItem.Text = "Auto Turn on Cheats on Load";
// //
// restoreWindowSizeToolStripMenuItem
//
this.restoreWindowSizeToolStripMenuItem.Name = "restoreWindowSizeToolStripMenuItem";
this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(248, 22);
this.restoreWindowSizeToolStripMenuItem.Text = "Restore Window Size";
this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click);
//
// toolStrip1 // toolStrip1
// //
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -465,7 +425,7 @@
// //
this.MessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.MessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.MessageLabel.AutoSize = true; this.MessageLabel.AutoSize = true;
this.MessageLabel.Location = new System.Drawing.Point(13, 356); this.MessageLabel.Location = new System.Drawing.Point(13, 305);
this.MessageLabel.Name = "MessageLabel"; this.MessageLabel.Name = "MessageLabel";
this.MessageLabel.Size = new System.Drawing.Size(0, 13); this.MessageLabel.Size = new System.Drawing.Size(0, 13);
this.MessageLabel.TabIndex = 3; this.MessageLabel.TabIndex = 3;
@ -487,11 +447,22 @@
this.AddCheatGroup.Controls.Add(this.label1); this.AddCheatGroup.Controls.Add(this.label1);
this.AddCheatGroup.Location = new System.Drawing.Point(327, 72); this.AddCheatGroup.Location = new System.Drawing.Point(327, 72);
this.AddCheatGroup.Name = "AddCheatGroup"; this.AddCheatGroup.Name = "AddCheatGroup";
this.AddCheatGroup.Size = new System.Drawing.Size(170, 225); this.AddCheatGroup.Size = new System.Drawing.Size(170, 236);
this.AddCheatGroup.TabIndex = 4; this.AddCheatGroup.TabIndex = 4;
this.AddCheatGroup.TabStop = false; this.AddCheatGroup.TabStop = false;
this.AddCheatGroup.Text = "Add Cheat"; this.AddCheatGroup.Text = "Add Cheat";
// //
// EditButton
//
this.EditButton.Enabled = false;
this.EditButton.Location = new System.Drawing.Point(99, 195);
this.EditButton.Name = "EditButton";
this.EditButton.Size = new System.Drawing.Size(65, 23);
this.EditButton.TabIndex = 11;
this.EditButton.Text = "&Edit";
this.EditButton.UseVisualStyleBackColor = true;
this.EditButton.Click += new System.EventHandler(this.EditButton_Click);
//
// label6 // label6
// //
this.label6.AutoSize = true; this.label6.AutoSize = true;
@ -530,7 +501,7 @@
// AddCheatButton // AddCheatButton
// //
this.AddCheatButton.Enabled = false; this.AddCheatButton.Enabled = false;
this.AddCheatButton.Location = new System.Drawing.Point(10, 187); this.AddCheatButton.Location = new System.Drawing.Point(10, 195);
this.AddCheatButton.Name = "AddCheatButton"; this.AddCheatButton.Name = "AddCheatButton";
this.AddCheatButton.Size = new System.Drawing.Size(65, 23); this.AddCheatButton.Size = new System.Drawing.Size(65, 23);
this.AddCheatButton.TabIndex = 6; this.AddCheatButton.TabIndex = 6;
@ -604,29 +575,70 @@
this.NumCheatsLabel.TabIndex = 5; this.NumCheatsLabel.TabIndex = 5;
this.NumCheatsLabel.Text = "0 Cheats"; this.NumCheatsLabel.Text = "0 Cheats";
// //
// EditButton // CheatListView
// //
this.EditButton.Enabled = false; this.CheatListView.AllowColumnReorder = true;
this.EditButton.Location = new System.Drawing.Point(99, 187); this.CheatListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.EditButton.Name = "EditButton"; | System.Windows.Forms.AnchorStyles.Left)
this.EditButton.Size = new System.Drawing.Size(65, 23); | System.Windows.Forms.AnchorStyles.Right)));
this.EditButton.TabIndex = 11; this.CheatListView.AutoArrange = false;
this.EditButton.Text = "&Edit"; this.CheatListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.EditButton.UseVisualStyleBackColor = true; this.CheatName,
this.EditButton.Click += new System.EventHandler(this.EditButton_Click); this.Address,
this.Value,
this.Domain,
this.On});
this.CheatListView.FullRowSelect = true;
this.CheatListView.GridLines = true;
this.CheatListView.ItemCount = 0;
this.CheatListView.LabelEdit = true;
this.CheatListView.Location = new System.Drawing.Point(12, 72);
this.CheatListView.Name = "CheatListView";
this.CheatListView.selectedItem = -1;
this.CheatListView.Size = new System.Drawing.Size(298, 236);
this.CheatListView.TabIndex = 0;
this.CheatListView.UseCompatibleStateImageBehavior = false;
this.CheatListView.View = System.Windows.Forms.View.Details;
this.CheatListView.Click += new System.EventHandler(this.CheatListView_Click);
this.CheatListView.SelectedIndexChanged += new System.EventHandler(this.CheatListView_SelectedIndexChanged);
this.CheatListView.DoubleClick += new System.EventHandler(this.CheatListView_DoubleClick);
this.CheatListView.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.CheatListView_AfterLabelEdit);
// //
// restoreWindowSizeToolStripMenuItem // CheatName
// //
this.restoreWindowSizeToolStripMenuItem.Name = "restoreWindowSizeToolStripMenuItem"; this.CheatName.Text = "Name";
this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(248, 22); this.CheatName.Width = 104;
this.restoreWindowSizeToolStripMenuItem.Text = "Restore Window Size"; //
this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click); // Address
//
this.Address.Text = "Address";
this.Address.Width = 52;
//
// Value
//
this.Value.Text = "Value";
this.Value.Width = 40;
//
// Domain
//
this.Domain.Text = "Domain";
this.Domain.Width = 58;
//
// On
//
this.On.Text = "On";
this.On.Width = 40;
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(245, 6);
// //
// Cheats // Cheats
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(509, 379); this.ClientSize = new System.Drawing.Size(509, 328);
this.Controls.Add(this.NumCheatsLabel); this.Controls.Add(this.NumCheatsLabel);
this.Controls.Add(this.AddCheatGroup); this.Controls.Add(this.AddCheatGroup);
this.Controls.Add(this.MessageLabel); this.Controls.Add(this.MessageLabel);
@ -709,5 +721,6 @@
private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button EditButton; private System.Windows.Forms.Button EditButton;
private System.Windows.Forms.ToolStripMenuItem restoreWindowSizeToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem restoreWindowSizeToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
} }
} }

View File

@ -13,10 +13,8 @@ namespace BizHawk.MultiClient
{ {
public partial class Cheats : Form public partial class Cheats : Form
{ {
//File format - saving & loading //File format - loading
//Shortcuts for Cheat menu items
//Implement Options menu settings //Implement Options menu settings
//Save column widths
//Implement Freeze/Unfreeze on enabled changed in Cheat object //Implement Freeze/Unfreeze on enabled changed in Cheat object
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
@ -107,6 +105,7 @@ namespace BizHawk.MultiClient
LoadConfigSettings(); LoadConfigSettings();
PopulateMemoryDomainComboBox(); PopulateMemoryDomainComboBox();
AddressBox.MaxLength = GetNumDigits(Global.Emulator.MainMemory.Size - 1); AddressBox.MaxLength = GetNumDigits(Global.Emulator.MainMemory.Size - 1);
UpdateNumberOfCheats();
} }
private void PopulateMemoryDomainComboBox() private void PopulateMemoryDomainComboBox()
@ -366,16 +365,14 @@ namespace BizHawk.MultiClient
for (int x = 0; x < cheatList.Count; x++) for (int x = 0; x < cheatList.Count; x++)
{ {
//str += string.Format("{0:X4}", watchList[x].address) + "\t"; str += FormatAddress(cheatList[x].address) + "\t";
//str += watchList[x].GetTypeByChar().ToString() + "\t"; str += String.Format("{0:X2}", cheatList[x].value) + "\t";
//str += watchList[x].GetSignedByChar().ToString() + "\t"; str += cheatList[x].domain.Name + "\t";
if (cheatList[x].IsEnabled())
//if (watchList[x].bigendian == true) str += "1\t";
// str += "1\t"; else
//else str += "0\t";
// str += "0\t"; str += cheatList[x].name + "\n";
//str += watchList[x].notes + "\n";
} }
sw.WriteLine(str); sw.WriteLine(str);
@ -388,7 +385,7 @@ namespace BizHawk.MultiClient
{ {
if (changes) if (changes)
{ {
DialogResult result = MessageBox.Show("Save Changes?", "Ram Watch", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3); DialogResult result = MessageBox.Show("Save Changes?", "Cheats", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3);
if (result == DialogResult.Yes) if (result == DialogResult.Yes)
{ {
@ -591,11 +588,23 @@ namespace BizHawk.MultiClient
private void UpdateNumberOfCheats() private void UpdateNumberOfCheats()
{ {
int z = cheatList.Count; string message = "";
if (z == 1) int active = 0;
NumCheatsLabel.Text = z.ToString() + " cheat"; for (int x = 0; x < cheatList.Count; x++)
{
if (cheatList[x].IsEnabled())
active++;
}
int c = cheatList.Count;
if (c == 1)
message += c.ToString() + " cheat (" + active.ToString() + " active)";
else if (c == 0)
message += c.ToString() + " cheats";
else else
NumCheatsLabel.Text = z.ToString() + " cheats"; message += c.ToString() + " cheats (" + active.ToString() + " active)";
NumCheatsLabel.Text = message;
} }
private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e) private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e)
@ -640,11 +649,12 @@ namespace BizHawk.MultiClient
if (indexes.Count > 0) if (indexes.Count > 0)
{ {
if (cheatList[indexes[0]].IsEnabled()) if (cheatList[indexes[0]].IsEnabled())
cheatList[indexes[0]].Enable();
else
cheatList[indexes[0]].Disable(); cheatList[indexes[0]].Disable();
else
cheatList[indexes[0]].Enable();
CheatListView.Refresh(); CheatListView.Refresh();
} }
UpdateNumberOfCheats();
} }
private void CheatListView_Click(object sender, EventArgs e) private void CheatListView_Click(object sender, EventArgs e)