mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-06 18:08:36 +00:00
Merge f874bf43a2 into 0c900be7fc
This commit is contained in:
commit
2445a4d3ff
@ -237,6 +237,7 @@ void CHookManager::OnClientConnected(int client)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int hookid = SH_ADD_VPHOOK(IClientMessageHandler, ProcessVoiceData, (IClientMessageHandler *)((intptr_t)(pClient) + sizeof(void *)), SH_MEMBER(this, &CHookManager::ProcessVoiceData), true);
|
int hookid = SH_ADD_VPHOOK(IClientMessageHandler, ProcessVoiceData, (IClientMessageHandler *)((intptr_t)(pClient) + sizeof(void *)), SH_MEMBER(this, &CHookManager::ProcessVoiceData), true);
|
||||||
hook.SetHookID(hookid);
|
hook.SetHookID(hookid);
|
||||||
netProcessVoiceData.push_back(new CVTableHook(hook));
|
netProcessVoiceData.push_back(new CVTableHook(hook));
|
||||||
|
|||||||
@ -63,7 +63,8 @@ inline void DecodePassMethod(ValveType vtype, SDKPassMethod method, PassType &ty
|
|||||||
type = PassType_Basic;
|
type = PassType_Basic;
|
||||||
if (vtype == Valve_POD
|
if (vtype == Valve_POD
|
||||||
|| vtype == Valve_Float
|
|| vtype == Valve_Float
|
||||||
|| vtype == Valve_Bool)
|
|| vtype == Valve_Bool
|
||||||
|
|| vtype == Valve_Pointer)
|
||||||
{
|
{
|
||||||
flags = PASSFLAG_BYVAL | PASSFLAG_ASPOINTER;
|
flags = PASSFLAG_BYVAL | PASSFLAG_ASPOINTER;
|
||||||
} else {
|
} else {
|
||||||
@ -394,8 +395,8 @@ static cell_t SDKCall(IPluginContext *pContext, const cell_t *params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//note: varargs pawn args are passed by-ref
|
//note: varargs pawn args are passed by-ref
|
||||||
cell_t *cell;
|
intptr_t *cell;
|
||||||
pContext->LocalToPhysAddr(params[startparam], &cell);
|
pContext->LocalToPhysAddr(params[startparam], reinterpret_cast<cell_t**>(&cell));
|
||||||
void *thisptr = reinterpret_cast<void*>(*cell);
|
void *thisptr = reinterpret_cast<void*>(*cell);
|
||||||
|
|
||||||
if (thisptr == nullptr)
|
if (thisptr == nullptr)
|
||||||
@ -429,7 +430,8 @@ static cell_t SDKCall(IPluginContext *pContext, const cell_t *params)
|
|||||||
{
|
{
|
||||||
startparam += 2;
|
startparam += 2;
|
||||||
} else if (vc->retinfo->vtype == Valve_Vector
|
} else if (vc->retinfo->vtype == Valve_Vector
|
||||||
|| vc->retinfo->vtype == Valve_QAngle)
|
|| vc->retinfo->vtype == Valve_QAngle
|
||||||
|
|| vc->retinfo->vtype == Valve_Pointer)
|
||||||
{
|
{
|
||||||
startparam += 1;
|
startparam += 1;
|
||||||
}
|
}
|
||||||
@ -506,7 +508,8 @@ static cell_t SDKCall(IPluginContext *pContext, const cell_t *params)
|
|||||||
pContext->StringToLocalUTF8(params[retparam], *addr, *(char **)vc->retbuf, &written);
|
pContext->StringToLocalUTF8(params[retparam], *addr, *(char **)vc->retbuf, &written);
|
||||||
return (cell_t)written;
|
return (cell_t)written;
|
||||||
} else if (vc->retinfo->vtype == Valve_Vector
|
} else if (vc->retinfo->vtype == Valve_Vector
|
||||||
|| vc->retinfo->vtype == Valve_QAngle)
|
|| vc->retinfo->vtype == Valve_QAngle
|
||||||
|
|| vc->retinfo->vtype == Valve_Pointer)
|
||||||
{
|
{
|
||||||
if (numparams < 2)
|
if (numparams < 2)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -164,6 +164,20 @@ size_t ValveParamToBinParam(ValveType type,
|
|||||||
return sizeof(float);
|
return sizeof(float);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case Valve_Pointer:
|
||||||
|
{
|
||||||
|
info->type = PassType_Basic;
|
||||||
|
info->flags = flags;
|
||||||
|
if (flags & PASSFLAG_ASPOINTER)
|
||||||
|
{
|
||||||
|
needs_extra = true;
|
||||||
|
info->size = sizeof(void*);
|
||||||
|
return sizeof(void*) * 2;
|
||||||
|
} else {
|
||||||
|
info->size = sizeof(void*);
|
||||||
|
return sizeof(void*);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -278,6 +292,20 @@ DataStatus EncodeValveParam(IPluginContext *pContext,
|
|||||||
|
|
||||||
return Data_Okay;
|
return Data_Okay;
|
||||||
}
|
}
|
||||||
|
case Valve_Pointer: // buffer -> sourcepawn
|
||||||
|
{
|
||||||
|
intptr_t *addr;
|
||||||
|
pContext->LocalToPhysAddr(param, reinterpret_cast<cell_t**>(&addr));
|
||||||
|
|
||||||
|
if (data->flags & PASSFLAG_ASPOINTER)
|
||||||
|
{
|
||||||
|
buffer = *(intptr_t **)buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
*addr = *(intptr_t *)buffer;
|
||||||
|
|
||||||
|
return Data_Okay;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Data_Fail;
|
return Data_Fail;
|
||||||
@ -585,6 +613,23 @@ DataStatus DecodeValveParam(IPluginContext *pContext,
|
|||||||
*(char **)buffer = addr;
|
*(char **)buffer = addr;
|
||||||
return Data_Okay;
|
return Data_Okay;
|
||||||
}
|
}
|
||||||
|
case Valve_Pointer: // sourcepawn -> buffer
|
||||||
|
{
|
||||||
|
intptr_t *addr;
|
||||||
|
pContext->LocalToPhysAddr(param, reinterpret_cast<cell_t**>(&addr));
|
||||||
|
|
||||||
|
if (data->decflags & VDECODE_FLAG_BYREF)
|
||||||
|
{
|
||||||
|
addr = reinterpret_cast<intptr_t*>(*addr);
|
||||||
|
}
|
||||||
|
if (data->flags & PASSFLAG_ASPOINTER)
|
||||||
|
{
|
||||||
|
*(void **)buffer = (unsigned char *)_buffer + pCall->stackEnd + data->obj_offset;
|
||||||
|
buffer = *(void **)buffer;
|
||||||
|
}
|
||||||
|
*(intptr_t *)buffer = *addr;
|
||||||
|
return Data_Okay;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Data_Fail;
|
return Data_Fail;
|
||||||
|
|||||||
@ -54,6 +54,7 @@ enum ValveType
|
|||||||
Valve_String, /**< String */
|
Valve_String, /**< String */
|
||||||
Valve_Bool, /**< Boolean */
|
Valve_Bool, /**< Boolean */
|
||||||
Valve_Object, /**< Object, not matching one of the above types */
|
Valve_Object, /**< Object, not matching one of the above types */
|
||||||
|
Valve_Pointer, /**< 64 bit or 32 bit array */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DataStatus
|
enum DataStatus
|
||||||
|
|||||||
@ -88,7 +88,9 @@ enum SDKType
|
|||||||
SDKType_Float, /**< Float (any) */
|
SDKType_Float, /**< Float (any) */
|
||||||
SDKType_Edict, /**< edict_t (always as pointer) */
|
SDKType_Edict, /**< edict_t (always as pointer) */
|
||||||
SDKType_String, /**< NULL-terminated string (always as pointer) */
|
SDKType_String, /**< NULL-terminated string (always as pointer) */
|
||||||
SDKType_Bool /**< Boolean (any) */
|
SDKType_Bool, /**< Boolean (any) */
|
||||||
|
SDKType_Object,
|
||||||
|
SDKType_Pointer, /**< Pointer (pass in an array) */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SDKPassMethod
|
enum SDKPassMethod
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user