2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2025-04-29 16:29:27 +03:00

Headers refactoring

This commit is contained in:
asmodai 2017-03-10 00:00:25 +03:00
parent 9427d6009e
commit ca861f62d2
9 changed files with 13 additions and 31 deletions

View File

@ -70,7 +70,6 @@
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile> <PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
</ClCompile> </ClCompile>
<Link> <Link>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<ModuleDefinitionFile>metamod.def</ModuleDefinitionFile> <ModuleDefinitionFile>metamod.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
@ -141,7 +140,7 @@
</SDLCheck> </SDLCheck>
</ClCompile> </ClCompile>
<Link> <Link>
<OutputFile>.\release/metamod.dll</OutputFile> <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner> <SuppressStartupBanner>true</SuppressStartupBanner>
<ModuleDefinitionFile>.\metamod.def</ModuleDefinitionFile> <ModuleDefinitionFile>.\metamod.def</ModuleDefinitionFile>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile> <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>

View File

@ -1,8 +1,5 @@
#pragma once #pragma once
#include "sdk_util.h"
#include "osdep.h"
typedef void (*FN_GAMEINIT)(); typedef void (*FN_GAMEINIT)();
// Typedefs for these are provided in SDK engine/eiface.h, but I didn't // Typedefs for these are provided in SDK engine/eiface.h, but I didn't
@ -15,4 +12,6 @@ C_DLLEXPORT int GetEntityAPI(DLL_FUNCTIONS *pFunctionTable, int interfaceVersion
C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion); C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion);
C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion); C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pNewFunctionTable, int *interfaceVersion);
#ifdef METAMOD_CORE
void compile_gamedll_callbacks(); void compile_gamedll_callbacks();
#endif

View File

@ -14,8 +14,8 @@ typedef int (*GET_ENGINE_FUNCTIONS_FN)(enginefuncs_s *pengfuncsFromEngine, int *
#ifdef METAMOD_CORE #ifdef METAMOD_CORE
#include "meta_eiface.h" // meta_enginefuncs_t #include "meta_eiface.h" // meta_enginefuncs_t
extern meta_enginefuncs_t g_meta_engfuncs; extern meta_enginefuncs_t g_meta_engfuncs;
void compile_engine_callbacks();
#else #else
extern enginefuncs_t meta_engfuncs; extern enginefuncs_t meta_engfuncs;
#endif #endif
void compile_engine_callbacks();

View File

@ -1726,17 +1726,11 @@ struct Frontend
return codebuff_.GetCodeSize(); return codebuff_.GetCodeSize();
} }
void _AppendInstr(InstrID id, uint32 opcode, uint32 encoding_flag, const detail::Opd& opd1, const detail::Opd& opd2, const detail::Opd& opd3, const detail::Opd& opd4, const detail::Opd& opd5, const detail::Opd& opd6) NOINLINE void AppendInstr(InstrID id, uint32 opcode, uint32 encoding_flag, const detail::Opd& opd1 = detail::Opd(), const detail::Opd& opd2 = detail::Opd(), const detail::Opd& opd3 = detail::Opd(), const detail::Opd& opd4 = detail::Opd(), const detail::Opd& opd5 = detail::Opd(), const detail::Opd& opd6 = detail::Opd())
{ {
instrs_.push_back(Instr(id, opcode, encoding_flag, opd1, opd2, opd3, opd4, opd5, opd6)); instrs_.push_back(Instr(id, opcode, encoding_flag, opd1, opd2, opd3, opd4, opd5, opd6));
} }
void AppendInstr(InstrID id, uint32 opcode, uint32 encoding_flag, const detail::Opd& opd1 = detail::Opd(), const detail::Opd& opd2 = detail::Opd(), const detail::Opd& opd3 = detail::Opd(), const detail::Opd& opd4 = detail::Opd(), const detail::Opd& opd5 = detail::Opd(), const detail::Opd& opd6 = detail::Opd())
{
#pragma noinline
_AppendInstr(id, opcode, encoding_flag, opd1, opd2, opd3, opd4, opd5, opd6);
}
void AppendJmp(size_t label_id) void AppendJmp(size_t label_id)
{ {
AppendInstr(I_JMP, 0, E_SPECIAL, Imm64(label_id)); AppendInstr(I_JMP, 0, E_SPECIAL, Imm64(label_id));

View File

@ -2,8 +2,9 @@
#include "dllapi.h" // GETENTITYAPI_FN, etc #include "dllapi.h" // GETENTITYAPI_FN, etc
#include "engine_api.h" // GET_ENGINE_FUNCTIONS_FN, etc #include "engine_api.h" // GET_ENGINE_FUNCTIONS_FN, etc
#include "enginecallbacks.h"
#include "h_export.h"
#include "plinfo.h" // plugin_info_t, etc #include "plinfo.h" // plugin_info_t, etc
#include "osdep.h" // DLLEXPORT, etc
#include "mutil.h" #include "mutil.h"
// Version consists of "major:minor", two separate integer numbers. // Version consists of "major:minor", two separate integer numbers.

View File

@ -53,9 +53,8 @@ extern MRegCvarList *g_regCvars;
// List of user messages registered by gamedll. // List of user messages registered by gamedll.
extern MRegMsgList *g_regMsgs; extern MRegMsgList *g_regMsgs;
#ifdef UNFINISHED #ifdef METAMOD_CORE
// List of event/logline hooks requested by plugins. ALIGN16
extern MHookList *Hooks;
#endif #endif
// Data provided to plugins. // Data provided to plugins.

View File

@ -38,14 +38,6 @@ struct mutil_funcs_t
const char * (*pfnIsQueryingClientCvar) (plid_t plid, const edict_t *pEdict); const char * (*pfnIsQueryingClientCvar) (plid_t plid, const edict_t *pEdict);
int (*pfnMakeRequestId) (plid_t plid); int (*pfnMakeRequestId) (plid_t plid);
void (*pfnGetHookTables) (plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll); void (*pfnGetHookTables) (plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll);
#ifdef UNFINISHED
int (*pfnHookGameEvent) (plid_t plid, game_event_t event, event_func_t pfnHandle);
int (*pfnHookLogTrigger) (plid_t plid, const char *trigger, logmatch_func_t pfnHandle);
int (*pfnHookLogString) (plid_t plid, const char *string, logmatch_func_t pfnHandle);
int (*pfnHookLogRegex) (plid_t plid, const char *pattern, logmatch_func_t pfnHandle);
qboolean (*pfnRemoveHookID) (plid_t plid, int hookid);
int (*pfnRemoveHookAll) (plid_t plid);
#endif
}; };
extern mutil_funcs_t g_MetaUtilFunctions; extern mutil_funcs_t g_MetaUtilFunctions;

View File

@ -21,8 +21,6 @@
#define unlikely(x) __builtin_expect(!!(x), 0) #define unlikely(x) __builtin_expect(!!(x), 0)
#endif #endif
#include "mreg.h"
#ifdef _WIN32 #ifdef _WIN32
typedef HINSTANCE module_handle_t; typedef HINSTANCE module_handle_t;
#else #else

View File

@ -2,19 +2,20 @@
#include "version/appversion.h" #include "version/appversion.h"
#define PSAPI_VERSION 1
#if defined(linux) || defined(__APPLE__) #if defined(linux) || defined(__APPLE__)
// enable extra routines in system header files, like dladdr // enable extra routines in system header files, like dladdr
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
#define _GNU_SOURCE #define _GNU_SOURCE
#endif #endif
#include <signal.h> // sigaction, etc #include <signal.h> // sigaction, etc
#else
#define PSAPI_VERSION 1
#endif #endif
#include <vector> #include <vector>
#include <array> #include <array>
#include "osconfig.h"
#include "jitasm.h" #include "jitasm.h"
#define CreateInterface mm_CreateInterface #define CreateInterface mm_CreateInterface
@ -34,7 +35,6 @@
#include "dllapi.h" #include "dllapi.h"
#include "engine_api.h" #include "engine_api.h"
#include "game_support.h" #include "game_support.h"
#include "h_export.h"
#include "meta_eiface.h" #include "meta_eiface.h"
#include "mreg.h" #include "mreg.h"
#include "meta_api.h" #include "meta_api.h"