Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int __thiscall ReadResearches(int this, int hDatFile, int a3)
- {
- int _this; // [sp+0h] [bp-14h]@1
- signed __int16 RequiredTechsSize; // [sp+4h] [bp-10h]@4
- signed __int16 j; // [sp+8h] [bp-Ch]@6
- __int16 k; // [sp+8h] [bp-Ch]@9
- __int16 NameLength; // [sp+Ch] [bp-8h]@18
- __int16 i; // [sp+10h] [bp-4h]@2
- _this = this;
- *(_DWORD *)(this + 8) = a3;
- ReadData((HANDLE)hDatFile, (LPVOID)(this + 4), 2u);// Researchs
- if ( (signed int)*(_WORD *)(_this + 4) <= 0 )
- {
- *(_DWORD *)_this = 0;
- *(_WORD *)(_this + 4) = 0;
- }
- else
- {
- *(_DWORD *)_this = calloc(68u, *(_WORD *)(_this + 4));
- for ( i = 0; i < (signed int)*(_WORD *)(_this + 4); ++i )
- {
- RequiredTechsSize = 6;
- if ( DatVersion < 9.7200003 )
- RequiredTechsSize = 4;
- for ( j = 0; j < RequiredTechsSize; ++j )
- ReadData((HANDLE)hDatFile, (LPVOID)(68 * i + *(_DWORD *)_this + 2 * j + 4), 2u);// RequiredTechs
- for ( k = 0; k < 3; ++k )
- {
- ReadData((HANDLE)hDatFile, (LPVOID)(68 * i + *(_DWORD *)_this + 2 * k + 22), 2u);// Type
- ReadData((HANDLE)hDatFile, (LPVOID)(68 * i + *(_DWORD *)_this + 2 * k + 28), 2u);// Amount
- ReadData((HANDLE)hDatFile, (LPVOID)(68 * i + *(_DWORD *)_this + k + 34), 1u);// Enabled
- }
- ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 16), 2u);// RequiredTechCount
- if ( DatVersion < 10.22 )
- *(_WORD *)(*(_DWORD *)_this + 68 * i + 18) = -1;
- else
- ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 18), 2u);// Civ
- if ( DatVersion < 10.77 )
- *(_WORD *)(*(_DWORD *)_this + 68 * i + 20) = 0;
- else
- ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 20), 2u);// FullTechMode
- ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 48), 2u);// ResearchLocation
- ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 50), 2u);// LanguageDLLName
- ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 52), 2u);// LanguageDLLDescription
- ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 38), 2u);// ResearchTime
- ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 40), 2u);// TechageID
- ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 42), 2u);// Type
- ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 44), 2u);// IconID
- ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 46), 1u);// ButtonID
- ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 56), 4u);// LanguageDLLHelp
- ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 60), 4u);// LanguageDLLName2
- ReadData((HANDLE)hDatFile, (LPVOID)(*(_DWORD *)_this + 68 * i + 64), 4u);// Unknown1
- ReadData((HANDLE)hDatFile, &NameLength, 2u);// NameLength
- if ( NameLength <= 0 )
- {
- *(_DWORD *)(*(_DWORD *)_this + 68 * i) = 0;
- }
- else
- {
- *(_DWORD *)(*(_DWORD *)_this + 68 * i) = calloc(1u, NameLength);
- ReadData((HANDLE)hDatFile, *(LPVOID *)(*(_DWORD *)_this + 68 * i), NameLength);// Name
- }
- }
- }
- return _this;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement