diff --git a/CollapseLauncher/Classes/GameManagement/GameSettings/StarRail/RegistryClass/Model.cs b/CollapseLauncher/Classes/GameManagement/GameSettings/StarRail/RegistryClass/Model.cs index 2c9a58d96..fbac6b5a4 100644 --- a/CollapseLauncher/Classes/GameManagement/GameSettings/StarRail/RegistryClass/Model.cs +++ b/CollapseLauncher/Classes/GameManagement/GameSettings/StarRail/RegistryClass/Model.cs @@ -1,11 +1,13 @@ using CollapseLauncher.GameSettings.StarRail.Context; using CollapseLauncher.Interfaces; +using CollapseLauncher.Pages; using Hi3Helper; using Hi3Helper.EncTool; using Microsoft.Win32; using System; using System.Collections.Generic; using System.Text; +using System.Threading.Tasks; using static CollapseLauncher.GameSettings.Base.SettingsBase; using static Hi3Helper.Logger; @@ -329,6 +331,13 @@ public void Save() try { if (RegistryRoot == null) throw new NullReferenceException($"Cannot save {_ValueName} since RegistryKey is unexpectedly not initialized!"); + + if (StarRailGameSettingsPage.CheckAbTest()) + { + LogWriteLine("[StarRailGameSettings::Model] Graphics settings could not be saved due to A/B test flag is found!", + LogType.Error, true); + return; + } RegistryRoot.SetValue(_GraphicsQuality, Quality.Custom, RegistryValueKind.DWord); diff --git a/CollapseLauncher/XAMLs/MainApp/Pages/GameSettingsPages/StarRailGameSettingsPage.xaml.cs b/CollapseLauncher/XAMLs/MainApp/Pages/GameSettingsPages/StarRailGameSettingsPage.xaml.cs index ece700ddd..060b2bb3c 100644 --- a/CollapseLauncher/XAMLs/MainApp/Pages/GameSettingsPages/StarRailGameSettingsPage.xaml.cs +++ b/CollapseLauncher/XAMLs/MainApp/Pages/GameSettingsPages/StarRailGameSettingsPage.xaml.cs @@ -17,6 +17,7 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Numerics; + using System.Threading.Tasks; using Windows.UI; using static Hi3Helper.Locale; using static Hi3Helper.Logger; @@ -88,12 +89,24 @@ private async void LoadPage() InheritApplyTextColor = ApplyText.Foreground!; #nullable enable // A/B Testing as of 2023-12-26 (HSR v1.6.0) + if (CheckAbTest()) + { + await SimpleDialogs.Dialog_GenericWarning(Content!); + } + } + + /// + /// Returns true if A/B test registry identifier is found. + /// + public static bool CheckAbTest() + { object? abValue = Registry.GetValue(@"HKEY_CURRENT_USER\Software\Cognosphere\Star Rail", _AbValueName, null); if (abValue != null) { - await SimpleDialogs.Dialog_GenericWarning(Content!); LogWriteLine($"A/B Value Found. Settings will not apply to the game.", LogType.Warning, true); + return true; } + return false; } #nullable disable private void RegistryExportClick(object sender, RoutedEventArgs e)