Merge branch 'master' of https://github.com/alliedmodders/sourcemod
This commit is contained in:
commit
28a5d4b342
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,6 +1,8 @@
|
|||||||
[submodule "public/amtl"]
|
[submodule "public/amtl"]
|
||||||
path = public/amtl
|
path = public/amtl
|
||||||
url = https://github.com/alliedmodders/amtl
|
url = https://github.com/alliedmodders/amtl
|
||||||
|
shallow = true
|
||||||
[submodule "sourcepawn"]
|
[submodule "sourcepawn"]
|
||||||
path = sourcepawn
|
path = sourcepawn
|
||||||
url = https://github.com/alliedmodders/sourcepawn
|
url = https://github.com/alliedmodders/sourcepawn
|
||||||
|
shallow = true
|
||||||
|
@ -373,7 +373,11 @@ static cell_t ShowSyncHudText(IPluginContext *pContext, const cell_t *params)
|
|||||||
Handle_t err;
|
Handle_t err;
|
||||||
CPlayer *pPlayer;
|
CPlayer *pPlayer;
|
||||||
hud_syncobj_t *obj;
|
hud_syncobj_t *obj;
|
||||||
|
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
|
||||||
|
char message_buffer[512];
|
||||||
|
#else
|
||||||
char message_buffer[255-36];
|
char message_buffer[255-36];
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!s_HudMsgHelpers.IsSupported())
|
if (!s_HudMsgHelpers.IsSupported())
|
||||||
{
|
{
|
||||||
@ -453,7 +457,11 @@ static cell_t ShowHudText(IPluginContext *pContext, const cell_t *params)
|
|||||||
{
|
{
|
||||||
int client;
|
int client;
|
||||||
CPlayer *pPlayer;
|
CPlayer *pPlayer;
|
||||||
|
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_BLADE
|
||||||
|
char message_buffer[512];
|
||||||
|
#else
|
||||||
char message_buffer[255-36];
|
char message_buffer[255-36];
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!s_HudMsgHelpers.IsSupported())
|
if (!s_HudMsgHelpers.IsSupported())
|
||||||
{
|
{
|
||||||
|
@ -256,6 +256,15 @@ cell_t Native_SetFromConf(IPluginContext *pContext, const cell_t *params)
|
|||||||
setup->funcAddr = addr;
|
setup->funcAddr = addr;
|
||||||
setup->offset = offset;
|
setup->offset = offset;
|
||||||
|
|
||||||
|
if (addr == nullptr)
|
||||||
|
{
|
||||||
|
setup->hookMethod = Virtual;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setup->hookMethod = Detour;
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,6 +291,13 @@ cell_t Native_AddParam(IPluginContext *pContext, const cell_t *params)
|
|||||||
info.flags = PASSFLAG_BYVAL;
|
info.flags = PASSFLAG_BYVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DynamicDetours doesn't expose the passflags concept like SourceHook.
|
||||||
|
// See if we're trying to set some invalid flags on detour arguments.
|
||||||
|
if(setup->hookMethod == Detour && (info.flags & ~PASSFLAG_BYVAL) > 0)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Pass flags are only supported for virtual hooks.");
|
||||||
|
}
|
||||||
|
|
||||||
if (params[0] >= 5)
|
if (params[0] >= 5)
|
||||||
{
|
{
|
||||||
PluginRegister custom_register = (PluginRegister)params[5];
|
PluginRegister custom_register = (PluginRegister)params[5];
|
||||||
@ -884,7 +900,8 @@ cell_t Native_SetParamVector(IPluginContext *pContext, const cell_t *params)
|
|||||||
int index = params[2] - 1;
|
int index = params[2] - 1;
|
||||||
|
|
||||||
size_t offset = GetParamOffset(paramStruct, index);
|
size_t offset = GetParamOffset(paramStruct, index);
|
||||||
void *addr = (void **)((intptr_t)paramStruct->newParams + offset);
|
void **origAddr = (void **)((intptr_t)paramStruct->orgParams + offset);
|
||||||
|
void **newAddr = (void **)((intptr_t)paramStruct->newParams + offset);
|
||||||
|
|
||||||
switch(paramStruct->dg->params.at(index).type)
|
switch(paramStruct->dg->params.at(index).type)
|
||||||
{
|
{
|
||||||
@ -892,11 +909,23 @@ cell_t Native_SetParamVector(IPluginContext *pContext, const cell_t *params)
|
|||||||
{
|
{
|
||||||
cell_t *buffer;
|
cell_t *buffer;
|
||||||
pContext->LocalToPhysAddr(params[3], &buffer);
|
pContext->LocalToPhysAddr(params[3], &buffer);
|
||||||
|
SDKVector *origVec = *(SDKVector **)origAddr;
|
||||||
|
SDKVector **newVec = (SDKVector **)newAddr;
|
||||||
|
|
||||||
*(SDKVector **)addr = new SDKVector(sp_ctof(buffer[0]), sp_ctof(buffer[1]), sp_ctof(buffer[2]));
|
if(origVec == nullptr)
|
||||||
|
{
|
||||||
|
*newVec = new SDKVector(sp_ctof(buffer[0]), sp_ctof(buffer[1]), sp_ctof(buffer[2]));
|
||||||
|
// Free it later (cheaply) after the function returned.
|
||||||
|
smutils->AddFrameAction(FreeChangedVector, *newVec);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
origVec->x = sp_ctof(buffer[0]);
|
||||||
|
origVec->y = sp_ctof(buffer[1]);
|
||||||
|
origVec->z = sp_ctof(buffer[2]);
|
||||||
|
*newVec = origVec;
|
||||||
|
}
|
||||||
paramStruct->isChanged[index] = true;
|
paramStruct->isChanged[index] = true;
|
||||||
// Free it later (cheaply) after the function returned.
|
|
||||||
smutils->AddFrameAction(FreeChangedVector, *(SDKVector **)addr);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,6 +376,20 @@ SMCResult SignatureGameConfig::ReadSMC_LeavingSection(const SMCStates *states)
|
|||||||
return SMCResult_HaltFail;
|
return SMCResult_HaltFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!g_CurrentSignature->offset.length())
|
||||||
|
{
|
||||||
|
// DynamicDetours doesn't expose the passflags concept like SourceHook.
|
||||||
|
// See if we're trying to set some invalid flags on detour arguments.
|
||||||
|
for (auto &arg : g_CurrentSignature->args)
|
||||||
|
{
|
||||||
|
if ((arg.info.flags & ~PASSFLAG_BYVAL) > 0)
|
||||||
|
{
|
||||||
|
smutils->LogError(myself, "Function \"%s\" uses unsupported pass flags in argument \"%s\". Flags are only supported for virtual hooks: line: %i col: %i", g_CurrentFunctionName.c_str(), arg.name.c_str(), states->line, states->col);
|
||||||
|
return SMCResult_HaltFail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Save this function signature in our cache.
|
// Save this function signature in our cache.
|
||||||
signatures_.insert(g_CurrentFunctionName.c_str(), g_CurrentSignature);
|
signatures_.insert(g_CurrentFunctionName.c_str(), g_CurrentSignature);
|
||||||
g_CurrentFunctionName = "";
|
g_CurrentFunctionName = "";
|
||||||
|
@ -225,6 +225,11 @@ public:
|
|||||||
DHooksInfo *dg;
|
DHooksInfo *dg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum HookMethod {
|
||||||
|
Virtual,
|
||||||
|
Detour
|
||||||
|
};
|
||||||
|
|
||||||
class HookSetup
|
class HookSetup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -238,6 +243,7 @@ public:
|
|||||||
this->offset = offset;
|
this->offset = offset;
|
||||||
this->funcAddr = nullptr;
|
this->funcAddr = nullptr;
|
||||||
this->callback = callback;
|
this->callback = callback;
|
||||||
|
this->hookMethod = Virtual;
|
||||||
};
|
};
|
||||||
HookSetup(ReturnType returnType, unsigned int returnFlag, CallingConvention callConv, ThisPointerType thisType, void *funcAddr)
|
HookSetup(ReturnType returnType, unsigned int returnFlag, CallingConvention callConv, ThisPointerType thisType, void *funcAddr)
|
||||||
{
|
{
|
||||||
@ -249,6 +255,7 @@ public:
|
|||||||
this->offset = -1;
|
this->offset = -1;
|
||||||
this->funcAddr = funcAddr;
|
this->funcAddr = funcAddr;
|
||||||
this->callback = nullptr;
|
this->callback = nullptr;
|
||||||
|
this->hookMethod = Detour;
|
||||||
};
|
};
|
||||||
~HookSetup(){};
|
~HookSetup(){};
|
||||||
|
|
||||||
@ -266,6 +273,7 @@ public:
|
|||||||
int offset;
|
int offset;
|
||||||
void *funcAddr;
|
void *funcAddr;
|
||||||
IPluginFunction *callback;
|
IPluginFunction *callback;
|
||||||
|
HookMethod hookMethod;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DHooksManager
|
class DHooksManager
|
||||||
|
@ -185,5 +185,11 @@
|
|||||||
"mac" "211"
|
"mac" "211"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"Keys"
|
||||||
|
{
|
||||||
|
"GameRulesProxy" "CNMRiH_GameRulesProxy"
|
||||||
|
"GameRulesDataTable" "nmrih_gamerules_data"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 18cce5f84247302126b5b6292516752d8a6bd1a7
|
Subproject commit 208001a01baaf98d4601e31fda0ab9c849fa700d
|
Loading…
Reference in New Issue
Block a user