L L4D2node

CByteswap::SwapFieldToTargetEndian

0x00b67df0 · 1310 bytes · __thiscall

_ZN9CByteswap23SwapFieldToTargetEndianEPvS0_P17typedescription_t

Decompiled

undefined (4 params)

/* CByteswap::SwapFieldToTargetEndian(void*, void*, typedescription_t*) */

void __thiscall
CByteswap::SwapFieldToTargetEndian
          (CByteswap *this,void *param_1,void *param_2,typedescription_t *param_3)

{
  void *__src;
  uint uVar1;
  int iVar2;
  datamap_t *pdVar3;
  int iVar4;
  bool bVar5;
  uint local_34;
  int local_30;
  undefined4 local_24;
  undefined4 local_20;
  
  __src = param_2;
  switch(*(undefined4 *)param_3) {
  case 1:
    local_34 = (uint)*(ushort *)(param_3 + 0xc);
    if (param_1 == (void *)0x0) {
      return;
    }
    if (local_34 == 0) {
      return;
    }
    if (param_2 == (void *)0x0) {
      param_2 = param_1;
      if (((byte)*this & 1) == 0) {
        return;
      }
    }
    else if (((byte)*this & 1) == 0) {
LAB_00b68260:
      if (param_1 == param_2) {
        return;
      }
      param_2 = (void *)(local_34 << 2);
LAB_00b67e57:
      memcpy(param_1,__src,(size_t)param_2);
      return;
    }
    iVar4 = 0;
    do {
      iVar4 = iVar4 + 1;
      local_24._0_2_ = CONCAT11(*(undefined1 *)((int)param_2 + 2),*(undefined1 *)((int)param_2 + 3))
      ;
      local_24._0_3_ = CONCAT12(*(undefined1 *)((int)param_2 + 1),(undefined2)local_24);
      local_24 = CONCAT13(*(undefined1 *)param_2,(undefined3)local_24);
      _V_memcpy(param_1,&local_24,4);
      param_1 = (void *)((int)param_1 + 4);
      param_2 = (undefined1 *)((int)param_2 + 4);
    } while (iVar4 < (int)local_34);
    break;
  case 3:
    local_34 = (uint)*(ushort *)(param_3 + 0xc) * 3;
    if (param_1 == (void *)0x0) {
      return;
    }
    if (local_34 == 0) {
      return;
    }
    if (param_2 == (void *)0x0) {
      param_2 = param_1;
      if (((byte)*this & 1) == 0) {
        return;
      }
    }
    else if (((byte)*this & 1) == 0) goto LAB_00b68260;
    iVar4 = 0;
    do {
      iVar4 = iVar4 + 1;
      local_24._0_2_ = CONCAT11(*(undefined1 *)((int)param_2 + 2),*(undefined1 *)((int)param_2 + 3))
      ;
      local_24._0_3_ = CONCAT12(*(undefined1 *)((int)param_2 + 1),(undefined2)local_24);
      local_24 = CONCAT13(*(undefined1 *)param_2,(undefined3)local_24);
      _V_memcpy(param_1,&local_24,4);
      param_1 = (void *)((int)param_1 + 4);
      param_2 = (undefined1 *)((int)param_2 + 4);
    } while (iVar4 < (int)local_34);
    break;
  case 4:
    uVar1 = (uint)*(ushort *)(param_3 + 0xc);
    if ((param_1 != (void *)0x0) && (uVar1 != 0)) {
      if (param_2 == (void *)0x0) {
        param_2 = param_1;
        if (((byte)*this & 1) == 0) {
          return;
        }
      }
      else if (((byte)*this & 1) == 0) {
        if (param_1 == param_2) {
          return;
        }
        param_2 = (void *)(uVar1 << 4);
        goto LAB_00b67e57;
      }
      iVar4 = 0;
      do {
        iVar4 = iVar4 + 1;
        local_24._0_2_ =
             CONCAT11(*(undefined1 *)((int)param_2 + 2),*(undefined1 *)((int)param_2 + 3));
        local_24._0_3_ = CONCAT12(*(undefined1 *)((int)param_2 + 1),(undefined2)local_24);
        local_24 = CONCAT13(*(undefined1 *)param_2,(undefined3)local_24);
        _V_memcpy(param_1,&local_24,4);
        param_1 = (void *)((int)param_1 + 4);
        param_2 = (undefined1 *)((int)param_2 + 4);
      } while (iVar4 < (int)(uVar1 * 4));
    }
    break;
  case 5:
    local_34 = (uint)*(ushort *)(param_3 + 0xc);
    if (param_1 == (void *)0x0) {
      return;
    }
    if (local_34 == 0) {
      return;
    }
    if (param_2 == (void *)0x0) {
      param_2 = param_1;
      if (((byte)*this & 1) == 0) {
        return;
      }
    }
    else if (((byte)*this & 1) == 0) goto LAB_00b68260;
    iVar4 = 0;
    do {
      iVar4 = iVar4 + 1;
      local_24._0_2_ = CONCAT11(*(undefined1 *)((int)param_2 + 2),*(undefined1 *)((int)param_2 + 3))
      ;
      local_24._0_3_ = CONCAT12(*(undefined1 *)((int)param_2 + 1),(undefined2)local_24);
      local_24 = CONCAT13(*(undefined1 *)param_2,(undefined3)local_24);
      _V_memcpy(param_1,&local_24,4);
      param_1 = (void *)((int)param_1 + 4);
      param_2 = (undefined1 *)((int)param_2 + 4);
    } while (iVar4 < (int)local_34);
    break;
  case 6:
  case 8:
    if ((void *)(uint)*(ushort *)(param_3 + 0xc) == (void *)0x0) {
      return;
    }
    if (param_1 == (void *)0x0) {
      return;
    }
    if (param_2 == (void *)0x0) {
      return;
    }
    bVar5 = param_1 == param_2;
    param_2 = (void *)(uint)*(ushort *)(param_3 + 0xc);
    if (bVar5) {
      return;
    }
    goto LAB_00b67e57;
  case 7:
    uVar1 = (uint)*(ushort *)(param_3 + 0xc);
    if ((param_1 != (void *)0x0) && (uVar1 != 0)) {
      if (param_2 == (void *)0x0) {
        param_2 = param_1;
        if (((byte)*this & 1) == 0) {
          return;
        }
      }
      else if (((byte)*this & 1) == 0) {
        if (param_1 == param_2) {
          return;
        }
        param_2 = (void *)(uVar1 * 2);
        goto LAB_00b67e57;
      }
      iVar4 = 0;
      do {
        iVar4 = iVar4 + 1;
        local_24._0_2_ = CONCAT11(*(undefined1 *)param_2,*(undefined1 *)((int)param_2 + 1));
        _V_memcpy(param_1,&local_24,2);
        param_1 = (void *)((int)param_1 + 2);
        param_2 = (undefined1 *)((int)param_2 + 2);
      } while (iVar4 < (int)uVar1);
    }
    break;
  case 10:
    pdVar3 = *(datamap_t **)(param_3 + 0x20);
    iVar4 = *(int *)pdVar3;
    if (*(short *)(param_3 + 0xc) != 0) {
      iVar2 = 0;
      while( true ) {
        iVar2 = iVar2 + 1;
        SwapFieldsToTargetEndian
                  (this,(void *)(*(int *)(iVar4 + 8) + (int)param_1),
                   (void *)((int)param_2 + *(int *)(iVar4 + 8)),pdVar3);
        param_1 = (void *)((int)param_1 + *(int *)(param_3 + 0x24));
        param_2 = (void *)((int)param_2 + *(int *)(param_3 + 0x24));
        if ((int)(uint)*(ushort *)(param_3 + 0xc) <= iVar2) break;
        pdVar3 = *(datamap_t **)(param_3 + 0x20);
      }
    }
    break;
  case 0x1c:
    uVar1 = (uint)*(ushort *)(param_3 + 0xc);
    if ((param_1 != (void *)0x0) && (uVar1 != 0)) {
      if (param_2 == (void *)0x0) {
        param_2 = param_1;
        if (((byte)*this & 1) == 0) {
          return;
        }
      }
      else if (((byte)*this & 1) == 0) {
        bVar5 = param_1 == param_2;
        param_2 = (void *)(uVar1 << 3);
        if (bVar5) {
          return;
        }
        goto LAB_00b67e57;
      }
      iVar4 = 0;
      do {
        iVar4 = iVar4 + 1;
        local_24._0_2_ =
             CONCAT11(*(undefined1 *)((int)param_2 + 2),*(undefined1 *)((int)param_2 + 3));
        local_24._0_3_ = CONCAT12(*(undefined1 *)((int)param_2 + 1),(undefined2)local_24);
        local_24 = CONCAT13(*(undefined1 *)param_2,(undefined3)local_24);
        _V_memcpy(param_1,&local_24,4);
        param_1 = (void *)((int)param_1 + 4);
        param_2 = (undefined1 *)((int)param_2 + 4);
      } while (iVar4 < (int)(uVar1 * 2));
    }
    break;
  case 0x1d:
    uVar1 = (uint)*(ushort *)(param_3 + 0xc);
    if ((param_1 != (void *)0x0) && (uVar1 != 0)) {
      if (param_2 == (void *)0x0) {
        param_2 = param_1;
        if (((byte)*this & 1) == 0) {
          return;
        }
      }
      else if (((byte)*this & 1) == 0) {
        if (param_1 == param_2) {
          return;
        }
        param_2 = (void *)(uVar1 << 3);
        goto LAB_00b67e57;
      }
      local_30 = 0;
      do {
        local_24 = *(undefined4 *)param_1;
        local_20 = *(undefined4 *)((int)param_1 + 4);
        iVar4 = 0;
        do {
          iVar2 = iVar4 + 1;
          *(undefined1 *)((int)&local_24 + iVar4) = *(undefined1 *)((int)param_2 + (7 - iVar4));
          iVar4 = iVar2;
        } while (iVar2 != 8);
        param_2 = (void *)((int)param_2 + 8);
        _V_memcpy(param_1,&local_24,8);
        local_30 = local_30 + 1;
        param_1 = (undefined4 *)((int)param_1 + 8);
      } while (local_30 < (int)uVar1);
    }
  }
  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)