Advertisement
sv_iridescence

iw6 dedi createconsole

Jan 18th, 2022
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.58 KB | None | 0 0
  1. void __fastcall Sys_CreateConsole(HINSTANCE__ *hInstance)
  2. {
  3.   const char *CommandLine; // rax
  4.   HICON__ *CursorA; // rax
  5.   HWND DesktopWindow; // rax
  6.   HDC DC; // rbx
  7.   int DeviceCaps; // esi
  8.   int v7; // edi
  9.   HWND v8; // rax
  10.   HWND__ *Window; // rax
  11.   HDC v10; // rbx
  12.   int v11; // eax
  13.   int v12; // eax
  14.   HANDLE ImageA; // rbx
  15.   tagRECT Rect; // [rsp+70h] [rbp-19h] BYREF
  16.   WNDCLASSA WndClass; // [rsp+80h] [rbp-9h] BYREF
  17.  
  18.   CommandLine = Com_GetCommandLine();
  19.   if ( I_stristr(CommandLine, "+nowindow") )
  20.   {
  21.     s_suppressConsoleWindow = 1;
  22.   }
  23.   else
  24.   {
  25.     *(&WndClass.style + 1) = 0;
  26.     WndClass.style = 0;
  27.     *(_QWORD *)&WndClass.cbClsExtra = 0i64;
  28.     WndClass.lpfnWndProc = ConWndProc;
  29.     WndClass.hInstance = hInstance;
  30.     WndClass.hIcon = LoadIconA(hInstance, (LPCSTR)2);
  31.     CursorA = LoadCursorA(0i64, (LPCSTR)0x7F00);
  32.     *(__m128i *)&WndClass.hbrBackground = _mm_load_si128((const __m128i *)&_xmm);
  33.     WndClass.hCursor = CursorA;
  34.     WndClass.lpszClassName = "IW6 WinConsole";
  35.     if ( RegisterClassA(&WndClass) )
  36.     {
  37.       *(_QWORD *)&Rect.left = 0i64;
  38.       Rect.right = 620;
  39.       Rect.bottom = 450;
  40.       AdjustWindowRect(&Rect, 0x80CA0000, 0);
  41.       DesktopWindow = GetDesktopWindow();
  42.       DC = GetDC(DesktopWindow);
  43.       DeviceCaps = GetDeviceCaps(DC, 8);
  44.       v7 = GetDeviceCaps(DC, 10);
  45.       v8 = GetDesktopWindow();
  46.       ReleaseDC(v8, DC);
  47.       s_wcd.windowHeight = Rect.bottom - Rect.top + 1;
  48.       s_wcd.windowWidth = Rect.right - Rect.left + 1;
  49.       *(_QWORD *)&s_wcd.consoleHistoryPos = 0i64;
  50.       Window = CreateWindowExA(
  51.                  0,
  52.                  "IW6 WinConsole",
  53.                  "IW6 Console",
  54.                  0x80CA0000,
  55.                  (DeviceCaps - 600) / 2,
  56.                  (v7 - 450) / 2,
  57.                  Rect.right - Rect.left + 1,
  58.                  Rect.bottom - Rect.top + 1,
  59.                  0i64,
  60.                  0i64,
  61.                  hInstance,
  62.                  0i64);
  63.       s_wcd.hWnd = Window;
  64.       if ( Window )
  65.       {
  66.         v10 = GetDC(Window);
  67.         v11 = GetDeviceCaps(v10, 90);
  68.         v12 = MulDiv(8, v11, 72);
  69.         s_wcd.hfBufferFont = CreateFontA(-v12, 0, 0, 0, 300, 0, 0, 0, 1u, 0, 0, 0, 0x31u, "Courier New");
  70.         ReleaseDC(s_wcd.hWnd, v10);
  71.         ImageA = LoadImageA(0i64, "logo.bmp", 0, 0, 0, 0x10u);
  72.         if ( ImageA )
  73.         {
  74.           s_wcd.codLogo = CreateWindowExA(
  75.                             0,
  76.                             "Static",
  77.                             0i64,
  78.                             0x5000000Eu,
  79.                             5,
  80.                             5,
  81.                             0,
  82.                             0,
  83.                             s_wcd.hWnd,
  84.                             (HMENU)1,
  85.                             hInstance,
  86.                             0i64);
  87.           SendMessageA(s_wcd.codLogo, 0x172u, 0i64, (LPARAM)ImageA);
  88.         }
  89.         s_wcd.hwndInputLine = CreateWindowExA(
  90.                                 0,
  91.                                 "edit",
  92.                                 0i64,
  93.                                 0x50800080u,
  94.                                 6,
  95.                                 400,
  96.                                 608,
  97.                                 20,
  98.                                 s_wcd.hWnd,
  99.                                 (HMENU)0x65,
  100.                                 hInstance,
  101.                                 0i64);
  102.         s_wcd.hwndBuffer = CreateWindowExA(
  103.                              0,
  104.                              "edit",
  105.                              0i64,
  106.                              0x50A00844u,
  107.                              6,
  108.                              70,
  109.                              606,
  110.                              324,
  111.                              s_wcd.hWnd,
  112.                              (HMENU)0x64,
  113.                              hInstance,
  114.                              0i64);
  115.         SendMessageA(s_wcd.hwndBuffer, 0x30u, (WPARAM)s_wcd.hfBufferFont, 0i64);
  116.         SendMessageA(s_wcd.hwndBuffer, 0xC5u, 0x8000ui64, 0i64);
  117.         s_wcd.SysInputLineWndProc = (__int64 (__fastcall *)(HWND__ *, unsigned int, unsigned __int64, __int64))SetWindowLongPtrA(s_wcd.hwndInputLine, -4, (LONG_PTR)InputLineWndProc);
  118.         SendMessageA(s_wcd.hwndInputLine, 0x30u, (WPARAM)s_wcd.hfBufferFont, 0i64);
  119.         SetFocus(s_wcd.hwndInputLine);
  120.         s_wcd.buffer[0] = 0;
  121.         s_wcd.cleanBuffer[0] = 0;
  122.         SetWindowTextA(s_wcd.hwndBuffer, s_wcd.cleanBuffer);
  123.         s_wcd.bufferLen = 0i64;
  124.         InitializeCriticalSection(&s_wcd.critSect);
  125.       }
  126.     }
  127.   }
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement