L L4D2node

V_StringToBin

0x0004b950 · 215 bytes · __cdecl

_Z13V_StringToBinPKcPvj

Decompiled

undefined (3 params)

/* V_StringToBin(char const*, void*, unsigned int) */

undefined4 V_StringToBin(char *param_1,void *param_2,uint param_3)

{
  char cVar1;
  size_t sVar2;
  uint uVar3;
  int iVar4;
  byte bVar5;
  int iVar6;
  
  if (param_1 == (char *)0x0) {
    sVar2 = 0;
  }
  else {
    sVar2 = strlen(param_1);
  }
  if (param_3 * 2 != sVar2) {
    return 0;
  }
  uVar3 = 0;
  if (param_3 != 0) {
    do {
      cVar1 = param_1[uVar3 * 2];
      iVar6 = (int)cVar1;
      if ((byte)(cVar1 - 0x30U) < 10) {
        iVar4 = iVar6 + -0x30;
      }
      else if ((byte)(cVar1 + 0xbfU) < 6) {
        iVar4 = iVar6 + -0x37;
      }
      else {
        iVar4 = -1;
        if ((byte)(cVar1 + 0x9fU) < 6) {
          iVar4 = iVar6 + -0x57;
        }
      }
      cVar1 = param_1[uVar3 * 2 + 1];
      if ((byte)(cVar1 - 0x30U) < 10) {
        bVar5 = cVar1 - 0x30;
      }
      else if ((byte)(cVar1 + 0xbfU) < 6) {
        bVar5 = cVar1 - 0x37;
      }
      else {
        if (5 < (byte)(cVar1 + 0x9fU)) {
          return 0;
        }
        bVar5 = cVar1 + 0xa9;
      }
      if (iVar4 < 0) {
        return 0;
      }
      *(byte *)((int)param_2 + uVar3) = (byte)(iVar4 << 4) | bVar5;
      uVar3 = uVar3 + 1;
    } while (uVar3 != param_3);
  }
  return 1;
}

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)