mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-19 00:51:30 -07:00
More arguments + debug settings (#4814)
* ability to disable package cleanup * add version and channel arguments * ignore duplicate flags * fix version argument not working * add the force flag * fix compiler warnings * fix indentation
This commit is contained in:
parent
9d356b0b71
commit
893aecbdd1
@ -45,8 +45,8 @@ namespace Bloxstrap
|
|||||||
private readonly FastZipEvents _fastZipEvents = new();
|
private readonly FastZipEvents _fastZipEvents = new();
|
||||||
private readonly CancellationTokenSource _cancelTokenSource = new();
|
private readonly CancellationTokenSource _cancelTokenSource = new();
|
||||||
|
|
||||||
private readonly IAppData AppData;
|
private IAppData AppData = default!;
|
||||||
private readonly LaunchMode _launchMode;
|
private LaunchMode _launchMode;
|
||||||
|
|
||||||
private string _launchCommandLine = App.LaunchSettings.RobloxLaunchArgs;
|
private string _launchCommandLine = App.LaunchSettings.RobloxLaunchArgs;
|
||||||
private string _latestVersionGuid = null!;
|
private string _latestVersionGuid = null!;
|
||||||
@ -60,7 +60,7 @@ namespace Bloxstrap
|
|||||||
private long _totalDownloadedBytes = 0;
|
private long _totalDownloadedBytes = 0;
|
||||||
private bool _packageExtractionSuccess = true;
|
private bool _packageExtractionSuccess = true;
|
||||||
|
|
||||||
private bool _mustUpgrade => String.IsNullOrEmpty(AppData.State.VersionGuid) || !File.Exists(AppData.ExecutablePath);
|
private bool _mustUpgrade => App.LaunchSettings.ForceFlag.Active || String.IsNullOrEmpty(AppData.State.VersionGuid) || !File.Exists(AppData.ExecutablePath);
|
||||||
private bool _noConnection = false;
|
private bool _noConnection = false;
|
||||||
|
|
||||||
private AsyncMutex? _mutex;
|
private AsyncMutex? _mutex;
|
||||||
@ -91,6 +91,11 @@ namespace Bloxstrap
|
|||||||
_fastZipEvents.DirectoryFailure += (_, e) => throw e.Exception;
|
_fastZipEvents.DirectoryFailure += (_, e) => throw e.Exception;
|
||||||
_fastZipEvents.ProcessFile += (_, e) => e.ContinueRunning = !_cancelTokenSource.IsCancellationRequested;
|
_fastZipEvents.ProcessFile += (_, e) => e.ContinueRunning = !_cancelTokenSource.IsCancellationRequested;
|
||||||
|
|
||||||
|
SetupAppData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetupAppData()
|
||||||
|
{
|
||||||
AppData = IsStudioLaunch ? new RobloxStudioData() : new RobloxPlayerData();
|
AppData = IsStudioLaunch ? new RobloxStudioData() : new RobloxPlayerData();
|
||||||
Deployment.BinaryType = AppData.BinaryType;
|
Deployment.BinaryType = AppData.BinaryType;
|
||||||
}
|
}
|
||||||
@ -293,7 +298,12 @@ namespace Bloxstrap
|
|||||||
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant
|
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant
|
||||||
);
|
);
|
||||||
|
|
||||||
if (match.Groups.Count == 2)
|
if (App.LaunchSettings.ChannelFlag.Active && !string.IsNullOrEmpty(App.LaunchSettings.ChannelFlag.Data))
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, $"Channel set to {App.LaunchSettings.ChannelFlag.Data} from arguments");
|
||||||
|
Deployment.Channel = App.LaunchSettings.ChannelFlag.Data.ToLowerInvariant();
|
||||||
|
}
|
||||||
|
else if (match.Groups.Count == 2)
|
||||||
{
|
{
|
||||||
Deployment.Channel = match.Groups[1].Value.ToLowerInvariant();
|
Deployment.Channel = match.Groups[1].Value.ToLowerInvariant();
|
||||||
}
|
}
|
||||||
@ -310,6 +320,8 @@ namespace Bloxstrap
|
|||||||
if (!Deployment.IsDefaultChannel)
|
if (!Deployment.IsDefaultChannel)
|
||||||
App.SendStat("robloxChannel", Deployment.Channel);
|
App.SendStat("robloxChannel", Deployment.Channel);
|
||||||
|
|
||||||
|
if (!App.LaunchSettings.VersionFlag.Active || string.IsNullOrEmpty(App.LaunchSettings.VersionFlag.Data))
|
||||||
|
{
|
||||||
ClientVersion clientVersion;
|
ClientVersion clientVersion;
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -327,12 +339,31 @@ namespace Bloxstrap
|
|||||||
key.SetValueSafe("www.roblox.com", Deployment.IsDefaultChannel ? "" : Deployment.Channel);
|
key.SetValueSafe("www.roblox.com", Deployment.IsDefaultChannel ? "" : Deployment.Channel);
|
||||||
|
|
||||||
_latestVersionGuid = clientVersion.VersionGuid;
|
_latestVersionGuid = clientVersion.VersionGuid;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, $"Version set to {App.LaunchSettings.VersionFlag.Data} from arguments");
|
||||||
|
_latestVersionGuid = App.LaunchSettings.VersionFlag.Data;
|
||||||
|
}
|
||||||
|
|
||||||
_latestVersionDirectory = Path.Combine(Paths.Versions, _latestVersionGuid);
|
_latestVersionDirectory = Path.Combine(Paths.Versions, _latestVersionGuid);
|
||||||
|
|
||||||
string pkgManifestUrl = Deployment.GetLocation($"/{_latestVersionGuid}-rbxPkgManifest.txt");
|
string pkgManifestUrl = Deployment.GetLocation($"/{_latestVersionGuid}-rbxPkgManifest.txt");
|
||||||
var pkgManifestData = await App.HttpClient.GetStringAsync(pkgManifestUrl);
|
var pkgManifestData = await App.HttpClient.GetStringAsync(pkgManifestUrl);
|
||||||
|
|
||||||
_versionPackageManifest = new(pkgManifestData);
|
_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()
|
private void StartRoblox()
|
||||||
@ -930,6 +961,8 @@ namespace Bloxstrap
|
|||||||
allPackageHashes.AddRange(App.State.Prop.Player.PackageHashes.Values);
|
allPackageHashes.AddRange(App.State.Prop.Player.PackageHashes.Values);
|
||||||
allPackageHashes.AddRange(App.State.Prop.Studio.PackageHashes.Values);
|
allPackageHashes.AddRange(App.State.Prop.Studio.PackageHashes.Values);
|
||||||
|
|
||||||
|
if (!App.Settings.Prop.DebugDisableVersionPackageCleanup)
|
||||||
|
{
|
||||||
foreach (string hash in cachedPackageHashes)
|
foreach (string hash in cachedPackageHashes)
|
||||||
{
|
{
|
||||||
if (!allPackageHashes.Contains(hash))
|
if (!allPackageHashes.Contains(hash))
|
||||||
@ -947,6 +980,7 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
App.Logger.WriteLine(LOG_IDENT, "Registering approximate program size...");
|
App.Logger.WriteLine(LOG_IDENT, "Registering approximate program size...");
|
||||||
|
|
||||||
|
@ -3,6 +3,10 @@
|
|||||||
public enum LaunchMode
|
public enum LaunchMode
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
|
/// <summary>
|
||||||
|
/// Launch mode will be determined inside the bootstrapper. Only works if the VersionFlag is set.
|
||||||
|
/// </summary>
|
||||||
|
Unknown,
|
||||||
Player,
|
Player,
|
||||||
Studio,
|
Studio,
|
||||||
StudioAuth
|
StudioAuth
|
||||||
|
@ -32,6 +32,12 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
public LaunchFlag StudioFlag { get; } = new("studio");
|
public LaunchFlag StudioFlag { get; } = new("studio");
|
||||||
|
|
||||||
|
public LaunchFlag VersionFlag { get; } = new("version");
|
||||||
|
|
||||||
|
public LaunchFlag ChannelFlag { get; } = new("channel");
|
||||||
|
|
||||||
|
public LaunchFlag ForceFlag { get; } = new("force");
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
public bool BypassUpdateCheck => true;
|
public bool BypassUpdateCheck => true;
|
||||||
#else
|
#else
|
||||||
@ -87,6 +93,13 @@ namespace Bloxstrap
|
|||||||
RobloxLaunchArgs = arg;
|
RobloxLaunchArgs = arg;
|
||||||
startIdx = 1;
|
startIdx = 1;
|
||||||
}
|
}
|
||||||
|
else if (arg.StartsWith("version-"))
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, "Got version argument");
|
||||||
|
VersionFlag.Active = true;
|
||||||
|
VersionFlag.Data = arg;
|
||||||
|
startIdx = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse
|
// parse
|
||||||
@ -108,6 +121,12 @@ namespace Bloxstrap
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flag.Active)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine(LOG_IDENT, $"Tried to set {identifier} flag twice");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
flag.Active = true;
|
flag.Active = true;
|
||||||
|
|
||||||
if (i < Args.Length - 1 && Args[i+1] is string nextArg && !nextArg.StartsWith('-'))
|
if (i < Args.Length - 1 && Args[i+1] is string nextArg && !nextArg.StartsWith('-'))
|
||||||
@ -122,6 +141,9 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (VersionFlag.Active)
|
||||||
|
RobloxLaunchMode = LaunchMode.Unknown; // determine in bootstrapper
|
||||||
|
|
||||||
if (PlayerFlag.Active)
|
if (PlayerFlag.Active)
|
||||||
ParsePlayer(PlayerFlag.Data);
|
ParsePlayer(PlayerFlag.Data);
|
||||||
else if (StudioFlag.Active)
|
else if (StudioFlag.Active)
|
||||||
|
@ -17,6 +17,7 @@ namespace Bloxstrap.Models.Persistable
|
|||||||
public bool UseFastFlagManager { get; set; } = true;
|
public bool UseFastFlagManager { get; set; } = true;
|
||||||
public bool WPFSoftwareRender { get; set; } = false;
|
public bool WPFSoftwareRender { get; set; } = false;
|
||||||
public bool EnableAnalytics { get; set; } = true;
|
public bool EnableAnalytics { get; set; } = true;
|
||||||
|
public bool DebugDisableVersionPackageCleanup { get; set; } = false;
|
||||||
public string? SelectedCustomTheme { get; set; } = null;
|
public string? SelectedCustomTheme { get; set; } = null;
|
||||||
|
|
||||||
// integration configuration
|
// integration configuration
|
||||||
|
Loading…
Reference in New Issue
Block a user