Skip to content

Commit

Permalink
change base game start method
Browse files Browse the repository at this point in the history
  • Loading branch information
whichtwix committed Apr 29, 2024
1 parent 52e1987 commit 5905396
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/EpicGamesStarter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<DebugType>embedded</DebugType>
<Version>1.0.1</Version>
<Version>1.0.2</Version>
</PropertyGroup>
</Project>
19 changes: 16 additions & 3 deletions src/code/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ public static class EpicGamesStarter
{
public const string AppId = "33956bcb55d4452d8c47e16b94e294bd%3A729a86a5146640a2ace9e8c595414c56%3A963137e4c29d4c79a81323b8fab03a40";

public static string Launcher = $@"{Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}\Epic Games\Launcher\Portal\Binaries\Win64";

public static readonly JsonSerializerOptions Opts = new()
{
TypeInfoResolver = SourceGenerator.Default
Expand All @@ -29,7 +27,8 @@ public static async Task Main(string[] args)
if (InstancesClosed()) await Task.Delay(1000);

Console.WriteLine("Starting Among Us in the epic folder to retrieve arguments");
var BaseGame = Process.Start($@"{Launcher}\EpicGamesLauncher.exe", $"com.epicgames.launcher://apps/{AppId}?action=launch&silent=true");

LaunchBaseGame();
while (Process.GetProcessesByName("Among Us").Length == 0)
{
Console.WriteLine("Waiting...");
Expand Down Expand Up @@ -93,6 +92,20 @@ public static ProcessData GetIdAndCommandLine()
}
}

public static void LaunchBaseGame()
{
var processStartInfo = new ProcessStartInfo
{
FileName = $"com.epicgames.launcher://apps/{AppId}?action=launch&silent=true",
UseShellExecute = true,
WindowStyle = ProcessWindowStyle.Hidden,
};

using var process = new Process();
process.StartInfo = processStartInfo;
process.Start();
}

public static bool InstancesClosed()
{
var instances = Process.GetProcessesByName("Among Us");
Expand Down

0 comments on commit 5905396

Please sign in to comment.