Improve Roblox launch detection

This commit is contained in:
pizzaboxer 2024-10-24 23:34:51 +01:00
parent d9a84f4cf9
commit 6dc8e286ce
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
4 changed files with 55 additions and 73 deletions

View File

@ -10,8 +10,6 @@
string ExecutableName { get; }
string StartEvent { get; }
string Directory { get; }
string LockFilePath { get; }

View File

@ -16,8 +16,6 @@ namespace Bloxstrap.AppData
public override string ExecutableName => "RobloxPlayerBeta.exe";
public string StartEvent => "www.roblox.com/robloxStartedEvent";
public override string Directory => Path.Combine(Paths.Roblox, "Player");
public AppState State => App.State.Prop.Player;

View File

@ -10,8 +10,6 @@
public override string ExecutableName => "RobloxStudioBeta.exe";
public string StartEvent => "www.roblox.com/robloxStudioStartedEvent";
public override string Directory => Path.Combine(Paths.Roblox, "Studio");
public AppState State => App.State.Prop.Studio;

View File

@ -319,20 +319,15 @@ namespace Bloxstrap
SetStatus(Strings.Bootstrapper_Status_Starting);
if (_launchMode == LaunchMode.Player)
{
if (App.Settings.Prop.ForceRobloxLanguage)
if (_launchMode == LaunchMode.Player && App.Settings.Prop.ForceRobloxLanguage)
{
var match = Regex.Match(_launchCommandLine, "gameLocale:([a-z_]+)", RegexOptions.CultureInvariant);
if (match.Groups.Count == 2)
_launchCommandLine = _launchCommandLine.Replace("robloxLocale:en_us", $"robloxLocale:{match.Groups[1].Value}", StringComparison.InvariantCultureIgnoreCase);
}
if (!String.IsNullOrEmpty(_launchCommandLine))
_launchCommandLine += " ";
_launchCommandLine += "-isInstallerLaunch";
_launchCommandLine = _launchCommandLine.Replace(
"robloxLocale:en_us",
$"robloxLocale:{match.Groups[1].Value}",
StringComparison.OrdinalIgnoreCase);
}
var startInfo = new ProcessStartInfo()
@ -350,10 +345,6 @@ namespace Bloxstrap
string? logFileName = null;
using (var startEvent = new EventWaitHandle(false, EventResetMode.ManualReset, AppData.StartEvent))
{
startEvent.Reset();
string rbxLogDir = Path.Combine(Paths.LocalAppData, "Roblox\\logs");
if (!Directory.Exists(rbxLogDir))
@ -388,14 +379,9 @@ namespace Bloxstrap
throw;
}
App.Logger.WriteLine(LOG_IDENT, $"Started Roblox (PID {_appPid}), waiting for start event");
App.Logger.WriteLine(LOG_IDENT, $"Started Roblox (PID {_appPid}), waiting for log file");
if (startEvent.WaitOne(TimeSpan.FromSeconds(5)))
App.Logger.WriteLine(LOG_IDENT, "Start event signalled");
else
App.Logger.WriteLine(LOG_IDENT, "Start event not signalled, implying successful launch");
logCreatedEvent.WaitOne(TimeSpan.FromSeconds(5));
logCreatedEvent.WaitOne(TimeSpan.FromSeconds(15));
if (String.IsNullOrEmpty(logFileName))
{
@ -409,7 +395,6 @@ namespace Bloxstrap
}
_mutex?.ReleaseAsync();
}
if (IsStudioLaunch)
return;
@ -466,6 +451,9 @@ namespace Bloxstrap
if (ipl.IsAcquired)
Process.Start(Paths.Process, args);
}
// average grace time between log being created and the window being shown
Thread.Sleep(2000);
}
public void Cancel()