L L4D2node

String_Encode

0x00149a00 · 234 bytes · __cdecl

_Z13String_EncodePKhP8DVariantPK8SendPropP8bf_writei

Decompiled

undefined (5 params)

/* String_Encode(unsigned char const*, DVariant*, SendProp const*, bf_write*, int) */

void String_Encode(uchar *param_1,DVariant *param_2,SendProp *param_3,bf_write *param_4,int param_5)

{
  int iVar1;
  uint uVar2;
  int iVar3;
  uint *puVar4;
  uint local_24;
  int local_20;
  
  local_24 = 0;
  do {
    if (*(char *)(*(int *)param_2 + local_24) == '\0') {
      local_20 = local_24 * 8;
      goto LAB_00149a3a;
    }
    local_24 = local_24 + 1;
  } while (local_24 != 0x1ff);
  local_20 = 0xff8;
  local_24 = 0x1ff;
LAB_00149a3a:
  uVar2 = *(uint *)(param_4 + 0xc);
  if (*(int *)(param_4 + 8) < (int)(uVar2 + 9)) {
    *(int *)(param_4 + 0xc) = *(int *)(param_4 + 8);
    param_4[0x10] = (bf_write)0x1;
  }
  else {
    iVar1 = ((int)uVar2 >> 5) * 4;
    uVar2 = uVar2 & 0x1f;
    puVar4 = (uint *)(*(int *)param_4 + iVar1);
    iVar3 = 0x20 - uVar2;
    *puVar4 = local_24 << (sbyte)uVar2 | *puVar4 & *(uint *)(&DAT_003f2dc4 + uVar2 * 0x84);
    if (iVar3 < 9) {
      puVar4 = (uint *)(*(int *)param_4 + 4 + iVar1);
      *puVar4 = (&g_BitWriteMasks)[9 - iVar3] & *puVar4 | local_24 >> ((byte)iVar3 & 0x1f);
    }
    *(int *)(param_4 + 0xc) = *(int *)(param_4 + 0xc) + 9;
  }
  bf_write::WriteBits(param_4,*(void **)param_2,local_20);
  return;
}

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)