Exemple #1
0
        private void SetProperties()
        {
            if (_address.HasValue)
            {
                AddressBox.SetFromRawInt(_address.Value);
            }
            else
            {
                AddressBox.ResetText();
            }

            if (_compare.HasValue)
            {
                CompareBox.SetFromRawInt(_compare.Value);
            }
            else
            {
                CompareBox.ResetText();
            }

            if (_value.HasValue)
            {
                ValueBox.SetFromRawInt(_value.Value);
            }
            else
            {
                ValueBox.ResetText();
            }
        }
Exemple #2
0
 public NESGameGenie()
 {
     InitializeComponent();
     AddressBox.SetHexProperties(0x10000);
     ValueBox.SetHexProperties(0x100);
     CompareBox.SetHexProperties(0x100);
 }
Exemple #3
0
 private void EncodeGameGenie()
 {
     _address           = AddressBox.ToRawInt();
     _value             = ValueBox.ToRawInt();
     _compare           = CompareBox.ToRawInt();
     GameGenieCode.Text = new NESGameGenieEncoder(_address.Value, _value.Value, _compare).Encode();
 }
Exemple #4
0
        private void ResetBtn_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(BaseBox.Text))
            {
                if (!BaseBox.Items.Contains(BaseBox.Text))
                {
                    BaseBox.Items.Add(BaseBox.Text);
                }
            }

            if (!string.IsNullOrEmpty(CompareBox.Text))
            {
                if (!BaseBox.Items.Contains(BaseBox.Text))
                {
                    BaseBox.Items.Add(CompareBox.Text);
                }
            }

            BaseBox.SelectedText = "";
            CompareBox.Clear();
            DifferenceBox.Clear();
            HexBox.Clear();
            HexEscapedBox.Clear();
            ByteArrayBox.Clear();
            MaskBox.Clear();

            StatusLbl.Text      = "Awaiting input...";
            StatusLbl.ForeColor = BlueColor;
            FirstScan           = true;
        }
Exemple #5
0
        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);
            }
        }
Exemple #6
0
 public NESGameGenie()
 {
     InitializeComponent();
     Closing += (o, e) =>
     {
         Global.Config.NesGGSettings.Wndx = Location.X;
         Global.Config.NesGGSettings.Wndy = Location.Y;
     };
     TopMost = Global.Config.NesGGSettings.TopMost;
     AddressBox.SetHexProperties(0x10000);
     ValueBox.SetHexProperties(0x100);
     CompareBox.SetHexProperties(0x100);
 }
Exemple #7
0
        private void SwapBtn_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(BaseBox.Text))
            {
                if (!BaseBox.Items.Contains(BaseBox.Text))
                {
                    BaseBox.Items.Add(BaseBox.Text);
                }
            }

            BaseBox.Text = CompareBox.Text;
            CompareBox.Clear();
        }
Exemple #8
0
        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()
                                         ));
            }
        }
Exemple #9
0
        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);
        }
Exemple #10
0
        private void SetFormToDefault()
        {
            _loading = true;
            SetSizeSelected(WatchSize.Byte);
            PopulateTypeDropdown();

            NameBox.Text = "";

            if (MemoryDomains != null)
            {
                AddressBox.SetHexProperties(MemoryDomains.SystemBus.Size);
            }

            ValueBox.ByteSize       =
                CompareBox.ByteSize =
                    WatchSize.Byte;

            ValueBox.Type       =
                CompareBox.Type =
                    DisplayType.Hex;

            ValueBox.ResetText();
            CompareBox.ResetText();

            ValueHexIndLabel.Text       =
                CompareHexIndLabel.Text =
                    HexInd;

            BigEndianCheckBox.Checked = false;

            SetTypeSelected(DisplayType.Hex);

            CheckFormState();
            CompareBox.Text = "";             // TODO: A needed hack until WatchValueBox.ToRawInt() becomes nullable
            _loading        = false;
        }
Exemple #11
0
        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);
            }
        }