I'm messing up strings somewhere, both szParticleName and szAttachmentName always comes up empty. Any ideas? The rest work fine.
Spoiler
Function being hooked (from
particle_parse.cpp):
PHP Code:
DispatchParticleEffect(const char *pszParticleName, ParticleAttachment_t iAttachType, CBaseEntity *pEntity, const char *pszAttachmentName, bool bResetAllParticlesOnEntity)
SP:
PHP Code:
public void OnPluginStart()
{
Handle hGameConf = LoadGameConfigFile("nmrih.life_extinguisher");
Handle hDispatchParticleEffect = DHookCreateFromConf(hGameConf, "DispatchParticleEffect");
DHookEnableDetour(hDispatchParticleEffect, true, OnDispatchParticleEffect);
}
public MRESReturn OnDispatchParticleEffect(Handle hParams)
{
char szParticleName[128];
DHookGetParamString(hParams, 1, szParticleName, sizeof(szParticleName));
PrintToChatAll("ParticleEffect %s", szParticleName);
return MRES_Ignored;
}
Gamedata:
PHP Code:
"Games"
{
"nmrih"
{
"Signatures"
{
"DispatchParticleEffect"
{
"library" "server"
"windows" "\x55\x8B\xEC\x81\xEC\xAC\x00\x00\x00\x56"
}
}
"Functions"
{
"DispatchParticleEffect"
{
"signature" "DispatchParticleEffect"
"callconv" "cdecl"
"return" "void"
"arguments"
{
"pszParticleName"
{
"type" "stringptr"
}
"iAttachType"
{
"type" "int"
}
"pEntity"
{
"type" "cbaseentity"
}
"pszAttachmentName"
{
"type" "stringptr"
}
"bResetAllParticlesOnEntity"
{
"type" "bool"
}
}
}
}
}
}
I am aware that stringptr != string, but I assume it automatically returns a string, is that not the case?
Thanks.
EDIT: Never mind, I'm supposed to use charptr here