示例#1
0
/*
================
idCommonLocal::LaunchExternalTitle

Launches an external title  ( Doom 1, or 2 ) based on title index. 
for PS3, a device number is sent in, for the game to register as a local 
user by default, when title initializes.
================
*/
void idCommonLocal::LaunchExternalTitle( int titleIndex, int device, const lobbyConnectInfo_t * const connectInfo ) {

	idStr deviceString( device );

	// We want to pass in the current executable, so that the launching title knows which title to return to.
	// as of right now, this feature is TBD. 
	const char * currentExecutablePath = "ImNotSureYet";
	idStr launchingExecutablePath;

	idCmdArgs cmdArgs;
	cmdArgs.AppendArg( currentExecutablePath );
	
	if ( titleIndex == LAUNCH_TITLE_DOOM ) {
			launchingExecutablePath.Format("%s%s", Sys_DefaultBasePath(), LAUNCH_TITLE_DOOM_EXECUTABLE );
		cmdArgs.AppendArg( "d1bfg" );
	} else if ( titleIndex == LAUNCH_TITLE_DOOM2 ) {
		launchingExecutablePath.Format("%s%s", Sys_DefaultBasePath(), LAUNCH_TITLE_DOOM2_EXECUTABLE );
		cmdArgs.AppendArg( "d2bfg" );

	} else {

		idLib::Warning("Unhandled Launch Title %d \n", titleIndex );
	}

	cmdArgs.AppendArg( deviceString.c_str() );

	// Add an argument so that the new process knows whether or not to read exitspawn data.
	if ( connectInfo != NULL ) {
		cmdArgs.AppendArg( "exitspawnInvite" );
	}

	// Add arguments so that the new process will know which command line to invoke to relaunch this process
	// if necessary.

	const int launchDataSize = ( connectInfo == NULL ) ? 0 : sizeof( *connectInfo );

	Sys_Launch(  launchingExecutablePath.c_str() , cmdArgs, const_cast< lobbyConnectInfo_t * const >( connectInfo ), launchDataSize );
}
示例#2
0
/*
================
FS_Startup
================
*/
void FS_Startup( const char *gameName )
{
	Com_Printf( "----- FS_Startup -----\n" );

	fs_openorder = Cvar_Get( "fs_openorder", "0", 0 );
	fs_debug = Cvar_Get( "fs_debug", "0", 0 );
	fs_copyfiles = Cvar_Get( "fs_copyfiles", "0", CVAR_INIT );
	fs_cdpath = Cvar_Get ("fs_cdpath", Sys_DefaultCDPath(), CVAR_INIT );	
	fs_basepath = Cvar_Get ("fs_basepath", Sys_DefaultBasePath(), CVAR_INIT );
	fs_gamedirvar = Cvar_Get ("fs_game", "base", CVAR_INIT|CVAR_SERVERINFO );
	fs_restrict = Cvar_Get ("fs_restrict", "", CVAR_INIT );

	gi_handles = new gi_handleTable[MAX_FILE_HANDLES];
	for (int f = 0; f < MAX_FILE_HANDLES; ++f)
	{
		fsh[f].used = false;
		gi_handles[f].used = false;
	}

	zi_stackBase = (char*)Z_Malloc(ZI_STACKSIZE, TAG_FILESYS, qfalse);

	GOBMemoryFuncSet mem;
	mem.alloc = gi_alloc;
	mem.free = gi_free;
	
	GOBFileSysFuncSet file;
	file.close = gi_close;
	file.open = gi_open;
	file.read = gi_read;
	file.seek = gi_seek;
	file.write = NULL;
	
	GOBCacheFileFuncSet cache;
	cache.close = cache_close;
	cache.open = cache_open;
	cache.read = cache_read;
	cache.seek = cache_seek;
	cache.write = cache_write;

	GOBCodecFuncSet codec = {
		2, // codecs
		{
			{ // Codec 0 - zlib
				'z', GOB_INFINITE_RATIO, // tag, ratio (ratio is meaningless for decomp)
				NULL,
				gi_decompress_zlib,
			},
			{ // Codec 1 - null
				'0', GOB_INFINITE_RATIO, // tag, ratio (ratio is meaningless for decomp)
				NULL,
				gi_decompress_null,
			},
		}
	};

	if (
#ifdef _XBOX
		GOBInit(&mem, &file, &codec, &cache)
#else
		GOBInit(&mem, &file, &codec, NULL)
#endif
		!= GOBERR_OK)
	{
		Com_Error( ERR_FATAL, "Could not initialize GOB" );
	}

#ifdef CUSTOM_MP_GOBS
	char* archive = FS_BuildOSPath( "assets_mp" );
#else
	char* archive = FS_BuildOSPath( "assets" );
#endif
	if (GOBArchiveOpen(archive, GOBACCESS_READ, GOB_FALSE, GOB_TRUE) != GOBERR_OK)
	{
#if defined(FINAL_BUILD)
		extern void ERR_DiscFail(bool);
		ERR_DiscFail(false);
#else
		//Com_Error( ERR_FATAL, "Could not initialize GOB" );
		Cvar_Set("fs_openorder", "1");
#endif
	}
	
	GOBSetCacheSize(1);
	GOBSetReadBufferSize(32 * 1024);

#ifdef GOB_PROFILE
	GOBProfileFuncSet profile = {
		gi_profileread
	};
	GOBSetProfileFuncs(&profile);
	GOBStartProfile();
#endif

	Com_Printf( "----------------------\n" );
}