From 104f8e8de7db006e33dd03ae8b8d456073879b00 Mon Sep 17 00:00:00 2001 From: octopus_yan Date: Fri, 2 Aug 2024 05:05:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BC=80=E5=90=AFmumu=E5=A2=9E?= =?UTF-8?q?=E5=BC=BA=E6=88=AA=E5=9B=BE=E6=97=B6=E5=B0=9D=E8=AF=95=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E6=B3=A8=E5=86=8C=E8=A1=A8=E5=9C=B0=E5=9D=80=E5=B9=B6?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=A1=AB=E5=85=85=20(#9076)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/UI/SettingsViewModel.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs index 566c9aa7bc..e56979bbee 100644 --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -3890,6 +3890,24 @@ namespace MaaWpfGui.ViewModels.UI if (value) { MessageBoxHelper.Show(LocalizationHelper.GetString("MuMu12ExtrasEnabledTip")); + + // 读取mumu注册表地址 并填充GUI + #if WINDOWS + if (string.Empty.Equals(EmulatorPath)) + { + try + { + RegistryKey driverKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MuMuPlayer-12.0"); + string result = (String)driverKey.GetValue("UninstallString"); + // MessageBoxHelper.Show(result.Substring(1, result.IndexOf("\\uninstall.exe") - 1)); + EmulatorPath = result.Substring(1, result.IndexOf("\\uninstall.exe") - 1); + } + catch(Exception e) + { + // 暂不处理 + } + } + #endif } Instances.AsstProxy.Connected = false; @@ -3909,7 +3927,7 @@ namespace MaaWpfGui.ViewModels.UI get => _emulatorPath; set { - if (!Directory.Exists(value)) + if (!Directory.Exists(value) && _enable) { MessageBoxHelper.Show("MuMu Emulator 12 Path Not Found"); value = string.Empty;