mirror of
https://github.com/rehlds/reapi.git
synced 2024-12-29 08:05:36 +03:00
Update metamod sdk
This commit is contained in:
parent
b8f7c25fb5
commit
532f8291b8
@ -1,189 +1,17 @@
|
|||||||
// dllapi.h - prototypes and typedefs for Half-Life DLL API routines
|
#pragma once
|
||||||
|
|
||||||
/*
|
typedef void (*FN_GAMEINIT)();
|
||||||
* Copyright (c) 2001-2003 Will Day <willday@hpgx.net>
|
|
||||||
*
|
|
||||||
* This file is part of Metamod.
|
|
||||||
*
|
|
||||||
* Metamod is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Metamod is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Metamod; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* In addition, as a special exception, the author gives permission to
|
|
||||||
* link the code of this program with the Half-Life Game Engine ("HL
|
|
||||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
||||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
||||||
* respects for all of the code used other than the HL Engine and MODs
|
|
||||||
* from Valve. If you modify this file, you may extend this exception
|
|
||||||
* to your version of the file, but you are not obligated to do so. If
|
|
||||||
* you do not wish to do so, delete this exception statement from your
|
|
||||||
* version.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef DLLAPI_H
|
|
||||||
#define DLLAPI_H
|
|
||||||
|
|
||||||
#include "sdk_util.h" // BOOL
|
|
||||||
#include "osdep.h" // DLLEXPORT, etc
|
|
||||||
|
|
||||||
// Typedefs for these are provided in SDK engine/eiface.h, but I didn't
|
// Typedefs for these are provided in SDK engine/eiface.h, but I didn't
|
||||||
// like the names (APIFUNCTION, APIFUNCTION2, NEW_DLL_FUNCTIONS_FN).
|
// like the names (APIFUNCTION, APIFUNCTION2, NEW_DLL_FUNCTIONS_FN).
|
||||||
typedef int (*GETENTITYAPI_FN) (DLL_FUNCTIONS *pFunctionTable, int interfaceVersion);
|
typedef int (*GETENTITYAPI_FN)(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion);
|
||||||
typedef int (*GETENTITYAPI2_FN) (DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion);
|
typedef int (*GETENTITYAPI2_FN)(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion);
|
||||||
typedef int (*GETNEWDLLFUNCTIONS_FN) (NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion);
|
typedef int (*GETNEWDLLFUNCTIONS_FN)(NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion);
|
||||||
|
|
||||||
// From SDK dlls/cbase.h:
|
C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion);
|
||||||
C_DLLEXPORT int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
|
C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion);
|
||||||
C_DLLEXPORT int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
|
C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion);
|
||||||
|
|
||||||
// No example in SDK..
|
#ifdef METAMOD_CORE
|
||||||
// From Adminmod dll.cpp:
|
void compile_gamedll_callbacks();
|
||||||
C_DLLEXPORT int GetNewDLLFunctions( NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion );
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// From SDK dlls/game.h:
|
|
||||||
extern void mm_GameDLLInit( void );
|
|
||||||
|
|
||||||
// From SDK dlls/cbase.h:
|
|
||||||
extern int mm_DispatchSpawn( edict_t *pent );
|
|
||||||
extern void mm_DispatchThink( edict_t *pent );
|
|
||||||
extern void mm_DispatchUse( edict_t *pentUsed, edict_t *pentOther );
|
|
||||||
extern void mm_DispatchTouch( edict_t *pentTouched, edict_t *pentOther );
|
|
||||||
extern void mm_DispatchBlocked( edict_t *pentBlocked, edict_t *pentOther );
|
|
||||||
extern void mm_DispatchKeyValue( edict_t *pentKeyvalue, KeyValueData *pkvd );
|
|
||||||
extern void mm_DispatchSave( edict_t *pent, SAVERESTOREDATA *pSaveData );
|
|
||||||
extern int mm_DispatchRestore( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity );
|
|
||||||
extern void mm_DispatchObjectCollisionBox( edict_t *pent );
|
|
||||||
extern void mm_SaveWriteFields( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount );
|
|
||||||
extern void mm_SaveReadFields( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount );
|
|
||||||
extern void mm_SaveGlobalState( SAVERESTOREDATA *pSaveData );
|
|
||||||
extern void mm_RestoreGlobalState( SAVERESTOREDATA *pSaveData );
|
|
||||||
extern void mm_ResetGlobalState( void );
|
|
||||||
|
|
||||||
// From SDK dlls/client.h:
|
|
||||||
extern BOOL mm_ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] );
|
|
||||||
extern void mm_ClientDisconnect( edict_t *pEntity );
|
|
||||||
extern void mm_ClientKill( edict_t *pEntity );
|
|
||||||
extern void mm_ClientPutInServer( edict_t *pEntity );
|
|
||||||
extern void mm_ClientCommand( edict_t *pEntity );
|
|
||||||
extern void mm_ClientUserInfoChanged( edict_t *pEntity, char *infobuffer );
|
|
||||||
extern void mm_ServerActivate( edict_t *pEdictList, int edictCount, int clientMax );
|
|
||||||
extern void mm_ServerDeactivate( void );
|
|
||||||
extern void mm_PlayerPreThink( edict_t *pEntity );
|
|
||||||
extern void mm_PlayerPostThink( edict_t *pEntity );
|
|
||||||
extern void mm_StartFrame( void );
|
|
||||||
extern void mm_ParmsNewLevel( void );
|
|
||||||
extern void mm_ParmsChangeLevel( void );
|
|
||||||
extern const char *mm_GetGameDescription( void );
|
|
||||||
extern void mm_PlayerCustomization( edict_t *pEntity, customization_t *pCust );
|
|
||||||
extern void mm_SpectatorConnect ( edict_t *pEntity );
|
|
||||||
extern void mm_SpectatorDisconnect ( edict_t *pEntity );
|
|
||||||
extern void mm_SpectatorThink ( edict_t *pEntity );
|
|
||||||
extern void mm_Sys_Error( const char *error_string );
|
|
||||||
|
|
||||||
// From SDK pm_shared/pm_shared.h:
|
|
||||||
extern void mm_PM_Move ( struct playermove_s *ppmove, int server );
|
|
||||||
extern void mm_PM_Init ( struct playermove_s *ppmove );
|
|
||||||
extern char mm_PM_FindTextureType ( char *name );
|
|
||||||
|
|
||||||
// From SDK dlls/client.h:
|
|
||||||
extern void mm_SetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas );
|
|
||||||
extern void mm_UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd );
|
|
||||||
extern int mm_AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet );
|
|
||||||
extern void mm_CreateBaseline( int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs );
|
|
||||||
extern void mm_RegisterEncoders( void );
|
|
||||||
extern int mm_GetWeaponData( struct edict_s *player, struct weapon_data_s *info );
|
|
||||||
extern void mm_CmdStart( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed );
|
|
||||||
extern void mm_CmdEnd ( const edict_t *player );
|
|
||||||
extern int mm_ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );
|
|
||||||
extern int mm_GetHullBounds( int hullnumber, float *mins, float *maxs );
|
|
||||||
extern void mm_CreateInstancedBaselines ( void );
|
|
||||||
extern int mm_InconsistentFile( const edict_t *player, const char *filename, char *disconnect_message );
|
|
||||||
extern int mm_AllowLagCompensation( void );
|
|
||||||
|
|
||||||
// No example from SDK...
|
|
||||||
extern void mm_OnFreeEntPrivateData(edict_t pEnt);
|
|
||||||
extern void mm_GameShutdown(void);
|
|
||||||
extern int mm_ShouldCollide(edict_t *pentTouched, edict_t *pentOther);
|
|
||||||
//Added 2005-08-11 (no SDK update)
|
|
||||||
extern void mm_CvarValue(const edict_t *pEnt, const char *value); //! Obsolete! Use mm_CvarValue2 instead
|
|
||||||
//Added 2005-11-22 (no SDK update)
|
|
||||||
extern void mm_CvarValue2(const edict_t *pEnt, int requestID, const char *cvarName, const char *value);
|
|
||||||
|
|
||||||
|
|
||||||
// Typedefs for the above functions:
|
|
||||||
|
|
||||||
typedef void (*FN_GAMEINIT) ( void );
|
|
||||||
typedef int (*FN_DISPATCHSPAWN) ( edict_t *pent );
|
|
||||||
typedef void (*FN_DISPATCHTHINK) ( edict_t *pent );
|
|
||||||
typedef void (*FN_DISPATCHUSE) ( edict_t *pentUsed, edict_t *pentOther );
|
|
||||||
typedef void (*FN_DISPATCHTOUCH) ( edict_t *pentTouched, edict_t *pentOther );
|
|
||||||
typedef void (*FN_DISPATCHBLOCKED) ( edict_t *pentBlocked, edict_t *pentOther );
|
|
||||||
typedef void (*FN_DISPATCHKEYVALUE) ( edict_t *pentKeyvalue, KeyValueData *pkvd );
|
|
||||||
typedef void (*FN_DISPATCHSAVE) ( edict_t *pent, SAVERESTOREDATA *pSaveData );
|
|
||||||
typedef int (*FN_DISPATCHRESTORE) ( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity );
|
|
||||||
typedef void (*FN_DISPATCHOBJECTCOLLISIONBOX) ( edict_t *pent );
|
|
||||||
typedef void (*FN_SAVEWRITEFIELDS) ( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount );
|
|
||||||
typedef void (*FN_SAVEREADFIELDS) ( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount );
|
|
||||||
typedef void (*FN_SAVEGLOBALSTATE) ( SAVERESTOREDATA *pSaveData );
|
|
||||||
typedef void (*FN_RESTOREGLOBALSTATE) ( SAVERESTOREDATA *pSaveData );
|
|
||||||
typedef void (*FN_RESETGLOBALSTATE) ( void );
|
|
||||||
|
|
||||||
typedef BOOL (*FN_CLIENTCONNECT) ( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] );
|
|
||||||
typedef void (*FN_CLIENTDISCONNECT) ( edict_t *pEntity );
|
|
||||||
typedef void (*FN_CLIENTKILL) ( edict_t *pEntity );
|
|
||||||
typedef void (*FN_CLIENTPUTINSERVER) ( edict_t *pEntity );
|
|
||||||
typedef void (*FN_CLIENTCOMMAND) ( edict_t *pEntity );
|
|
||||||
typedef void (*FN_CLIENTUSERINFOCHANGED) ( edict_t *pEntity, char *infobuffer );
|
|
||||||
typedef void (*FN_SERVERACTIVATE) ( edict_t *pEdictList, int edictCount, int clientMax );
|
|
||||||
typedef void (*FN_SERVERDEACTIVATE) ( void );
|
|
||||||
typedef void (*FN_PLAYERPRETHINK) ( edict_t *pEntity );
|
|
||||||
typedef void (*FN_PLAYERPOSTTHINK) ( edict_t *pEntity );
|
|
||||||
typedef void (*FN_STARTFRAME) ( void );
|
|
||||||
typedef void (*FN_PARMSNEWLEVEL) ( void );
|
|
||||||
typedef void (*FN_PARMSCHANGELEVEL) ( void );
|
|
||||||
typedef const char *(*FN_GETGAMEDESCRIPTION) ( void );
|
|
||||||
typedef void (*FN_PLAYERCUSTOMIZATION) ( edict_t *pEntity, customization_t *pCust );
|
|
||||||
typedef void (*FN_SPECTATORCONNECT) ( edict_t *pEntity );
|
|
||||||
typedef void (*FN_SPECTATORDISCONNECT) ( edict_t *pEntity );
|
|
||||||
typedef void (*FN_SPECTATORTHINK) ( edict_t *pEntity );
|
|
||||||
typedef void (*FN_SYS_ERROR) ( const char *error_string );
|
|
||||||
|
|
||||||
typedef void (*FN_PM_MOVE) ( struct playermove_s *ppmove, int server );
|
|
||||||
typedef void (*FN_PM_INIT) ( struct playermove_s *ppmove );
|
|
||||||
typedef char (*FN_PM_FINDTEXTURETYPE) ( char *name );
|
|
||||||
|
|
||||||
typedef void (*FN_SETUPVISIBILITY) ( edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas );
|
|
||||||
typedef void (*FN_UPDATECLIENTDATA) ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd );
|
|
||||||
typedef int (*FN_ADDTOFULLPACK) ( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet );
|
|
||||||
typedef void (*FN_CREATEBASELINE) ( int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs );
|
|
||||||
typedef void (*FN_REGISTERENCODERS) ( void );
|
|
||||||
typedef int (*FN_GETWEAPONDATA) ( struct edict_s *player, struct weapon_data_s *info );
|
|
||||||
typedef void (*FN_CMDSTART) ( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed );
|
|
||||||
typedef void (*FN_CMDEND) ( const edict_t *player );
|
|
||||||
typedef int (*FN_CONNECTIONLESSPACKET) ( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );
|
|
||||||
typedef int (*FN_GETHULLBOUNDS) ( int hullnumber, float *mins, float *maxs );
|
|
||||||
typedef void (*FN_CREATEINSTANCEDBASELINES) ( void );
|
|
||||||
typedef int (*FN_INCONSISTENTFILE) ( const edict_t *player, const char *filename, char *disconnect_message );
|
|
||||||
typedef int (*FN_ALLOWLAGCOMPENSATION) ( void );
|
|
||||||
|
|
||||||
typedef void (*FN_ONFREEENTPRIVATEDATA) (edict_t *pEnt);
|
|
||||||
typedef void (*FN_GAMESHUTDOWN) (void);
|
|
||||||
typedef int (*FN_SHOULDCOLLIDE) (edict_t *pentTouched, edict_t *pentOther);
|
|
||||||
//Added 2005-08-11 (no SDK update)
|
|
||||||
typedef void (*FN_CVARVALUE)(const edict_t *pEnt, const char *value); //! Obsolete! Use FN_CVARVALUE2 instead
|
|
||||||
//Added 2005-11-22 (no SDK update)
|
|
||||||
typedef void (*FN_CVARVALUE2)(const edict_t *pEnt, int requestID, const char *cvarName, const char *value);
|
|
||||||
|
|
||||||
#endif /* DLLAPI_H */
|
|
||||||
|
@ -1,461 +1,21 @@
|
|||||||
// engine_api.h - prototypes and typedefs for Half-Life engine functions
|
#pragma once
|
||||||
|
|
||||||
/*
|
struct enginefuncs_s;
|
||||||
* Copyright (c) 2001-2003 Will Day <willday@hpgx.net>
|
|
||||||
*
|
|
||||||
* This file is part of Metamod.
|
|
||||||
*
|
|
||||||
* Metamod is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Metamod is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Metamod; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* In addition, as a special exception, the author gives permission to
|
|
||||||
* link the code of this program with the Half-Life Game Engine ("HL
|
|
||||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
||||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
||||||
* respects for all of the code used other than the HL Engine and MODs
|
|
||||||
* from Valve. If you modify this file, you may extend this exception
|
|
||||||
* to your version of the file, but you are not obligated to do so. If
|
|
||||||
* you do not wish to do so, delete this exception statement from your
|
|
||||||
* version.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ENGINE_API_H
|
|
||||||
#define ENGINE_API_H
|
|
||||||
|
|
||||||
#include <archtypes.h>
|
|
||||||
|
|
||||||
// Plugin's GetEngineFunctions, called by metamod.
|
// Plugin's GetEngineFunctions, called by metamod.
|
||||||
typedef int (*GET_ENGINE_FUNCTIONS_FN) (enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion);
|
typedef int (*GET_ENGINE_FUNCTIONS_FN)(enginefuncs_s *pengfuncsFromEngine, int *interfaceVersion);
|
||||||
|
|
||||||
// According to SDK engine/eiface.h:
|
// According to SDK engine/eiface.h:
|
||||||
//! enginefuncs_t
|
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138
|
||||||
//! ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138
|
|
||||||
#define ENGINE_INTERFACE_VERSION 138
|
#define ENGINE_INTERFACE_VERSION 138
|
||||||
|
|
||||||
// Protect against other projects which use this include file but use the
|
// Protect against other projects which use this include file but use the
|
||||||
// normal enginefuncs_t type for their meta_engfuncs.
|
// normal enginefuncs_t type for their meta_engfuncs.
|
||||||
#ifdef METAMOD_CORE
|
#ifdef METAMOD_CORE
|
||||||
# include "meta_eiface.h" // meta_enginefuncs_t
|
#include "meta_eiface.h" // meta_enginefuncs_t
|
||||||
extern meta_enginefuncs_t meta_engfuncs;
|
extern meta_enginefuncs_t g_meta_engfuncs;
|
||||||
|
|
||||||
|
void compile_engine_callbacks();
|
||||||
#else
|
#else
|
||||||
extern enginefuncs_t meta_engfuncs;
|
extern enginefuncs_t meta_engfuncs;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// From SDK engine/eiface.h:
|
|
||||||
extern int mm_PrecacheModel(char *s);
|
|
||||||
extern int mm_PrecacheSound(char *s);
|
|
||||||
extern void mm_SetModel(edict_t *e, const char *m);
|
|
||||||
extern int mm_ModelIndex(const char *m);
|
|
||||||
extern int mm_ModelFrames(int modelIndex);
|
|
||||||
|
|
||||||
extern void mm_SetSize(edict_t *e, const float *rgflMin, const float *rgflMax);
|
|
||||||
extern void mm_ChangeLevel(char *s1, char *s2);
|
|
||||||
extern void mm_GetSpawnParms(edict_t *ent);
|
|
||||||
extern void mm_SaveSpawnParms(edict_t *ent);
|
|
||||||
|
|
||||||
extern float mm_VecToYaw(const float *rgflVector);
|
|
||||||
extern void mm_VecToAngles(const float *rgflVectorIn, float *rgflVectorOut);
|
|
||||||
extern void mm_MoveToOrigin(edict_t *ent, const float *pflGoal, float dist, int iMoveType);
|
|
||||||
extern void mm_ChangeYaw(edict_t *ent);
|
|
||||||
extern void mm_ChangePitch(edict_t *ent);
|
|
||||||
|
|
||||||
extern edict_t *mm_FindEntityByString(edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue);
|
|
||||||
extern int mm_GetEntityIllum(edict_t *pEnt);
|
|
||||||
extern edict_t *mm_FindEntityInSphere(edict_t *pEdictStartSearchAfter, const float *org, float rad);
|
|
||||||
extern edict_t *mm_FindClientInPVS(edict_t *pEdict);
|
|
||||||
extern edict_t *mm_EntitiesInPVS(edict_t *pplayer);
|
|
||||||
|
|
||||||
extern void mm_MakeVectors(const float *rgflVector);
|
|
||||||
extern void mm_AngleVectors(const float *rgflVector, float *forward, float *right, float *up);
|
|
||||||
|
|
||||||
extern edict_t *mm_CreateEntity(void);
|
|
||||||
extern void mm_RemoveEntity(edict_t *e);
|
|
||||||
extern edict_t *mm_CreateNamedEntity(int className);
|
|
||||||
|
|
||||||
extern void mm_MakeStatic(edict_t *ent);
|
|
||||||
extern int mm_EntIsOnFloor(edict_t *e);
|
|
||||||
extern int mm_DropToFloor(edict_t *e);
|
|
||||||
|
|
||||||
extern int mm_WalkMove(edict_t *ent, float yaw, float dist, int iMode);
|
|
||||||
extern void mm_SetOrigin(edict_t *e, const float *rgflOrigin);
|
|
||||||
|
|
||||||
extern void mm_EmitSound(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch);
|
|
||||||
extern void mm_EmitAmbientSound(edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch);
|
|
||||||
|
|
||||||
extern void mm_TraceLine(const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
|
|
||||||
extern void mm_TraceToss(edict_t *pent, edict_t *pentToIgnore, TraceResult *ptr);
|
|
||||||
extern int mm_TraceMonsterHull(edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
|
|
||||||
extern void mm_TraceHull(const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);
|
|
||||||
extern void mm_TraceModel(const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr);
|
|
||||||
extern const char *mm_TraceTexture(edict_t *pTextureEntity, const float *v1, const float *v2 );
|
|
||||||
extern void mm_TraceSphere(const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);
|
|
||||||
extern void mm_GetAimVector(edict_t *ent, float speed, float *rgflReturn);
|
|
||||||
|
|
||||||
extern void mm_ServerCommand(char *str);
|
|
||||||
extern void mm_ServerExecute(void);
|
|
||||||
extern void ClientCommand(edict_t *pEdict, char *szFmt, ...);
|
|
||||||
|
|
||||||
extern void mm_ParticleEffect(const float *org, const float *dir, float color, float count);
|
|
||||||
extern void mm_LightStyle(int style, char *val);
|
|
||||||
extern int mm_DecalIndex(const char *name);
|
|
||||||
extern int mm_PointContents(const float *rgflVector);
|
|
||||||
|
|
||||||
extern void mm_MessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
|
|
||||||
extern void mm_MessageEnd(void);
|
|
||||||
|
|
||||||
extern void mm_WriteByte(int iValue);
|
|
||||||
extern void mm_WriteChar(int iValue);
|
|
||||||
extern void mm_WriteShort(int iValue);
|
|
||||||
extern void mm_WriteLong(int iValue);
|
|
||||||
extern void mm_WriteAngle(float flValue);
|
|
||||||
extern void mm_WriteCoord(float flValue);
|
|
||||||
extern void mm_WriteString(const char *sz);
|
|
||||||
extern void mm_WriteEntity(int iValue);
|
|
||||||
|
|
||||||
extern void mm_CVarRegister(cvar_t *pCvar);
|
|
||||||
extern float mm_CVarGetFloat(const char *szVarName);
|
|
||||||
extern const char* mm_CVarGetString(const char *szVarName);
|
|
||||||
extern void mm_CVarSetFloat(const char *szVarName, float flValue);
|
|
||||||
extern void mm_CVarSetString(const char *szVarName, const char *szValue);
|
|
||||||
|
|
||||||
extern void mm_AlertMessage(ALERT_TYPE atype, char *szFmt, ...);
|
|
||||||
#ifdef HLSDK_3_2_OLD_EIFACE
|
|
||||||
extern void mm_EngineFprintf(FILE *pfile, char *szFmt, ...);
|
|
||||||
#else
|
|
||||||
extern void mm_EngineFprintf(void *pfile, char *szFmt, ...);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HLSDK_3_2_OLD_EIFACE
|
|
||||||
extern void *mm_PvAllocEntPrivateData(edict_t *pEdict, long cb);
|
|
||||||
#else
|
|
||||||
extern void *mm_PvAllocEntPrivateData(edict_t *pEdict, int32 cb);
|
|
||||||
#endif
|
|
||||||
extern void *mm_PvEntPrivateData(edict_t *pEdict);
|
|
||||||
extern void mm_FreeEntPrivateData(edict_t *pEdict);
|
|
||||||
|
|
||||||
extern const char *mm_SzFromIndex(int iString);
|
|
||||||
extern int mm_AllocString(const char *szValue);
|
|
||||||
|
|
||||||
extern struct entvars_s *mm_GetVarsOfEnt(edict_t *pEdict);
|
|
||||||
extern edict_t *mm_PEntityOfEntOffset(int iEntOffset);
|
|
||||||
extern int mm_EntOffsetOfPEntity(const edict_t *pEdict);
|
|
||||||
extern int mm_IndexOfEdict(const edict_t *pEdict);
|
|
||||||
extern edict_t *mm_PEntityOfEntIndex(int iEntIndex);
|
|
||||||
extern edict_t *mm_FindEntityByVars(struct entvars_s *pvars);
|
|
||||||
extern void *mm_GetModelPtr(edict_t *pEdict);
|
|
||||||
|
|
||||||
extern int mm_RegUserMsg(const char *pszName, int iSize);
|
|
||||||
|
|
||||||
extern void mm_AnimationAutomove(const edict_t *pEdict, float flTime);
|
|
||||||
extern void mm_GetBonePosition(const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles );
|
|
||||||
|
|
||||||
#ifdef HLSDK_3_2_OLD_EIFACE
|
|
||||||
extern unsigned long mm_FunctionFromName( const char *pName );
|
|
||||||
extern const char *mm_NameForFunction( unsigned long function );
|
|
||||||
#else
|
|
||||||
extern uint32 mm_FunctionFromName( const char *pName );
|
|
||||||
extern const char *mm_NameForFunction( uint32 function );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void mm_ClientPrintf( edict_t *pEdict, PRINT_TYPE ptype, const char *szMsg ); //! JOHN: engine callbacks so game DLL can print messages to individual clients
|
|
||||||
extern void mm_ServerPrint( const char *szMsg );
|
|
||||||
|
|
||||||
extern const char *mm_Cmd_Args( void ); //! these 3 added
|
|
||||||
extern const char *mm_Cmd_Argv( int argc ); //! so game DLL can easily
|
|
||||||
extern int mm_Cmd_Argc( void ); //! access client 'cmd' strings
|
|
||||||
|
|
||||||
extern void mm_GetAttachment(const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );
|
|
||||||
|
|
||||||
extern void mm_CRC32_Init(CRC32_t *pulCRC);
|
|
||||||
extern void mm_CRC32_ProcessBuffer(CRC32_t *pulCRC, void *p, int len);
|
|
||||||
extern void mm_CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch);
|
|
||||||
extern CRC32_t mm_CRC32_Final(CRC32_t pulCRC);
|
|
||||||
|
|
||||||
#ifdef HLSDK_3_2_OLD_EIFACE
|
|
||||||
extern long mm_RandomLong(long lLow, long lHigh);
|
|
||||||
#else
|
|
||||||
extern int32 mm_RandomLong(int32 lLow, int32 lHigh);
|
|
||||||
#endif
|
|
||||||
extern float mm_RandomFloat(float flLow, float flHigh);
|
|
||||||
|
|
||||||
extern void mm_SetView(const edict_t *pClient, const edict_t *pViewent );
|
|
||||||
extern float mm_Time( void );
|
|
||||||
extern void mm_CrosshairAngle(const edict_t *pClient, float pitch, float yaw);
|
|
||||||
|
|
||||||
extern byte * mm_LoadFileForMe(char *filename, int *pLength);
|
|
||||||
extern void mm_FreeFile(void *buffer);
|
|
||||||
|
|
||||||
extern void mm_EndSection(const char *pszSectionName); //! trigger_endsection
|
|
||||||
extern int mm_CompareFileTime(char *filename1, char *filename2, int *iCompare);
|
|
||||||
extern void mm_GetGameDir(char *szGetGameDir);
|
|
||||||
extern void mm_Cvar_RegisterVariable(cvar_t *variable);
|
|
||||||
extern void mm_FadeClientVolume(const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
|
|
||||||
extern void mm_SetClientMaxspeed(const edict_t *pEdict, float fNewMaxspeed);
|
|
||||||
extern edict_t * mm_CreateFakeClient(const char *netname); //! returns NULL if fake client can't be created
|
|
||||||
extern void mm_RunPlayerMove(edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec );
|
|
||||||
extern int mm_NumberOfEntities(void);
|
|
||||||
|
|
||||||
extern char *mm_GetInfoKeyBuffer(edict_t *e); //! passing in NULL gets the serverinfo
|
|
||||||
extern char *mm_InfoKeyValue(char *infobuffer, char *key);
|
|
||||||
extern void mm_SetKeyValue(char *infobuffer, char *key, char *value);
|
|
||||||
extern void mm_SetClientKeyValue(int clientIndex, char *infobuffer, char *key, char *value);
|
|
||||||
|
|
||||||
extern int mm_IsMapValid(char *filename);
|
|
||||||
extern void mm_StaticDecal( const float *origin, int decalIndex, int entityIndex, int modelIndex );
|
|
||||||
extern int mm_PrecacheGeneric(char *s);
|
|
||||||
extern int mm_GetPlayerUserId(edict_t *e ); //! returns the server assigned userid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients
|
|
||||||
extern void mm_BuildSoundMsg(edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
|
|
||||||
extern int mm_IsDedicatedServer(void);//! is this a dedicated server?
|
|
||||||
extern cvar_t *mm_CVarGetPointer(const char *szVarName);
|
|
||||||
extern unsigned int mm_GetPlayerWONId(edict_t *e); //! returns the server assigned WONid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients
|
|
||||||
|
|
||||||
//! YWB 8/1/99 TFF Physics additions
|
|
||||||
extern void mm_Info_RemoveKey( char *s, const char *key );
|
|
||||||
extern const char *mm_GetPhysicsKeyValue( const edict_t *pClient, const char *key );
|
|
||||||
extern void mm_SetPhysicsKeyValue( const edict_t *pClient, const char *key, const char *value );
|
|
||||||
extern const char *mm_GetPhysicsInfoString( const edict_t *pClient );
|
|
||||||
extern unsigned short mm_PrecacheEvent( int type, const char *psz );
|
|
||||||
extern void mm_PlaybackEvent( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
|
||||||
|
|
||||||
extern unsigned char *mm_SetFatPVS( float *org );
|
|
||||||
extern unsigned char *mm_SetFatPAS( float *org );
|
|
||||||
|
|
||||||
extern int mm_CheckVisibility( const edict_t *entity, unsigned char *pset );
|
|
||||||
|
|
||||||
extern void mm_DeltaSetField( struct delta_s *pFields, const char *fieldname );
|
|
||||||
extern void mm_DeltaUnsetField( struct delta_s *pFields, const char *fieldname );
|
|
||||||
extern void mm_DeltaAddEncoder( char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) );
|
|
||||||
extern int mm_GetCurrentPlayer( void );
|
|
||||||
extern int mm_CanSkipPlayer( const edict_t *player );
|
|
||||||
extern int mm_DeltaFindField( struct delta_s *pFields, const char *fieldname );
|
|
||||||
extern void mm_DeltaSetFieldByIndex( struct delta_s *pFields, int fieldNumber );
|
|
||||||
extern void mm_DeltaUnsetFieldByIndex( struct delta_s *pFields, int fieldNumber );
|
|
||||||
|
|
||||||
extern void mm_SetGroupMask( int mask, int op );
|
|
||||||
|
|
||||||
extern int CreateInstancedBaseline( int classname, struct entity_state_s *baseline );
|
|
||||||
extern void mm_Cvar_DirectSet( struct cvar_s *var, char *value );
|
|
||||||
|
|
||||||
//! Forces the client and server to be running with the same version of the specified file
|
|
||||||
//!( e.g., a player model ).
|
|
||||||
//! Calling this has no effect in single player
|
|
||||||
extern void mm_ForceUnmodified( FORCE_TYPE type, float *mins, float *maxs, const char *filename );
|
|
||||||
|
|
||||||
extern void mm_GetPlayerStats( const edict_t *pClient, int *ping, int *packet_loss );
|
|
||||||
|
|
||||||
extern void mm_AddServerCommand( char *cmd_name, void (*function) (void) );
|
|
||||||
// Added in SDK 2.2:
|
|
||||||
extern qboolean mm_Voice_GetClientListening(int iReceiver, int iSender);
|
|
||||||
extern qboolean mm_Voice_SetClientListening(int iReceiver, int iSender, qboolean bListen);
|
|
||||||
// Added for HL 1109 (no SDK update):
|
|
||||||
extern const char *mm_pfnGetPlayerAuthId(edict_t *e);
|
|
||||||
// Added 2003-11-10 (no SDK update):
|
|
||||||
extern sequenceEntry_s * mm_SequenceGet(const char* fileName, const char* entryName);
|
|
||||||
extern sentenceEntry_s * mm_SequencePickSentence(const char* groupName, int pickMethod, int *picked);
|
|
||||||
extern int mm_GetFileSize(char *filename);
|
|
||||||
extern unsigned int mm_GetApproxWavePlayLen(const char *filepath);
|
|
||||||
extern int mm_IsCareerMatch(void);
|
|
||||||
extern int mm_GetLocalizedStringLength(const char *label);
|
|
||||||
extern void mm_RegisterTutorMessageShown(int mid);
|
|
||||||
extern int mm_GetTimesTutorMessageShown(int mid);
|
|
||||||
extern void mm_ProcessTutorMessageDecayBuffer(int *buffer, int bufferLength);
|
|
||||||
extern void mm_ConstructTutorMessageDecayBuffer(int *buffer, int bufferLength);
|
|
||||||
extern void mm_ResetTutorMessageDecayData(void);
|
|
||||||
//Added 2005-08-11 (no SDK update)
|
|
||||||
extern void mm_QueryClientCvarValue(const edict_t *pEdict, const char *cvarName); //! Obsolete! Use mm_QueryClientCvarValue2 instead
|
|
||||||
//Added 2005-11-22 (no SDK update)
|
|
||||||
extern void mm_QueryClientCvarValue2(const edict_t *pEdict, const char *cvarName, int requestID);
|
|
||||||
|
|
||||||
|
|
||||||
// Typedefs for the above functions:
|
|
||||||
|
|
||||||
typedef int (*FN_PRECACHEMODEL) (char* s);
|
|
||||||
typedef int (*FN_PRECACHESOUND) (char* s);
|
|
||||||
typedef void (*FN_SETMODEL) (edict_t *e, const char *m);
|
|
||||||
typedef int (*FN_MODELINDEX) (const char *m);
|
|
||||||
typedef int (*FN_MODELFRAMES) (int modelIndex);
|
|
||||||
typedef void (*FN_SETSIZE) (edict_t *e, const float *rgflMin, const float *rgflMax);
|
|
||||||
typedef void (*FN_CHANGELEVEL) (char *s1, char *s2);
|
|
||||||
typedef void (*FN_GETSPAWNPARMS) (edict_t *ent);
|
|
||||||
typedef void (*FN_SAVESPAWNPARMS) (edict_t *ent);
|
|
||||||
typedef float (*FN_VECTOYAW) (const float *rgflVector);
|
|
||||||
typedef void (*FN_VECTOANGLES) (const float *rgflVectorIn, float *rgflVectorOut);
|
|
||||||
typedef void (*FN_MOVETOORIGIN) (edict_t *ent, const float *pflGoal, float dist, int iMoveType);
|
|
||||||
typedef void (*FN_CHANGEYAW) (edict_t *ent);
|
|
||||||
typedef void (*FN_CHANGEPITCH) (edict_t *ent);
|
|
||||||
typedef edict_t * (*FN_FINDENTITYBYSTRING) (edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue);
|
|
||||||
typedef int (*FN_GETENTITYILLUM) (edict_t *pEnt);
|
|
||||||
typedef edict_t * (*FN_FINDENTITYINSPHERE) (edict_t *pEdictStartSearchAfter, const float *org, float rad);
|
|
||||||
typedef edict_t * (*FN_FINDCLIENTINPVS) (edict_t *pEdict);
|
|
||||||
typedef edict_t * (*FN_ENTITIESINPVS) (edict_t *pplayer);
|
|
||||||
typedef void (*FN_MAKEVECTORS) (const float *rgflVector);
|
|
||||||
typedef void (*FN_ANGLEVECTORS) (const float *rgflVector, float *forward, float *right, float *up);
|
|
||||||
typedef edict_t * (*FN_CREATEENTITY) (void);
|
|
||||||
typedef void (*FN_REMOVEENTITY) (edict_t *e);
|
|
||||||
typedef edict_t * (*FN_CREATENAMEDENTITY) (int className);
|
|
||||||
typedef void (*FN_MAKESTATIC) (edict_t *ent);
|
|
||||||
typedef int (*FN_ENTISONFLOOR) (edict_t *e);
|
|
||||||
typedef int (*FN_DROPTOFLOOR) (edict_t *e);
|
|
||||||
typedef int (*FN_WALKMOVE) (edict_t *ent, float yaw, float dist, int iMode);
|
|
||||||
typedef void (*FN_SETORIGIN) (edict_t *e, const float *rgflOrigin);
|
|
||||||
typedef void (*FN_EMITSOUND) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch);
|
|
||||||
typedef void (*FN_EMITAMBIENTSOUND) (edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch);
|
|
||||||
typedef void (*FN_TRACELINE) (const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
|
|
||||||
typedef void (*FN_TRACETOSS) (edict_t *pent, edict_t *pentToIgnore, TraceResult *ptr);
|
|
||||||
typedef int (*FN_TRACEMONSTERHULL) (edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr);
|
|
||||||
typedef void (*FN_TRACEHULL) (const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr);
|
|
||||||
typedef void (*FN_TRACEMODEL) (const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr);
|
|
||||||
typedef const char * (*FN_TRACETEXTURE) (edict_t *pTextureEntity, const float *v1, const float *v2 );
|
|
||||||
typedef void (*FN_TRACESPHERE) (const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr);
|
|
||||||
typedef void (*FN_GETAIMVECTOR) (edict_t *ent, float speed, float *rgflReturn);
|
|
||||||
typedef void (*FN_SERVERCOMMAND) (char *str);
|
|
||||||
typedef void (*FN_SERVEREXECUTE) (void);
|
|
||||||
typedef void (*FN_CLIENTCOMMAND_ENG) (edict_t *pEdict, char *szFmt, ...);
|
|
||||||
typedef void (*FN_PARTICLEEFFECT) (const float *org, const float *dir, float color, float count);
|
|
||||||
typedef void (*FN_LIGHTSTYLE) (int style, char *val);
|
|
||||||
typedef int (*FN_DECALINDEX) (const char *name);
|
|
||||||
typedef int (*FN_POINTCONTENTS) (const float *rgflVector);
|
|
||||||
typedef void (*FN_MESSAGEBEGIN) (int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
|
|
||||||
typedef void (*FN_MESSAGEEND) (void);
|
|
||||||
typedef void (*FN_WRITEBYTE) (int iValue);
|
|
||||||
typedef void (*FN_WRITECHAR) (int iValue);
|
|
||||||
typedef void (*FN_WRITESHORT) (int iValue);
|
|
||||||
typedef void (*FN_WRITELONG) (int iValue);
|
|
||||||
typedef void (*FN_WRITEANGLE) (float flValue);
|
|
||||||
typedef void (*FN_WRITECOORD) (float flValue);
|
|
||||||
typedef void (*FN_WRITESTRING) (const char *sz);
|
|
||||||
typedef void (*FN_WRITEENTITY) (int iValue);
|
|
||||||
typedef void (*FN_CVARREGISTER) (cvar_t *pCvar);
|
|
||||||
typedef float (*FN_CVARGETFLOAT) (const char *szVarName);
|
|
||||||
typedef const char * (*FN_CVARGETSTRING) (const char *szVarName);
|
|
||||||
typedef void (*FN_CVARSETFLOAT) (const char *szVarName, float flValue);
|
|
||||||
typedef void (*FN_CVARSETSTRING) (const char *szVarName, const char *szValue);
|
|
||||||
typedef void (*FN_ALERTMESSAGE) (ALERT_TYPE atype, char *szFmt, ...);
|
|
||||||
#ifdef HLSDK_3_2_OLD_EIFACE
|
|
||||||
typedef void (*FN_ENGINEFPRINTF) (FILE *pfile, char *szFmt, ...);
|
|
||||||
typedef void * (*FN_PVALLOCENTPRIVATEDATA) (edict_t *pEdict, long cb);
|
|
||||||
#else
|
|
||||||
typedef void (*FN_ENGINEFPRINTF) (void *pfile, char *szFmt, ...);
|
|
||||||
typedef void * (*FN_PVALLOCENTPRIVATEDATA) (edict_t *pEdict, int32 cb);
|
|
||||||
#endif
|
|
||||||
typedef void * (*FN_PVENTPRIVATEDATA) (edict_t *pEdict);
|
|
||||||
typedef void (*FN_FREEENTPRIVATEDATA) (edict_t *pEdict);
|
|
||||||
typedef const char * (*FN_SZFROMINDEX) (int iString);
|
|
||||||
typedef int (*FN_ALLOCSTRING) (const char *szValue);
|
|
||||||
typedef struct entvars_s * (*FN_GETVARSOFENT) (edict_t *pEdict);
|
|
||||||
typedef edict_t * (*FN_PENTITYOFENTOFFSET) (int iEntOffset);
|
|
||||||
typedef int (*FN_ENTOFFSETOFPENTITY) (const edict_t *pEdict);
|
|
||||||
typedef int (*FN_INDEXOFEDICT) (const edict_t *pEdict);
|
|
||||||
typedef edict_t * (*FN_PENTITYOFENTINDEX) (int iEntIndex);
|
|
||||||
typedef edict_t * (*FN_FINDENTITYBYVARS) (struct entvars_s *pvars);
|
|
||||||
typedef void * (*FN_GETMODELPTR) (edict_t *pEdict);
|
|
||||||
typedef int (*FN_REGUSERMSG) (const char *pszName, int iSize);
|
|
||||||
typedef void (*FN_ANIMATIONAUTOMOVE) (const edict_t *pEdict, float flTime);
|
|
||||||
typedef void (*FN_GETBONEPOSITION) (const edict_t *pEdict, int iBone, float *rgflOrigin, float *rgflAngles );
|
|
||||||
#ifdef HLSDK_3_2_OLD_EIFACE
|
|
||||||
typedef unsigned long (*FN_FUNCTIONFROMNAME) ( const char *pName );
|
|
||||||
typedef const char * (*FN_NAMEFORFUNCTION) ( unsigned long function );
|
|
||||||
#else
|
|
||||||
typedef uint32 (*FN_FUNCTIONFROMNAME) ( const char *pName );
|
|
||||||
typedef const char * (*FN_NAMEFORFUNCTION) ( uint32 function );
|
|
||||||
#endif
|
|
||||||
typedef void (*FN_CLIENTPRINTF) ( edict_t *pEdict, PRINT_TYPE ptype, const char *szMsg );
|
|
||||||
typedef void (*FN_SERVERPRINT) ( const char *szMsg );
|
|
||||||
typedef const char * (*FN_CMD_ARGS) ( void );
|
|
||||||
typedef const char * (*FN_CMD_ARGV) ( int argc );
|
|
||||||
typedef int (*FN_CMD_ARGC) ( void );
|
|
||||||
typedef void (*FN_GETATTACHMENT) (const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );
|
|
||||||
typedef void (*FN_CRC32_INIT) (CRC32_t *pulCRC);
|
|
||||||
typedef void (*FN_CRC32_PROCESSBUFFER) (CRC32_t *pulCRC, void *p, int len);
|
|
||||||
typedef void (*FN_CRC32_PROCESSBYTE) (CRC32_t *pulCRC, unsigned char ch);
|
|
||||||
typedef CRC32_t (*FN_CRC32_FINAL) (CRC32_t pulCRC);
|
|
||||||
#ifdef HLSDK_3_2_OLD_EIFACE
|
|
||||||
typedef long (*FN_RANDOMLONG) (long lLow, long lHigh);
|
|
||||||
#else
|
|
||||||
typedef int32 (*FN_RANDOMLONG) (int32 lLow, int32 lHigh);
|
|
||||||
#endif
|
|
||||||
typedef float (*FN_RANDOMFLOAT) (float flLow, float flHigh);
|
|
||||||
typedef void (*FN_SETVIEW) (const edict_t *pClient, const edict_t *pViewent );
|
|
||||||
typedef float (*FN_TIME) ( void );
|
|
||||||
typedef void (*FN_CROSSHAIRANGLE) (const edict_t *pClient, float pitch, float yaw);
|
|
||||||
typedef byte * (*FN_LOADFILEFORME) (char *filename, int *pLength);
|
|
||||||
typedef void (*FN_FREEFILE) (void *buffer);
|
|
||||||
typedef void (*FN_ENDSECTION) (const char *pszSectionName);
|
|
||||||
typedef int (*FN_COMPAREFILETIME) (char *filename1, char *filename2, int *iCompare);
|
|
||||||
typedef void (*FN_GETGAMEDIR) (char *szGetGameDir);
|
|
||||||
typedef void (*FN_CVAR_REGISTERVARIABLE) (cvar_t *variable);
|
|
||||||
typedef void (*FN_FADECLIENTVOLUME) (const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
|
|
||||||
typedef void (*FN_SETCLIENTMAXSPEED) (const edict_t *pEdict, float fNewMaxspeed);
|
|
||||||
typedef edict_t * (*FN_CREATEFAKECLIENT) (const char *netname);
|
|
||||||
typedef void (*FN_RUNPLAYERMOVE) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec );
|
|
||||||
typedef int (*FN_NUMBEROFENTITIES) (void);
|
|
||||||
typedef char * (*FN_GETINFOKEYBUFFER) (edict_t *e);
|
|
||||||
typedef char * (*FN_INFOKEYVALUE) (char *infobuffer, char *key);
|
|
||||||
typedef void (*FN_SETKEYVALUE) (char *infobuffer, char *key, char *value);
|
|
||||||
typedef void (*FN_SETCLIENTKEYVALUE) (int clientIndex, char *infobuffer, char *key, char *value);
|
|
||||||
typedef int (*FN_ISMAPVALID) (char *filename);
|
|
||||||
typedef void (*FN_STATICDECAL) ( const float *origin, int decalIndex, int entityIndex, int modelIndex );
|
|
||||||
typedef int (*FN_PRECACHEGENERIC) (char *s);
|
|
||||||
typedef int (*FN_GETPLAYERUSERID) (edict_t *e );
|
|
||||||
typedef void (*FN_BUILDSOUNDMSG) (edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed);
|
|
||||||
typedef int (*FN_ISDEDICATEDSERVER) (void);
|
|
||||||
typedef cvar_t * (*FN_CVARGETPOINTER) (const char *szVarName);
|
|
||||||
typedef unsigned int (*FN_GETPLAYERWONID) (edict_t *e);
|
|
||||||
typedef void (*FN_INFO_REMOVEKEY) ( char *s, const char *key );
|
|
||||||
typedef const char * (*FN_GETPHYSICSKEYVALUE) ( const edict_t *pClient, const char *key );
|
|
||||||
typedef void (*FN_SETPHYSICSKEYVALUE) ( const edict_t *pClient, const char *key, const char *value );
|
|
||||||
typedef const char * (*FN_GETPHYSICSINFOSTRING) ( const edict_t *pClient );
|
|
||||||
typedef unsigned short (*FN_PRECACHEEVENT) ( int type, const char *psz );
|
|
||||||
typedef void (*FN_PLAYBACKEVENT) ( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
|
||||||
typedef unsigned char * (*FN_SETFATPVS) ( float *org );
|
|
||||||
typedef unsigned char * (*FN_SETFATPAS) ( float *org );
|
|
||||||
typedef int (*FN_CHECKVISIBILITY) ( const edict_t *entity, unsigned char *pset );
|
|
||||||
typedef void (*FN_DELTASETFIELD) ( struct delta_s *pFields, const char *fieldname );
|
|
||||||
typedef void (*FN_DELTAUNSETFIELD) ( struct delta_s *pFields, const char *fieldname );
|
|
||||||
typedef void (*FN_DELTAADDENCODER) ( char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) );
|
|
||||||
typedef int (*FN_GETCURRENTPLAYER) ( void );
|
|
||||||
typedef int (*FN_CANSKIPPLAYER) ( const edict_t *player );
|
|
||||||
typedef int (*FN_DELTAFINDFIELD) ( struct delta_s *pFields, const char *fieldname );
|
|
||||||
typedef void (*FN_DELTASETFIELDBYINDEX) ( struct delta_s *pFields, int fieldNumber );
|
|
||||||
typedef void (*FN_DELTAUNSETFIELDBYINDEX) ( struct delta_s *pFields, int fieldNumber );
|
|
||||||
typedef void (*FN_SETGROUPMASK) ( int mask, int op );
|
|
||||||
typedef int (*FN_CREATEINSTANCEDBASELINE) ( int classname, struct entity_state_s *baseline );
|
|
||||||
typedef void (*FN_CVAR_DIRECTSET) ( struct cvar_s *var, char *value );
|
|
||||||
typedef void (*FN_FORCEUNMODIFIED) ( FORCE_TYPE type, float *mins, float *maxs, const char *filename );
|
|
||||||
typedef void (*FN_GETPLAYERSTATS) ( const edict_t *pClient, int *ping, int *packet_loss );
|
|
||||||
typedef void (*FN_ADDSERVERCOMMAND) ( char *cmd_name, void (*function) (void) );
|
|
||||||
// Added in SDK 2.2:
|
|
||||||
typedef qboolean (*FN_VOICE_GETCLIENTLISTENING) (int iReceiver, int iSender);
|
|
||||||
typedef qboolean (*FN_VOICE_SETCLIENTLISTENING) (int iReceiver, int iSender, qboolean bListen);
|
|
||||||
// Added for HL 1109 (no SDK update):
|
|
||||||
typedef const char * (*FN_GETPLAYERAUTHID) (edict_t *e);
|
|
||||||
// Added 2003-11-10 (no SDK update):
|
|
||||||
typedef sequenceEntry_s * (*FN_SEQUENCEGET) (const char* fileName, const char* entryName);
|
|
||||||
typedef sentenceEntry_s * (*FN_SEQUENCEPICKSENTENCE) (const char* groupName, int pickMethod, int *picked);
|
|
||||||
typedef int (*FN_GETFILESIZE) (char *filename);
|
|
||||||
typedef unsigned int (*FN_GETAPPROXWAVEPLAYLEN) (const char *filepath);
|
|
||||||
typedef int (*FN_ISCAREERMATCH) (void);
|
|
||||||
typedef int (*FN_GETLOCALIZEDSTRINGLENGTH) (const char *label);
|
|
||||||
typedef void (*FN_REGISTERTUTORMESSAGESHOWN) (int mid);
|
|
||||||
typedef int (*FN_GETTIMESTUTORMESSAGESHOWN) (int mid);
|
|
||||||
typedef void (*FN_PROCESSTUTORMESSAGEDECAYBUFFER) (int *buffer, int bufferLength);
|
|
||||||
typedef void (*FN_CONSTRUCTTUTORMESSAGEDECAYBUFFER) (int *buffer, int bufferLength);
|
|
||||||
typedef void (*FN_RESETTUTORMESSAGEDECAYDATA) (void);
|
|
||||||
//Added 2005-08-11 (no SDK update)
|
|
||||||
typedef void (*FN_QUERYCLIENTCVARVALUE)(const edict_t *pEdict, const char *cvarName); //! Obsolete! Use FN_QUERYCLIENTCVARVALUE2 instead
|
|
||||||
//Added 2005-11-22 (no SDK update)
|
|
||||||
typedef void (*FN_QUERYCLIENTCVARVALUE2)(const edict_t *pEdict, const char *cvarName, int requestID);
|
|
||||||
|
|
||||||
#endif /* ENGINE_API_H */
|
|
@ -1,38 +1,4 @@
|
|||||||
// enginecallbacks.h - wrapper for <enginecallback.h>
|
#pragma once
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2001-2006 Will Day <willday@hpgx.net>
|
|
||||||
*
|
|
||||||
* This file is part of Metamod.
|
|
||||||
*
|
|
||||||
* Metamod is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Metamod is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Metamod; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* In addition, as a special exception, the author gives permission to
|
|
||||||
* link the code of this program with the Half-Life Game Engine ("HL
|
|
||||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
||||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
||||||
* respects for all of the code used other than the HL Engine and MODs
|
|
||||||
* from Valve. If you modify this file, you may extend this exception
|
|
||||||
* to your version of the file, but you are not obligated to do so. If
|
|
||||||
* you do not wish to do so, delete this exception statement from your
|
|
||||||
* version.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MM_ENGINECALLBACKS_H
|
|
||||||
#define MM_ENGINECALLBACKS_H
|
|
||||||
|
|
||||||
// This file is a wrapper around the SDK's enginecallback.h file. We need
|
// This file is a wrapper around the SDK's enginecallback.h file. We need
|
||||||
// this because we use a different type for the global object g_engfuncs,
|
// this because we use a different type for the global object g_engfuncs,
|
||||||
@ -41,34 +7,30 @@
|
|||||||
// This is only done for files that belong to Metamod, not other projects
|
// This is only done for files that belong to Metamod, not other projects
|
||||||
// like plugins that use this file, or others that include it, too.
|
// like plugins that use this file, or others that include it, too.
|
||||||
// Since we don't have a clean seperation of include files right now we
|
// Since we don't have a clean seperation of include files right now we
|
||||||
// "hack" our way around that by using a flag METAMOD_CORE which is set
|
// "hack" our way around that by using a flag METAMOD_CORE which is set
|
||||||
// when compiling Metamod proper.
|
// when compiling Metamod proper.
|
||||||
|
|
||||||
#ifdef METAMOD_CORE
|
#ifdef METAMOD_CORE
|
||||||
# include "meta_eiface.h" // HL_enginefuncs_t
|
#include "meta_eiface.h" // HL_enginefuncs_t
|
||||||
|
|
||||||
// Use a #define to bend the enginefuncs_t type to our HL_enginefuncs_t
|
// Use a #define to bend the enginefuncs_t type to our HL_enginefuncs_t
|
||||||
// type instead as we now use that for the global object g_engfuncs.
|
// type instead as we now use that for the global object g_engfuncs.
|
||||||
# define enginefuncs_t HL_enginefuncs_t
|
#define enginefuncs_t HL_enginefuncs_t
|
||||||
#endif /* METAMOD_CORE */
|
#endif
|
||||||
|
|
||||||
#include <enginecallback.h> // ALERT, etc
|
#include <enginecallback.h> // ALERT, etc
|
||||||
|
|
||||||
#ifdef METAMOD_CORE
|
#ifdef METAMOD_CORE
|
||||||
# undef enginefuncs_t
|
#undef enginefuncs_t
|
||||||
#endif /* METAMOD_CORE */
|
#endif
|
||||||
|
|
||||||
// Also, create some additional macros for engine callback functions, which
|
// Also, create some additional macros for engine callback functions, which
|
||||||
// weren't in SDK dlls/enginecallbacks.h but probably should have been.
|
// weren't in SDK dlls/enginecallbacks.h but probably should have been.
|
||||||
|
#define GET_INFOKEYBUFFER (*g_engfuncs.pfnGetInfoKeyBuffer)
|
||||||
#define GET_INFOKEYBUFFER (*g_engfuncs.pfnGetInfoKeyBuffer)
|
#define INFOKEY_VALUE (*g_engfuncs.pfnInfoKeyValue)
|
||||||
#define INFOKEY_VALUE (*g_engfuncs.pfnInfoKeyValue)
|
#define SET_CLIENT_KEYVALUE (*g_engfuncs.pfnSetClientKeyValue)
|
||||||
#define SET_CLIENT_KEYVALUE (*g_engfuncs.pfnSetClientKeyValue)
|
#define REG_SVR_COMMAND (*g_engfuncs.pfnAddServerCommand)
|
||||||
#define REG_SVR_COMMAND (*g_engfuncs.pfnAddServerCommand)
|
#define SERVER_PRINT (*g_engfuncs.pfnServerPrint)
|
||||||
#define SERVER_PRINT (*g_engfuncs.pfnServerPrint)
|
#define SET_SERVER_KEYVALUE (*g_engfuncs.pfnSetKeyValue)
|
||||||
#define SET_SERVER_KEYVALUE (*g_engfuncs.pfnSetKeyValue)
|
#define QUERY_CLIENT_CVAR_VALUE (*g_engfuncs.pfnQueryClientCvarValue)
|
||||||
#define QUERY_CLIENT_CVAR_VALUE (*g_engfuncs.pfnQueryClientCvarValue)
|
|
||||||
#define QUERY_CLIENT_CVAR_VALUE2 (*g_engfuncs.pfnQueryClientCvarValue2)
|
#define QUERY_CLIENT_CVAR_VALUE2 (*g_engfuncs.pfnQueryClientCvarValue2)
|
||||||
|
|
||||||
|
|
||||||
#endif /* MM_ENGINECALLBACKS_H */
|
|
||||||
|
@ -1,46 +1,5 @@
|
|||||||
// h_export.h - prototypes for h_export.cpp
|
#pragma once
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2001-2003 Will Day <willday@hpgx.net>
|
|
||||||
*
|
|
||||||
* This file is part of Metamod.
|
|
||||||
*
|
|
||||||
* Metamod is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Metamod is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Metamod; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* In addition, as a special exception, the author gives permission to
|
|
||||||
* link the code of this program with the Half-Life Game Engine ("HL
|
|
||||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
||||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
||||||
* respects for all of the code used other than the HL Engine and MODs
|
|
||||||
* from Valve. If you modify this file, you may extend this exception
|
|
||||||
* to your version of the file, but you are not obligated to do so. If
|
|
||||||
* you do not wish to do so, delete this exception statement from your
|
|
||||||
* version.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef H_EXPORT_H
|
|
||||||
#define H_EXPORT_H
|
|
||||||
|
|
||||||
#include "osdep.h" // DLLEXPORT, WINAPI, etc
|
|
||||||
|
|
||||||
// Our GiveFnptrsToDll, called by engine.
|
// Our GiveFnptrsToDll, called by engine.
|
||||||
typedef void (WINAPI *GIVE_ENGINE_FUNCTIONS_FN) (enginefuncs_t
|
typedef void (WINAPI *GIVE_ENGINE_FUNCTIONS_FN)(enginefuncs_t *pengfuncsFromEngine, globalvars_t *pGlobals);
|
||||||
*pengfuncsFromEngine, globalvars_t *pGlobals);
|
C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pengfuncsFromEngine, globalvars_t *pGlobals);
|
||||||
|
|
||||||
C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pengfuncsFromEngine,
|
|
||||||
globalvars_t *pGlobals);
|
|
||||||
|
|
||||||
#endif /* H_EXPORT_H */
|
|
||||||
|
@ -1,99 +0,0 @@
|
|||||||
// log_meta.h - functions & macros for logging
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2001-2003 Will Day <willday@hpgx.net>
|
|
||||||
*
|
|
||||||
* This file is part of Metamod.
|
|
||||||
*
|
|
||||||
* Metamod is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Metamod is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Metamod; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* In addition, as a special exception, the author gives permission to
|
|
||||||
* link the code of this program with the Half-Life Game Engine ("HL
|
|
||||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
||||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
||||||
* respects for all of the code used other than the HL Engine and MODs
|
|
||||||
* from Valve. If you modify this file, you may extend this exception
|
|
||||||
* to your version of the file, but you are not obligated to do so. If
|
|
||||||
* you do not wish to do so, delete this exception statement from your
|
|
||||||
* version.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef LOG_META_H
|
|
||||||
#define LOG_META_H
|
|
||||||
|
|
||||||
#include "enginecallbacks.h" // ALERT, etc
|
|
||||||
#include "sdk_util.h" // UTIL_VarArgs, etc
|
|
||||||
|
|
||||||
// Debug logging.
|
|
||||||
//
|
|
||||||
// This is done as a macro, rather than a function. This way, you can add
|
|
||||||
// DEBUG statements all over, without worrying about performance
|
|
||||||
// implications. If the debugging level is set low, all those statements
|
|
||||||
// will only generate a simple float/int compare each; if we were to use a
|
|
||||||
// function instead of a macro, it would end up wasting a lot of cpu cycles
|
|
||||||
// calling/returning from the function every time. With a fair number of
|
|
||||||
// DEBUG statements, or if they're placed in frequently excuted code, the
|
|
||||||
// overhead of the wasted function calls could significantly impact server
|
|
||||||
// performance.
|
|
||||||
//
|
|
||||||
// For this reason, we also compare directly to the float value of the
|
|
||||||
// cvar, rather than calling CVAR_GET_FLOAT() and thus generating a string
|
|
||||||
// compare for each DEBUG statement.
|
|
||||||
//
|
|
||||||
// Called as:
|
|
||||||
// META_DEBUG(3, ("return code: %d", ret));
|
|
||||||
//
|
|
||||||
// Note the double parens, and the missing parens around "args" in the
|
|
||||||
// macro itself. Note also the "do..while(0)" loop wrapping the
|
|
||||||
// statements, so they become a single statement when expanded, necessary
|
|
||||||
// for times when it might be called as a single-statement result of an
|
|
||||||
// else (or other flow control).
|
|
||||||
//
|
|
||||||
// As suggested by Jussi Kivilinna: Use "if(meta_debug.value < level); else
|
|
||||||
// DO(something);" style because "meta_debug.value < level" is in most common
|
|
||||||
// case "false". Check disasm, contitional jumps are predicted not to be
|
|
||||||
// taken by CPU.
|
|
||||||
//
|
|
||||||
// Yes, it's all a bit of a hack.
|
|
||||||
|
|
||||||
#define META_DEBUG(level, args) \
|
|
||||||
do { if(meta_debug.value < level) break; else ALERT(at_logged, "[META] (debug:%d) %s\n", level, UTIL_VarArgs args ); } while(0)
|
|
||||||
|
|
||||||
// max buffer size for printed messages
|
|
||||||
#define MAX_LOGMSG_LEN 1024
|
|
||||||
|
|
||||||
// max buffer size for client messages
|
|
||||||
#define MAX_CLIENTMSG_LEN 128
|
|
||||||
|
|
||||||
extern cvar_t meta_debug;
|
|
||||||
|
|
||||||
// META_DEV provides debug logging via the cvar "developer" (when set to 1)
|
|
||||||
// and uses a function call rather than a macro as it's really intended to
|
|
||||||
// be used only during startup, before meta_debug has been set from reading
|
|
||||||
// server.cfg.
|
|
||||||
// NOTE: META_DEV has now been mostly obsoleted in the code.
|
|
||||||
|
|
||||||
void META_CONS(char *fmt, ...);
|
|
||||||
void META_DEV(char *fmt, ...);
|
|
||||||
void META_INFO(char *fmt, ...);
|
|
||||||
void META_WARNING(char *fmt, ...);
|
|
||||||
void META_ERROR(char *fmt, ...);
|
|
||||||
void META_LOG(char *fmt, ...);
|
|
||||||
void META_CLIENT(edict_t *pEntity, char *fmt, ...);
|
|
||||||
|
|
||||||
void flush_ALERT_buffer(void);
|
|
||||||
|
|
||||||
#endif /* LOG_META_H */
|
|
@ -1,44 +1,11 @@
|
|||||||
// meta_api.h - description of metamod's DLL interface
|
#pragma once
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2001-2003 Will Day <willday@hpgx.net>
|
|
||||||
*
|
|
||||||
* This file is part of Metamod.
|
|
||||||
*
|
|
||||||
* Metamod is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Metamod is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Metamod; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* In addition, as a special exception, the author gives permission to
|
|
||||||
* link the code of this program with the Half-Life Game Engine ("HL
|
|
||||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
||||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
||||||
* respects for all of the code used other than the HL Engine and MODs
|
|
||||||
* from Valve. If you modify this file, you may extend this exception
|
|
||||||
* to your version of the file, but you are not obligated to do so. If
|
|
||||||
* you do not wish to do so, delete this exception statement from your
|
|
||||||
* version.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef META_API_H
|
|
||||||
#define META_API_H
|
|
||||||
|
|
||||||
#include "dllapi.h" // GETENTITYAPI_FN, etc
|
#include "dllapi.h" // GETENTITYAPI_FN, etc
|
||||||
#include "engine_api.h" // GET_ENGINE_FUNCTIONS_FN, etc
|
#include "engine_api.h" // GET_ENGINE_FUNCTIONS_FN, etc
|
||||||
|
#include "enginecallbacks.h"
|
||||||
|
#include "h_export.h"
|
||||||
#include "plinfo.h" // plugin_info_t, etc
|
#include "plinfo.h" // plugin_info_t, etc
|
||||||
#include "mutil.h" // mutil_funcs_t, etc
|
#include "mutil.h"
|
||||||
#include "osdep.h" // DLLEXPORT, etc
|
|
||||||
|
|
||||||
// Version consists of "major:minor", two separate integer numbers.
|
// Version consists of "major:minor", two separate integer numbers.
|
||||||
// Version 1 original
|
// Version 1 original
|
||||||
@ -57,49 +24,48 @@
|
|||||||
// Version 5:9 added GetGameInfo [v1.14]
|
// Version 5:9 added GetGameInfo [v1.14]
|
||||||
// Version 5:10 added GINFO_REALDLL_FULLPATH for GetGameInfo [v1.17]
|
// Version 5:10 added GINFO_REALDLL_FULLPATH for GetGameInfo [v1.17]
|
||||||
// Version 5:11 added plugin loading and unloading API [v1.18]
|
// Version 5:11 added plugin loading and unloading API [v1.18]
|
||||||
// Version 5:12 added util code for checking player query status [v1.18]
|
// Version 5:12 added IS_QUERYING_CLIENT_CVAR to mutils [v1.18]
|
||||||
// Version 5:13 added cvarquery2 support and api for calling hook tables [v1.19]
|
// Version 5:13 added MAKE_REQUESTID and GET_HOOK_TABLES to mutils [v1.19]
|
||||||
#define META_INTERFACE_VERSION "5:13"
|
#define META_INTERFACE_VERSION "5:13"
|
||||||
|
|
||||||
#ifdef UNFINISHED
|
|
||||||
// Version 5:99 added event hook utility functions [v.???]
|
|
||||||
#define META_INTERFACE_VERSION "5:99"
|
|
||||||
#endif /* UNFINISHED */
|
|
||||||
|
|
||||||
// Flags returned by a plugin's api function.
|
// Flags returned by a plugin's api function.
|
||||||
// NOTE: order is crucial, as greater/less comparisons are made.
|
// NOTE: order is crucial, as greater/less comparisons are made.
|
||||||
typedef enum {
|
enum META_RES
|
||||||
|
{
|
||||||
MRES_UNSET = 0,
|
MRES_UNSET = 0,
|
||||||
MRES_IGNORED, // plugin didn't take any action
|
MRES_IGNORED, // plugin didn't take any action
|
||||||
MRES_HANDLED, // plugin did something, but real function should still be called
|
MRES_HANDLED, // plugin did something, but real function should still be called
|
||||||
MRES_OVERRIDE, // call real function, but use my return value
|
MRES_OVERRIDE, // call real function, but use my return value
|
||||||
MRES_SUPERCEDE, // skip real function; use my return value
|
MRES_SUPERCEDE, // skip real function; use my return value
|
||||||
} META_RES;
|
};
|
||||||
|
|
||||||
// Variables provided to plugins.
|
// Variables provided to plugins.
|
||||||
typedef struct meta_globals_s {
|
struct meta_globals_t
|
||||||
|
{
|
||||||
META_RES mres; // writable; plugin's return flag
|
META_RES mres; // writable; plugin's return flag
|
||||||
META_RES prev_mres; // readable; return flag of the previous plugin called
|
META_RES prev_mres; // readable; return flag of the previous plugin called
|
||||||
META_RES status; // readable; "highest" return flag so far
|
META_RES status; // readable; "highest" return flag so far
|
||||||
void *orig_ret; // readable; return value from "real" function
|
void *orig_ret; // readable; return value from "real" function
|
||||||
void *override_ret; // readable; return value from overriding/superceding plugin
|
void *override_ret; // readable; return value from overriding/superceding plugin
|
||||||
} meta_globals_t;
|
};
|
||||||
|
|
||||||
extern meta_globals_t *gpMetaGlobals;
|
extern meta_globals_t *gpMetaGlobals;
|
||||||
#define SET_META_RESULT(result) gpMetaGlobals->mres=result
|
#define SET_META_RESULT(result) gpMetaGlobals->mres = result
|
||||||
|
|
||||||
#define RETURN_META(result) \
|
#define RETURN_META(result) \
|
||||||
do { gpMetaGlobals->mres=result; return; } while(0)
|
do { gpMetaGlobals->mres = result; return; } while (0)
|
||||||
|
|
||||||
#define RETURN_META_VALUE(result, value) \
|
#define RETURN_META_VALUE(result, value) \
|
||||||
do { gpMetaGlobals->mres=result; return(value); } while(0)
|
do { gpMetaGlobals->mres = result; return value; } while (0)
|
||||||
|
|
||||||
#define META_RESULT_STATUS gpMetaGlobals->status
|
#define META_RESULT_STATUS gpMetaGlobals->status
|
||||||
#define META_RESULT_PREVIOUS gpMetaGlobals->prev_mres
|
#define META_RESULT_PREVIOUS gpMetaGlobals->prev_mres
|
||||||
#define META_RESULT_ORIG_RET(type) *(type *)gpMetaGlobals->orig_ret
|
#define META_RESULT_ORIG_RET(type) *(type *)gpMetaGlobals->orig_ret
|
||||||
#define META_RESULT_OVERRIDE_RET(type) *(type *)gpMetaGlobals->override_ret
|
#define META_RESULT_OVERRIDE_RET(type) *(type *)gpMetaGlobals->override_ret
|
||||||
|
|
||||||
// Table of getapi functions, retrieved from each plugin.
|
// Table of getapi functions, retrieved from each plugin.
|
||||||
typedef struct {
|
struct META_FUNCTIONS
|
||||||
|
{
|
||||||
GETENTITYAPI_FN pfnGetEntityAPI;
|
GETENTITYAPI_FN pfnGetEntityAPI;
|
||||||
GETENTITYAPI_FN pfnGetEntityAPI_Post;
|
GETENTITYAPI_FN pfnGetEntityAPI_Post;
|
||||||
GETENTITYAPI2_FN pfnGetEntityAPI2;
|
GETENTITYAPI2_FN pfnGetEntityAPI2;
|
||||||
@ -108,13 +74,14 @@ typedef struct {
|
|||||||
GETNEWDLLFUNCTIONS_FN pfnGetNewDLLFunctions_Post;
|
GETNEWDLLFUNCTIONS_FN pfnGetNewDLLFunctions_Post;
|
||||||
GET_ENGINE_FUNCTIONS_FN pfnGetEngineFunctions;
|
GET_ENGINE_FUNCTIONS_FN pfnGetEngineFunctions;
|
||||||
GET_ENGINE_FUNCTIONS_FN pfnGetEngineFunctions_Post;
|
GET_ENGINE_FUNCTIONS_FN pfnGetEngineFunctions_Post;
|
||||||
} META_FUNCTIONS;
|
};
|
||||||
|
|
||||||
// Pair of function tables provided by game DLL.
|
// Pair of function tables provided by game DLL.
|
||||||
typedef struct {
|
struct gamedll_funcs_t
|
||||||
|
{
|
||||||
DLL_FUNCTIONS *dllapi_table;
|
DLL_FUNCTIONS *dllapi_table;
|
||||||
NEW_DLL_FUNCTIONS *newapi_table;
|
NEW_DLL_FUNCTIONS *newapi_table;
|
||||||
} gamedll_funcs_t;
|
};
|
||||||
|
|
||||||
// Declared in plugin; referenced in macros.
|
// Declared in plugin; referenced in macros.
|
||||||
extern gamedll_funcs_t *gpGamedllFuncs;
|
extern gamedll_funcs_t *gpGamedllFuncs;
|
||||||
@ -125,38 +92,26 @@ extern mutil_funcs_t *gpMetaUtilFuncs;
|
|||||||
// procedure. In particular, this will allow for DLL's that can be used as
|
// procedure. In particular, this will allow for DLL's that can be used as
|
||||||
// both standalone DLL's and metamod plugins. (optional; not required in
|
// both standalone DLL's and metamod plugins. (optional; not required in
|
||||||
// plugin)
|
// plugin)
|
||||||
C_DLLEXPORT void Meta_Init(void);
|
C_DLLEXPORT void Meta_Init();
|
||||||
typedef void (*META_INIT_FN) (void);
|
typedef void (*META_INIT_FN)();
|
||||||
|
|
||||||
// Get info about plugin, compare meta_interface versions, provide meta
|
// Get info about plugin, compare meta_interface versions, provide meta
|
||||||
// utility callback functions.
|
// utility callback functions.
|
||||||
C_DLLEXPORT int Meta_Query(char *interfaceVersion,
|
C_DLLEXPORT int Meta_Query(char *interfaceVersion, plugin_info_t **plinfo, mutil_funcs_t *pMetaUtilFuncs);
|
||||||
plugin_info_t **plinfo,
|
typedef int (*META_QUERY_FN) (char *interfaceVersion, plugin_info_t **plinfo, mutil_funcs_t *pMetaUtilFuncs);
|
||||||
mutil_funcs_t *pMetaUtilFuncs);
|
|
||||||
typedef int (*META_QUERY_FN) (char *interfaceVersion,
|
|
||||||
plugin_info_t **plinfo,
|
|
||||||
mutil_funcs_t *pMetaUtilFuncs);
|
|
||||||
|
|
||||||
// Attach the plugin to the API; get the table of getapi functions; give
|
// Attach the plugin to the API; get the table of getapi functions; give
|
||||||
// meta_globals and gamedll_funcs.
|
// meta_globals and gamedll_funcs.
|
||||||
C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now,
|
C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs);
|
||||||
META_FUNCTIONS *pFunctionTable,
|
typedef int (*META_ATTACH_FN) (PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs);
|
||||||
meta_globals_t *pMGlobals,
|
|
||||||
gamedll_funcs_t *pGamedllFuncs);
|
|
||||||
typedef int (*META_ATTACH_FN) (PLUG_LOADTIME now,
|
|
||||||
META_FUNCTIONS *pFunctionTable,
|
|
||||||
meta_globals_t *pMGlobals,
|
|
||||||
gamedll_funcs_t *pGamedllFuncs);
|
|
||||||
|
|
||||||
// Detach the plugin; tell why and when.
|
// Detach the plugin; tell why and when.
|
||||||
C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
|
C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
|
||||||
typedef int (*META_DETACH_FN) (PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
|
typedef int (*META_DETACH_FN) (PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
|
||||||
|
|
||||||
// Standard HL SDK interface function prototypes.
|
// Standard HL SDK interface function prototypes.
|
||||||
C_DLLEXPORT int GetEntityAPI_Post(DLL_FUNCTIONS *pFunctionTable,
|
C_DLLEXPORT int GetEntityAPI_Post(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
|
||||||
int interfaceVersion );
|
C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
|
||||||
C_DLLEXPORT int GetEntityAPI2_Post(DLL_FUNCTIONS *pFunctionTable,
|
|
||||||
int *interfaceVersion );
|
|
||||||
|
|
||||||
// Additional SDK-like interface function prototypes.
|
// Additional SDK-like interface function prototypes.
|
||||||
C_DLLEXPORT int GetNewDLLFunctions_Post(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion );
|
C_DLLEXPORT int GetNewDLLFunctions_Post(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion );
|
||||||
@ -166,67 +121,65 @@ C_DLLEXPORT int GetEngineFunctions_Post(enginefuncs_t *pengfuncsFromEngine, int
|
|||||||
// Convenience macros for accessing GameDLL functions. Note: these talk
|
// Convenience macros for accessing GameDLL functions. Note: these talk
|
||||||
// _directly_ to the gamedll, and are not multiplexed through Metamod to
|
// _directly_ to the gamedll, and are not multiplexed through Metamod to
|
||||||
// the other plugins.
|
// the other plugins.
|
||||||
// DLL API functions:
|
|
||||||
#define MDLL_FUNC gpGamedllFuncs->dllapi_table
|
|
||||||
|
|
||||||
#define MDLL_GameDLLInit MDLL_FUNC->pfnGameInit
|
// DLL API functions:
|
||||||
#define MDLL_Spawn MDLL_FUNC->pfnSpawn
|
#define MDLL_FUNC gpGamedllFuncs->dllapi_table
|
||||||
#define MDLL_Think MDLL_FUNC->pfnThink
|
|
||||||
#define MDLL_Use MDLL_FUNC->pfnUse
|
#define MDLL_GameDLLInit MDLL_FUNC->pfnGameInit
|
||||||
#define MDLL_Touch MDLL_FUNC->pfnTouch
|
#define MDLL_Spawn MDLL_FUNC->pfnSpawn
|
||||||
#define MDLL_Blocked MDLL_FUNC->pfnBlocked
|
#define MDLL_Think MDLL_FUNC->pfnThink
|
||||||
#define MDLL_KeyValue MDLL_FUNC->pfnKeyValue
|
#define MDLL_Use MDLL_FUNC->pfnUse
|
||||||
#define MDLL_Save MDLL_FUNC->pfnSave
|
#define MDLL_Touch MDLL_FUNC->pfnTouch
|
||||||
#define MDLL_Restore MDLL_FUNC->pfnRestore
|
#define MDLL_Blocked MDLL_FUNC->pfnBlocked
|
||||||
|
#define MDLL_KeyValue MDLL_FUNC->pfnKeyValue
|
||||||
|
#define MDLL_Save MDLL_FUNC->pfnSave
|
||||||
|
#define MDLL_Restore MDLL_FUNC->pfnRestore
|
||||||
#define MDLL_ObjectCollsionBox MDLL_FUNC->pfnAbsBox
|
#define MDLL_ObjectCollsionBox MDLL_FUNC->pfnAbsBox
|
||||||
#define MDLL_SaveWriteFields MDLL_FUNC->pfnSaveWriteFields
|
#define MDLL_SaveWriteFields MDLL_FUNC->pfnSaveWriteFields
|
||||||
#define MDLL_SaveReadFields MDLL_FUNC->pfnSaveReadFields
|
#define MDLL_SaveReadFields MDLL_FUNC->pfnSaveReadFields
|
||||||
#define MDLL_SaveGlobalState MDLL_FUNC->pfnSaveGlobalState
|
#define MDLL_SaveGlobalState MDLL_FUNC->pfnSaveGlobalState
|
||||||
#define MDLL_RestoreGlobalState MDLL_FUNC->pfnRestoreGlobalState
|
#define MDLL_RestoreGlobalState MDLL_FUNC->pfnRestoreGlobalState
|
||||||
#define MDLL_ResetGlobalState MDLL_FUNC->pfnResetGlobalState
|
#define MDLL_ResetGlobalState MDLL_FUNC->pfnResetGlobalState
|
||||||
#define MDLL_ClientConnect MDLL_FUNC->pfnClientConnect
|
#define MDLL_ClientConnect MDLL_FUNC->pfnClientConnect
|
||||||
#define MDLL_ClientDisconnect MDLL_FUNC->pfnClientDisconnect
|
#define MDLL_ClientDisconnect MDLL_FUNC->pfnClientDisconnect
|
||||||
#define MDLL_ClientKill MDLL_FUNC->pfnClientKill
|
#define MDLL_ClientKill MDLL_FUNC->pfnClientKill
|
||||||
#define MDLL_ClientPutInServer MDLL_FUNC->pfnClientPutInServer
|
#define MDLL_ClientPutInServer MDLL_FUNC->pfnClientPutInServer
|
||||||
#define MDLL_ClientCommand MDLL_FUNC->pfnClientCommand
|
#define MDLL_ClientCommand MDLL_FUNC->pfnClientCommand
|
||||||
#define MDLL_ClientUserInfoChanged MDLL_FUNC->pfnClientUserInfoChanged
|
#define MDLL_ClientUserInfoChanged MDLL_FUNC->pfnClientUserInfoChanged
|
||||||
#define MDLL_ServerActivate MDLL_FUNC->pfnServerActivate
|
#define MDLL_ServerActivate MDLL_FUNC->pfnServerActivate
|
||||||
#define MDLL_ServerDeactivate MDLL_FUNC->pfnServerDeactivate
|
#define MDLL_ServerDeactivate MDLL_FUNC->pfnServerDeactivate
|
||||||
#define MDLL_PlayerPreThink MDLL_FUNC->pfnPlayerPreThink
|
#define MDLL_PlayerPreThink MDLL_FUNC->pfnPlayerPreThink
|
||||||
#define MDLL_PlayerPostThink MDLL_FUNC->pfnPlayerPostThink
|
#define MDLL_PlayerPostThink MDLL_FUNC->pfnPlayerPostThink
|
||||||
#define MDLL_StartFrame MDLL_FUNC->pfnStartFrame
|
#define MDLL_StartFrame MDLL_FUNC->pfnStartFrame
|
||||||
#define MDLL_ParmsNewLevel MDLL_FUNC->pfnParmsNewLevel
|
#define MDLL_ParmsNewLevel MDLL_FUNC->pfnParmsNewLevel
|
||||||
#define MDLL_ParmsChangeLevel MDLL_FUNC->pfnParmsChangeLevel
|
#define MDLL_ParmsChangeLevel MDLL_FUNC->pfnParmsChangeLevel
|
||||||
#define MDLL_GetGameDescription MDLL_FUNC->pfnGetGameDescription
|
#define MDLL_GetGameDescription MDLL_FUNC->pfnGetGameDescription
|
||||||
#define MDLL_PlayerCustomization MDLL_FUNC->pfnPlayerCustomization
|
#define MDLL_PlayerCustomization MDLL_FUNC->pfnPlayerCustomization
|
||||||
#define MDLL_SpectatorConnect MDLL_FUNC->pfnSpectatorConnect
|
#define MDLL_SpectatorConnect MDLL_FUNC->pfnSpectatorConnect
|
||||||
#define MDLL_SpectatorDisconnect MDLL_FUNC->pfnSpectatorDisconnect
|
#define MDLL_SpectatorDisconnect MDLL_FUNC->pfnSpectatorDisconnect
|
||||||
#define MDLL_SpectatorThink MDLL_FUNC->pfnSpectatorThink
|
#define MDLL_SpectatorThink MDLL_FUNC->pfnSpectatorThink
|
||||||
#define MDLL_Sys_Error MDLL_FUNC->pfnSys_Error
|
#define MDLL_Sys_Error MDLL_FUNC->pfnSys_Error
|
||||||
#define MDLL_PM_Move MDLL_FUNC->pfnPM_Move
|
#define MDLL_PM_Move MDLL_FUNC->pfnPM_Move
|
||||||
#define MDLL_PM_Init MDLL_FUNC->pfnPM_Init
|
#define MDLL_PM_Init MDLL_FUNC->pfnPM_Init
|
||||||
#define MDLL_PM_FindTextureType MDLL_FUNC->pfnPM_FindTextureType
|
#define MDLL_PM_FindTextureType MDLL_FUNC->pfnPM_FindTextureType
|
||||||
#define MDLL_SetupVisibility MDLL_FUNC->pfnSetupVisibility
|
#define MDLL_SetupVisibility MDLL_FUNC->pfnSetupVisibility
|
||||||
#define MDLL_UpdateClientData MDLL_FUNC->pfnUpdateClientData
|
#define MDLL_UpdateClientData MDLL_FUNC->pfnUpdateClientData
|
||||||
#define MDLL_AddToFullPack MDLL_FUNC->pfnAddToFullPack
|
#define MDLL_AddToFullPack MDLL_FUNC->pfnAddToFullPack
|
||||||
#define MDLL_CreateBaseline MDLL_FUNC->pfnCreateBaseline
|
#define MDLL_CreateBaseline MDLL_FUNC->pfnCreateBaseline
|
||||||
#define MDLL_RegisterEncoders MDLL_FUNC->pfnRegisterEncoders
|
#define MDLL_RegisterEncoders MDLL_FUNC->pfnRegisterEncoders
|
||||||
#define MDLL_GetWeaponData MDLL_FUNC->pfnGetWeaponData
|
#define MDLL_GetWeaponData MDLL_FUNC->pfnGetWeaponData
|
||||||
#define MDLL_CmdStart MDLL_FUNC->pfnCmdStart
|
#define MDLL_CmdStart MDLL_FUNC->pfnCmdStart
|
||||||
#define MDLL_CmdEnd MDLL_FUNC->pfnCmdEnd
|
#define MDLL_CmdEnd MDLL_FUNC->pfnCmdEnd
|
||||||
#define MDLL_ConnectionlessPacket MDLL_FUNC->pfnConnectionlessPacket
|
#define MDLL_ConnectionlessPacket MDLL_FUNC->pfnConnectionlessPacket
|
||||||
#define MDLL_GetHullBounds MDLL_FUNC->pfnGetHullBounds
|
#define MDLL_GetHullBounds MDLL_FUNC->pfnGetHullBounds
|
||||||
#define MDLL_CreateInstancedBaselines MDLL_FUNC->pfnCreateInstancedBaselines
|
#define MDLL_CreateInstancedBaselines MDLL_FUNC->pfnCreateInstancedBaselines
|
||||||
#define MDLL_InconsistentFile MDLL_FUNC->pfnInconsistentFile
|
#define MDLL_InconsistentFile MDLL_FUNC->pfnInconsistentFile
|
||||||
#define MDLL_AllowLagCompensation MDLL_FUNC->pfnAllowLagCompensation
|
#define MDLL_AllowLagCompensation MDLL_FUNC->pfnAllowLagCompensation
|
||||||
|
|
||||||
// NEW API functions:
|
// NEW API functions:
|
||||||
#define MNEW_FUNC gpGamedllFuncs->newapi_table
|
#define MNEW_FUNC gpGamedllFuncs->newapi_table
|
||||||
|
|
||||||
#define MNEW_OnFreeEntPrivateData MNEW_FUNC->pfnOnFreeEntPrivateData
|
#define MNEW_OnFreeEntPrivateData MNEW_FUNC->pfnOnFreeEntPrivateData
|
||||||
#define MNEW_GameShutdown MNEW_FUNC->pfnGameShutdown
|
#define MNEW_GameShutdown MNEW_FUNC->pfnGameShutdown
|
||||||
#define MNEW_ShouldCollide MNEW_FUNC->pfnShouldCollide
|
#define MNEW_ShouldCollide MNEW_FUNC->pfnShouldCollide
|
||||||
#define MNEW_CvarValue MNEW_FUNC->pfnCvarValue
|
#define MNEW_CvarValue MNEW_FUNC->pfnCvarValue
|
||||||
#define MNEW_CvarValue2 MNEW_FUNC->pfnCvarValue2
|
|
||||||
|
|
||||||
#endif /* META_API_H */
|
|
||||||
|
@ -1,157 +0,0 @@
|
|||||||
#ifdef UNFINISHED
|
|
||||||
|
|
||||||
// mhook.h - class and types to describe hooks and hooklists
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2001-2003 Will Day <willday@hpgx.net>
|
|
||||||
*
|
|
||||||
* This file is part of Metamod.
|
|
||||||
*
|
|
||||||
* Metamod is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Metamod is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Metamod; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* In addition, as a special exception, the author gives permission to
|
|
||||||
* link the code of this program with the Half-Life Game Engine ("HL
|
|
||||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
||||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
||||||
* respects for all of the code used other than the HL Engine and MODs
|
|
||||||
* from Valve. If you modify this file, you may extend this exception
|
|
||||||
* to your version of the file, but you are not obligated to do so. If
|
|
||||||
* you do not wish to do so, delete this exception statement from your
|
|
||||||
* version.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MHOOK_H
|
|
||||||
#define MHOOK_H
|
|
||||||
|
|
||||||
#include "plinfo.h" // plid_t, etc
|
|
||||||
#include "types_meta.h" // mBOOL
|
|
||||||
#include "osdep.h" // MUTEX_T, etc
|
|
||||||
|
|
||||||
#define MAX_HOOKS 100
|
|
||||||
|
|
||||||
// Particular game events that we detect, though whatever means we can best
|
|
||||||
// find.
|
|
||||||
typedef enum {
|
|
||||||
EV_NONE = 0, // no event here...
|
|
||||||
// non-log detected
|
|
||||||
EV_PLAYER_CONNECT, // ie ClientConnect
|
|
||||||
EV_PLAYER_ENTER, // ie ClientPutInServer
|
|
||||||
EV_PLAYER_LEAVE, // ie ClientDisconnect (opposite PutInServer)
|
|
||||||
EV_PLAYER_SPAWN, // deadflag change to DEAD_NO
|
|
||||||
EV_PLAYER_DEATH, // deadflag change to DEAD_DEAD
|
|
||||||
EV_PLAYER_CHANGE_NAME, // netname change in ClientUserInfoChanged
|
|
||||||
// log detected
|
|
||||||
EV_PLAYER_JOIN_TEAM, // ie "Joe<15><785><>" joined team "CT"
|
|
||||||
EV_PLAYER_SUICIDE, // ie "Joe<15><785><CT>" committed suicide ...
|
|
||||||
EV_PLAYER_CHANGE_ROLE, // TFC: ie "Joe<15><785><Red>" changed role to "Pyro"
|
|
||||||
EV_TEAM_KILL, // ie "Joe<15><785><CT>" killed "Bob<16><342><CT>" ...
|
|
||||||
EV_WEAPON_KILL, // ie "Joe<15><785><CT>" killed "Sam<17><197><TERRORIST>" with "sg552"
|
|
||||||
EV_TEAM_SCORE, // ie Team "CT" scored "7" with "2" players
|
|
||||||
} game_event_t;
|
|
||||||
|
|
||||||
// Info corresponding to a player, in particular the info found in the logline.
|
|
||||||
typedef struct {
|
|
||||||
char *name;
|
|
||||||
int userid;
|
|
||||||
int wonid;
|
|
||||||
char *team;
|
|
||||||
} event_player_t;
|
|
||||||
|
|
||||||
// Info for an event, mostly corresponding to info from a logline.
|
|
||||||
typedef struct {
|
|
||||||
game_event_t evtype; // specific event, if identified.
|
|
||||||
char *buf; // copy of the logmsg, with embedded NULLs
|
|
||||||
event_player_t *player;
|
|
||||||
char *action; // "triggered" string, or a generic action string
|
|
||||||
event_player_t *target;
|
|
||||||
char *with;
|
|
||||||
} event_args_t;
|
|
||||||
|
|
||||||
// Types for callback functions to be called for requested event/logline.
|
|
||||||
typedef void (*event_func_t) (game_event_t event, event_args_t *args,
|
|
||||||
const char *logline);
|
|
||||||
typedef void (*logmatch_func_t) (const char *pattern, event_args_t *args,
|
|
||||||
const char *logline);
|
|
||||||
|
|
||||||
// The 4 types of hook requests we accept.
|
|
||||||
typedef enum {
|
|
||||||
H_NONE = 0,
|
|
||||||
H_EVENT, // Specific event, from a short list.
|
|
||||||
H_TRIGGER, // A given "triggered" string.
|
|
||||||
H_STRING, // Any substring of logline.
|
|
||||||
H_REGEX, // A regular expression matching of logline.
|
|
||||||
} hook_t;
|
|
||||||
|
|
||||||
|
|
||||||
// Class for individual hook function, as registered by a plugin.
|
|
||||||
class MHook {
|
|
||||||
friend class MHookList;
|
|
||||||
friend class MFuncQueue;
|
|
||||||
private:
|
|
||||||
// data:
|
|
||||||
int index;
|
|
||||||
hook_t type; // EVENT, TRIGGER, etc
|
|
||||||
plid_t plid;
|
|
||||||
int pl_index; // index of matching plugin
|
|
||||||
void *pfnHandle;
|
|
||||||
game_event_t event; // if type is H_EVENT
|
|
||||||
const char *match; // if type is TRIGGER, STRING, or REGEX
|
|
||||||
// Copy/Assignment constructors, to satisfy -Weffc++.
|
|
||||||
// Note however, we declare them private and don't define them, since
|
|
||||||
// we don't ever want to copy or assign instances of the class.
|
|
||||||
// (thanks to O'Reilly "C++: The Core Language", page 113)
|
|
||||||
MHook(const MHook &src);
|
|
||||||
void operator=(const MHook &src);
|
|
||||||
// constructors:
|
|
||||||
MHook(void);
|
|
||||||
MHook(int idx, plid_t pid, game_event_t evt, event_func_t pfn);
|
|
||||||
MHook(int idx, plid_t pid, hook_t tp, const char *cp, logmatch_func_t pfn);
|
|
||||||
// functions:
|
|
||||||
mBOOL call(event_args_t *args, const char *logline);
|
|
||||||
mBOOL enqueue(MFuncQueue *mfq, event_args_t *args, const char *logline);
|
|
||||||
public:
|
|
||||||
// no public interfaces; everything done from friend MHookList.
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Class for list of registered hook functions.
|
|
||||||
class MHookList {
|
|
||||||
private:
|
|
||||||
// data:
|
|
||||||
MHook *hlist[MAX_HOOKS];
|
|
||||||
int size; // set to MAX_HOOKS in constructor
|
|
||||||
int endlist;
|
|
||||||
MUTEX_T mx_hlist;
|
|
||||||
int MXlock(void) { return(MUTEX_LOCK(&mx_hlist)); };
|
|
||||||
int MXunlock(void) { return(MUTEX_UNLOCK(&mx_hlist)); };
|
|
||||||
public:
|
|
||||||
// constructor:
|
|
||||||
MHookList(void);
|
|
||||||
// functions:
|
|
||||||
int add(plid_t plid, game_event_t event, event_func_t pfnHandle);
|
|
||||||
int add(plid_t plid, hook_t type, const char *match,
|
|
||||||
logmatch_func_t pfnHandle);
|
|
||||||
mBOOL remove(plid_t plid, int hindex);
|
|
||||||
int remove_all(plid_t plid);
|
|
||||||
mBOOL call(event_args_t *args, const char *logline);
|
|
||||||
mBOOL enqueue(MFuncQueue *mfq, hook_t htype, event_args_t *evargs,
|
|
||||||
const char *logline);
|
|
||||||
char *str_htype(hook_t htype);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* MHOOK_H */
|
|
||||||
|
|
||||||
#endif /* UNFINISHED */
|
|
@ -1,183 +0,0 @@
|
|||||||
// mreg.h - description of registered items (classes MRegCmd, MRegCmdList)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2001-2003 Will Day <willday@hpgx.net>
|
|
||||||
*
|
|
||||||
* This file is part of Metamod.
|
|
||||||
*
|
|
||||||
* Metamod is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Metamod is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Metamod; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* In addition, as a special exception, the author gives permission to
|
|
||||||
* link the code of this program with the Half-Life Game Engine ("HL
|
|
||||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
||||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
||||||
* respects for all of the code used other than the HL Engine and MODs
|
|
||||||
* from Valve. If you modify this file, you may extend this exception
|
|
||||||
* to your version of the file, but you are not obligated to do so. If
|
|
||||||
* you do not wish to do so, delete this exception statement from your
|
|
||||||
* version.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MREG_H
|
|
||||||
#define MREG_H
|
|
||||||
|
|
||||||
#include "types_meta.h" // mBOOL
|
|
||||||
|
|
||||||
// Number of entries to add to reglists when they need to grow. Typically
|
|
||||||
// more cvars than commands, so we grow them at different increments.
|
|
||||||
#define REG_CMD_GROWSIZE 32
|
|
||||||
#define REG_CVAR_GROWSIZE 64
|
|
||||||
|
|
||||||
// Width required to printf a Reg*List index number, for show() functions.
|
|
||||||
// This used to correspond to the number of digits in MAX_REG, which was a
|
|
||||||
// fixed, compile-time limit. However, now that the reg lists are grown
|
|
||||||
// dynamically, this has less strong correspondance to list sizes. So for
|
|
||||||
// the moment, it reflects what one might normally expect to be the max
|
|
||||||
// width needed to print an index number; 4 allows 9999 (which is a damn
|
|
||||||
// lot, if you ask me).
|
|
||||||
#define WIDTH_MAX_REG 4
|
|
||||||
|
|
||||||
// Max number of registered user msgs we can manage.
|
|
||||||
#define MAX_REG_MSGS 256
|
|
||||||
|
|
||||||
// Flags to indicate if given cvar or func is part of a loaded plugin.
|
|
||||||
typedef enum {
|
|
||||||
RG_INVALID,
|
|
||||||
RG_VALID,
|
|
||||||
} REG_STATUS;
|
|
||||||
|
|
||||||
// Pointer to function registered by AddServerCommand.
|
|
||||||
typedef void (*REG_CMD_FN) (void);
|
|
||||||
|
|
||||||
|
|
||||||
// An individual registered function/command.
|
|
||||||
class MRegCmd {
|
|
||||||
friend class MRegCmdList;
|
|
||||||
private:
|
|
||||||
// data:
|
|
||||||
int index; // 1-based
|
|
||||||
public:
|
|
||||||
char *name; // space is malloc'd
|
|
||||||
REG_CMD_FN pfnCmd; // pointer to the function
|
|
||||||
int plugid; // index id of corresponding plugin
|
|
||||||
REG_STATUS status; // whether corresponding plugin is loaded
|
|
||||||
// functions:
|
|
||||||
void init(int idx); // init values, as not using constructors
|
|
||||||
mBOOL call(void); // try to call the function
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// A list of registered commands.
|
|
||||||
class MRegCmdList {
|
|
||||||
private:
|
|
||||||
// data:
|
|
||||||
MRegCmd *mlist; // malloc'd array of registered commands
|
|
||||||
int size; // current size of list
|
|
||||||
int endlist; // index of last used entry
|
|
||||||
// Private; to satisfy -Weffc++ "has pointer data members but does
|
|
||||||
// not override" copy/assignment constructor.
|
|
||||||
void operator=(const MRegCmdList &src);
|
|
||||||
MRegCmdList(const MRegCmdList &src);
|
|
||||||
|
|
||||||
public:
|
|
||||||
// constructor:
|
|
||||||
MRegCmdList(void);
|
|
||||||
|
|
||||||
// functions:
|
|
||||||
MRegCmd *find(const char *findname); // find by MRegCmd->name
|
|
||||||
MRegCmd *add(const char *addname);
|
|
||||||
void disable(int plugin_id); // change status to Invalid
|
|
||||||
void show(void); // list all funcs to console
|
|
||||||
void show(int plugin_id); // list given plugin's funcs to console
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// An individual registered cvar.
|
|
||||||
class MRegCvar {
|
|
||||||
friend class MRegCvarList;
|
|
||||||
private:
|
|
||||||
// data:
|
|
||||||
int index; // 1-based
|
|
||||||
public:
|
|
||||||
cvar_t *data; // actual cvar structure, malloc'd
|
|
||||||
int plugid; // index id of corresponding plugin
|
|
||||||
REG_STATUS status; // whether corresponding plugin is loaded
|
|
||||||
// functions:
|
|
||||||
void init(int idx); // init values, as not using constructors
|
|
||||||
mBOOL set(cvar_t *src);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// A list of registered cvars.
|
|
||||||
class MRegCvarList {
|
|
||||||
private:
|
|
||||||
// data:
|
|
||||||
MRegCvar *vlist; // malloc'd array of registered cvars
|
|
||||||
int size; // size of list, ie MAX_REG_CVARS
|
|
||||||
int endlist; // index of last used entry
|
|
||||||
// Private; to satisfy -Weffc++ "has pointer data members but does
|
|
||||||
// not override" copy/assignment constructor.
|
|
||||||
void operator=(const MRegCvarList &src);
|
|
||||||
MRegCvarList(const MRegCvarList &src);
|
|
||||||
|
|
||||||
public:
|
|
||||||
// constructor:
|
|
||||||
MRegCvarList(void);
|
|
||||||
|
|
||||||
// functions:
|
|
||||||
MRegCvar *add(const char *addname);
|
|
||||||
MRegCvar *find(const char *findname); // find by MRegCvar->data.name
|
|
||||||
void disable(int plugin_id); // change status to Invalid
|
|
||||||
void show(void); // list all cvars to console
|
|
||||||
void show(int plugin_id); // list given plugin's cvars to console
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// An individual registered user msg, from gamedll.
|
|
||||||
class MRegMsg {
|
|
||||||
friend class MRegMsgList;
|
|
||||||
private:
|
|
||||||
// data:
|
|
||||||
int index; // 1-based
|
|
||||||
public:
|
|
||||||
const char *name; // name, assumed constant string in gamedll
|
|
||||||
int msgid; // msgid, assigned by engine
|
|
||||||
int size; // size, if given by gamedll
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// A list of registered user msgs.
|
|
||||||
class MRegMsgList {
|
|
||||||
private:
|
|
||||||
// data:
|
|
||||||
MRegMsg mlist[MAX_REG_MSGS]; // array of registered msgs
|
|
||||||
int size; // size of list, ie MAX_REG_MSGS
|
|
||||||
int endlist; // index of last used entry
|
|
||||||
|
|
||||||
public:
|
|
||||||
// constructor:
|
|
||||||
MRegMsgList(void);
|
|
||||||
|
|
||||||
// functions:
|
|
||||||
MRegMsg *add(const char *addname, int addmsgid, int addsize);
|
|
||||||
MRegMsg *find(const char *findname);
|
|
||||||
MRegMsg *find(int findmsgid);
|
|
||||||
void show(void); // list all msgs to console
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* MREG_H */
|
|
@ -1,93 +1,43 @@
|
|||||||
// mutil.h - prototypes for utility functions to provide to plugins
|
#pragma once
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2001-2003 Will Day <willday@hpgx.net>
|
|
||||||
*
|
|
||||||
* This file is part of Metamod.
|
|
||||||
*
|
|
||||||
* Metamod is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Metamod is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Metamod; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* In addition, as a special exception, the author gives permission to
|
|
||||||
* link the code of this program with the Half-Life Game Engine ("HL
|
|
||||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
||||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
||||||
* respects for all of the code used other than the HL Engine and MODs
|
|
||||||
* from Valve. If you modify this file, you may extend this exception
|
|
||||||
* to your version of the file, but you are not obligated to do so. If
|
|
||||||
* you do not wish to do so, delete this exception statement from your
|
|
||||||
* version.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MUTIL_H
|
|
||||||
#define MUTIL_H
|
|
||||||
|
|
||||||
#include "plinfo.h" // plugin_info_t, etc
|
|
||||||
#include "mhook.h" // game_event_t, etc
|
|
||||||
#include "sdk_util.h" // hudtextparms_t, etc
|
|
||||||
|
|
||||||
// max buffer size for printed messages
|
// max buffer size for printed messages
|
||||||
#define MAX_LOGMSG_LEN 1024
|
#define MAX_LOGMSG_LEN 1024
|
||||||
|
|
||||||
// For GetGameInfo:
|
// For GetGameInfo:
|
||||||
typedef enum {
|
enum ginfo_t
|
||||||
|
{
|
||||||
GINFO_NAME = 0,
|
GINFO_NAME = 0,
|
||||||
GINFO_DESC,
|
GINFO_DESC,
|
||||||
GINFO_GAMEDIR,
|
GINFO_GAMEDIR,
|
||||||
GINFO_DLL_FULLPATH,
|
GINFO_DLL_FULLPATH,
|
||||||
GINFO_DLL_FILENAME,
|
GINFO_DLL_FILENAME,
|
||||||
GINFO_REALDLL_FULLPATH,
|
GINFO_REALDLL_FULLPATH,
|
||||||
} ginfo_t;
|
};
|
||||||
|
|
||||||
// Meta Utility Function table type.
|
// Meta Utility Function table type.
|
||||||
typedef struct meta_util_funcs_s {
|
struct mutil_funcs_t
|
||||||
|
{
|
||||||
void (*pfnLogConsole) (plid_t plid, const char *fmt, ...);
|
void (*pfnLogConsole) (plid_t plid, const char *fmt, ...);
|
||||||
void (*pfnLogMessage) (plid_t plid, const char *fmt, ...);
|
void (*pfnLogMessage) (plid_t plid, const char *fmt, ...);
|
||||||
void (*pfnLogError) (plid_t plid, const char *fmt, ...);
|
void (*pfnLogError) (plid_t plid, const char *fmt, ...);
|
||||||
void (*pfnLogDeveloper) (plid_t plid, const char *fmt, ...);
|
void (*pfnLogDeveloper) (plid_t plid, const char *fmt, ...);
|
||||||
void (*pfnCenterSay) (plid_t plid, const char *fmt, ...);
|
void (*pfnCenterSay) (plid_t plid, const char *fmt, ...);
|
||||||
void (*pfnCenterSayParms) (plid_t plid, hudtextparms_t tparms,
|
void (*pfnCenterSayParms) (plid_t plid, hudtextparms_t tparms, const char *fmt, ...);
|
||||||
const char *fmt, ...);
|
void (*pfnCenterSayVarargs) (plid_t plid, hudtextparms_t tparms, const char *fmt, va_list ap);
|
||||||
void (*pfnCenterSayVarargs) (plid_t plid, hudtextparms_t tparms,
|
qboolean (*pfnCallGameEntity) (plid_t plid, const char *entStr, entvars_t *pev);
|
||||||
const char *fmt, va_list ap);
|
int (*pfnGetUserMsgID) (plid_t plid, const char *msgname, int *size);
|
||||||
qboolean (*pfnCallGameEntity) (plid_t plid, const char *entStr,
|
const char * (*pfnGetUserMsgName) (plid_t plid, int msgid, int *size);
|
||||||
entvars_t *pev);
|
const char * (*pfnGetPluginPath) (plid_t plid);
|
||||||
int (*pfnGetUserMsgID) (plid_t plid, const char *msgname, int *size);
|
const char * (*pfnGetGameInfo) (plid_t plid, ginfo_t tag);
|
||||||
const char *(*pfnGetUserMsgName) (plid_t plid, int msgid, int *size);
|
int (*pfnLoadPlugin) (plid_t plid, const char *cmdline, PLUG_LOADTIME now, void **plugin_handle);
|
||||||
const char *(*pfnGetPluginPath) (plid_t plid);
|
int (*pfnUnloadPlugin) (plid_t plid, const char *cmdline, PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
|
||||||
const char *(*pfnGetGameInfo) (plid_t plid, ginfo_t tag);
|
int (*pfnUnloadPluginByHandle) (plid_t plid, void *plugin_handle, PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
|
||||||
int (*pfnLoadPlugin) (plid_t plid, const char *cmdline, PLUG_LOADTIME now, void **plugin_handle);
|
const char * (*pfnIsQueryingClientCvar) (plid_t plid, const edict_t *pEdict);
|
||||||
int (*pfnUnloadPlugin) (plid_t plid, const char *cmdline, PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
|
int (*pfnMakeRequestId) (plid_t plid);
|
||||||
int (*pfnUnloadPluginByHandle) (plid_t plid, void *plugin_handle, PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
|
|
||||||
const char *(*pfnIsQueryingClientCvar) (plid_t plid, const edict_t *pEdict);
|
|
||||||
int (*pfnMakeRequestId) (plid_t plid);
|
|
||||||
void (*pfnGetHookTables) (plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll);
|
void (*pfnGetHookTables) (plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll);
|
||||||
#ifdef UNFINISHED
|
};
|
||||||
int (*pfnHookGameEvent) (plid_t plid, game_event_t event,
|
|
||||||
event_func_t pfnHandle);
|
extern mutil_funcs_t g_MetaUtilFunctions;
|
||||||
int (*pfnHookLogTrigger) (plid_t plid, const char *trigger,
|
|
||||||
logmatch_func_t pfnHandle);
|
|
||||||
int (*pfnHookLogString) (plid_t plid, const char *string,
|
|
||||||
logmatch_func_t pfnHandle);
|
|
||||||
int (*pfnHookLogRegex) (plid_t plid, const char *pattern,
|
|
||||||
logmatch_func_t pfnHandle);
|
|
||||||
qboolean (*pfnRemoveHookID) (plid_t plid, int hookid);
|
|
||||||
int (*pfnRemoveHookAll) (plid_t plid);
|
|
||||||
#endif /* UNFINISHED */
|
|
||||||
} mutil_funcs_t;
|
|
||||||
extern mutil_funcs_t MetaUtilFunctions;
|
|
||||||
|
|
||||||
// Meta Utility Functions
|
// Meta Utility Functions
|
||||||
void mutil_LogConsole(plid_t plid, const char *fmt, ...);
|
void mutil_LogConsole(plid_t plid, const char *fmt, ...);
|
||||||
@ -96,10 +46,8 @@ void mutil_LogError(plid_t plid, const char *fmt, ...);
|
|||||||
void mutil_LogDeveloper(plid_t plid, const char *fmt, ...);
|
void mutil_LogDeveloper(plid_t plid, const char *fmt, ...);
|
||||||
|
|
||||||
void mutil_CenterSay(plid_t plid, const char *fmt, ...);
|
void mutil_CenterSay(plid_t plid, const char *fmt, ...);
|
||||||
void mutil_CenterSayParms(plid_t plid, hudtextparms_t tparms,
|
void mutil_CenterSayParms(plid_t plid, hudtextparms_t tparms, const char *fmt, ...);
|
||||||
const char *fmt, ...);
|
void mutil_CenterSayVarargs(plid_t plid, hudtextparms_t tparms, const char *fmt, va_list ap);
|
||||||
void mutil_CenterSayVarargs(plid_t plid, hudtextparms_t tparms,
|
|
||||||
const char *fmt, va_list ap);
|
|
||||||
|
|
||||||
qboolean mutil_CallGameEntity(plid_t plid, const char *entStr, entvars_t *pev);
|
qboolean mutil_CallGameEntity(plid_t plid, const char *entStr, entvars_t *pev);
|
||||||
|
|
||||||
@ -111,20 +59,6 @@ const char *mutil_IsQueryingClientCvar(plid_t plid, const edict_t *pEdict);
|
|||||||
int mutil_MakeRequestId(plid_t plid);
|
int mutil_MakeRequestId(plid_t plid);
|
||||||
void mutil_GetHookTables(plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll);
|
void mutil_GetHookTables(plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll);
|
||||||
|
|
||||||
#ifdef UNFINISHED
|
|
||||||
int mutil_HookGameEvent(plid_t plid, game_event_t event,
|
|
||||||
event_func_t pfnHandle);
|
|
||||||
int mutil_HookLogTrigger(plid_t plid, const char *trigger,
|
|
||||||
logmatch_func_t pfnHandle);
|
|
||||||
int mutil_HookLogString(plid_t plid, const char *string,
|
|
||||||
logmatch_func_t pfnHandle);
|
|
||||||
int mutil_HookLogRegex(plid_t plid, const char *pattern,
|
|
||||||
logmatch_func_t pfnHandle);
|
|
||||||
|
|
||||||
qboolean mutil_RemoveHookID(plid_t plid, int hookid);
|
|
||||||
int mutil_RemoveHookAll(plid_t plid);
|
|
||||||
#endif /* UNFINISHED */
|
|
||||||
|
|
||||||
// Convenience macros for MetaUtil functions
|
// Convenience macros for MetaUtil functions
|
||||||
#define LOG_CONSOLE (*gpMetaUtilFuncs->pfnLogConsole)
|
#define LOG_CONSOLE (*gpMetaUtilFuncs->pfnLogConsole)
|
||||||
#define LOG_MESSAGE (*gpMetaUtilFuncs->pfnLogMessage)
|
#define LOG_MESSAGE (*gpMetaUtilFuncs->pfnLogMessage)
|
||||||
@ -144,14 +78,3 @@ int mutil_RemoveHookAll(plid_t plid);
|
|||||||
#define IS_QUERYING_CLIENT_CVAR (*gpMetaUtilFuncs->pfnIsQueryingClientCvar)
|
#define IS_QUERYING_CLIENT_CVAR (*gpMetaUtilFuncs->pfnIsQueryingClientCvar)
|
||||||
#define MAKE_REQUESTID (*gpMetaUtilFuncs->pfnMakeRequestId)
|
#define MAKE_REQUESTID (*gpMetaUtilFuncs->pfnMakeRequestId)
|
||||||
#define GET_HOOK_TABLES (*gpMetaUtilFuncs->pfnGetHookTables)
|
#define GET_HOOK_TABLES (*gpMetaUtilFuncs->pfnGetHookTables)
|
||||||
|
|
||||||
#ifdef UNFINISHED
|
|
||||||
#define HOOK_GAME_EVENT (*gpMetaUtilFuncs->pfnHookGameEvent)
|
|
||||||
#define HOOK_LOG_TRIGGER (*gpMetaUtilFuncs->pfnHookLogTrigger)
|
|
||||||
#define HOOK_LOG_STRING (*gpMetaUtilFuncs->pfnHookLogString)
|
|
||||||
#define HOOK_LOG_REGEX (*gpMetaUtilFuncs->pfnHookLogRegex)
|
|
||||||
#define REMOVE_HOOK_ID (*gpMetaUtilFuncs->pfnRemoveHookID)
|
|
||||||
#define REMOVE_HOOK_ALL (*gpMetaUtilFuncs->pfnRemoveHookAll)
|
|
||||||
#endif /* UNFINISHED */
|
|
||||||
|
|
||||||
#endif /* MUTIL_H */
|
|
||||||
|
@ -1,519 +0,0 @@
|
|||||||
// osdep.h - operating system dependencies
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2001-2003 Will Day <willday@hpgx.net>
|
|
||||||
*
|
|
||||||
* This file is part of Metamod.
|
|
||||||
*
|
|
||||||
* Metamod is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Metamod is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Metamod; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* In addition, as a special exception, the author gives permission to
|
|
||||||
* link the code of this program with the Half-Life Game Engine ("HL
|
|
||||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
||||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
||||||
* respects for all of the code used other than the HL Engine and MODs
|
|
||||||
* from Valve. If you modify this file, you may extend this exception
|
|
||||||
* to your version of the file, but you are not obligated to do so. If
|
|
||||||
* you do not wish to do so, delete this exception statement from your
|
|
||||||
* version.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef OSDEP_H
|
|
||||||
#define OSDEP_H
|
|
||||||
|
|
||||||
#include <string.h> // strerror()
|
|
||||||
#include <ctype.h> // isupper, tolower
|
|
||||||
#include <errno.h> // errno
|
|
||||||
|
|
||||||
// Various differences between WIN32 and Linux.
|
|
||||||
|
|
||||||
#include "types_meta.h" // mBOOL
|
|
||||||
#include "mreg.h" // REG_CMD_FN, etc
|
|
||||||
#include "log_meta.h" // LOG_ERROR, etc
|
|
||||||
|
|
||||||
extern mBOOL dlclose_handle_invalid;
|
|
||||||
|
|
||||||
// String describing platform/DLL-type, for matching lines in plugins.ini.
|
|
||||||
#ifdef __linux__
|
|
||||||
#define PLATFORM "linux"
|
|
||||||
# ifdef __amd64__
|
|
||||||
#define PLATFORM_SPC "lin64"
|
|
||||||
# else
|
|
||||||
#define PLATFORM_SPC "lin32"
|
|
||||||
# endif
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
#define PLATFORM "mswin"
|
|
||||||
#define PLATFORM_SPC "win32"
|
|
||||||
#else /* unknown */
|
|
||||||
#error "OS unrecognized"
|
|
||||||
#endif /* unknown */
|
|
||||||
|
|
||||||
|
|
||||||
// Macro for function-exporting from DLL..
|
|
||||||
// from SDK dlls/cbase.h:
|
|
||||||
//! C functions for external declarations that call the appropriate C++ methods
|
|
||||||
|
|
||||||
// Windows uses "__declspec(dllexport)" to mark functions in the DLL that
|
|
||||||
// should be visible/callable externally.
|
|
||||||
//
|
|
||||||
// It also apparently requires WINAPI for GiveFnptrsToDll().
|
|
||||||
//
|
|
||||||
// See doc/notes_windows_coding for more information..
|
|
||||||
|
|
||||||
// Attributes to specify an "exported" function, visible from outside the
|
|
||||||
// DLL.
|
|
||||||
#undef DLLEXPORT
|
|
||||||
#ifdef _WIN32
|
|
||||||
#define DLLEXPORT __declspec(dllexport)
|
|
||||||
// WINAPI should be provided in the windows compiler headers.
|
|
||||||
// It's usually defined to something like "__stdcall".
|
|
||||||
#elif defined(__linux__)
|
|
||||||
#define DLLEXPORT /* */
|
|
||||||
#define WINAPI /* */
|
|
||||||
#endif /* linux */
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
# define DECLSPEC(kw)
|
|
||||||
# define ATTRIBUTE(kw) __attribute__((kw))
|
|
||||||
# define MM_CDECL
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
# define DECLSPEC(kw) __declspec(kw)
|
|
||||||
# define ATTRIBUTE(kw)
|
|
||||||
# define MM_CDECL __cdecl
|
|
||||||
#endif /* _MSC_VER */
|
|
||||||
|
|
||||||
|
|
||||||
// Simplified macro for declaring/defining exported DLL functions. They
|
|
||||||
// need to be 'extern "C"' so that the C++ compiler enforces parameter
|
|
||||||
// type-matching, rather than considering routines with mis-matched
|
|
||||||
// arguments/types to be overloaded functions...
|
|
||||||
//
|
|
||||||
// AFAIK, this is os-independent, but it's included here in osdep.h where
|
|
||||||
// DLLEXPORT is defined, for convenience.
|
|
||||||
#define C_DLLEXPORT extern "C" DLLEXPORT
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
// Disable MSVC warning:
|
|
||||||
// 4390 : empty controlled statement found; is this what was intended?
|
|
||||||
// generated by the RETURN macros.
|
|
||||||
#pragma warning(disable: 4390)
|
|
||||||
#endif /* _MSC_VER */
|
|
||||||
|
|
||||||
|
|
||||||
// Functions & types for DLL open/close/etc operations.
|
|
||||||
#ifdef __linux__
|
|
||||||
#include <dlfcn.h>
|
|
||||||
typedef void* DLHANDLE;
|
|
||||||
typedef void* DLFUNC;
|
|
||||||
inline DLHANDLE DLOPEN(const char *filename) {
|
|
||||||
return(dlopen(filename, RTLD_NOW));
|
|
||||||
}
|
|
||||||
inline DLFUNC DLSYM(DLHANDLE handle, const char *string) {
|
|
||||||
return(dlsym(handle, string));
|
|
||||||
}
|
|
||||||
inline int DLCLOSE(DLHANDLE handle) {
|
|
||||||
if (!handle) {
|
|
||||||
dlclose_handle_invalid = mTRUE;
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
dlclose_handle_invalid = mFALSE;
|
|
||||||
return(dlclose(handle));
|
|
||||||
}
|
|
||||||
inline char* DLERROR(void) {
|
|
||||||
if (dlclose_handle_invalid)
|
|
||||||
return("Invalid handle.");
|
|
||||||
return(dlerror());
|
|
||||||
}
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
typedef HINSTANCE DLHANDLE;
|
|
||||||
typedef FARPROC DLFUNC;
|
|
||||||
inline DLHANDLE DLOPEN(const char *filename) {
|
|
||||||
return(LoadLibrary(filename));
|
|
||||||
}
|
|
||||||
inline DLFUNC DLSYM(DLHANDLE handle, const char *string) {
|
|
||||||
return(GetProcAddress(handle, string));
|
|
||||||
}
|
|
||||||
inline int DLCLOSE(DLHANDLE handle) {
|
|
||||||
if (!handle) {
|
|
||||||
dlclose_handle_invalid = mTRUE;
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
dlclose_handle_invalid = mFALSE;
|
|
||||||
// NOTE: Windows FreeLibrary returns success=nonzero, fail=zero,
|
|
||||||
// which is the opposite of the unix convention, thus the '!'.
|
|
||||||
return(!FreeLibrary(handle));
|
|
||||||
}
|
|
||||||
// Windows doesn't provide a function corresponding to dlerror(), so
|
|
||||||
// we make our own.
|
|
||||||
char *str_GetLastError(void);
|
|
||||||
inline char* DLERROR(void) {
|
|
||||||
if (dlclose_handle_invalid)
|
|
||||||
return("Invalid handle.");
|
|
||||||
return(str_GetLastError());
|
|
||||||
}
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
const char *DLFNAME(void *memptr);
|
|
||||||
mBOOL IS_VALID_PTR(void *memptr);
|
|
||||||
|
|
||||||
|
|
||||||
// Attempt to call the given function pointer, without segfaulting.
|
|
||||||
mBOOL os_safe_call(REG_CMD_FN pfn);
|
|
||||||
|
|
||||||
|
|
||||||
// Windows doesn't have an strtok_r() routine, so we write our own.
|
|
||||||
#ifdef _WIN32
|
|
||||||
#define strtok_r(s, delim, ptrptr) my_strtok_r(s, delim, ptrptr)
|
|
||||||
char *my_strtok_r(char *s, const char *delim, char **ptrptr);
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
|
|
||||||
|
|
||||||
// Set filename and pathname maximum lengths. Note some windows compilers
|
|
||||||
// provide a <limits.h> which is incomplete and/or causes problems; see
|
|
||||||
// doc/windows_notes.txt for more information.
|
|
||||||
//
|
|
||||||
// Note that both OS's include room for null-termination:
|
|
||||||
// linux: "# chars in a path name including nul"
|
|
||||||
// win32: "note that the sizes include space for 0-terminator"
|
|
||||||
#ifdef __linux__
|
|
||||||
#include <limits.h>
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
#include <stdlib.h>
|
|
||||||
#define NAME_MAX _MAX_FNAME
|
|
||||||
#define PATH_MAX _MAX_PATH
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
|
|
||||||
|
|
||||||
// Various other windows routine differences.
|
|
||||||
#ifdef __linux__
|
|
||||||
#include <unistd.h> // sleep
|
|
||||||
#ifndef O_BINARY
|
|
||||||
#define O_BINARY 0
|
|
||||||
#endif
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
#define snprintf _snprintf
|
|
||||||
#define vsnprintf _vsnprintf
|
|
||||||
#define sleep(x) Sleep(x*1000)
|
|
||||||
#define strcasecmp _stricmp
|
|
||||||
#define strncasecmp _strnicmp
|
|
||||||
#include <io.h>
|
|
||||||
#define open _open
|
|
||||||
#define read _read
|
|
||||||
#define write _write
|
|
||||||
#define close _close
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#include <unistd.h> // getcwd
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
#include <direct.h> // getcwd
|
|
||||||
#endif /* _MSC_VER */
|
|
||||||
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#ifndef S_ISREG
|
|
||||||
// Linux gcc defines this; earlier mingw didn't, later mingw does;
|
|
||||||
// MSVC doesn't seem to.
|
|
||||||
#define S_ISREG(m) ((m) & S_IFREG)
|
|
||||||
#endif /* not S_ISREG */
|
|
||||||
#ifdef _WIN32
|
|
||||||
// The following two are defined in mingw but not in MSVC
|
|
||||||
#ifndef S_IRUSR
|
|
||||||
#define S_IRUSR _S_IREAD
|
|
||||||
#endif
|
|
||||||
#ifndef S_IWUSR
|
|
||||||
#define S_IWUSR _S_IWRITE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// The following two are defined neither in mingw nor in MSVC
|
|
||||||
#ifndef S_IRGRP
|
|
||||||
#define S_IRGRP S_IRUSR
|
|
||||||
#endif
|
|
||||||
#ifndef S_IWGRP
|
|
||||||
#define S_IWGRP S_IWUSR
|
|
||||||
#endif
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
|
|
||||||
|
|
||||||
// Our handler for new().
|
|
||||||
//
|
|
||||||
// Thanks to notes from:
|
|
||||||
// http://dragon.klte.hu/~kollarl/C++/node45.html
|
|
||||||
//
|
|
||||||
// At one point it appeared MSVC++ was no longer different from gcc, according
|
|
||||||
// to:
|
|
||||||
// http://msdn.microsoft.com/library/en-us/vclang98/stdlib/info/NEW.asp
|
|
||||||
//
|
|
||||||
// However, this page is apparently no longer available from MSDN. The
|
|
||||||
// only thing now is:
|
|
||||||
// http://msdn.microsoft.com/library/en-us/vccore98/HTML/_crt_malloc.asp
|
|
||||||
//
|
|
||||||
// According to Fritz Elfert <felfert@to.com>:
|
|
||||||
// set_new_handler() is just a stub which (according to comments in the
|
|
||||||
// MSVCRT debugging sources) should never be used. It is just an ugly
|
|
||||||
// hack to make STL compile. It does _not_ set the new handler but
|
|
||||||
// always calls _set_new_handler(0) instead. _set_new_handler is the
|
|
||||||
// "real" function and uses the "old" semantic; handler-type is:
|
|
||||||
// int newhandler(size_t)
|
|
||||||
//
|
|
||||||
#if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 1300))
|
|
||||||
void MM_CDECL meta_new_handler(void);
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
int meta_new_handler(size_t size);
|
|
||||||
#endif /* _MSC_VER */
|
|
||||||
|
|
||||||
|
|
||||||
// To keep the rest of the sources clean and keep not only OS but also
|
|
||||||
// compiler dependant differences in this file, we define a local function
|
|
||||||
// to set the new handler.
|
|
||||||
void mm_set_new_handler( void );
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Thread handling...
|
|
||||||
#ifdef __linux__
|
|
||||||
#include <pthread.h>
|
|
||||||
typedef pthread_t THREAD_T;
|
|
||||||
// returns 0==success, non-zero==failure
|
|
||||||
inline int THREAD_CREATE(THREAD_T *tid, void (*func)(void)) {
|
|
||||||
int ret;
|
|
||||||
ret=pthread_create(tid, NULL, (void *(*)(void*)) func, NULL);
|
|
||||||
if(ret != 0) {
|
|
||||||
META_ERROR("Failure starting thread: %s", strerror(ret));
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
ret=pthread_detach(*tid);
|
|
||||||
if(ret != 0)
|
|
||||||
META_ERROR("Failure detaching thread: %s", strerror(ret));
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
// See:
|
|
||||||
// http://msdn.microsoft.com/library/en-us/dllproc/prothred_4084.asp
|
|
||||||
typedef DWORD THREAD_T;
|
|
||||||
// returns 0==success, non-zero==failure
|
|
||||||
inline int THREAD_CREATE(THREAD_T *tid, void (*func)(void)) {
|
|
||||||
HANDLE ret;
|
|
||||||
// win32 returns NULL==failure, non-NULL==success
|
|
||||||
ret=CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) func, NULL, 0, tid);
|
|
||||||
if(ret==NULL)
|
|
||||||
META_ERROR("Failure starting thread: %s", str_GetLastError());
|
|
||||||
return(ret==NULL);
|
|
||||||
}
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
#define THREAD_OK 0
|
|
||||||
|
|
||||||
|
|
||||||
// Mutex handling...
|
|
||||||
#ifdef __linux__
|
|
||||||
typedef pthread_mutex_t MUTEX_T;
|
|
||||||
inline int MUTEX_INIT(MUTEX_T *mutex) {
|
|
||||||
int ret;
|
|
||||||
ret=pthread_mutex_init(mutex, NULL);
|
|
||||||
if(ret!=THREAD_OK)
|
|
||||||
META_ERROR("mutex_init failed: %s", strerror(ret));
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
inline int MUTEX_LOCK(MUTEX_T *mutex) {
|
|
||||||
int ret;
|
|
||||||
ret=pthread_mutex_lock(mutex);
|
|
||||||
if(ret!=THREAD_OK)
|
|
||||||
META_ERROR("mutex_lock failed: %s", strerror(ret));
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
inline int MUTEX_UNLOCK(MUTEX_T *mutex) {
|
|
||||||
int ret;
|
|
||||||
ret=pthread_mutex_unlock(mutex);
|
|
||||||
if(ret!=THREAD_OK)
|
|
||||||
META_ERROR("mutex_unlock failed: %s", strerror(ret));
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
// Win32 has "mutexes" as well, but CS's are simpler.
|
|
||||||
// See:
|
|
||||||
// http://msdn.microsoft.com/library/en-us/dllproc/synchro_2a2b.asp
|
|
||||||
typedef CRITICAL_SECTION MUTEX_T;
|
|
||||||
// Note win32 routines don't return any error (return void).
|
|
||||||
inline int MUTEX_INIT(MUTEX_T *mutex) {
|
|
||||||
InitializeCriticalSection(mutex);
|
|
||||||
return(THREAD_OK);
|
|
||||||
}
|
|
||||||
inline int MUTEX_LOCK(MUTEX_T *mutex) {
|
|
||||||
EnterCriticalSection(mutex);
|
|
||||||
return(THREAD_OK);
|
|
||||||
}
|
|
||||||
inline int MUTEX_UNLOCK(MUTEX_T *mutex) {
|
|
||||||
LeaveCriticalSection(mutex);
|
|
||||||
return(THREAD_OK);
|
|
||||||
}
|
|
||||||
#endif /* _WIN32 (mutex) */
|
|
||||||
|
|
||||||
|
|
||||||
// Condition variables...
|
|
||||||
#ifdef __linux__
|
|
||||||
typedef pthread_cond_t COND_T;
|
|
||||||
inline int COND_INIT(COND_T *cond) {
|
|
||||||
int ret;
|
|
||||||
ret=pthread_cond_init(cond, NULL);
|
|
||||||
if(ret!=THREAD_OK)
|
|
||||||
META_ERROR("cond_init failed: %s", strerror(ret));
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
inline int COND_WAIT(COND_T *cond, MUTEX_T *mutex) {
|
|
||||||
int ret;
|
|
||||||
ret=pthread_cond_wait(cond, mutex);
|
|
||||||
if(ret!=THREAD_OK)
|
|
||||||
META_ERROR("cond_wait failed: %s", strerror(ret));
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
inline int COND_SIGNAL(COND_T *cond) {
|
|
||||||
int ret;
|
|
||||||
ret=pthread_cond_signal(cond);
|
|
||||||
if(ret!=THREAD_OK)
|
|
||||||
META_ERROR("cond_signal failed: %s", strerror(ret));
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
// Since win32 doesn't provide condition-variables, we have to model
|
|
||||||
// them with mutex/critical-sections and win32 events. This uses the
|
|
||||||
// second (SetEvent) solution from:
|
|
||||||
//
|
|
||||||
// http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
|
|
||||||
//
|
|
||||||
// but without the waiters_count overhead, since we don't need
|
|
||||||
// broadcast functionality anyway. Or actually, I guess it's more like
|
|
||||||
// the first (PulseEvent) solution, but with SetEven rather than
|
|
||||||
// PulseEvent. :)
|
|
||||||
//
|
|
||||||
// See also:
|
|
||||||
// http://msdn.microsoft.com/library/en-us/dllproc/synchro_8ann.asp
|
|
||||||
typedef HANDLE COND_T;
|
|
||||||
inline int COND_INIT(COND_T *cond) {
|
|
||||||
*cond = CreateEvent(NULL, // security attributes (none)
|
|
||||||
FALSE, // manual-reset type (false==auto-reset)
|
|
||||||
FALSE, // initial state (unsignaled)
|
|
||||||
NULL); // object name (unnamed)
|
|
||||||
// returns NULL on error
|
|
||||||
if(*cond==NULL) {
|
|
||||||
META_ERROR("cond_init failed: %s", str_GetLastError());
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
inline int COND_WAIT(COND_T *cond, MUTEX_T *mutex) {
|
|
||||||
DWORD ret;
|
|
||||||
LeaveCriticalSection(mutex);
|
|
||||||
ret=WaitForSingleObject(*cond, INFINITE);
|
|
||||||
EnterCriticalSection(mutex);
|
|
||||||
// returns WAIT_OBJECT_0 if object was signaled; other return
|
|
||||||
// values indicate errors.
|
|
||||||
if(ret == WAIT_OBJECT_0)
|
|
||||||
return(0);
|
|
||||||
else {
|
|
||||||
META_ERROR("cond_wait failed: %s", str_GetLastError());
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inline int COND_SIGNAL(COND_T *cond) {
|
|
||||||
BOOL ret;
|
|
||||||
ret=SetEvent(*cond);
|
|
||||||
// returns zero on failure
|
|
||||||
if(ret==0) {
|
|
||||||
META_ERROR("cond_signal failed: %s", str_GetLastError());
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
#endif /* _WIN32 (condition variable) */
|
|
||||||
|
|
||||||
// Normalize/standardize a pathname.
|
|
||||||
// - For win32, this involves:
|
|
||||||
// - Turning backslashes (\) into slashes (/), so that config files and
|
|
||||||
// Metamod internal code can be simpler and just use slashes (/).
|
|
||||||
// - Turning upper/mixed case into lowercase, since windows is
|
|
||||||
// non-case-sensitive.
|
|
||||||
// - For linux, this requires no work, as paths uses slashes (/) natively,
|
|
||||||
// and pathnames are case-sensitive.
|
|
||||||
#ifdef __linux__
|
|
||||||
#define normalize_pathname(a)
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
inline void normalize_pathname(char *path) {
|
|
||||||
char *cp;
|
|
||||||
|
|
||||||
META_DEBUG(8, ("normalize: %s", path));
|
|
||||||
for(cp=path; *cp; cp++) {
|
|
||||||
if(isupper(*cp)) *cp=tolower(*cp);
|
|
||||||
if(*cp=='\\') *cp='/';
|
|
||||||
}
|
|
||||||
META_DEBUG(8, ("normalized: %s", path));
|
|
||||||
}
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
|
|
||||||
// Indicate if pathname appears to be an absolute-path. Under linux this
|
|
||||||
// is a leading slash (/). Under win32, this can be:
|
|
||||||
// - a drive-letter path (ie "D:blah" or "C:\blah")
|
|
||||||
// - a toplevel path (ie "\blah")
|
|
||||||
// - a UNC network address (ie "\\srv1\blah").
|
|
||||||
// Also, handle both native and normalized pathnames.
|
|
||||||
inline int is_absolute_path(const char *path) {
|
|
||||||
if(path[0]=='/') return(TRUE);
|
|
||||||
#ifdef _WIN32
|
|
||||||
if(path[1]==':') return(TRUE);
|
|
||||||
if(path[0]=='\\') return(TRUE);
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
// Buffer pointed to by resolved_name is assumed to be able to store a
|
|
||||||
// string of PATH_MAX length.
|
|
||||||
inline char *realpath(const char *file_name, char *resolved_name) {
|
|
||||||
int ret;
|
|
||||||
ret=GetFullPathName(file_name, PATH_MAX, resolved_name, NULL);
|
|
||||||
if(ret > PATH_MAX) {
|
|
||||||
errno=ENAMETOOLONG;
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
else if(ret > 0) {
|
|
||||||
HANDLE handle;
|
|
||||||
WIN32_FIND_DATA find_data;
|
|
||||||
handle=FindFirstFile(resolved_name, &find_data);
|
|
||||||
if(INVALID_HANDLE_VALUE == handle) {
|
|
||||||
errno=ENOENT;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
FindClose(handle);
|
|
||||||
normalize_pathname(resolved_name);
|
|
||||||
return(resolved_name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
|
|
||||||
// Generic "error string" from a recent OS call. For linux, this is based
|
|
||||||
// on errno. For win32, it's based on GetLastError.
|
|
||||||
inline const char *str_os_error(void) {
|
|
||||||
#ifdef __linux__
|
|
||||||
return(strerror(errno));
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
return(str_GetLastError());
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* OSDEP_H */
|
|
@ -1,79 +1,48 @@
|
|||||||
// plinfo.h - typedefs for plugin info structure
|
#pragma once
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2001-2003 Will Day <willday@hpgx.net>
|
|
||||||
*
|
|
||||||
* This file is part of Metamod.
|
|
||||||
*
|
|
||||||
* Metamod is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Metamod is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Metamod; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* In addition, as a special exception, the author gives permission to
|
|
||||||
* link the code of this program with the Half-Life Game Engine ("HL
|
|
||||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
||||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
||||||
* respects for all of the code used other than the HL Engine and MODs
|
|
||||||
* from Valve. If you modify this file, you may extend this exception
|
|
||||||
* to your version of the file, but you are not obligated to do so. If
|
|
||||||
* you do not wish to do so, delete this exception statement from your
|
|
||||||
* version.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PLINFO_H
|
|
||||||
#define PLINFO_H
|
|
||||||
|
|
||||||
// Flags for plugin to indicate when it can be be loaded/unloaded.
|
// Flags for plugin to indicate when it can be be loaded/unloaded.
|
||||||
// NOTE: order is crucial, as greater/less comparisons are made.
|
// NOTE: order is crucial, as greater/less comparisons are made.
|
||||||
typedef enum {
|
enum PLUG_LOADTIME
|
||||||
|
{
|
||||||
PT_NEVER = 0,
|
PT_NEVER = 0,
|
||||||
PT_STARTUP, // should only be loaded/unloaded at initial hlds execution
|
PT_STARTUP, // should only be loaded/unloaded at initial hlds execution
|
||||||
PT_CHANGELEVEL, // can be loaded/unloaded between maps
|
PT_CHANGELEVEL, // can be loaded/unloaded between maps
|
||||||
PT_ANYTIME, // can be loaded/unloaded at any time
|
PT_ANYTIME, // can be loaded/unloaded at any time
|
||||||
PT_ANYPAUSE, // can be loaded/unloaded at any time, and can be "paused" during a map
|
PT_ANYPAUSE, // can be loaded/unloaded at any time, and can be "paused" during a map
|
||||||
} PLUG_LOADTIME;
|
};
|
||||||
|
|
||||||
// Flags to indicate why the plugin is being unloaded.
|
// Flags to indicate why the plugin is being unloaded.
|
||||||
typedef enum {
|
enum PL_UNLOAD_REASON
|
||||||
|
{
|
||||||
PNL_NULL = 0,
|
PNL_NULL = 0,
|
||||||
PNL_INI_DELETED, // was deleted from plugins.ini
|
PNL_INI_DELETED, // was deleted from plugins.ini
|
||||||
PNL_FILE_NEWER, // file on disk is newer than last load
|
PNL_FILE_NEWER, // file on disk is newer than last load
|
||||||
PNL_COMMAND, // requested by server/console command
|
PNL_COMMAND, // requested by server/console command
|
||||||
PNL_CMD_FORCED, // forced by server/console command
|
PNL_CMD_FORCED, // forced by server/console command
|
||||||
PNL_DELAYED, // delayed from previous request; can't tell origin
|
PNL_DELAYED, // delayed from previous request; can't tell origin
|
||||||
//only used for 'real_reason' on MPlugin::unload()
|
|
||||||
PNL_PLUGIN, // requested by plugin function call
|
// only used for 'real_reason' on MPlugin::unload()
|
||||||
|
PNL_PLUGIN, // requested by plugin function call
|
||||||
PNL_PLG_FORCED, // forced by plugin function call
|
PNL_PLG_FORCED, // forced by plugin function call
|
||||||
PNL_RELOAD, // forced unload by reload()
|
PNL_RELOAD, // forced unload by reload()
|
||||||
} PL_UNLOAD_REASON;
|
};
|
||||||
|
|
||||||
// Information plugin provides about itself.
|
// Information plugin provides about itself.
|
||||||
typedef struct {
|
struct plugin_info_t
|
||||||
char *ifvers; // meta_interface version
|
{
|
||||||
char *name; // full name of plugin
|
const char *ifvers; // meta_interface version
|
||||||
char *version; // version
|
const char *name; // full name of plugin
|
||||||
char *date; // date
|
const char *version; // version
|
||||||
char *author; // author name/email
|
const char *date; // date
|
||||||
char *url; // URL
|
const char *author; // author name/email
|
||||||
char *logtag; // log message prefix (unused right now)
|
const char *url; // URL
|
||||||
|
const char *logtag; // log message prefix (unused right now)
|
||||||
PLUG_LOADTIME loadable; // when loadable
|
PLUG_LOADTIME loadable; // when loadable
|
||||||
PLUG_LOADTIME unloadable; // when unloadable
|
PLUG_LOADTIME unloadable; // when unloadable
|
||||||
} plugin_info_t;
|
};
|
||||||
|
|
||||||
extern plugin_info_t Plugin_info;
|
extern plugin_info_t Plugin_info;
|
||||||
|
|
||||||
// Plugin identifier, passed to all Meta Utility Functions.
|
// Plugin identifier, passed to all Meta Utility Functions.
|
||||||
typedef plugin_info_t* plid_t;
|
typedef plugin_info_t *plid_t;
|
||||||
#define PLID &Plugin_info
|
#define PLID &Plugin_info
|
||||||
|
|
||||||
#endif /* PLINFO_H */
|
|
||||||
|
@ -1,98 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2001-2003 Will Day <willday@hpgx.net>
|
|
||||||
*
|
|
||||||
* This file is part of Metamod.
|
|
||||||
*
|
|
||||||
* Metamod is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Metamod is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Metamod; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* In addition, as a special exception, the author gives permission to
|
|
||||||
* link the code of this program with the Half-Life Game Engine ("HL
|
|
||||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
||||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
||||||
* respects for all of the code used other than the HL Engine and MODs
|
|
||||||
* from Valve. If you modify this file, you may extend this exception
|
|
||||||
* to your version of the file, but you are not obligated to do so. If
|
|
||||||
* you do not wish to do so, delete this exception statement from your
|
|
||||||
* version.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Wrap util.h from SDK with ifndef/endif, to avoid problems from multiple
|
|
||||||
// inclusions. Dunno why Valve didn't do that in util.h themselves..
|
|
||||||
|
|
||||||
#ifndef SDK_UTIL_H
|
|
||||||
#define SDK_UTIL_H
|
|
||||||
|
|
||||||
// We're not including the DBG_EntOfVars and DBG_AssertFunction routines
|
|
||||||
// mentioned in the SDK util.h, so we're going to unset DEBUG here so that
|
|
||||||
// we don't get "unresolved symbol" errors.
|
|
||||||
#ifdef DEBUG
|
|
||||||
#undef DEBUG
|
|
||||||
#endif // DEBUG
|
|
||||||
|
|
||||||
// Inlcude local enginecallbacks wrapper *first* so that the g_engfuncs
|
|
||||||
// type is correct and the <enginecallback.h> header protection is already
|
|
||||||
// defined.
|
|
||||||
#include "enginecallbacks.h"
|
|
||||||
#include <util.h>
|
|
||||||
|
|
||||||
// Also, create some nice inlines for engine callback combos.
|
|
||||||
|
|
||||||
// Get a setinfo value from a player entity.
|
|
||||||
inline char *ENTITY_KEYVALUE(edict_t *entity, char *key) {
|
|
||||||
char *ifbuf=GET_INFOKEYBUFFER(entity);
|
|
||||||
return(INFOKEY_VALUE(ifbuf, key));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set a setinfo value for a player entity.
|
|
||||||
inline void ENTITY_SET_KEYVALUE(edict_t *entity, char *key, char *value) {
|
|
||||||
char *ifbuf=GET_INFOKEYBUFFER(entity);
|
|
||||||
SET_CLIENT_KEYVALUE(ENTINDEX(entity), ifbuf, key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a "serverinfo" value.
|
|
||||||
inline char *SERVERINFO(char *key) {
|
|
||||||
edict_t *server=INDEXENT(0);
|
|
||||||
return(ENTITY_KEYVALUE(server, key));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set a "serverinfo" value.
|
|
||||||
inline void SET_SERVERINFO(char *key, char *value) {
|
|
||||||
edict_t *server=INDEXENT(0);
|
|
||||||
char *ifbuf=GET_INFOKEYBUFFER(server);
|
|
||||||
SET_SERVER_KEYVALUE(ifbuf, key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a "localinfo" value.
|
|
||||||
inline char *LOCALINFO(char *key) {
|
|
||||||
edict_t *server=NULL;
|
|
||||||
return(ENTITY_KEYVALUE(server, key));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set a "localinfo" value.
|
|
||||||
inline void SET_LOCALINFO(char *key, char *value) {
|
|
||||||
edict_t *server=NULL;
|
|
||||||
char *ifbuf=GET_INFOKEYBUFFER(server);
|
|
||||||
SET_SERVER_KEYVALUE(ifbuf, key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
short FixedSigned16(float value, float scale);
|
|
||||||
unsigned short FixedUnsigned16(float value, float scale);
|
|
||||||
|
|
||||||
// Our slightly modified version, using an edict_t pointer instead of a
|
|
||||||
// CBaseEntity pointer.
|
|
||||||
void META_UTIL_HudMessage(edict_t *pEntity, const hudtextparms_t &textparms, const char *pMessage);
|
|
||||||
|
|
||||||
#endif // SDK_UTIL_H
|
|
@ -1,79 +0,0 @@
|
|||||||
// types_meta.h - common internal type, etc definitions
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2001-2003 Will Day <willday@hpgx.net>
|
|
||||||
*
|
|
||||||
* This file is part of Metamod.
|
|
||||||
*
|
|
||||||
* Metamod is free software; you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the
|
|
||||||
* Free Software Foundation; either version 2 of the License, or (at
|
|
||||||
* your option) any later version.
|
|
||||||
*
|
|
||||||
* Metamod is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Metamod; if not, write to the Free Software Foundation,
|
|
||||||
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
* In addition, as a special exception, the author gives permission to
|
|
||||||
* link the code of this program with the Half-Life Game Engine ("HL
|
|
||||||
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
|
|
||||||
* L.L.C ("Valve"). You must obey the GNU General Public License in all
|
|
||||||
* respects for all of the code used other than the HL Engine and MODs
|
|
||||||
* from Valve. If you modify this file, you may extend this exception
|
|
||||||
* to your version of the file, but you are not obligated to do so. If
|
|
||||||
* you do not wish to do so, delete this exception statement from your
|
|
||||||
* version.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef TYPES_META_H
|
|
||||||
#define TYPES_META_H
|
|
||||||
|
|
||||||
// Our own boolean type, for stricter type matching.
|
|
||||||
typedef enum mBOOL {
|
|
||||||
mFALSE = 0,
|
|
||||||
mTRUE,
|
|
||||||
} mBOOL;
|
|
||||||
|
|
||||||
// Like C's errno, for our various functions; describes causes of failure
|
|
||||||
// or mFALSE returns.
|
|
||||||
typedef enum {
|
|
||||||
ME_NOERROR = 0,
|
|
||||||
ME_FORMAT, // invalid format
|
|
||||||
ME_COMMENT, // ignored comment
|
|
||||||
ME_BLANK, // ignored blank (empty) line
|
|
||||||
ME_ALREADY, // request had already been done
|
|
||||||
ME_DELAYED, // request is delayed
|
|
||||||
ME_NOTALLOWED, // request not allowed
|
|
||||||
ME_SKIPPED, // request is being skipped for whatever reason
|
|
||||||
ME_BADREQ, // invalid request for this <whatever>
|
|
||||||
ME_ARGUMENT, // invalid arguments
|
|
||||||
ME_NULLRESULT, // resulting data was empty or null
|
|
||||||
ME_MAXREACHED, // reached max/limit
|
|
||||||
ME_NOTUNIQ, // not unique (ambigious match)
|
|
||||||
ME_NOTFOUND, // in find operation, match not found
|
|
||||||
ME_NOFILE, // file empty or missing
|
|
||||||
ME_NOMEM, // malloc failed
|
|
||||||
ME_BADMEMPTR, // invalid memory address
|
|
||||||
ME_OSNOTSUP, // OS doesn't support this operation
|
|
||||||
ME_DLOPEN, // failed to open shared lib/dll
|
|
||||||
ME_DLMISSING, // symbol missing in lib/dll
|
|
||||||
ME_DLERROR, // some other error encountered calling functions from dll
|
|
||||||
ME_IFVERSION, // incompatible interface version
|
|
||||||
ME_UNLOAD_UNLOADER, // tried to unload unloader
|
|
||||||
ME_UNLOAD_SELF, // tried to unload self
|
|
||||||
} META_ERRNO;
|
|
||||||
extern META_ERRNO meta_errno;
|
|
||||||
|
|
||||||
#define RETURN_ERRNO(retval, errval) \
|
|
||||||
do { meta_errno=errval; return(retval); } while(0)
|
|
||||||
|
|
||||||
#define RETURN_LOGERR_ERRNO(errargs, retval, errval) \
|
|
||||||
do { META_ERROR errargs ; meta_errno=errval; return(retval); } while(0)
|
|
||||||
|
|
||||||
#endif /* TYPES_META_H */
|
|
@ -4,6 +4,7 @@
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define DLLEXPORT __declspec(dllexport)
|
#define DLLEXPORT __declspec(dllexport)
|
||||||
#define NOINLINE __declspec(noinline)
|
#define NOINLINE __declspec(noinline)
|
||||||
|
#define snprintf _snprintf
|
||||||
#else
|
#else
|
||||||
#define DLLEXPORT __attribute__((visibility("default")))
|
#define DLLEXPORT __attribute__((visibility("default")))
|
||||||
#define NOINLINE __attribute__((noinline))
|
#define NOINLINE __attribute__((noinline))
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include <vector> // std::vector
|
#include <vector> // std::vector
|
||||||
|
|
||||||
// platform defs
|
// platform defs
|
||||||
#include <platform.h>
|
#include "platform.h"
|
||||||
|
|
||||||
// cssdk
|
// cssdk
|
||||||
#include <extdll.h>
|
#include <extdll.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user