Example #1
0
        private void btnRefreshVmdFiles_Click(object sender, EventArgs e)
        {
            CorruptCore.Filtering.ResetLoadedListsInUI();

            //reload lists
            UICore.LoadLists(RtcCore.listsDir);
            UICore.LoadLists(Path.Combine(RtcCore.EmuDir, "LISTS"));

            RefreshLists();
        }
        private void RTC_BlastGeneratorForm_Load(object sender, EventArgs e)
        {
            dgvBlastGenerator.MouseClick           += dgvBlastGenerator_MouseClick;
            dgvBlastGenerator.CellValueChanged     += dgvBlastGenerator_CellValueChanged;
            dgvBlastGenerator.CellClick            += dgvBlastGenerator_CellClick;
            dgvBlastGenerator.CellMouseDoubleClick += DgvBlastGenerator_CellMouseDoubleClick;

            UICore.SetRTCColor(UICore.GeneralColor, this);
            getAllControls(this);
        }
Example #3
0
        private async void loadSavestateList(bool import = false, string fileName = null)
        {
            if (fileName == null)
            {
                OpenFileDialog ofd = new OpenFileDialog
                {
                    DefaultExt       = "ssk",
                    Title            = "Open Savestate Keys File",
                    Filter           = "SSK files|*.ssk",
                    RestoreDirectory = true
                };
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    fileName = ofd.FileName;
                }
                else
                {
                    return;
                }
            }
            if (!File.Exists(fileName))
            {
                MessageBox.Show("The Savestate Keys file wasn't found");
                return;
            }

            var ghForm = UI_CanvasForm.GetExtraForm("Glitch Harvester");

            try
            {
                //We do this here and invoke because our unlock runs at the end of the awaited method, but there's a chance an error occurs
                //Thus, we want this to happen within the try block
                SyncObjectSingleton.FormExecute(() =>
                {
                    UICore.LockInterface(false, true);
                    S.GET <UI_SaveProgress_Form>().Dock = DockStyle.Fill;
                    ghForm?.OpenSubForm(S.GET <UI_SaveProgress_Form>());
                });

                await Task.Run(() =>
                {
                    loadSSK(import, fileName);
                });
            }
            finally
            {
                SyncObjectSingleton.FormExecute(() =>
                {
                    ghForm?.CloseSubForm();
                    UICore.UnlockInterface();
                });
            }
        }
        private async void LoadStockpile(string filename)
        {
            if (UnsavedEdits && MessageBox.Show("You have unsaved edits in the Glitch Harvester Stockpile. \n\n Are you sure you want to load without saving?",
                                                "Unsaved edits in Stockpile", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            var ghForm = UI_CanvasForm.GetExtraForm("Glitch Harvester");

            try
            {
                //We do this here and invoke because our unlock runs at the end of the awaited method, but there's a chance an error occurs
                //Thus, we want this to happen within the try block
                SyncObjectSingleton.FormExecute(() =>
                {
                    UICore.LockInterface(false, true);
                    S.GET <UI_SaveProgress_Form>().Dock = DockStyle.Fill;
                    ghForm?.OpenSubForm(S.GET <UI_SaveProgress_Form>());
                });

                await Task.Run(() =>
                {
                    if (Stockpile.Load(dgvStockpile, filename))
                    {
                        SyncObjectSingleton.FormExecute(() =>
                        {
                            btnSaveStockpile.Enabled = true;
                            RefreshNoteIcons();
                        });
                    }

                    SyncObjectSingleton.FormExecute(() =>
                    {
                        S.GET <RTC_StockpilePlayer_Form>().dgvStockpile.Rows.Clear();

                        dgvStockpile.ClearSelection();
                        StockpileManager_UISide.StockpileChanged();

                        UnsavedEdits = false;
                    });
                });
            }
            finally
            {
                SyncObjectSingleton.FormExecute(() =>
                {
                    ghForm?.CloseSubForm();
                    UICore.UnlockInterface();
                });
            }
        }
Example #5
0
        private async void LoadStockpile(string fileName)
        {
            try
            {
                //We do this here and invoke because our unlock runs at the end of the awaited method, but there's a chance an error occurs
                //Thus, we want this to happen within the try block
                UICore.SetHotkeyTimer(false);
                UICore.LockInterface(false, true);
                S.GET <UI_SaveProgress_Form>().Dock = DockStyle.Fill;
                UI_CoreForm.cfForm?.OpenSubForm(S.GET <UI_SaveProgress_Form>());

                StockpileManager_UISide.ClearCurrentStockpile();

                //Clear out the DGVs
                S.GET <RTC_StockpileManager_Form>().dgvStockpile.Rows.Clear(); // Clear the stockpile manager
                dgvStockpile.Rows.Clear();                                     // Clear the stockpile player

                var r = await Task.Run(() => Stockpile.Load(fileName));

                if (r.Failed)
                {
                    MessageBox.Show($"Loading the stockpile failed!\n" +
                                    $"{r.GetErrorsFormatted()}");
                }
                else
                {
                    var sks = r.Result;
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        foreach (StashKey key in sks.StashKeys) //Populate the dgv
                        {
                            dgvStockpile?.Rows.Add(key, key.GameName, key.SystemName, key.SystemCore, key.Note);
                        }
                    });
                }

                List <StashKey> keys = dgvStockpile.Rows.Cast <DataGridViewRow>().Select(x => (StashKey)x.Cells["Item"].Value).ToList();
                foreach (var sk in keys)
                {
                    StockpileManager_UISide.CheckAndFixMissingReference(sk, false, keys);
                }

                dgvStockpile.ClearSelection();
                RefreshNoteIcons();
            }
            finally
            {
                UI_CoreForm.cfForm?.CloseSubForm();
                UICore.UnlockInterface();
                UICore.SetHotkeyTimer(true);
            }
        }
Example #6
0
        public UI_CanvasForm(bool extraForm = false)
        {
            InitializeComponent();

            UICore.SetRTCColor(UICore.GeneralColor, this);

            if (!extraForm)
            {
                mainForm   = this;
                spacerSize = pnScale.Location.X;
                tileSize   = pnScale.Size.Width;
                Controls.Remove(pnScale);
            }
        }
Example #7
0
        private void UI_CoreForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (S.GET <RTC_StockpileManager_Form>().UnsavedEdits&& !UICore.isClosing && MessageBox.Show("You have unsaved edits in the Glitch Harvester Stockpile. \n\n Are you sure you want to close RTC without saving?", "Unsaved edits in Stockpile", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                e.Cancel = true;
                return;
            }

            LocalNetCoreRouter.Route(NetcoreCommands.VANGUARD, NetcoreCommands.REMOTE_EVENT_CLOSEEMULATOR);

            //Sleep to make sure the message is sent
            System.Threading.Thread.Sleep(500);

            UICore.CloseAllRtcForms();
        }
Example #8
0
        //public void BlockView() => (this as IBlockable)?.BlockView();
        //public void UnblockView() => (this as IBlockable)?.UnblockView();

        public static void loadTileFormExtraWindow(CanvasGrid canvasGrid, string WindowHeader, bool silent = false)
        {
            UI_CanvasForm extraForm;

            if (allExtraForms.ContainsKey(WindowHeader))
            {
                extraForm = allExtraForms[WindowHeader];

                foreach (Control ctr in extraForm?.Controls)
                {
                    if (ctr is UI_ComponentFormTile cft)
                    {
                        cft.ReAnchorToPanel();
                    }
                }
            }
            else
            {
                extraForm = new UI_CanvasForm(true);
                allExtraForms[WindowHeader] = extraForm;
                extraForms.Add(extraForm);
            }

            extraForm.Controls.Clear();
            extraForm.Text = WindowHeader;

            UICore.registerFormEvents(extraForm);
            UICore.registerHotkeyBlacklistControls(extraForm);
            loadTileForm(extraForm, canvasGrid);

            if (canvasGrid.isResizable)
            {
                extraForm.MaximizeBox     = true;
                extraForm.FormBorderStyle = FormBorderStyle.Sizable;
            }
            else
            {
                extraForm.MaximizeBox     = false;
                extraForm.FormBorderStyle = FormBorderStyle.FixedSingle;
            }


            if (!silent)
            {
                extraForm.Show();
                extraForm.Focus();
            }
        }
Example #9
0
        public RTC_SelectBox_Form(ComponentForm[] _childForms)
        {
            InitializeComponent();

            UICore.SetRTCColor(UICore.GeneralColor, this);

            childForms = _childForms;

            cbSelectBox.DisplayMember = "text";
            cbSelectBox.ValueMember   = "value";

            foreach (var item in childForms)
            {
                cbSelectBox.Items.Add(new { text = item.Text, value = item });
            }
        }
Example #10
0
        private async void btnSaveSavestateList_Click(object sender, EventArgs e)
        {
            string         filename;
            SaveFileDialog saveFileDialog1 = new SaveFileDialog
            {
                DefaultExt       = "ssk",
                Title            = "Savestate Keys File",
                Filter           = "SSK files|*.ssk",
                RestoreDirectory = true
            };

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                filename = saveFileDialog1.FileName;
            }
            else
            {
                return;
            }

            var ghForm = UI_CanvasForm.GetExtraForm("Glitch Harvester");

            try
            {
                //We do this here and invoke because our unlock runs at the end of the awaited method, but there's a chance an error occurs
                //Thus, we want this to happen within the try block
                SyncObjectSingleton.FormExecute(() =>
                {
                    UICore.LockInterface(false, true);
                    S.GET <UI_SaveProgress_Form>().Dock = DockStyle.Fill;
                    ghForm?.OpenSubForm(S.GET <UI_SaveProgress_Form>());
                });

                await Task.Run(() =>
                {
                    saveSSK(filename);
                });
            }
            finally
            {
                SyncObjectSingleton.FormExecute(() =>
                {
                    ghForm?.CloseSubForm();
                    UICore.UnlockInterface();
                });
            }
        }
        private async void btnImportStockpile_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog
            {
                DefaultExt       = "*",
                Title            = "Select stockpile to import",
                Filter           = "Any file|*.sks",
                RestoreDirectory = true
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                var ghForm = UI_CanvasForm.GetExtraForm("Glitch Harvester");
                try
                {
                    UICore.SetHotkeyTimer(false);
                    //We do this here and invoke because our unlock runs at the end of the awaited method, but there's a chance an error occurs
                    //Thus, we want this to happen within the try block
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        UICore.LockInterface(false, true);
                        S.GET <UI_SaveProgress_Form>().Dock = DockStyle.Fill;
                        ghForm?.OpenSubForm(S.GET <UI_SaveProgress_Form>());
                    });

                    await Task.Run(() =>
                    {
                        if (Stockpile.Import(ofd.FileName, dgvStockpile))
                        {
                            UnsavedEdits = true;
                        }
                    });
                }
                finally
                {
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        ghForm?.CloseSubForm();
                        UICore.UnlockInterface();
                        UICore.SetHotkeyTimer(true);
                        RefreshNoteIcons();
                    });
                }
            }
        }
Example #12
0
        private void btnLoadVmd_Click(object sender, EventArgs e)
        {
            if (lbKnownLists.SelectedIndex == -1)
            {
                return;
            }

            foreach (var item in lbKnownLists.SelectedItems)
            {
                string listName   = item.ToString();
                bool   isDisabled = listName.Contains("[DISABLED] ");

                string cleanListName = listName.Replace("[DISABLED] ", "$");
                if (cleanListName[0] == '$')
                {
                    cleanListName = cleanListName.Substring(1);
                }

                string pathDisabled = Path.Combine(RtcCore.listsDir, "$" + cleanListName);
                string pathEnabled  = Path.Combine(RtcCore.listsDir, cleanListName);

                if (btnEnableDisableList.Text.Contains("Disable"))
                {
                    if (!isDisabled)
                    {
                        File.Move(pathEnabled, pathDisabled);
                    }
                }
                else //button says enable
                {
                    if (isDisabled)
                    {
                        File.Move(pathDisabled, pathEnabled);
                    }
                }
            }

            CorruptCore.Filtering.ResetLoadedListsInUI();

            //reload lists
            UICore.LoadLists(RtcCore.listsDir);
            UICore.LoadLists(Path.Combine(RtcCore.EmuDir, "LISTS"));

            RefreshLists();
        }
Example #13
0
        private void UI_CoreForm_Load(object sender, EventArgs e)
        {
            btnLogo.Text = "RTCV " + CorruptCore.RtcCore.RtcVersion;

            if (!NetCore.Params.IsParamSet("DISCLAIMER_READ"))
            {
                string disclaimer = @"Welcome to the Real-Time Corruptor
Version [ver]

Disclaimer:
This program comes with absolutely ZERO warranty.
You may use it at your own risk.

RTC is distributed under an MIT License.
Detailed information about other licenses available in the
respective Vanguard implementation folders and the RTC folder.

Known facts(and warnings):
- Can generate incredible amounts of flashing and noise
- Can cause windows to BSOD (extremely rarely)
- Can write a significant amount of data to your hard drive depending on usage

This message only appears once.";

                string disclaimerPath = Path.Combine(CorruptCore.RtcCore.RtcDir, "LICENSES", "DISCLAIMER.TXT");

                //Use the text file if it exists
                if (File.Exists(disclaimerPath))
                {
                    disclaimer = File.ReadAllText(disclaimerPath);
                }

                MessageBox.Show(disclaimer.Replace("[ver]", CorruptCore.RtcCore.RtcVersion), "RTC", MessageBoxButtons.OK, MessageBoxIcon.Information);
                NetCore.Params.SetParam("DISCLAIMER_READ");

                NetCore.Params.SetParam("COMPRESS_STOCKPILE");       //Default param
                NetCore.Params.SetParam("INCLUDE_REFERENCED_FILES"); //Default param
            }

            CorruptCore.RtcCore.DownloadProblematicProcesses();

            UICore.LoadLists(CorruptCore.RtcCore.listsDir);
            //UI_DefaultGrids.engineConfig.LoadToMain();
        }
        private async void loadStockpile(string fileName)
        {
            try
            {
                //We do this here and invoke because our unlock runs at the end of the awaited method, but there's a chance an error occurs
                //Thus, we want this to happen within the try block
                SyncObjectSingleton.FormExecute(() =>
                {
                    UICore.LockInterface(false, true);
                    S.GET <UI_SaveProgress_Form>().Dock = DockStyle.Fill;
                    UI_CoreForm.cfForm?.OpenSubForm(S.GET <UI_SaveProgress_Form>());
                });

                await Task.Run(() =>
                {
                    if (Stockpile.Load(dgvStockpile, fileName))
                    {
                        SyncObjectSingleton.FormExecute(() => S.GET <RTC_StockpileManager_Form>().dgvStockpile.Rows.Clear());
                    }

                    SyncObjectSingleton.FormExecute(() =>
                    {
                        List <StashKey> keys = dgvStockpile.Rows.Cast <DataGridViewRow>().Select(x => (StashKey)x.Cells["Item"].Value).ToList();
                        foreach (var sk in keys)
                        {
                            StockpileManager_UISide.CheckAndFixMissingReference(sk, false, keys);
                        }

                        dgvStockpile.ClearSelection();
                        RefreshNoteIcons();
                    });
                });
            }
            finally
            {
                SyncObjectSingleton.FormExecute(() =>
                {
                    UI_CoreForm.cfForm?.CloseSubForm();
                    UICore.UnlockInterface();
                });
            }
        }
Example #15
0
        private void NetCoreSpec_ServerConnectionLost(object sender, EventArgs e)
        {
            UIConnector.ConnectionLostLockout.WaitOne();
            Console.WriteLine("Thread id {0} got Mutex...  (specconnectionlost)", System.Threading.Thread.CurrentThread.ManagedThreadId);

            if (UICore.isClosing || UICore.FirstConnect)
            {
                return;
            }
            SyncObjectSingleton.FormExecute(() =>
            {
                if (S.GET <RTC_ConnectionStatus_Form>() != null && !S.GET <RTC_ConnectionStatus_Form>()
                    .IsDisposed)
                {
                    S.GET <RTC_ConnectionStatus_Form>()
                    .lbConnectionStatus.Text =
                        $"{(string) AllSpec.VanguardSpec?[VSPEC.NAME] ?? "Vanguard"} connection timed out";

                    UICore.LockInterface();
                    UI_DefaultGrids.connectionStatus.LoadToMain();
                }

                S.GET <RTC_VmdAct_Form>()
                .cbAutoAddDump.Checked = false;
                GameProtection.WasAutoCorruptRunning = CorruptCore.RtcCore.AutoCorrupt;
                S.GET <UI_CoreForm>().AutoCorrupt    = false;
            });
            GameProtection.Stop(false);

            if (S.GET <UI_CoreForm>()
                .cbUseAutoKillSwitch.Checked&& AllSpec.VanguardSpec != null)
            {
                AutoKillSwitch.KillEmulator();
            }

            UIConnector.ConnectionLostLockout.ReleaseMutex();
            Console.WriteLine("Thread id {0} released Mutex (specconnectionlost)...", Thread.CurrentThread.ManagedThreadId);
        }
Example #16
0
        public UI_ShadowPanel(UI_CanvasForm _parentForm, ISubForm reqForm)
        {
            InitializeComponent();
            blockerForm = new Form
            {
                ControlBox      = false,
                MinimizeBox     = false,
                FormBorderStyle = System.Windows.Forms.FormBorderStyle.None,
                Text            = "",
                Size            = Size,
                BackColor       = Color.DarkSlateBlue,
                Opacity         = 0.2f
            };

            UICore.SetRTCColor(UICore.GeneralColor, this);

            parentForm = _parentForm;
            UpdateBackground();

            subForm = (Form)reqForm;

            UpdateSubForm();
        }
Example #17
0
 private void btnChangeRTCColor_Click(object sender, EventArgs e)
 {
     UICore.SelectRTCColor();
 }
Example #18
0
        public static void SetRTCColor(Color color, Control ctr = null)
        {
            HashSet <Control> allControls = new HashSet <Control>();

            if (ctr == null)
            {
                foreach (Form targetForm in UICore.AllColorizedSingletons())
                {
                    if (targetForm != null)
                    {
                        foreach (var c in targetForm.Controls.getControlsWithTag())
                        {
                            allControls.Add(c);
                        }
                        allControls.Add(targetForm);
                    }
                }

                //Get the extraforms
                foreach (UI_CanvasForm targetForm in UI_CanvasForm.extraForms)
                {
                    foreach (var c in targetForm.Controls.getControlsWithTag())
                    {
                        allControls.Add(c);
                    }
                    allControls.Add(targetForm);
                }

                //We have to manually add the etform because it's not singleton, not an extraForm, and not owned by any specific form
                //Todo - Refactor this so we don't need to add it separately
                if (mtForm != null)
                {
                    foreach (var c in mtForm.Controls.getControlsWithTag())
                    {
                        allControls.Add(c);
                    }
                    allControls.Add(mtForm);
                }
            }
            else if (ctr is Form || ctr is UserControl)
            {
                foreach (var c in ctr.Controls.getControlsWithTag())
                {
                    allControls.Add(c);
                }
                allControls.Add(ctr);
            }
            else if (ctr is Form)
            {
                allControls.Add(ctr);
            }

            float generalDarken = -0.50f;
            float light1        = 0.10f;
            float light2        = 0.45f;
            float dark1         = -0.20f;
            float dark2         = -0.35f;
            float dark3         = -0.50f;
            float dark4         = -0.85f;

            color = color.ChangeColorBrightness(generalDarken);

            Light1Color = color.ChangeColorBrightness(light1);
            Light2Color = color.ChangeColorBrightness(light2);
            NormalColor = color;
            Dark1Color  = color.ChangeColorBrightness(dark1);
            Dark2Color  = color.ChangeColorBrightness(dark2);
            Dark3Color  = color.ChangeColorBrightness(dark3);
            Dark4Color  = color.ChangeColorBrightness(dark4);

            var tag2ColorDico = new Dictionary <string, Color>
            {
                { "color:light2", Light2Color },
                { "color:light1", Light1Color },
                { "color:normal", NormalColor },
                { "color:dark1", Dark1Color },
                { "color:dark2", Dark2Color },
                { "color:dark3", Dark3Color },
                { "color:dark4", Dark4Color }
            };

            foreach (var c in allControls)
            {
                var tag = c.Tag?.ToString().Split(' ');

                if (tag == null || tag.Length == 0)
                {
                    continue;
                }

                //Snag the tag and look for the color.
                var ctag = tag.FirstOrDefault(x => x.Contains("color:"));

                //We didn't find a valid color
                if (ctag == null || !tag2ColorDico.TryGetValue(ctag, out Color _color))
                {
                    continue;
                }

                if (c is Label l && l.BackColor != Color.FromArgb(30, 31, 32))
                {
                    c.ForeColor = _color;
                }
Example #19
0
        private static void OnMessageReceived(object sender, NetCoreEventArgs e)
        {
            try
            {
                var message         = e.message;
                var simpleMessage   = message as NetCoreSimpleMessage;
                var advancedMessage = message as NetCoreAdvancedMessage;

                switch (message.Type) //Handle received messages here
                {
                case REMOTE_PUSHVANGUARDSPEC:
                {
                    if (!CorruptCore.RtcCore.Attached)
                    {
                        RTCV.NetCore.AllSpec.VanguardSpec = new FullSpec((PartialSpec)advancedMessage.objectValue, !CorruptCore.RtcCore.Attached);
                    }

                    e.setReturnValue(true);

                    //Push the UI and CorruptCore spec (since we're master)
                    LocalNetCoreRouter.Route(NetcoreCommands.CORRUPTCORE, NetcoreCommands.REMOTE_PUSHUISPEC, RTCV.NetCore.AllSpec.UISpec.GetPartialSpec(), true);
                    LocalNetCoreRouter.Route(NetcoreCommands.CORRUPTCORE, NetcoreCommands.REMOTE_PUSHCORRUPTCORESPEC, RTCV.NetCore.AllSpec.CorruptCoreSpec.GetPartialSpec(), true);

                    SyncObjectSingleton.FormExecute(() =>
                        {
                            S.GET <UI_CoreForm>().pnAutoKillSwitch.Visible  = true;
                            S.GET <UI_CoreForm>().pnCrashProtection.Visible = true;
                        });
                    //Specs are all set up so UI is clear.
                    LocalNetCoreRouter.Route(NetcoreCommands.VANGUARD, NetcoreCommands.REMOTE_ALLSPECSSENT, true);
                }
                break;

                case REMOTE_ALLSPECSSENT:
                    if (UICore.FirstConnect)
                    {
                        UICore.Initialized.WaitOne(10000);
                    }

                    SyncObjectSingleton.FormExecute(() =>
                    {
                        if (UICore.FirstConnect)
                        {
                            lastVanguardClient  = (string)RTCV.NetCore.AllSpec.VanguardSpec?[VSPEC.NAME] ?? "VANGUARD";
                            UICore.FirstConnect = false;

                            //Load plugins on both sides
                            CorruptCore.RtcCore.LoadPlugins();
                            LocalNetCoreRouter.Route(NetcoreCommands.CORRUPTCORE, NetcoreCommands.REMOTE_LOADPLUGINS, true);

                            //Configure the UI based on the vanguard spec
                            UICore.ConfigureUIFromVanguardSpec();

                            S.GET <UI_CoreForm>().Show();

                            //Pull any lists from the vanguard implementation
                            if (RtcCore.EmuDir != null)
                            {
                                UICore.LoadLists(Path.Combine(RtcCore.EmuDir, "LISTS"));
                            }

                            UICore.LoadLists(CorruptCore.RtcCore.listsDir);

                            Panel sidebar = S.GET <UI_CoreForm>().pnSideBar;
                            foreach (Control c in sidebar.Controls)
                            {
                                if (c is Button b)
                                {
                                    if (!b.Text.Contains("Test") && !b.Text.Contains("Custom Layout") && b.ForeColor != Color.OrangeRed)
                                    {
                                        b.Visible = true;
                                    }
                                }
                            }

                            string customLayoutPath = Path.Combine(RTCV.CorruptCore.RtcCore.RtcDir, "CustomLayout.txt");
                            if (File.Exists(customLayoutPath))
                            {
                                S.GET <UI_CoreForm>().btnOpenCustomLayout.Visible = true;
                            }

                            UI_DefaultGrids.engineConfig.LoadToMain();

                            UI_DefaultGrids.glitchHarvester.LoadToNewWindow("Glitch Harvester", true);
                        }
                        else
                        {
                            var clientName = (string)RTCV.NetCore.AllSpec.VanguardSpec?[VSPEC.NAME] ?? "VANGUARD";
                            if (clientName != lastVanguardClient)
                            {
                                MessageBox.Show($"Error: Found {clientName} when previously connected to {lastVanguardClient}.\nPlease restart the RTC to swap clients.");
                                return;
                            }

                            //Push the VMDs since we store them out of spec
                            var vmdProtos = MemoryDomains.VmdPool.Values.Cast <VirtualMemoryDomain>().Select(x => x.Proto).ToArray();
                            LocalNetCoreRouter.Route(NetcoreCommands.CORRUPTCORE, NetcoreCommands.REMOTE_PUSHVMDPROTOS, vmdProtos, true);

                            S.GET <UI_CoreForm>().Show();

                            //Configure the UI based on the vanguard spec
                            UICore.ConfigureUIFromVanguardSpec();

                            //Unblock the controls in the GH
                            S.GET <RTC_GlitchHarvesterBlast_Form>().SetBlastButtonVisibility(true);

                            //Return to the main form. If the form is null for some reason, default to engineconfig
                            if (S.GET <UI_CoreForm>().previousGrid == null)
                            {
                                S.GET <UI_CoreForm>().previousGrid = UI_DefaultGrids.engineConfig;
                            }

                            UICore.UnlockInterface();
                            S.GET <UI_CoreForm>().previousGrid.LoadToMain();
                        }

                        S.GET <UI_CoreForm>().pbAutoKillSwitchTimeout.Value = 0;   //remove this once core form is dead

                        if (!CorruptCore.RtcCore.Attached)
                        {
                            AutoKillSwitch.Enabled = true;
                        }

                        //Restart game protection
                        if (S.GET <UI_CoreForm>().cbUseGameProtection.Checked)
                        {
                            if (CorruptCore.StockpileManager_UISide.BackupedState != null)
                            {
                                CorruptCore.StockpileManager_UISide.BackupedState.Run();
                            }

                            if (CorruptCore.StockpileManager_UISide.BackupedState != null)
                            {
                                S.GET <RTC_MemoryDomains_Form>().RefreshDomainsAndKeepSelected(CorruptCore.StockpileManager_UISide.BackupedState.SelectedDomains.ToArray());
                            }

                            GameProtection.Start();
                            if (GameProtection.WasAutoCorruptRunning)
                            {
                                S.GET <UI_CoreForm>().AutoCorrupt = true;
                            }
                        }

                        S.GET <UI_CoreForm>().Show();

                        if (NetCore.Params.IsParamSet("SIMPLE_MODE"))
                        {
                            bool isSpec = (AllSpec.VanguardSpec[VSPEC.NAME] as string)?.ToUpper().Contains("SPEC") ?? false;

                            if (isSpec)     //Simple Mode cannot run on Stubs
                            {
                                MessageBox.Show("Unfortunately, Simple Mode is not compatible with Stubs. RTC will now switch to Normal Mode.");
                                NetCore.Params.RemoveParam("SIMPLE_MODE");
                            }
                            else
                            {
                                UI_DefaultGrids.simpleMode.LoadToMain();
                                RTC_SimpleMode_Form smForm = S.GET <RTC_SimpleMode_Form>();
                                smForm.EnteringSimpleMode();
                            }
                        }
                    });
                    break;

                case REMOTE_PUSHVANGUARDSPECUPDATE:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        RTCV.NetCore.AllSpec.VanguardSpec?.Update((PartialSpec)advancedMessage.objectValue);
                    });
                    e.setReturnValue(true);
                    break;

                //CorruptCore pushed its spec. Note the false on propogate (since we don't want a recursive loop)
                case REMOTE_PUSHCORRUPTCORESPECUPDATE:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        RTCV.NetCore.AllSpec.CorruptCoreSpec?.Update((PartialSpec)advancedMessage.objectValue, false);
                    });
                    e.setReturnValue(true);
                    break;

                case REMOTE_GENERATEVMDTEXT:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        object[] objs = (object[])advancedMessage.objectValue;
                        string domain = (string)objs[0];
                        string text   = (string)objs[1];

                        var vmdgenerator = S.GET <RTC_VmdGen_Form>();

                        vmdgenerator.btnSelectAll_Click(null, null);

                        var cbitems        = vmdgenerator.cbSelectedMemoryDomain.Items;
                        object domainFound = null;
                        for (int i = 0; i < cbitems.Count; i++)
                        {
                            var item = cbitems[i];

                            if (item.ToString() == domain)
                            {
                                domainFound = item;
                                vmdgenerator.cbSelectedMemoryDomain.SelectedIndex = i;
                                break;
                            }
                        }

                        if (domainFound == null)
                        {
                            throw new Exception($"Domain {domain} could not be selected in the VMD Generator. Aborting procedure.");
                            //return;
                        }

                        vmdgenerator.tbCustomAddresses.Text = text;

                        string value = "";

                        if (RTCV.UI.UI_Extensions.GetInputBox("VMD Generation", "Enter the new VMD name:", ref value) == DialogResult.OK)
                        {
                            if (!string.IsNullOrWhiteSpace(value))
                            {
                                vmdgenerator.tbVmdName.Text = value.Trim();
                            }
                            vmdgenerator.btnGenerateVMD_Click(null, null);
                        }
                    });
                    e.setReturnValue(true);
                    break;

                case REMOTE_EVENT_DOMAINSUPDATED:

                    SyncObjectSingleton.FormExecute(() =>
                    {
                        S.GET <RTC_MemoryDomains_Form>().RefreshDomains();
                        S.GET <RTC_MemoryDomains_Form>().SetMemoryDomainsAllButSelectedDomains(RTCV.NetCore.AllSpec.VanguardSpec[VSPEC.MEMORYDOMAINS_BLACKLISTEDDOMAINS] as string[] ?? new string[] { });
                    });
                    break;

                case REMOTE_GETBLASTGENERATOR_LAYER:

                    SyncObjectSingleton.FormExecute(() =>
                    {
                        e.setReturnValue(S.GET <RTC_BlastGenerator_Form>().GenerateBlastLayers(true, true, false));
                    });
                    break;

                case ERROR_DISABLE_AUTOCORRUPT:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        S.GET <UI_CoreForm>().AutoCorrupt = false;
                    });
                    break;

                case REMOTE_RENDER_DISPLAY:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        S.GET <RTC_GlitchHarvesterBlast_Form>().refreshRenderOutputButton();
                    });
                    break;

                case REMOTE_BACKUPKEY_STASH:
                    if (advancedMessage?.objectValue is StashKey sk)
                    {
                        StockpileManager_UISide.BackupedState = sk;
                        GameProtection.AddBackupState(sk);
                        SyncObjectSingleton.FormExecute(() =>
                        {
                            S.GET <UI_CoreForm>().btnGpJumpBack.Visible = true;
                            S.GET <UI_CoreForm>().btnGpJumpNow.Visible  = true;
                        });
                    }
                    break;

                case KILLSWITCH_PULSE:
                    AutoKillSwitch.Pulse();
                    break;

                case RESET_GAME_PROTECTION_IF_RUNNING:
                    if (GameProtection.isRunning)
                    {
                        SyncObjectSingleton.FormExecute(() =>
                        {
                            S.GET <UI_CoreForm>().cbUseGameProtection.Checked = false;
                            S.GET <UI_CoreForm>().cbUseGameProtection.Checked = true;
                        });
                    }
                    break;

                case REMOTE_DISABLESAVESTATESUPPORT:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        S.GET <RTC_SavestateManager_Form>().DisableFeature();
                        S.GET <UI_CoreForm>().pnCrashProtection.Visible = false;
                    });
                    break;

                case REMOTE_DISABLEGAMEPROTECTIONSUPPORT:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        S.GET <UI_CoreForm>().pnCrashProtection.Visible = false;
                    });
                    break;

                case REMOTE_DISABLEREALTIMESUPPORT:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        Button btnManual = S.GET <UI_CoreForm>().btnManualBlast;
                        if (AllSpec.VanguardSpec[VSPEC.REPLACE_MANUALBLAST_WITH_GHCORRUPT] != null)
                        {
                            btnManual.Text = "  Corrupt";
                        }
                        else
                        {
                            btnManual.Visible = false;
                        }

                        S.GET <UI_CoreForm>().btnAutoCorrupt.Enabled = false;
                        S.GET <UI_CoreForm>().btnAutoCorrupt.Visible = false;
                        S.GET <RTC_GeneralParameters_Form>().multiTB_ErrorDelay.Enabled = false;
                        S.GET <RTC_GlitchHarvesterBlast_Form>().btnSendRaw.Enabled      = false;
                        S.GET <RTC_GlitchHarvesterBlast_Form>().btnBlastToggle.Enabled  = false;

                        S.GET <RTC_CorruptionEngine_Form>().cbSelectedEngine.Items.Remove("Hellgenie Engine");
                        S.GET <RTC_CorruptionEngine_Form>().cbSelectedEngine.Items.Remove("Distortion Engine");
                        S.GET <RTC_CorruptionEngine_Form>().cbSelectedEngine.Items.Remove("Pipe Engine");
                        S.GET <RTC_CorruptionEngine_Form>().cbSelectedEngine.Items.Remove("Freeze Engine");
                    });
                    break;

                case REMOTE_DISABLEKILLSWITCHSUPPORT:
                    SyncObjectSingleton.FormExecute(() =>
                    {
                        S.GET <UI_CoreForm>().pnAutoKillSwitch.Visible    = false;
                        S.GET <UI_CoreForm>().cbUseAutoKillSwitch.Checked = false;
                    });
                    break;
                }
            }
            catch (Exception ex)
            {
                if (CloudDebug.ShowErrorDialog(ex) == DialogResult.Abort)
                {
                    throw new RTCV.NetCore.AbortEverythingException();
                }

                return;
            }
        }
Example #20
0
 private void RTC_AnalyticsToolForm_Load(object sender, EventArgs e)
 {
     UICore.SetRTCColor(UICore.GeneralColor, this);
 }
Example #21
0
        public UI_ComponentFormSubForm()
        {
            InitializeComponent();

            UICore.SetRTCColor(UICore.GeneralColor, this);
        }
Example #22
0
 private void RTC_SettingsHotkeyConfig_Form_Load(object sender, EventArgs e)
 {
     UICore.SetRTCColor(UICore.GeneralColor, this.Parent);
 }
Example #23
0
 private void Button1_Click_1(object sender, EventArgs e)
 {
     UICore.LockInterface();
     UI_DefaultGrids.connectionStatus.LoadToMain();
 }
Example #24
0
 private void RTC_SettingsHotkeyConfig_Form_GotFocus(object sender, EventArgs e)
 {
     UICore.SetHotkeyTimer(false);
     DoFocus();
 }
Example #25
0
 private void btnRefreshListsFromFile_Click(object sender, EventArgs e)
 {
     UICore.LoadLists(RtcCore.listsDir);
     UICore.LoadLists(Path.Combine(RtcCore.EmuDir, "LISTS"));
 }
Example #26
0
 public ColumnSelector()
 {
     InitializeComponent();
     UICore.SetRTCColor(UICore.GeneralColor, this);
     this.FormClosing += this.ColumnSelector_Closing;
 }
Example #27
0
 private void RTC_Intro_Form_Load(object sender, EventArgs e)
 {
     UICore.SetRTCColor(UICore.GeneralColor, this);
 }
Example #28
0
 private void RTC_NewBlastEditorForm_Load(object sender, EventArgs e)
 {
     UICore.SetRTCColor(UICore.GeneralColor, this);
 }