mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Improve Roblox launch detection
This commit is contained in:
parent
d9a84f4cf9
commit
6dc8e286ce
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
string ExecutableName { get; }
|
string ExecutableName { get; }
|
||||||
|
|
||||||
string StartEvent { get; }
|
|
||||||
|
|
||||||
string Directory { get; }
|
string Directory { get; }
|
||||||
|
|
||||||
string LockFilePath { get; }
|
string LockFilePath { get; }
|
||||||
|
@ -16,8 +16,6 @@ namespace Bloxstrap.AppData
|
|||||||
|
|
||||||
public override string ExecutableName => "RobloxPlayerBeta.exe";
|
public override string ExecutableName => "RobloxPlayerBeta.exe";
|
||||||
|
|
||||||
public string StartEvent => "www.roblox.com/robloxStartedEvent";
|
|
||||||
|
|
||||||
public override string Directory => Path.Combine(Paths.Roblox, "Player");
|
public override string Directory => Path.Combine(Paths.Roblox, "Player");
|
||||||
|
|
||||||
public AppState State => App.State.Prop.Player;
|
public AppState State => App.State.Prop.Player;
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
public override string ExecutableName => "RobloxStudioBeta.exe";
|
public override string ExecutableName => "RobloxStudioBeta.exe";
|
||||||
|
|
||||||
public string StartEvent => "www.roblox.com/robloxStudioStartedEvent";
|
|
||||||
|
|
||||||
public override string Directory => Path.Combine(Paths.Roblox, "Studio");
|
public override string Directory => Path.Combine(Paths.Roblox, "Studio");
|
||||||
|
|
||||||
public AppState State => App.State.Prop.Studio;
|
public AppState State => App.State.Prop.Studio;
|
||||||
|
@ -319,20 +319,15 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
SetStatus(Strings.Bootstrapper_Status_Starting);
|
SetStatus(Strings.Bootstrapper_Status_Starting);
|
||||||
|
|
||||||
if (_launchMode == LaunchMode.Player)
|
if (_launchMode == LaunchMode.Player && App.Settings.Prop.ForceRobloxLanguage)
|
||||||
{
|
|
||||||
if (App.Settings.Prop.ForceRobloxLanguage)
|
|
||||||
{
|
{
|
||||||
var match = Regex.Match(_launchCommandLine, "gameLocale:([a-z_]+)", RegexOptions.CultureInvariant);
|
var match = Regex.Match(_launchCommandLine, "gameLocale:([a-z_]+)", RegexOptions.CultureInvariant);
|
||||||
|
|
||||||
if (match.Groups.Count == 2)
|
if (match.Groups.Count == 2)
|
||||||
_launchCommandLine = _launchCommandLine.Replace("robloxLocale:en_us", $"robloxLocale:{match.Groups[1].Value}", StringComparison.InvariantCultureIgnoreCase);
|
_launchCommandLine = _launchCommandLine.Replace(
|
||||||
}
|
"robloxLocale:en_us",
|
||||||
|
$"robloxLocale:{match.Groups[1].Value}",
|
||||||
if (!String.IsNullOrEmpty(_launchCommandLine))
|
StringComparison.OrdinalIgnoreCase);
|
||||||
_launchCommandLine += " ";
|
|
||||||
|
|
||||||
_launchCommandLine += "-isInstallerLaunch";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var startInfo = new ProcessStartInfo()
|
var startInfo = new ProcessStartInfo()
|
||||||
@ -350,10 +345,6 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
string? logFileName = null;
|
string? logFileName = null;
|
||||||
|
|
||||||
using (var startEvent = new EventWaitHandle(false, EventResetMode.ManualReset, AppData.StartEvent))
|
|
||||||
{
|
|
||||||
startEvent.Reset();
|
|
||||||
|
|
||||||
string rbxLogDir = Path.Combine(Paths.LocalAppData, "Roblox\\logs");
|
string rbxLogDir = Path.Combine(Paths.LocalAppData, "Roblox\\logs");
|
||||||
|
|
||||||
if (!Directory.Exists(rbxLogDir))
|
if (!Directory.Exists(rbxLogDir))
|
||||||
@ -388,14 +379,9 @@ namespace Bloxstrap
|
|||||||
throw;
|
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)))
|
logCreatedEvent.WaitOne(TimeSpan.FromSeconds(15));
|
||||||
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));
|
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(logFileName))
|
if (String.IsNullOrEmpty(logFileName))
|
||||||
{
|
{
|
||||||
@ -409,7 +395,6 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
|
|
||||||
_mutex?.ReleaseAsync();
|
_mutex?.ReleaseAsync();
|
||||||
}
|
|
||||||
|
|
||||||
if (IsStudioLaunch)
|
if (IsStudioLaunch)
|
||||||
return;
|
return;
|
||||||
@ -466,6 +451,9 @@ namespace Bloxstrap
|
|||||||
if (ipl.IsAcquired)
|
if (ipl.IsAcquired)
|
||||||
Process.Start(Paths.Process, args);
|
Process.Start(Paths.Process, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// average grace time between log being created and the window being shown
|
||||||
|
Thread.Sleep(2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Cancel()
|
public void Cancel()
|
||||||
|
Loading…
Reference in New Issue
Block a user