mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-07 02:18:35 +00:00
Merge branch 'master' into k/build_static_libs
This commit is contained in:
commit
df52ac7b43
6
.github/workflows/scripting.yml
vendored
6
.github/workflows/scripting.yml
vendored
@ -31,9 +31,9 @@ jobs:
|
|||||||
|
|
||||||
# Setup Python for AMBuild
|
# Setup Python for AMBuild
|
||||||
- uses: actions/setup-python@v6
|
- uses: actions/setup-python@v6
|
||||||
name: Setup Python 3.8
|
name: Setup Python 3.12
|
||||||
with:
|
with:
|
||||||
python-version: 3.8
|
python-version: 3.12
|
||||||
- name: Install AMBuild
|
- name: Install AMBuild
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip setuptools wheel
|
python -m pip install --upgrade pip setuptools wheel
|
||||||
@ -67,7 +67,7 @@ jobs:
|
|||||||
echo "SM_VERSION=$(cat ../product.version)" >> $GITHUB_ENV
|
echo "SM_VERSION=$(cat ../product.version)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Archive tooling
|
- name: Archive tooling
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v5
|
||||||
with:
|
with:
|
||||||
name: sourcemod-tooling-${{ env.SM_VERSION }}-${{ matrix.os_short }}
|
name: sourcemod-tooling-${{ env.SM_VERSION }}-${{ matrix.os_short }}
|
||||||
path: build/package
|
path: build/package
|
||||||
|
|||||||
@ -58,6 +58,7 @@ public:
|
|||||||
virtual bool IsDirectory(const char *pFileName, const char *pathID = 0) = 0;
|
virtual bool IsDirectory(const char *pFileName, const char *pathID = 0) = 0;
|
||||||
virtual void CreateDirHierarchy(const char *path, const char *pathID = 0) = 0;
|
virtual void CreateDirHierarchy(const char *path, const char *pathID = 0) = 0;
|
||||||
virtual int GetSearchPath(const char* pathID, bool bGetPackFiles, char* pPath, int nMaxLen) = 0;
|
virtual int GetSearchPath(const char* pathID, bool bGetPackFiles, char* pPath, int nMaxLen) = 0;
|
||||||
|
virtual const char * GetGameBinArchSubdirectory() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace SourceMod
|
} // namespace SourceMod
|
||||||
|
|||||||
@ -1094,13 +1094,18 @@ void GameBinPathManager::Init()
|
|||||||
std::istringstream iss(search_path);
|
std::istringstream iss(search_path);
|
||||||
for (std::string path; std::getline(iss, path, ';');)
|
for (std::string path; std::getline(iss, path, ';');)
|
||||||
{
|
{
|
||||||
if (path.length() > 0
|
if (path.length() > 0)
|
||||||
&& path.find(addons_folder) == std::string::npos
|
|
||||||
&& m_lookup.find(path) == m_lookup.cend()
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
m_lookup.insert(path);
|
const char* arch_subdir = bridge->filesystem->GetGameBinArchSubdirectory();
|
||||||
m_ordered.push_back(path);
|
std::string full_path = path + arch_subdir;
|
||||||
|
if (full_path.find(addons_folder) == std::string::npos
|
||||||
|
&& m_lookup.find(full_path) == m_lookup.cend()
|
||||||
|
)
|
||||||
|
{
|
||||||
|
m_lookup.insert(full_path);
|
||||||
|
m_ordered.push_back(full_path);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -188,6 +188,15 @@ bool AddString(char **buf_p, size_t &maxlen, const char *string, int width, int
|
|||||||
|
|
||||||
width -= size;
|
width -= size;
|
||||||
|
|
||||||
|
if (!(flags & LADJUST))
|
||||||
|
{
|
||||||
|
while ((width-- > 0) && maxlen)
|
||||||
|
{
|
||||||
|
*buf++ = ' ';
|
||||||
|
maxlen--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (g_FormatEscapeDatabase && (flags & NOESCAPE) == 0)
|
if (g_FormatEscapeDatabase && (flags & NOESCAPE) == 0)
|
||||||
{
|
{
|
||||||
char *tempBuffer = NULL;
|
char *tempBuffer = NULL;
|
||||||
@ -226,10 +235,13 @@ bool AddString(char **buf_p, size_t &maxlen, const char *string, int width, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((width-- > 0) && maxlen)
|
if (flags & LADJUST)
|
||||||
{
|
{
|
||||||
*buf++ = ' ';
|
while ((width-- > 0) && maxlen)
|
||||||
maxlen--;
|
{
|
||||||
|
*buf++ = ' ';
|
||||||
|
maxlen--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*buf_p = buf;
|
*buf_p = buf;
|
||||||
@ -254,6 +266,12 @@ void AddFloat(char **buf_p, size_t &maxlen, double fval, int width, int prec, in
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ke::IsInfinite(static_cast<float>(fval)))
|
||||||
|
{
|
||||||
|
AddString(buf_p, maxlen, "Inf", width, prec, flags | NOESCAPE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// default precision
|
// default precision
|
||||||
if (prec < 0)
|
if (prec < 0)
|
||||||
{
|
{
|
||||||
@ -485,13 +503,15 @@ void AddInt(char **buf_p, size_t &maxlen, int val, int width, int flags)
|
|||||||
unsignedVal /= 10;
|
unsignedVal /= 10;
|
||||||
} while (unsignedVal);
|
} while (unsignedVal);
|
||||||
|
|
||||||
if (signedVal < 0)
|
|
||||||
{
|
|
||||||
text[digits++] = '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = *buf_p;
|
buf = *buf_p;
|
||||||
|
|
||||||
|
// minus sign BEFORE left padding if padding with zeros
|
||||||
|
if (signedVal < 0 && maxlen && (flags & ZEROPAD))
|
||||||
|
{
|
||||||
|
*buf++ = '-';
|
||||||
|
maxlen--;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(flags & LADJUST))
|
if (!(flags & LADJUST))
|
||||||
{
|
{
|
||||||
while ((digits < width) && maxlen)
|
while ((digits < width) && maxlen)
|
||||||
@ -502,6 +522,13 @@ void AddInt(char **buf_p, size_t &maxlen, int val, int width, int flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// minus sign AFTER left padding if padding with spaces
|
||||||
|
if (signedVal < 0 && maxlen && !(flags & ZEROPAD))
|
||||||
|
{
|
||||||
|
*buf++ = '-';
|
||||||
|
maxlen--;
|
||||||
|
}
|
||||||
|
|
||||||
while (digits-- && maxlen)
|
while (digits-- && maxlen)
|
||||||
{
|
{
|
||||||
*buf++ = text[digits];
|
*buf++ = text[digits];
|
||||||
|
|||||||
@ -194,6 +194,25 @@ public:
|
|||||||
{
|
{
|
||||||
return filesystem->GetSearchPath(pathID, bGetPackFiles, pPath, nMaxLen);
|
return filesystem->GetSearchPath(pathID, bGetPackFiles, pPath, nMaxLen);
|
||||||
}
|
}
|
||||||
|
const char* GetGameBinArchSubdirectory() override
|
||||||
|
{
|
||||||
|
#if defined( KE_ARCH_X64 ) && SOURCE_ENGINE >= SE_BLADE
|
||||||
|
#if defined( PLATFORM_WINDOWS )
|
||||||
|
#if SOURCE_ENGINE == SE_MCV
|
||||||
|
return "win64" PLATFORM_SEP;
|
||||||
|
#else
|
||||||
|
return "x64" PLATFORM_SEP;
|
||||||
|
#endif // SOURCE_ENGINE == SE_MCV
|
||||||
|
#elif defined( PLATFORM_LINUX )
|
||||||
|
return "linux64" PLATFORM_SEP;
|
||||||
|
#else
|
||||||
|
#error "Unsupported platform"
|
||||||
|
#endif // PLATFORM
|
||||||
|
#else
|
||||||
|
// Already included in the GameBin path(s), if required
|
||||||
|
return "";
|
||||||
|
#endif // defined( KE_ARCH_X64 ) && SOURCE_ENGINE >= SE_BLADE
|
||||||
|
}
|
||||||
} fs_wrapper;
|
} fs_wrapper;
|
||||||
|
|
||||||
class VPlayerInfo_Logic : public IPlayerInfoBridge
|
class VPlayerInfo_Logic : public IPlayerInfoBridge
|
||||||
|
|||||||
@ -532,6 +532,7 @@ CDynamicHooksSourcePawn::CDynamicHooksSourcePawn(HookSetup *setup, CHook *pDetou
|
|||||||
this->hookType = setup->hookType;
|
this->hookType = setup->hookType;
|
||||||
this->m_pDetour = pDetour;
|
this->m_pDetour = pDetour;
|
||||||
this->callConv = setup->callConv;
|
this->callConv = setup->callConv;
|
||||||
|
this->thisFuncCallConv = setup->callConv;
|
||||||
}
|
}
|
||||||
|
|
||||||
HookReturnStruct *CDynamicHooksSourcePawn::GetReturnStruct()
|
HookReturnStruct *CDynamicHooksSourcePawn::GetReturnStruct()
|
||||||
|
|||||||
@ -42,6 +42,8 @@ enum SDKFuncConfSource
|
|||||||
SDKConf_Address
|
SDKConf_Address
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using ParamVector = SourceHook::CVector<ParamInfo>;
|
||||||
|
|
||||||
bool GetHandleIfValidOrError(HandleType_t type, void **object, IPluginContext *pContext, cell_t param)
|
bool GetHandleIfValidOrError(HandleType_t type, void **object, IPluginContext *pContext, cell_t param)
|
||||||
{
|
{
|
||||||
if(param == BAD_HANDLE)
|
if(param == BAD_HANDLE)
|
||||||
@ -81,6 +83,56 @@ bool GetCallbackArgHandleIfValidOrError(HandleType_t type, HandleType_t otherTyp
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GetObjectAddrOrThis(IPluginContext *pContext, const cell_t *params, void *&retAddr)
|
||||||
|
{
|
||||||
|
HookParamsStruct *paramStruct = NULL;
|
||||||
|
retAddr = NULL;
|
||||||
|
|
||||||
|
if(!GetCallbackArgHandleIfValidOrError(g_HookParamsHandle, g_HookReturnHandle, (void **)¶mStruct, pContext, params[1]))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(params[2] != 0)
|
||||||
|
{
|
||||||
|
const ParamVector ¶msVec = paramStruct->dg->params;
|
||||||
|
|
||||||
|
if(params[2] < 0 || params[2] > static_cast<int>(paramsVec.size()))
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Invalid param number %i max params is %i", params[2], paramsVec.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = params[2] - 1;
|
||||||
|
const ParamInfo ¶m = paramsVec.at(index);
|
||||||
|
|
||||||
|
if(param.type != HookParamType_ObjectPtr && param.type != HookParamType_Object)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Invalid object value type %i", param.type);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t offset = GetParamOffset(paramStruct, index);
|
||||||
|
retAddr = GetObjectAddr(param.type, param.flags, paramStruct->orgParams, offset);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const DHooksInfo* dgInfo = paramStruct->dg;
|
||||||
|
|
||||||
|
if(dgInfo->thisFuncCallConv != CallConv_THISCALL)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Parameter 'this' is only available in member functions");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dgInfo->thisType != ThisPointer_Address
|
||||||
|
&& dgInfo->thisType != ThisPointer_CBaseEntity
|
||||||
|
&& dgInfo->hookType != HookType_GameRules)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Parameter 'this' is not specified as an address, it is not available");
|
||||||
|
}
|
||||||
|
|
||||||
|
retAddr = g_SHPtr->GetIfacePtr();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
IPluginFunction *GetCallback(IPluginContext *pContext, HookSetup * setup, const cell_t *params, cell_t callback_index)
|
IPluginFunction *GetCallback(IPluginContext *pContext, HookSetup * setup, const cell_t *params, cell_t callback_index)
|
||||||
{
|
{
|
||||||
IPluginFunction *ret = NULL;
|
IPluginFunction *ret = NULL;
|
||||||
@ -1089,28 +1141,12 @@ cell_t Native_RemoveEntityListener(IPluginContext *pContext, const cell_t *param
|
|||||||
//native any:DHookGetParamObjectPtrVar(Handle:hParams, num, offset, ObjectValueType:type);
|
//native any:DHookGetParamObjectPtrVar(Handle:hParams, num, offset, ObjectValueType:type);
|
||||||
cell_t Native_GetParamObjectPtrVar(IPluginContext *pContext, const cell_t *params)
|
cell_t Native_GetParamObjectPtrVar(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
HookParamsStruct *paramStruct;
|
void *addr = NULL;
|
||||||
|
if(!GetObjectAddrOrThis(pContext, params, addr))
|
||||||
if(!GetCallbackArgHandleIfValidOrError(g_HookParamsHandle, g_HookReturnHandle, (void **)¶mStruct, pContext, params[1]))
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(params[2] <= 0 || params[2] > (int)paramStruct->dg->params.size())
|
|
||||||
{
|
|
||||||
return pContext->ThrowNativeError("Invalid param number %i max params is %i", params[2], paramStruct->dg->params.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
int index = params[2] - 1;
|
|
||||||
|
|
||||||
if(paramStruct->dg->params.at(index).type != HookParamType_ObjectPtr && paramStruct->dg->params.at(index).type != HookParamType_Object)
|
|
||||||
{
|
|
||||||
return pContext->ThrowNativeError("Invalid object value type %i", paramStruct->dg->params.at(index).type);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t offset = GetParamOffset(paramStruct, index);
|
|
||||||
void *addr = GetObjectAddr(paramStruct->dg->params.at(index).type, paramStruct->dg->params.at(index).flags, paramStruct->orgParams, offset);
|
|
||||||
|
|
||||||
switch((ObjectValueType)params[4])
|
switch((ObjectValueType)params[4])
|
||||||
{
|
{
|
||||||
case ObjectValueType_Int:
|
case ObjectValueType_Int:
|
||||||
@ -1160,28 +1196,12 @@ cell_t Native_GetParamObjectPtrVar(IPluginContext *pContext, const cell_t *param
|
|||||||
//native DHookSetParamObjectPtrVar(Handle:hParams, num, offset, ObjectValueType:type, value)
|
//native DHookSetParamObjectPtrVar(Handle:hParams, num, offset, ObjectValueType:type, value)
|
||||||
cell_t Native_SetParamObjectPtrVar(IPluginContext *pContext, const cell_t *params)
|
cell_t Native_SetParamObjectPtrVar(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
HookParamsStruct *paramStruct;
|
void *addr = NULL;
|
||||||
|
if(!GetObjectAddrOrThis(pContext, params, addr))
|
||||||
if(!GetCallbackArgHandleIfValidOrError(g_HookParamsHandle, g_HookReturnHandle, (void **)¶mStruct, pContext, params[1]))
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(params[2] <= 0 || params[2] > (int)paramStruct->dg->params.size())
|
|
||||||
{
|
|
||||||
return pContext->ThrowNativeError("Invalid param number %i max params is %i", params[2], paramStruct->dg->params.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
int index = params[2] - 1;
|
|
||||||
|
|
||||||
if(paramStruct->dg->params.at(index).type != HookParamType_ObjectPtr && paramStruct->dg->params.at(index).type != HookParamType_Object)
|
|
||||||
{
|
|
||||||
return pContext->ThrowNativeError("Invalid object value type %i", paramStruct->dg->params.at(index).type);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t offset = GetParamOffset(paramStruct, index);
|
|
||||||
void *addr = GetObjectAddr(paramStruct->dg->params.at(index).type, paramStruct->dg->params.at(index).flags, paramStruct->orgParams, offset);
|
|
||||||
|
|
||||||
switch((ObjectValueType)params[4])
|
switch((ObjectValueType)params[4])
|
||||||
{
|
{
|
||||||
case ObjectValueType_Int:
|
case ObjectValueType_Int:
|
||||||
@ -1245,28 +1265,12 @@ cell_t Native_SetParamObjectPtrVar(IPluginContext *pContext, const cell_t *param
|
|||||||
//native DHookGetParamObjectPtrVarVector(Handle:hParams, num, offset, ObjectValueType:type, Float:buffer[3]);
|
//native DHookGetParamObjectPtrVarVector(Handle:hParams, num, offset, ObjectValueType:type, Float:buffer[3]);
|
||||||
cell_t Native_GetParamObjectPtrVarVector(IPluginContext *pContext, const cell_t *params)
|
cell_t Native_GetParamObjectPtrVarVector(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
HookParamsStruct *paramStruct;
|
void *addr = NULL;
|
||||||
|
if(!GetObjectAddrOrThis(pContext, params, addr))
|
||||||
if(!GetCallbackArgHandleIfValidOrError(g_HookParamsHandle, g_HookReturnHandle, (void **)¶mStruct, pContext, params[1]))
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(params[2] <= 0 || params[2] > (int)paramStruct->dg->params.size())
|
|
||||||
{
|
|
||||||
return pContext->ThrowNativeError("Invalid param number %i max params is %i", params[2], paramStruct->dg->params.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
int index = params[2] - 1;
|
|
||||||
|
|
||||||
if(paramStruct->dg->params.at(index).type != HookParamType_ObjectPtr && paramStruct->dg->params.at(index).type != HookParamType_Object)
|
|
||||||
{
|
|
||||||
return pContext->ThrowNativeError("Invalid object value type %i", paramStruct->dg->params.at(index).type);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t offset = GetParamOffset(paramStruct, index);
|
|
||||||
void *addr = GetObjectAddr(paramStruct->dg->params.at(index).type, paramStruct->dg->params.at(index).flags, paramStruct->orgParams, offset);
|
|
||||||
|
|
||||||
cell_t *buffer;
|
cell_t *buffer;
|
||||||
pContext->LocalToPhysAddr(params[5], &buffer);
|
pContext->LocalToPhysAddr(params[5], &buffer);
|
||||||
|
|
||||||
@ -1299,28 +1303,12 @@ cell_t Native_GetParamObjectPtrVarVector(IPluginContext *pContext, const cell_t
|
|||||||
//native DHookSetParamObjectPtrVarVector(Handle:hParams, num, offset, ObjectValueType:type, Float:value[3]);
|
//native DHookSetParamObjectPtrVarVector(Handle:hParams, num, offset, ObjectValueType:type, Float:value[3]);
|
||||||
cell_t Native_SetParamObjectPtrVarVector(IPluginContext *pContext, const cell_t *params)
|
cell_t Native_SetParamObjectPtrVarVector(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
HookParamsStruct *paramStruct;
|
void *addr = NULL;
|
||||||
|
if(!GetObjectAddrOrThis(pContext, params, addr))
|
||||||
if(!GetCallbackArgHandleIfValidOrError(g_HookParamsHandle, g_HookReturnHandle, (void **)¶mStruct, pContext, params[1]))
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(params[2] <= 0 || params[2] > (int)paramStruct->dg->params.size())
|
|
||||||
{
|
|
||||||
return pContext->ThrowNativeError("Invalid param number %i max params is %i", params[2], paramStruct->dg->params.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
int index = params[2] - 1;
|
|
||||||
|
|
||||||
if(paramStruct->dg->params.at(index).type != HookParamType_ObjectPtr && paramStruct->dg->params.at(index).type != HookParamType_Object)
|
|
||||||
{
|
|
||||||
return pContext->ThrowNativeError("Invalid object value type %i", paramStruct->dg->params.at(index).type);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t offset = GetParamOffset(paramStruct, index);
|
|
||||||
void *addr = GetObjectAddr(paramStruct->dg->params.at(index).type, paramStruct->dg->params.at(index).flags, paramStruct->orgParams, offset);
|
|
||||||
|
|
||||||
cell_t *buffer;
|
cell_t *buffer;
|
||||||
pContext->LocalToPhysAddr(params[5], &buffer);
|
pContext->LocalToPhysAddr(params[5], &buffer);
|
||||||
|
|
||||||
@ -1352,28 +1340,12 @@ cell_t Native_SetParamObjectPtrVarVector(IPluginContext *pContext, const cell_t
|
|||||||
//native DHookGetParamObjectPtrString(Handle:hParams, num, offset, ObjectValueType:type, String:buffer[], size)
|
//native DHookGetParamObjectPtrString(Handle:hParams, num, offset, ObjectValueType:type, String:buffer[], size)
|
||||||
cell_t Native_GetParamObjectPtrString(IPluginContext *pContext, const cell_t *params)
|
cell_t Native_GetParamObjectPtrString(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
HookParamsStruct *paramStruct;
|
void *addr = NULL;
|
||||||
|
if (!GetObjectAddrOrThis(pContext, params, addr))
|
||||||
if(!GetCallbackArgHandleIfValidOrError(g_HookParamsHandle, g_HookReturnHandle, (void **)¶mStruct, pContext, params[1]))
|
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(params[2] <= 0 || params[2] > (int)paramStruct->dg->params.size())
|
|
||||||
{
|
|
||||||
return pContext->ThrowNativeError("Invalid param number %i max params is %i", params[2], paramStruct->dg->params.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
int index = params[2] - 1;
|
|
||||||
|
|
||||||
if(paramStruct->dg->params.at(index).type != HookParamType_ObjectPtr && paramStruct->dg->params.at(index).type != HookParamType_Object)
|
|
||||||
{
|
|
||||||
return pContext->ThrowNativeError("Invalid object value type %i", paramStruct->dg->params.at(index).type);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t offset = GetParamOffset(paramStruct, index);
|
|
||||||
void *addr = GetObjectAddr(paramStruct->dg->params.at(index).type, paramStruct->dg->params.at(index).flags, paramStruct->orgParams, offset);
|
|
||||||
|
|
||||||
switch((ObjectValueType)params[4])
|
switch((ObjectValueType)params[4])
|
||||||
{
|
{
|
||||||
case ObjectValueType_CharPtr:
|
case ObjectValueType_CharPtr:
|
||||||
|
|||||||
@ -162,6 +162,7 @@ public:
|
|||||||
int entity;
|
int entity;
|
||||||
ThisPointerType thisType;
|
ThisPointerType thisType;
|
||||||
HookType hookType;
|
HookType hookType;
|
||||||
|
CallingConvention thisFuncCallConv;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DHooksCallback : public SourceHook::ISHDelegate, public DHooksInfo
|
class DHooksCallback : public SourceHook::ISHDelegate, public DHooksInfo
|
||||||
|
|||||||
@ -4,26 +4,32 @@
|
|||||||
{
|
{
|
||||||
"Offsets"
|
"Offsets"
|
||||||
{
|
{
|
||||||
|
"CanBeAutobalanced"
|
||||||
|
{
|
||||||
|
"windows" "465"
|
||||||
|
"linux" "466"
|
||||||
|
}
|
||||||
"GroundEntChanged"
|
"GroundEntChanged"
|
||||||
{
|
{
|
||||||
"windows" "188"
|
"windows" "178"
|
||||||
"linux" "190"
|
"linux" "180"
|
||||||
}
|
}
|
||||||
"OnTakeDamage_Alive"
|
"OnTakeDamage_Alive"
|
||||||
{
|
{
|
||||||
"windows" "287"
|
"windows" "283"
|
||||||
"linux" "288"
|
"linux" "284"
|
||||||
}
|
}
|
||||||
"GetMaxHealth"
|
"GetMaxHealth"
|
||||||
{
|
{
|
||||||
"windows" "126"
|
"windows" "118"
|
||||||
"linux" "127"
|
"linux" "119"
|
||||||
}
|
}
|
||||||
"Blocked"
|
"Blocked"
|
||||||
{
|
{
|
||||||
"windows" "109"
|
"windows" "101"
|
||||||
"linux" "110"
|
"linux" "102"
|
||||||
}
|
}
|
||||||
|
/* CBaseCombatWeapon::Reload */
|
||||||
"Reload"
|
"Reload"
|
||||||
{
|
{
|
||||||
"windows" "287"
|
"windows" "287"
|
||||||
@ -31,18 +37,19 @@
|
|||||||
}
|
}
|
||||||
"EndTouch"
|
"EndTouch"
|
||||||
{
|
{
|
||||||
"windows" "107"
|
"windows" "99"
|
||||||
"linux" "108"
|
"linux" "100"
|
||||||
}
|
}
|
||||||
|
/* CBaseEntity::FireBullets(FireBulletsInfo_t const&) */
|
||||||
"FireBullets"
|
"FireBullets"
|
||||||
{
|
{
|
||||||
"windows" "121"
|
"windows" "113"
|
||||||
"linux" "121"
|
"linux" "113"
|
||||||
}
|
}
|
||||||
"OnTakeDamage"
|
"OnTakeDamage"
|
||||||
{
|
{
|
||||||
"windows" "69"
|
"windows" "61"
|
||||||
"linux" "70"
|
"linux" "62"
|
||||||
}
|
}
|
||||||
"PreThink"
|
"PreThink"
|
||||||
{
|
{
|
||||||
@ -56,8 +63,8 @@
|
|||||||
}
|
}
|
||||||
"SetTransmit"
|
"SetTransmit"
|
||||||
{
|
{
|
||||||
"windows" "28"
|
"windows" "20"
|
||||||
"linux" "29"
|
"linux" "21"
|
||||||
}
|
}
|
||||||
"ShouldCollide"
|
"ShouldCollide"
|
||||||
{
|
{
|
||||||
@ -66,64 +73,64 @@
|
|||||||
}
|
}
|
||||||
"Spawn"
|
"Spawn"
|
||||||
{
|
{
|
||||||
"windows" "30"
|
"windows" "22"
|
||||||
"linux" "31"
|
"linux" "23"
|
||||||
}
|
}
|
||||||
"StartTouch"
|
"StartTouch"
|
||||||
{
|
{
|
||||||
"windows" "105"
|
"windows" "97"
|
||||||
"linux" "106"
|
"linux" "98"
|
||||||
}
|
}
|
||||||
"Think"
|
"Think"
|
||||||
{
|
{
|
||||||
"windows" "57"
|
"windows" "49"
|
||||||
"linux" "58"
|
"linux" "50"
|
||||||
}
|
}
|
||||||
"Touch"
|
"Touch"
|
||||||
{
|
{
|
||||||
"windows" "106"
|
"windows" "98"
|
||||||
"linux" "107"
|
"linux" "99"
|
||||||
}
|
}
|
||||||
"TraceAttack"
|
"TraceAttack"
|
||||||
{
|
{
|
||||||
"windows" "67"
|
"windows" "59"
|
||||||
"linux" "68"
|
"linux" "60"
|
||||||
}
|
}
|
||||||
"Use"
|
"Use"
|
||||||
{
|
{
|
||||||
"windows" "104"
|
"windows" "96"
|
||||||
"linux" "105"
|
"linux" "97"
|
||||||
}
|
}
|
||||||
"VPhysicsUpdate"
|
"VPhysicsUpdate"
|
||||||
{
|
{
|
||||||
"windows" "168"
|
"windows" "158"
|
||||||
"linux" "169"
|
"linux" "159"
|
||||||
}
|
}
|
||||||
"Weapon_CanSwitchTo"
|
"Weapon_CanSwitchTo"
|
||||||
{
|
{
|
||||||
"windows" "278"
|
"windows" "277"
|
||||||
"linux" "279"
|
"linux" "278"
|
||||||
}
|
}
|
||||||
"Weapon_CanUse"
|
"Weapon_CanUse"
|
||||||
|
{
|
||||||
|
"windows" "271"
|
||||||
|
"linux" "272"
|
||||||
|
}
|
||||||
|
"Weapon_Drop"
|
||||||
|
{
|
||||||
|
"windows" "274"
|
||||||
|
"linux" "275"
|
||||||
|
}
|
||||||
|
"Weapon_Equip"
|
||||||
{
|
{
|
||||||
"windows" "272"
|
"windows" "272"
|
||||||
"linux" "273"
|
"linux" "273"
|
||||||
}
|
}
|
||||||
"Weapon_Drop"
|
"Weapon_Switch"
|
||||||
{
|
{
|
||||||
"windows" "275"
|
"windows" "275"
|
||||||
"linux" "276"
|
"linux" "276"
|
||||||
}
|
}
|
||||||
"Weapon_Equip"
|
|
||||||
{
|
|
||||||
"windows" "273"
|
|
||||||
"linux" "274"
|
|
||||||
}
|
|
||||||
"Weapon_Switch"
|
|
||||||
{
|
|
||||||
"windows" "276"
|
|
||||||
"linux" "277"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,13 +23,13 @@
|
|||||||
}
|
}
|
||||||
"RemovePlayerItem"
|
"RemovePlayerItem"
|
||||||
{
|
{
|
||||||
"windows" "285"
|
"windows" "281"
|
||||||
"linux" "286"
|
"linux" "282"
|
||||||
}
|
}
|
||||||
"Weapon_GetSlot"
|
"Weapon_GetSlot"
|
||||||
{
|
{
|
||||||
"windows" "280"
|
"windows" "279"
|
||||||
"linux" "281"
|
"linux" "280"
|
||||||
}
|
}
|
||||||
"Ignite"
|
"Ignite"
|
||||||
{
|
{
|
||||||
@ -43,8 +43,8 @@
|
|||||||
}
|
}
|
||||||
"Teleport"
|
"Teleport"
|
||||||
{
|
{
|
||||||
"windows" "115"
|
"windows" "107"
|
||||||
"linux" "116"
|
"linux" "108"
|
||||||
}
|
}
|
||||||
"CommitSuicide"
|
"CommitSuicide"
|
||||||
{
|
{
|
||||||
@ -53,33 +53,33 @@
|
|||||||
}
|
}
|
||||||
"GetVelocity"
|
"GetVelocity"
|
||||||
{
|
{
|
||||||
"windows" "151"
|
"windows" "141"
|
||||||
"linux" "152"
|
"linux" "142"
|
||||||
}
|
}
|
||||||
"EyeAngles"
|
"EyeAngles"
|
||||||
{
|
{
|
||||||
"windows" "142"
|
"windows" "132"
|
||||||
"linux" "143"
|
"linux" "133"
|
||||||
}
|
}
|
||||||
"AcceptInput"
|
"AcceptInput"
|
||||||
{
|
{
|
||||||
"windows" "44"
|
"windows" "36"
|
||||||
"linux" "45"
|
"linux" "37"
|
||||||
}
|
}
|
||||||
"SetEntityModel"
|
"SetEntityModel"
|
||||||
{
|
{
|
||||||
"windows" "32"
|
"windows" "24"
|
||||||
"linux" "33"
|
"linux" "25"
|
||||||
}
|
}
|
||||||
"WeaponEquip"
|
"WeaponEquip"
|
||||||
{
|
{
|
||||||
"windows" "273"
|
"windows" "272"
|
||||||
"linux" "274"
|
"linux" "273"
|
||||||
}
|
}
|
||||||
"Activate"
|
"Activate"
|
||||||
{
|
{
|
||||||
"windows" "41"
|
"windows" "33"
|
||||||
"linux" "42"
|
"linux" "34"
|
||||||
}
|
}
|
||||||
"PlayerRunCmd"
|
"PlayerRunCmd"
|
||||||
{
|
{
|
||||||
@ -93,13 +93,13 @@
|
|||||||
}
|
}
|
||||||
"SetOwnerEntity"
|
"SetOwnerEntity"
|
||||||
{
|
{
|
||||||
"windows" "25"
|
"windows" "17"
|
||||||
"linux" "26"
|
"linux" "18"
|
||||||
}
|
}
|
||||||
"GiveAmmo"
|
"GiveAmmo"
|
||||||
{
|
{
|
||||||
"windows" "264"
|
"windows" "263"
|
||||||
"linux" "265"
|
"linux" "264"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"Signatures"
|
"Signatures"
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit 41cb9169cb613c8455d0c8958e675ed88bd02c5b
|
Subproject commit c018a994478d6c31f70ded7adec7aa9e2c40bb1a
|
||||||
@ -310,7 +310,7 @@ methodmap DHookParam < Handle
|
|||||||
|
|
||||||
// Gets an object's variable value.
|
// Gets an object's variable value.
|
||||||
//
|
//
|
||||||
// @param num Parameter number to get, starting at 1.
|
// @param num Parameter number to get, 0 for param "this", other parameters start from 1
|
||||||
// @param offset Byte offset within the object to the var to get.
|
// @param offset Byte offset within the object to the var to get.
|
||||||
// @param type Type of var it is.
|
// @param type Type of var it is.
|
||||||
//
|
//
|
||||||
@ -320,7 +320,7 @@ methodmap DHookParam < Handle
|
|||||||
|
|
||||||
// Gets an object's vector variable value.
|
// Gets an object's vector variable value.
|
||||||
//
|
//
|
||||||
// @param num Parameter number to get, starting at 1.
|
// @param num Parameter number to get, 0 for param "this", other parameters start from 1.
|
||||||
// @param offset Byte offset within the object to the var to get.
|
// @param offset Byte offset within the object to the var to get.
|
||||||
// @param type Type of var it is.
|
// @param type Type of var it is.
|
||||||
// @param vec Buffer to store the result vector.
|
// @param vec Buffer to store the result vector.
|
||||||
@ -330,7 +330,7 @@ methodmap DHookParam < Handle
|
|||||||
|
|
||||||
// Gets an object's string variable value.
|
// Gets an object's string variable value.
|
||||||
//
|
//
|
||||||
// @param num Parameter number to get, starting at 1.
|
// @param num Parameter number to get, 0 for param "this", other parameters start from 1.
|
||||||
// @param offset Byte offset within the object to the var to get.
|
// @param offset Byte offset within the object to the var to get.
|
||||||
// @param type Type of var it is.
|
// @param type Type of var it is.
|
||||||
// @param buffer Buffer to store the result string.
|
// @param buffer Buffer to store the result string.
|
||||||
@ -344,7 +344,7 @@ methodmap DHookParam < Handle
|
|||||||
// The changes are only applied when MRES_ChangedHandled or MRES_ChangedOverride
|
// The changes are only applied when MRES_ChangedHandled or MRES_ChangedOverride
|
||||||
// is returned in the callback.
|
// is returned in the callback.
|
||||||
//
|
//
|
||||||
// @param num Parameter number to set, starting at 1.
|
// @param num Parameter number to set, 0 for param "this", other parameters start from 1.
|
||||||
// @param offset Byte offset within the object to the var to set.
|
// @param offset Byte offset within the object to the var to set.
|
||||||
// @param type Type of var it is.
|
// @param type Type of var it is.
|
||||||
// @param value The value to set the var to.
|
// @param value The value to set the var to.
|
||||||
@ -357,7 +357,7 @@ methodmap DHookParam < Handle
|
|||||||
// The changes are only applied when MRES_ChangedHandled or MRES_ChangedOverride
|
// The changes are only applied when MRES_ChangedHandled or MRES_ChangedOverride
|
||||||
// is returned in the callback.
|
// is returned in the callback.
|
||||||
//
|
//
|
||||||
// @param num Parameter number to set, starting at 1.
|
// @param num Parameter number to set, 0 for param "this", other parameters start from 1.
|
||||||
// @param offset Byte offset within the object to the var to set.
|
// @param offset Byte offset within the object to the var to set.
|
||||||
// @param type Type of var it is.
|
// @param type Type of var it is.
|
||||||
// @param vec The value to set the vector var to.
|
// @param vec The value to set the vector var to.
|
||||||
@ -928,7 +928,7 @@ native void DHookSetReturnString(Handle hReturn, char[] value);
|
|||||||
* Gets an objects variable value
|
* Gets an objects variable value
|
||||||
*
|
*
|
||||||
* @param hParams Handle to params structure
|
* @param hParams Handle to params structure
|
||||||
* @param num Param number to get.
|
* @param num Param number to get, 0 for param "this".
|
||||||
* @param offset Offset within the object to the var to get.
|
* @param offset Offset within the object to the var to get.
|
||||||
* @param type Type of var it is
|
* @param type Type of var it is
|
||||||
*
|
*
|
||||||
@ -941,7 +941,7 @@ native any DHookGetParamObjectPtrVar(Handle hParams, int num, int offset, Object
|
|||||||
* Sets an objects variable value
|
* Sets an objects variable value
|
||||||
*
|
*
|
||||||
* @param hParams Handle to params structure
|
* @param hParams Handle to params structure
|
||||||
* @param num Param number to set.
|
* @param num Param number to set, 0 for param "this".
|
||||||
* @param offset Offset within the object to the var to set.
|
* @param offset Offset within the object to the var to set.
|
||||||
* @param type Type of var it is
|
* @param type Type of var it is
|
||||||
* @param value The value to set the var to.
|
* @param value The value to set the var to.
|
||||||
@ -954,7 +954,7 @@ native void DHookSetParamObjectPtrVar(Handle hParams, int num, int offset, Objec
|
|||||||
* Gets an objects vector variable value
|
* Gets an objects vector variable value
|
||||||
*
|
*
|
||||||
* @param hParams Handle to params structure
|
* @param hParams Handle to params structure
|
||||||
* @param num Param number to get.
|
* @param num Param number to get, 0 for param "this".
|
||||||
* @param offset Offset within the object to the var to get.
|
* @param offset Offset within the object to the var to get.
|
||||||
* @param type Type of var it is
|
* @param type Type of var it is
|
||||||
* @param buffer Buffer to store the result vector
|
* @param buffer Buffer to store the result vector
|
||||||
@ -967,7 +967,7 @@ native void DHookGetParamObjectPtrVarVector(Handle hParams, int num, int offset,
|
|||||||
* Sets an objects vector variable value
|
* Sets an objects vector variable value
|
||||||
*
|
*
|
||||||
* @param hParams Handle to params structure
|
* @param hParams Handle to params structure
|
||||||
* @param num Param number to set.
|
* @param num Param number to set, 0 for param "this".
|
||||||
* @param offset Offset within the object to the var to set.
|
* @param offset Offset within the object to the var to set.
|
||||||
* @param type Type of var it is
|
* @param type Type of var it is
|
||||||
* @param value The value to set the vector var to.
|
* @param value The value to set the vector var to.
|
||||||
@ -980,7 +980,7 @@ native void DHookSetParamObjectPtrVarVector(Handle hParams, int num, int offset,
|
|||||||
* Gets an objects string variable value
|
* Gets an objects string variable value
|
||||||
*
|
*
|
||||||
* @param hParams Handle to params structure
|
* @param hParams Handle to params structure
|
||||||
* @param num Param number to get.
|
* @param num Param number to get, 0 for param "this".
|
||||||
* @param offset Offset within the object to the var to get.
|
* @param offset Offset within the object to the var to get.
|
||||||
* @param type Type of var it is
|
* @param type Type of var it is
|
||||||
* @param buffer Buffer to store the result vector
|
* @param buffer Buffer to store the result vector
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user