Skip to content

Commit b81419d

Browse files
committed
Restore old behavior to wait for game to exit
1 parent b7a02aa commit b81419d

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("$"))
@@ -1458,36 +1454,24 @@ int LaunchGame(SString strCmdLine)
14581454

14591455
// Wait for game to exit
14601456
WriteDebugEvent("Loader - Wait for game to exit");
1461-
DWORD totalWaitTime = 0;
1462-
1463-
while (status == WAIT_TIMEOUT && totalWaitTime < 3600000) // 1 hour max wait
1457+
while (status == WAIT_TIMEOUT)
14641458
{
14651459
status = WaitForSingleObject(piLoadee.hProcess, 1500);
1466-
totalWaitTime += 1500;
14671460

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

0 commit comments

Comments
 (0)