public static void Start(Form standaloneForm = null) { S.formRegister.FormRegistered += FormRegister_FormRegistered; //registerFormEvents(S.GET<RTC_Core_Form>()); registerFormEvents(S.GET <UI_CoreForm>()); registerHotkeyBlacklistControls(S.GET <UI_CoreForm>()); if (!RtcCore.Attached) { S.SET((RTC_Standalone_Form)standaloneForm); } Form dummy = new Form(); IntPtr Handle = dummy.Handle; SyncObjectSingleton.SyncObject = dummy; UI_VanguardImplementation.StartServer(); PartialSpec p = new PartialSpec("UISpec"); p["SELECTEDDOMAINS"] = new string[] { }; RTCV.NetCore.AllSpec.UISpec = new FullSpec(p, !CorruptCore.RtcCore.Attached); RTCV.NetCore.AllSpec.UISpec.SpecUpdated += (o, e) => { PartialSpec partial = e.partialSpec; LocalNetCoreRouter.Route(CORRUPTCORE, REMOTE_PUSHUISPECUPDATE, partial, e.syncedUpdate); }; CorruptCore.RtcCore.StartUISide(); //Loading RTC Params S.GET <RTC_SettingsGeneral_Form>().cbDisableEmulatorOSD.Checked = RTCV.NetCore.Params.IsParamSet(RTCSPEC.CORE_EMULATOROSDDISABLED); S.GET <RTC_SettingsGeneral_Form>().cbAllowCrossCoreCorruption.Checked = RTCV.NetCore.Params.IsParamSet("ALLOW_CROSS_CORE_CORRUPTION"); S.GET <RTC_SettingsGeneral_Form>().cbDontCleanAtQuit.Checked = RTCV.NetCore.Params.IsParamSet("DONT_CLEAN_SAVESTATES_AT_QUIT"); S.GET <RTC_SettingsGeneral_Form>().cbUncapIntensity.Checked = RTCV.NetCore.Params.IsParamSet("UNCAP_INTENSITY"); //Initialize input code. Poll every 16ms Input.Input.Initialize(); inputCheckTimer = new System.Timers.Timer(); inputCheckTimer.Elapsed += ProcessInputCheck; inputCheckTimer.AutoReset = false; inputCheckTimer.Interval = 10; inputCheckTimer.Start(); if (FirstConnect) { UI_DefaultGrids.connectionStatus.LoadToMain(); } LoadRTCColor(); S.GET <UI_CoreForm>().Show(); Initialized.Set(); LoadRTCColor(); }
public static void KillEmulator(bool forceBypass = false) { if (!ShouldKillswitchFire || (UICore.FirstConnect && !forceBypass) || (!S.GET <UI_CoreForm>().cbUseAutoKillSwitch.Checked&& !forceBypass)) { return; } ShouldKillswitchFire = false; //Nuke netcore UI_VanguardImplementation.RestartServer(); SyncObjectSingleton.FormExecute(() => { //Stop the old timer and eat any exceptions try { BoopMonitoringTimer?.Stop(); BoopMonitoringTimer?.Dispose(); } catch { } killswitchSpamPreventTimer = new Timer(); killswitchSpamPreventTimer.Interval = 5000; killswitchSpamPreventTimer.Tick += KillswitchSpamPreventTimer_Tick; killswitchSpamPreventTimer.Start(); PlayCrashSound(true); if (CorruptCore.RtcCore.EmuDir == null) { MessageBox.Show("Couldn't determine what emulator to start! Please start it manually."); return; } }); var info = new ProcessStartInfo(); oldEmuDir = CorruptCore.RtcCore.EmuDir; info.WorkingDirectory = oldEmuDir; info.FileName = Path.Combine(oldEmuDir, "RESTARTDETACHEDRTC.bat"); if (!File.Exists(info.FileName)) { MessageBox.Show($"Couldn't find {info.FileName}! Killswitch will not work."); return; } Process.Start(info); }