Advertisement
Guest User

Untitled

a guest
Nov 24th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.17 KB | None | 0 0
  1. int __thiscall ReadResearches(int this, int hDatFile, int a3)
  2. {
  3.   int _this; // [sp+0h] [bp-14h]@1
  4.   signed __int16 RequiredTechsSize; // [sp+4h] [bp-10h]@4
  5.   signed __int16 j; // [sp+8h] [bp-Ch]@6
  6.   __int16 k; // [sp+8h] [bp-Ch]@9
  7.   __int16 NameLength; // [sp+Ch] [bp-8h]@18
  8.   __int16 i; // [sp+10h] [bp-4h]@2
  9.  
  10.   _this = this;
  11.   *(_DWORD *)(this + 8) = a3;
  12.   ReadData((HANDLE)hDatFile, (LPVOID)(this + 4), 2u);// Researchs
  13.   if ( (signed int)*(_WORD *)(_this + 4) <= 0 )
  14.   {
  15.     *(_DWORD *)_this = 0;
  16.     *(_WORD *)(_this + 4) = 0;
  17.   }
  18.   else
  19.   {
  20.     *(_DWORD *)_this = calloc(68u, *(_WORD *)(_this + 4));
  21.     for ( i = 0; i < (signed int)*(_WORD *)(_this + 4); ++i )
  22.     {
  23.       RequiredTechsSize = 6;
  24.       if ( DatVersion < 9.7200003 )
  25.         RequiredTechsSize = 4;
  26.       for ( j = 0; j < RequiredTechsSize; ++j )
  27.         ReadData((HANDLE)hDatFile, (LPVOID)(68 * i + *(_DWORD *)_this + 2 * j + 4), 2u);// RequiredTechs
  28.       for ( k = 0; k < 3; ++k )
  29.       {
  30.         ReadData((HANDLE)hDatFile, (LPVOID)(68 * i + *(_DWORD *)_this + 2 * k + 22), 2u);// Type
  31.         ReadData((HANDLE)hDatFile, (LPVOID)(68 * i + *(_DWORD *)_this + 2 * k + 28), 2u);// Amount
  32.         ReadData((HANDLE)hDatFile, (LPVOID)(68 * i + *(_DWORD *)_this + k + 34), 1u);// Enabled
  33.       }
  34.       ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 16), 2u);// RequiredTechCount
  35.       if ( DatVersion < 10.22 )
  36.         *(_WORD *)(*(_DWORD *)_this + 68 * i + 18) = -1;
  37.       else
  38.         ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 18), 2u);// Civ
  39.       if ( DatVersion < 10.77 )
  40.         *(_WORD *)(*(_DWORD *)_this + 68 * i + 20) = 0;
  41.       else
  42.         ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 20), 2u);// FullTechMode
  43.       ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 48), 2u);// ResearchLocation
  44.       ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 50), 2u);// LanguageDLLName
  45.       ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 52), 2u);// LanguageDLLDescription
  46.       ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 38), 2u);// ResearchTime
  47.       ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 40), 2u);// TechageID
  48.       ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 42), 2u);// Type
  49.       ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 44), 2u);// IconID
  50.       ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 46), 1u);// ButtonID
  51.       ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 56), 4u);// LanguageDLLHelp
  52.       ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 60), 4u);// LanguageDLLName2
  53.       ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 64), 4u);// Unknown1
  54.       ReadData((HANDLE)hDatFile, &NameLength, 2u);// NameLength
  55.       if ( NameLength <= 0 )
  56.       {
  57.         *(_DWORD *)(*(_DWORD *)_this + 68 * i) = 0;
  58.       }
  59.       else
  60.       {
  61.         *(_DWORD *)(*(_DWORD *)_this + 68 * i) = calloc(1u, NameLength);
  62.         ReadData((HANDLE)hDatFile, *(LPVOID *)(*(_DWORD *)_this + 68 * i), NameLength);// Name
  63.       }
  64.     }
  65.   }
  66.   return _this;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement