Skip to content

Commit cd46ab2

Browse files
committed
Restore old behavior to wait for game to exit
1 parent 8c9f53d commit cd46ab2

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

Client/loader/MainFunctions.cpp

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ namespace
3232
if (path.find('\0') != SString::npos)
3333
return false;
3434

35-
if (path.Contains(":") && !path.BeginsWith("C:\\") && !path.BeginsWith("D:\\") &&
36-
!path.BeginsWith("E:\\") && !path.BeginsWith("F:\\") && !path.BeginsWith("G:\\"))
37-
return false;
38-
3935
// Check for special characters
4036
if (path.Contains("\\\\?\\") || path.Contains("\\\\.\\")|| // Device namespace paths
4137
path.Contains("%") || path.Contains("$"))
@@ -1459,36 +1455,24 @@ int LaunchGame(SString strCmdLine)
14591455

14601456
// Wait for game to exit
14611457
WriteDebugEvent("Loader - Wait for game to exit");
1462-
DWORD totalWaitTime = 0;
1463-
1464-
while (status == WAIT_TIMEOUT && totalWaitTime < 3600000) // 1 hour max wait
1458+
while (status == WAIT_TIMEOUT)
14651459
{
14661460
status = WaitForSingleObject(piLoadee.hProcess, 1500);
1467-
totalWaitTime += 1500;
14681461

1469-
// Detect if stuck on quit
1462+
// If core is closing and gta_sa.exe process memory usage is not changing, terminate
14701463
CStuckProcessDetector detector(piLoadee.hProcess, 5000);
14711464
while (status == WAIT_TIMEOUT && WatchDogIsSectionOpen("Q0")) // Gets closed when quit is detected as frozen
14721465
{
14731466
if (detector.UpdateIsStuck())
14741467
{
14751468
WriteDebugEvent("Detected stuck process at quit");
1476-
#ifndef MTA_DEBUG
1477-
TerminateProcess(piLoadee.hProcess, 1);
1478-
status = WAIT_FAILED;
1479-
break;
1480-
#endif
1481-
}
1482-
status = WaitForSingleObject(piLoadee.hProcess, 1000); // 1 second timeout
1483-
totalWaitTime += 1000;
1484-
1485-
if (totalWaitTime >= 3600000) // 1 hour max wait
1486-
{
1487-
WriteDebugEvent("Maximum wait time exceeded");
1469+
#ifndef MTA_DEBUG
14881470
TerminateProcess(piLoadee.hProcess, 1);
14891471
status = WAIT_FAILED;
14901472
break;
1473+
#endif
14911474
}
1475+
status = WaitForSingleObject(piLoadee.hProcess, 1000);
14921476
}
14931477
}
14941478

0 commit comments

Comments
 (0)