L L4D2node

bzopen_or_bzdopen

0x00290060 · 589 bytes · __regparm3

_ZL17bzopen_or_bzdopenPKciS0_i

Decompiled

undefined (4 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* bzopen_or_bzdopen(char const*, int, char const*, int) */

int __regparm3 bzopen_or_bzdopen(char *param_1,int param_2,char *param_3,int param_4)

{
  bool bVar1;
  bool bVar2;
  FILE *__stream;
  char cVar3;
  int iVar4;
  undefined1 *puVar5;
  uint uVar6;
  undefined4 uVar7;
  int in_GS_OFFSET;
  undefined1 local_13b8 [6];
  undefined4 local_13b2;
  undefined4 local_13ae;
  undefined2 local_13aa;
  undefined1 local_13a8 [5000];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_13b2 = 0;
  local_13ae = 0;
  local_13aa = 0;
  if (param_3 == (char *)0x0) goto LAB_002902b0;
  iVar4 = (int)*param_3;
  if (*param_3 == '\0') {
    bVar2 = false;
    uVar7 = 0;
    uVar6 = 9;
    puVar5 = &DAT_002a9af2;
  }
  else {
    uVar7 = 0;
    bVar1 = false;
    uVar6 = 9;
    do {
      while (cVar3 = (char)iVar4, cVar3 == 's') {
        param_3 = param_3 + 1;
        iVar4 = (int)*param_3;
        uVar7 = 1;
        if (*param_3 == '\0') goto LAB_002900f9;
      }
      if (cVar3 == 'w') {
        bVar1 = true;
      }
      else if (cVar3 == 'r') {
        bVar1 = false;
      }
      else if (iVar4 - 0x30U < 10) {
        uVar6 = iVar4 - 0x30U;
      }
      param_3 = param_3 + 1;
      iVar4 = (int)*param_3;
    } while (*param_3 != '\0');
LAB_002900f9:
    puVar5 = &DAT_002a9af2;
    bVar2 = false;
    if (bVar1) {
      bVar2 = true;
      puVar5 = &DAT_002b7513;
    }
  }
  local_13b2 = (uint)CONCAT21(0x62,*puVar5);
  if (param_4 == 0) {
    if ((param_1 != (char *)0x0) && (*param_1 != '\0')) {
      __stream = (FILE *)__wrap_fopen(param_1,&local_13b2);
      goto LAB_00290272;
    }
    if (bVar2) {
      if (_stdout == (FILE *)0x0) goto LAB_002902b0;
      __stream = _stdout;
      if ((int)uVar6 < 1) goto LAB_00290286;
LAB_002901f0:
      if (9 < (int)uVar6) {
        uVar6 = 9;
      }
LAB_002901fb:
      iVar4 = BZ2_bzWriteOpen(local_13b8,__stream,uVar6,0,0x1e);
      goto joined_r0x00290231;
    }
    __stream = _stdin;
    if (_stdin != (FILE *)0x0) goto LAB_0029014f;
  }
  else {
    __stream = fdopen(param_2,(char *)&local_13b2);
LAB_00290272:
    if (__stream != (FILE *)0x0) {
      if (bVar2) {
        if (0 < (int)uVar6) goto LAB_002901f0;
LAB_00290286:
        uVar6 = 1;
        goto LAB_002901fb;
      }
LAB_0029014f:
      iVar4 = BZ2_bzReadOpen(local_13b8,__stream,0,uVar7,local_13a8,0);
joined_r0x00290231:
      if (iVar4 != 0) goto LAB_00290195;
      if ((__stream != _stdin) && (__stream != _stdout)) {
        fclose(__stream);
        goto LAB_00290195;
      }
    }
  }
LAB_002902b0:
  iVar4 = 0;
LAB_00290195:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return iVar4;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)