diff --git a/MAA.sln.DotSettings b/MAA.sln.DotSettings index 10229301c4..de1dfb6710 100644 --- a/MAA.sln.DotSettings +++ b/MAA.sln.DotSettings @@ -69,6 +69,7 @@ True True True + True True True True diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index 5f60593e1c..c076f37012 100644 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -4320,6 +4320,38 @@ namespace MaaWpfGui.ViewModels.UI if (value) { MessageBoxHelper.Show(LocalizationHelper.GetString("LdExtrasEnabledTip")); + + // 读取 LD 注册表地址 并填充GUI + if (string.IsNullOrEmpty(EmulatorPath)) + { + try + { + const string UninstallKeyPath = @"Software\leidian\ldplayer9"; + const string InstallDirValueName = "InstallDir"; + + using RegistryKey? driverKey = Registry.CurrentUser.OpenSubKey(UninstallKeyPath); + if (driverKey == null) + { + EmulatorPath = string.Empty; + return; + } + + string? installDir = driverKey.GetValue(InstallDirValueName) as string; + + if (string.IsNullOrEmpty(installDir)) + { + EmulatorPath = string.Empty; + return; + } + + EmulatorPath = installDir; + } + catch (Exception e) + { + _logger.Warning($"An error occurred: {e.Message}"); + EmulatorPath = string.Empty; + } + } } Instances.AsstProxy.Connected = false;