mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
fix unlocking fps
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ internal sealed class GameFpsUnlocker : IGameFpsUnlocker
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public async ValueTask UnlockAsync(CancellationToken token = default)
|
||||
public async ValueTask<bool> 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)
|
||||
|
||||
@@ -11,5 +11,5 @@ internal interface IGameFpsUnlocker
|
||||
{
|
||||
ValueTask PostUnlockAsync(CancellationToken token = default);
|
||||
|
||||
ValueTask UnlockAsync(CancellationToken token = default);
|
||||
ValueTask<bool> UnlockAsync(CancellationToken token = default);
|
||||
}
|
||||
Reference in New Issue
Block a user