Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions RLBotCS/ManagerTools/LaunchManager/CustomLaunchers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,43 @@ namespace RLBotCS.ManagerTools;

public static partial class LaunchManager
{
private static void LaunchGameViaLegendary()
private static void LaunchGameViaLegendary(int gamePort)
{
Process legendary = RunCommandInShell(
"legendary launch Sugar -rlbot RLBot_ControllerURL=127.0.0.1:23233 RLBot_PacketSendRate=240 -nomovie"
);
string args = string.Join(" ", GetRLBotArgs(gamePort));
Process legendary = RunCommandInShell($"legendary launch Sugar {args} -noeac");
legendary.Start();
}

private static void LaunchGameViaHeroic()
private static void LaunchGameViaHeroic(int gamePort)
{
string[] rlbotArgs = GetRLBotArgs(gamePort);
string heroicArgs = string.Join(
"",
rlbotArgs.Select(a => $"&arg={Uri.EscapeDataString(a)}")
);
string heroicUrl =
$"heroic://launch?appName=Sugar&runner=legendary{heroicArgs}&arg=-noeac";

Process heroic;

#if 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\""
);
heroic = RunCommandInShell($"start \"\" \"{heroicUrl}\"");
#else
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'"
);
heroic = RunCommandInShell($"xdg-open '{heroicUrl}'");
#endif

heroic.Start();
}

private static void LaunchCustomLauncher(string extraArg)
private static void LaunchCustomLauncher(string extraArg, int gamePort)
{
if (extraArg.Equals("legendary", StringComparison.OrdinalIgnoreCase))
{
LaunchGameViaLegendary();
LaunchGameViaLegendary(gamePort);
}
else if (extraArg.Equals("heroic", StringComparison.OrdinalIgnoreCase))
{
LaunchGameViaHeroic();
LaunchGameViaHeroic(gamePort);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion RLBotCS/ManagerTools/LaunchManager/RocketLeagueLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int gamePort
LaunchGameViaEpic(gamePort);
break;
case RLBot.Flat.Launcher.Custom:
LaunchCustomLauncher(extraArg);
LaunchCustomLauncher(extraArg, gamePort);
break;
case RLBot.Flat.Launcher.NoLaunch:
break;
Expand Down
Loading