wdmisc_plugin/dll_plugin.cpp
author Scott Ehlert <ds@alliedmods.net>
Thu Sep 26 15:21:07 2013 -0500 (2013-09-26)
changeset 279 7674d15b15bc
parent 0 d15304fcb7a7
permissions -rw-r--r--
Removed pointless code for OS X that checked for a fat Mach-O engine binary.

The only Mach-O header loaded in memory would be the one for the current (32-bit) architecture anyways. The fat header only applies when reading from disk.

(I'm not sure what I was thinking when I wrote this originally!)
darope@0
     1
// vi: set ts=4 sw=4 :
darope@0
     2
// vim: set tw=75 :
darope@0
     3
darope@0
     4
// dll_plugin.cpp - implementation of plugin's HL DLL routines
darope@0
     5
darope@0
     6
/*
darope@0
     7
 * Copyright (c) 2001-2003 Will Day <[email protected]>
darope@0
     8
 *
darope@0
     9
 *    This file is part of Metamod.
darope@0
    10
 *
darope@0
    11
 *    Metamod is free software; you can redistribute it and/or modify it
darope@0
    12
 *    under the terms of the GNU General Public License as published by the
darope@0
    13
 *    Free Software Foundation; either version 2 of the License, or (at
darope@0
    14
 *    your option) any later version.
darope@0
    15
 *
darope@0
    16
 *    Metamod is distributed in the hope that it will be useful, but
darope@0
    17
 *    WITHOUT ANY WARRANTY; without even the implied warranty of
darope@0
    18
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
darope@0
    19
 *    General Public License for more details.
darope@0
    20
 *
darope@0
    21
 *    You should have received a copy of the GNU General Public License
darope@0
    22
 *    along with Metamod; if not, write to the Free Software Foundation,
darope@0
    23
 *    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
darope@0
    24
 *
darope@0
    25
 *    In addition, as a special exception, the author gives permission to
darope@0
    26
 *    link the code of this program with the Half-Life Game Engine ("HL
darope@0
    27
 *    Engine") and Modified Game Libraries ("MODs") developed by Valve,
darope@0
    28
 *    L.L.C ("Valve").  You must obey the GNU General Public License in all
darope@0
    29
 *    respects for all of the code used other than the HL Engine and MODs
darope@0
    30
 *    from Valve.  If you modify this file, you may extend this exception
darope@0
    31
 *    to your version of the file, but you are not obligated to do so.  If
darope@0
    32
 *    you do not wish to do so, delete this exception statement from your
darope@0
    33
 *    version.
darope@0
    34
 *
darope@0
    35
 */
darope@0
    36
darope@0
    37
#include <extdll.h>
darope@0
    38
#include <sdk_util.h>
darope@0
    39
darope@0
    40
#include <meta_api.h>
darope@0
    41
#include <sdk_util.h>
darope@0
    42
darope@0
    43
#include "wdmisc.h"
darope@0
    44
#include "dll_plugin.h"
darope@0
    45
#include "log_plugin.h"
darope@0
    46
darope@0
    47
void wd_ServerDeactivate( void ) {
darope@0
    48
	bounce_check();
darope@0
    49
	RETURN_META(MRES_HANDLED);
darope@0
    50
}
darope@0
    51
darope@0
    52
static DLL_FUNCTIONS gFunctionTable = 
darope@0
    53
{
darope@0
    54
	NULL,						//! pfnGameInit()
darope@0
    55
	NULL,						//! pfnSpawn()
darope@0
    56
	NULL,						//! pfnThink()
darope@0
    57
	NULL,						//! pfnUse()
darope@0
    58
	NULL,						//! pfnTouch()
darope@0
    59
	NULL,						//! pfnBlocked()
darope@0
    60
	NULL,						//! pfnKeyValue()
darope@0
    61
	NULL,						//! pfnSave()
darope@0
    62
	NULL,						//! pfnRestore()
darope@0
    63
	NULL,						//! pfnSetAbsBox()
darope@0
    64
darope@0
    65
	NULL,						//! pfnSaveWriteFields()
darope@0
    66
	NULL,						//! pfnSaveReadFields()
darope@0
    67
darope@0
    68
	NULL,						//! pfnSaveGlobalState()
darope@0
    69
	NULL,						//! pfnRestoreGlobalState()
darope@0
    70
	NULL,						//! pfnResetGlobalState()
darope@0
    71
darope@0
    72
	NULL,						//! pfnClientConnect()
darope@0
    73
	NULL,						//! pfnClientDisconnect()
darope@0
    74
	NULL,						//! pfnClientKill()
darope@0
    75
	NULL,						//! pfnClientPutInServer()
darope@0
    76
	NULL,						//! pfnClientCommand()
darope@0
    77
	NULL,						//! pfnClientUserInfoChanged()
darope@0
    78
	NULL,						//! pfnServerActivate()
darope@0
    79
	wd_ServerDeactivate,		//! pfnServerDeactivate()
darope@0
    80
darope@0
    81
	NULL,						//! pfnPlayerPreThink()
darope@0
    82
	NULL,						//! pfnPlayerPostThink()
darope@0
    83
darope@0
    84
	NULL,						//! pfnStartFrame()
darope@0
    85
	NULL,						//! pfnParmsNewLevel()
darope@0
    86
	NULL,						//! pfnParmsChangeLevel()
darope@0
    87
darope@0
    88
	NULL,						//! pfnGetGameDescription()
darope@0
    89
	NULL,						//! pfnPlayerCustomization()
darope@0
    90
darope@0
    91
	NULL,						//! pfnSpectatorConnect()
darope@0
    92
	NULL,						//! pfnSpectatorDisconnect()
darope@0
    93
	NULL,						//! pfnSpectatorThink()
darope@0
    94
	
darope@0
    95
	NULL,						//! pfnSys_Error()
darope@0
    96
darope@0
    97
	NULL,						//! pfnPM_Move()
darope@0
    98
	NULL,						//! pfnPM_Init()
darope@0
    99
	NULL,						//! pfnPM_FindTextureType()
darope@0
   100
	
darope@0
   101
	NULL,						//! pfnSetupVisibility()
darope@0
   102
	NULL,						//! pfnUpdateClientData()
darope@0
   103
	NULL,						//! pfnAddToFullPack()
darope@0
   104
	NULL,						//! pfnCreateBaseline()
darope@0
   105
	NULL,						//! pfnRegisterEncoders()
darope@0
   106
	NULL,						//! pfnGetWeaponData()
darope@0
   107
	NULL,						//! pfnCmdStart()
darope@0
   108
	NULL,						//! pfnCmdEnd()
darope@0
   109
	NULL,						//! pfnConnectionlessPacket()
darope@0
   110
	NULL,						//! pfnGetHullBounds()
darope@0
   111
	NULL,						//! pfnCreateInstancedBaselines()
darope@0
   112
	NULL,						//! pfnInconsistentFile()
darope@0
   113
	NULL,						//! pfnAllowLagCompensation()
darope@0
   114
};
darope@0
   115
darope@0
   116
C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, 
darope@0
   117
		int *interfaceVersion)
darope@0
   118
{
darope@0
   119
	LOG_DEVELOPER(PLID, "called: GetEntityAPI2; version=%d", *interfaceVersion);
darope@0
   120
	if(!pFunctionTable) {
darope@0
   121
		LOG_ERROR(PLID, "GetEntityAPI2 called with null pFunctionTable");
darope@0
   122
		return(FALSE);
darope@0
   123
	}
darope@0
   124
	else if(*interfaceVersion != INTERFACE_VERSION) {
darope@0
   125
		LOG_ERROR(PLID, "GetEntityAPI2 version mismatch; requested=%d ours=%d",
darope@0
   126
				*interfaceVersion, INTERFACE_VERSION);
darope@0
   127
		//! Tell engine what version we had, so it can figure out who is 
darope@0
   128
		//! out of date.
darope@0
   129
		*interfaceVersion = INTERFACE_VERSION;
darope@0
   130
		return(FALSE);
darope@0
   131
	}
darope@0
   132
	memcpy(pFunctionTable, &gFunctionTable, sizeof(DLL_FUNCTIONS));
darope@0
   133
	return(TRUE);
darope@0
   134
}