Skip to content

Commit 46fc2b7

Browse files
committed
launcher: don't grab/release mutex if multirun is enabled
1 parent 88418eb commit 46fc2b7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

launcher/launcher.cpp

+11-4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ static IEngineAPI *g_pEngineAPI;
104104
static IHammer *g_pHammer;
105105

106106
bool g_bTextMode = false;
107+
bool g_MultiRun = false;
107108

108109
static char g_szBasedir[MAX_PATH];
109110
static char g_szGamedir[MAX_PATH];
@@ -922,6 +923,9 @@ char g_lockFilename[MAX_PATH];
922923
#endif
923924
bool GrabSourceMutex()
924925
{
926+
if( g_MultiRun )
927+
return true;
928+
925929
#ifdef WIN32
926930
if ( IsPC() )
927931
{
@@ -1016,6 +1020,9 @@ bool GrabSourceMutex()
10161020

10171021
void ReleaseSourceMutex()
10181022
{
1023+
if( g_MultiRun )
1024+
return;
1025+
10191026
#ifdef WIN32
10201027
if ( IsPC() && g_hMutex )
10211028
{
@@ -1280,7 +1287,7 @@ DLL_EXPORT int LauncherMain( int argc, char **argv )
12801287

12811288
// Allow the user to explicitly say they want to be able to run multiple instances of the source mutex.
12821289
// Useful for side-by-side comparisons of different renderers.
1283-
bool multiRun = CommandLine()->CheckParm( "-multirun" ) != NULL;
1290+
g_MultiRun = CommandLine()->CheckParm( "-multirun" ) != NULL;
12841291

12851292
#if defined( _X360 )
12861293
bool bSpewDllInfo = CommandLine()->CheckParm( "-dllinfo" );
@@ -1430,20 +1437,20 @@ DLL_EXPORT int LauncherMain( int argc, char **argv )
14301437
}
14311438
else
14321439
{
1433-
if (!multiRun) {
1440+
if (!g_MultiRun) {
14341441
::MessageBox(NULL, "Only one instance of the game can be running at one time.", "Source - Warning", MB_ICONINFORMATION | MB_OK);
14351442
}
14361443
}
14371444

1438-
if (!multiRun) {
1445+
if (!g_MultiRun) {
14391446
return retval;
14401447
}
14411448
}
14421449
}
14431450
#elif defined( POSIX )
14441451
else
14451452
{
1446-
if ( !GrabSourceMutex() && !multiRun )
1453+
if ( !GrabSourceMutex() && !g_MultiRun )
14471454
{
14481455
::MessageBox(NULL, "Only one instance of the game can be running at one time.", "Source - Warning", 0 );
14491456
return -1;

0 commit comments

Comments
 (0)