If you want to help us maintaining this wiki, check out our discord server: https://discord.gg/3u69jMa 

Core.dll

From SWRC Wiki
Jump to navigation Jump to search
int __fastcall appInit(int a1, const char *a2, int (__stdcall **a3)(int, int), int (__stdcall *(*a4)[2])(int, int), int a5, int (*a6)(void), int a7)
{
  unsigned int i; // ecx@1
  int v8; // eax@3
  signed int v9; // esi@3
  signed int v10; // eax@9
  signed int v11; // ecx@9
  signed int v12; // esi@9
  CHAR *v13; // eax@15
  const CHAR *v14; // eax@15
  int v15; // eax@17
  int v16; // esi@17
  int v17; // eax@18
  int j; // eax@20
  int k; // eax@25
  int v20; // eax@30
  int v21; // eax@32
  const CHAR *v22; // edx@32
  int v23; // esi@32
  int v24; // ecx@32
  const CHAR *v25; // eax@34
  unsigned int v26; // ecx@41
  void *v27; // ecx@43
  int result; // eax@44
  int l; // eax@47
  int m; // eax@53
  int v31; // [sp+0h] [bp-134h]@1
  char Str1; // [sp+Ch] [bp-128h]@36
  int v33; // [sp+114h] [bp-20h]@32
  unsigned int v34; // [sp+118h] [bp-1Ch]@32
  int v35; // [sp+11Ch] [bp-18h]@17
  unsigned int v36; // [sp+120h] [bp-14h]@24
  int *v37; // [sp+124h] [bp-10h]@1
  int v38; // [sp+130h] [bp-4h]@1

  v37 = &v31;
  v38 = 0;
  for ( i = 0; i < 0x100; ++i )
  {
    v8 = i << 24;
    v9 = 8;
    while ( v9 )
    {
      if ( v8 >= 0 )
      {
        v8 *= 2;
        (&GCRCTable)[i] = (unsigned __int32 *)v8;
        --v9;
      }
      else
      {
        v8 = 2 * v8 ^ 0x4C11DB7;
        (&GCRCTable)[i] = (unsigned __int32 *)v8;
        --v9;
      }
    }
  }
  v10 = 0;
  v11 = -1;
  v12 = 0;
  while ( v10 <= 256 )
  {
    byte_101E3838[v10] = v11 + 1;
    if ( !v10 || (++v12, v12 >= 1 << v11) )
    {
      v12 = 0;
      ++v11;
    }
    ++v10;
  }
  appStrcpy(byte_101E3D60, a2);
  appStrcpy(&GErrorHist, "General protection fault!\r\n\r\nHistory: ");
  GLog = a3;
  GError = a4;
  GWarn = a5;
  FName::StaticInit();
  sub_10170AE0();
  (**(void (__stdcall ***)(_DWORD))GFileManager)(1);
  v13 = appBaseDir();
  (*(void (__stdcall **)(CHAR *))(*(_DWORD *)GFileManager + 48))(v13);
  v14 = (const CHAR *)GOutputPath;
  if ( !(dword_101BDA84 & 0x1FFFFFFF) )
    v14 = &Directory;
  (*(void (__stdcall **)(const CHAR *, _DWORD))(*(_DWORD *)GFileManager + 36))(v14, 0);
  v15 = FString::Printf((int)&v35, (int)"Build: %d");
  v16 = v15;
  LOBYTE(v38) = 1;
  if ( (int *)v15 != &GBuildLabel )
  {
    v17 = *(_DWORD *)(v15 + 4);
    if ( v17 & 0x60000000 )
    {
      for ( j = 0; j < 8 * dword_101BDAF4 >> 3; ++j )
        ;
      TArray<char>::Realloc((int)&GBuildLabel, 0, 0);
      GBuildLabel = *(_DWORD *)v16;
      dword_101BDAF4 ^= (dword_101BDAF4 ^ (8 * *(_DWORD *)(v16 + 4) >> 3)) & 0x1FFFFFFF;
      dword_101BDAF4 ^= (dword_101BDAF4 ^ (4 * *(_DWORD *)(v16 + 4) >> 2)) & 0x20000000;
      *(_DWORD *)(v16 + 4) |= 0x20000000u;
    }
    else
    {
      TArray<char>::Realloc((int)&GBuildLabel, 8 * v17 >> 3, 0);
      memcpy((void *)GBuildLabel, *(const void **)v16, 8 * dword_101BDAF4 >> 3);
    }
  }
  LOBYTE(v38) = 0;
  if ( !(v36 & 0x20000000) )
  {
    for ( k = 0; k < (signed int)(8 * v36) >> 3; ++k )
      ;
    if ( v35 )
      (*(void (__stdcall **)(int))(*(_DWORD *)GMalloc + 12))(v35);
  }
  v20 = GBuildLabel;
  if ( !(dword_101BDAF4 & 0x1FFFFFFF) )
    v20 = (int)&Directory;
  FOutputDevice::Logf((int)GLog, 762, v20);
  FOutputDevice::Logf((int)GLog, 762, (int)"Engine version: %i");
  FOutputDevice::Logf((int)GLog, 762, (int)"Compiled: %s");
  FOutputDevice::Logf((int)GLog, 762, (int)"Command line: %s");
  appBaseDir();
  FOutputDevice::Logf((int)GLog, 762, (int)"Base directory: %s");
  FOutputDevice::Logf((int)GLog, 762, (int)"Character set: %s");
  GIsStrict = ParseParam((int)byte_101E3D60, "STRICT");
  v36 = 0;
  LOBYTE(v38) = 2;
  v35 = (int)"System.ini";
  v36 = (unsigned int)(appStrlen("System.ini") + 1) & 0x1FFFFFFF | 0x20000000;
  v34 = 0;
  LOBYTE(v38) = 4;
  v33 = (int)"User.ini";
  v34 = (unsigned int)(appStrlen("User.ini") + 1) & 0x1FFFFFFF | 0x20000000;
  LOBYTE(v38) = 5;
  Parse(byte_101E3D60, "INI=", (int)&v35);
  Parse(byte_101E3D60, "USERINI=", (int)&v33);
  GIsUTracing = ParseParam((int)byte_101E3D60, "UTRACE");
  v21 = a6();
  v22 = (const CHAR *)v33;
  v23 = (signed int)(8 * v34) >> 3;
  v24 = v21;
  GConfig = v21;
  if ( !v23 )
    v22 = &Directory;
  v25 = (const CHAR *)v35;
  if ( !(v36 & 0x1FFFFFFF) )
    v25 = &Directory;
  (*(void (__stdcall **)(const CHAR *, const CHAR *, int))(*(_DWORD *)v24 + 68))(v25, v22, a7);
  if ( (*(int (__stdcall **)(_DWORD, _DWORD, char *, signed int, _DWORD))(*(_DWORD *)GConfig + 16))(
         "Engine.Engine",
         "Language",
         &Str1,
         256,
         0)
    && appStricmp(&Str1, "multi") )
    UObject::SetLanguage(&Str1);
  if ( !Parse(byte_101E3D60, "PROFILINGSTACKDEPTH=", &GMaxScriptProfilingStackDepth) )
    GMaxScriptProfilingStackDepth = 1000000;
  UObject::StaticInit();
  FMemStack::Init((int)&GMem, 65536);
  GFileStream = FFileStream::Init(16);
  sub_10171110(v26);
  if ( ParseParam((int)byte_101E3D60, "nolinear") )
  {
    *(_DWORD *)(GSys + 104) = 0;
    *(_DWORD *)(GSys + 100) = 0;
  }
  v27 = (void *)(*(int (__stdcall **)(signed int))(*(_DWORD *)GMalloc + 4))(4);
  LOBYTE(v38) = 6;
  if ( v27 )
    result = (int)FCriticalSection::FCriticalSection(v27);
  else
    result = 0;
  gethostbyname_mutex = result;
  LOBYTE(v38) = 3;
  if ( !(v34 & 0x20000000) )
  {
    for ( l = 0; l < v23; ++l )
      ;
    result = v33;
    if ( v33 )
      result = (*(int (__stdcall **)(int))(*(_DWORD *)GMalloc + 12))(v33);
  }
  LOBYTE(v38) = 0;
  if ( !(v36 & 0x20000000) )
  {
    for ( m = 0; m < (signed int)(8 * v36) >> 3; ++m )
      ;
    result = v35;
    if ( v35 )
      result = (*(int (__stdcall **)(int))(*(_DWORD *)GMalloc + 12))(v35);
  }
  return result;
}
// 101BA3A0: using guessed type int (__stdcall **GLog)(int, int);
// 101BA3A4: using guessed type int (__stdcall *(*GError)[2])(int, int);
// 101BB5E8: using guessed type void *GMalloc;
// 101BB5F0: using guessed type void *GFileManager;
// 101BC8A8: using guessed type int GWarn;
// 101BC8AC: using guessed type int GConfig;
// 101BC8BC: using guessed type int GSys;
// 101BDA20: using guessed type int GIsStrict;
// 101BDA2C: using guessed type int GFileStream;
// 101BDA50: using guessed type int GIsUTracing;
// 101BDA80: using guessed type int GOutputPath;
// 101BDA84: using guessed type int dword_101BDA84;
// 101BDAF0: using guessed type int GBuildLabel;
// 101BDAF4: using guessed type int dword_101BDAF4;
// 101E3940: using guessed type unsigned __int32 *GCRCTable;
// 101E3D40: using guessed type int gethostbyname_mutex;