mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-06 18:08:36 +00:00
Fix-up encoding/decoding of virtualaddress sdktools type
This commit is contained in:
parent
6368eb4a5a
commit
871bc2bde3
@ -63,7 +63,8 @@ inline void DecodePassMethod(ValveType vtype, SDKPassMethod method, PassType &ty
|
||||
type = PassType_Basic;
|
||||
if (vtype == Valve_POD
|
||||
|| vtype == Valve_Float
|
||||
|| vtype == Valve_Bool)
|
||||
|| vtype == Valve_Bool
|
||||
|| vtype == Valve_VirtualAddress)
|
||||
{
|
||||
flags = PASSFLAG_BYVAL | PASSFLAG_ASPOINTER;
|
||||
} else {
|
||||
@ -573,12 +574,12 @@ static cell_t SDKCall(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
return *addr ? 1 : 0;
|
||||
} else if (vc->retinfo->vtype == Valve_VirtualAddress) {
|
||||
void *addr = (void *)vc->retbuf;
|
||||
void *addr = *(void **)vc->retbuf;
|
||||
if (vc->retinfo->flags & PASSFLAG_ASPOINTER)
|
||||
{
|
||||
addr = *(void **)addr;
|
||||
}
|
||||
return g_pSM->ToPseudoAddress((void*)addr);
|
||||
return g_pSM->ToPseudoAddress(addr);
|
||||
} else {
|
||||
cell_t *addr = (cell_t *)vc->retbuf;
|
||||
if (vc->retinfo->flags & PASSFLAG_ASPOINTER)
|
||||
|
||||
@ -295,11 +295,14 @@ DataStatus EncodeValveParam(IPluginContext *pContext,
|
||||
}
|
||||
case Valve_VirtualAddress:
|
||||
{
|
||||
cell_t *addr;
|
||||
pContext->LocalToPhysAddr(param, &addr);
|
||||
|
||||
if (data->flags & PASSFLAG_ASPOINTER)
|
||||
{
|
||||
buffer = *(void **)buffer;
|
||||
}
|
||||
param = g_pSM->ToPseudoAddress((void*)buffer);
|
||||
*addr = g_pSM->ToPseudoAddress(*(void**)buffer);
|
||||
|
||||
return Data_Okay;
|
||||
}
|
||||
@ -612,6 +615,17 @@ DataStatus DecodeValveParam(IPluginContext *pContext,
|
||||
}
|
||||
case Valve_VirtualAddress:
|
||||
{
|
||||
if (data->decflags & VDECODE_FLAG_BYREF)
|
||||
{
|
||||
cell_t *addr;
|
||||
pContext->LocalToPhysAddr(param, &addr);
|
||||
param = *addr;
|
||||
}
|
||||
if (data->flags & PASSFLAG_ASPOINTER)
|
||||
{
|
||||
*(void **)buffer = (unsigned char *)_buffer + pCall->stackEnd + data->obj_offset;
|
||||
buffer = *(void **)buffer;
|
||||
}
|
||||
void* addr = g_pSM->FromPseudoAddress(param);
|
||||
if (addr == nullptr && (data->decflags & VDECODE_FLAG_ALLOWNULL) == 0)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user