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