Exemplo n.º 1
0
        private void btnLoadCorrupt_Click(object sender, EventArgs e)
        {
            string saveStateWord = "Savestate";

            object renameSaveStateWord = AllSpec.VanguardSpec[VSPEC.RENAME_SAVESTATE];

            if (renameSaveStateWord != null && renameSaveStateWord is string s)
            {
                saveStateWord = s;
            }

            try
            {
                btnLoadCorrupt.Enabled = false;
                btnSendTo.Enabled      = false;
                btnJustCorrupt.Enabled = false;

                StashKey newSk = null;
                if (sk == null)
                {
                    StashKey psk = StockpileManager_UISide.CurrentSavestateStashKey;
                    if (psk == null)
                    {
                        MessageBox.Show(
                            $"Could not perform the CORRUPT action\n\nEither no {saveStateWord} Box was selected in the {saveStateWord} Manager\nor the {saveStateWord} Box itself is empty.");
                        return;
                    }

                    newSk = new StashKey(CorruptCore.RtcCore.GetRandomKey(), psk.ParentKey, null)
                    {
                        RomFilename   = psk.RomFilename,
                        SystemName    = psk.SystemName,
                        SystemCore    = psk.SystemCore,
                        GameName      = psk.GameName,
                        SyncSettings  = psk.SyncSettings,
                        StateLocation = psk.StateLocation
                    };
                }
                else
                {
                    newSk = (StashKey)sk.Clone();
                }

                BlastLayer bl = GenerateBlastLayers(true, true);
                if (bl == null)
                {
                    return;
                }

                newSk.BlastLayer = bl;
            }
            finally
            {
                btnLoadCorrupt.Enabled = true;
                btnSendTo.Enabled      = true;
                btnJustCorrupt.Enabled = true;
            }
        }
Exemplo n.º 2
0
        private void btnLoadCorrupt_Click(object sender, EventArgs e)
        {
            BlastLayer bl = new BlastLayer();

            foreach (var item in lbBlastLayer.Items)
            {
                BlastUnit bu = (item as BlastUnit);
                if (bu.IsEnabled)
                {
                    bl.Layer.Add(bu);
                }
            }

            StashKey newSk = (StashKey)sk.Clone();

            newSk.BlastLayer = bl;
            WGH_Core.RestoreTarget();
            newSk.Run();
            WGH_Executor.Execute();
        }
Exemplo n.º 3
0
        public void LoadStashkey(StashKey _sk)
        {
            if (_sk == null)
            {
                return;
            }

            //lbBlastLayer.Items.Clear();
            sk = (StashKey)_sk.Clone();

            lbBlastLayer.DataSource = sk.BlastLayer.Layer;

            //foreach (var item in sk.blastlayer.Layer)
            //	lbBlastLayer.Items.Add(item);
            RefreshBlastLayer();
            this.Show();
        }
Exemplo n.º 4
0
        public void LoadStashkey(StashKey _sk)
        {
            if (_sk == null)
            {
                return;
            }

            if (!RefreshDomains())
            {
                return;
            }

            sk            = (StashKey)_sk.Clone();
            sk.BlastLayer = new BlastLayer();

            AddDefaultRow();
            PopulateModeCombobox(dgvBlastGenerator.Rows[0]);
            OpenedFromBlastEditor = true;
            btnSendTo.Text        = "Send to Blast Editor";
            initialized           = true;

            this.Show();
            this.BringToFront();
        }
Exemplo n.º 5
0
        private void btnRerollInject_Click(object sender, EventArgs e)
        {
            if (WGH_Core.currentMemoryInterface == null)
            {
                MessageBox.Show("No target is loaded");
                return;
            }

            TerminateIfNeeded();

            StashKey sk = null;


            if (lbStashHistory.SelectedIndex != -1)
            {
                sk = (StashKey)lbStashHistory.SelectedItem;
            }
            else if (lbStockpile.SelectedIndex != -1)
            {
                sk = (StashKey)lbStockpile.SelectedItem;
            }

            if (sk != null)
            {
                StashKey newSk = (StashKey)sk.Clone();
                newSk.Key   = WGH_Core.GetRandomKey();
                newSk.Alias = null;

                WGH_Core.ghForm.DontLoadSelectedStash = true;
                WGH_Core.ghForm.lbStashHistory.Items.Add(newSk);
                WGH_Core.ghForm.lbStashHistory.ClearSelected();
                WGH_Core.ghForm.lbStashHistory.SelectedIndex = WGH_Core.ghForm.lbStashHistory.Items.Count - 1;
                WGH_Core.ghForm.lbStockpile.ClearSelected();


                //TODO: Refactor this properly instead of as a hacky mess
                foreach (BlastUnit bu in newSk.BlastLayer.Layer)
                {
                    var bb = (bu as BlastByte);
                    var bv = (bu as BlastVector);
                    //BAD HACK. USE THIS TO DECTECT IF VECTOR. SORRY I DIDN'T KNOW WHERE TO REFACTOR THIS -NARRY
                    if (bb != null)
                    {
                        if (bb.Type == BlastByteType.SET)
                        {
                            bb.Value = WGH_Core.RND.Next(0, 255);
                        }
                        else if (bb.Type == BlastByteType.ADD || bb.Type == BlastByteType.SUBSTRACT)
                        {
                            int result = WGH_Core.RND.Next(1, 3);
                            switch (result)
                            {
                            case 1:
                                bb.Type = BlastByteType.ADD;
                                break;

                            case 2:
                                bb.Type = BlastByteType.SUBSTRACT;
                                break;
                            }
                        }
                    }
                    if (bv != null)
                    {
                        bv.Values = WGH_VectorEngine.getRandomConstant(WGH_VectorEngine.valueList);
                    }
                }

                WGH_Core.RestoreTarget();

                newSk.Run();
                WGH_Executor.Execute();
            }
        }