Skip to content

Commit d56e855

Browse files
authored
Merge pull request #208 from tyabus/multirun
launcher: multirun should work on POSIX now
2 parents e998499 + 46fc2b7 commit d56e855

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

launcher/launcher.cpp

+14-7
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
{
@@ -1278,6 +1285,10 @@ DLL_EXPORT int LauncherMain( int argc, char **argv )
12781285
// Figure out the directory the executable is running from
12791286
UTIL_ComputeBaseDir();
12801287

1288+
// Allow the user to explicitly say they want to be able to run multiple instances of the source mutex.
1289+
// Useful for side-by-side comparisons of different renderers.
1290+
g_MultiRun = CommandLine()->CheckParm( "-multirun" ) != NULL;
1291+
12811292
#if defined( _X360 )
12821293
bool bSpewDllInfo = CommandLine()->CheckParm( "-dllinfo" );
12831294
bool bWaitForConsole = CommandLine()->CheckParm( "-vxconsole" );
@@ -1389,10 +1400,6 @@ DLL_EXPORT int LauncherMain( int argc, char **argv )
13891400
// Can only run one windowed source app at a time
13901401
if ( !GrabSourceMutex() )
13911402
{
1392-
// Allow the user to explicitly say they want to be able to run multiple instances of the source mutex.
1393-
// Useful for side-by-side comparisons of different renderers.
1394-
bool multiRun = CommandLine()->CheckParm( "-multirun" ) != NULL;
1395-
13961403
// We're going to hijack the existing session and load a new savegame into it. This will mainly occur when users click on links in Bugzilla that will automatically copy saves and load them
13971404
// directly from the web browser. The -hijack command prevents the launcher from objecting that there is already an instance of the game.
13981405
if (CommandLine()->CheckParm( "-hijack" ))
@@ -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() )
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)