sourcemm/metamod.h
changeset 371 751179604513
child 375 17ca1d5645ac
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/sourcemm/metamod.h	Thu Oct 04 20:15:25 2007 +0000
     1.3 @@ -0,0 +1,105 @@
     1.4 +/**
     1.5 + * vim: set ts=4 :
     1.6 + * ======================================================
     1.7 + * Metamod:Source
     1.8 + * Copyright (C) 2004-2007 AlliedModders LLC and authors.
     1.9 + * All rights reserved.
    1.10 + * ======================================================
    1.11 + *
    1.12 + * This software is provided 'as-is', without any express or implied warranty.
    1.13 + * In no event will the authors be held liable for any damages arising from 
    1.14 + * the use of this software.
    1.15 + * 
    1.16 + * Permission is granted to anyone to use this software for any purpose, 
    1.17 + * including commercial applications, and to alter it and redistribute it 
    1.18 + * freely, subject to the following restrictions:
    1.19 + *
    1.20 + * 1. The origin of this software must not be misrepresented; you must not 
    1.21 + * claim that you wrote the original software. If you use this software in a 
    1.22 + * product, an acknowledgment in the product documentation would be 
    1.23 + * appreciated but is not required.
    1.24 + * 2. Altered source versions must be plainly marked as such, and must not be
    1.25 + * misrepresented as being the original software.
    1.26 + * 3. This notice may not be removed or altered from any source distribution.
    1.27 + *
    1.28 + * Version: $Id$
    1.29 + */
    1.30 +
    1.31 +#ifndef _INCLUDE_SOURCEMM_H
    1.32 +#define _INCLUDE_SOURCEMM_H
    1.33 +
    1.34 +/**
    1.35 + * @brief SourceMM main functionality for GameDLL interception
    1.36 + * @file sourcemm.h
    1.37 + */
    1.38 +
    1.39 +#include <string>
    1.40 +#include <interface.h>
    1.41 +#include <eiface.h>
    1.42 +#include <sourcehook/sourcehook_impl.h>
    1.43 +#include <sourcehook/sourcehook.h>
    1.44 +#include "ISmmAPI.h"
    1.45 +#include "metamod_provider.h"
    1.46 +#include "svn_version.h"
    1.47 +
    1.48 +using namespace SourceMM;
    1.49 +
    1.50 +/**
    1.51 + * Versioning
    1.52 + *   increase api_major when API breaks
    1.53 + *   increase api_minor when new functions are added (non-breaking)
    1.54 + */
    1.55 +#define SOURCEMM_VERSION	SVN_FILE_VERSION_STRING
    1.56 +#define SOURCEMM_DATE		__DATE__
    1.57 +#define SM_VERS_API_MAJOR	1		//increase this on a breaking change
    1.58 +#define SM_VERS_API_MINOR	7		//increase this on a non-breaking API change
    1.59 +
    1.60 +class MetamodSource : public ISmmAPI
    1.61 +{
    1.62 +public:
    1.63 +	void LogMsg(ISmmPlugin *pl, const char *msg, ...);
    1.64 +	CreateInterfaceFn engineFactory(bool syn=true);
    1.65 +	CreateInterfaceFn physicsFactory(bool syn=true);
    1.66 +	CreateInterfaceFn fileSystemFactory(bool syn=true);
    1.67 +	CreateInterfaceFn serverFactory(bool syn=true);
    1.68 +	CGlobalVars *pGlobals();
    1.69 +	void SetLastMetaReturn(META_RES res);
    1.70 +	META_RES GetLastMetaReturn();
    1.71 +	IConCommandBaseAccessor *GetCvarBaseAccessor();
    1.72 +	bool RegisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
    1.73 +	void UnregisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand);
    1.74 +	void ConPrint(const char *str);
    1.75 +	void ConPrintf(const char *fmt, ...);
    1.76 +	bool RemotePrintingAvailable();
    1.77 +	void GetApiVersions(int &major, int &minor, int &plvers, int &plmin);
    1.78 +	void GetShVersions(int &shvers, int &shimpl);
    1.79 +	void AddListener(ISmmPlugin *plugin, IMetamodListener *pListener);
    1.80 +	void *MetaFactory(const char *iface, int *ret, PluginId *id);
    1.81 +	int FormatIface(char iface[], unsigned int maxlength);
    1.82 +	void *InterfaceSearch(CreateInterfaceFn fn, const char *iface, int max, int *ret);
    1.83 +	const char *GetBaseDir();
    1.84 +	void PathFormat(char *buffer, size_t len, const char *fmt, ...);
    1.85 +	void ClientConPrintf(edict_t *client, const char *fmt, ...);
    1.86 +	void *VInterfaceMatch(CreateInterfaceFn fn, const char *iface, int min=-1);
    1.87 +	void EnableVSPListener();
    1.88 +	int GetGameDLLVersion();
    1.89 +	int GetUserMessageCount();
    1.90 +	int FindUserMessage(const char *name, int *size=NULL);
    1.91 +	const char *GetUserMessage(int index, int *size=NULL);
    1.92 +	int GetVSPVersion();
    1.93 +	int GetSourceEngineBuild();
    1.94 +	IServerPluginCallbacks *GetVSPInfo(int *pVersion);
    1.95 +public:
    1.96 +	const char *GetGameBinaryPath();
    1.97 +	const char *GetPluginsFile();
    1.98 +	void UnregisterConCommandBase(PluginId id, ConCommandBase *pCommand);
    1.99 +	void NotifyVSPListening(IServerPluginCallbacks *callbacks);
   1.100 +};
   1.101 +
   1.102 +void LogMessage(const char *msg, ...);
   1.103 +int LoadPluginsFromFile(const char *_file);
   1.104 +
   1.105 +extern SourceHook::CSourceHookImpl g_SourceHook;
   1.106 +extern MetamodSource g_Metamod;
   1.107 +
   1.108 +#endif //_INCLUDE_SOURCEMM_H