Skip to content

Commit fcd9222

Browse files
authored
Merge pull request #113 from rivques/master
Add support for launching via Heroic
2 parents f0960af + d9bbcce commit fcd9222

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

RLBotCS/ManagerTools/ConfigValidator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public static bool Validate(MatchConfigurationT config)
2929
if (config.Launcher == Launcher.Custom)
3030
{
3131
config.LauncherArg = (config.LauncherArg ?? "").ToLower();
32-
if (config.LauncherArg != "legendary")
32+
if (config.LauncherArg != "legendary" && config.LauncherArg != "heroic")
3333
{
3434
Logger.LogError(
3535
$"Invalid {ctx.ToStringWithEnd(Fields.RlBotLauncherArg)} value \"{config.LauncherArg}\". "
36-
+ $"\"legendary\" is the only Custom launcher supported currently."
36+
+ $"\"legendary\" and \"heroic\" are the only Custom launchers supported currently."
3737
);
3838
valid = false;
3939
}

RLBotCS/ManagerTools/LaunchManager.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,31 @@ private static void LaunchGameViaLegendary()
135135
legendary.Start();
136136
}
137137

138+
private static void LaunchGameViaHeroic()
139+
{
140+
Process heroic;
141+
142+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
143+
{
144+
heroic = RunCommandInShell(
145+
"xdg-open 'heroic://launch?appName=Sugar&runner=legendary&arg=-rlbot&arg=RLBot_ControllerURL%3D127.0.0.1%3A23233&arg=RLBot_PacketSendRate%3D240&arg=-nomovie'"
146+
);
147+
}
148+
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
149+
{
150+
heroic = RunCommandInShell(
151+
"start \"\" \"heroic://launch?appName=Sugar&runner=legendary&arg=-rlbot&arg=RLBot_ControllerURL%3D127.0.0.1%3A23233&arg=RLBot_PacketSendRate%3D240&arg=-nomovie\""
152+
);
153+
}
154+
else
155+
{
156+
throw new PlatformNotSupportedException(
157+
"RLBot is not supported on non-Windows/Linux platforms"
158+
);
159+
}
160+
heroic.Start();
161+
}
162+
138163
public static void LaunchBots(
139164
List<rlbot.flat.PlayerConfigurationT> bots,
140165
int rlbotSocketsPort
@@ -324,6 +349,11 @@ int gamePort
324349
LaunchGameViaLegendary();
325350
return;
326351
}
352+
else if (extraArg.ToLower() == "heroic")
353+
{
354+
LaunchGameViaHeroic();
355+
return;
356+
}
327357

328358
throw new NotSupportedException($"Unexpected launcher, \"{extraArg}\"");
329359
case rlbot.flat.Launcher.NoLaunch:
@@ -355,6 +385,11 @@ int gamePort
355385
LaunchGameViaLegendary();
356386
return;
357387
}
388+
else if (extraArg.ToLower() == "heroic")
389+
{
390+
LaunchGameViaHeroic();
391+
return;
392+
}
358393

359394
throw new NotSupportedException($"Unexpected launcher, \"{extraArg}\"");
360395
case rlbot.flat.Launcher.NoLaunch:

0 commit comments

Comments
 (0)