From 5ab1076530f9d58e13ba852c525ee11ee509eb02 Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Tue, 11 Mar 2025 22:57:46 +0000 Subject: [PATCH] fix version argument not working --- Bloxstrap/Bootstrapper.cs | 21 +++++++++++++++++++-- Bloxstrap/Enums/LaunchMode.cs | 4 ++++ Bloxstrap/LaunchSettings.cs | 3 +++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 3133c06..8d06814 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -45,8 +45,8 @@ namespace Bloxstrap private readonly FastZipEvents _fastZipEvents = new(); private readonly CancellationTokenSource _cancelTokenSource = new(); - private readonly IAppData AppData; - private readonly LaunchMode _launchMode; + private IAppData AppData; + private LaunchMode _launchMode; private string _launchCommandLine = App.LaunchSettings.RobloxLaunchArgs; private string _latestVersionGuid = null!; @@ -91,6 +91,11 @@ namespace Bloxstrap _fastZipEvents.DirectoryFailure += (_, e) => throw e.Exception; _fastZipEvents.ProcessFile += (_, e) => e.ContinueRunning = !_cancelTokenSource.IsCancellationRequested; + SetupAppData(); + } + + private void SetupAppData() + { AppData = IsStudioLaunch ? new RobloxStudioData() : new RobloxPlayerData(); Deployment.BinaryType = AppData.BinaryType; } @@ -347,6 +352,18 @@ namespace Bloxstrap var pkgManifestData = await App.HttpClient.GetStringAsync(pkgManifestUrl); _versionPackageManifest = new(pkgManifestData); + + // this can happen if version is set through arguments + if (_launchMode == LaunchMode.Unknown) + { + App.Logger.WriteLine(LOG_IDENT, "Identifying launch mode from package manifest"); + + bool isPlayer = _versionPackageManifest.Exists(x => x.Name == "RobloxApp.zip"); + App.Logger.WriteLine(LOG_IDENT, $"isPlayer: {isPlayer}"); + + _launchMode = isPlayer ? LaunchMode.Player : LaunchMode.Studio; + SetupAppData(); // we need to set it up again + } } private void StartRoblox() diff --git a/Bloxstrap/Enums/LaunchMode.cs b/Bloxstrap/Enums/LaunchMode.cs index c045d4f..4778442 100644 --- a/Bloxstrap/Enums/LaunchMode.cs +++ b/Bloxstrap/Enums/LaunchMode.cs @@ -3,6 +3,10 @@ public enum LaunchMode { None, + /// + /// Launch mode will be determined inside the bootstrapper. Only works if the VersionFlag is set. + /// + Unknown, Player, Studio, StudioAuth diff --git a/Bloxstrap/LaunchSettings.cs b/Bloxstrap/LaunchSettings.cs index 625f32b..b3ce012 100644 --- a/Bloxstrap/LaunchSettings.cs +++ b/Bloxstrap/LaunchSettings.cs @@ -139,6 +139,9 @@ namespace Bloxstrap } } + if (VersionFlag.Active) + RobloxLaunchMode = LaunchMode.Unknown; // determine in bootstrapper + if (PlayerFlag.Active) ParsePlayer(PlayerFlag.Data); else if (StudioFlag.Active)