sourcemm/sourcemm.h
author Pavol Marko <pavolmarko@gmail.com>
Sun Apr 17 18:43:21 2005 +0000 (2005-04-17)
changeset 14 a3f323f6f91d
parent 12 9fd53562f68c
child 15 6c861b24941b
permissions -rw-r--r--
YAMS
     1 /* ======== SourceMM ========
     2 * Copyright (C) 2004-2005 Metamod:Source Development Team
     3 * No warranties of any kind
     4 *
     5 * License: zlib/libpng
     6 *
     7 * Author(s): David "BAILOPAN" Anderson
     8 * ============================
     9 */
    10 
    11 #ifndef _INCLUDE_SOURCEMM_H
    12 #define _INCLUDE_SOURCEMM_H
    13 
    14 /**
    15  * @brief SourceMM main functionality for GameDLL interception
    16  * @file sourcemm.h
    17  */
    18 
    19 #include <string>
    20 #include <interface.h>
    21 #include <eiface.h>
    22 #include <sourcehook/sourcehook_impl.h>
    23 #include <sourcehook/sourcehook.h>
    24 #include "ISmmAPI.h"
    25 #include "CPlugin.h"
    26 #include "oslink.h"
    27 #include "util.h"
    28 
    29 #define		SOURCEMM_VERSION	"1.00"
    30 #define		SOURCEMM_DATE		__DATE__
    31 
    32 /**
    33  * @brief Entry point for HL2 Engine
    34  */
    35 SMM_API void *CreateInterface(const char *name, int *code);
    36 
    37 /** @brief Wrapper to catch GameDLL calls */
    38 void *EngineFactory(const char *name, int *code);
    39 
    40 /** @brief Wrapper to catch GameDLL calls */
    41 void *PhysicsFactory(const char *name, int *code);
    42 
    43 /** @brief Wrapper to catch GameDLL calls */
    44 void *FileSystemFactory(const char *name, int *code);
    45 
    46 /** @brief Loads all plugins found in a file */
    47 int LoadPluginsFromFile(const char *file);
    48 
    49 /** @brief Logs a message to the standard log file */
    50 void LogMessage(const char *msg, ...);
    51 
    52 /** @brief Stores information about the GameDLL */
    53 struct GameDllInfo
    54 {
    55 	bool loaded;
    56 	HINSTANCE lib;
    57 	CreateInterfaceFn factory;
    58 	IServerGameDLL *serverGameDLL_CC;
    59 };
    60 
    61 /** @brief Stores information about the HL2 Engine pointers */
    62 struct EngineInfo
    63 {
    64 	CreateInterfaceFn engineFactory;
    65 	CreateInterfaceFn physicsFactory;
    66 	CreateInterfaceFn fileSystemFactory;
    67 	CGlobalVars *pGlobals;
    68 	ICvar *icvar;
    69 	IVEngineServer *engine;
    70 };
    71 
    72 /** @brief Global variable for GameDLL info */
    73 extern GameDllInfo g_GameDll;
    74 
    75 /** @brief Global variable for Engine info */
    76 extern EngineInfo g_Engine;
    77 
    78 /** @brief Global singleton for SourceHook */
    79 extern SourceHook::CSourceHookImpl g_SourceHook;
    80 
    81 /** @brief Mod path (important!)*/
    82 extern std::string g_ModPath;
    83 
    84 /** @brief Path to server binary */
    85 extern std::string g_BinPath;
    86 
    87 /** @brief Global variable for SourceHook macros */
    88 extern SourceHook::ISourceHook *g_SHPtr;
    89 
    90 /** @brief We have our own internal plugin id... */
    91 extern PluginId g_PLID;
    92 
    93 #endif //_INCLUDE_SOURCEMM_H