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

SWRepublicCommando.exe

From SWRC Wiki
Revision as of 06:07, 21 November 2017 by Plasma (talk | contribs) (Created page with "<source lang="cpp" line"> //----- (10908690) -------------------------------------------------------- int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
//----- (10908690) --------------------------------------------------------
int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
  LPSTR v4; // esi@1
  const char *v5; // eax@1
  char v6[4]; // ecx@2
  HWND v7; // edi@15
  bool v8; // zf@18
  CHAR v9; // al@19
  const char *v10; // eax@25
  const char *v11; // eax@25
  const char *v12; // eax@26
  int v13; // eax@26
  const char v14; // al@28
  int result; // eax@33
  const char *v16; // eax@35
  int v17; // ebx@35
  int v18; // eax@35
  int v19; // eax@35
  int v20; // eax@35
  int v21; // eax@35
  const char *v22; // eax@37
  const char *v23; // eax@38
  const char *v24; // eax@39
  int v25; // eax@40
  int v26; // edx@45
  int v27; // ecx@45
  HINSTANCE v28; // esi@45
  const char *v29; // eax@48
  HWND v30; // eax@49
  const char *v31; // eax@50
  int v32; // edx@51
  int v33; // edx@51
  signed int v34; // esi@52
  const char *v35; // eax@52
  const char *v36; // eax@54
  const char *v37; // eax@56
  const char *v38; // eax@58
  const char *v39; // eax@60
  const char *v40; // eax@62
  const char *v41; // eax@64
  const char *v42; // eax@66
  int v43; // eax@69
  int v44; // edx@69
  int v45; // eax@69
  int v46; // edx@69
  int v47; // ebx@70
  const char *v48; // eax@71
  const char *v49; // eax@71
  int v50; // eax@72
  int v51; // ecx@74
  char *v52; // edi@76
  int v53; // esi@78
  int v54; // eax@78
  int v55; // edx@78
  int v56; // eax@82
  int v57; // edx@84
  HWND v58; // eax@84
  const char *v59; // eax@84
  int v60; // eax@85
  int v61; // [sp-8h] [bp-1A4h]@46
  signed int v62; // [sp-4h] [bp-1A0h]@51
  int v63; // [sp+0h] [bp-19Ch]@1
  const CHAR szClass; // [sp+Ch] [bp-190h]@15
  char Dest; // [sp+10Ch] [bp-90h]@1
  char v66; // [sp+140h] [bp-5Ch]@35
  char v67; // [sp+148h] [bp-54h]@35
  char v68; // [sp+150h] [bp-4Ch]@45
  LPARAM lParam; // [sp+154h] [bp-48h]@33
  int v70; // [sp+158h] [bp-44h]@33
  LPSTR v71; // [sp+15Ch] [bp-40h]@33
  int v72; // [sp+160h] [bp-3Ch]@41
  int v73; // [sp+164h] [bp-38h]@1
  char v74; // [sp+168h] [bp-34h]@35
  int v75; // [sp+170h] [bp-2Ch]@37
  char v76; // [sp+174h] [bp-28h]@71
  int v77; // [sp+178h] [bp-24h]@37
  char v78; // [sp+17Ch] [bp-20h]@52
  char v79; // [sp+184h] [bp-18h]@52
  int *v80; // [sp+18Ch] [bp-10h]@1
  int v81; // [sp+198h] [bp-4h]@18

  v80 = &v63;
  strncpy(&Dest, "752F41D039DB4507A84B40488E76721E 0123456789ABCDEIPA", 0x33u);
  GIsStarted = 1;
  v73 = 0;
  ::hInstance = hInstance;
  v4 = GetCommandLineA();
  v5 = appPackage();
  appStrcpy("Launch", v5);
  switch ( (unsigned __int8)GetUserDefaultLCID() )
  {
    case 9u:
      *(_DWORD *)v6 = "int";
      goto LABEL_11;
    case 0x11u:
      *(_DWORD *)v6 = "jpt";
      goto LABEL_11;
    case 7u:
      *(_DWORD *)v6 = "det";
      goto LABEL_11;
    case 0xCu:
      *(_DWORD *)v6 = "frt";
      goto LABEL_11;
    case 0xAu:
      *(_DWORD *)v6 = "est";
      goto LABEL_11;
    case 0x10u:
      *(_DWORD *)v6 = "itt";
      goto LABEL_11;
    case 0x12u:
      *(_DWORD *)v6 = "krt";
      goto LABEL_11;
    case 4u:
      *(_DWORD *)v6 = "cht";
      goto LABEL_11;
    case 0x16u:
      *(_DWORD *)v6 = "prt";
LABEL_11:
      UObject::SetLanguage(*(_DWORD *)v6);
      break;
    default:
      break;
  }
  if ( appStrfind(v4, "NewWindow")
    || appStrfind(v4, "changevideo")
    || appStrfind(v4, "TestRenDev")
    || (sub_10901240((char *)&szClass, (int)"WLog"), (v7 = FindWindowExA(0, 0, &szClass, 0)) == 0) )
  {
LABEL_18:
    GIsGuarded = 1;
    GIsClient = 1;
    v8 = *v4 == 34;
    v81 = 0;
    if ( !v8 )
      goto LABEL_22;
    while ( 1 )
    {
      v9 = (v4++)[1];
      if ( !v9 )
        break;
      if ( v9 == 34 )
      {
        while ( 1 )
        {
          ++v4;
LABEL_22:
          if ( !*v4 )
            goto LABEL_25;
          if ( *v4 == 32 )
          {
            ++v4;
            goto LABEL_25;
          }
        }
      }
    }
LABEL_25:
    appInit("Launch", v4, &dword_10954928, &dword_1095491C, &unk_109548F0, sub_10908630, 1);
    GIsServer = 1;
    v10 = appCmdLine();
    GIsClient = ParseParam(v10, "SERVER") == 0;
    GIsEditor = 0;
    GIsScriptable = 1;
    v11 = appCmdLine();
    GUseFrontEnd = ParseParam(v11, "NOUI") == 0;
    if ( !GIsClient || (v12 = appCmdLine(), (v13 = ParseParam(v12, "LAZY")) != 0) )
      v13 = 1;
    GLazyLoad = v13;
    v16 = appCmdLine();
    v17 = ParseParam(v16, "LOG");
    v18 = FString::FString(&v70, "..\\Help");
    LOBYTE(v81) = 1;
    v19 = FString::operator_(v18, &v66, "Launch");
    LOBYTE(v81) = 2;
    v20 = FString::operator_(v19, &v67, "Logo.bmp");
    LOBYTE(v81) = 3;
    TArray<char>::TArray<char>(&v74, v20, 0);
    LOBYTE(v81) = 7;
    FStringTemp::_FStringTemp(&v67);
    LOBYTE(v81) = 6;
    FStringTemp::_FStringTemp(&v66);
    LOBYTE(v81) = 5;
    FString::_FString(&v70);
    v21 = FString::operator_(&v74);
    if ( (*(int (__stdcall **)(int))(*(_DWORD *)GFileManager + 12))(v21) < 0 )
      FString::operator_(&v74, "..\\Help\\Logo.bmp");
    v22 = appPackage();
    appStrcpy("Launch", v22);
    v77 = 0;
    v75 = 0;
    hInstance = 0;
    if ( !v17 )
    {
      v23 = appCmdLine();
      if ( !ParseParam(v23, "server") )
      {
        v24 = appCmdLine();
        if ( !appStrfind(v24, "TestRenDev") )
        {
          v25 = FString::operator_(&v74);
          sub_109012E0(v25, (int)&v77, (int)&v75, (int)&hInstance);
        }
      }
    }
    v72 = 0;
    (*(void (__stdcall **)(_DWORD, _DWORD, int *, _DWORD))(*(_DWORD *)GConfig + 4))("FirstRun", "FirstRun", &v72, 0);
    if ( GIsClient )
      sub_109040B0(v77, v75, (signed int)hInstance);
    if ( GIsRequestingExit )
    {
      sub_10901460();
      appPreExit();
      appExit();
      LOBYTE(v81) = 0;
      FString::_FString(&v74);
      return 0;
    }
    InitWindowing();
    GameSpyCDKeyResponseInterface::GameSpyCDKeyResponseInterface(&v68);
    v26 = *(_DWORD *)GMalloc;
    LOBYTE(v81) = 8;
    v28 = (HINSTANCE)(*(int (__stdcall **)(signed int))(v26 + 4))(436);
    hInstance = v28;
    LOBYTE(v81) = 9;
    if ( v28 )
    {
      v77 = (int)&v61;
      FName::FName(&v61, "GameLog", 1, v27, 0);
      WLog::WLog(v28, &byte_10954930, &dword_1095492C);
      *(_DWORD *)v28 = &off_10944D38;
    }
    else
    {
      v28 = 0;
    }
    GLogWindow = v28;
    LOBYTE(v81) = 8;
    WLog::OpenWindow(GLogWindow, v17, 0);
    v29 = LocalizeGeneral("Start", "Launch", 0);
    FOutputDevice::Log((char *)GLogWindow + 56, 788, v29);
    if ( GIsClient )
    {
      v30 = (HWND)WWindow::operator HWND____(GLogWindow);
      SetPropA(v30, "IsBrowser", HANDLE_FLAG_INHERIT);
    }
    v31 = appCmdLine();
    GIsBenchmarking = ParseParam(v31, "BENCHMARK");
    if ( GIsBenchmarking )
    {
      v32 = *(_DWORD *)GConfig;
      v62 = (signed int)"System.ini";
      (*(void (__stdcall **)(_DWORD))(v32 + 64))("System.ini");
      v33 = *(_DWORD *)GConfig;
      v62 = (signed int)"User.ini";
      (*(void (__stdcall **)(_DWORD))(v33 + 64))("User.ini");
    }
    FString::FString(&v79);
    LOBYTE(v81) = 10;
    FString::FString(&v78);
    LOBYTE(v81) = 11;
    v34 = 0;
    v35 = appCmdLine();
    if ( ParseParam(v35, "320x240") )
    {
      FString::operator_(&v79, "320");
      FString::operator_(&v78, "240");
      v34 = 1;
    }
    v36 = appCmdLine();
    if ( ParseParam(v36, "512x384") )
    {
      FString::operator_(&v79, "512");
      FString::operator_(&v78, "384");
      v34 = 1;
    }
    v37 = appCmdLine();
    if ( ParseParam(v37, "640x480") )
    {
      FString::operator_(&v79, "640");
      FString::operator_(&v78, "480");
      v34 = 1;
    }
    v38 = appCmdLine();
    if ( ParseParam(v38, "800x600") )
    {
      FString::operator_(&v79, "800");
      FString::operator_(&v78, "600");
      v34 = 1;
    }
    v39 = appCmdLine();
    if ( ParseParam(v39, "1024x768") )
    {
      FString::operator_(&v79, "1024");
      FString::operator_(&v78, "768");
      v34 = 1;
    }
    v40 = appCmdLine();
    if ( ParseParam(v40, "1280x960") )
    {
      FString::operator_(&v79, "1280");
      FString::operator_(&v78, "960");
      v34 = 1;
    }
    v41 = appCmdLine();
    if ( ParseParam(v41, "1280x1024") )
    {
      FString::operator_(&v79, "1280");
      FString::operator_(&v78, "1024");
      v34 = 1;
    }
    v42 = appCmdLine();
    if ( ParseParam(v42, "1600x1200") )
    {
      FString::operator_(&v79, "1600");
      FString::operator_(&v78, "1200");
    }
    else
    {
      if ( !v34 )
      {
LABEL_70:
        v47 = (int)sub_10903880();
        if ( v47 )
        {
          v48 = LocalizeGeneral("Run", "Launch", 0);
          FOutputDevice::Log((char *)GLogWindow + 56, 788, v48);
          sub_10901460();
          FString::FString(&v76);
          LOBYTE(v81) = 12;
          v49 = appCmdLine();
          if ( Parse(v49, "EXEC=", &v76) )
          {
            v50 = *(_DWORD *)(v47 + 72);
            if ( v50 )
            {
              if ( *(_DWORD *)(v50 + 48) & 0x1FFFFFFF )
              {
                v51 = **(_DWORD **)(v50 + 44);
                if ( v51 )
                {
                  if ( GLogWindow )
                    v52 = (char *)GLogWindow + 56;
                  else
                    v52 = 0;
                  v53 = v51 + 44;
                  v54 = FString::operator_(&v76);
                  v55 = *(_DWORD *)v53;
                  v62 = (signed int)v52;
                  v61 = v54;
                  (*(void (__thiscall **)(int, int, char *))v55)(v53, v54, v52);
                }
              }
            }
          }
          if ( !GIsRequestingExit )
            sub_10906DC0(v47);
          LOBYTE(v81) = 11;
          FString::_FString(&v76);
        }
        v56 = *(_DWORD *)(v47 + 76);
        if ( v56 )
          (*(void (**)(void))(*(_DWORD *)v56 + 144))();
        v57 = *(_DWORD *)GFileManager;
        v62 = 0;
        v61 = 0;
        (*(void (__stdcall **)(_DWORD, _DWORD, _DWORD))(v57 + 16))("Running.ini", 0, 0);
        v58 = (HWND)WWindow::operator HWND____(GLogWindow);
        RemovePropA(v58, "IsBrowser");
        v59 = LocalizeGeneral("Exit", "Launch", 0);
        FOutputDevice::Log((char *)GLogWindow + 56, 788, v59);
        if ( GLogWindow )
        {
          v60 = *(_DWORD *)GLogWindow;
          v62 = 1;
          (*(void (__stdcall **)(signed int))(v60 + 4))(1);
        }
        appPreExit();
        GIsGuarded = 0;
        LOBYTE(v81) = 10;
        FString::_FString(&v78);
        LOBYTE(v81) = 8;
        FString::_FString(&v79);
        LOBYTE(v81) = 5;
        CDKeyResponseInterface::_CDKeyResponseInterface(&v68);
        LOBYTE(v81) = 0;
        FString::_FString(&v74);
        v81 = -1;
        appExit();
        result = v73;
        goto LABEL_87;
      }
    }
    v43 = FString::operator_(&v79);
    v44 = *(_DWORD *)GConfig;
    v62 = 0;
    v61 = v43;
    (*(void (__stdcall **)(_DWORD, _DWORD, int, _DWORD))(v44 + 48))(
      "WinDrv.WindowsClient",
      "FullscreenViewportX",
      v43,
      0);
    v45 = FString::operator_(&v78);
    v46 = *(_DWORD *)GConfig;
    v62 = 0;
    v61 = v45;
    (*(void (__stdcall **)(_DWORD, _DWORD, int, _DWORD))(v46 + 48))(
      "WinDrv.WindowsClient",
      "FullscreenViewportY",
      v45,
      0);
    goto LABEL_70;
  }
  while ( !GetPropA(v7, "IsBrowser") )
  {
    v7 = FindWindowExA(v7, 0, &szClass, 0);
    if ( !v7 )
      goto LABEL_18;
  }
  v14 = *v4;
  if ( *v4 )
  {
    while ( v14 != 32 )
    {
      v14 = (v4++)[1];
      if ( !v14 )
        goto LABEL_31;
    }
    goto LABEL_32;
  }
LABEL_31:
  if ( *v4 == 32 )
LABEL_32:
    ++v4;
  lParam = WindowMessageOpen;
  v70 = 4 * appStrlen(v4) + 4;
  v71 = v4;
  SendMessageTimeoutA(v7, 0x4Au, 0, (LPARAM)&lParam, 3u, 0x7530u, (PDWORD_PTR)&hInstance);
  result = 0;
LABEL_87:
  GIsStarted = 0;
  return result;
}
// 10908630: using guessed type int sub_10908630();
// 1090BC36: using guessed type int __thiscall GameSpyCDKeyResponseInterface__GameSpyCDKeyResponseInterface(_DWORD);
// 10943018: using guessed type const char *__fastcall appPackage();
// 1094301C: using guessed type char *__fastcall appStrcpy(char *, const char *);
// 10943024: using guessed type int __fastcall appStrlen(const char *);
// 10943028: using guessed type int __thiscall FString___FString(_DWORD);
// 1094302C: using guessed type int __thiscall FString__FString(_DWORD);
// 10943030: using guessed type const char *__fastcall LocalizeGeneral(const char *, const char *, const char *);
// 10943038: using guessed type int __thiscall FStringTemp___FStringTemp(_DWORD);
// 1094303C: using guessed type void *GFileManager;
// 10943040: using guessed type int __thiscall FString__operator_(_DWORD, _DWORD, _DWORD);
// 10943044: using guessed type int __thiscall FString__FString(_DWORD, _DWORD);
// 10943060: using guessed type int GIsRequestingExit;
// 1094308C: using guessed type int GIsGuarded;
// 109430B8: using guessed type int __thiscall FOutputDevice__Log(_DWORD, _DWORD, _DWORD);
// 109430E0: using guessed type int GIsStarted;
// 109430E4: using guessed type int __thiscall UObject__SetLanguage(_DWORD);
// 109430E8: using guessed type int __fastcall appInit(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 109430EC: using guessed type int GIsServer;
// 109430F0: using guessed type int GIsScriptable;
// 109430F4: using guessed type int GUseFrontEnd;
// 109430F8: using guessed type int GLazyLoad;
// 109430FC: using guessed type int GIsEditor;
// 10943100: using guessed type int GIsClient;
// 10943104: using guessed type int __thiscall FString__operator_(_DWORD);
// 10943108: using guessed type void *GMalloc;
// 10943114: using guessed type void __fastcall appPreExit();
// 10943118: using guessed type void __fastcall appExit();
// 10943124: using guessed type int __thiscall FString__operator_(_DWORD, _DWORD, _DWORD);
// 1094316C: using guessed type int GIsBenchmarking;
// 10943194: using guessed type int __thiscall FName__FName(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD);
// 109431CC: using guessed type int __thiscall TArray_char___TArray_char_(_DWORD, _DWORD, _DWORD);
// 109431EC: using guessed type const char *__fastcall appCmdLine();
// 109431F0: using guessed type int __fastcall ParseParam(const char *, const char *);
// 109431F4: using guessed type int __fastcall Parse(_DWORD, _DWORD, _DWORD);
// 10943200: using guessed type const char *__fastcall appStrfind(const char *, const char *);
// 10943218: using guessed type void *GConfig;
// 10943228: using guessed type int __thiscall FString__operator_(_DWORD, _DWORD);
// 10943260: using guessed type int __thiscall CDKeyResponseInterface___CDKeyResponseInterface(_DWORD);
// 10943450: using guessed type int __thiscall WWindow__operator HWND__ _(_DWORD);
// 109435EC: using guessed type unsigned int WindowMessageOpen;
// 109435F0: using guessed type void __fastcall InitWindowing();
// 109435F4: using guessed type int __thiscall WLog__WLog(_DWORD, _DWORD, _DWORD);
// 109435F8: using guessed type int __thiscall WLog__OpenWindow(_DWORD, _DWORD, _DWORD);
// 10943644: using guessed type void *GLogWindow;
// 10944D38: using guessed type int (*off_10944D38)();
// 1095491C: using guessed type int dword_1095491C;
// 10954928: using guessed type int dword_10954928;
// 1095492C: using guessed type int dword_1095492C;
// 10954930: using guessed type char byte_10954930;