private void DoEdit() { if (Watches.Count == 1) { Watches[0].Notes = NotesBox.Text; } if (_changedSize) { for (var i = 0; i < Watches.Count; i++) { var size = SizeDropDown.SelectedIndex switch { 1 => WatchSize.Word, 2 => WatchSize.DWord, _ => WatchSize.Byte }; var displayType = Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()); Watches[i] = Watch.GenerateWatch( Watches[i].Domain, Watches.Count == 1 ? AddressBox.ToRawInt() ?? 0 : Watches[i].Address, size, _changedDisplayType ? displayType : Watches[i].Type, Watches[i].BigEndian, Watches[i].Notes); } } if (BigEndianCheckBox.CheckState != CheckState.Indeterminate) { Watches.ForEach(x => x.BigEndian = BigEndianCheckBox.Checked); } }
private void AddCheatClick(object sender, EventArgs e) { if ((Emulator.SystemId == "GB") || (Global.Game.System == "GG")) { string name; var address = 0; var value = 0; int? compare = null; if (!string.IsNullOrWhiteSpace(cheatname.Text)) { name = cheatname.Text; } else { _processing = true; GGCodeMaskBox.TextMaskFormat = MaskFormat.IncludeLiterals; name = GGCodeMaskBox.Text; GGCodeMaskBox.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; _processing = false; } if (!string.IsNullOrWhiteSpace(AddressBox.Text)) { address = int.Parse(AddressBox.Text, NumberStyles.HexNumber); } if (!string.IsNullOrWhiteSpace(ValueBox.Text)) { value = (byte)int.Parse(ValueBox.Text, NumberStyles.HexNumber); } if (!string.IsNullOrWhiteSpace(CompareBox.Text)) { try { compare = byte.Parse(CompareBox.Text, NumberStyles.HexNumber); } catch { compare = null; } } var watch = Watch.GenerateWatch( MemoryDomains["System Bus"], address, WatchSize.Byte, Client.Common.DisplayType.Hex, false, name); Global.CheatList.Add(new Cheat( watch, value, compare)); } }
private void Ok_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; switch (_mode) { default: case Mode.New: var domain = Global.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()); var address = AddressBox.ToRawInt() ?? 0; var notes = NotesBox.Text; var type = Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()); var bigendian = BigEndianCheckBox.Checked; switch (SizeDropDown.SelectedIndex) { case 0: _watchList.Add(new ByteWatch(domain, address, type, bigendian, notes)); break; case 1: _watchList.Add(new WordWatch(domain, address, type, bigendian, notes)); break; case 2: _watchList.Add(new DWordWatch(domain, address, type, bigendian, notes)); break; } break; case Mode.Edit: DoEdit(); break; case Mode.Duplicate: var tempWatchList = new List <Watch>(); tempWatchList.AddRange(_watchList); _watchList.Clear(); foreach (var watch in tempWatchList) { _watchList.Add(Watch.GenerateWatch( watch.Domain, watch.Address ?? 0, watch.Size, watch.Type, watch.Notes, watch.BigEndian)); } DoEdit(); break; } Close(); }
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 DoEdit() { if (_watchList.Count == 1) { _watchList[0].Notes = NotesBox.Text; } if (_changedSize) { for (var i = 0; i < _watchList.Count; i++) { var size = Watch.WatchSize.Byte; switch (SizeDropDown.SelectedIndex) { case 0: size = Watch.WatchSize.Byte; break; case 1: size = Watch.WatchSize.Word; break; case 2: size = Watch.WatchSize.DWord; break; } _watchList[i] = Watch.GenerateWatch( _watchList[i].Domain, _watchList.Count == 1 ? AddressBox.ToRawInt() ?? 0 : _watchList[i].Address ?? 0, size, _watchList[i].Type, _watchList[i].Notes, _watchList[i].BigEndian ); } } if (_changedDisplayType) { _watchList.ForEach(x => x.Type = Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString())); } if (BigEndianCheckBox.CheckState != CheckState.Indeterminate) { _watchList.ForEach(x => x.BigEndian = BigEndianCheckBox.Checked); } }
private void AddCheat_Click(object sender, EventArgs e) { if (Global.Emulator is LibsnesCore) { string name; var address = 0; var value = 0; if (!string.IsNullOrWhiteSpace(CheatNameBox.Text)) { name = CheatNameBox.Text; } else { _processing = true; GGCodeMaskBox.TextMaskFormat = MaskFormat.IncludeLiterals; name = GGCodeMaskBox.Text; GGCodeMaskBox.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; _processing = false; } if (!string.IsNullOrWhiteSpace(AddressBox.Text)) { address = int.Parse(AddressBox.Text, NumberStyles.HexNumber) + 0x8000; } if (!string.IsNullOrWhiteSpace(ValueBox.Text)) { value = byte.Parse(ValueBox.Text, NumberStyles.HexNumber); } var watch = Watch.GenerateWatch( Global.Emulator.MemoryDomains["BUS"], address, Watch.WatchSize.Byte, Watch.DisplayType.Hex, name, bigEndian: false ); Global.CheatList.Add(new Cheat( watch, value )); } }
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() )); } }
private void AddCheatButton_Click(object sender, EventArgs e) { string name; var address = 0; var value = 0; if (!string.IsNullOrWhiteSpace(cheatname.Text)) { name = cheatname.Text; } else { _processing = true; GGCodeMaskBox.TextMaskFormat = MaskFormat.IncludeLiterals; name = GGCodeMaskBox.Text; GGCodeMaskBox.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; _processing = false; } if (!string.IsNullOrWhiteSpace(AddressBox.Text)) { address = int.Parse(AddressBox.Text, NumberStyles.HexNumber); } if (!string.IsNullOrWhiteSpace(ValueBox.Text)) { value = ValueBox.ToRawInt() ?? 0; } var watch = Watch.GenerateWatch( MemoryDomains["MD CART"], address, Watch.WatchSize.Word, Watch.DisplayType.Hex, name, true ); Global.CheatList.Add(new Cheat( watch, value )); }
/// <summary> /// Restart is called the first time you call the form /// but also when you start playing a movie /// </summary> public void Restart() { //set a client padding ClientApi.SetExtraPadding(50, 50); if (Global.Game.Name != "Null") { //first initialization of WatchList if (_watches == null) { _watches = new WatchList(_memoryDomains, _emu.SystemId ?? string.Empty); //Create some watch Watch myFirstWatch = Watch.GenerateWatch(_memoryDomains.MainMemory, 0x40, WatchSize.Byte, BizHawk.Client.Common.DisplayType.Hex, true); Watch mySecondWatch = Watch.GenerateWatch(_memoryDomains.MainMemory, 0x50, WatchSize.Word, BizHawk.Client.Common.DisplayType.Unsigned, true); Watch myThirdWatch = Watch.GenerateWatch(_memoryDomains.MainMemory, 0x60, WatchSize.DWord, BizHawk.Client.Common.DisplayType.Hex, true); //add them into the list _watches.Add(myFirstWatch); _watches.Add(mySecondWatch); _watches.Add(myThirdWatch); label_Game.Text = string.Format("You're playing {0}", Global.Game.Name); label_GameHash.Text = string.Format("Hash: {0}", Global.Game.Hash); } //refresh it else { _watches.RefreshDomains(_memoryDomains); label_Game.Text = string.Format("You're playing {0}", Global.Game.Name); label_GameHash.Text = string.Format("Hash: {0}", Global.Game.Hash); } } else { label_Game.Text = string.Format("You aren't playing to anything"); label_GameHash.Text = string.Empty; } }
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); } }