From b3dcb48038a408bf1f5af528fa0c44daa93efc65 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Thu, 20 Apr 2023 11:51:37 +0100 Subject: [PATCH] Make launch behaviour closer to official launcher no custom start event, only specifying launchtime when launched from website oh yeah i fixed a bug with fflag management --- Bloxstrap/App.xaml.cs | 6 ++---- Bloxstrap/Bootstrapper.cs | 23 +++++++++-------------- Bloxstrap/Helpers/JsonManager.cs | 3 +-- Bloxstrap/Helpers/Protocol.cs | 6 +++++- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index cfc62ff..fac8054 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -163,9 +163,6 @@ namespace Bloxstrap ShowMessageBox(message, MessageBoxImage.Warning); } - // this needs to be loaded this early for the menu and also to check for default values - FastFlags.Load(); - // check if installed using (RegistryKey? registryKey = Registry.CurrentUser.OpenSubKey($@"Software\{ProjectName}")) { @@ -179,6 +176,7 @@ namespace Bloxstrap if (!IsQuiet) { IsSetupComplete = false; + FastFlags.Load(); new MainWindow().ShowDialog(); } } @@ -197,7 +195,7 @@ namespace Bloxstrap } Directories.Initialize(BaseDirectory); - FastFlags.AltFileLocation = Path.Combine(Directories.Modifications, "ClientSettings\\ClientAppSettings.json"); + FastFlags.Load(); // we shouldn't save settings on the first run until the first installation is finished, // just in case the user decides to cancel the install diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 948fb53..35e7281 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -62,11 +62,11 @@ namespace Bloxstrap }; private const string AppSettings = - "\n" + - "\n" + - " content\n" + - " http://www.roblox.com\n" + - "\n"; + "\r\n" + + "\r\n" + + " content\r\n" + + " http://www.roblox.com\r\n" + + "\r\n"; private readonly CancellationTokenSource _cancelTokenSource = new(); @@ -76,7 +76,7 @@ namespace Bloxstrap private string _playerLocation => Path.Combine(_versionFolder, "RobloxPlayerBeta.exe"); - private string? _launchCommandLine; + private string _launchCommandLine; private string _latestVersionGuid = null!; private PackageManifest _versionPackageManifest = null!; @@ -92,7 +92,7 @@ namespace Bloxstrap #endregion #region Core - public Bootstrapper(string? launchCommandLine = null) + public Bootstrapper(string launchCommandLine) { _launchCommandLine = launchCommandLine; @@ -226,8 +226,6 @@ namespace Bloxstrap private async Task StartRoblox() { - string startEventName = App.ProjectName.Replace(" ", "") + "StartEvent"; - SetStatus("Starting Roblox..."); if (_launchCommandLine == "--app" && App.Settings.Prop.UseDisableAppPatch) @@ -237,14 +235,11 @@ namespace Bloxstrap return; } - // launch time isn't really required for all launches, but it's usually just safest to do this - _launchCommandLine += " --launchtime=" + DateTimeOffset.Now.ToUnixTimeMilliseconds(); + _launchCommandLine = _launchCommandLine.Replace("LAUNCHTIMEPLACEHOLDER", DateTimeOffset.Now.ToUnixTimeMilliseconds().ToString()); if (App.Settings.Prop.Channel.ToLower() != DeployManager.DefaultChannel.ToLower()) _launchCommandLine += " -channel " + App.Settings.Prop.Channel.ToLower(); - _launchCommandLine += " -startEvent " + startEventName; - // whether we should wait for roblox to exit to handle stuff in the background or clean up after roblox closes bool shouldWait = false; @@ -256,7 +251,7 @@ namespace Bloxstrap App.Logger.WriteLine($"[Bootstrapper::StartRoblox] Started Roblox (PID {gameClient.Id})"); - using (SystemEvent startEvent = new(startEventName)) + using (SystemEvent startEvent = new("www.roblox.com/robloxStartedEvent")) { bool startEventFired = await startEvent.WaitForEvent(); diff --git a/Bloxstrap/Helpers/JsonManager.cs b/Bloxstrap/Helpers/JsonManager.cs index dde7851..ef39f9c 100644 --- a/Bloxstrap/Helpers/JsonManager.cs +++ b/Bloxstrap/Helpers/JsonManager.cs @@ -7,8 +7,7 @@ namespace Bloxstrap.Helpers public class JsonManager where T : new() { public T Prop { get; set; } = new(); - public virtual string FileLocation => AltFileLocation ?? Path.Combine(Directories.Base, $"{typeof(T).Name}.json"); - public string? AltFileLocation { get; set; } + public virtual string FileLocation => Path.Combine(Directories.Base, $"{typeof(T).Name}.json"); public virtual void Load() { diff --git a/Bloxstrap/Helpers/Protocol.cs b/Bloxstrap/Helpers/Protocol.cs index 8524566..70c56b3 100644 --- a/Bloxstrap/Helpers/Protocol.cs +++ b/Bloxstrap/Helpers/Protocol.cs @@ -18,7 +18,7 @@ namespace Bloxstrap.Helpers { "launchmode", "--" }, { "gameinfo", "-t " }, { "placelauncherurl", "-j "}, - // { "launchtime", "--launchtime=" }, we'll set this when launching the game client + { "launchtime", "--launchtime=" }, { "browsertrackerid", "-b " }, { "robloxLocale", "--rloc " }, { "gameLocale", "--gloc " }, @@ -50,6 +50,10 @@ namespace Bloxstrap.Helpers if (key == "placelauncherurl") val = HttpUtility.UrlDecode(val); + // we'll set this before launching because for some reason roblox just refuses to launch if its like a few minutes old so ??? + if (key == "launchtime") + val = "LAUNCHTIMEPLACEHOLDER"; + if (key == "channel") { if (val.ToLower() != App.Settings.Prop.Channel.ToLower())