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


C++ VM_Create函数代码示例

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


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

示例1: CL_InitUI

void CL_InitUI( void ) {
	int v;
	vmInterpret_t interpret;

	// load the dll or bytecode
	if ( cl_connectedToPureServer != 0 ) {
		// if sv_pure is set we only allow qvms to be loaded
		interpret = VMI_COMPILED;
	} else {
		interpret = Cvar_VariableValue( "vm_ui" );
	}

//----(SA)	always dll

#ifdef WOLF_SP_DEMO
	uivm = VM_Create( "ui", CL_UISystemCalls, VMI_NATIVE );
#else
	uivm = VM_Create( "ui", CL_UISystemCalls, Cvar_VariableValue( "vm_ui" ) );
#endif

	if ( !uivm ) {
		Com_Error( ERR_FATAL, "VM_Create on UI failed" );
	}

	// sanity check
	v = VM_Call( uivm, UI_GETAPIVERSION );
	if ( v != UI_API_VERSION ) {
		Com_Error( ERR_FATAL, "User Interface is version %d, expected %d", v, UI_API_VERSION );
		cls.uiStarted = qfalse;
	}

	// init for this gamestate
//	VM_Call( uivm, UI_INIT );
	VM_Call( uivm, UI_INIT, ( cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE ) );
}
开发者ID:phobosanomaly,项目名称:rtcw,代码行数:35,代码来源:cl_ui.c

示例2: PHYS_InitGameProgs

/*
===============
PHYS_InitGameProgs

Called on a normal map change, not on a map_restart
===============
*/
void PHYS_InitGameProgs(void)
{
#if defined(USE_LLVM)
  pvm = VM_Create("physics", PHYS_SystemCalls, Cvar_VariableValue("vm_physics"));
#else
  pvm = VM_Create("physics", PHYS_SystemCalls, VMI_NATIVE);
#endif

  if (!pvm)
    Com_Error(ERR_FATAL, "VM_Create on physics failed");

  PHYS_InitVM(qfalse);
}
开发者ID:SinSiXX,项目名称:Rogue-Reborn,代码行数:20,代码来源:sv_physics.c

示例3: CL_InitUI

/*
====================
CL_InitUI
====================
*/
void CL_InitUI( void )
{
	int v;

	uivm = VM_Create( "ui", CL_UISystemCalls, VMI_NATIVE );

	if ( !uivm )
	{
		Com_Error( ERR_FATAL, "VM_Create on UI failed" );
	}

	// sanity check
	v = VM_Call( uivm, UI_GETAPIVERSION );

	if ( v != UI_API_VERSION )
	{
		// Free uivm now, so UI_SHUTDOWN doesn't get called later.
		VM_Free( uivm );
		uivm = NULL;

		Com_Error( ERR_FATAL, "User Interface is version %d, expected %d", v, UI_API_VERSION );
	}

	// init for this gamestate
	VM_Call( uivm, UI_INIT, ( cls.state >= CA_CONNECTING && cls.state < CA_ACTIVE ) );
}
开发者ID:ghostmod,项目名称:Unvanquished,代码行数:31,代码来源:cl_ui.c

示例4: CL_InitCGame

/*
====================
CL_InitCGame

Should only be called by CL_StartHunkUsers
====================
*/
void CL_InitCGame(void)
{
	const char *info;
	const char *mapname;
	int        t1, t2;

	t1 = Sys_Milliseconds();

	// put away the console
	Con_Close();

	// find the current mapname
	info    = cl.gameState.stringData + cl.gameState.stringOffsets[CS_SERVERINFO];
	mapname = Info_ValueForKey(info, "mapname");
	Com_sprintf(cl.mapname, sizeof(cl.mapname), "maps/%s.bsp", mapname);

	// load the dll
	cgvm = VM_Create("cgame", CL_CgameSystemCalls, VMI_NATIVE);
	if (!cgvm)
	{
		Com_Error(ERR_DROP, "VM_Create on cgame failed");
	}
	cls.state = CA_LOADING;

	// init for this gamestate
	// use the lastExecutedServerCommand instead of the serverCommandSequence
	// otherwise server commands sent just before a gamestate are dropped
	// bani - added clc.demoplaying, since some mods need this at init time, and drawactiveframe is too late for them
	VM_Call(cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum, clc.demoplaying, qtrue);

	// reset any CVAR_CHEAT cvars registered by cgame
	if (!clc.demoplaying && !cl_connectedToCheatServer)
	{
		Cvar_SetCheatState();
	}

	// we will send a usercmd this frame, which
	// will cause the server to send us the first snapshot
	cls.state = CA_PRIMED;

	t2 = Sys_Milliseconds();

	Com_Printf("CL_InitCGame: %5.2f seconds\n", (t2 - t1) / 1000.0);

	// have the renderer touch all its images, so they are present
	// on the card even if the driver does deferred loading
	re.EndRegistration();

	// make sure everything is paged in
	if (!Sys_LowPhysicalMemory())
	{
		Com_TouchMemory();
	}

	// clear anything that got printed
	Con_ClearNotify();

	// update the memory usage file
	CL_UpdateLevelHunkUsage();
}
开发者ID:Mailaender,项目名称:etlegacy,代码行数:67,代码来源:cl_cgame.c

示例5: CL_InitUI

/*
====================
CL_InitUI
====================
*/
void CL_InitUI(void) {
	int v;

	uivm = VM_Create("ui", CL_UISystemCalls, VMI_NATIVE );
	if(!uivm)
	{
		Com_Error(ERR_FATAL, "VM_Create on UI failed");
	}

	// sanity check
	v = VM_Call(uivm, UI_GETAPIVERSION);
	if(v != UI_API_VERSION) {
		Com_Error(ERR_FATAL, "User Interface is version %d, expected %d", v, UI_API_VERSION);
		cls.uiStarted = false;
	}

#if defined (USE_HTTP)
	//	if the session id has something in it, then assume that the browser sent it from the
	//	command line and tell ui we're already logged in.  
	if ( com_sessionid->string[0] ) {
		VM_Call( uivm, UI_AUTHORIZED, AUTHORIZE_OK );
	}
#endif

	// init for this gamestate
	VM_Call(uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE));
}
开发者ID:TheDushan,项目名称:OpenWolf,代码行数:32,代码来源:cl_ui.cpp

示例6: CL_InitUI

void CL_InitUI( void ) {
	int		v;
	vmInterpret_t		interpret;

	// load the dll or bytecode
	if ( cl_connectedToPureServer != 0 ) {
		// if sv_pure is set we only allow qvms to be loaded
		interpret = VMI_COMPILED;
	}
	else {
		interpret = Cvar_VariableValue( "vm_ui" );
	}
	uivm = VM_Create( "ui", CL_UISystemCalls, interpret );
	if ( !uivm ) {
		Com_Error( ERR_FATAL, "VM_Create on UI failed" );
	}

	// sanity check
	v = VM_Call( uivm, UI_GETAPIVERSION );
	if (v == UI_OLD_API_VERSION) {
//		Com_Printf(S_COLOR_YELLOW "WARNING: loading old Quake III Arena User Interface version %d\n", v );
		// init for this gamestate
		VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE));
	}
	else if (v != UI_API_VERSION) {
		Com_Error( ERR_DROP, "User Interface is version %d, expected %d", v, UI_API_VERSION );
		cls.uiStarted = qfalse;
	}
	else {
		// init for this gamestate
		VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE) );
	}
}
开发者ID:he110world,项目名称:quake3-ios,代码行数:33,代码来源:cl_ui.c

示例7: CL_InitUI

void CL_InitUI( void ) {
	int		v;
	vmInterpret_t		interpret;

	// load the dll or bytecode
	if ( cl_connectedToPureServer != 0 ) {
#if 0
		// if sv_pure is set we only allow qvms to be loaded
		interpret = VMI_COMPILED;
#else //load the module type based on what the server is doing -rww
		interpret = (vmInterpret_t)cl_connectedUI;
#endif
	}
	else {
		interpret = (vmInterpret_t)(int)Cvar_VariableValue( "vm_ui" );
	}
	uivm = VM_Create( "ui", CL_UISystemCalls, interpret );
	if ( !uivm ) {
		Com_Error( ERR_FATAL, "VM_Create on UI failed" );
	}

	// sanity check
	v = VM_Call( uivm, UI_GETAPIVERSION );
	if (v != UI_API_VERSION) {
		Com_Error( ERR_DROP, "User Interface is version %d, expected %d", v, UI_API_VERSION );
		cls.uiStarted = qfalse;
	}
	else {
		// init for this gamestate
		//rww - changed to <= CA_ACTIVE, because that is the state when we did a vid_restart
		//ingame (was just < CA_ACTIVE before, resulting in ingame menus getting wiped and
		//not reloaded on vid restart from ingame menu)
		VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state <= CA_ACTIVE) );
	}
}
开发者ID:AlexCSilva,项目名称:jediacademy,代码行数:35,代码来源:cl_ui.cpp

示例8: CL_InitCGame

/*
====================
CL_InitCGame

Should only be called by CL_StartHunkUsers
====================
*/
void CL_InitCGame( void ) {
	const char			*info;
	const char			*mapname;
	int					t1, t2;
	vmInterpret_t		interpret;

	t1 = Sys_Milliseconds();

	// put away the console
	Con_Close();

	// find the current mapname
	info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ];
	mapname = Info_ValueForKey( info, "mapname" );
	Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname );

	// load the dll or bytecode
	if ( cl_connectedToPureServer != 0 ) {
		// if sv_pure is set we only allow qvms to be loaded
		interpret = VMI_COMPILED;
	}
	else {
		interpret = Cvar_VariableValue( "vm_cgame" );
	}
	cgvm = VM_Create( "cgame", CL_CgameSystemCalls, interpret );
	if ( !cgvm ) {
		Com_Error( ERR_DROP, "VM_Create on cgame failed" );
	}
	cls.state = CA_LOADING;

	// init for this gamestate
	// use the lastExecutedServerCommand instead of the serverCommandSequence
	// otherwise server commands sent just before a gamestate are dropped
	VM_Call( cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum );

	// reset any CVAR_CHEAT cvars registered by cgame
	if ( !clc.demoplaying && !cl_connectedToCheatServer )
		Cvar_SetCheatState();

	// we will send a usercmd this frame, which
	// will cause the server to send us the first snapshot
	cls.state = CA_PRIMED;

	t2 = Sys_Milliseconds();

	Com_DPrintf( "CL_InitCGame: %5.2f seconds\n", (t2-t1)/1000.0 );

	// have the renderer touch all its images, so they are present
	// on the card even if the driver does deferred loading
	re.EndRegistration();

	// make sure everything is paged in
	if (!Sys_LowPhysicalMemory()) {
		Com_TouchMemory();
	}

	// clear anything that got printed
	Con_ClearNotify ();
	CL_WriteClientLog( va("`~=-----------------=~`\n MAP: %s \n`~=-----------------=~`\n", mapname ) );
}
开发者ID:ksritharan,项目名称:fsm-trem,代码行数:67,代码来源:cl_cgame.c

示例9: memcpy

/*
=================
VM_Restart

Reload the data, but leave everything else in place
This allows a server to do a map_restart without changing memory allocation
=================
*/
vm_t *VM_Restart( vm_t *vm ) {
	vm_t saved;

	memcpy( &saved, vm, sizeof( saved ) );

	VM_Free( vm );

	return VM_Create( saved.slot );
}
开发者ID:Razish,项目名称:CompJA,代码行数:17,代码来源:vm.cpp

示例10: VM_Free

// Reload the data, but leave everything else in place
// This allows a server to do a map_restart without changing memory allocation
vm_t *VM_Restart( vm_t *vm ) {
	const vm_t saved = *vm;

	VM_Free( vm );

	if ( saved.isLegacy )
		return VM_CreateLegacy( saved.slot, saved.legacy.syscall );
	else
		return VM_Create( saved.slot );
}
开发者ID:BruceJohnJennerLawso,项目名称:OpenJK,代码行数:12,代码来源:vm.cpp

示例11: memcpy

/*
=================
VM_Restart

Reload the data, but leave everything else in place
This allows a server to do a map_restart without changing memory allocation
=================
*/
vm_t *VM_Restart( vm_t *vm ) {
	vm_t saved;

	memcpy( &saved, vm, sizeof( saved ) );

	VM_Free( vm );

	if ( saved.isLegacy )
		return VM_CreateLegacy( saved.slot, saved.legacy.syscall );
	else
		return VM_Create( saved.slot );
}
开发者ID:Almightygir,项目名称:OpenJK,代码行数:20,代码来源:vm.cpp

示例12: SV_InitGameProgs

/*
===============
SV_InitGameProgs

Called on a normal map change, not on a map_restart
===============
*/
void SV_InitGameProgs(void) {
	sv.num_tagheaders = 0;
	sv.num_tags = 0;

	// load the dll or bytecode
	gvm = VM_Create( "qagame", SV_GameSystemCalls, VMI_NATIVE );
	if(!gvm) {
		Com_Error(ERR_FATAL, "VM_Create on game failed");
	}

	SV_InitGameVM(false);
}
开发者ID:TheDushan,项目名称:OpenWolf,代码行数:19,代码来源:sv_game.cpp

示例13: intptr_t

/*
=================
VM_Restart

Reload the data, but leave everything else in place
This allows a server to do a map_restart without changing memory allocation
=================
*/
vm_t *VM_Restart( vm_t *vm ) {
	// DLL's can't be restarted in place
	char            name[MAX_QPATH];
	vmInterpret_t	interpret;

	intptr_t(*systemCall) (intptr_t * parms);

	systemCall = vm->systemCall;
	Q_strncpyz(name, vm->name, sizeof(name));
	interpret = vm->interpret;

	VM_Free(vm);

	vm = VM_Create(name, systemCall, interpret);
	return vm;
}
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:24,代码来源:vm.cpp

示例14: CL_InitUI

void CL_InitUI( void ) {
	int v;

	uivm = VM_Create( "ui", CL_UISystemCalls, VMI_NATIVE );
	if ( !uivm ) {
		Com_Error( ERR_FATAL, "VM_Create on UI failed" );
	}

	// sanity check
	v = VM_Call( uivm, UI_GETAPIVERSION );
	if ( v != UI_API_VERSION ) {
		Com_Error( ERR_FATAL, "User Interface is version %d, expected %d", v, UI_API_VERSION );
		cls.uiStarted = qfalse;
	}

	// init for this gamestate
	VM_Call( uivm, UI_INIT, ( cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE ) );
}
开发者ID:Justasic,项目名称:RTCW-MP,代码行数:18,代码来源:cl_ui.c

示例15: intptr_t

/*
=================
VM_Restart

Reload the data, but leave everything else in place
This allows a server to do a map_restart without changing memory allocation
=================
*/
vm_t *VM_Restart( vm_t *vm ) {

	// DLL's can't be restarted in place
	if ( vm->dllHandle ) {
		char name[MAX_QPATH];
		intptr_t ( *systemCall )( intptr_t *parms );

		systemCall = vm->systemCall;
		Q_strncpyz( name, vm->name, sizeof( name ) );

		VM_Free( vm );

		vm = VM_Create( name, systemCall, VMI_NATIVE );
		return vm;
	}

	return NULL;
}
开发者ID:cbxbiker61,项目名称:wolfsp,代码行数:26,代码来源:vm.c


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