L L4D2node

CLZMA::Uncompress

0x00254230 · 277 bytes · __thiscall

_ZN5CLZMA10UncompressEPhS0_PFvvE

Decompiled

undefined (4 params)

/* CLZMA::Uncompress(unsigned char*, unsigned char*, void (*)()) */

uint __thiscall CLZMA::Uncompress(CLZMA *this,uchar *param_1,uchar *param_2,_func_void *param_3)

{
  uint uVar1;
  char cVar2;
  int iVar3;
  uint uVar4;
  byte bVar5;
  uint local_34;
  uint local_30;
  uint local_2c;
  int local_28;
  int local_24;
  void *local_20;
  
  if (((param_1 != (uchar *)0x0) && (*(int *)param_1 == 0x414d5a4c)) &&
     (uVar1 = *(uint *)(param_1 + 4), uVar1 != 0)) {
    bVar5 = param_1[0xc];
    if (bVar5 < 0xe1) {
      local_24 = 0;
      if (0x2c < bVar5) {
        iVar3 = 1;
        do {
          local_24 = iVar3;
          bVar5 = bVar5 - 0x2d;
          iVar3 = local_24 + 1;
        } while (0x2c < bVar5);
      }
      local_28 = 0;
      if (8 < bVar5) {
        iVar3 = 1;
        do {
          local_28 = iVar3;
          bVar5 = bVar5 - 9;
          iVar3 = local_28 + 1;
        } while (8 < bVar5);
      }
      cVar2 = (char)local_28;
      local_2c = (uint)bVar5;
    }
    else {
      bVar5 = (byte)local_2c;
      cVar2 = (char)local_28;
    }
    local_20 = malloc((0x300 << (bVar5 + cVar2 & 0x1f)) * 4 + 0x1cd8);
    iVar3 = LzmaDecode((_CLzmaDecoderState *)&local_2c,param_1 + 0x11,*(uint *)(param_1 + 8),
                       &local_34,param_2,uVar1,&local_30,param_3);
    free(local_20);
    if (iVar3 == 0) {
      uVar4 = 0;
      if (local_30 == uVar1) {
        uVar4 = uVar1;
      }
      return uVar4;
    }
  }
  return 0;
}

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)