Merge pull request #682 from Soreepeong/feature/inject-via-entrypoint

Add DelayInitializeMs to DalamudStartInfo
This commit is contained in:
goaaats 2021-11-12 19:50:57 +01:00 committed by GitHub
commit 681be5b743
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View file

@ -198,7 +198,7 @@ HWND try_find_game_window() {
DWORD pid;
GetWindowThreadProcessId(hwnd, &pid);
if (pid == GetCurrentProcessId())
if (pid == GetCurrentProcessId() && IsWindowVisible(hwnd))
break;
}
return hwnd;

View file

@ -51,5 +51,10 @@ namespace Dalamud
/// Gets a value indicating whether or not market board information should be uploaded by default.
/// </summary>
public bool OptOutMbCollection { get; init; }
/// <summary>
/// Gets a value that specifies how much to wait before a new Dalamud session.
/// </summary>
public int DelayInitializeMs { get; init; } = 0;
}
}

View file

@ -79,6 +79,12 @@ namespace Dalamud
try
{
if (info.DelayInitializeMs > 0)
{
Log.Information(string.Format("Waiting for {0}ms before starting a session.", info.DelayInitializeMs));
Thread.Sleep(info.DelayInitializeMs);
}
Log.Information(new string('-', 80));
Log.Information("Initializing a session..");