本文整理汇总了C++中Hunk_MemoryRemaining函数的典型用法代码示例。如果您正苦于以下问题:C++ Hunk_MemoryRemaining函数的具体用法?C++ Hunk_MemoryRemaining怎么用?C++ Hunk_MemoryRemaining使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Hunk_MemoryRemaining函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: intptr_t
/*
================
VM_Create
================
*/
vm_t *VM_Create( const char *module, intptr_t ( *systemCalls )(intptr_t *), vmInterpret_t interpret ) {
vm_t *vm;
int i, remaining;
if ( !module || !module[0] || !systemCalls ) {
Com_Error( ERR_FATAL, "VM_Create: bad parms" );
}
remaining = Hunk_MemoryRemaining();
// see if we already have the VM
for ( i = 0 ; i < MAX_VM ; i++ ) {
if ( !Q_stricmp( vmTable[i].name, module ) ) {
vm = &vmTable[i];
return vm;
}
}
// find a free vm
for ( i = 0 ; i < MAX_VM ; i++ ) {
if ( !vmTable[i].name[0] ) {
break;
}
}
if ( i == MAX_VM ) {
Com_Error( ERR_FATAL, "VM_Create: no free vm_t" );
}
vm = &vmTable[i];
Q_strncpyz( vm->name, module, sizeof( vm->name ) );
vm->systemCall = systemCalls;
if ( interpret == VMI_NATIVE ) {
// try to load as a system dll
Com_Printf("Loading dll file '%s'.\n", vm->name);
vm->dllHandle = Sys_LoadDll( module, vm->fqpath, &vm->entryPoint, VM_DllSyscall );
if ( vm->dllHandle ) {
vm->systemCall = systemCalls;
return vm;
}
Com_Printf("Failed loading DLL.\n");
}
Com_Printf("%s loaded in %d bytes on the hunk\n", module, remaining - Hunk_MemoryRemaining());
return NULL;
}
示例2: int
vm_t *VM_Create( const char *module, int (*systemCalls)(int *) ) {
vm_t *vm;
int length;
int dataLength;
int i, remaining;
char filename[MAX_QPATH];
if ( !module || !module[0] || !systemCalls ) {
Com_Error( ERR_FATAL, "VM_Create: bad parms" );
}
remaining = Hunk_MemoryRemaining();
// see if we already have the VM
for ( i = 0 ; i < MAX_VM ; i++ ) {
if (!Q_stricmp(vmTable[i].name, module)) {
vm = &vmTable[i];
return vm;
}
}
// find a free vm
for ( i = 0 ; i < MAX_VM ; i++ ) {
if ( !vmTable[i].name[0] ) {
break;
}
}
if ( i == MAX_VM ) {
Com_Error( ERR_FATAL, "VM_Create: no free vm_t" );
}
vm = &vmTable[i];
Q_strncpyz( vm->name, module, sizeof( vm->name ) );
vm->systemCall = systemCalls;
// try to load as a system dll
Com_Printf( "Loading dll file %s.\n", vm->name );
vm->dllHandle = Sys_LoadDll( module, vm->fqpath , &vm->entryPoint, VM_DllSyscall );
if ( vm->dllHandle ) {
return vm;
}
Com_Error( ERR_FATAL, "Unable to load %s.", vm->name );
}
示例3: CL_CgameSystemCalls
//.........这里部分代码省略.........
return 0;
case CG_R_SETCOLOR:
re.SetColor( VMA(1) );
return 0;
case CG_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 CG_R_MODELBOUNDS:
re.ModelBounds( args[1], VMA(2), VMA(3) );
return 0;
case CG_R_LERPTAG:
return re.LerpTag( VMA(1), args[2], args[3], args[4], VMF(5), VMA(6) );
case CG_GETGLCONFIG:
CL_GetGlconfig( VMA(1) );
return 0;
case CG_GETGAMESTATE:
CL_GetGameState( VMA(1) );
return 0;
case CG_GETCURRENTSNAPSHOTNUMBER:
CL_GetCurrentSnapshotNumber( VMA(1), VMA(2) );
return 0;
case CG_GETSNAPSHOT:
return CL_GetSnapshot( args[1], VMA(2) );
case CG_GETSERVERCOMMAND:
return CL_GetServerCommand( args[1] );
case CG_GETCURRENTCMDNUMBER:
return CL_GetCurrentCmdNumber();
case CG_GETUSERCMD:
return CL_GetUserCmd( args[1], VMA(2) );
case CG_SETUSERCMDVALUE:
CL_SetUserCmdValue( args[1], VMF(2) );
return 0;
case CG_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case CG_KEY_ISDOWN:
return Key_IsDown( args[1] );
case CG_KEY_GETCATCHER:
return Key_GetCatcher();
case CG_KEY_SETCATCHER:
// Don't allow the cgame module to close the console
Key_SetCatcher( args[1] | ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) );
return 0;
case CG_KEY_GETKEY:
return Key_GetKey( VMA(1) );
case CG_MEMSET:
Com_Memset( VMA(1), args[2], args[3] );
return 0;
case CG_MEMCPY:
Com_Memcpy( VMA(1), VMA(2), args[3] );
return 0;
case CG_STRNCPY:
strncpy( VMA(1), VMA(2), args[3] );
return args[1];
case CG_SIN:
return FloatAsInt( sin( VMF(1) ) );
case CG_COS:
return FloatAsInt( cos( VMF(1) ) );
case CG_ATAN2:
return FloatAsInt( atan2( VMF(1), VMF(2) ) );
case CG_SQRT:
return FloatAsInt( sqrt( VMF(1) ) );
case CG_FLOOR:
return FloatAsInt( floor( VMF(1) ) );
示例4: CL_CgameSystemCalls
//.........这里部分代码省略.........
return 0;
case CG_R_DRAW2DPOLYS:
re.Add2dPolys(VMA(1), args[2], args[3]);
return 0;
case CG_R_MODELBOUNDS:
re.ModelBounds(args[1], VMA(2), VMA(3));
return 0;
case CG_R_LERPTAG:
return re.LerpTag(VMA(1), VMA(2), VMA(3), args[4]);
case CG_GETGLCONFIG:
CL_GetGlconfig(VMA(1));
return 0;
case CG_GETGAMESTATE:
CL_GetGameState(VMA(1));
return 0;
case CG_GETCURRENTSNAPSHOTNUMBER:
CL_GetCurrentSnapshotNumber(VMA(1), VMA(2));
return 0;
case CG_GETSNAPSHOT:
return CL_GetSnapshot(args[1], VMA(2));
case CG_GETSERVERCOMMAND:
return CL_GetServerCommand(args[1]);
case CG_GETCURRENTCMDNUMBER:
return CL_GetCurrentCmdNumber();
case CG_GETUSERCMD:
return CL_GetUserCmd(args[1], VMA(2));
case CG_SETUSERCMDVALUE:
CL_SetUserCmdValue(args[1], args[2], VMF(3), args[4]);
return 0;
case CG_SETCLIENTLERPORIGIN:
CL_SetClientLerpOrigin(VMF(1), VMF(2), VMF(3));
return 0;
case CG_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case CG_KEY_ISDOWN:
return Key_IsDown(args[1]);
case CG_KEY_GETCATCHER:
return Key_GetCatcher();
case CG_KEY_SETCATCHER:
// Don't allow the cgame module to close the console
Key_SetCatcher(args[1] | (Key_GetCatcher() & KEYCATCH_CONSOLE));
return 0;
case CG_KEY_GETKEY:
return Key_GetKey(VMA(1));
case CG_KEY_GETOVERSTRIKEMODE:
return Key_GetOverstrikeMode();
case CG_KEY_SETOVERSTRIKEMODE:
Key_SetOverstrikeMode(args[1]);
return 0;
case CG_MEMSET:
return (intptr_t)memset(VMA(1), args[2], args[3]);
case CG_MEMCPY:
return (intptr_t)memcpy(VMA(1), VMA(2), args[3]);
case CG_STRNCPY:
return (intptr_t)strncpy(VMA(1), VMA(2), args[3]);
case CG_SIN:
return FloatAsInt(sin(VMF(1)));
case CG_COS:
return FloatAsInt(cos(VMF(1)));
case CG_ATAN2:
return FloatAsInt(atan2(VMF(1), VMF(2)));
case CG_SQRT:
return FloatAsInt(sqrt(VMF(1)));
case CG_FLOOR:
示例5: CL_UISystemCalls
//.........这里部分代码省略.........
case UI_LAN_GETSERVERADDRESSSTRING:
LAN_GetServerAddressString( args[1], args[2], VMA(3), args[4] );
return 0;
case UI_LAN_GETSERVERINFO:
LAN_GetServerInfo( args[1], args[2], VMA(3), args[4] );
return 0;
case UI_LAN_GETSERVERPING:
return LAN_GetServerPing( args[1], args[2] );
case UI_LAN_MARKSERVERVISIBLE:
LAN_MarkServerVisible( args[1], args[2], args[3] );
return 0;
case UI_LAN_SERVERISVISIBLE:
return LAN_ServerIsVisible( args[1], args[2] );
case UI_LAN_UPDATEVISIBLEPINGS:
return LAN_UpdateVisiblePings( args[1] );
case UI_LAN_RESETPINGS:
LAN_ResetPings( args[1] );
return 0;
case UI_LAN_SERVERSTATUS:
return LAN_GetServerStatus( VMA(1), VMA(2), args[3] );
case UI_LAN_COMPARESERVERS:
return LAN_CompareServers( args[1], args[2], args[3], args[4], args[5] );
case UI_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case UI_GET_CDKEY:
CLUI_GetCDKey( VMA(1), args[2] );
return 0;
case UI_SET_CDKEY:
CLUI_SetCDKey( VMA(1) );
return 0;
case UI_SET_PBCLSTATUS:
return 0;
case UI_R_REGISTERFONT:
re.RegisterFont( VMA(1), args[2], VMA(3));
return 0;
case UI_MEMSET:
Com_Memset( VMA(1), args[2], args[3] );
return 0;
case UI_MEMCPY:
Com_Memcpy( VMA(1), VMA(2), args[3] );
return 0;
case UI_STRNCPY:
return (int)strncpy( VMA(1), VMA(2), args[3] );
case UI_SIN:
return FloatAsInt( sin( VMF(1) ) );
case UI_COS:
return FloatAsInt( cos( VMF(1) ) );
示例6: CL_UISystemCalls
//.........这里部分代码省略.........
return 0;
case UI_LAN_GETPINGINFO:
LAN_GetPingInfo(args[1], (char*)VMA(2), args[3]);
return 0;
case UI_LAN_GETSERVERCOUNT:
return LAN_GetServerCount(args[1]);
case UI_LAN_GETSERVERADDRESSSTRING:
LAN_GetServerAddressString(args[1], args[2], (char*)VMA(3), args[4]);
return 0;
case UI_LAN_GETSERVERINFO:
LAN_GetServerInfo(args[1], args[2], (char*)VMA(3), args[4]);
return 0;
case UI_LAN_GETSERVERPING:
return LAN_GetServerPing(args[1], args[2]);
case UI_LAN_MARKSERVERVISIBLE:
LAN_MarkServerVisible(args[1], args[2], (bool)args[3]);
return 0;
case UI_LAN_SERVERISVISIBLE:
return LAN_ServerIsVisible(args[1], args[2]);
case UI_LAN_UPDATEVISIBLEPINGS:
return LAN_UpdateVisiblePings(args[1]);
case UI_LAN_RESETPINGS:
LAN_ResetPings(args[1]);
return 0;
case UI_LAN_SERVERSTATUS:
return LAN_GetServerStatus((char*)VMA(1), (char*)VMA(2), args[3]);
case UI_LAN_SERVERISINFAVORITELIST:
return LAN_ServerIsInFavoriteList(args[1], args[2]);
case UI_GETNEWS:
return GetNews((bool)args[1]);
case UI_LAN_COMPARESERVERS:
return LAN_CompareServers(args[1], args[2], args[3], args[4], args[5]);
case UI_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case UI_GET_CDKEY:
CLUI_GetCDKey((char*)VMA(1), args[2]);
return 0;
case UI_SET_CDKEY:
CLUI_SetCDKey((char*)VMA(1));
return 0;
case UI_R_REGISTERFONT:
re.RegisterFont((char*)VMA(1), args[2], (fontInfo_t*)VMA(3));
return 0;
case UI_MEMSET:
return (intptr_t)memset( VMA( 1 ), args[2], args[3] );
case UI_MEMCPY:
return (intptr_t)memcpy( VMA( 1 ), VMA( 2 ), args[3] );
case UI_STRNCPY:
return (intptr_t)strncpy( (char*)VMA( 1 ), (char*)VMA( 2 ), args[3] );
case UI_SIN:
return FloatAsInt(sin(VMF(1)));
case UI_COS:
return FloatAsInt(cos(VMF(1)));
case UI_ATAN2:
return FloatAsInt(atan2(VMF(1), VMF(2)));
case UI_SQRT:
return FloatAsInt(sqrt(VMF(1)));
case UI_FLOOR:
return FloatAsInt(floor(VMF(1)));
case UI_CEIL:
return FloatAsInt(ceil(VMF(1)));
case UI_PARSE_ADD_GLOBAL_DEFINE:
return Parse_AddGlobalDefine( (char*)VMA(1) );
case UI_PARSE_LOAD_SOURCE:
return Parse_LoadSourceHandle( (char*)VMA(1) );
case UI_PARSE_FREE_SOURCE:
示例7: CL_CgameSystemCalls
//.........这里部分代码省略.........
case CG_GETGLCONFIG:
CL_GetGlconfig( VMA( 1 ) );
return 0;
case CG_GETGAMESTATE:
CL_GetGameState( VMA( 1 ) );
return 0;
case CG_GETCURRENTSNAPSHOTNUMBER:
CL_GetCurrentSnapshotNumber( VMA( 1 ), VMA( 2 ) );
return 0;
case CG_GETSNAPSHOT:
return CL_GetSnapshot( args[ 1 ], VMA( 2 ) );
case CG_GETSERVERCOMMAND:
return CL_GetServerCommand( args[ 1 ] );
case CG_GETCURRENTCMDNUMBER:
return CL_GetCurrentCmdNumber();
case CG_GETUSERCMD:
return CL_GetUserCmd( args[ 1 ], VMA( 2 ) );
case CG_SETUSERCMDVALUE:
CL_SetUserCmdValue( args[ 1 ], args[ 2 ], VMF( 3 ), args[ 4 ] );
return 0;
case CG_SETCLIENTLERPORIGIN:
CL_SetClientLerpOrigin( VMF( 1 ), VMF( 2 ), VMF( 3 ) );
return 0;
case CG_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case CG_KEY_ISDOWN:
return Key_IsDown( args[ 1 ] );
case CG_KEY_GETCATCHER:
return Key_GetCatcher();
case CG_KEY_SETCATCHER:
Key_SetCatcher( args[ 1 ] );
return 0;
case CG_KEY_GETKEY:
return Key_GetKey( VMA( 1 ) );
case CG_KEY_GETOVERSTRIKEMODE:
return Key_GetOverstrikeMode();
case CG_KEY_SETOVERSTRIKEMODE:
Key_SetOverstrikeMode( args[ 1 ] );
return 0;
case CG_S_STOPBACKGROUNDTRACK:
S_StopBackgroundTrack();
return 0;
case CG_REAL_TIME:
return Com_RealTime( VMA( 1 ) );
case CG_SNAPVECTOR:
Q_SnapVector( VMA( 1 ) );
return 0;
示例8: CL_UISystemCalls
//.........这里部分代码省略.........
case UI_LAN_GETSERVERADDRESSSTRING:
LAN_GetServerAddressString( args[1], args[2], (char *)VMA(3), args[4] );
return 0;
case UI_LAN_GETSERVERINFO:
LAN_GetServerInfo( args[1], args[2], (char *)VMA(3), args[4] );
return 0;
case UI_LAN_GETSERVERPING:
return LAN_GetServerPing( args[1], args[2] );
case UI_LAN_MARKSERVERVISIBLE:
LAN_MarkServerVisible( args[1], args[2], (qboolean)args[3] );
return 0;
case UI_LAN_SERVERISVISIBLE:
return LAN_ServerIsVisible( args[1], args[2] );
case UI_LAN_UPDATEVISIBLEPINGS:
return LAN_UpdateVisiblePings( args[1] );
case UI_LAN_RESETPINGS:
LAN_ResetPings( args[1] );
return 0;
case UI_LAN_SERVERSTATUS:
return LAN_GetServerStatus( (char *)VMA(1), (char *)VMA(2), args[3] );
case UI_LAN_COMPARESERVERS:
return LAN_CompareServers( args[1], args[2], args[3], args[4], args[5] );
case UI_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
#ifdef USE_CD_KEY
case UI_GET_CDKEY:
CLUI_GetCDKey( (char *)VMA(1), args[2] );
return 0;
case UI_SET_CDKEY:
CLUI_SetCDKey( (char *)VMA(1) );
return 0;
#endif // USE_CD_KEY
case UI_R_REGISTERFONT:
return re.RegisterFont( (const char *)VMA(1) );
case UI_R_FONT_STRLENPIXELS:
return re.Font_StrLenPixels( (const char *)VMA(1), args[2], VMF(3) );
case UI_R_FONT_STRLENCHARS:
return re.Font_StrLenChars( (const char *)VMA(1) );
case UI_R_FONT_STRHEIGHTPIXELS:
return re.Font_HeightPixels( args[1], VMF(2) );
case UI_R_FONT_DRAWSTRING:
re.Font_DrawString( args[1], args[2], (const char *)VMA(3), (const float *) VMA(4), args[5], args[6], VMF(7) );
return 0;
case UI_LANGUAGE_ISASIAN:
return re.Language_IsAsian();
case UI_LANGUAGE_USESSPACES:
return re.Language_UsesSpaces();
示例9: CL_UISystemCalls
//.........这里部分代码省略.........
return 0;
case UI_LAN_GETSERVERPING:
return LAN_GetServerPing( args[ 1 ], args[ 2 ] );
case UI_LAN_MARKSERVERVISIBLE:
LAN_MarkServerVisible( args[ 1 ], args[ 2 ], args[ 3 ] );
return 0;
case UI_LAN_SERVERISVISIBLE:
return LAN_ServerIsVisible( args[ 1 ], args[ 2 ] );
case UI_LAN_UPDATEVISIBLEPINGS:
return LAN_UpdateVisiblePings( args[ 1 ] );
case UI_LAN_RESETPINGS:
LAN_ResetPings( args[ 1 ] );
return 0;
case UI_LAN_SERVERSTATUS:
VM_CheckBlock( args[2], args[3], "UILANGSS" );
return LAN_GetServerStatus( VMA( 1 ), VMA( 2 ), args[ 3 ] );
case UI_LAN_SERVERISINFAVORITELIST:
return LAN_ServerIsInFavoriteList( args[ 1 ], args[ 2 ] );
case UI_GETNEWS:
return GetNews( args[ 1 ] );
case UI_LAN_COMPARESERVERS:
return LAN_CompareServers( args[ 1 ], args[ 2 ], args[ 3 ], args[ 4 ], args[ 5 ] );
case UI_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case UI_R_REGISTERFONT:
re.RegisterFontVM( VMA( 1 ), VMA( 2 ), args[ 3 ], VMA( 4 ) );
return 0;
case UI_PARSE_ADD_GLOBAL_DEFINE:
return Parse_AddGlobalDefine( VMA( 1 ) );
case UI_PARSE_LOAD_SOURCE:
return Parse_LoadSourceHandle( VMA( 1 ) );
case UI_PARSE_FREE_SOURCE:
return Parse_FreeSourceHandle( args[ 1 ] );
case UI_PARSE_READ_TOKEN:
return Parse_ReadTokenHandle( args[ 1 ], VMA( 2 ) );
case UI_PARSE_SOURCE_FILE_AND_LINE:
return Parse_SourceFileAndLine( args[ 1 ], VMA( 2 ), VMA( 3 ) );
case UI_S_STOPBACKGROUNDTRACK:
S_StopBackgroundTrack();
return 0;
case UI_S_STARTBACKGROUNDTRACK:
//S_StartBackgroundTrack(VMA(1), VMA(2), args[3]); //----(SA) added fadeup time
S_StartBackgroundTrack( VMA( 1 ), VMA( 2 ) );
return 0;
case UI_REAL_TIME:
return Com_RealTime( VMA( 1 ) );
示例10: CL_CgameSystemCalls
//.........这里部分代码省略.........
return 0;
case CG_R_DRAWSTRETCHPIC_GRADIENT:
re.DrawStretchPicGradient( VMF( 1 ), VMF( 2 ), VMF( 3 ), VMF( 4 ), VMF( 5 ), VMF( 6 ), VMF( 7 ), VMF( 8 ), args[9], VMA( 10 ), args[11] );
return 0;
case CG_R_MODELBOUNDS:
re.ModelBounds( args[1], VMA( 2 ), VMA( 3 ) );
return 0;
case CG_R_LERPTAG:
return re.LerpTag( VMA( 1 ), VMA( 2 ), VMA( 3 ), args[4] );
case CG_GETGLCONFIG:
CL_GetGlconfig( VMA( 1 ) );
return 0;
case CG_GETGAMESTATE:
CL_GetGameState( VMA( 1 ) );
return 0;
case CG_GETCURRENTSNAPSHOTNUMBER:
CL_GetCurrentSnapshotNumber( VMA( 1 ), VMA( 2 ) );
return 0;
case CG_GETSNAPSHOT:
return CL_GetSnapshot( args[1], VMA( 2 ) );
case CG_GETSERVERCOMMAND:
return CL_GetServerCommand( args[1] );
case CG_GETCURRENTCMDNUMBER:
return CL_GetCurrentCmdNumber();
case CG_GETUSERCMD:
return CL_GetUserCmd( args[1], VMA( 2 ) );
case CG_SETUSERCMDVALUE:
CL_SetUserCmdValue( args[1], args[2], VMF( 3 ), args[4], args[5] );
return 0;
case CG_SETCLIENTLERPORIGIN:
CL_SetClientLerpOrigin( VMF( 1 ), VMF( 2 ), VMF( 3 ) );
return 0;
case CG_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case CG_KEY_ISDOWN:
return Key_IsDown( args[1] );
case CG_KEY_GETCATCHER:
return Key_GetCatcher();
case CG_KEY_SETCATCHER:
// Don't allow the cgame module to close the console
Key_SetCatcher( args[1] | ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) );
return 0;
case CG_KEY_GETKEY:
return Key_GetKey( VMA( 1 ) );
case CG_MEMSET:
Com_Memset( VMA(1), args[2], args[3] );
return args[1];
case CG_MEMCPY:
Com_Memcpy( VMA(1), VMA(2), args[3] );
return args[1];
case CG_STRNCPY:
strncpy( VMA(1), VMA(2), args[3] );
return args[1];
case CG_SIN:
return FloatAsInt( sin( VMF( 1 ) ) );
case CG_COS:
return FloatAsInt( cos( VMF( 1 ) ) );
case CG_ATAN2:
return FloatAsInt( atan2( VMF( 1 ), VMF( 2 ) ) );
case CG_SQRT:
return FloatAsInt( sqrt( VMF( 1 ) ) );
case CG_FLOOR:
return FloatAsInt( floor( VMF( 1 ) ) );
示例11: CL_UISystemCalls
//.........这里部分代码省略.........
case UI_LAN_GETPING:
LAN_GetPing(args[1], VMA(2), args[3], VMA(4));
return 0;
case UI_LAN_GETPINGINFO:
LAN_GetPingInfo(args[1], VMA(2), args[3]);
return 0;
case UI_LAN_GETSERVERCOUNT:
return LAN_GetServerCount(args[1]);
case UI_LAN_GETSERVERADDRESSSTRING:
LAN_GetServerAddressString(args[1], args[2], VMA(3), args[4]);
return 0;
case UI_LAN_GETSERVERINFO:
LAN_GetServerInfo(args[1], args[2], VMA(3), args[4]);
return 0;
case UI_LAN_GETSERVERPING:
return LAN_GetServerPing(args[1], args[2]);
case UI_LAN_MARKSERVERVISIBLE:
LAN_MarkServerVisible(args[1], args[2], (qboolean)args[3]);
return 0;
case UI_LAN_SERVERISVISIBLE:
return LAN_ServerIsVisible(args[1], args[2]);
case UI_LAN_UPDATEVISIBLEPINGS:
return LAN_UpdateVisiblePings(args[1]);
case UI_LAN_RESETPINGS:
LAN_ResetPings(args[1]);
return 0;
case UI_LAN_SERVERSTATUS:
return LAN_GetServerStatus(VMA(1), VMA(2), args[3]);
case UI_LAN_SERVERISINFAVORITELIST:
return LAN_ServerIsInFavoriteList(args[1], args[2]);
case UI_LAN_COMPARESERVERS:
return LAN_CompareServers(args[1], args[2], args[3], args[4], args[5]);
case UI_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case UI_R_REGISTERFONT:
re.RegisterFont(VMA(1), args[2], VMA(3), (args[4] == qtrue));
return 0;
case UI_MEMSET:
return (intptr_t)memset(VMA(1), args[2], args[3]);
case UI_MEMCPY:
return (intptr_t)memcpy(VMA(1), VMA(2), args[3]);
case UI_STRNCPY:
return (intptr_t)strncpy(VMA(1), VMA(2), args[3]);
case UI_SIN:
return FloatAsInt(sin(VMF(1)));
case UI_COS:
return FloatAsInt(cos(VMF(1)));
case UI_ATAN2:
return FloatAsInt(atan2(VMF(1), VMF(2)));
case UI_SQRT:
return FloatAsInt(sqrt(VMF(1)));
case UI_FLOOR:
return FloatAsInt(floor(VMF(1)));
case UI_CEIL:
return FloatAsInt(ceil(VMF(1)));
case UI_PC_ADD_GLOBAL_DEFINE:
return botlib_export->PC_AddGlobalDefine(VMA(1));
case UI_PC_REMOVE_ALL_GLOBAL_DEFINES:
botlib_export->PC_RemoveAllGlobalDefines();
return 0;
case UI_PC_LOAD_SOURCE:
return botlib_export->PC_LoadSourceHandle(VMA(1));
case UI_PC_FREE_SOURCE:
return botlib_export->PC_FreeSourceHandle(args[1]);
case UI_PC_READ_TOKEN:
return botlib_export->PC_ReadTokenHandle(args[1], VMA(2));
示例12: CL_CgameSystemCalls
//.........这里部分代码省略.........
return 0;
case CG_R_SETCLIPREGION:
re.SetClipRegion( (const float*)VMA(1) );
return 0;
case CG_R_DRAWSTRETCHPIC:
re.DrawStretchPic( VMF(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), VMF(7), VMF(8), (qhandle_t)args[9] );
return 0;
case CG_R_MODELBOUNDS:
re.ModelBounds( (qhandle_t)args[1], (float*)VMA(2), (float*)VMA(3) );
return 0;
case CG_R_LERPTAG:
return re.LerpTag( (orientation_t*)VMA(1), args[2], args[3], args[4], VMF(5), (const char*)VMA(6) );
case CG_GETGLCONFIG:
CL_GetGlconfig( (glconfig_t*)VMA(1) );
return 0;
case CG_GETGAMESTATE:
CL_GetGameState( (gameState_t*)VMA(1) );
return 0;
case CG_GETCURRENTSNAPSHOTNUMBER:
CL_GetCurrentSnapshotNumber( (int*)VMA(1), (int*)VMA(2) );
return 0;
case CG_GETSNAPSHOT:
return CL_GetSnapshot( args[1], (snapshot_t*)VMA(2) );
case CG_GETSERVERCOMMAND:
return CL_GetServerCommand( args[1] );
case CG_GETCURRENTCMDNUMBER:
return CL_GetCurrentCmdNumber();
case CG_GETUSERCMD:
return CL_GetUserCmd( args[1], (usercmd_t*)VMA(2) );
case CG_SETUSERCMDVALUE:
CL_SetUserCmdValue( args[1], VMF(2) );
return 0;
case CG_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case CG_KEY_ISDOWN:
return Key_IsDown( args[1] );
case CG_KEY_GETCATCHER:
return Key_GetCatcher();
case CG_KEY_SETCATCHER:
// don't allow the cgame module to toggle the console
Key_SetCatcher( ( args[1] & ~KEYCATCH_CONSOLE ) | ( Key_GetCatcher() & KEYCATCH_CONSOLE ) );
return 0;
case CG_KEY_GETKEY:
return Key_GetKey( (const char*)VMA(1) );
case CG_GETDEMOSTATE:
return CL_DemoState( );
case CG_GETDEMOPOS:
return CL_DemoPos( );
case CG_GETDEMONAME:
CL_DemoName( (char*)VMA(1), args[2] );
return 0;
case CG_KEY_KEYNUMTOSTRINGBUF:
Key_KeynumToStringBuf( args[1], (char*)VMA(2), args[3] );
return 0;
case CG_KEY_GETBINDINGBUF:
Key_GetBindingBuf( args[1], (char*)VMA(2), args[3] );
return 0;
case CG_KEY_SETBINDING:
Key_SetBinding( args[1], (const char*)VMA(2) );
return 0;
case CG_PARSE_ADD_GLOBAL_DEFINE:
return Parse_AddGlobalDefine( (char*)VMA(1) );
case CG_PARSE_LOAD_SOURCE:
示例13: CL_UISystemCalls
//.........这里部分代码省略.........
case UI_LAN_GETSERVERADDRESSSTRING:
LAN_GetServerAddressString( args[1], args[2], VMA(3), args[4] );
return 0;
case UI_LAN_GETSERVERINFO:
LAN_GetServerInfo( args[1], args[2], VMA(3), args[4] );
return 0;
case UI_LAN_GETSERVERPING:
return LAN_GetServerPing( args[1], args[2] );
case UI_LAN_MARKSERVERVISIBLE:
LAN_MarkServerVisible( args[1], args[2], args[3] );
return 0;
case UI_LAN_SERVERISVISIBLE:
return LAN_ServerIsVisible( args[1], args[2] );
case UI_LAN_UPDATEVISIBLEPINGS:
return LAN_UpdateVisiblePings( args[1] );
case UI_LAN_RESETPINGS:
LAN_ResetPings( args[1] );
return 0;
case UI_LAN_SERVERSTATUS:
return LAN_GetServerStatus( VMA(1), VMA(2), args[3] );
case UI_LAN_COMPARESERVERS:
return LAN_CompareServers( args[1], args[2], args[3], args[4], args[5] );
case UI_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case UI_R_REGISTERFONT:
re.RegisterFont( VMA(1), args[2], VMA(3));
return 0;
case UI_MEMSET:
Com_Memset( VMA(1), args[2], args[3] );
return 0;
case UI_MEMCPY:
Com_Memcpy( VMA(1), VMA(2), args[3] );
return 0;
case UI_STRNCPY:
strncpy( VMA(1), VMA(2), args[3] );
return args[1];
case UI_SIN:
return FloatAsInt( sin( VMF(1) ) );
case UI_COS:
return FloatAsInt( cos( VMF(1) ) );
case UI_ATAN2:
return FloatAsInt( atan2( VMF(1), VMF(2) ) );
case UI_SQRT:
return FloatAsInt( sqrt( VMF(1) ) );
case UI_FLOOR:
return FloatAsInt( floor( VMF(1) ) );
示例14: CL_CgameSystemCalls
//.........这里部分代码省略.........
return 0;
case CG_R_GETFONT:
memcpy( VMA(3), re.GetFontFromFontSet( args[1], VMF(2) ), sizeof(fontInfo_t) );
return 0;
case CG_R_ROUNDRECT:
SCR_FillRect( VMF(1), VMF(2), VMF(3), VMF(4), VMA(5), args[6] );
return 0;
case CG_R_MODELBOUNDS:
re.ModelBounds( args[1], VMA(2), VMA(3) );
return 0;
case CG_R_LERPTAG:
return re.LerpTag( VMA(1), args[2], args[3], args[4], VMF(5), VMA(6) );
case CG_GETGLCONFIG:
CL_GetGlconfig( VMA(1) );
return 0;
case CG_GETGAMESTATE:
CL_GetGameState( VMA(1) );
return 0;
case CG_GETCURRENTSNAPSHOTNUMBER:
CL_GetCurrentSnapshotNumber( VMA(1), VMA(2) );
return 0;
case CG_GETSNAPSHOT:
return CL_GetSnapshot( args[1], VMA(2) );
case CG_GETSERVERCOMMAND:
return CL_GetServerCommand( args[1] );
case CG_GETCURRENTCMDNUMBER:
return CL_GetCurrentCmdNumber();
case CG_GETUSERCMD:
return CL_GetUserCmd( args[1], VMA(2) );
case CG_SETUSERCMDVALUE:
CL_SetUserCmdValue( args[1], VMF(2) );
return 0;
case CG_MEMORY_REMAINING:
return Hunk_MemoryRemaining();
case CG_KEY_ISDOWN:
return Key_IsDown( args[1] );
case CG_KEY_GETCATCHER:
return Key_GetCatcher();
case CG_KEY_SETCATCHER:
Key_SetCatcher( args[1] );
return 0;
case CG_KEY_GETKEY:
return Key_GetKey( VMA(1) );
case CG_MEMSET:
Com_Memset( VMA(1), args[2], args[3] );
return 0;
case CG_MEMCPY:
Com_Memcpy( VMA(1), VMA(2), args[3] );
return 0;
case CG_STRNCPY:
strncpy( VMA(1), VMA(2), args[3] );
return args[1];
case CG_SIN:
return FloatAsInt( sin( VMF(1) ) );
case CG_COS:
return FloatAsInt( cos( VMF(1) ) );
case CG_ATAN2:
return FloatAsInt( atan2( VMF(1), VMF(2) ) );
case CG_SQRT:
return FloatAsInt( sqrt( VMF(1) ) );
case CG_FLOOR:
return FloatAsInt( floor( VMF(1) ) );
case CG_CEIL:
示例15: int
vm_t *VM_Create( const char *module, int (*systemCalls)(int *),
vmInterpret_t interpret ) {
vm_t *vm;
vmHeader_t *header;
int length;
int dataLength;
int i, remaining;
char filename[MAX_QPATH];
if ( !module || !module[0] || !systemCalls ) {
Com_Error( ERR_FATAL, "VM_Create: bad parms" );
}
remaining = Hunk_MemoryRemaining();
// see if we already have the VM
for ( i = 0 ; i < MAX_VM ; i++ ) {
if (!Q_stricmp(vmTable[i].name, module)) {
vm = &vmTable[i];
return vm;
}
}
// find a free vm
for ( i = 0 ; i < MAX_VM ; i++ ) {
if ( !vmTable[i].name[0] ) {
break;
}
}
if ( i == MAX_VM ) {
Com_Error( ERR_FATAL, "VM_Create: no free vm_t" );
}
vm = &vmTable[i];
Q_strncpyz( vm->name, module, sizeof( vm->name ) );
vm->systemCall = systemCalls;
// never allow dll loading with a demo
if ( interpret == VMI_NATIVE ) {
if ( Cvar_VariableValue( "fs_restrict" ) ) {
interpret = VMI_COMPILED;
}
}
if ( interpret == VMI_NATIVE ) {
// try to load as a system dll
Com_Printf( "Loading dll file %s.\n", vm->name );
vm->dllHandle = Sys_LoadDll( module, vm->fqpath , &vm->entryPoint, VM_DllSyscall );
if ( vm->dllHandle ) {
return vm;
}
Com_Printf( "Failed to load dll, looking for qvm.\n" );
interpret = VMI_COMPILED;
}
// load the image
Com_sprintf( filename, sizeof(filename), "vm/%s.qvm", vm->name );
Com_Printf( "Loading vm file %s.\n", filename );
length = FS_ReadFile( filename, (void **)&header );
if ( !header ) {
Com_Printf( "Failed.\n" );
VM_Free( vm );
return NULL;
}
// byte swap the header
for ( i = 0 ; i < sizeof( *header ) / 4 ; i++ ) {
((int *)header)[i] = LittleLong( ((int *)header)[i] );
}
// validate
if ( header->vmMagic != VM_MAGIC
|| header->bssLength < 0
|| header->dataLength < 0
|| header->litLength < 0
|| header->codeLength <= 0 ) {
VM_Free( vm );
Com_Error( ERR_FATAL, "%s has bad header", filename );
}
// round up to next power of 2 so all data operations can
// be mask protected
dataLength = header->dataLength + header->litLength + header->bssLength;
for ( i = 0 ; dataLength > ( 1 << i ) ; i++ ) {
}
dataLength = 1 << i;
// allocate zero filled space for initialized and uninitialized data
vm->dataBase = Hunk_Alloc( dataLength, h_high );
vm->dataMask = dataLength - 1;
// copy the intialized data
Com_Memcpy( vm->dataBase, (byte *)header + header->dataOffset, header->dataLength + header->litLength );
// byte swap the longs
for ( i = 0 ; i < header->dataLength ; i += 4 ) {
*(int *)(vm->dataBase + i) = LittleLong( *(int *)(vm->dataBase + i ) );
//.........这里部分代码省略.........