示例#1
0
        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();
        }
示例#2
0
        private void AutoKillSwitch_Load(object sender, EventArgs e)
        {
            cbDetection.SelectedIndex = 0;

            t          = new Timer();
            t.Interval = 300;
            t.Tick    += new EventHandler(CheckHeartbeat);
            t.Start();

            RTC_RPC.Start();
        }
示例#3
0
        //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));
            }
        }