public static Guid HugeOperationStart(string targetAggressiveness = "DISABLED") { RTC_RPC.SendToKillSwitch("FREEZE"); if (RTC_Core.isStandalone) { if (lastNetCoreAggressivity == null) { lastNetCoreAggressivity = RTC_Core.sForm.cbNetCoreCommandTimeout.SelectedIndex; } if (targetAggressiveness == "DISABLED") { RTC_Core.sForm.cbNetCoreCommandTimeout.SelectedIndex = RTC_Core.sForm.cbNetCoreCommandTimeout.Items.Count - 1; } else { RTC_Core.sForm.cbNetCoreCommandTimeout.SelectedIndex = RTC_Core.sForm.cbNetCoreCommandTimeout.Items.Count - 2; } } var token = Guid.NewGuid(); if (lastNetCoreAggressivityGuid == null) { lastNetCoreAggressivityGuid = token; } return(token); }
private void btnCloudSave_Click(object sender, EventArgs e) { RTC_RPC.SendToKillSwitch("FREEZE"); BlastLayer bl; StashKey key; if (lbStashHistory.SelectedIndex != -1) { key = (lbStashHistory.SelectedItem as StashKey); } else if (lbStockpile.SelectedIndex != -1) { key = (lbStockpile.SelectedItem as StashKey); } else { return; } bl = key.blastlayer; bl.CCGD = new CorruptCloudGameData(key); tbCorruptCloudCode.Text = RTC_CorruptCloud.CloudSave(bl); RTC_RPC.SendToKillSwitch("UNFREEZE"); }
public static void Start() { bool Expires = false; DateTime ExpiringDate = DateTime.Parse("2015-01-02"); if (Expires && DateTime.Now > ExpiringDate) { RTC_RPC.SendToKillSwitch("CLOSE"); MessageBox.Show("This version has expired"); GlobalWin.MainForm.Close(); RTC_Core.coreForm.Close(); RTC_Core.ghForm.Close(); RTC_Core.tfForm.Close(); Application.Exit(); return; } //Populating the Params Menu ParamsButtonMenu.Items.Add("Reset RTC Parameters", null, new EventHandler(coreForm.btnReboot_Click)); ParamsButtonMenu.Items.Add("Reset RTC Parameters + Window Parameters", null, new EventHandler(coreForm.btnRebootWindow_Click)); ParamsButtonMenu.Items.Add("Start AutoKillSwitch", null, new EventHandler(coreForm.btnAutoKillSwitch_Click)); ParamsButtonMenu.Items.Add("RTC Factory Clean", null, new EventHandler(coreForm.btnFactoryClean_Click)); //Populating the Easy Mode Menu EasyButtonMenu.Items.Add("Start with current settings", null, new EventHandler(coreForm.btnEasyModeCurrent_Click)); EasyButtonMenu.Items.Add("Start with system template", null, new EventHandler(coreForm.btnEasyModeTemplate_Click)); coreForm.Show(); GlobalWin.MainForm.Focus(); RTC_RPC.Start(); }
public static void Start() { Running = true; time = new System.Windows.Forms.Timer(); time.Interval = 200; time.Tick += new EventHandler(CheckMessages); time.Start(); if (RTC_Hooks.isRemoteRTC) { RTC_RPC.SendToKillSwitch("UNFREEZE"); } else { bridgeThread = new Thread(new ThreadStart(ListenToBridge)); bridgeThread.IsBackground = true; bridgeThread.Start(); pluginThread = new Thread(new ThreadStart(ListenToPlugin)); pluginThread.IsBackground = true; pluginThread.Start(); } }
private void btnActiveTableQuickSave_Click(object sender, EventArgs e) { if (btnActiveTableQuickSave.ForeColor != Color.Silver) { RTC_RPC.SendToKillSwitch("FREEZE"); RTC_FreezeEngine.SaveActiveTable(true); RTC_RPC.SendToKillSwitch("UNFREEZE"); } }
private void btnSaveStockpile_Click(object sender, EventArgs e) { GlobalWin.Sound.StopSound(); RTC_RPC.SendToKillSwitch("FREEZE"); Stockpile sks = new Stockpile(lbStockpile); Stockpile.Save(sks, true); RTC_RPC.SendToKillSwitch("UNFREEZE"); GlobalWin.Sound.StartSound(); }
private void btnActiveTableAddDump_Click(object sender, EventArgs e) { if (!RTC_FreezeEngine.FirstInit) { return; } RTC_RPC.SendToKillSwitch("FREEZE"); RTC_FreezeEngine.AddDump(); RTC_RPC.SendToKillSwitch("UNFREEZE"); }
private void btnActiveTableSaveAs_Click(object sender, EventArgs e) { if (!RTC_FreezeEngine.ActiveTableReady) { return; } RTC_RPC.SendToKillSwitch("FREEZE"); RTC_FreezeEngine.SaveActiveTable(false); RTC_RPC.SendToKillSwitch("UNFREEZE"); }
public static void HugeOperationReset() { RTC_RPC.SendToKillSwitch("UNFREEZE"); if (RTC_Core.isStandalone) { RTC_Core.sForm.cbNetCoreCommandTimeout.SelectedIndex = 0; lastNetCoreAggressivity = null; lastNetCoreAggressivityGuid = null; } }
private void btnActiveTableSubstractFile_Click(object sender, EventArgs e) { if (!RTC_FreezeEngine.FirstInit) { return; } RTC_RPC.SendToKillSwitch("FREEZE"); RTC_FreezeEngine.SubstractActiveTable(); RTC_RPC.SendToKillSwitch("UNFREEZE"); }
private void btnLoadStockpile_Click(object sender, EventArgs e) { try { GlobalWin.Sound.StopSound(); RTC_RPC.SendToKillSwitch("FREEZE"); Stockpile.Load(); } finally { RTC_RPC.SendToKillSwitch("UNFREEZE"); GlobalWin.Sound.StartSound(); } RTC_Restore.SaveRestore(); }
public static void MAINFORM_CLOSING() { RTC_Core.lastOpenRom = null; RTC_Core.AutoCorrupt = false; RTC_Core.coreForm.cbUseTimeStack.Checked = false; RTC_TimeFlow.Stop(); RTC_Restore.SaveRestore(); RTC_RPC.SendToKillSwitch("CLOSE"); ForceCloseTimer = new Timer(); ForceCloseTimer.Interval = 5000; ForceCloseTimer.Tick += new EventHandler(ForceCloseTimer_Tick); ForceCloseTimer.Start(); }
public static void HugeOperationEnd(Guid?operationGuid = null) { RTC_RPC.SendToKillSwitch("UNFREEZE"); if (RTC_Core.isStandalone) { if (operationGuid != null && operationGuid != lastNetCoreAggressivityGuid) { return; } if (lastNetCoreAggressivity != null) { RTC_Core.sForm.cbNetCoreCommandTimeout.SelectedIndex = (int)lastNetCoreAggressivity; lastNetCoreAggressivity = null; lastNetCoreAggressivityGuid = null; } } }
private void btnSaveStockpileAs_Click(object sender, EventArgs e) { if (lbStockpile.Items.Count == 0) { GlobalWin.Sound.StopSound(); MessageBox.Show("You cannot save the Stockpile because it is empty"); GlobalWin.Sound.StartSound(); return; } GlobalWin.Sound.StopSound(); RTC_RPC.SendToKillSwitch("FREEZE"); Stockpile sks = new Stockpile(lbStockpile); Stockpile.Save(sks); RTC_RPC.SendToKillSwitch("UNFREEZE"); GlobalWin.Sound.StartSound(); RTC_Restore.SaveRestore(); }
public static void LOAD_GAME_DONE() { if (!RTC_Core.isLoaded) { return; } if (RTC_Core.currentGameName == lastGameName) { RTC_MemoryZones.RefreshAndKeepDomains(); } RTC_HellgenieEngine.ClearCheats(); //Load Game vars into RTC_Core PathEntry pathEntry = Global.Config.PathEntries[Global.Game.System, "Savestates"] ?? Global.Config.PathEntries[Global.Game.System, "Base"]; RTC_Core.currentGameSystem = RTC_Core.EmuFolderCheck(pathEntry.SystemDisplayName); RTC_Core.currentGameName = PathManager.FilesystemSafeName(Global.Game); RTC_Core.lastOpenRom = GlobalWin.MainForm.CurrentlyOpenRom; RTC_RPC.RefreshPlugin(); if (RTC_Core.currentGameName != lastGameName) { RTC_TimeStack.Reset(); RTC_MemoryZones.AutoSelectDomains(); } if (RTC_MemoryZones.pendingSelectedDomains != null) { RTC_MemoryZones.setSelectedDomains(RTC_MemoryZones.pendingSelectedDomains); RTC_MemoryZones.pendingSelectedDomains = null; } lastGameName = RTC_Core.currentGameName; //RTC_Restore.SaveRestore(); RTC_RPC.SendToKillSwitch("UNFREEZE"); }
private static void initFullMap() { RTC_RPC.SendToKillSwitch("FREEZE"); GlobalWin.Sound.StopSound(); new Thread(() => { Bitmap newMap = new Bitmap(204800, RTC_Core.tfForm.pbFullMap.Height); for (int x = 0; x < newMap.Width; x++) { if (x % 30 == 0) { for (int y = 0; y < newMap.Height; y++) { SafeSetPixel(newMap, x, y, Color.FromArgb(32, 32, 32)); } } } FullMap = newMap; Running = true; } ).Start(); timeGame = 0; LastTimeGame = 0; State = TimeState.Forward; TimeFlowGame.Clear(); UniverseFlow.Clear(); UniverseLayer.Clear(); GlobalWin.Sound.StartSound(); RTC_RPC.SendToKillSwitch("UNFREEZE"); }
private void btnActiveTableLoad_Click(object sender, EventArgs e) { RTC_RPC.SendToKillSwitch("FREEZE"); RTC_FreezeEngine.LoadActiveTable(); RTC_RPC.SendToKillSwitch("UNFREEZE"); }
//This is the entry point of RTC. Without this method, nothing will load. public static void Start(Form _standaloneForm = null) { //Timed releases. Only for exceptionnal cases. bool Expires = false; DateTime ExpiringDate = DateTime.Parse("2017-03-03"); if (Expires && DateTime.Now > ExpiringDate) { RTC_RPC.SendToKillSwitch("CLOSE"); MessageBox.Show("This version has expired"); GlobalWin.MainForm.Close(); RTC_Core.coreForm.Close(); RTC_Core.ghForm.Close(); Application.Exit(); return; } coreForm = new RTC_Core_Form(); ecForm = new RTC_EngineConfig_Form(); spForm = new RTC_StockpilePlayer_Form(); ghForm = new RTC_GlitchHarvester_Form(); sForm = new RTC_Settings_Form(); multiForm = new RTC_Multiplayer_Form(); multipeerpopoutForm = new RTC_MultiPeerPopout_Form(); sbForm = new RTC_StockpileBlastBoard_Form(); beForm = new RTC_BlastEditor_Form(); vmdPoolForm = new RTC_VmdPool_Form(); vmdGenForm = new RTC_VmdGen_Form(); vmdActForm = new RTC_VmdAct_Form(); standaloneForm = _standaloneForm; if (!Directory.Exists(RTC_Core.rtcDir + "\\TEMP\\")) { Directory.CreateDirectory(RTC_Core.rtcDir + "\\TEMP\\"); } if (!Directory.Exists(RTC_Core.rtcDir + "\\TEMP2\\")) { Directory.CreateDirectory(RTC_Core.rtcDir + "\\TEMP2\\"); } if (!Directory.Exists(RTC_Core.rtcDir + "\\TEMP3\\")) { Directory.CreateDirectory(RTC_Core.rtcDir + "\\TEMP3\\"); } if (!Directory.Exists(RTC_Core.rtcDir + "\\TEMP4\\")) { Directory.CreateDirectory(RTC_Core.rtcDir + "\\TEMP4\\"); } //Loading RTC PArams RTC_Params.LoadRTCColor(); RTC_Core.sForm.cbDisableBizhawkOSD.Checked = !RTC_Params.IsParamSet("ENABLE_BIZHAWK_OSD"); RTC_Core.sForm.cbAllowCrossCoreCorruption.Checked = RTC_Params.IsParamSet("ALLOW_CROSS_CORE_CORRUPTION"); //Initiation of loopback TCP, only in DETACHED MODE if (RTC_Hooks.isRemoteRTC || RTC_Core.isStandalone) { RemoteRTC = new RTC_NetCore(); RemoteRTC.port = 42042; RemoteRTC.address = ""; } //Initialize RemoteRTC server if (RTC_Hooks.isRemoteRTC && !RTC_Core.isStandalone) { //Bizhawk has started in REMOTERTC mode, no RTC form will be loaded RemoteRTC.StartNetworking(NetworkSide.CLIENT, true); RemoteRTC.SendCommand(new RTC_Command(CommandType.REMOTE_EVENT_BIZHAWKSTARTED), false, true); } else { //Setup of Detached-exclusive features if (RTC_Core.isStandalone) { coreForm.Text = "RTC : Detached Mode"; if (csForm == null) { csForm = new RTC_ConnectionStatus_Form(); } RTC_Core.coreForm.showPanelForm(csForm); RemoteRTC.ServerStarted += new EventHandler((ob, ev) => { RemoteRTC_SupposedToBeConnected = false; Console.WriteLine("RemoteRTC.ServerStarted"); if (csForm != null && !csForm.IsDisposed) { if (RTC_Core.csForm == null) { csForm = new RTC_ConnectionStatus_Form(); } RTC_Core.coreForm.showPanelForm(csForm); } if (ghForm != null && !ghForm.IsDisposed) { ghForm.pnHideGlitchHarvester.BringToFront(); ghForm.pnHideGlitchHarvester.Show(); } }); RemoteRTC.ServerConnected += new EventHandler((ob, ev) => { RemoteRTC_SupposedToBeConnected = true; Console.WriteLine("RemoteRTC.ServerConnected"); csForm.lbConnectionStatus.Text = "Connection status: Connected"; if (FirstConnection) { FirstConnection = false; coreForm.btnEngineConfig_Click(ob, ev); } else { coreForm.showPanelForm(coreForm.previousForm, false); } ghForm.pnHideGlitchHarvester.Hide(); csForm.btnStartEmuhawkDetached.Text = "Restart BizHawk"; RTC_RPC.Heartbeat = true; RTC_RPC.Freeze = false; }); RemoteRTC.ServerConnectionLost += new EventHandler((ob, ev) => { RemoteRTC_SupposedToBeConnected = false; Console.WriteLine("RemoteRTC.ServerConnectionLost"); if (csForm != null && !csForm.IsDisposed) { csForm.lbConnectionStatus.Text = "Connection status: Bizhawk timed out"; coreForm.showPanelForm(csForm); } if (ghForm != null && !ghForm.IsDisposed) { ghForm.lbConnectionStatus.Text = "Connection status: Bizhawk timed out"; ghForm.pnHideGlitchHarvester.BringToFront(); ghForm.pnHideGlitchHarvester.Show(); } RTC_GameProtection.Stop(); }); RemoteRTC.ServerDisconnected += new EventHandler((ob, ev) => { RemoteRTC_SupposedToBeConnected = false; Console.WriteLine("RemoteRTC.ServerDisconnected"); csForm.lbConnectionStatus.Text = "Connection status: NetCore Shutdown"; ghForm.lbConnectionStatus.Text = "Connection status: NetCore Shutdown"; coreForm.showPanelForm(csForm); ghForm.pnHideGlitchHarvester.BringToFront(); ghForm.pnHideGlitchHarvester.Show(); RTC_GameProtection.Stop(); }); RemoteRTC.StartNetworking(NetworkSide.SERVER, false, false); } else if (RTC_Hooks.isRemoteRTC) { //WILL THIS EVER HAPPEN? TO BE REMOVED IF NOT RemoteRTC.StartNetworking(NetworkSide.SERVER, false, true); } // Show the main RTC Form coreForm.Show(); } //Starting UDP loopback for Killswitch and External Rom Plugins RTC_RPC.Start(); //Refocus on Bizhawk if (GlobalWin.MainForm != null) { GlobalWin.MainForm.Focus(); } //Force create bizhawk config file if it doesn't exist if (!File.Exists(RTC_Core.bizhawkDir + "\\config.ini")) { RTC_Hooks.BIZHAWK_SAVE_CONFIG(); } //Fetch NetCore aggressiveness if (RTC_Hooks.isRemoteRTC) { RTC_Core.SendCommandToRTC(new RTC_Command(CommandType.GETAGGRESSIVENESS)); } }
public static void LOAD_SAVESTATE_END() { RTC_RPC.SendToKillSwitch("UNFREEZE"); }
public static void LOAD_SAVESTATE_BEGIN() { RTC_RPC.SendToKillSwitch("FREEZE"); }
public static void LOAD_GAME_FAILED() { RTC_RPC.SendToKillSwitch("UNFREEZE"); }
private void btnCloudCorrupt_Click(object sender, EventArgs e) { if (!IsValidCCC()) { GlobalWin.Sound.StopSound(); MessageBox.Show("The CorruptCloud Code entered below isn't valid"); GlobalWin.Sound.StartSound(); return; } GlobalWin.Sound.StopSound(); RTC_RPC.SendToKillSwitch("FREEZE"); BlastLayer bl = RTC_CorruptCloud.CloudLoad(tbCorruptCloudCode.Text); if (!bl.CCGD.CheckCompatibility()) { GlobalWin.Sound.StartSound(); RTC_RPC.SendToKillSwitch("UNFREEZE"); return; } if (cbAutoLoadState.Checked) { bl.CCGD.PutBackSavestate(); LoadState(bl.CCGD.originalKey, bl.CCGD.originalGameSystem, bl.CCGD.originalGameName); } if (bl != null) { bl.Apply(); } else { return; } if (bl != null) { IsCorruptionApplied = true; } if (cbStashCorrupted.Checked) { RTC_Core.currentStashkey = new StashKey(RTC_Core.GetRandomKey(), bl.CCGD.originalKey, bl); DontLoadSelectedStash = true; lbStashHistory.Items.Add(RTC_Core.currentStashkey); lbStashHistory.SelectedIndex = lbStashHistory.Items.Count - 1; lbStockpile.ClearSelected(); } if (cbRenderAtCorrupt.Checked) { StartRender(); } RTC_RPC.SendToKillSwitch("UNFREEZE"); GlobalWin.Sound.StartSound(); }
private void btnCloudInject_Click(object sender, EventArgs e) { if (!IsValidCCC()) { GlobalWin.Sound.StopSound(); MessageBox.Show("The CorruptCloud Code entered below isn't valid"); GlobalWin.Sound.StartSound(); return; } GlobalWin.Sound.StopSound(); RTC_RPC.SendToKillSwitch("FREEZE"); BlastLayer bl = RTC_CorruptCloud.CloudLoad(tbCorruptCloudCode.Text); if (!bl.CCGD.CheckCompatibility()) { GlobalWin.Sound.StartSound(); return; } if (cbAutoLoadState.Checked) { if (btnParentKeys[Convert.ToInt32(currentSelectedState)] != null) { LoadState(); } else { GlobalWin.Sound.StopSound(); MessageBox.Show("There is no SaveState in the selected box,\nPress 'Switch: Save/Load State' then Press 'SAVE'"); GlobalWin.Sound.StartSound(); RTC_RPC.SendToKillSwitch("UNFREEZE"); return; } } if (bl != null) { bl.Apply(); } else { GlobalWin.Sound.StartSound(); return; } if (bl != null) { IsCorruptionApplied = true; } if (cbStashInjected.Checked) { RTC_Core.currentStashkey = new StashKey(RTC_Core.GetRandomKey(), btnParentKeys[Convert.ToInt32(currentSelectedState)], bl); DontLoadSelectedStash = true; lbStashHistory.Items.Add(RTC_Core.currentStashkey); lbStashHistory.SelectedIndex = lbStashHistory.Items.Count - 1; lbStockpile.ClearSelected(); } if (cbRenderAtCorrupt.Checked) { StartRender(); } GlobalWin.Sound.StartSound(); RTC_RPC.SendToKillSwitch("UNFREEZE"); }
public static void Jump() { if (t == null) { return; } string key; if (ts.Count() > 0) { key = ts.Pop(); } else { return; } RTC_TimeFlow.State = TimeState.Jump; if (key != null) { t.Stop(); t.Start(); ts_buffer.Enqueue(key); key = ts_buffer.Dequeue(); //removed screenshot previewing to save ressources /* * Bitmap bmp = MainForm.MakeScreenshotImage().ToSysdrawingBitmap(); * * for(int y = 0; y<bmp.Size.Height;y++) * for (int x = 0; x < bmp.Size.Width; x++) * { * Color pix = bmp.GetPixel(x,y); * Color pix2 = Color.FromArgb(Convert.ToInt32(pix.R*0.2),Convert.ToInt32(pix.G*0.2),Convert.ToInt32(pix.B*0.2)); * bmp.SetPixel(x, y, pix2); * } * * GlobalWin.MainForm.BackgroundImageLayout = ImageLayout.Center; * * double factor = Convert.ToDouble(GlobalWin.MainForm.PresentationPanel.Control.Size.Height) / Convert.ToDouble(bmp.Height); * * Size bmpsize = new Size(Convert.ToInt32(bmp.Width * factor), Convert.ToInt32(bmp.Height * factor)); * * GlobalWin.MainForm.BackColor = Color.Black; * GlobalWin.MainForm.BackgroundImage = new Bitmap(bmp, bmpsize); * * GlobalWin.MainForm.PresentationPanel.Control.Visible = false; */ if (ts_buffer.Count == 0) { RTC_RPC.SendToKillSwitch("FREEZE"); RTC_Core.LoadStateCorruptorSafe(key + ".timestack.timejump", null); RTC_RPC.SendToKillSwitch("UNFREEZE"); /* * GlobalWin.MainForm.BackColor = System.Drawing.SystemColors.Control; * GlobalWin.MainForm.BackgroundImage = null; * * GlobalWin.MainForm.PresentationPanel.Control.Visible = true; * GlobalWin.MainForm.Activate(); * GlobalWin.MainForm.Focus(); */ } RTC_TimeFlow.JumpStep(); RTC_Core.tfForm.RefreshJumpLabel(); } }