Merge pull request #1484 from DGP-Studio/feat/spinwait_game_window

This commit is contained in:
DismissedLight
2024-03-16 16:57:17 +08:00
committed by GitHub

View File

@@ -26,11 +26,12 @@ internal sealed class LaunchExecutionBetterGenshinImpactAutomationHandlder : ILa
try
{
context.Logger.LogInformation("Waiting game window to be ready");
context.Process.WaitForInputIdle();
SpinWait.SpinUntil(() => context.Process.MainWindowHandle != IntPtr.Zero);
}
catch (InvalidOperationException)
{
context.Logger.LogInformation("Failed to wait Input idle waiting");
context.Logger.LogInformation("Failed to get game window handle");
return;
}