trace_plugin/plugin.cpp
changeset 0 d15304fcb7a7
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/trace_plugin/plugin.cpp	Tue Apr 06 07:36:14 2004 +0000
     1.3 @@ -0,0 +1,75 @@
     1.4 +// vi: set ts=4 sw=4 :
     1.5 +// vim: set tw=75 :
     1.6 +
     1.7 +// plugin.cpp - generic plugin operation
     1.8 +
     1.9 +/*
    1.10 + * Copyright (c) 2001-2003 Will Day <[email protected]>
    1.11 + *
    1.12 + *    This file is part of Metamod.
    1.13 + *
    1.14 + *    Metamod is free software; you can redistribute it and/or modify it
    1.15 + *    under the terms of the GNU General Public License as published by the
    1.16 + *    Free Software Foundation; either version 2 of the License, or (at
    1.17 + *    your option) any later version.
    1.18 + *
    1.19 + *    Metamod is distributed in the hope that it will be useful, but
    1.20 + *    WITHOUT ANY WARRANTY; without even the implied warranty of
    1.21 + *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.22 + *    General Public License for more details.
    1.23 + *
    1.24 + *    You should have received a copy of the GNU General Public License
    1.25 + *    along with Metamod; if not, write to the Free Software Foundation,
    1.26 + *    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.27 + *
    1.28 + *    In addition, as a special exception, the author gives permission to
    1.29 + *    link the code of this program with the Half-Life Game Engine ("HL
    1.30 + *    Engine") and Modified Game Libraries ("MODs") developed by Valve,
    1.31 + *    L.L.C ("Valve").  You must obey the GNU General Public License in all
    1.32 + *    respects for all of the code used other than the HL Engine and MODs
    1.33 + *    from Valve.  If you modify this file, you may extend this exception
    1.34 + *    to your version of the file, but you are not obligated to do so.  If
    1.35 + *    you do not wish to do so, delete this exception statement from your
    1.36 + *    version.
    1.37 + *
    1.38 + */
    1.39 +
    1.40 +#include <extdll.h>
    1.41 +
    1.42 +#include <meta_api.h>
    1.43 +
    1.44 +#include "plugin.h"
    1.45 +#include "log_plugin.h"
    1.46 +#include "trace_api.h"
    1.47 +
    1.48 +// Must provide at least one of these..
    1.49 +META_FUNCTIONS gMetaFunctionTable = {
    1.50 +	NULL,			// pfnGetEntityAPI				HL SDK; called before game DLL
    1.51 +	NULL,			// pfnGetEntityAPI_Post			META; called after game DLL
    1.52 +	GetEntityAPI2,	// pfnGetEntityAPI2				HL SDK2; called before game DLL
    1.53 +	GetEntityAPI2_Post,			// pfnGetEntityAPI2_Post		META; called after game DLL
    1.54 +	GetNewDLLFunctions,			// pfnGetNewDLLFunctions		HL SDK2; called before game DLL
    1.55 +	GetNewDLLFunctions_Post,	// pfnGetNewDLLFunctions_Post	META; called after game DLL
    1.56 +	GetEngineFunctions,			// pfnGetEngineFunctions		META; called before HL engine
    1.57 +	GetEngineFunctions_Post,	// pfnGetEngineFunctions_Post	META; called after HL engine
    1.58 +};
    1.59 +
    1.60 +cvar_t init_plugin_debug = {"trace_debug", "0", FCVAR_EXTDLL, 0, NULL};
    1.61 +
    1.62 +
    1.63 +// Meta_Query, any desired checks for valid use.
    1.64 +int plugin_query(void) {
    1.65 +	return(TRUE);
    1.66 +}
    1.67 +
    1.68 +// Meta_Attach.  Plugin startup.  Register commands and cvars.
    1.69 +int plugin_attach(void) {
    1.70 +	log_init("trace_debug");
    1.71 +	trace_init();
    1.72 +	return(TRUE);
    1.73 +}
    1.74 +
    1.75 +// Meta_Detach.  Cleaning up.
    1.76 +int plugin_detach(void) {
    1.77 +	return(TRUE);
    1.78 +}