public override void ApplyToConfig(UnrealAppConfig AppConfig) { base.ApplyToConfig(AppConfig); if (AppConfig.ProcessType.IsClient() || AppConfig.ProcessType.IsServer()) { string McpString = ""; if (AppConfig.ProcessType.IsServer()) { // set explicit server and beacon port for online services // this is important when running tests in parallel to avoid matchmaking collisions McpString += string.Format(" -port={0}", ServerPort); McpString += string.Format(" -beaconport={0}", BeaconPort); } if (NoMCP) { McpString += " -nomcp -notimeouts"; // if this is a client, and there is a server role, find our PC's IP address and tell it to connect to us if (AppConfig.ProcessType.IsClient() && (RequiredRoles.ContainsKey(UnrealTargetRole.Server) || RequiredRoles.ContainsKey(UnrealTargetRole.EditorServer))) { // find all valid IP addresses but throw away anything with an invalid range var LocalAddress = Dns.GetHostEntry(Dns.GetHostName()).AddressList .Where(o => o.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork && o.GetAddressBytes()[0] != 169) .FirstOrDefault(); if (LocalAddress == null) { throw new AutomationException("Could not find local IP address"); } string LocalIP = Globals.Params.ParseValue("serverip", LocalAddress.ToString()); McpString += string.Format(" -ExecCmds=\"open {0}:{1}\"", LocalIP, ServerPort); } } else { McpString += string.Format(" -epicapp={0} -buildidoverride={1}", EpicApp, BuildIDOverride); } if (FastCook) { McpString += " -FastCook"; } AppConfig.CommandLine += McpString; } if (AppConfig.ProcessType.IsClient()) { // turn off skill-based matchmaking, turn off porta; AppConfig.CommandLine += " -nosbmm"; if (LogPSO) { AppConfig.CommandLine += " -logpso"; } if (AppConfig.Platform == UnrealTargetPlatform.Win64) { // turn off skill-based matchmaking, turn off porta; AppConfig.CommandLine += " -noepicportal"; } // select an account if (NoMCP == false && AppConfig.Platform != UnrealTargetPlatform.PS4 && AppConfig.Platform != UnrealTargetPlatform.XboxOne && PreAssignAccount == true) { Account UserAccount = AccountPool.Instance.ReserveAccount(); UserAccount.ApplyToConfig(AppConfig); } } }
public override void ApplyToConfig(UnrealAppConfig AppConfig, UnrealSessionRole ConfigRole, IEnumerable <UnrealSessionRole> OtherRoles) { base.ApplyToConfig(AppConfig, ConfigRole, OtherRoles); if (ConfigRole.RoleType.IsClient() || ConfigRole.RoleType.IsServer()) { string McpString = ""; if (ConfigRole.RoleType.IsServer()) { // set explicit server and beacon port for online services // this is important when running tests in parallel to avoid matchmaking collisions McpString += string.Format(" -port={0}", ServerPort); McpString += string.Format(" -beaconport={0}", BeaconPort); AppConfig.CommandLine += " -net.forcecompatible"; } // Default to the first address with a valid prefix var LocalAddress = Dns.GetHostEntry(Dns.GetHostName()).AddressList .Where(o => o.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork && o.GetAddressBytes()[0] != 169) .FirstOrDefault(); var ActiveInterfaces = NetworkInterface.GetAllNetworkInterfaces() .Where(I => I.OperationalStatus == OperationalStatus.Up); bool MultipleInterfaces = ActiveInterfaces.Count() > 1; if (MultipleInterfaces) { // Now, lots of Epic PCs have virtual adapters etc, so see if there's one that's on our network and if so use that IP var PreferredInterface = ActiveInterfaces .Where(I => I.GetIPProperties().DnsSuffix.Equals("epicgames.net", StringComparison.OrdinalIgnoreCase)) .SelectMany(I => I.GetIPProperties().UnicastAddresses) .Where(A => A.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) .FirstOrDefault(); if (PreferredInterface != null) { LocalAddress = PreferredInterface.Address; } } if (LocalAddress == null) { throw new AutomationException("Could not find local IP address"); } string RequestedServerIP = Globals.Params.ParseValue("serverip", ""); string RequestedClientIP = Globals.Params.ParseValue("clientip", ""); string ServerIP = string.IsNullOrEmpty(RequestedServerIP) ? LocalAddress.ToString() : RequestedServerIP; string ClientIP = string.IsNullOrEmpty(RequestedClientIP) ? LocalAddress.ToString() : RequestedClientIP; // Do we need to add the -multihome argument to bind to specific IP? if (ConfigRole.RoleType.IsServer() && (MultipleInterfaces || !string.IsNullOrEmpty(RequestedServerIP))) { AppConfig.CommandLine += string.Format(" -multihome={0}", ServerIP); } // client too, but only desktop platforms if (ConfigRole.RoleType.IsClient() && (MultipleInterfaces || !string.IsNullOrEmpty(RequestedClientIP))) { if (ConfigRole.Platform == UnrealTargetPlatform.Win64 || ConfigRole.Platform == UnrealTargetPlatform.Mac) { AppConfig.CommandLine += string.Format(" -multihome={0}", ClientIP); } } if (NoMCP) { McpString += " -nomcp -notimeouts"; // if this is a client, and there is a server role, find our PC's IP address and tell it to connect to us if (ConfigRole.RoleType.IsClient() && (RequiredRoles.ContainsKey(UnrealTargetRole.Server) || RequiredRoles.ContainsKey(UnrealTargetRole.EditorServer))) { McpString += string.Format(" -ExecCmds=\"open {0}:{1}\"", ServerIP, ServerPort); } } else { if (Globals.Params.ParseParam("nobuildid")) { McpString += string.Format(" -epicapp={0} ", EpicApp); } else { McpString += string.Format(" -epicapp={0} -buildidoverride={1}", EpicApp, BuildIDOverride); } } if (FastCook) { McpString += " -FastCook"; } // turn off XboxAuth for NoMcp, or if specified, but only if there's an Xbox client somewhere bool SkipAuth = ConfigRole.RoleType.IsServer() && (NoMCP || XboxAuthSkip) && OtherRoles.Any(R => R.Platform == UnrealTargetPlatform.XboxOne); if (SkipAuth) { AppConfig.CommandLine += " -ini:Game:[/Script/FortniteGame.FortGameModeZone]:bTrustXboxPlatformId=true"; } AppConfig.CommandLine += McpString; } if (ConfigRole.RoleType.IsClient()) { if (LogPSO) { AppConfig.CommandLine += " -logpso"; } if (ConfigRole.Platform == UnrealTargetPlatform.Win64) { // turn off skill-based matchmaking, turn off porta; AppConfig.CommandLine += " -noepicportal"; } // select an account if (NoMCP == false && ConfigRole.Platform != UnrealTargetPlatform.PS4 && ConfigRole.Platform != UnrealTargetPlatform.XboxOne && PreAssignAccount == true) { Account UserAccount = AccountPool.Instance.ReserveAccount(); UserAccount.ApplyToConfig(AppConfig); } // turn off voice chat, otherwise will open blocking permission requests on mobile if (ConfigRole.Platform == UnrealTargetPlatform.IOS) { AppConfig.CommandLine += " -ini:Engine:[VoiceChat.Vivox]:bEnabled=false"; } } }