sourcemm/sourcemm.h
author David Anderson <dvander@alliedmods.net>
Sun May 01 18:46:06 2005 +0000 (2005-05-01)
changeset 53 797ecc5394d6
parent 39 f7f7c5a4e889
child 55 12937809811e
permissions -rw-r--r--
Switched from MEMFUNC to STATICFUNC for simplicity
     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 };
    59 
    60 /** @brief Stores information about the HL2 Engine pointers */
    61 struct EngineInfo
    62 {
    63 	CreateInterfaceFn engineFactory;
    64 	CreateInterfaceFn physicsFactory;
    65 	CreateInterfaceFn fileSystemFactory;
    66 	CGlobalVars *pGlobals;
    67 	ICvar *icvar;
    68 	IVEngineServer *engine;
    69 };
    70 
    71 /** @brief Global variable for GameDLL info */
    72 extern GameDllInfo g_GameDll;
    73 
    74 /** @brief Global variable for Engine info */
    75 extern EngineInfo g_Engine;
    76 
    77 /** @brief Global singleton for SourceHook */
    78 extern SourceHook::CSourceHookImpl g_SourceHook;
    79 
    80 /** @brief Mod path (important!)*/
    81 extern std::string g_ModPath;
    82 
    83 /** @brief Path to server binary */
    84 extern std::string g_BinPath;
    85 
    86 /** @brief Global variable for SourceHook macros */
    87 extern SourceHook::ISourceHook *g_SHPtr;
    88 
    89 /** @brief We have our own internal plugin id... */
    90 extern PluginId g_PLID;
    91 
    92 /** @brief Hook for LevelShutdown */
    93 void LevelShutdown_handler(void);
    94 
    95 #endif //_INCLUDE_SOURCEMM_H