mirror of
https://github.com/sp-tarkov/launcher.git
synced 2025-02-12 22:10:44 -05:00
pass gamepath as parameter to gamestarter
This commit is contained in:
parent
351d3f2655
commit
567e891df1
@ -29,7 +29,6 @@ namespace Aki.Launcher
|
|||||||
private readonly IGameStarterFrontend _frontend;
|
private readonly IGameStarterFrontend _frontend;
|
||||||
private readonly bool _showOnly;
|
private readonly bool _showOnly;
|
||||||
private readonly string _originalGamePath;
|
private readonly string _originalGamePath;
|
||||||
private readonly string _gamePath;
|
|
||||||
private readonly string[] _excludeFromCleanup;
|
private readonly string[] _excludeFromCleanup;
|
||||||
private const string registryInstall = @"Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\EscapeFromTarkov";
|
private const string registryInstall = @"Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\EscapeFromTarkov";
|
||||||
|
|
||||||
@ -40,7 +39,6 @@ namespace Aki.Launcher
|
|||||||
{
|
{
|
||||||
_frontend = frontend;
|
_frontend = frontend;
|
||||||
_showOnly = showOnly;
|
_showOnly = showOnly;
|
||||||
_gamePath = gamePath ?? LauncherSettingsProvider.Instance.GamePath ?? Environment.CurrentDirectory;
|
|
||||||
_originalGamePath = originalGamePath ??= DetectOriginalGamePath();
|
_originalGamePath = originalGamePath ??= DetectOriginalGamePath();
|
||||||
_excludeFromCleanup = excludeFromCleanup ?? LauncherSettingsProvider.Instance.ExcludeFromCleanup;
|
_excludeFromCleanup = excludeFromCleanup ?? LauncherSettingsProvider.Instance.ExcludeFromCleanup;
|
||||||
}
|
}
|
||||||
@ -57,7 +55,7 @@ namespace Aki.Launcher
|
|||||||
return info?.DirectoryName;
|
return info?.DirectoryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GameStarterResult> LaunchGame(ServerInfo server, AccountInfo account)
|
public async Task<GameStarterResult> LaunchGame(ServerInfo server, AccountInfo account, string gamePath)
|
||||||
{
|
{
|
||||||
// setup directories
|
// setup directories
|
||||||
if (IsInstalledInLive())
|
if (IsInstalledInLive())
|
||||||
@ -66,7 +64,7 @@ namespace Aki.Launcher
|
|||||||
return GameStarterResult.FromError(-1);
|
return GameStarterResult.FromError(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetupGameFiles();
|
SetupGameFiles(gamePath);
|
||||||
|
|
||||||
if (!ValidationUtil.Validate())
|
if (!ValidationUtil.Validate())
|
||||||
{
|
{
|
||||||
@ -81,7 +79,7 @@ namespace Aki.Launcher
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check game path
|
// check game path
|
||||||
var clientExecutable = Path.Join(_gamePath, "EscapeFromTarkov.exe");
|
var clientExecutable = Path.Join(gamePath, "EscapeFromTarkov.exe");
|
||||||
|
|
||||||
if (!File.Exists(clientExecutable))
|
if (!File.Exists(clientExecutable))
|
||||||
{
|
{
|
||||||
@ -90,7 +88,7 @@ namespace Aki.Launcher
|
|||||||
}
|
}
|
||||||
|
|
||||||
// apply patches
|
// apply patches
|
||||||
ProgressReportingPatchRunner patchRunner = new ProgressReportingPatchRunner(_gamePath);
|
ProgressReportingPatchRunner patchRunner = new ProgressReportingPatchRunner(gamePath);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -116,7 +114,7 @@ namespace Aki.Launcher
|
|||||||
{
|
{
|
||||||
Arguments = args,
|
Arguments = args,
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
WorkingDirectory = _gamePath,
|
WorkingDirectory = gamePath,
|
||||||
};
|
};
|
||||||
|
|
||||||
Process.Start(clientProcess);
|
Process.Start(clientProcess);
|
||||||
@ -183,17 +181,17 @@ namespace Aki.Launcher
|
|||||||
return isInstalledInLive;
|
return isInstalledInLive;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupGameFiles()
|
void SetupGameFiles(string gamePath)
|
||||||
{
|
{
|
||||||
var files = new []
|
var files = new []
|
||||||
{
|
{
|
||||||
GetFileForCleanup("BattlEye"),
|
GetFileForCleanup("BattlEye", gamePath),
|
||||||
GetFileForCleanup("Logs"),
|
GetFileForCleanup("Logs", gamePath),
|
||||||
GetFileForCleanup("ConsistencyInfo"),
|
GetFileForCleanup("ConsistencyInfo", gamePath),
|
||||||
GetFileForCleanup("EscapeFromTarkov_BE.exe"),
|
GetFileForCleanup("EscapeFromTarkov_BE.exe", gamePath),
|
||||||
GetFileForCleanup("Uninstall.exe"),
|
GetFileForCleanup("Uninstall.exe", gamePath),
|
||||||
GetFileForCleanup("UnityCrashHandler64.exe"),
|
GetFileForCleanup("UnityCrashHandler64.exe", gamePath),
|
||||||
GetFileForCleanup("WinPixEventRuntime.dll")
|
GetFileForCleanup("WinPixEventRuntime.dll", gamePath)
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
@ -215,7 +213,7 @@ namespace Aki.Launcher
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetFileForCleanup(string fileName)
|
private string GetFileForCleanup(string fileName, string gamePath)
|
||||||
{
|
{
|
||||||
if (_excludeFromCleanup.Contains(fileName))
|
if (_excludeFromCleanup.Contains(fileName))
|
||||||
{
|
{
|
||||||
@ -223,7 +221,7 @@ namespace Aki.Launcher
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Path.Combine(_gamePath, fileName);
|
return Path.Combine(gamePath, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -144,7 +144,7 @@ namespace Aki.Launcher.ViewModels
|
|||||||
|
|
||||||
LauncherSettingsProvider.Instance.GameRunning = true;
|
LauncherSettingsProvider.Instance.GameRunning = true;
|
||||||
|
|
||||||
GameStarterResult gameStartResult = await gameStarter.LaunchGame(ServerManager.SelectedServer, AccountManager.SelectedAccount);
|
GameStarterResult gameStartResult = await gameStarter.LaunchGame(ServerManager.SelectedServer, AccountManager.SelectedAccount, LauncherSettingsProvider.Instance.GamePath);
|
||||||
|
|
||||||
if (gameStartResult.Succeeded)
|
if (gameStartResult.Succeeded)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user