Bintools extension no longer needs a separate build for each engine (bug 4548, r=dvander).
This commit is contained in:
parent
0ae2d99599
commit
89334bb459
@ -87,6 +87,12 @@ CLocalExtension::CLocalExtension(const char *filename)
|
|||||||
|
|
||||||
char path[PLATFORM_MAX_PATH];
|
char path[PLATFORM_MAX_PATH];
|
||||||
|
|
||||||
|
/* Special case for new bintools binary */
|
||||||
|
if (strcmp(filename, "bintools.ext") == 0)
|
||||||
|
{
|
||||||
|
goto normal;
|
||||||
|
}
|
||||||
|
|
||||||
/* Zeroth, see if there is an engine specific build in the new place. */
|
/* Zeroth, see if there is an engine specific build in the new place. */
|
||||||
g_SourceMod.BuildPath(Path_SM,
|
g_SourceMod.BuildPath(Path_SM,
|
||||||
path,
|
path,
|
||||||
@ -106,6 +112,7 @@ CLocalExtension::CLocalExtension(const char *filename)
|
|||||||
"extensions/auto." GAMEFIX "/%s." PLATFORM_LIB_EXT,
|
"extensions/auto." GAMEFIX "/%s." PLATFORM_LIB_EXT,
|
||||||
filename);
|
filename);
|
||||||
|
|
||||||
|
normal:
|
||||||
/* Try the "normal" version */
|
/* Try the "normal" version */
|
||||||
if (!g_LibSys.IsPathFile(path))
|
if (!g_LibSys.IsPathFile(path))
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 sw=4 :
|
* vim: set ts=4 sw=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -737,5 +737,13 @@ int SourceModBase::GetPluginId()
|
|||||||
return g_PLID;
|
return g_PLID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SourceModBase::GetShApiVersion()
|
||||||
|
{
|
||||||
|
int api, impl;
|
||||||
|
g_SMAPI->GetShVersions(api, impl);
|
||||||
|
|
||||||
|
return api;
|
||||||
|
}
|
||||||
|
|
||||||
SMGlobalClass *SMGlobalClass::head = NULL;
|
SMGlobalClass *SMGlobalClass::head = NULL;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -134,6 +134,7 @@ public: // ISourceMod
|
|||||||
void AddFrameAction(FRAMEACTION fn, void *data);
|
void AddFrameAction(FRAMEACTION fn, void *data);
|
||||||
const char *GetCoreConfigValue(const char *key);
|
const char *GetCoreConfigValue(const char *key);
|
||||||
int GetPluginId();
|
int GetPluginId();
|
||||||
|
int GetShApiVersion();
|
||||||
private:
|
private:
|
||||||
CStack<CDataPack *> m_freepacks;
|
CStack<CDataPack *> m_freepacks;
|
||||||
char m_SMBaseDir[PLATFORM_MAX_PATH];
|
char m_SMBaseDir[PLATFORM_MAX_PATH];
|
||||||
|
@ -1,33 +1,24 @@
|
|||||||
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
# vim: set ts=2 sw=2 tw=99 noet ft=python:
|
||||||
import os
|
import os
|
||||||
|
|
||||||
for i in SM.sdkInfo:
|
compiler = SM.DefaultExtCompiler('extensions/bintools')
|
||||||
sdk = SM.sdkInfo[i]
|
compiler['CDEFINES'].append('HOOKING_ENABLED')
|
||||||
if AMBuild.target['platform'] not in sdk['platform']:
|
compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
|
||||||
continue
|
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit'))
|
||||||
|
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit', 'x86'))
|
||||||
|
|
||||||
name = 'bintools.ext.' + sdk['ext']
|
extension = AMBuild.AddJob('bintools.ext')
|
||||||
|
binary = Cpp.LibraryBuilder('bintools.ext', AMBuild, extension, compiler)
|
||||||
compiler = SM.DefaultHL2Compiler('extensions/bintools', i, True, '')
|
binary.AddSourceFiles('extensions/bintools', [
|
||||||
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit'))
|
'extension.cpp',
|
||||||
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit', 'x86'))
|
'CallMaker.cpp',
|
||||||
|
'CallWrapper.cpp',
|
||||||
|
'HookWrapper.cpp',
|
||||||
|
'jit_call.cpp',
|
||||||
|
'jit_hook.cpp',
|
||||||
|
'sdk/smsdk_ext.cpp'
|
||||||
|
])
|
||||||
|
SM.AutoVersion('extensions/bintools', binary)
|
||||||
|
binary.SendToJob()
|
||||||
|
|
||||||
if i != 'ep1':
|
|
||||||
compiler['CDEFINES'].append('HOOKING_ENABLED')
|
|
||||||
|
|
||||||
extension = AMBuild.AddJob(name)
|
|
||||||
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
|
|
||||||
SM.PreSetupHL2Job(extension, binary, i)
|
|
||||||
binary.AddSourceFiles('extensions/bintools', [
|
|
||||||
'extension.cpp',
|
|
||||||
'CallMaker.cpp',
|
|
||||||
'CallWrapper.cpp',
|
|
||||||
'HookWrapper.cpp',
|
|
||||||
'jit_call.cpp',
|
|
||||||
'jit_hook.cpp',
|
|
||||||
'sdk/smsdk_ext.cpp'
|
|
||||||
])
|
|
||||||
SM.PostSetupHL2Job(extension, binary, i)
|
|
||||||
SM.AutoVersion('extensions/bintools', binary)
|
|
||||||
binary.SendToJob()
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod BinTools Extension
|
* SourceMod BinTools Extension
|
||||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -128,17 +128,17 @@ unsigned int HookWrapper::GetParamOffset(unsigned int argnum, unsigned int *size
|
|||||||
void HookWrapper::PerformRecall(void *params, void *retval)
|
void HookWrapper::PerformRecall(void *params, void *retval)
|
||||||
{
|
{
|
||||||
/* Notify SourceHook of the upcoming recall */
|
/* Notify SourceHook of the upcoming recall */
|
||||||
SH_GLOB_SHPTR->DoRecall();
|
m_pSH->DoRecall();
|
||||||
|
|
||||||
/* Add thisptr into params buffer */
|
/* Add thisptr into params buffer */
|
||||||
unsigned char *newparams = new unsigned char[sizeof(void *) + m_ParamSize];
|
unsigned char *newparams = new unsigned char[sizeof(void *) + m_ParamSize];
|
||||||
*(void **)newparams = META_IFACEPTR(void);
|
*(void **)newparams = m_pSH->GetIfacePtr();
|
||||||
memcpy(newparams + sizeof(void *), params, m_ParamSize);
|
memcpy(newparams + sizeof(void *), params, m_ParamSize);
|
||||||
|
|
||||||
/* Execute the call */
|
/* Execute the call */
|
||||||
m_CallWrapper->Execute(newparams, retval);
|
m_CallWrapper->Execute(newparams, retval);
|
||||||
|
|
||||||
SET_META_RESULT(MRES_SUPERCEDE);
|
m_pSH->SetRes(MRES_SUPERCEDE);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 sw=4 tw=99 noet:
|
* vim: set ts=4 sw=4 tw=99 noet:
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod BinTools Extension
|
* SourceMod BinTools Extension
|
||||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -49,9 +49,12 @@ bool BinTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
{
|
{
|
||||||
g_SPEngine = g_pSM->GetScriptingEngine();
|
g_SPEngine = g_pSM->GetScriptingEngine();
|
||||||
g_pShareSys->AddInterface(myself, &g_CallMaker);
|
g_pShareSys->AddInterface(myself, &g_CallMaker);
|
||||||
#if defined METAMOD_PLAPI_VERSION
|
|
||||||
g_pShareSys->AddInterface(myself, &g_CallMaker2);
|
/* IBinTools2 is only compatible with SH v5 */
|
||||||
#endif
|
if (g_pSM->GetShApiVersion() >= 5)
|
||||||
|
{
|
||||||
|
g_pShareSys->AddInterface(myself, &g_CallMaker2);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod BinTools Extension
|
* SourceMod BinTools Extension
|
||||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -56,9 +56,7 @@
|
|||||||
* @brief Sets whether or not this plugin required Metamod.
|
* @brief Sets whether or not this plugin required Metamod.
|
||||||
* NOTE: Uncomment to enable, comment to disable.
|
* NOTE: Uncomment to enable, comment to disable.
|
||||||
*/
|
*/
|
||||||
#if defined HOOKING_ENABLED
|
//#define SMEXT_CONF_METAMOD
|
||||||
#define SMEXT_CONF_METAMOD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Enable interfaces you want to use here by uncommenting lines */
|
/** Enable interfaces you want to use here by uncommenting lines */
|
||||||
//#define SMEXT_ENABLE_FORWARDSYS
|
//#define SMEXT_ENABLE_FORWARDSYS
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* vim: set ts=4 :
|
* vim: set ts=4 :
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
* SourceMod
|
* SourceMod
|
||||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||||
* =============================================================================
|
* =============================================================================
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -43,7 +43,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#define SMINTERFACE_SOURCEMOD_NAME "ISourceMod"
|
#define SMINTERFACE_SOURCEMOD_NAME "ISourceMod"
|
||||||
#define SMINTERFACE_SOURCEMOD_VERSION 11
|
#define SMINTERFACE_SOURCEMOD_VERSION 12
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Forward declaration of the KeyValues class.
|
* @brief Forward declaration of the KeyValues class.
|
||||||
@ -303,6 +303,14 @@ namespace SourceMod
|
|||||||
* @return Metamod:Source PluginId.
|
* @return Metamod:Source PluginId.
|
||||||
*/
|
*/
|
||||||
virtual int GetPluginId() = 0;
|
virtual int GetPluginId() = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns SourceHook's API version.
|
||||||
|
*
|
||||||
|
* @return SourceHook API version number.
|
||||||
|
*/
|
||||||
|
virtual int GetShApiVersion() = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user