L L4D2node

GetSpew

0x00215550 · 242 bytes · __cdecl

_Z7GetSpewPcj

Decompiled

undefined (2 params)

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

uint GetSpew(char *param_1,uint param_2)

{
  uint uVar1;
  uint uVar2;
  void *pvVar3;
  int iVar4;
  int iVar5;
  CUtlString *this;
  bool bVar6;
  
  uVar2 = ThreadGetCurrentId();
  if (uVar2 != g_SpewMutex) {
    LOCK();
    bVar6 = g_SpewMutex != 0;
    uVar1 = uVar2;
    if (bVar6) {
      uVar1 = g_SpewMutex;
    }
    g_SpewMutex = uVar1;
    UNLOCK();
    if (bVar6) {
      CThreadFastMutex::Lock(0x3eca44,uVar2);
      goto LAB_00215586;
    }
  }
  DAT_003eca48 = DAT_003eca48 + 1;
LAB_00215586:
  iVar5 = param_2 - 1;
  uVar2 = (uint)DAT_003eca5a;
  if (uVar2 != 0xffff) {
    while( true ) {
      this = (CUtlString *)(g_SpewHistory + uVar2 * 0x14);
      iVar4 = CUtlString::Length(this);
      if (iVar5 <= iVar4) {
        iVar4 = iVar5;
      }
      if (iVar4 < 1) break;
                    /* try { // try from 002155ab to 002155f3 has its CatchHandler @ 0021564f */
      pvVar3 = (void *)CUtlString::Get(this);
      _V_memcpy(param_1,pvVar3,iVar4);
      param_1 = param_1 + iVar4;
      iVar5 = iVar5 - iVar4;
      if ((iVar5 < 1) ||
         (uVar2 = (uint)*(ushort *)(g_SpewHistory + 0x10 + uVar2 * 0x14), uVar2 == 0xffff)) break;
    }
  }
  *param_1 = '\0';
  DAT_003eca48 = DAT_003eca48 - 1;
  uVar2 = DAT_003eca48;
  if (DAT_003eca48 == 0) {
    LOCK();
    UNLOCK();
    uVar2 = g_SpewMutex;
    g_SpewMutex = 0;
  }
  return uVar2;
}

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)