示例#1
0
        private void btnAutoKillSwitchExecute_Click(object sender, EventArgs e)
        {
            RTC_NetCore.HugeOperationReset();

            showPanelForm(RTC_Core.csForm);

            RTC.RTC_RPC.Heartbeat = false;
            RTC.RTC_Core.coreForm.pbAutoKillSwitchTimeout.Value = RTC.RTC_Core.coreForm.pbAutoKillSwitchTimeout.Maximum;
            RTC.RTC_RPC.Freeze = true;

            RTC_NetCoreSettings.PlayCrashSound(true);

            switch (btnAutoKillSwitchExecute.Text.ToUpper())
            {
            case "KILL":
                Process.Start("KILLDETACHEDRTC.bat");
                break;

            case "KILL + RESTART":
                Process.Start("RESTARTDETACHEDRTC.bat");
                break;

            case "RESTART + RESET":
                Process.Start("RESETDETACHEDRTC.bat");
                break;
            }
        }
示例#2
0
        public void cbNetCoreCommandTimeout_SelectedIndexChanged(object sender, EventArgs e)
        {
            string setting = cbNetCoreCommandTimeout.SelectedItem.ToString().ToUpper();

            RTC_NetCoreSettings.changeNetCoreSettings(setting);
            RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.AGGRESSIVENESS)
            {
                objectValue = setting
            }, true);
        }
示例#3
0
        public void btnStartEmuhawkDetached_Click(object sender, EventArgs e)
        {
            lbBizhawkAttached.Visible         = false;
            lbBizhawkEmulatorAttached.Visible = false;
            pnBizhawkAttached.Visible         = false;

            RTC.RTC_RPC.Heartbeat = false;
            RTC.RTC_Core.coreForm.pbAutoKillSwitchTimeout.Value = RTC.RTC_Core.coreForm.pbAutoKillSwitchTimeout.Maximum;
            RTC.RTC_RPC.Freeze = true;

            RTC_NetCoreSettings.PlayCrashSound();


            Process.Start("RESTARTDETACHEDRTC.bat");
        }
示例#4
0
        public object ProcessQueue(LinkedList <RTC_Command> cmdQueue, bool snatchReturn = false)
        {
            while (cmdQueue.Count > 0 && cmdQueue.First != null)
            {
                RTC_Command cmd = cmdQueue.First.Value;

                if (cmd.Type == CommandType.PUSHSCREEN)
                {
                    cmd = GetLatestScreenFrame(cmdQueue);
                }
                else
                {
                    try
                    {
                        cmdQueue.RemoveFirst();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("NetCore had a thread collision and threw up.\nIn theory this should fix itself after you close this window.\n\n" + ex.ToString());
                        return(null);
                    }
                }

                if (cmd == null)
                {
                    continue;
                }

                RTC_Command cmdBack = null;

                Console.WriteLine(expectedSide.ToString() + ":ProcessQueue -> " + cmd.Type.ToString());

                switch (cmd.Type)
                {
                // NetCore Commands

                case CommandType.HI:
                    if (side == NetworkSide.SERVER)
                    {
                        OnServerConnected(null);
                        expectingSomeone = true;
                        SendCommand(new RTC_Command(CommandType.HI), false, true);
                    }
                    else if (side == NetworkSide.CLIENT)
                    {
                        OnClientConnected(null);
                        expectingSomeone = true;
                    }

                    break;

                case CommandType.SAYBYE:
                    SendCommand(new RTC_Command(CommandType.BYE), !(isStreamReadingThreadAlive && expectingSomeone), true);
                    //if not connected, send to self directly
                    break;

                case CommandType.SAIDBYE:
                case CommandType.BYE:
                    StopNetworking(true);
                    return(null);


                case CommandType.CONNECTIONLOST:
                    StopNetworking(true, true);
                    break;


                case CommandType.BOOP:
                    KeepAliveCounter = DefaultKeepAliveCounter;
                    break;

                case CommandType.AGGRESSIVENESS:
                    RTC_NetCoreSettings.changeNetCoreSettings((string)cmd.objectValue);
                    break;

                case CommandType.GETAGGRESSIVENESS:
                    string setting = RTC_Core.sForm.cbNetCoreCommandTimeout.SelectedItem.ToString().ToUpper();
                    RTC_Core.SendCommandToBizhawk(new RTC_Command(CommandType.AGGRESSIVENESS)
                    {
                        objectValue = setting
                    });
                    break;


                default:
                    // NetCore Extension Commands (Comment to detach Netcore from Extensions)
                    cmdBack = Process_RTCExtensions(cmd);
                    break;
                }


                // Create backcommand if a sync request was issued
                if (cmdBack == null && cmd.requestGuid != null)
                {
                    cmdBack = new RTC_Command(CommandType.RETURNVALUE);
                }


                //send command back or return value if from bizhawk to bizhawk
                if (cmdBack != null)
                {
                    if (snatchReturn)
                    {
                        return(cmdBack.objectValue);
                    }

                    cmdBack.ReturnedFrom = cmd.Type;
                    cmdBack.requestGuid  = cmd.requestGuid;
                    SendCommand(cmdBack, false);
                }
            }

            return(null);
        }