diff --git a/RLBotCS/ManagerTools/ConfigValidator.cs b/RLBotCS/ManagerTools/ConfigValidator.cs index f82c24f..193b485 100644 --- a/RLBotCS/ManagerTools/ConfigValidator.cs +++ b/RLBotCS/ManagerTools/ConfigValidator.cs @@ -29,11 +29,11 @@ public static bool Validate(MatchConfigurationT config) if (config.Launcher == Launcher.Custom) { config.LauncherArg = (config.LauncherArg ?? "").ToLower(); - if (config.LauncherArg != "legendary") + if (config.LauncherArg != "legendary" && config.LauncherArg != "heroic") { Logger.LogError( $"Invalid {ctx.ToStringWithEnd(Fields.RlBotLauncherArg)} value \"{config.LauncherArg}\". " - + $"\"legendary\" is the only Custom launcher supported currently." + + $"\"legendary\" and \"heroic\" are the only Custom launchers supported currently." ); valid = false; } diff --git a/RLBotCS/ManagerTools/LaunchManager.cs b/RLBotCS/ManagerTools/LaunchManager.cs index 54b5cc1..669d297 100644 --- a/RLBotCS/ManagerTools/LaunchManager.cs +++ b/RLBotCS/ManagerTools/LaunchManager.cs @@ -135,6 +135,31 @@ private static void LaunchGameViaLegendary() legendary.Start(); } + private static void LaunchGameViaHeroic() + { + Process heroic; + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + heroic = RunCommandInShell( + "xdg-open 'heroic://launch?appName=Sugar&runner=legendary&arg=-rlbot&arg=RLBot_ControllerURL%3D127.0.0.1%3A23233&arg=RLBot_PacketSendRate%3D240&arg=-nomovie'" + ); + } + else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + heroic = RunCommandInShell( + "start \"\" \"heroic://launch?appName=Sugar&runner=legendary&arg=-rlbot&arg=RLBot_ControllerURL%3D127.0.0.1%3A23233&arg=RLBot_PacketSendRate%3D240&arg=-nomovie\"" + ); + } + else + { + throw new PlatformNotSupportedException( + "RLBot is not supported on non-Windows/Linux platforms" + ); + } + heroic.Start(); + } + public static void LaunchBots( List bots, int rlbotSocketsPort @@ -324,6 +349,11 @@ int gamePort LaunchGameViaLegendary(); return; } + else if (extraArg.ToLower() == "heroic") + { + LaunchGameViaHeroic(); + return; + } throw new NotSupportedException($"Unexpected launcher, \"{extraArg}\""); case rlbot.flat.Launcher.NoLaunch: @@ -355,6 +385,11 @@ int gamePort LaunchGameViaLegendary(); return; } + else if (extraArg.ToLower() == "heroic") + { + LaunchGameViaHeroic(); + return; + } throw new NotSupportedException($"Unexpected launcher, \"{extraArg}\""); case rlbot.flat.Launcher.NoLaunch: