本文整理汇总了C++中VM_Free函数的典型用法代码示例。如果您正苦于以下问题:C++ VM_Free函数的具体用法?C++ VM_Free怎么用?C++ VM_Free使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VM_Free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VM_Clear
/*
==============
VM_Clear
==============
*/
void VM_Clear(void) {
int i;
for (i=0;i<MAX_VM; i++) {
VM_Free(&vmTable[i]);
}
}
示例2: sizeof
vm_t *VM_Create( vmSlots_t vmSlot ) {
vm_t *vm = NULL;
// see if we already have the VM
if ( vmTable[vmSlot] )
return vmTable[vmSlot];
// find a free vm
vmTable[vmSlot] = (vm_t *)Z_Malloc( sizeof( *vm ), TAG_VM, qtrue );
vm = vmTable[vmSlot];
// initialise it
vm->slot = vmSlot;
Q_strncpyz( vm->name, vmNames[vmSlot], sizeof( vm->name ) );
// find the module api
FS_FindPureDLL( vm->name );
Com_Printf( "VM_Create: %s"ARCH_STRING DLL_EXT, vm->name );
vm->dllHandle = Sys_LoadGameDll( vm->name, &vm->GetModuleAPI );
if ( vm->dllHandle ) {
if ( com_developer->integer ) Com_Printf( " succeeded [0x%X+0x%X]\n", vm->dllHandle, (intptr_t)vm->GetModuleAPI - (intptr_t)vm->dllHandle );
else Com_Printf( " succeeded\n" );
return vm;
}
VM_Free( vm );
Com_Printf( " failed!\n" );
return NULL;
}
示例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 ) );
}
示例4: VM_Clear
void VM_Clear( void ) {
for ( int i=0; i<MAX_VM; i++ )
VM_Free( vmTable[i] );
currentVM = NULL;
lastVM = NULL;
}
示例5: 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 );
}
示例6: CLT3_ShutdownCGame
void CLT3_ShutdownCGame() {
in_keyCatchers &= ~KEYCATCH_CGAME;
cls.q3_cgameStarted = false;
if ( !cgvm ) {
return;
}
VM_Call( cgvm, CG_SHUTDOWN );
VM_Free( cgvm );
cgvm = NULL;
}
示例7: CL_ShutdownCGame
/*
====================
CL_ShutdonwCGame
====================
*/
void CL_ShutdownCGame( void ) {
cls.keyCatchers &= ~KEYCATCH_CGAME;
cls.cgameStarted = qfalse;
if ( !cgvm ) {
return;
}
VM_Call( cgvm, CG_SHUTDOWN );
VM_Free( cgvm );
cgvm = NULL;
}
示例8: CL_ShutdownUI
/*
====================
CL_ShutdownUI
====================
*/
void CL_ShutdownUI( void ) {
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_UI );
cls.uiStarted = qfalse;
if ( !uivm ) {
return;
}
VM_Call( uivm, UI_SHUTDOWN );
VM_Free( uivm );
uivm = NULL;
}
示例9: CL_ShutdownUI
/*
====================
CL_ShutdownUI
====================
*/
void CL_ShutdownUI( void ) {
cls.keyCatchers &= ~KEYCATCH_UI;
cls.uiStarted = qfalse;
if ( !uivm ) {
return;
}
VM_Call( uivm, UI_SHUTDOWN );
VM_Free( uivm );
uivm = NULL;
}
示例10: CL_ShutdownCGame
/*
====================
CL_ShutdonwCGame
====================
*/
void CL_ShutdownCGame( void ) {
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_CGAME );
cls.cgameStarted = qfalse;
if ( !cgvm ) {
return;
}
VM_Call( cgvm, CG_SHUTDOWN );
VM_Free( cgvm );
cgvm = NULL;
}
示例11: 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 );
}
示例12: 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 );
}
示例13: SV_ShutdownGameProgs
/*
===============
SV_ShutdownGameProgs
Called every time a map changes
===============
*/
void SV_ShutdownGameProgs(void) {
if(!gvm) {
return;
}
VM_Call(gvm, GAME_SHUTDOWN, false);
VM_Free(gvm);
gvm = NULL;
if ( sv_newGameShlib->string[0] ) {
FS_Rename( sv_newGameShlib->string, "game" DLL_EXT);
Cvar_Set( "sv_newGameShlib", "" );
}
}
示例14: CL_ShutdownUI
/*
====================
CL_ShutdownUI
====================
*/
void CL_ShutdownUI( void ) {
Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_UI );
cls.uiStarted = qfalse;
if ( !uivm ) {
return;
}
VM_Call( uivm, UI_SHUTDOWN );
VM_Free( uivm );
uivm = NULL;
#if EMSCRIPTEN
cls.uiGlConfig = NULL;
cls.numUiPatches = 0;
#endif
}
示例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
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;
}