trace_plugin/dllapi.cpp
author darope
Tue Aug 23 20:31:28 2005 +0000 (2005-08-23)
changeset 248 f72386298cba
parent 0 d15304fcb7a7
child 249 0e54d20d8f28
permissions -rw-r--r--
Merged with working branch (bt-release-1_17_4) for release 1.18
     1 // vi: set ts=4 sw=4 :
     2 // vim: set tw=75 :
     3 
     4 // dllapi.cpp - implementation of Half-Life DLL routines
     5 
     6 /*
     7  * Copyright (c) 2001-2003 Will Day <[email protected]>
     8  *
     9  *    This file is part of Metamod.
    10  *
    11  *    Metamod is free software; you can redistribute it and/or modify it
    12  *    under the terms of the GNU General Public License as published by the
    13  *    Free Software Foundation; either version 2 of the License, or (at
    14  *    your option) any later version.
    15  *
    16  *    Metamod is distributed in the hope that it will be useful, but
    17  *    WITHOUT ANY WARRANTY; without even the implied warranty of
    18  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    19  *    General Public License for more details.
    20  *
    21  *    You should have received a copy of the GNU General Public License
    22  *    along with Metamod; if not, write to the Free Software Foundation,
    23  *    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    24  *
    25  *    In addition, as a special exception, the author gives permission to
    26  *    link the code of this program with the Half-Life Game Engine ("HL
    27  *    Engine") and Modified Game Libraries ("MODs") developed by Valve,
    28  *    L.L.C ("Valve").  You must obey the GNU General Public License in all
    29  *    respects for all of the code used other than the HL Engine and MODs
    30  *    from Valve.  If you modify this file, you may extend this exception
    31  *    to your version of the file, but you are not obligated to do so.  If
    32  *    you do not wish to do so, delete this exception statement from your
    33  *    version.
    34  *
    35  */
    36 
    37 #include <extdll.h>
    38 #include <sdk_util.h>
    39 #include <cbase.h>
    40 #include <player.h>
    41 
    42 #include <dllapi.h>
    43 #include <meta_api.h>
    44 #include <sdk_util.h>
    45 
    46 #include "trace_api.h"
    47 #include "log_plugin.h"
    48 
    49 // from SDK dlls/game.cpp:
    50 void GameDLLInit( void ) {
    51 	DLL_TRACE(pfnGameInit, P_PRE, (""));
    52 	RETURN_META(MRES_IGNORED);
    53 }
    54 
    55 // from SDK dlls/cbase.cpp:
    56 int DispatchSpawn( edict_t *pent ) {
    57 	edict_t *ed=pent;
    58 	DLL_TRACE(pfnSpawn, P_PRE, ("classname=%s",
    59 				ed ? STRING(ed->v.classname) : "nil"));
    60 	// 0==Success, -1==Failure ?
    61 	RETURN_META_VALUE(MRES_IGNORED, 0);
    62 }
    63 void DispatchThink( edict_t *pent ) {
    64 	DLL_TRACE(pfnThink, P_PRE, (""));
    65 	RETURN_META(MRES_IGNORED);
    66 }
    67 void DispatchUse( edict_t *pentUsed, edict_t *pentOther ) {
    68 	DLL_TRACE(pfnUse, P_PRE, (""));
    69 	RETURN_META(MRES_IGNORED);
    70 }
    71 void DispatchTouch( edict_t *pentTouched, edict_t *pentOther ) {
    72 	DLL_TRACE(pfnTouch, P_PRE, (""));
    73 	RETURN_META(MRES_IGNORED);
    74 }
    75 void DispatchBlocked( edict_t *pentBlocked, edict_t *pentOther ) {
    76 	DLL_TRACE(pfnBlocked, P_PRE, (""));
    77 	RETURN_META(MRES_IGNORED);
    78 }
    79 void DispatchKeyValue( edict_t *pentKeyvalue, KeyValueData *pkvd ) {
    80 	DLL_TRACE(pfnKeyValue, P_PRE, ("classname=%s keyname=%s value=%s", P_PRE,
    81 			pkvd->szClassName, pkvd->szKeyName, pkvd->szValue));
    82 	RETURN_META(MRES_IGNORED);
    83 }
    84 void DispatchSave( edict_t *pent, SAVERESTOREDATA *pSaveData ) {
    85 	DLL_TRACE(pfnSave, P_PRE, (""));
    86 	RETURN_META(MRES_IGNORED);
    87 }
    88 int DispatchRestore( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity ) {
    89 	DLL_TRACE(pfnRestore, P_PRE, (""));
    90 	// 0==Success, -1==Failure ?
    91 	RETURN_META_VALUE(MRES_IGNORED, 0);
    92 }
    93 void DispatchObjectCollsionBox( edict_t *pent ) {
    94 	edict_t *ed=pent;
    95 	DLL_TRACE(pfnSetAbsBox, P_PRE, ("classname=%s netname=%s",
    96 				ed ? STRING(ed->v.classname) : "nil",
    97 				ed ? STRING(ed->v.netname) : "nil"));
    98 	RETURN_META(MRES_IGNORED);
    99 }
   100 void SaveWriteFields( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount ) {
   101 	DLL_TRACE(pfnSaveWriteFields, P_PRE, (""));
   102 	RETURN_META(MRES_IGNORED);
   103 }
   104 void SaveReadFields( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount ) {
   105 	DLL_TRACE(pfnSaveReadFields, P_PRE, (""));
   106 	RETURN_META(MRES_IGNORED);
   107 }
   108 
   109 // from SDK dlls/world.cpp:
   110 void SaveGlobalState( SAVERESTOREDATA *pSaveData ) {
   111 	DLL_TRACE(pfnSaveGlobalState, P_PRE, (""));
   112 	RETURN_META(MRES_IGNORED);
   113 }
   114 void RestoreGlobalState( SAVERESTOREDATA *pSaveData ) {
   115 	DLL_TRACE(pfnRestoreGlobalState, P_PRE, (""));
   116 	RETURN_META(MRES_IGNORED);
   117 }
   118 void ResetGlobalState( void ) {
   119 	DLL_TRACE(pfnResetGlobalState, P_PRE, (""));
   120 	RETURN_META(MRES_IGNORED);
   121 }
   122 
   123 //! from SDK dlls/client.cpp:
   124 BOOL ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ]  ) {
   125 	DLL_TRACE(pfnClientConnect, P_PRE, ("name=%s, addr=%s", pszName, pszAddress));
   126 	RETURN_META_VALUE(MRES_IGNORED, FALSE);
   127 }
   128 void ClientDisconnect( edict_t *pEntity ) {
   129 	// DLL_TRACE(pfnClientDisconnect, P_PRE, ("name=%s", ENTITY_KEYVALUE(pEntity, "name")));
   130 	DLL_TRACE(pfnClientDisconnect, P_PRE, ("name=%s", STRING(pEntity->v.netname)));
   131 	RETURN_META(MRES_IGNORED);
   132 }
   133 void ClientKill( edict_t *pEntity ) {
   134 	DLL_TRACE(pfnClientKill, P_PRE, ("name=%s", STRING(pEntity->v.netname)));
   135 	RETURN_META(MRES_IGNORED);
   136 }
   137 void ClientPutInServer( edict_t *pEntity ) {
   138 	CBaseEntity *pPlayer=NULL;
   139 	pPlayer=(CBasePlayer*)GET_PRIVATE(pEntity);
   140 	DLL_TRACE(pfnClientPutInServer, P_PRE, ("name=%s", STRING(pEntity->v.netname)));
   141 	RETURN_META(MRES_IGNORED);
   142 }
   143 void ClientCommand( edict_t *pEntity ) {
   144 	DLL_TRACE(pfnClientCommand, P_PRE, ("name=%s, cmd='%s %s'", STRING(pEntity->v.netname), CMD_ARGV(0), 
   145 				CMD_ARGC() >= 1 ? CMD_ARGS() : ""));
   146 	RETURN_META(MRES_IGNORED);
   147 }
   148 void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer ) {
   149 	DLL_TRACE(pfnClientUserInfoChanged, P_PRE, ("name=%s", STRING(pEntity->v.netname)));
   150 	RETURN_META(MRES_IGNORED);
   151 }
   152 void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax ) {
   153 	DLL_TRACE(pfnServerActivate, P_PRE, ("count=%d, max=%d", edictCount, clientMax));
   154 	RETURN_META(MRES_IGNORED);
   155 }
   156 void ServerDeactivate( void ) {
   157 	DLL_TRACE(pfnServerDeactivate, P_PRE, (""));
   158 	RETURN_META(MRES_IGNORED);
   159 }
   160 void PlayerPreThink( edict_t *pEntity ) {
   161 	DLL_TRACE(pfnPlayerPreThink, P_PRE, ("name=%s", STRING(pEntity->v.netname)));
   162 	RETURN_META(MRES_IGNORED);
   163 }
   164 void PlayerPostThink( edict_t *pEntity ) {
   165 	DLL_TRACE(pfnPlayerPostThink, P_PRE, ("name=%s", STRING(pEntity->v.netname)));
   166 	RETURN_META(MRES_IGNORED);
   167 }
   168 void StartFrame( void ) {
   169 	DLL_TRACE(pfnStartFrame, P_PRE, (""));
   170 	RETURN_META(MRES_IGNORED);
   171 }
   172 void ParmsNewLevel( void ) {
   173 	DLL_TRACE(pfnParmsNewLevel, P_PRE, (""));
   174 	RETURN_META(MRES_IGNORED);
   175 }
   176 void ParmsChangeLevel( void ) {
   177 	DLL_TRACE(pfnParmsChangeLevel, P_PRE, (""));
   178 	RETURN_META(MRES_IGNORED);
   179 }
   180 const char *GetGameDescription( void ) {
   181 	DLL_TRACE(pfnGetGameDescription, P_PRE, (""));
   182 	RETURN_META_VALUE(MRES_IGNORED, "");
   183 }
   184 void PlayerCustomization( edict_t *pEntity, customization_t *pCust ) {
   185 	DLL_TRACE(pfnPlayerCustomization, P_PRE, ("name=%s", STRING(pEntity->v.netname)));
   186 	RETURN_META(MRES_IGNORED);
   187 }
   188 void SpectatorConnect( edict_t *pEntity ) {
   189 	DLL_TRACE(pfnSpectatorConnect, P_PRE, (""));
   190 	RETURN_META(MRES_IGNORED);
   191 }
   192 void SpectatorDisconnect( edict_t *pEntity ) {
   193 	DLL_TRACE(pfnSpectatorDisconnect, P_PRE, (""));
   194 	RETURN_META(MRES_IGNORED);
   195 }
   196 void SpectatorThink( edict_t *pEntity ) {
   197 	DLL_TRACE(pfnSpectatorThink, P_PRE, (""));
   198 	RETURN_META(MRES_IGNORED);
   199 }
   200 void Sys_Error( const char *error_string ) {
   201 	DLL_TRACE(pfnSys_Error, P_PRE, ("string=%s", error_string));
   202 	RETURN_META(MRES_IGNORED);
   203 }
   204 
   205 // from SDK pm_shared/pm_shared.c:
   206 void PM_Move ( struct playermove_s *ppmove, int server ) {
   207 	DLL_TRACE(pfnPM_Move, P_PRE, (""));
   208 	RETURN_META(MRES_IGNORED);
   209 }
   210 void PM_Init( struct playermove_s *ppmove ) {
   211 	DLL_TRACE(pfnPM_Init, P_PRE, (""));
   212 	RETURN_META(MRES_IGNORED);
   213 }
   214 char PM_FindTextureType( char *name ) {
   215 	DLL_TRACE(pfnPM_FindTextureType, P_PRE, ("name=%s", name));
   216 	RETURN_META_VALUE(MRES_IGNORED, '\0');
   217 }
   218 
   219 // from SDK dlls/client.cpp:
   220 void SetupVisibility( edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas ) {
   221 	DLL_TRACE(pfnSetupVisibility, P_PRE, (""));
   222 	RETURN_META(MRES_IGNORED);
   223 }
   224 void UpdateClientData ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd ) {
   225 	DLL_TRACE(pfnUpdateClientData, P_PRE, (""));
   226 	RETURN_META(MRES_IGNORED);
   227 }
   228 int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet ) {
   229 	DLL_TRACE(pfnAddToFullPack, P_PRE, (""));
   230 	RETURN_META_VALUE(MRES_IGNORED, 0);
   231 }
   232 void CreateBaseline( int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs ) {
   233 	DLL_TRACE(pfnCreateBaseline, P_PRE, (""));
   234 	RETURN_META(MRES_IGNORED);
   235 }
   236 void RegisterEncoders( void ) {
   237 	DLL_TRACE(pfnRegisterEncoders, P_PRE, (""));
   238 	RETURN_META(MRES_IGNORED);
   239 }
   240 int GetWeaponData( struct edict_s *player, struct weapon_data_s *info ) {
   241 	DLL_TRACE(pfnGetWeaponData, P_PRE, (""));
   242 	RETURN_META_VALUE(MRES_IGNORED, 1);
   243 }
   244 void CmdStart( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed ) {
   245 	DLL_TRACE(pfnCmdStart, P_PRE, ("name=%s, rand=%d", STRING(player->v.netname), random_seed));
   246 	RETURN_META(MRES_IGNORED);
   247 }
   248 void CmdEnd ( const edict_t *player ) {
   249 	DLL_TRACE(pfnCmdEnd, P_PRE, ("name=%s", STRING(player->v.netname)));
   250 	RETURN_META(MRES_IGNORED);
   251 }
   252 int ConnectionlessPacket( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size ) {
   253 	DLL_TRACE(pfnConnectionlessPacket, P_PRE, (""));
   254 	RETURN_META_VALUE(MRES_IGNORED, 0);
   255 }
   256 int GetHullBounds( int hullnumber, float *mins, float *maxs ) {
   257 	DLL_TRACE(pfnGetHullBounds, P_PRE, (""));
   258 	RETURN_META_VALUE(MRES_IGNORED, 0);
   259 }
   260 void CreateInstancedBaselines ( void ) {
   261 	DLL_TRACE(pfnCreateInstancedBaselines, P_PRE, (""));
   262 	RETURN_META(MRES_IGNORED);
   263 }
   264 int InconsistentFile( const edict_t *player, const char *filename, char *disconnect_message ) {
   265 	DLL_TRACE(pfnInconsistentFile, P_PRE, ("name=%s, file=%s", STRING(player->v.netname), filename));
   266 	RETURN_META_VALUE(MRES_IGNORED, 0);
   267 }
   268 int AllowLagCompensation( void ) {
   269 	DLL_TRACE(pfnAllowLagCompensation, P_PRE, (""));
   270 	RETURN_META_VALUE(MRES_IGNORED, 1);
   271 }
   272 
   273 
   274 // from SDK ?
   275 void OnFreeEntPrivateData(edict_t *pEnt) {
   276 	NEWDLL_TRACE(pfnOnFreeEntPrivateData, P_PRE, (""));
   277 	RETURN_META(MRES_IGNORED);
   278 }
   279 void GameShutdown(void) {
   280 	NEWDLL_TRACE(pfnGameShutdown, P_PRE, (""));
   281 	RETURN_META(MRES_IGNORED);
   282 }
   283 int ShouldCollide(edict_t *pentTouched, edict_t *pentOther) {
   284 	NEWDLL_TRACE(pfnShouldCollide, P_PRE, (""));
   285 	RETURN_META_VALUE(MRES_IGNORED, 1);
   286 }
   287 void CvarValue(const edict_t *pEdict, const char *szValue) {
   288 	NEWDLL_TRACE(pfnCvarValue, P_PRE, ("player=%s, value=%s", STRING(pEdict->v.netname), szValue?szValue:"nil"));
   289 	RETURN_META(MRES_IGNORED);
   290 }
   291 
   292 
   293 // from SDK dlls/cbase.cpp:
   294 // (wd) indicates my comments on the functions
   295 static DLL_FUNCTIONS gFunctionTable = 
   296 {
   297 	GameDLLInit,				//! pfnGameInit()				Initialize the game (one-time call after loading of game .dll)
   298 	DispatchSpawn,				//! pfnSpawn()
   299 	DispatchThink,				//! pfnThink()
   300 	DispatchUse,				//! pfnUse()
   301 	DispatchTouch,				//! pfnTouch()
   302 	DispatchBlocked,			//! pfnBlocked()
   303 	DispatchKeyValue,			//! pfnKeyValue()
   304 	DispatchSave,				//! pfnSave()
   305 	DispatchRestore,			//! pfnRestore()
   306 	DispatchObjectCollsionBox,	//! pfnSetAbsBox()
   307 
   308 	SaveWriteFields,			//! pfnSaveWriteFields()
   309 	SaveReadFields,				//! pfnSaveReadFields()
   310 
   311 	SaveGlobalState,			//! pfnSaveGlobalState()
   312 	RestoreGlobalState,			//! pfnRestoreGlobalState()
   313 	ResetGlobalState,			//! pfnResetGlobalState()
   314 
   315 	ClientConnect,				//! pfnClientConnect()			(wd) Client has connected
   316 	ClientDisconnect,			//! pfnClientDisconnect()		(wd) Player has left the game
   317 	ClientKill,					//! pfnClientKill()				(wd) Player has typed "kill"
   318 	ClientPutInServer,			//! pfnClientPutInServer()		(wd) Client is entering the game
   319 	ClientCommand,				//! pfnClientCommand()			(wd) Player has sent a command (typed, or from a bind)
   320 	ClientUserInfoChanged,		//! pfnClientUserInfoChanged()	(wd) Client has updated their setinfo structure
   321 	ServerActivate,				//! pfnServerActivate()			(wd) Server is starting a new map
   322 	ServerDeactivate,			//! pfnServerDeactivate()		(wd) Server is leaving the map (shutdown, or changelevel); SDK2
   323 
   324 	PlayerPreThink,				//! pfnPlayerPreThink()
   325 	PlayerPostThink,			//! pfnPlayerPostThink()
   326 
   327 	StartFrame,					//! pfnStartFrame()
   328 	ParmsNewLevel,				//! pfnParmsNewLevel()
   329 	ParmsChangeLevel,			//! pfnParmsChangeLevel()
   330 
   331 	GetGameDescription,			//! pfnGetGameDescription()		Returns string describing current .dll.  E.g. "TeamFotrress 2", "Half-Life"
   332 	PlayerCustomization,		//! pfnPlayerCustomization()	Notifies .dll of new customization for player.
   333 
   334 	SpectatorConnect,			//! pfnSpectatorConnect()		Called when spectator joins server
   335 	SpectatorDisconnect,		//! pfnSpectatorDisconnect()	Called when spectator leaves the server
   336 	SpectatorThink,				//! pfnSpectatorThink()			Called when spectator sends a command packet (usercmd_t)
   337 	
   338 	Sys_Error,					//! pfnSys_Error()				Notify game .dll that engine is going to shut down.  Allows mod authors to set a breakpoint.  SDK2
   339 
   340 	PM_Move,					//! pfnPM_Move()				(wd) SDK2
   341 	PM_Init,					//! pfnPM_Init()				Server version of player movement initialization; (wd) SDK2
   342 	PM_FindTextureType,			//! pfnPM_FindTextureType()		(wd) SDK2
   343 	
   344 	SetupVisibility,			//! pfnSetupVisibility()		Set up PVS and PAS for networking for this client; (wd) SDK2
   345 	UpdateClientData,			//! pfnUpdateClientData()		Set up data sent only to specific client; (wd) SDK2
   346 	AddToFullPack,				//! pfnAddToFullPack()			(wd) SDK2
   347 	CreateBaseline,				//! pfnCreateBaseline()			Tweak entity baseline for network encoding, allows setup of player baselines, too.; (wd) SDK2
   348 	RegisterEncoders,			//! pfnRegisterEncoders()		Callbacks for network encoding; (wd) SDK2
   349 	GetWeaponData,				//! pfnGetWeaponData()			(wd) SDK2
   350 	CmdStart,					//! pfnCmdStart()				(wd) SDK2
   351 	CmdEnd,						//! pfnCmdEnd()					(wd) SDK2
   352 	ConnectionlessPacket,		//! pfnConnectionlessPacket()	(wd) SDK2
   353 	GetHullBounds,				//! pfnGetHullBounds()			(wd) SDK2
   354 	CreateInstancedBaselines,	//! pfnCreateInstancedBaselines()	(wd) SDK2
   355 	InconsistentFile,			//! pfnInconsistentFile()		(wd) SDK2
   356 	AllowLagCompensation,		//! pfnAllowLagCompensation()	(wd) SDK2
   357 };
   358 
   359 // It's not clear what the difference is between GetAPI and GetAPI2; they
   360 // both appear to return the exact same function table.  
   361 //
   362 // Only one of them appears to be ever called, though.  If the DLL provides
   363 // GetAPI2, the engine/hlds will call that, and will not call GetAPI.  If
   364 // the engine couldn't find GetAPI2 in the DLL, it appears to fall back to
   365 // GetAPI.
   366 //
   367 // So, GetAPI2 appears to replace GetAPI, and appears to have been added
   368 // with SDK 2.0.  My best guess is that, with the new SDK, interface
   369 // version checking became important, and without the int ptr used in
   370 // GetAPI2, the engine can't find out the version of the DLL via GetAPI.
   371 //
   372 // It's unclear whether a DLL coded under SDK2 needs to provide the older
   373 // GetAPI or not..
   374 
   375 C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, 
   376 		int *interfaceVersion )
   377 {
   378 	LOG_DEVELOPER(PLID, "called: GetEntityAPI2; version=%d", *interfaceVersion);
   379 	if(!pFunctionTable) {
   380 		LOG_ERROR(PLID, "GetEntityAPI2 called with null pFunctionTable");
   381 		return(FALSE);
   382 	}
   383 	else if(*interfaceVersion != INTERFACE_VERSION) {
   384 		LOG_ERROR(PLID, 
   385 				"GetEntityAPI2 version mismatch; requested=%d ours=%d", 
   386 				*interfaceVersion, INTERFACE_VERSION);
   387 		//! Tell engine what version we had, so it can figure out who is 
   388 		//! out of date.
   389 		*interfaceVersion = INTERFACE_VERSION;
   390 		return(FALSE);
   391 	}
   392 	memcpy(pFunctionTable, &gFunctionTable, sizeof(DLL_FUNCTIONS));
   393 	return(TRUE);
   394 }
   395 
   396 
   397 // I could find _no_ documentation or examples for the intended use of
   398 // NEW_DLL_FUNCTIONS.  I wouldn't have even _known_ about the
   399 // GetNewDLLFunctions() function except for the reference in Adminmod..  It
   400 // appears to be new with SDK 2.0.
   401 //
   402 // Obviously, it seems to provide additional functions to the engine, but
   403 // it's unclear why a new table and interface were added, rather than
   404 // appending new functions to the GetAPI table/interface.
   405 //
   406 // Interestingly, it appears to be called by the engine _before_ GetAPI.
   407 
   408 static NEW_DLL_FUNCTIONS gNewFunctionTable = 
   409 {
   410 	OnFreeEntPrivateData,		//! pfnOnFreeEntPrivateData()	Called right before the object's memory is freed.  Calls its destructor.
   411 	GameShutdown,				//! pfnGameShutdown()
   412 	ShouldCollide,				//! pfnShouldCollide()
   413 	CvarValue,					//! pfnCvarValue()
   414 };
   415 
   416 C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, 
   417 		int *interfaceVersion) 
   418 {
   419 	LOG_DEVELOPER(PLID, "called: GetNewDLLFunctions; version=%d", 
   420 			*interfaceVersion);
   421 	if(!pNewFunctionTable) {
   422 		LOG_ERROR(PLID, 
   423 				"GetNewDLLFunctions called with null pNewFunctionTable");
   424 		return(FALSE);
   425 	}
   426 	else if(*interfaceVersion != NEW_DLL_FUNCTIONS_VERSION) {
   427 		LOG_ERROR(PLID, 
   428 				"GetNewDLLFunctions version mismatch; requested=%d ours=%d", 
   429 				*interfaceVersion, NEW_DLL_FUNCTIONS_VERSION);
   430 		//! Tell engine what version we had, so it can figure out who is 
   431 		//! out of date.
   432 		*interfaceVersion = NEW_DLL_FUNCTIONS_VERSION;
   433 		return(FALSE);
   434 	}
   435 	memcpy(pNewFunctionTable, &gNewFunctionTable, sizeof(NEW_DLL_FUNCTIONS));
   436 	return TRUE;
   437 }