Exemple #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();
        }
Exemple #2
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();
        }
Exemple #3
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();
        }
Exemple #4
0
 private void btnRefreshListsFromFile_Click(object sender, EventArgs e)
 {
     UICore.LoadLists(RtcCore.listsDir);
     UICore.LoadLists(Path.Combine(RtcCore.EmuDir, "LISTS"));
 }
Exemple #5
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;
            }
        }