loader/loader.h
author Nicholas Hastings <skamonkey@gmail.com>
Fri Jul 20 17:26:56 2012 -0400 (2012-07-20)
changeset 787 2310f65888f2
parent 780 35f2a207badf
child 791 a1b97ab6e0b1
permissions -rw-r--r--
Added missing vc10 proj configs, updated to only build necessary core ver (NPOTB).
     1 /**
     2  * vim: set ts=4 sw=4 tw=99 noet :
     3  * ======================================================
     4  * Metamod:Source
     5  * Copyright (C) 2004-2009 AlliedModders LLC and authors.
     6  * All rights reserved.
     7  * ======================================================
     8  *
     9  * This software is provided 'as-is', without any express or implied warranty.
    10  * In no event will the authors be held liable for any damages arising from 
    11  * the use of this software.
    12  * 
    13  * Permission is granted to anyone to use this software for any purpose, 
    14  * including commercial applications, and to alter it and redistribute it 
    15  * freely, subject to the following restrictions:
    16  *
    17  * 1. The origin of this software must not be misrepresented; you must not 
    18  * claim that you wrote the original software. If you use this software in a 
    19  * product, an acknowledgment in the product documentation would be 
    20  * appreciated but is not required.
    21  * 2. Altered source versions must be plainly marked as such, and must not be
    22  * misrepresented as being the original software.
    23  * 3. This notice may not be removed or altered from any source distribution.
    24  */
    25 
    26 #ifndef _INCLUDE_METAMOD_SOURCE_LOADER_H_
    27 #define _INCLUDE_METAMOD_SOURCE_LOADER_H_
    28 
    29 // System
    30 #define SH_SYS_WIN32	1
    31 #define SH_SYS_LINUX	2
    32 #define SH_SYS_APPLE	3
    33 
    34 // Platform
    35 #define SH_XP_POSIX		10
    36 #define SH_XP_WINAPI	20
    37 
    38 // Compiler
    39 #define SH_COMP_GCC 	1
    40 #define SH_COMP_MSVC	2
    41 
    42 #if defined WIN32
    43 #define SH_SYS              SH_SYS_WIN32
    44 #define SH_XP               SH_XP_WINAPI
    45 #define SH_COMP             SH_COMP_MSVC
    46 #define WINDOWS_LEAN_AND_MEAN
    47 #include <windows.h>
    48 #include <direct.h>
    49 #define PLATFORM_MAX_PATH	MAX_PATH
    50 #define	PATH_SEP_STR		"\\"
    51 #define PATH_SEP_CHAR		'\\'
    52 #define ALT_SEP_CHAR		'/'
    53 #elif defined __linux__ || defined __APPLE__
    54 #if defined __linux__
    55 #define SH_SYS				SH_SYS_LINUX
    56 #elif defined __APPLE__
    57 #define SH_SYS				SH_SYS_APPLE
    58 #endif
    59 #define SH_XP               SH_XP_POSIX
    60 #define SH_COMP             SH_COMP_GCC
    61 #include <dlfcn.h>
    62 #include <dirent.h>
    63 #include <stdint.h>
    64 #include <unistd.h>
    65 #if SH_SYS == SH_SYS_APPLE
    66 #include <sys/syslimits.h>
    67 #endif
    68 typedef void *	HMODULE;
    69 #define PLATFORM_MAX_PATH	PATH_MAX
    70 #define	PATH_SEP_STR		"/"
    71 #define PATH_SEP_CHAR		'/'
    72 #define ALT_SEP_CHAR		'\\'
    73 #else
    74 #error "OS detection failed"
    75 #endif
    76 
    77 #include "loader_bridge.h"
    78 
    79 #define SH_PTRSIZE sizeof(void*)
    80 
    81 enum MetamodBackend
    82 {
    83 	MMBackend_Episode1 = 0,
    84 	MMBackend_DarkMessiah,
    85 	MMBackend_Episode2,
    86 	MMBackend_BloodyGoodTime,
    87 	MMBackend_EYE,
    88 	MMBackend_Episode2Valve,
    89 	MMBackend_Left4Dead,
    90 	MMBackend_Left4Dead2,
    91 	MMBackend_AlienSwarm,
    92 	MMBackend_Portal2,
    93 	MMBackend_CSGO,
    94 	MMBackend_UNKNOWN
    95 };
    96 
    97 extern bool
    98 mm_LoadMetamodLibrary(MetamodBackend backend, char *buffer, size_t maxlength);
    99 
   100 extern void *
   101 mm_GetProcAddress(const char *name);
   102 
   103 extern void
   104 mm_UnloadMetamodLibrary();
   105 
   106 extern void
   107 mm_LogFatal(const char *message, ...);
   108 
   109 extern const char *
   110 mm_GetGameName();
   111 
   112 extern MetamodBackend
   113 mm_DetermineBackend(QueryValveInterface qvi, const char *game_name);
   114 
   115 extern MetamodBackend mm_backend;
   116 
   117 #endif /* _INCLUDE_METAMOD_SOURCE_LOADER_H_ */
   118