L L4D2node

Sys_LoadLibraryGuts

0x00b6c400 · 269 bytes · __regparm3

_ZL19Sys_LoadLibraryGutsPKc9Sys_Flags

Decompiled

undefined (2 params)

/* Sys_LoadLibraryGuts(char const*, Sys_Flags) */

int __regparm3 Sys_LoadLibraryGuts(char *param_1,uint param_2)

{
  int iVar1;
  char *pcVar2;
  char *pcVar3;
  int in_GS_OFFSET;
  char local_420 [1024];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  iVar1 = V_GetFileExtension("_srv.so");
  pcVar2 = "_srv.so";
  if (iVar1 != 0) {
    pcVar2 = (char *)(iVar1 + -1);
  }
  V_strncpy(local_420,param_1,0x400);
  V_SetExtension(local_420,pcVar2,0x400);
  V_FixSlashes(local_420,'/');
  if ((param_2 & 1) == 0) {
    iVar1 = dlopen(local_420,2);
    if (iVar1 == 0) {
      pcVar2 = (char *)dlerror();
      if (pcVar2 != (char *)0x0) {
        pcVar3 = strstr(pcVar2,"No such file");
        if (pcVar3 == (char *)0x0) {
          pcVar3 = strstr(pcVar2,"image not found");
          if (pcVar3 == (char *)0x0) {
            Msg(" failed to dlopen %s error=%s\n",local_420,pcVar2);
          }
        }
      }
    }
  }
  else {
    iVar1 = dlopen(local_420,6);
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return iVar1;
  }
                    /* 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)