当前位置: 首页>>代码示例>>C++>>正文


C++ FS_GetFileList函数代码示例

本文整理汇总了C++中FS_GetFileList函数的典型用法代码示例。如果您正苦于以下问题:C++ FS_GetFileList函数的具体用法?C++ FS_GetFileList怎么用?C++ FS_GetFileList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了FS_GetFileList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ML_Update

/*
* ML_Update
*/
bool ML_Update( void )
{
	int i, len, total, newpaks;
	size_t size;
	char *map, *maps, *filename;

	newpaks = FS_Rescan();
	if( !newpaks )
		return false;

	total = FS_GetFileListExt( "maps", ".bsp", NULL, &size, 0, 0 );
	if( size )
	{
		maps = ( char* )Mem_TempMalloc( size );
		FS_GetFileList( "maps", ".bsp", maps, size, 0, 0 );
		for( i = 0, len = 0; i < total; i++ )
		{
			map = maps + len;
			len += strlen( map ) + 1;

			filename = ( char * )COM_FileBase( map );
			COM_StripExtension( filename );

			// don't check for existance of each file itself, as we've just got the fresh list
			if( !ML_FilenameExistsExt( filename, true ) )
				ML_AddMap( filename, MLIST_UNKNOWN_MAPNAME );
		}
		Mem_TempFree( maps );
	}

	return true;
}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:35,代码来源:mlist.c

示例2: SV_BeginAutoRecordDemos

// starts demo recording on all active clients
void SV_BeginAutoRecordDemos() {
	if ( sv_autoDemo->integer ) {
		for ( client_t *client = svs.clients; client - svs.clients < sv_maxclients->integer; client++ ) {
			if ( client->state == CS_ACTIVE && !client->demo.demorecording ) {
				if ( client->netchan.remoteAddress.type != NA_BOT || sv_autoDemoBots->integer ) {
					SV_AutoRecordDemo( client );
				}
			}
		}
		if ( sv_autoDemoMaxMaps->integer > 0 && sv.demosPruned == qfalse ) {
			char autorecordDirList[500 * MAX_OSPATH], tmpFileList[5 * MAX_OSPATH];
			int autorecordDirListCount = SV_FindLeafFolders( "demos/autorecord", autorecordDirList, 500, MAX_OSPATH );
			int i;

			qsort( autorecordDirList, autorecordDirListCount, MAX_OSPATH, SV_DemoFolderTimeComparator );
			for ( i = sv_autoDemoMaxMaps->integer; i < autorecordDirListCount; i++ ) {
				char *folder = &autorecordDirList[i * MAX_OSPATH], *slash = NULL;
				FS_HomeRmdir( folder, qtrue );
				// if this folder was the last thing in its parent folder (and its parent isn't the root folder),
				// also delete the parent.
				for (;;) {
					slash = strrchr( folder, '/' );
					if ( slash == NULL ) {
						break;
					}
					slash[0] = '\0';
					if ( !strcmp( folder, "demos/autorecord" ) ) {
						break;
					}
					int numFiles = FS_GetFileList( folder, "", tmpFileList, sizeof( tmpFileList ) );
					int numFolders = FS_GetFileList( folder, "/", tmpFileList, sizeof( tmpFileList ) );
					// numFolders will include . and ..
					if ( numFiles == 0 && numFolders == 2 ) {
						// dangling empty folder, delete
						FS_HomeRmdir( folder, qfalse );
					} else {
						break;
					}
				}
			}
			sv.demosPruned = qtrue;
		}
	}
}
开发者ID:adnanfzafar,项目名称:OpenJK,代码行数:45,代码来源:sv_ccmds.cpp

示例3: ML_InitFromMaps

/*
* ML_InitFromMaps
* Fills map list array from each map file. Very slow
* and should only be called if cache doesnt exist
*/
static void ML_InitFromMaps( void )
{
	int i, j, total, len;
	char maps[2048];
	char *filename;

	if( ml_initialized )
		return;

	total = FS_GetFileList( "maps", ".bsp", NULL, 0, 0, 0 );
	if( !total )
		return;

	i = 0;
	while( i < total )
	{
		memset( maps, 0, sizeof( maps ) );
		j = FS_GetFileList( "maps", ".bsp", maps, sizeof( maps ), i, total );

		// no maps returned, map name is too big or end of list?
		if( !j )
		{
			i++;
			continue;
		}
		i += j;

		// split the maps up and find their fullnames
		len = 0;
		while( j-- )
		{
			filename = maps + len;
			if( !*filename )
				continue;

			len += strlen( filename ) + 1;

			COM_SanitizeFilePath( filename );
			COM_StripExtension( filename );

			ML_AddMap( filename, NULL );
		}
	}
}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:49,代码来源:mlist.c

示例4: fread

	/*	Precache the radio sounds + some other sounds of urt 'cause it doesn't on its own and it
		may be freezing rendering in the process of fread()ing assets for the 1st time. */
	static void PreCache_UT_Audio (void) {

		//lister stolen from UI_LoadBots()
		char	*		dirptr;
		char			dirlist[8192],filename[1024];
		int			numdirs,dirlen, i;

		numdirs = FS_GetFileList("sound/radio/female", ".wav", dirlist, 8192);
		dirptr  = dirlist;
		for (i = 0; i < numdirs; i++, dirptr += dirlen+1) {
			dirlen = strlen(dirptr);
			strcpy(filename, "sound/radio/female/");
			strcat(filename, dirptr);
			S_RegisterSound(filename, qfalse);
		}

		numdirs = FS_GetFileList("sound/radio/male", ".wav", dirlist, 8192);
		dirptr  = dirlist;
		for (i = 0; i < numdirs; i++, dirptr += dirlen+1) {
			dirlen = strlen(dirptr);
			strcpy(filename, "sound/radio/male/");
			strcat(filename, dirptr);
			S_RegisterSound(filename, qfalse);
		}

		//some extra ones caught not being pre-registered:
		S_RegisterSound ("sound/misc/kcaction.wav", qfalse);
		S_RegisterSound ("sound/player/ledgegrab.wav", qfalse);
		S_RegisterSound ("sound/surfaces/bullets/water1.wav", qfalse);
		S_RegisterSound ("sound/items/nvgoff.wav", qfalse);
		S_RegisterSound ("sound/items/nvgon.wav", qfalse);
		S_RegisterSound ("sound/items/flashlight.wav", qfalse);
		S_RegisterSound ("sound/items/laseronoff.wav", qfalse);
		S_RegisterSound ("sound/weapons/beretta/92G_noammo.wav", qfalse);
		S_RegisterSound ("sound/bomb/Bomb_disarm.wav", qfalse);
		S_RegisterSound ("sound/bomb/Explode01.wav", qfalse);
		S_RegisterSound ("sound/misc/blast_wind.wav", qfalse);
		S_RegisterSound ("sound/misc/blast_fire.wav", qfalse);
	}
开发者ID:anthonynguyen,项目名称:ioq3-mitsu,代码行数:41,代码来源:ioq3-urt_Precache.c

示例5: PreCache_UT_Models

	//similarly, pre-cache funstuff
	static void PreCache_UT_Models (void) {
		char*		dirptr;
		char			dirlist[8192],filename[1024];
		int			numdirs,dirlen, i;

		numdirs = FS_GetFileList("models/players/funstuff/", ".md3", dirlist, 8192 );
		dirptr  = dirlist;
		for (i = 0; i < numdirs; i++, dirptr += dirlen+1) {
			dirlen = strlen(dirptr);
			strcpy(filename, "models/players/funstuff/");
			strcat(filename, dirptr);
			RE_RegisterModel (filename);
		}
	}
开发者ID:anthonynguyen,项目名称:ioq3-mitsu,代码行数:15,代码来源:ioq3-urt_Precache.c

示例6: SV_FindLeafFolders

// returns number of folders found.  pass NULL result pointer for just a count.
static int SV_FindLeafFolders( const char *baseFolder, char *result, int maxResults, int maxFolderLength ) {
	char *fileList = (char *)Z_Malloc( MAX_OSPATH * maxResults, TAG_FILESYS ); // too big for stack since this is recursive
	char fullFolder[MAX_OSPATH];
	int resultCount = 0;
	char *fileName;
	int i;
	int numFiles = FS_GetFileList( baseFolder, "/", fileList, MAX_OSPATH * maxResults );

	fileName = fileList;
	for ( i = 0; i < numFiles; i++ ) {
		if ( Q_stricmp( fileName, "." ) && Q_stricmp( fileName, ".." ) ) {
			char *nextResult = NULL;
			Com_sprintf( fullFolder, sizeof( fullFolder ), "%s/%s", baseFolder, fileName );
			if ( result != NULL ) {
				nextResult = &result[maxFolderLength * resultCount];
			}
			int newResults = SV_FindLeafFolders( fullFolder, nextResult, maxResults - resultCount, maxFolderLength );
			resultCount += newResults;
			if ( result != NULL && resultCount >= maxResults ) {
				break;
			}
			if ( newResults == 0 ) {
				if ( result != NULL ) {
					Q_strncpyz( &result[maxFolderLength * resultCount], fullFolder, maxFolderLength );
				}
				resultCount++;
				if ( result != NULL && resultCount >= maxResults ) {
					break;
				}
			}
		}
		fileName += strlen( fileName ) + 1;
	}

	Z_Free( fileList );

	return resultCount;
}
开发者ID:adnanfzafar,项目名称:OpenJK,代码行数:39,代码来源:sv_ccmds.cpp

示例7: CL_CgameSystemCalls

intptr_t CL_CgameSystemCalls(intptr_t *args)
{
	switch (args[0])
	{
	case CG_PRINT:
		Com_Printf("%s", (char *)VMA(1));
		return 0;
	case CG_ERROR:
		Com_Error(ERR_DROP, "%s", (char *)VMA(1));
		return 0;
	case CG_MILLISECONDS:
		return Sys_Milliseconds();
	case CG_CVAR_REGISTER:
		Cvar_Register(VMA(1), VMA(2), VMA(3), args[4]);
		return 0;
	case CG_CVAR_UPDATE:
		Cvar_Update(VMA(1));
		return 0;
	case CG_CVAR_SET:
		Cvar_SetSafe(VMA(1), VMA(2));
		return 0;
	case CG_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer(VMA(1), VMA(2), args[3]);
		return 0;
	case CG_CVAR_LATCHEDVARIABLESTRINGBUFFER:
		Cvar_LatchedVariableStringBuffer(VMA(1), VMA(2), args[3]);
		return 0;
	case CG_ARGC:
		return Cmd_Argc();
	case CG_ARGV:
		Cmd_ArgvBuffer(args[1], VMA(2), args[3]);
		return 0;
	case CG_ARGS:
		Cmd_ArgsBuffer(VMA(1), args[2]);
		return 0;
	case CG_FS_FOPENFILE:
		return FS_FOpenFileByMode(VMA(1), VMA(2), args[3]);
	case CG_FS_READ:
		FS_Read(VMA(1), args[2], args[3]);
		return 0;
	case CG_FS_WRITE:
		return FS_Write(VMA(1), args[2], args[3]);
	case CG_FS_FCLOSEFILE:
		FS_FCloseFile(args[1]);
		return 0;
	case CG_FS_GETFILELIST:
		return FS_GetFileList(VMA(1), VMA(2), VMA(3), args[4]);
	case CG_FS_DELETEFILE:
		return FS_Delete(VMA(1));
	case CG_SENDCONSOLECOMMAND:
		Cbuf_AddText(VMA(1));
		return 0;
	case CG_ADDCOMMAND:
		CL_AddCgameCommand(VMA(1));
		return 0;
	case CG_REMOVECOMMAND:
		Cmd_RemoveCommandSafe(VMA(1));
		return 0;
	case CG_SENDCLIENTCOMMAND:
		CL_AddReliableCommand(VMA(1));
		return 0;
	case CG_UPDATESCREEN:
		SCR_UpdateScreen();
		return 0;
	case CG_CM_LOADMAP:
		CL_CM_LoadMap(VMA(1));
		return 0;
	case CG_CM_NUMINLINEMODELS:
		return CM_NumInlineModels();
	case CG_CM_INLINEMODEL:
		return CM_InlineModel(args[1]);
	case CG_CM_TEMPBOXMODEL:
		return CM_TempBoxModel(VMA(1), VMA(2), qfalse);
	case CG_CM_TEMPCAPSULEMODEL:
		return CM_TempBoxModel(VMA(1), VMA(2), qtrue);
	case CG_CM_POINTCONTENTS:
		return CM_PointContents(VMA(1), args[2]);
	case CG_CM_TRANSFORMEDPOINTCONTENTS:
		return CM_TransformedPointContents(VMA(1), args[2], VMA(3), VMA(4));
	case CG_CM_BOXTRACE:
		CM_BoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qfalse);
		return 0;
	case CG_CM_CAPSULETRACE:
		CM_BoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], /*int capsule*/ qtrue);
		return 0;
	case CG_CM_TRANSFORMEDBOXTRACE:
		CM_TransformedBoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qfalse);
		return 0;
	case CG_CM_TRANSFORMEDCAPSULETRACE:
		CM_TransformedBoxTrace(VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], VMA(8), VMA(9), /*int capsule*/ qtrue);
		return 0;
	case CG_CM_MARKFRAGMENTS:
		return re.MarkFragments(args[1], VMA(2), VMA(3), args[4], VMA(5), args[6], VMA(7));

	case CG_R_PROJECTDECAL:
		re.ProjectDecal(args[1], args[2], VMA(3), VMA(4), VMA(5), args[6], args[7]);
		return 0;
	case CG_R_CLEARDECALS:
		re.ClearDecals();
		return 0;
//.........这里部分代码省略.........
开发者ID:Mailaender,项目名称:etlegacy,代码行数:101,代码来源:cl_cgame.c

示例8: CL_UISystemCalls

/*
====================
CL_UISystemCalls

The ui module is making a system call
====================
*/
int CL_UISystemCalls( int *args ) {
	switch( args[0] ) {
	case UI_ERROR:
		Com_Error( ERR_DROP, "%s", VMA(1) );
		return 0;

	case UI_PRINT:
		Com_Printf( "%s", VMA(1) );
		return 0;

	case UI_MILLISECONDS:
		return Sys_Milliseconds();

	case UI_CVAR_REGISTER:
		Cvar_Register( VMA(1), VMA(2), VMA(3), args[4] ); 
		return 0;

	case UI_CVAR_UPDATE:
		Cvar_Update( VMA(1) );
		return 0;

	case UI_CVAR_SET:
		Cvar_Set( VMA(1), VMA(2) );
		return 0;

	case UI_CVAR_VARIABLEVALUE:
		return FloatAsInt( Cvar_VariableValue( VMA(1) ) );

	case UI_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer( VMA(1), VMA(2), args[3] );
		return 0;

	case UI_CVAR_SETVALUE:
		Cvar_SetValue( VMA(1), VMF(2) );
		return 0;

	case UI_CVAR_RESET:
		Cvar_Reset( VMA(1) );
		return 0;

	case UI_CVAR_CREATE:
		Cvar_Get( VMA(1), VMA(2), args[3] );
		return 0;

	case UI_CVAR_INFOSTRINGBUFFER:
		Cvar_InfoStringBuffer( args[1], VMA(2), args[3] );
		return 0;

	case UI_ARGC:
		return Cmd_Argc();

	case UI_ARGV:
		Cmd_ArgvBuffer( args[1], VMA(2), args[3] );
		return 0;

	case UI_CMD_EXECUTETEXT:
		Cbuf_ExecuteText( args[1], VMA(2) );
		return 0;

	case UI_FS_FOPENFILE:
		return FS_FOpenFileByMode( VMA(1), VMA(2), args[3] );

	case UI_FS_READ:
		FS_Read2( VMA(1), args[2], args[3] );
		return 0;

	case UI_FS_WRITE:
		FS_Write( VMA(1), args[2], args[3] );
		return 0;

	case UI_FS_FCLOSEFILE:
		FS_FCloseFile( args[1] );
		return 0;

	case UI_FS_GETFILELIST:
		return FS_GetFileList( VMA(1), VMA(2), VMA(3), args[4] );

	case UI_FS_SEEK:
		return FS_Seek( args[1], args[2], args[3] );
	
	case UI_R_REGISTERMODEL:
#ifdef IOS_NOTYET
		GLimp_AcquireGL();
		return re.RegisterModel( VMA(1) );
		GLimp_ReleaseGL();
#else
		return re.RegisterModel( VMA(1) );
#endif // IOS

	case UI_R_REGISTERSKIN:
#ifdef IOS_NOTYET
		GLimp_AcquireGL();
		return re.RegisterSkin( VMA(1) );
//.........这里部分代码省略.........
开发者ID:he110world,项目名称:quake3-ios,代码行数:101,代码来源:cl_ui.c

示例9: CLWM_UISystemCalls

//	The ui module is making a system call
qintptr CLWM_UISystemCalls( qintptr* args ) {
	switch ( args[ 0 ] ) {
	case WMUI_ERROR:
		common->Error( "%s", ( char* )VMA( 1 ) );
		return 0;

	case WMUI_PRINT:
		common->Printf( "%s", ( char* )VMA( 1 ) );
		return 0;

	case WMUI_MILLISECONDS:
		return Sys_Milliseconds();

	case WMUI_CVAR_REGISTER:
		Cvar_Register( ( vmCvar_t* )VMA( 1 ), ( char* )VMA( 2 ), ( char* )VMA( 3 ), args[ 4 ] );
		return 0;

	case WMUI_CVAR_UPDATE:
		Cvar_Update( ( vmCvar_t* )VMA( 1 ) );
		return 0;

	case WMUI_CVAR_SET:
		Cvar_Set( ( char* )VMA( 1 ), ( char* )VMA( 2 ) );
		return 0;

	case WMUI_CVAR_VARIABLEVALUE:
		return FloatAsInt( Cvar_VariableValue( ( char* )VMA( 1 ) ) );

	case WMUI_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer( ( char* )VMA( 1 ), ( char* )VMA( 2 ), args[ 3 ] );
		return 0;

	case WMUI_CVAR_SETVALUE:
		Cvar_SetValue( ( char* )VMA( 1 ), VMF( 2 ) );
		return 0;

	case WMUI_CVAR_RESET:
		Cvar_Reset( ( char* )VMA( 1 ) );
		return 0;

	case WMUI_CVAR_CREATE:
		Cvar_Get( ( char* )VMA( 1 ), ( char* )VMA( 2 ), args[ 3 ] );
		return 0;

	case WMUI_CVAR_INFOSTRINGBUFFER:
		Cvar_InfoStringBuffer( args[ 1 ], MAX_INFO_STRING_Q3, ( char* )VMA( 2 ), args[ 3 ] );
		return 0;

	case WMUI_ARGC:
		return Cmd_Argc();

	case WMUI_ARGV:
		Cmd_ArgvBuffer( args[ 1 ], ( char* )VMA( 2 ), args[ 3 ] );
		return 0;

	case WMUI_CMD_EXECUTETEXT:
		Cbuf_ExecuteText( args[ 1 ], ( char* )VMA( 2 ) );
		return 0;

	case WMUI_FS_FOPENFILE:
		return FS_FOpenFileByMode( ( char* )VMA( 1 ), ( fileHandle_t* )VMA( 2 ), ( fsMode_t )args[ 3 ] );

	case WMUI_FS_READ:
		FS_Read( VMA( 1 ), args[ 2 ], args[ 3 ] );
		return 0;

	case WMUI_FS_WRITE:
		FS_Write( VMA( 1 ), args[ 2 ], args[ 3 ] );
		return 0;

	case WMUI_FS_FCLOSEFILE:
		FS_FCloseFile( args[ 1 ] );
		return 0;

	case WMUI_FS_DELETEFILE:
		return FS_Delete( ( char* )VMA( 1 ) );

	case WMUI_FS_GETFILELIST:
		return FS_GetFileList( ( char* )VMA( 1 ), ( char* )VMA( 2 ), ( char* )VMA( 3 ), args[ 4 ] );

	case WMUI_R_REGISTERMODEL:
		return R_RegisterModel( ( char* )VMA( 1 ) );

	case WMUI_R_REGISTERSKIN:
		return R_RegisterSkin( ( char* )VMA( 1 ) );

	case WMUI_R_REGISTERSHADERNOMIP:
		return R_RegisterShaderNoMip( ( char* )VMA( 1 ) );

	case WMUI_R_CLEARSCENE:
		R_ClearScene();
		return 0;

	case WMUI_R_ADDREFENTITYTOSCENE:
		CLWM_AddRefEntityToScene( ( wmrefEntity_t* )VMA( 1 ) );
		return 0;

	case WMUI_R_ADDPOLYTOSCENE:
		R_AddPolyToScene( args[ 1 ], args[ 2 ], ( polyVert_t* )VMA( 3 ), 1 );
//.........这里部分代码省略.........
开发者ID:janisl,项目名称:jlquake,代码行数:101,代码来源:ui.cpp

示例10: CL_UISystemCalls

/*
====================
CL_UISystemCalls

The ui module is making a system call
====================
*/
intptr_t CL_UISystemCalls(intptr_t * args) {
	switch (args[0]) {
		case UI_ERROR:
			Com_Error(ERR_DROP, "%s", (char *)VMA(1));
			return 0;
		case UI_PRINT:
			Com_Printf("%s", (char *)VMA(1));
			return 0;
		case UI_MILLISECONDS:
			return Sys_Milliseconds();
		case UI_CVAR_REGISTER:
			Cvar_Register((vmCvar_t*)VMA(1), (char*)VMA(2), (char*)VMA(3), args[4]);
			return 0;
		case UI_CVAR_UPDATE:
			Cvar_Update((vmCvar_t*)VMA(1));
			return 0;
		case UI_CVAR_SET:
			Cvar_Set((char*)VMA(1), (char*)VMA(2));
			return 0;
		case UI_CVAR_VARIABLEVALUE:
			return FloatAsInt(Cvar_VariableValue((char*)VMA(1)));
		case UI_CVAR_VARIABLESTRINGBUFFER:
			Cvar_VariableStringBuffer((char*)VMA(1), (char*)VMA(2), args[3]);
			return 0;
		case UI_CVAR_LATCHEDVARIABLESTRINGBUFFER:
			Cvar_LatchedVariableStringBuffer((char*)VMA(1), (char*)VMA(2), args[3]);
			return 0;
		case UI_CVAR_SETVALUE:
			Cvar_SetValue((char*)VMA(1), VMF(2));
			return 0;
		case UI_CVAR_RESET:
			Cvar_Reset((char*)VMA(1));
			return 0;
		case UI_CVAR_CREATE:
			Cvar_Get((char*)VMA(1), (char*)VMA(2), args[3], (char*)VMA(4));
			return 0;
		case UI_CVAR_INFOSTRINGBUFFER:
			Cvar_InfoStringBuffer(args[1], (char*)VMA(2), args[3]);
			return 0;
		case UI_ARGC:
			return Cmd_Argc();
		case UI_ARGV:
			Cmd_ArgvBuffer(args[1], (char*)VMA(2), args[3]);
			return 0;
		case UI_CMD_EXECUTETEXT:
			Cbuf_ExecuteText(args[1], (char*)VMA(2));
			return 0;
		case UI_ADDCOMMAND:
			Cmd_AddCommand((char*)VMA(1), NULL, (char*)VMA(3));
			return 0;
		case UI_FS_FOPENFILE:
			return FS_FOpenFileByMode((char*)VMA(1), (fileHandle_t*)VMA( 2 ), (fsMode_t)args[3] );
		case UI_FS_READ:
			FS_Read2(VMA(1), args[2], args[3]);
			return 0;
		case UI_FS_WRITE:
			FS_Write(VMA(1), args[2], args[3]);
			return 0;
		case UI_FS_FCLOSEFILE:
			FS_FCloseFile(args[1]);
			return 0;
		case UI_FS_DELETEFILE:
			return FS_Delete((char*)VMA(1));
		case UI_FS_GETFILELIST:
			return FS_GetFileList((char*)VMA(1), (char*)VMA(2), (char*)VMA(3), args[4]);
		case UI_FS_SEEK:
			return FS_Seek( args[1], args[2], args[3] );
		case UI_R_REGISTERMODEL:
			return re.RegisterModel((char*)VMA(1));
		case UI_R_REGISTERSKIN:
			return re.RegisterSkin((char*)VMA(1));
		case UI_R_REGISTERSHADERNOMIP:
			return re.RegisterShaderNoMip((char*)VMA(1));
		case UI_R_CLEARSCENE:
			re.ClearScene();
			return 0;
		case UI_R_ADDREFENTITYTOSCENE:
			re.AddRefEntityToScene((refEntity_t*)VMA(1));
			return 0;
		case UI_R_ADDPOLYTOSCENE:
			re.AddPolyToScene(args[1], args[2], (polyVert_t*)VMA(3));
			return 0;
		case UI_R_ADDPOLYSTOSCENE:
			re.AddPolysToScene(args[1], args[2], (polyVert_t*)VMA(3), args[4]);
			return 0;
		case UI_R_ADDLIGHTTOSCENE:
			re.AddLightToScene((vec_t*)VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), args[7], args[8]);
			return 0;
		case UI_R_ADDCORONATOSCENE:
			re.AddCoronaToScene((vec_t*)VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), args[6], (bool)args[7]);
			return 0;
		case UI_R_RENDERSCENE:
			re.RenderScene((refdef_t*)VMA(1));
//.........这里部分代码省略.........
开发者ID:TheDushan,项目名称:OpenWolf,代码行数:101,代码来源:cl_ui.cpp

示例11: SV_DemoList_f

void SV_DemoList_f( client_t *client )
{
	char message[MAX_STRING_CHARS];
	char numpr[16];
	char buffer[MAX_STRING_CHARS];
	char *s, *p;
	size_t j, length, length_escaped, pos, extlen;
	int numdemos, i, start = -1, end, k;

	if( client->state < CS_SPAWNED )
		return;

	if( Cmd_Argc() > 2 )
	{
		SV_AddGameCommand( client, "pr \"Usage: demolist [starting position]\n\"" );
		return;
	}

	if( Cmd_Argc() == 2 )
	{
		start = atoi( Cmd_Argv( 1 ) ) - 1;
		if( start < 0 )
		{
			SV_AddGameCommand( client, "pr \"Usage: demolist [starting position]\n\"" );
			return;
		}
	}

	Q_strncpyz( message, "pr \"Available demos:\n----------------\n", sizeof( message ) );

	numdemos = FS_GetFileList( SV_DEMO_DIR, APP_DEMO_EXTENSION_STR, NULL, 0, 0, 0 );
	if( numdemos )
	{
		if( start < 0 )
			start = max( 0, numdemos - DEMOS_PER_VIEW );
		else if( start > numdemos - 1 )
			start = numdemos - 1;

		if( start > 0 )
			Q_strncatz( message, "...\n", sizeof( message ) );

		end = start + DEMOS_PER_VIEW;
		if( end > numdemos )
			end = numdemos;

		extlen = strlen( APP_DEMO_EXTENSION_STR );

		i = start;
		do
		{
			if( ( k = FS_GetFileList( SV_DEMO_DIR, APP_DEMO_EXTENSION_STR, buffer, sizeof( buffer ), i, end ) ) == 0 )
			{
				i++;
				continue;
			}

			for( s = buffer; k > 0; k--, s += length+1, i++ )
			{
				length = strlen( s );

				length_escaped = length;
				p = s;
				while( ( p = strchr( p, '\\' ) ) )
					length_escaped++;

				Q_snprintfz( numpr, sizeof( numpr ), "%i: ", i+1 );
				if( strlen( message ) + strlen( numpr ) + length_escaped - extlen + 1 + 5 >= sizeof( message ) )
				{
					Q_strncatz( message, "\"", sizeof( message ) );
					SV_AddGameCommand( client, message );

					Q_strncpyz( message, "pr \"", sizeof( message ) );
					if( strlen( "demoget " ) + strlen( numpr ) + length_escaped - extlen + 1 + 5 >= sizeof( message ) )
						continue;
				}

				Q_strncatz( message, numpr, sizeof( message ) );
				pos = strlen( message );
				for( j = 0; j < length - extlen; j++ )
				{
					assert( s[j] != '\\' );
					if( s[j] == '"' )
						message[pos++] = '\\';
					message[pos++] = s[j];
				}
				message[pos++] = '\n';
				message[pos] = '\0';
			}
		}
		while( i < end );

		if( end < numdemos )
			Q_strncatz( message, "...\n", sizeof( message ) );
	}
	else
	{
		Q_strncatz( message, "none\n", sizeof( message ) );
	}

	Q_strncatz( message, "\"", sizeof( message ) );
//.........这里部分代码省略.........
开发者ID:cfr,项目名称:qfusion,代码行数:101,代码来源:sv_demos.c

示例12: ML_InitFromCache

/*
* ML_InitFromCache
* Fills map list array from cache, much faster
*/
static void ML_InitFromCache( void )
{
	int count, i, total, len;
	size_t size = 0;
	char *buffer, *chr, *current, *curend;
	char *temp, *maps, *map;
	mapdir_t *dir, *curmap, *prev;

	if( ml_initialized )
		return;

	total = FS_GetFileListExt( "maps", ".bsp", NULL, &size, 0, 0 );
	if( !total )
		return;

	// load maps from directory reading into a list
	maps = temp = ( char* )Mem_TempMalloc( size + sizeof( mapdir_t ) * total );
	temp += size;
	FS_GetFileList( "maps", ".bsp", maps, size, 0, 0 );
	len = 0;
	prev = NULL;
	dir = NULL;
	for( i = 0; i < total; i++ )
	{
		map = maps + len;
		len += strlen( map ) + 1;

		curmap = ( mapdir_t * )temp;
		temp += sizeof( mapdir_t );

		COM_StripExtension( map );

		if( !i )
			dir = curmap;
		else
		{
			prev->next = curmap;
			curmap->prev = prev;
		}

		curmap->filename = map;
		prev = curmap;
	}

	FS_LoadCacheFile( MLIST_CACHE, (void **)&buffer, NULL, 0 );
	if( !buffer )
	{
		Mem_TempFree( maps );
		return;
	}

	current = curend = buffer;
	count = 0;

	for( chr = buffer; *chr; chr++ )
	{
		// current character is a delimiter
		if( *chr == '\n' )
		{
			if( *(chr-1) == '\r' )
				*(chr-1) = '\0';	// clear the CR too
			*chr = '\0';			// clear the LF

			// if we have got both params
			if( !( ++count & 1 ) )
			{
				// check if its in the maps directory
				for( curmap = dir; curmap; curmap = curmap->next )
				{
					if( !Q_stricmp( curmap->filename, current ) )
					{
						if( curmap->prev )
							curmap->prev->next = curmap->next;
						else
							dir = curmap->next;

						if( curmap->next )
							curmap->next->prev = curmap->prev;
						break;
					}
				}

				// if we found it in the maps directory
				if( curmap )
				{
					COM_SanitizeFilePath( current );

					// well, if we've got a map with an unknown fullname, load it from map
					if( !strcmp( curend + 1, MLIST_UNKNOWN_MAPNAME ) )
						ML_AddMap( current, NULL );
					else
						ML_AddMap( current, curend + 1 );
				}
				current = chr + 1;
			}
			else
//.........这里部分代码省略.........
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:101,代码来源:mlist.c

示例13: CL_UISystemCalls

/*
====================
CL_UISystemCalls

The ui module is making a system call
====================
*/
intptr_t CL_UISystemCalls( intptr_t *args ) 
{

	switch( args[0] ) 
	{
	case UI_ERROR:
		Com_Error( ERR_DROP, "%s", VMA(1) );
		return 0;

	case UI_CVAR_REGISTER:
		Cvar_Register( (vmCvar_t *)VMA(1),(const char *) VMA(2),(const char *) VMA(3), args[4] ); 
		return 0;

	case UI_CVAR_SET:
		Cvar_Set( (const char *) VMA(1), (const char *) VMA(2) );
		return 0;

	case UI_CVAR_SETVALUE:
		Cvar_SetValue( (const char *) VMA(1), VMF(2) );
		return 0;

	case UI_CVAR_UPDATE:
		Cvar_Update( (vmCvar_t *) VMA(1) );
		return 0;

	case UI_R_REGISTERMODEL:
		return re.RegisterModel((const char *) VMA(1) );

	case UI_R_REGISTERSHADERNOMIP:
		return re.RegisterShaderNoMip((const char *) VMA(1) );

	case UI_GETGLCONFIG:
		CL_GetGlconfig( ( glconfig_t *) VMA(1) );
		return 0;

	case UI_CMD_EXECUTETEXT:
		Cbuf_ExecuteText( args[1], (const char *) VMA(2) );
		return 0;

	case UI_CVAR_VARIABLEVALUE:
		return FloatAsInt( Cvar_VariableValue( (const char *) VMA(1) ) );

	case UI_FS_GETFILELIST:
		return FS_GetFileList( (const char *) VMA(1), (const char *) VMA(2), (char *) VMA(3), args[4] );

	case UI_KEY_SETCATCHER:
		Key_SetCatcher( args[1] );
		return 0;

	case UI_KEY_CLEARSTATES:
		Key_ClearStates();
		return 0;

	case UI_R_SETCOLOR:
		re.SetColor( (const float *) VMA(1) );
		return 0;

	case UI_R_DRAWSTRETCHPIC:
		re.DrawStretchPic( VMF(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), VMF(7), VMF(8), args[9] );
		return 0;

	case UI_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer( (const char *) VMA(1), (char *) VMA(2), args[3] );
		return 0;

  case UI_R_MODELBOUNDS:
		re.ModelBounds( args[1], (float *) VMA(2),(float *) VMA(3) );
		return 0;

	case UI_R_CLEARSCENE:
		re.ClearScene();
		return 0;

//	case UI_KEY_GETOVERSTRIKEMODE:
//		return Key_GetOverstrikeMode();
//		return 0;

//	case UI_PC_READ_TOKEN:
//		return PC_ReadTokenHandle( args[1], VMA(2) );
		
//	case UI_PC_SOURCE_FILE_AND_LINE:
//		return PC_SourceFileAndLine( args[1], VMA(2), VMA(3) );

	case UI_KEY_GETCATCHER:
		return Key_GetCatcher();

	case UI_MILLISECONDS:
		return Sys_Milliseconds();

	case UI_S_REGISTERSOUND:
		return S_RegisterSound((const char *) VMA(1));

	case UI_S_STARTLOCALSOUND:
//.........这里部分代码省略.........
开发者ID:Elfmagi,项目名称:OpenJK,代码行数:101,代码来源:cl_ui.cpp

示例14: CL_UISystemCalls

/*
====================
CL_UISystemCalls

The ui module is making a system call
====================
*/
int CL_UISystemCalls( int *args ) {
	switch( args[0] ) {
	case UI_ERROR:
		Com_Error( ERR_DROP, "%s", VMA(1) );
		return 0;

	case UI_PRINT:
		Com_Printf( "%s", VMA(1) );
		return 0;

	case UI_MILLISECONDS:
		return Sys_Milliseconds();

	case UI_CVAR_REGISTER:
		Cvar_Register( (vmCvar_t *)VMA(1), (const char *)VMA(2), (const char *)VMA(3), args[4] ); 
		return 0;

	case UI_CVAR_UPDATE:
		Cvar_Update( (vmCvar_t *)VMA(1) );
		return 0;

	case UI_CVAR_SET:
		Cvar_Set( (const char *)VMA(1), (const char *)VMA(2) );
		return 0;

	case UI_CVAR_VARIABLEVALUE:
		return FloatAsInt( Cvar_VariableValue( (const char *)VMA(1) ) );

	case UI_CVAR_VARIABLESTRINGBUFFER:
		Cvar_VariableStringBuffer( (const char *)VMA(1), (char *)VMA(2), args[3] );
		return 0;

	case UI_CVAR_SETVALUE:
		Cvar_SetValue( (const char *)VMA(1), VMF(2) );
		return 0;

	case UI_CVAR_RESET:
		Cvar_Reset( (const char *)VMA(1) );
		return 0;

	case UI_CVAR_CREATE:
		Cvar_Get( (const char *)VMA(1), (const char *)VMA(2), args[3] );
		return 0;

	case UI_CVAR_INFOSTRINGBUFFER:
		Cvar_InfoStringBuffer( args[1], (char *)VMA(2), args[3] );
		return 0;

	case UI_ARGC:
		return Cmd_Argc();

	case UI_ARGV:
		Cmd_ArgvBuffer( args[1], (char *)VMA(2), args[3] );
		return 0;

	case UI_CMD_EXECUTETEXT:
		Cbuf_ExecuteText( args[1], (const char *)VMA(2) );
		return 0;

	case UI_FS_FOPENFILE:
		return FS_FOpenFileByMode( (const char *)VMA(1), (int *)VMA(2), (fsMode_t)args[3] );

	case UI_FS_READ:
		FS_Read2( VMA(1), args[2], args[3] );
		return 0;

	case UI_FS_WRITE:
		FS_Write( VMA(1), args[2], args[3] );
		return 0;

	case UI_FS_FCLOSEFILE:
		FS_FCloseFile( args[1] );
		return 0;

	case UI_FS_GETFILELIST:
		return FS_GetFileList( (const char *)VMA(1), (const char *)VMA(2), (char *)VMA(3), args[4] );

	case UI_R_REGISTERMODEL:
		return re.RegisterModel( (const char *)VMA(1) );

	case UI_R_REGISTERSKIN:
		return re.RegisterSkin( (const char *)VMA(1) );

	case UI_R_REGISTERSHADERNOMIP:
		return re.RegisterShaderNoMip( (const char *)VMA(1) );

	case UI_R_CLEARSCENE:
		re.ClearScene();
		return 0;

	case UI_R_ADDREFENTITYTOSCENE:
		re.AddRefEntityToScene( (const refEntity_t *)VMA(1) );
		return 0;
//.........这里部分代码省略.........
开发者ID:Boothand,项目名称:jk2mp,代码行数:101,代码来源:cl_ui.cpp

示例15: CL_UISystemCalls

/**
 * @brief The ui module is making a system call
 * @param[in] args
 * @return
 */
intptr_t CL_UISystemCalls(intptr_t *args)
{
    switch (args[0])
    {
    case UI_ERROR:
        Com_Error(ERR_DROP, "%s", (char *)VMA(1));
    case UI_PRINT:
        Com_Printf("%s", (char *)VMA(1));
        return 0;
    case UI_MILLISECONDS:
        return Sys_Milliseconds();
    case UI_CVAR_REGISTER:
        Cvar_Register(VMA(1), VMA(2), VMA(3), args[4]);
        return 0;
    case UI_CVAR_UPDATE:
        Cvar_Update(VMA(1));
        return 0;
    case UI_CVAR_SET:
        Cvar_SetSafe(VMA(1), VMA(2));
        return 0;
    case UI_CVAR_VARIABLEVALUE:
        return FloatAsInt(Cvar_VariableValue(VMA(1)));
    case UI_CVAR_VARIABLESTRINGBUFFER:
        Cvar_VariableStringBuffer(VMA(1), VMA(2), args[3]);
        return 0;
    case UI_CVAR_LATCHEDVARIABLESTRINGBUFFER:
        Cvar_LatchedVariableStringBuffer(VMA(1), VMA(2), args[3]);
        return 0;
    case UI_CVAR_SETVALUE:
        Cvar_SetValueSafe(VMA(1), VMF(2));
        return 0;
    case UI_CVAR_RESET:
        Cvar_Reset(VMA(1));
        return 0;
    case UI_CVAR_CREATE:
        Cvar_Register(NULL, VMA(1), VMA(2), args[3]);
        return 0;
    case UI_CVAR_INFOSTRINGBUFFER:
        Cvar_InfoStringBuffer(args[1], VMA(2), args[3]);
        return 0;
    case UI_ARGC:
        return Cmd_Argc();
    case UI_ARGV:
        Cmd_ArgvBuffer(args[1], VMA(2), args[3]);
        return 0;
    case UI_CMD_EXECUTETEXT:
        if (args[1] == EXEC_NOW
                && (!strncmp(VMA(2), "snd_restart", 11)
                    || !strncmp(VMA(2), "vid_restart", 11)
                    || !strncmp(VMA(2), "quit", 5)))
        {
            Com_Printf(S_COLOR_YELLOW "turning EXEC_NOW '%.11s' into EXEC_INSERT\n", (const char *)VMA(2));
            args[1] = EXEC_INSERT;
        }
        Cbuf_ExecuteText(args[1], VMA(2));
        return 0;
    case UI_ADDCOMMAND:
        Cmd_AddCommand(VMA(1));
        return 0;
    case UI_FS_FOPENFILE:
        return FS_FOpenFileByMode(VMA(1), VMA(2), (fsMode_t)args[3]);
    case UI_FS_READ:
        FS_Read(VMA(1), args[2], args[3]);
        return 0;
    case UI_FS_WRITE:
        FS_Write(VMA(1), args[2], args[3]);
        return 0;
    case UI_FS_FCLOSEFILE:
        FS_FCloseFile(args[1]);
        return 0;
    case UI_FS_DELETEFILE:
        return FS_Delete(VMA(1));
    case UI_FS_GETFILELIST:
        return FS_GetFileList(VMA(1), VMA(2), VMA(3), args[4]);
    case UI_R_REGISTERMODEL:
        return re.RegisterModel(VMA(1));
    case UI_R_REGISTERSKIN:
        return re.RegisterSkin(VMA(1));
    case UI_R_REGISTERSHADERNOMIP:
        return re.RegisterShaderNoMip(VMA(1));
    case UI_R_CLEARSCENE:
        re.ClearScene();
        return 0;
    case UI_R_ADDREFENTITYTOSCENE:
        re.AddRefEntityToScene(VMA(1));
        return 0;
    case UI_R_ADDPOLYTOSCENE:
        re.AddPolyToScene(args[1], args[2], VMA(3));
        return 0;
    case UI_R_ADDPOLYSTOSCENE:
        re.AddPolysToScene(args[1], args[2], VMA(3), args[4]);
        return 0;
    case UI_R_ADDLIGHTTOSCENE:
        // new dlight code
        re.AddLightToScene(VMA(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), args[7], args[8]);
//.........这里部分代码省略.........
开发者ID:etlegacy,项目名称:etlegacy,代码行数:101,代码来源:cl_ui.c


注:本文中的FS_GetFileList函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。