From 3b7a363aa06cbc851e9c3500b279cae0393e6d36 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Fri, 21 Apr 2023 13:25:28 +0100 Subject: [PATCH] Auto switch to LIVE if using ReShade --- Bloxstrap/App.xaml.cs | 4 +++ Bloxstrap/Helpers/DeployManager.cs | 2 +- Bloxstrap/Integrations/ReShade.cs | 37 ++++++++++++++++++--- Bloxstrap/Views/Pages/BehaviourPage.xaml | 4 +-- Bloxstrap/Views/Pages/IntegrationsPage.xaml | 11 +++++- 5 files changed, 50 insertions(+), 8 deletions(-) diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index 6446109..2954958 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -16,6 +16,7 @@ using Microsoft.Win32; using Bloxstrap.Dialogs; using Bloxstrap.Enums; using Bloxstrap.Helpers; +using Bloxstrap.Integrations; using Bloxstrap.Models; using Bloxstrap.Views; @@ -262,6 +263,9 @@ namespace Bloxstrap DeployManager.Channel = Settings.Prop.Channel; + if (Settings.Prop.UseReShade) + ReShade.CheckRobloxReleaseChannel().Wait(); + // start bootstrapper and show the bootstrapper modal if we're not running silently Logger.WriteLine($"[App::OnStartup] Initializing bootstrapper"); Bootstrapper bootstrapper = new(commandLine); diff --git a/Bloxstrap/Helpers/DeployManager.cs b/Bloxstrap/Helpers/DeployManager.cs index 2f88c9d..c87534d 100644 --- a/Bloxstrap/Helpers/DeployManager.cs +++ b/Bloxstrap/Helpers/DeployManager.cs @@ -94,7 +94,7 @@ namespace Bloxstrap.Helpers { App.Logger.WriteLine($"[DeployManager::GetLastDeploy] Getting deploy info for channel {Channel} (timestamp={timestamp})"); - HttpResponseMessage deployInfoResponse = await App.HttpClient.GetAsync($"https://clientsettings.roblox.com/v2/client-version/WindowsPlayer/channel/{Channel}"); + HttpResponseMessage deployInfoResponse = await App.HttpClient.GetAsync($"https://clientsettings.roblox.com/v2/client-version/WindowsPlayer/channel/{Channel}").ConfigureAwait(false); string rawResponse = await deployInfoResponse.Content.ReadAsStringAsync(); diff --git a/Bloxstrap/Integrations/ReShade.cs b/Bloxstrap/Integrations/ReShade.cs index 5931f1e..1a541aa 100644 --- a/Bloxstrap/Integrations/ReShade.cs +++ b/Bloxstrap/Integrations/ReShade.cs @@ -1,14 +1,13 @@ using System; -using System.Collections; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; using System.Threading.Tasks; -using Bloxstrap.Helpers; +using System.Windows; +using Bloxstrap.Helpers; using Bloxstrap.Models; using IniParser; @@ -501,5 +500,35 @@ namespace Bloxstrap.Integrations SynchronizeConfigFile(); } - } + + public static async Task CheckRobloxReleaseChannel() + { + App.Logger.WriteLine($"[ReShade::CheckRobloxReleaseChannel] Checking current Roblox release channel ({App.Settings.Prop.Channel})..."); + + if (App.Settings.Prop.Channel.ToLower() == DeployManager.DefaultChannel.ToLower()) + { + App.Logger.WriteLine($"[App::OnStartup] Channel is already {DeployManager.DefaultChannel}"); + return; + } + + ClientVersion versionInfo = await App.DeployManager.GetLastDeploy().ConfigureAwait(false); + string manifest = await App.HttpClient.GetStringAsync($"{App.DeployManager.BaseUrl}/{versionInfo.VersionGuid}-rbxManifest.txt"); + + if (!manifest.Contains("RobloxPlayerBeta.dll")) + return; + + MessageBoxResult result = !App.Settings.Prop.PromptChannelChange ? MessageBoxResult.Yes : App.ShowMessageBox( + $"You currently have ReShade enabled, however your current preferred channel ({App.Settings.Prop.Channel}) does not support ReShade. Would you like to switch to {DeployManager.DefaultChannel}? ", + MessageBoxImage.Question, + MessageBoxButton.YesNo + ); + + if (result != MessageBoxResult.Yes) + return; + + App.Logger.WriteLine($"[App::OnStartup] Changed Roblox build channel from {App.Settings.Prop.Channel} to {DeployManager.DefaultChannel}"); + App.DeployManager.Channel = App.Settings.Prop.Channel = DeployManager.DefaultChannel; + } + + } } diff --git a/Bloxstrap/Views/Pages/BehaviourPage.xaml b/Bloxstrap/Views/Pages/BehaviourPage.xaml index 8b677b7..35ed8ff 100644 --- a/Bloxstrap/Views/Pages/BehaviourPage.xaml +++ b/Bloxstrap/Views/Pages/BehaviourPage.xaml @@ -43,8 +43,8 @@ - - + + diff --git a/Bloxstrap/Views/Pages/IntegrationsPage.xaml b/Bloxstrap/Views/Pages/IntegrationsPage.xaml index a204986..4800714 100644 --- a/Bloxstrap/Views/Pages/IntegrationsPage.xaml +++ b/Bloxstrap/Views/Pages/IntegrationsPage.xaml @@ -34,6 +34,15 @@ + + + + + + + + + @@ -106,7 +115,7 @@ - +