Added KvGetSectionSymbol
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401715
This commit is contained in:
@@ -948,6 +948,36 @@ static cell_t smn_FindKeyById(IPluginContext *pContext, const cell_t *params)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell_t smn_KvGetSectionSymbol(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
Handle_t hndl = static_cast<Handle_t>(params[1]);
|
||||
HandleError herr;
|
||||
HandleSecurity sec;
|
||||
KeyValueStack *pStk;
|
||||
cell_t *val;
|
||||
|
||||
sec.pOwner = NULL;
|
||||
sec.pIdentity = g_pCoreIdent;
|
||||
|
||||
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
|
||||
!= HandleError_None)
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
|
||||
}
|
||||
|
||||
KeyValues *pSection = pStk->pCurRoot.front();
|
||||
|
||||
pContext->LocalToPhysAddr(params[2], &val);
|
||||
*val = pSection->GetNameSymbol();
|
||||
|
||||
if (!*val)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static KeyValueNatives s_KeyValueNatives;
|
||||
|
||||
REGISTER_NATIVES(keyvaluenatives)
|
||||
@@ -984,5 +1014,6 @@ REGISTER_NATIVES(keyvaluenatives)
|
||||
{"KvCopySubkeys", smn_CopySubkeys},
|
||||
{"KvFindKeyById", smn_FindKeyById},
|
||||
{"KvGetNameSymbol", smn_GetNameSymbol},
|
||||
{"KvGetSectionSymbol", smn_KvGetSectionSymbol},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user