mirror of
https://github.com/rfvgyhn/min-ed-launcher.git
synced 2026-02-04 16:45:37 +00:00
@ -18,6 +18,10 @@
|
||||
require re-logging in every few days though, so it may be preferable to just stick with the alternate launchers.
|
||||
- Added an [icon](resources/min-ed-launcher.svg) for the app. Linux users can check the [readme](README.md#icon-on-linux)
|
||||
for setup instructions.
|
||||
- The launcher will now exit instead of waiting for Elite to exit if the following conditions are met:
|
||||
1. `/autoquit` is specified
|
||||
2. `/restart` is not specified
|
||||
3. No external apps specified in `settings.json` (`processes`, `shutdownProcesses`)
|
||||
|
||||
## [0.10.1] - 2024-05-03
|
||||
|
||||
|
||||
@ -98,15 +98,16 @@ let private checkForLauncherUpdates httpClient cancellationToken currentVersion
|
||||
)
|
||||
}
|
||||
|
||||
let launchProduct dryRun proton processArgs productName product =
|
||||
let launchProduct dryRun proton processArgs productName waitForExit product =
|
||||
let args = processArgs()
|
||||
Log.info $"Launching %s{productName}"
|
||||
|
||||
match Product.run dryRun proton args product with
|
||||
| Product.RunResult.Ok p ->
|
||||
use p = p
|
||||
p.BeginErrorReadLine()
|
||||
p.BeginOutputReadLine()
|
||||
if waitForExit then
|
||||
use p = p
|
||||
p.WaitForExit()
|
||||
p.Close()
|
||||
Log.info $"Shutdown %s{productName}"
|
||||
@ -337,8 +338,22 @@ let rec private launchLoop initialLaunch settings playableProducts (session: EdS
|
||||
Log.info $"Delaying game launch for %.2f{settings.GameStartDelay.TotalSeconds} seconds"
|
||||
do! Task.Delay settings.GameStartDelay
|
||||
|
||||
launchProduct settings.DryRun settings.CompatTool pArgs selectedProduct.Name p
|
||||
let waitForEdExit = not settings.AutoQuit || settings.Restart.IsSome || not settings.Processes.IsEmpty || not settings.ShutdownProcesses.IsEmpty
|
||||
|
||||
launchProduct settings.DryRun settings.CompatTool pArgs selectedProduct.Name waitForEdExit p
|
||||
|
||||
if not waitForEdExit then
|
||||
// Wait for ED Process to start before exiting
|
||||
let maxTries = 30
|
||||
let mutable tries = 0
|
||||
while tries < maxTries do
|
||||
if not (Product.isRunning p) then
|
||||
do! Task.Delay(TimeSpan.FromSeconds(1))
|
||||
tries <- tries + 1
|
||||
else
|
||||
tries <- maxTries
|
||||
return [], didLoop
|
||||
else
|
||||
let timeout = settings.Restart |> Option.defaultValue 3000L
|
||||
while settings.Restart.IsSome && not (Console.cancelRestart timeout) do
|
||||
Process.stopProcesses settings.ShutdownTimeout relaunchProcesses
|
||||
@ -347,7 +362,7 @@ let rec private launchLoop initialLaunch settings playableProducts (session: EdS
|
||||
|
||||
do! renewEpicTokenIfNeeded settings.Platform session.PlatformToken
|
||||
|
||||
launchProduct settings.DryRun settings.CompatTool pArgs selectedProduct.Name p
|
||||
launchProduct settings.DryRun settings.CompatTool pArgs selectedProduct.Name true p
|
||||
|
||||
if not settings.AutoQuit then
|
||||
return! launchLoop false settings playableProducts session (Some persistentProcesses) (Some relaunchProcesses) cancellationToken processArgs
|
||||
|
||||
@ -247,6 +247,16 @@ let validateForRun launcherDir watchForCrashes (product: ProductDetails) =
|
||||
Mode = product.VInfo.Mode
|
||||
ServerArgs = product.ServerArgs }
|
||||
|
||||
let isRunning (product:RunnableProduct) =
|
||||
let exeName = Path.GetFileNameWithoutExtension(product.Executable.Name)
|
||||
|
||||
if RuntimeInformation.IsOSPlatform(OSPlatform.Windows) then
|
||||
Process.GetProcessesByName(exeName).Length > 0
|
||||
else
|
||||
// Process.ProcessName seems to be truncated on linux. Not sure if it's always the case or only sometimes
|
||||
// so check both truncated name and full name
|
||||
Process.GetProcessesByName(exeName[..14]).Length > 0 || Process.GetProcessesByName(exeName).Length > 0
|
||||
|
||||
let createProcessInfo proton args product =
|
||||
let fileName, arguments =
|
||||
match proton with
|
||||
|
||||
Reference in New Issue
Block a user