From c9634abebb10fc3f5761b3bf850e6004cef1e5bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89=E9=B8=AD=E8=9B=8B?= Date: Fri, 27 Dec 2024 02:37:46 +0800 Subject: [PATCH] fix install path get --- BetterGenshinImpact/Genshin/Paths/RegistryGameLocator.cs | 9 +++++---- BetterGenshinImpact/ViewModel/Pages/HomePageViewModel.cs | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/BetterGenshinImpact/Genshin/Paths/RegistryGameLocator.cs b/BetterGenshinImpact/Genshin/Paths/RegistryGameLocator.cs index cfc3992f..1faadeec 100644 --- a/BetterGenshinImpact/Genshin/Paths/RegistryGameLocator.cs +++ b/BetterGenshinImpact/Genshin/Paths/RegistryGameLocator.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using BetterGenshinImpact.GameTask.Common; using Microsoft.Extensions.Logging; using Microsoft.Win32; @@ -17,19 +18,19 @@ public class RegistryGameLocator var cn = Registry.GetValue($@"HKEY_CURRENT_USER\Software\miHoYo\HYP\1_1\hk4e_cn", "GameInstallPath", null) as string; if (!string.IsNullOrEmpty(cn)) { - return cn; + return Path.Combine(cn, "YuanShen.exe"); } var global = Registry.GetValue($@"HKEY_CURRENT_USER\Software\Cognosphere\HYP\1_0\hk4e_global", "GameInstallPath", null) as string; if (!string.IsNullOrEmpty(global)) { - return global; + return Path.Combine(global, "GenshinImpact.exe"); } - var bilibili = Registry.GetValue($@"HKEY_CURRENT_USER\Software\miHoYo\HYP\standalone\14_0\hk4e_bilibili\BilibiliGenshin\hk4e_bilibili", "GameInstallPath", null) as string; + var bilibili = Registry.GetValue($@"HKEY_CURRENT_USER\Software\miHoYo\HYP\standalone\14_0\hk4e_cn\umfgRO5gh5\hk4e_cn", "GameInstallPath", null) as string; if (!string.IsNullOrEmpty(bilibili)) { - return bilibili; + return Path.Combine(bilibili, "YuanShen.exe"); } } catch (Exception e) diff --git a/BetterGenshinImpact/ViewModel/Pages/HomePageViewModel.cs b/BetterGenshinImpact/ViewModel/Pages/HomePageViewModel.cs index 9c1c5203..47888dfb 100644 --- a/BetterGenshinImpact/ViewModel/Pages/HomePageViewModel.cs +++ b/BetterGenshinImpact/ViewModel/Pages/HomePageViewModel.cs @@ -337,17 +337,17 @@ public partial class HomePageViewModel : ObservableObject, INavigationAware, IVi { Task.Run(async () => { - var p1 = RegistryGameLocator.GetDefaultGameInstallPath(); + var p1 = await UnityLogGameLocator.LocateSingleGamePathAsync(); if (!string.IsNullOrEmpty(p1)) { Config.GenshinStartConfig.InstallPath = p1; } else { - var path = await UnityLogGameLocator.LocateSingleGamePathAsync(); - if (!string.IsNullOrEmpty(path)) + var p2 = RegistryGameLocator.GetDefaultGameInstallPath(); + if (!string.IsNullOrEmpty(p2)) { - Config.GenshinStartConfig.InstallPath = path; + Config.GenshinStartConfig.InstallPath = p2; } } });