mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Merge branch 'version-2.1.1' into version-2.2.0
This commit is contained in:
commit
7fa4a0b989
@ -38,6 +38,10 @@ namespace Bloxstrap
|
|||||||
{ "shaders.zip", @"shaders\" },
|
{ "shaders.zip", @"shaders\" },
|
||||||
{ "ssl.zip", @"ssl\" },
|
{ "ssl.zip", @"ssl\" },
|
||||||
|
|
||||||
|
// the runtime installer is only extracted if it needs installing
|
||||||
|
{ "WebView2.zip", @"" },
|
||||||
|
{ "WebView2RuntimeInstaller.zip", @"WebView2RuntimeInstaller\" },
|
||||||
|
|
||||||
{ "content-avatar.zip", @"content\avatar\" },
|
{ "content-avatar.zip", @"content\avatar\" },
|
||||||
{ "content-configs.zip", @"content\configs\" },
|
{ "content-configs.zip", @"content\configs\" },
|
||||||
{ "content-fonts.zip", @"content\fonts\" },
|
{ "content-fonts.zip", @"content\fonts\" },
|
||||||
@ -68,11 +72,13 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
private static bool FreshInstall => String.IsNullOrEmpty(App.State.Prop.VersionGuid);
|
private static bool FreshInstall => String.IsNullOrEmpty(App.State.Prop.VersionGuid);
|
||||||
private static string DesktopShortcutLocation => Path.Combine(Directories.Desktop, "Play Roblox.lnk");
|
private static string DesktopShortcutLocation => Path.Combine(Directories.Desktop, "Play Roblox.lnk");
|
||||||
|
private static bool ShouldInstallWebView2 = false;
|
||||||
|
|
||||||
private string _playerLocation => Path.Combine(_versionFolder, "RobloxPlayerBeta.exe");
|
private string _playerLocation => Path.Combine(_versionFolder, "RobloxPlayerBeta.exe");
|
||||||
|
|
||||||
private string? _launchCommandLine;
|
private string? _launchCommandLine;
|
||||||
|
|
||||||
private string _versionGuid = null!;
|
private string _latestVersionGuid = null!;
|
||||||
private PackageManifest _versionPackageManifest = null!;
|
private PackageManifest _versionPackageManifest = null!;
|
||||||
private string _versionFolder = null!;
|
private string _versionFolder = null!;
|
||||||
|
|
||||||
@ -89,6 +95,18 @@ namespace Bloxstrap
|
|||||||
public Bootstrapper(string? launchCommandLine = null)
|
public Bootstrapper(string? launchCommandLine = null)
|
||||||
{
|
{
|
||||||
_launchCommandLine = launchCommandLine;
|
_launchCommandLine = launchCommandLine;
|
||||||
|
|
||||||
|
// check if the webview2 runtime needs to be installed
|
||||||
|
// webview2 can either be installed be per-user or globally, so we need to check in both hklm and hkcu
|
||||||
|
// https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#online-only-deployment
|
||||||
|
|
||||||
|
string hklmLocation = "SOFTWARE\\WOW6432Node\\Microsoft\\EdgeUpdate\\Clients\\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}";
|
||||||
|
string hkcuLocation = "Software\\Microsoft\\EdgeUpdate\\Clients\\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}";
|
||||||
|
|
||||||
|
if (!Environment.Is64BitOperatingSystem)
|
||||||
|
hklmLocation = "SOFTWARE\\Microsoft\\EdgeUpdate\\Clients\\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}";
|
||||||
|
|
||||||
|
ShouldInstallWebView2 = Registry.LocalMachine.OpenSubKey(hklmLocation) is null && Registry.CurrentUser.OpenSubKey(hkcuLocation) is null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetStatus(string message)
|
private void SetStatus(string message)
|
||||||
@ -147,7 +165,7 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
// only update roblox if we're running for the first time, or if
|
// only update roblox if we're running for the first time, or if
|
||||||
// roblox isn't running and our version guid is out of date, or the player exe doesn't exist
|
// roblox isn't running and our version guid is out of date, or the player exe doesn't exist
|
||||||
if (App.IsFirstRun || !Utilities.CheckIfRobloxRunning() && (_versionGuid != App.State.Prop.VersionGuid || !File.Exists(_playerLocation)))
|
if (App.IsFirstRun || !Utilities.CheckIfRobloxRunning() && (_latestVersionGuid != App.State.Prop.VersionGuid || !File.Exists(_playerLocation)))
|
||||||
await InstallLatestVersion();
|
await InstallLatestVersion();
|
||||||
|
|
||||||
// last time the version folder was set, it was set to the latest version guid
|
// last time the version folder was set, it was set to the latest version guid
|
||||||
@ -160,6 +178,9 @@ namespace Bloxstrap
|
|||||||
IntegrationMigrator.Execute();
|
IntegrationMigrator.Execute();
|
||||||
App.FastFlags.Save();
|
App.FastFlags.Save();
|
||||||
|
|
||||||
|
if (ShouldInstallWebView2)
|
||||||
|
await InstallWebView2();
|
||||||
|
|
||||||
if (App.Settings.Prop.UseReShade)
|
if (App.Settings.Prop.UseReShade)
|
||||||
SetStatus("Configuring/Downloading ReShade...");
|
SetStatus("Configuring/Downloading ReShade...");
|
||||||
|
|
||||||
@ -244,9 +265,9 @@ namespace Bloxstrap
|
|||||||
SetStatus("Connecting to Roblox...");
|
SetStatus("Connecting to Roblox...");
|
||||||
|
|
||||||
ClientVersion clientVersion = await App.DeployManager.GetLastDeploy();
|
ClientVersion clientVersion = await App.DeployManager.GetLastDeploy();
|
||||||
_versionGuid = clientVersion.VersionGuid;
|
_latestVersionGuid = clientVersion.VersionGuid;
|
||||||
_versionFolder = Path.Combine(Directories.Versions, _versionGuid);
|
_versionFolder = Path.Combine(Directories.Versions, _latestVersionGuid);
|
||||||
_versionPackageManifest = await PackageManifest.Get(_versionGuid);
|
_versionPackageManifest = await PackageManifest.Get(_latestVersionGuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckInstallMigration()
|
private void CheckInstallMigration()
|
||||||
@ -664,8 +685,13 @@ namespace Bloxstrap
|
|||||||
// download all the packages synchronously
|
// download all the packages synchronously
|
||||||
await DownloadPackage(package);
|
await DownloadPackage(package);
|
||||||
|
|
||||||
|
// we'll extract the runtime installer later if we need to
|
||||||
|
if (package.Name == "WebView2RuntimeInstaller.zip")
|
||||||
|
continue;
|
||||||
|
|
||||||
// extract the package immediately after download asynchronously
|
// extract the package immediately after download asynchronously
|
||||||
ExtractPackage(package);
|
// discard is just used to suppress the warning
|
||||||
|
Task _ = ExtractPackage(package);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_cancelFired)
|
if (_cancelFired)
|
||||||
@ -680,8 +706,8 @@ namespace Bloxstrap
|
|||||||
SetStatus("Configuring Roblox...");
|
SetStatus("Configuring Roblox...");
|
||||||
}
|
}
|
||||||
|
|
||||||
// wait for all packages to finish extracting
|
// wait for all packages to finish extracting, with an exception for the webview2 runtime installer
|
||||||
while (_packagesExtracted < _versionPackageManifest.Count)
|
while (_packagesExtracted < _versionPackageManifest.Where(x => x.Name != "WebView2RuntimeInstaller.zip").Count())
|
||||||
{
|
{
|
||||||
await Task.Delay(100);
|
await Task.Delay(100);
|
||||||
}
|
}
|
||||||
@ -708,9 +734,11 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
string oldVersionFolder = Path.Combine(Directories.Versions, App.State.Prop.VersionGuid);
|
string oldVersionFolder = Path.Combine(Directories.Versions, App.State.Prop.VersionGuid);
|
||||||
|
|
||||||
// and also to delete our old version folder
|
if (_latestVersionGuid != App.State.Prop.VersionGuid && Directory.Exists(oldVersionFolder))
|
||||||
if (_versionGuid != App.State.Prop.VersionGuid && Directory.Exists(oldVersionFolder))
|
{
|
||||||
|
// and also to delete our old version folder
|
||||||
Directory.Delete(oldVersionFolder, true);
|
Directory.Delete(oldVersionFolder, true);
|
||||||
|
}
|
||||||
|
|
||||||
// move old compatibility flags for the old location
|
// move old compatibility flags for the old location
|
||||||
using (RegistryKey appFlagsKey = Registry.CurrentUser.CreateSubKey($"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"))
|
using (RegistryKey appFlagsKey = Registry.CurrentUser.CreateSubKey($"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"))
|
||||||
@ -730,11 +758,47 @@ namespace Bloxstrap
|
|||||||
if (Dialog is not null)
|
if (Dialog is not null)
|
||||||
Dialog.CancelEnabled = false;
|
Dialog.CancelEnabled = false;
|
||||||
|
|
||||||
App.State.Prop.VersionGuid = _versionGuid;
|
App.State.Prop.VersionGuid = _latestVersionGuid;
|
||||||
|
|
||||||
_isInstalling = false;
|
_isInstalling = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task InstallWebView2()
|
||||||
|
{
|
||||||
|
if (!ShouldInstallWebView2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
App.Logger.WriteLine($"[Bootstrapper::InstallWebView2] Installing runtime...");
|
||||||
|
|
||||||
|
string baseDirectory = Path.Combine(_versionFolder, "WebView2RuntimeInstaller");
|
||||||
|
|
||||||
|
if (!Directory.Exists(baseDirectory))
|
||||||
|
{
|
||||||
|
Package? package = _versionPackageManifest.Find(x => x.Name == "WebView2RuntimeInstaller.zip");
|
||||||
|
|
||||||
|
if (package is null)
|
||||||
|
{
|
||||||
|
App.Logger.WriteLine($"[Bootstrapper::InstallWebView2] Aborted runtime install because package does not exist, has WebView2 been added in this Roblox version yet?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await ExtractPackage(package);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetStatus("Installing WebView2, please wait...");
|
||||||
|
|
||||||
|
ProcessStartInfo startInfo = new()
|
||||||
|
{
|
||||||
|
WorkingDirectory = baseDirectory,
|
||||||
|
FileName = Path.Combine(baseDirectory, "MicrosoftEdgeWebview2Setup.exe"),
|
||||||
|
Arguments = "/silent /install"
|
||||||
|
};
|
||||||
|
|
||||||
|
await Process.Start(startInfo)!.WaitForExitAsync();
|
||||||
|
|
||||||
|
App.Logger.WriteLine($"[Bootstrapper::InstallWebView2] Finished installing runtime");
|
||||||
|
}
|
||||||
|
|
||||||
private async Task ApplyModifications()
|
private async Task ApplyModifications()
|
||||||
{
|
{
|
||||||
SetStatus("Applying Roblox modifications...");
|
SetStatus("Applying Roblox modifications...");
|
||||||
@ -882,7 +946,7 @@ namespace Bloxstrap
|
|||||||
if (_cancelFired)
|
if (_cancelFired)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string packageUrl = $"{App.DeployManager.BaseUrl}/{_versionGuid}-{package.Name}";
|
string packageUrl = $"{App.DeployManager.BaseUrl}/{_latestVersionGuid}-{package.Name}";
|
||||||
string packageLocation = Path.Combine(Directories.Downloads, package.Signature);
|
string packageLocation = Path.Combine(Directories.Downloads, package.Signature);
|
||||||
string robloxPackageLocation = Path.Combine(Directories.LocalAppData, "Roblox", "Downloads", package.Signature);
|
string robloxPackageLocation = Path.Combine(Directories.LocalAppData, "Roblox", "Downloads", package.Signature);
|
||||||
|
|
||||||
@ -952,7 +1016,7 @@ namespace Bloxstrap
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void ExtractPackage(Package package)
|
private async Task ExtractPackage(Package package)
|
||||||
{
|
{
|
||||||
if (_cancelFired)
|
if (_cancelFired)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user