diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/GameService.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/GameService.cs index cbff5252..880a804a 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/Game/GameService.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/GameService.cs @@ -163,7 +163,7 @@ internal sealed partial class GameService : IGameService } } - return changed || !LaunchSchemeMatchesExecutable(scheme, Path.GetFileName(gamePath)); + return changed; } /// @@ -398,4 +398,6 @@ internal sealed partial class GameService : IGameService _ => false, }; } + + private static bool LaunchScheme } \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.cs index 08e445db..00f69330 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. using Snap.Hutao.Model.Intrinsic; +using System.IO; namespace Snap.Hutao.Service.Game; @@ -64,4 +65,29 @@ internal sealed partial class LaunchScheme { return Channel == multiChannel.Channel && SubChannel == multiChannel.SubChannel; } + + public bool ExecutableMatches(string gameFileName) + { + return (IsOversea, gameFileName) switch + { + (true, GameConstants.GenshinImpactFileName) => true, + (false, GameConstants.YuanShenFileName) => true, + _ => false, + }; + } + + public bool SdkLibraryMatches(string gameFolder) + { + if (IsOversea) + { + return false; + } + + if (LauncherId is SdkStaticLauncherBilibiliId) + { + + } + + string sdkDll = Path.Combine(gameFolder, GameConstants.YuanShenData, "Plugins\\PCGameSDK.dll"); + } } \ No newline at end of file diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs index 0e7a8d6e..73147c10 100644 --- a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs +++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs @@ -186,18 +186,17 @@ internal sealed partial class LaunchGameViewModel : Abstraction.ViewModel { try { - if (gameService.SetChannelOptions(SelectedScheme)) + gameService.SetChannelOptions(SelectedScheme); + + // Whether or not the channel options changed, we always ensure game resouces + LaunchGamePackageConvertDialog dialog = await contentDialogFactory.CreateInstanceAsync().ConfigureAwait(false); + IProgress convertProgress = taskContext.CreateProgressForMainThread(state => dialog.State = state); + using (await dialog.BlockAsync(taskContext).ConfigureAwait(false)) { - // Channel changed, we need to change local file. - LaunchGamePackageConvertDialog dialog = await contentDialogFactory.CreateInstanceAsync().ConfigureAwait(false); - IProgress convertProgress = taskContext.CreateProgressForMainThread(state => dialog.State = state); - using (await dialog.BlockAsync(taskContext).ConfigureAwait(false)) + if (!await gameService.EnsureGameResourceAsync(SelectedScheme, convertProgress).ConfigureAwait(false)) { - if (!await gameService.EnsureGameResourceAsync(SelectedScheme, convertProgress).ConfigureAwait(false)) - { - infoBarService.Warning(SH.ViewModelLaunchGameEnsureGameResourceFail); - return; - } + infoBarService.Warning(SH.ViewModelLaunchGameEnsureGameResourceFail); + return; } }