L L4D2node

memfgets

0x001930e0 · 143 bytes · __cdecl

_Z8memfgetsPhiPiPci

Decompiled

undefined (5 params)

/* memfgets(unsigned char*, int, int*, char*, int) */

char * memfgets(uchar *param_1,int param_2,int *param_3,char *param_4,int param_5)

{
  int iVar1;
  size_t __n;
  int iVar2;
  int iVar3;
  
  iVar1 = *param_3;
  if ((((param_1 != (uchar *)0x0) && (param_4 != (char *)0x0)) && (iVar1 < param_2)) &&
     ((iVar2 = iVar1, param_2 - iVar1 < param_5 || (param_2 = iVar1 + -1 + param_5, iVar1 < param_2)
      ))) {
    do {
      iVar3 = iVar2 + 1;
      if (param_1[iVar2] == '\n') break;
      iVar2 = iVar3;
    } while (iVar3 < param_2);
    if (iVar1 != iVar3) {
      __n = iVar3 - iVar1;
      memcpy(param_4,param_1 + iVar1,__n);
      if ((int)__n < param_5) {
        param_4[__n] = '\0';
      }
      *param_3 = iVar3;
      return param_4;
    }
  }
  return (char *)0x0;
}

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)