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);
}