L L4D2node

ReadAndAllocStringValue

0x00582220 · 137 bytes · __cdecl

_Z23ReadAndAllocStringValueP9KeyValuesPKcS2_

Decompiled

undefined (3 params)

/* ReadAndAllocStringValue(KeyValues*, char const*, char const*) */

char * ReadAndAllocStringValue(KeyValues *param_1,char *param_2,char *param_3)

{
  char *pcVar1;
  int iVar2;
  char *pcVar3;
  
  pcVar1 = (char *)KeyValues::GetString(param_1,param_2,(char *)0x0);
  if (pcVar1 == (char *)0x0) {
    pcVar3 = "";
    if (param_3 != (char *)0x0) {
      DevWarning("Can\'t get key value\t\'%s\' from file \'%s\'.\n",param_2,param_3);
      return "";
    }
  }
  else {
    iVar2 = _V_strlen(pcVar1);
    pcVar3 = operator_new__(iVar2 + 1U);
    V_strncpy(pcVar3,pcVar1,iVar2 + 1U);
  }
  return pcVar3;
}

SourceMod gamedata

paste into addons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)

Just a Signatures{} block, ready to drop into a gamedata file. Wire it up in your plugin however you like - SDKCall, DHooks, raw memory ops, or anything else.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)