L L4D2node

DownloadManager::MarkMapAsDownloadedFromServer

0x0013d090 · 268 bytes · __thiscall

_ZN15DownloadManager29MarkMapAsDownloadedFromServerEPKc

Decompiled

undefined (2 params)

/* DownloadManager::MarkMapAsDownloadedFromServer(char const*) */

void __thiscall DownloadManager::MarkMapAsDownloadedFromServer(DownloadManager *this,char *param_1)

{
  int iVar1;
  int iVar2;
  char cVar3;
  undefined4 uVar4;
  void *pvVar5;
  int iVar6;
  int iVar7;
  
  if (param_1 == (char *)0x0) {
    return;
  }
  cVar3 = HasMapBeenDownloadedFromServer(this,param_1);
  if (cVar3 != '\0') {
    return;
  }
  uVar4 = CloneString(param_1);
  iVar1 = *(int *)(this + 0x44);
  iVar7 = *(int *)(this + 0x3c);
  iVar6 = iVar1 + 1;
  if (iVar7 < iVar6) {
    iVar2 = *(int *)(this + 0x40);
    if (-1 < iVar2) {
      if (iVar2 == 0) {
        if (iVar7 == 0) {
          if (iVar6 < 9) {
            iVar7 = 8;
            goto LAB_0013d14f;
          }
          iVar7 = 8;
        }
        do {
          iVar7 = iVar7 * 2;
        } while (iVar7 < iVar6);
      }
      else {
        for (iVar7 = (iVar1 / iVar2 + 1) * iVar2; iVar7 < iVar6; iVar7 = (iVar7 + iVar6) / 2) {
        }
      }
LAB_0013d14f:
      *(int *)(this + 0x3c) = iVar7;
      if (*(void **)(this + 0x38) == (void *)0x0) {
        pvVar5 = malloc(iVar7 << 2);
        *(void **)(this + 0x38) = pvVar5;
      }
      else {
        pvVar5 = realloc(*(void **)(this + 0x38),iVar7 << 2);
        *(void **)(this + 0x38) = pvVar5;
        iVar6 = *(int *)(this + 0x44) + 1;
      }
      goto LAB_0013d0da;
    }
  }
  pvVar5 = *(void **)(this + 0x38);
LAB_0013d0da:
  *(int *)(this + 0x44) = iVar6;
  iVar7 = iVar1 * 4;
  iVar6 = (iVar6 - iVar1) + -1;
  *(void **)(this + 0x48) = pvVar5;
  if (0 < iVar6) {
    _V_memmove((void *)((int)pvVar5 + iVar7 + 4),(void *)((int)pvVar5 + iVar7),iVar6 * 4);
    pvVar5 = *(void **)(this + 0x38);
  }
  if ((undefined4 *)(iVar7 + (int)pvVar5) == (undefined4 *)0x0) {
    return;
  }
  *(undefined4 *)(iVar7 + (int)pvVar5) = uVar4;
  return;
}

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)