Compare commits

...

1 Commits

Author SHA1 Message Date
qhy040404
0f29d260dd Use SpinWait to wait game window instead of WaitForInputIdle 2024-03-15 22:24:47 +08:00

View File

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