L L4D2node

KeyValues::LoadFromFile

0x00046e70 · 420 bytes · __thiscall

_ZN9KeyValues12LoadFromFileEP15IBaseFileSystemPKcS3_

Decompiled

undefined (4 params)

/* KeyValues::LoadFromFile(IBaseFileSystem*, char const*, char const*) */

undefined4 __thiscall
KeyValues::LoadFromFile(KeyValues *this,IBaseFileSystem *param_1,char *param_2,char *param_3)

{
  IBaseFileSystem *pIVar1;
  char cVar2;
  int iVar3;
  int iVar4;
  char *pcVar5;
  int iVar6;
  undefined4 uVar7;
  uint uVar8;
  int local_54 [17];
  
  iVar3 = (**(code **)(*(int *)param_1 + 8))(param_1,param_2,&DAT_000b2c79,param_3);
  if (iVar3 != 0) {
    s_LastFileLoadingFrom = param_2;
    iVar4 = (**(code **)(*(int *)param_1 + 0x18))(param_1,iVar3);
    uVar8 = iVar4 + 2;
    pIVar1 = param_1 + -4;
    cVar2 = (**(code **)(*(int *)(param_1 + -4) + 0x148))(pIVar1,iVar3,local_54,0,0);
    if (cVar2 != '\0') {
      uVar8 = iVar4 + 1 + local_54[0] & -local_54[0];
    }
    pcVar5 = (char *)(**(code **)(*(int *)(param_1 + -4) + 0x14c))(pIVar1,iVar3,uVar8,0);
    iVar6 = (**(code **)(*(int *)(param_1 + -4) + 0x118))(pIVar1,pcVar5,uVar8,iVar4,iVar3);
    uVar7 = 0;
    (**(code **)(*(int *)param_1 + 0xc))(param_1,iVar3);
    if (iVar6 != 0) {
      pcVar5[iVar4] = '\0';
      pcVar5[iVar4 + 1] = '\0';
      CUtlBuffer::CUtlBuffer((CUtlBuffer *)local_54,0,0,0);
                    /* try { // try from 00046fb5 to 00046ffd has its CatchHandler @ 0004701a */
      iVar3 = _V_strlen(pcVar5);
      CUtlBuffer::SetExternalBuffer((CUtlBuffer *)local_54,pcVar5,uVar8,iVar3,9);
      uVar7 = LoadFromBuffer(this,param_2,(CUtlBuffer *)local_54,param_1,(char *)0x0);
      CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)local_54);
    }
    (**(code **)(*(int *)(param_1 + -4) + 0x150))(pIVar1,pcVar5);
    return uVar7;
  }
  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)