Skip to content

Commit

Permalink
Fix #1305: "Select device" hides under other program without MTA icon…
Browse files Browse the repository at this point in the history
… on a taskbar
  • Loading branch information
ccw808 committed Mar 20, 2020
1 parent f3d80a7 commit 2c5251a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions Client/loader/MainFunctions.cpp
Expand Up @@ -1175,7 +1175,6 @@ int LaunchGame(SString strCmdLine)
BsodDetectionOnGameBegin();
// Show splash until game window is displayed (or max 20 seconds)
DWORD status;
bool bShownDeviceSelectionDialog = false;
for (uint i = 0; i < 20; i++)
{
status = WaitForSingleObject(piLoadee.hProcess, 1000);
Expand All @@ -1188,16 +1187,18 @@ int LaunchGame(SString strCmdLine)
break;
}

// Skip stuck process warning if DeviceSelection dialog is still open after 4 seconds
if (i >= 4)
bShownDeviceSelectionDialog |= IsDeviceSelectionDialogOpen(piLoadee.dwThreadId);
// Keep showing splash if the device selection dialog is open
if (IsDeviceSelectionDialogOpen(piLoadee.dwThreadId))
{
i--;
}
}

// Actually hide the splash
HideSplash();

// If hasn't shown the loading screen and gta_sa.exe process memory usage is not changing, give user option to terminate
if (status == WAIT_TIMEOUT && !bShownDeviceSelectionDialog)
if (status == WAIT_TIMEOUT)
{
CStuckProcessDetector stuckProcessDetector(piLoadee.hProcess, 5000);
while (status == WAIT_TIMEOUT && WatchDogIsSectionOpen("L3")) // Gets closed when loading screen is shown
Expand Down
3 changes: 2 additions & 1 deletion Client/loader/Utils.cpp
Expand Up @@ -2155,7 +2155,8 @@ BOOL CALLBACK MyEnumThreadWndProc(HWND hwnd, LPARAM lParam)
{
if (windowInfo.atomWindowType == reinterpret_cast<uint>(WC_DIALOG))
{
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
// Ensure dialog is not hidden by other applications
SetForegroundWindow(hwnd);
return false;
}
}
Expand Down

0 comments on commit 2c5251a

Please sign in to comment.