L L4D2node

SplitContext

0x005a9640 · 410 bytes · __cdecl

_Z12SplitContextPKcPciS1_iPfS0_

Decompiled

undefined (7 params)

/* SplitContext(char const*, char*, int, char*, int, float*, char const*) */

int SplitContext(char *param_1,char *param_2,int param_3,char *param_4,int param_5,float *param_6,
                char *param_7)

{
  char *pcVar1;
  int iVar2;
  uint uVar3;
  uint uVar4;
  int iVar5;
  int iVar6;
  bool bVar7;
  double dVar8;
  
  iVar2 = _V_strstr(param_1,":");
  if (iVar2 == 0) {
    DevMsg("SplitContext:  warning, ignoring context \'%s\', missing colon separator!\n",param_1);
LAB_005a97c2:
    *param_4 = '\0';
    *param_2 = '\0';
    iVar2 = 0;
  }
  else {
    iVar6 = iVar2 - (int)param_1;
    iVar5 = iVar6 + 1;
    if (param_3 < iVar6 + 1) {
      iVar5 = param_3;
    }
    V_strncpy(param_2,param_1,iVar5);
    iVar5 = param_3 + -1;
    if (iVar6 <= param_3 + -1) {
      iVar5 = iVar6;
    }
    param_2[iVar5] = '\0';
    pcVar1 = (char *)(iVar2 + 1);
    uVar3 = _V_strstr(pcVar1,",");
    bVar7 = uVar3 == 0;
    if (bVar7) {
      iVar5 = _V_strlen(pcVar1);
      uVar3 = iVar2 + 1 + iVar5;
    }
    uVar4 = _V_strstr(pcVar1,":");
    if ((uVar4 < uVar3) && (uVar4 != 0)) {
      if (param_6 != (float *)0x0) {
        dVar8 = strtod((char *)(uVar4 + 1),(char **)0x0);
        *param_6 = (float)dVar8;
      }
      if (9 < (byte)(*(char *)(uVar4 + 1) - 0x30U)) {
        DevMsg("SplitContext:  warning, ignoring context \'%s\', missing comma separator!  Entire context was \'%s\'.\n"
               ,param_1,param_7);
        goto LAB_005a97c2;
      }
      iVar2 = param_5 + -1;
      if ((int)(uVar4 - (int)pcVar1) <= param_5 + -1) {
        iVar2 = uVar4 - (int)pcVar1;
      }
    }
    else {
      if (param_6 != (float *)0x0) {
        *param_6 = 0.0;
      }
      iVar2 = uVar3 - (int)pcVar1;
      if (param_5 + -1 < (int)(uVar3 - (int)pcVar1)) {
        iVar2 = param_5 + -1;
      }
    }
    V_strncpy(param_4,pcVar1,iVar2 + 1);
    param_4[iVar2] = '\0';
    iVar2 = 0;
    if (!bVar7) {
      iVar2 = uVar3 + 1;
    }
  }
  return iVar2;
}

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)