private void EncodeGameGenie() { _address = AddressBox.ToRawInt(); _value = ValueBox.ToRawInt(); _compare = CompareBox.ToRawInt(); GameGenieCode.Text = new NESGameGenieEncoder(_address.Value, _value.Value, _compare).Encode(); }
public Cheat GetCheat() { Cheat.COMPARISONTYPE comparisonType = Cheat.COMPARISONTYPE.NONE; var domain = MemoryDomains[DomainDropDown.SelectedItem.ToString()]; var address = AddressBox.ToRawInt().Value; if (address < domain.Size) { var watch = Watch.GenerateWatch( MemoryDomains[DomainDropDown.SelectedItem.ToString()], AddressBox.ToRawInt().Value, GetCurrentSize(), Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()), BigEndianCheckBox.Checked, NameBox.Text ); switch (CompareTypeDropDown.SelectedItem.ToString()) { case "": comparisonType = Cheat.COMPARISONTYPE.NONE; break; case "=": comparisonType = Cheat.COMPARISONTYPE.EQUAL; break; case ">": comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN; break; case ">=": comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN_OR_EQUAL; break; case "<": comparisonType = Cheat.COMPARISONTYPE.LESS_THAN; break; case "<=": comparisonType = Cheat.COMPARISONTYPE.LESS_THAN_OR_EQUAL; break; case "!=": comparisonType = Cheat.COMPARISONTYPE.NOT_EQUAL; break; default: comparisonType = Cheat.COMPARISONTYPE.NONE; break; } int?c = CompareBox.ToRawInt() == null ? null : (int?)CompareBox.ToRawInt().Value; return(new Cheat( watch, ValueBox.ToRawInt().Value, CompareBox.ToRawInt() == null ? null : (int?)CompareBox.ToRawInt().Value, true, comparisonType )); } else { MessageBox.Show(address.ToString() + " is not a valid address for the domain " + domain.Name, "Index out of range", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(Cheat.Separator); } }
private void AddCheat_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(AddressBox.Text) && !string.IsNullOrWhiteSpace(ValueBox.Text)) { var watch = Watch.GenerateWatch( MemoryDomains["System Bus"], AddressBox.ToRawInt().Value, WatchSize.Byte, Client.Common.DisplayType.Hex, false, GameGenieCode.Text); Global.CheatList.Add(new Cheat( watch, ValueBox.ToRawInt().Value, CompareBox.ToRawInt() )); } }
public Cheat GetCheat() { var domain = MemoryDomains[DomainDropDown.SelectedItem.ToString()] !; var address = AddressBox.ToRawInt().Value; if (address < domain.Size) { var watch = Watch.GenerateWatch( MemoryDomains[DomainDropDown.SelectedItem.ToString()], AddressBox.ToRawInt().Value, GetCurrentSize(), Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()), BigEndianCheckBox.Checked, NameBox.Text); var comparisonType = CompareTypeDropDown.SelectedItem.ToString() switch { "" => Cheat.CompareType.None, "=" => Cheat.CompareType.Equal, ">" => Cheat.CompareType.GreaterThan, ">=" => Cheat.CompareType.GreaterThanOrEqual, "<" => Cheat.CompareType.LessThan, "<=" => Cheat.CompareType.LessThanOrEqual, "!=" => Cheat.CompareType.NotEqual, _ => Cheat.CompareType.None }; return(new Cheat( watch, ValueBox.ToRawInt().Value, CompareBox.ToRawInt() == null ? null : (int?)CompareBox.ToRawInt().Value, true, comparisonType)); } MessageBox.Show($"{address} is not a valid address for the domain {domain.Name}", "Index out of range", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(Cheat.Separator); }
public Cheat GetCheat() { var domain = MemoryDomains[DomainDropDown.SelectedItem.ToString()]; var address = AddressBox.ToRawInt().Value; if (address < domain.Size) { var watch = Watch.GenerateWatch( MemoryDomains[DomainDropDown.SelectedItem.ToString()], AddressBox.ToRawInt().Value, GetCurrentSize(), Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()), BigEndianCheckBox.Checked, NameBox.Text); Cheat.CompareType comparisonType; switch (CompareTypeDropDown.SelectedItem.ToString()) { case "": comparisonType = Cheat.CompareType.None; break; case "=": comparisonType = Cheat.CompareType.Equal; break; case ">": comparisonType = Cheat.CompareType.GreaterThan; break; case ">=": comparisonType = Cheat.CompareType.GreaterThanOrEqual; break; case "<": comparisonType = Cheat.CompareType.LessThan; break; case "<=": comparisonType = Cheat.CompareType.LessThanOrEqual; break; case "!=": comparisonType = Cheat.CompareType.NotEqual; break; default: comparisonType = Cheat.CompareType.None; break; } return(new Cheat( watch, ValueBox.ToRawInt().Value, CompareBox.ToRawInt() == null ? null : (int?)CompareBox.ToRawInt().Value, true, comparisonType)); } else { MessageBox.Show(address + " is not a valid address for the domain " + domain.Name, "Index out of range", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(Cheat.Separator); } }