L L4D2node

Sys_InitGame

0x00215680 · 637 bytes · __cdecl

_Z12Sys_InitGamePFPvPKcPiES1_S_i

Decompiled

undefined (4 params)

/* Sys_InitGame(void* (*)(char const*, int*), char const*, void*, int) */

bool Sys_InitGame(_func_void_ptr_char_ptr_int_ptr *param_1,char *param_2,void *param_3,int param_4)

{
  code *pcVar1;
  int *piVar2;
  undefined4 uVar3;
  __pid_t _Var4;
  int iVar5;
  undefined4 *puVar6;
  bool bVar7;
  byte bVar8;
  
  bVar8 = 0;
  InitMathlib();
  FileSystem_SetWhitelistSpewFlags();
  LoggingSystem_SetChannelSpewLevelByTag("Console",0);
  LoggingSystem_PushLoggingState(0);
  LoggingSystem_RegisterLoggingListener(&g_EngineLoggingListener);
  ConVar::InstallChangeCallback((ConVar *)developer,DeveloperChangeCallback);
  host_initialized = '\0';
  pmainwindow = param_3;
  s_bIsDedicated = param_4 != 0;
  puVar6 = &gmodinfo;
  for (iVar5 = 0x8b; iVar5 != 0; iVar5 = iVar5 + -1) {
    *puVar6 = 0;
    puVar6 = puVar6 + (uint)bVar8 * -2 + 1;
  }
  V_strncpy(Sys_InitGame(void*(*)(char_const*,int*),char_const*,void*,int)::s_pBaseDir,param_2,0x100
           );
  _V_strlower(Sys_InitGame(void*(*)(char_const*,int*),char_const*,void*,int)::s_pBaseDir);
  V_FixSlashes(Sys_InitGame(void*(*)(char_const*,int*),char_const*,void*,int)::s_pBaseDir,'/');
  host_parms = Sys_InitGame(void*(*)(char_const*,int*),char_const*,void*,int)::s_pBaseDir;
  piVar2 = (int *)CommandLine_Tier0();
  iVar5 = (**(code **)(*piVar2 + 0x28))(piVar2,"-pidfile");
  if (iVar5 != 0) {
    pcVar1 = *(code **)(g_pFileSystem[1] + 8);
    piVar2 = (int *)CommandLine_Tier0();
    uVar3 = (**(code **)(*piVar2 + 0x18))(piVar2,"-pidfile","srcds.pid");
    iVar5 = (*pcVar1)(g_pFileSystem + 1,uVar3,&DAT_002c6247,0);
    if (iVar5 == 0) {
      piVar2 = (int *)CommandLine_Tier0();
      uVar3 = (**(code **)(*piVar2 + 0xc))(piVar2,"-pidfile",0);
      Warning("Unable to open pidfile (%s)\n",uVar3);
    }
    else {
      pcVar1 = *(code **)(*g_pFileSystem + 100);
      _Var4 = getpid();
      (*pcVar1)(g_pFileSystem,iVar5,"%i\n",_Var4);
      (**(code **)(g_pFileSystem[1] + 0xc))(g_pFileSystem + 1,iVar5);
    }
  }
  TraceInit("Sys_Init()","Sys_Shutdown()",0);
  piVar2 = (int *)CommandLine_Tier0();
  iVar5 = (**(code **)(*piVar2 + 0x28))(piVar2,"-random_invariant");
  SeedRandomNumberGenerator(iVar5 != 0);
  TraceInit("Sys_InitMemory()","Sys_ShutdownMemory()",0);
  Sys_InitMemory();
  TraceInit("Host_Init( s_bIsDedicated )","Host_Shutdown()",0);
  Host_Init((bool)s_bIsDedicated);
  bVar7 = host_initialized != '\0';
  if (bVar7) {
    TraceInit("Sys_InitAuthentication()","Sys_ShutdownAuthentication()",0);
    MapReslistGenerator_BuildMapList();
    BuildMinidumpComment((char *)0x0,false);
  }
  return bVar7;
}

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)