2005-04-16 21:59:26 +02:00
|
|
|
/* ======== SourceMM ========
|
2006-01-07 15:38:18 +01:00
|
|
|
* Copyright (C) 2004-2006 Metamod:Source Development Team
|
2005-04-16 21:59:26 +02:00
|
|
|
* No warranties of any kind
|
|
|
|
*
|
|
|
|
* License: zlib/libpng
|
|
|
|
*
|
|
|
|
* Author(s): David "BAILOPAN" Anderson
|
|
|
|
* ============================
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE_SOURCEMM_H
|
|
|
|
#define _INCLUDE_SOURCEMM_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief SourceMM main functionality for GameDLL interception
|
|
|
|
* @file sourcemm.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <interface.h>
|
|
|
|
#include <eiface.h>
|
|
|
|
#include <sourcehook/sourcehook_impl.h>
|
|
|
|
#include <sourcehook/sourcehook.h>
|
|
|
|
#include "ISmmAPI.h"
|
|
|
|
#include "CPlugin.h"
|
|
|
|
#include "oslink.h"
|
|
|
|
#include "util.h"
|
|
|
|
|
2005-10-06 23:59:10 +02:00
|
|
|
/**
|
|
|
|
* Versioning
|
2005-12-24 00:38:38 +01:00
|
|
|
* ?what the hell was I smoking when I wrote this
|
|
|
|
* increase api_major when API breaks
|
|
|
|
* increase api_minor when new functions are added (non-breaking)
|
|
|
|
* increase vers_release when bug fix releases are made
|
|
|
|
* never increase major
|
2005-10-06 23:59:10 +02:00
|
|
|
*/
|
2006-08-13 13:34:30 +02:00
|
|
|
#define SOURCEMM_VERSION "1.3"
|
2005-04-16 21:59:26 +02:00
|
|
|
#define SOURCEMM_DATE __DATE__
|
2005-10-06 23:59:10 +02:00
|
|
|
#define SM_MAJOR_VERSION 1 //never need to increase this
|
|
|
|
#define SM_VERS_API_MAJOR 1 //increase this on a breaking change
|
2006-08-14 07:50:26 +02:00
|
|
|
#define SM_VERS_API_MINOR 4 //increase this on a non-breaking API change
|
2006-06-28 20:33:00 +02:00
|
|
|
#define SM_VERS_RELEASE 4 //increase this on a bug-fix release.
|
2005-04-16 21:59:26 +02:00
|
|
|
|
2005-10-06 23:59:10 +02:00
|
|
|
//We need a good CServerGameDLL version to work properly. We support these inclusively.
|
2005-10-06 02:59:01 +02:00
|
|
|
#define MIN_GAMEDLL_VERSION 3
|
2006-06-15 02:01:06 +02:00
|
|
|
#define MAX_GAMEDLL_VERSION 5
|
2005-10-06 02:59:01 +02:00
|
|
|
|
2005-04-16 21:59:26 +02:00
|
|
|
/**
|
|
|
|
* @brief Entry point for HL2 Engine
|
|
|
|
*/
|
|
|
|
SMM_API void *CreateInterface(const char *name, int *code);
|
|
|
|
|
|
|
|
/** @brief Wrapper to catch GameDLL calls */
|
|
|
|
void *EngineFactory(const char *name, int *code);
|
|
|
|
|
|
|
|
/** @brief Wrapper to catch GameDLL calls */
|
|
|
|
void *PhysicsFactory(const char *name, int *code);
|
|
|
|
|
|
|
|
/** @brief Wrapper to catch GameDLL calls */
|
|
|
|
void *FileSystemFactory(const char *name, int *code);
|
|
|
|
|
|
|
|
/** @brief Loads all plugins found in a file */
|
|
|
|
int LoadPluginsFromFile(const char *file);
|
|
|
|
|
|
|
|
/** @brief Logs a message to the standard log file */
|
|
|
|
void LogMessage(const char *msg, ...);
|
|
|
|
|
|
|
|
/** @brief Stores information about the GameDLL */
|
|
|
|
struct GameDllInfo
|
|
|
|
{
|
|
|
|
bool loaded;
|
|
|
|
HINSTANCE lib;
|
|
|
|
CreateInterfaceFn factory;
|
2005-10-06 02:59:01 +02:00
|
|
|
IServerGameDLL *pGameDLL;
|
2006-04-21 08:35:47 +02:00
|
|
|
IServerGameClients *pGameClients;
|
2005-04-16 21:59:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief Stores information about the HL2 Engine pointers */
|
|
|
|
struct EngineInfo
|
|
|
|
{
|
2005-10-06 02:59:01 +02:00
|
|
|
EngineInfo() : loaded(false),
|
|
|
|
engineFactory(NULL), physicsFactory(NULL), fileSystemFactory(NULL),
|
|
|
|
pGlobals(NULL), icvar(NULL), engine(NULL)
|
|
|
|
{ };
|
|
|
|
bool loaded;
|
2005-04-16 21:59:26 +02:00
|
|
|
CreateInterfaceFn engineFactory;
|
|
|
|
CreateInterfaceFn physicsFactory;
|
|
|
|
CreateInterfaceFn fileSystemFactory;
|
|
|
|
CGlobalVars *pGlobals;
|
|
|
|
ICvar *icvar;
|
|
|
|
IVEngineServer *engine;
|
|
|
|
};
|
|
|
|
|
|
|
|
/** @brief Global variable for GameDLL info */
|
|
|
|
extern GameDllInfo g_GameDll;
|
|
|
|
|
|
|
|
/** @brief Global variable for Engine info */
|
|
|
|
extern EngineInfo g_Engine;
|
|
|
|
|
|
|
|
/** @brief Global singleton for SourceHook */
|
|
|
|
extern SourceHook::CSourceHookImpl g_SourceHook;
|
|
|
|
|
|
|
|
/** @brief Mod path (important!)*/
|
2005-08-12 19:44:53 +02:00
|
|
|
extern SourceHook::String g_ModPath;
|
2005-04-16 21:59:26 +02:00
|
|
|
|
|
|
|
/** @brief Path to server binary */
|
2005-08-12 19:44:53 +02:00
|
|
|
extern SourceHook::String g_BinPath;
|
2005-04-16 21:59:26 +02:00
|
|
|
|
2005-04-17 05:37:50 +02:00
|
|
|
/** @brief Global variable for SourceHook macros */
|
|
|
|
extern SourceHook::ISourceHook *g_SHPtr;
|
|
|
|
|
|
|
|
/** @brief We have our own internal plugin id... */
|
|
|
|
extern PluginId g_PLID;
|
|
|
|
|
2006-07-13 08:08:08 +02:00
|
|
|
/** @brief ServerGameDLL version that is currently loaded */
|
|
|
|
extern int g_GameDllVersion;
|
|
|
|
|
2005-04-16 21:59:26 +02:00
|
|
|
#endif //_INCLUDE_SOURCEMM_H
|