fix version argument not working

This commit is contained in:
bluepilledgreat 2025-03-11 22:57:46 +00:00
parent 68556c42b4
commit 5ab1076530
3 changed files with 26 additions and 2 deletions

View File

@ -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()

View File

@ -3,6 +3,10 @@
public enum LaunchMode
{
None,
/// <summary>
/// Launch mode will be determined inside the bootstrapper. Only works if the VersionFlag is set.
/// </summary>
Unknown,
Player,
Studio,
StudioAuth

View File

@ -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)