L L4D2node

GCSDK::GetPchTempTextBuffer

0x0008c500 · 440 bytes · __cdecl

_ZN5GCSDK20GetPchTempTextBufferEv

Decompiled

undefined (0 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* GCSDK::GetPchTempTextBuffer() */

int GCSDK::GetPchTempTextBuffer(void)

{
  int iVar1;
  int *piVar2;
  int iVar3;
  void *pvVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  undefined4 *puVar8;
  
  piVar2 = (int *)___tls_get_addr();
  iVar6 = (*piVar2 + 1) % 5;
  *piVar2 = iVar6;
  iVar3 = ___tls_get_addr();
  iVar5 = *(int *)(iVar3 + iVar6 * 4);
  if (iVar5 != 0) {
    return iVar5;
  }
  pthread_mutex_lock((pthread_mutex_t *)g_mutexTempTextBuffer);
  pvVar4 = malloc(0x400);
  iVar1 = DAT_000d68cc;
  *(void **)(iVar3 + iVar6 * 4) = pvVar4;
  iVar5 = iVar1 + 1;
  if ((iVar5 <= _DAT_000d68c4) || (DAT_000d68c8 < 0)) goto LAB_0008c59a;
  if (DAT_000d68c8 == 0) {
    if (_DAT_000d68c4 == 0) {
      if (iVar5 < 9) {
        _DAT_000d68c4 = 8;
        goto LAB_0008c63f;
      }
      _DAT_000d68c4 = 8;
    }
    do {
      _DAT_000d68c4 = _DAT_000d68c4 * 2;
    } while (_DAT_000d68c4 < iVar5);
  }
  else {
    for (_DAT_000d68c4 = (iVar1 / DAT_000d68c8 + 1) * DAT_000d68c8; _DAT_000d68c4 < iVar5;
        _DAT_000d68c4 = (_DAT_000d68c4 + iVar5) / 2) {
    }
  }
LAB_0008c63f:
  if (g_vecTempTextBuffer == (void *)0x0) {
    g_vecTempTextBuffer = malloc(_DAT_000d68c4 << 2);
  }
  else {
    g_vecTempTextBuffer = realloc(g_vecTempTextBuffer,_DAT_000d68c4 << 2);
    iVar5 = DAT_000d68cc + 1;
  }
LAB_0008c59a:
  iVar7 = iVar1 * 4;
  iVar3 = (iVar5 - iVar1) + -1;
  DAT_000d68cc = iVar5;
  _DAT_000d68d0 = g_vecTempTextBuffer;
  if (0 < iVar3) {
                    /* try { // try from 0008c685 to 0008c689 has its CatchHandler @ 0008c6c4 */
    _V_memmove((void *)((int)g_vecTempTextBuffer + iVar7 + 4),
               (void *)((int)g_vecTempTextBuffer + iVar7),iVar3 * 4);
  }
  puVar8 = (undefined4 *)(iVar7 + (int)g_vecTempTextBuffer);
  if (puVar8 != (undefined4 *)0x0) {
    iVar5 = ___tls_get_addr();
    *puVar8 = *(undefined4 *)(iVar5 + iVar6 * 4);
  }
  pthread_mutex_unlock((pthread_mutex_t *)g_mutexTempTextBuffer);
  iVar5 = ___tls_get_addr();
  return *(int *)(iVar5 + iVar6 * 4);
}

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)