diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/Launching/Handler/LaunchExecutionUnlockFpsHandler.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/Launching/Handler/LaunchExecutionUnlockFpsHandler.cs index d2e05f03..28df662b 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/Game/Launching/Handler/LaunchExecutionUnlockFpsHandler.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/Launching/Handler/LaunchExecutionUnlockFpsHandler.cs @@ -23,8 +23,10 @@ internal sealed class LaunchExecutionUnlockFpsHandler : ILaunchExecutionDelegate try { - await unlocker.UnlockAsync(context.CancellationToken).ConfigureAwait(false); - unlocker.PostUnlockAsync(context.CancellationToken).SafeForget(); + if (await unlocker.UnlockAsync(context.CancellationToken).ConfigureAwait(false)) + { + unlocker.PostUnlockAsync(context.CancellationToken).SafeForget(); + } } catch (InvalidOperationException ex) { diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/Unlocker/GameFpsUnlocker.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/Unlocker/GameFpsUnlocker.cs index fa6a996a..71ba37be 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/Game/Unlocker/GameFpsUnlocker.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/Unlocker/GameFpsUnlocker.cs @@ -28,7 +28,7 @@ internal sealed class GameFpsUnlocker : IGameFpsUnlocker } /// - public async ValueTask UnlockAsync(CancellationToken token = default) + public async ValueTask UnlockAsync(CancellationToken token = default) { HutaoException.ThrowIfNot(state.IsUnlockerValid, HutaoExceptionKind.GameFpsUnlockingFailed, "This Unlocker is invalid"); (FindModuleResult result, RequiredGameModule gameModule) = await GameProcessModule.FindModuleAsync(state).ConfigureAwait(false); @@ -37,6 +37,7 @@ internal sealed class GameFpsUnlocker : IGameFpsUnlocker GameFpsAddress.UnsafeFindFpsAddress(state, gameModule); state.Report(); + return state.FpsAddress != 0U; } public async ValueTask PostUnlockAsync(CancellationToken token = default) diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/Unlocker/IGameFpsUnlocker.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/Unlocker/IGameFpsUnlocker.cs index 21fe40dd..a2eda5b6 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/Game/Unlocker/IGameFpsUnlocker.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/Unlocker/IGameFpsUnlocker.cs @@ -11,5 +11,5 @@ internal interface IGameFpsUnlocker { ValueTask PostUnlockAsync(CancellationToken token = default); - ValueTask UnlockAsync(CancellationToken token = default); + ValueTask UnlockAsync(CancellationToken token = default); } \ No newline at end of file