2008-11-26 07:19:30 +01:00
|
|
|
/**
|
2009-10-29 16:57:27 +01:00
|
|
|
* vim: set ts=4 sw=4 tw=99 noet :
|
2008-11-26 07:19:30 +01:00
|
|
|
* ======================================================
|
|
|
|
* Metamod:Source
|
2015-07-09 20:09:56 +02:00
|
|
|
* Copyright (C) 2004-2015 AlliedModders LLC and authors.
|
2008-11-26 07:19:30 +01:00
|
|
|
* All rights reserved.
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* This software is provided 'as-is', without any express or implied warranty.
|
|
|
|
* In no event will the authors be held liable for any damages arising from
|
|
|
|
* the use of this software.
|
|
|
|
*
|
|
|
|
* Permission is granted to anyone to use this software for any purpose,
|
|
|
|
* including commercial applications, and to alter it and redistribute it
|
|
|
|
* freely, subject to the following restrictions:
|
|
|
|
*
|
|
|
|
* 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
* claim that you wrote the original software. If you use this software in a
|
|
|
|
* product, an acknowledgment in the product documentation would be
|
|
|
|
* appreciated but is not required.
|
|
|
|
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
* misrepresented as being the original software.
|
|
|
|
* 3. This notice may not be removed or altered from any source distribution.
|
|
|
|
*/
|
|
|
|
|
2008-11-16 01:29:24 +01:00
|
|
|
#ifndef _INCLUDE_METAMOD_SOURCE_LOADER_H_
|
|
|
|
#define _INCLUDE_METAMOD_SOURCE_LOADER_H_
|
|
|
|
|
2009-11-24 14:57:17 +01:00
|
|
|
// System
|
2009-11-24 15:01:06 +01:00
|
|
|
#define SH_SYS_WIN32 1
|
2009-11-24 14:57:17 +01:00
|
|
|
#define SH_SYS_LINUX 2
|
2009-11-24 15:01:06 +01:00
|
|
|
#define SH_SYS_APPLE 3
|
|
|
|
|
|
|
|
// Platform
|
|
|
|
#define SH_XP_POSIX 10
|
|
|
|
#define SH_XP_WINAPI 20
|
|
|
|
|
2009-11-24 14:57:17 +01:00
|
|
|
// Compiler
|
2008-11-16 01:29:24 +01:00
|
|
|
#define SH_COMP_GCC 1
|
|
|
|
#define SH_COMP_MSVC 2
|
|
|
|
|
|
|
|
#if defined WIN32
|
2010-05-14 07:34:56 +02:00
|
|
|
#define SH_SYS SH_SYS_WIN32
|
|
|
|
#define SH_XP SH_XP_WINAPI
|
|
|
|
#define SH_COMP SH_COMP_MSVC
|
2008-11-16 01:29:24 +01:00
|
|
|
#define WINDOWS_LEAN_AND_MEAN
|
|
|
|
#include <windows.h>
|
2008-11-24 05:18:17 +01:00
|
|
|
#include <direct.h>
|
2008-11-16 01:29:24 +01:00
|
|
|
#define PLATFORM_MAX_PATH MAX_PATH
|
2008-11-24 04:21:49 +01:00
|
|
|
#define PATH_SEP_STR "\\"
|
|
|
|
#define PATH_SEP_CHAR '\\'
|
|
|
|
#define ALT_SEP_CHAR '/'
|
2010-05-14 07:34:56 +02:00
|
|
|
#elif defined __linux__ || defined __APPLE__
|
|
|
|
#if defined __linux__
|
|
|
|
#define SH_SYS SH_SYS_LINUX
|
|
|
|
#elif defined __APPLE__
|
|
|
|
#define SH_SYS SH_SYS_APPLE
|
|
|
|
#endif
|
|
|
|
#define SH_XP SH_XP_POSIX
|
|
|
|
#define SH_COMP SH_COMP_GCC
|
2008-11-16 01:29:24 +01:00
|
|
|
#include <dlfcn.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <stdint.h>
|
2008-11-24 04:21:49 +01:00
|
|
|
#include <unistd.h>
|
2010-05-14 07:34:56 +02:00
|
|
|
#if SH_SYS == SH_SYS_APPLE
|
|
|
|
#include <sys/syslimits.h>
|
|
|
|
#endif
|
2008-11-16 01:29:24 +01:00
|
|
|
typedef void * HMODULE;
|
|
|
|
#define PLATFORM_MAX_PATH PATH_MAX
|
2008-11-24 04:21:49 +01:00
|
|
|
#define PATH_SEP_STR "/"
|
|
|
|
#define PATH_SEP_CHAR '/'
|
|
|
|
#define ALT_SEP_CHAR '\\'
|
2008-11-16 01:29:24 +01:00
|
|
|
#else
|
|
|
|
#error "OS detection failed"
|
|
|
|
#endif
|
|
|
|
|
2008-11-24 04:21:49 +01:00
|
|
|
#include "loader_bridge.h"
|
|
|
|
|
2008-11-16 01:29:24 +01:00
|
|
|
#define SH_PTRSIZE sizeof(void*)
|
|
|
|
|
|
|
|
enum MetamodBackend
|
|
|
|
{
|
|
|
|
MMBackend_Episode1 = 0,
|
2009-10-29 16:57:27 +01:00
|
|
|
MMBackend_DarkMessiah,
|
2008-11-16 01:29:24 +01:00
|
|
|
MMBackend_Episode2,
|
2011-01-10 20:09:50 +01:00
|
|
|
MMBackend_BloodyGoodTime,
|
2011-08-08 14:57:03 +02:00
|
|
|
MMBackend_EYE,
|
2012-08-20 20:25:29 +02:00
|
|
|
MMBackend_CSS,
|
2013-07-31 12:49:21 +02:00
|
|
|
MMBackend_Episode2Valve_OBSOLETE,
|
2008-11-16 01:29:24 +01:00
|
|
|
MMBackend_Left4Dead,
|
2009-10-29 16:57:27 +01:00
|
|
|
MMBackend_Left4Dead2,
|
2010-07-22 10:22:27 +02:00
|
|
|
MMBackend_AlienSwarm,
|
2012-05-26 23:07:26 +02:00
|
|
|
MMBackend_Portal2,
|
|
|
|
MMBackend_CSGO,
|
2013-03-04 16:38:17 +01:00
|
|
|
MMBackend_DOTA,
|
2013-07-31 12:49:21 +02:00
|
|
|
MMBackend_HL2DM,
|
|
|
|
MMBackend_DODS,
|
|
|
|
MMBackend_TF2,
|
|
|
|
MMBackend_NuclearDawn,
|
2013-10-09 03:01:53 +02:00
|
|
|
MMBackend_SDK2013,
|
2013-10-09 14:46:13 +02:00
|
|
|
MMBackend_Blade,
|
2013-10-09 15:00:23 +02:00
|
|
|
MMBackend_Insurgency,
|
2014-03-24 04:37:46 +01:00
|
|
|
MMBackend_Contagion,
|
2015-05-06 23:51:54 +02:00
|
|
|
MMBackend_BMS,
|
2017-11-03 19:52:37 +01:00
|
|
|
MMBackend_DOI,
|
2021-09-21 06:05:21 +02:00
|
|
|
MMBackend_Mock,
|
2022-10-24 18:57:18 +02:00
|
|
|
|
|
|
|
MMBackend_PVKII,
|
2008-11-16 01:29:24 +01:00
|
|
|
MMBackend_UNKNOWN
|
|
|
|
};
|
|
|
|
|
|
|
|
extern bool
|
|
|
|
mm_LoadMetamodLibrary(MetamodBackend backend, char *buffer, size_t maxlength);
|
|
|
|
|
|
|
|
extern void *
|
|
|
|
mm_GetProcAddress(const char *name);
|
|
|
|
|
|
|
|
extern void
|
|
|
|
mm_UnloadMetamodLibrary();
|
|
|
|
|
|
|
|
extern void
|
|
|
|
mm_LogFatal(const char *message, ...);
|
|
|
|
|
2013-10-24 19:24:22 +02:00
|
|
|
extern void
|
2013-03-23 01:47:35 +01:00
|
|
|
mm_GetGameName(char *buffer, size_t size);
|
2009-02-18 08:38:23 +01:00
|
|
|
|
2008-11-24 04:21:49 +01:00
|
|
|
extern MetamodBackend
|
2014-01-07 23:39:55 +01:00
|
|
|
mm_DetermineBackend(QueryValveInterface engineFactory, QueryValveInterface serverFactory, const char *game_name);
|
2008-11-24 04:21:49 +01:00
|
|
|
|
2009-11-23 06:54:55 +01:00
|
|
|
extern MetamodBackend mm_backend;
|
|
|
|
|
2008-11-16 01:29:24 +01:00
|
|
|
#endif /* _INCLUDE_METAMOD_SOURCE_LOADER_H_ */
|
|
|
|
|