Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void __cdecl createListOfFilesFromImgArchive(const char *filepath, int ImgDescriptorNum)
- {
- FILE *file1; // eax@1
- signed int v3; // ebp@1
- FILE *file2; // esi@1
- char *v5; // edi@5
- int v6; // eax@11
- int v7; // eax@13
- int v8; // eax@15
- int v9; // eax@19
- int v10; // eax@33
- WORD v11; // cx@33
- char v12; // zf@33
- int v13; // eax@35
- int pIndex; // [sp+0h] [bp-3Ch]@8
- int AmountOfFiles; // [sp+4h] [bp-38h]@2
- FILE *file3; // [sp+8h] [bp-34h]@1
- int p_Size; // [sp+Ch] [bp-30h]@32
- int p_Position; // [sp+10h] [bp-2Ch]@32
- char Version; // [sp+14h] [bp-28h]@2
- int v20; // [sp+15h] [bp-27h]@2
- CDirectoryEntry Entry; // [sp+1Ch] [bp-20h]@3
- v3 = -1;
- file1 = CFileMgr__Open(filepath, "rb");
- file2 = file1;
- file3 = file1;
- if ( (signed int)file1 > 0 )
- {
- Version = 0;
- v20 = 0;
- CFileMgr__Read(file1, &Version, 4u);
- CFileMgr__Read(file2, &AmountOfFiles, 4u);
- for ( ; AmountOfFiles; file2 = file3 )
- {
- --AmountOfFiles;
- CFileMgr__Read(file2, &Entry, 32u);
- if ( Entry.SizeSecondPriority > dword_8E4CA8 )
- dword_8E4CA8 = Entry.SizeSecondPriority;
- Entry.Name[23] = 0;
- v5 = strchr(Entry.Name, '.');
- if ( !v5 || (signed int)(v5 - Entry.Name) > 20 )
- {
- Entry.Name[23] = 0;
- goto LABEL_39;
- }
- *v5 = 0;
- if ( memicmp(v5 + 1, "DFF", 3) )
- {
- if ( memicmp(v5 + 1, "TXD", 3) )
- {
- if ( memicmp(v5 + 1, "COL", 3) )
- {
- if ( memicmp(v5 + 1, "IPL", 3) )
- {
- if ( memicmp(v5 + 1, "DAT", 3) )
- {
- if ( memicmp(v5 + 1, "IFP", 3) )
- {
- if ( memicmp(v5 + 1, "RRR", 3) )
- {
- if ( memicmp(v5 + 1, "SCM", 3) )
- {
- *v5 = '.';
- goto LABEL_39;
- }
- v7 = CExternalScripts__allocate(&externalScripts, Entry.Name) + 26230;
- pIndex = v7;
- }
- else
- {
- v7 = addPath(Entry.Name) + 25755;
- pIndex = v7;
- }
- }
- else
- {
- v7 = CAnimMgr__getIfpIndexByNameAlways(Entry.Name) + 25575;
- pIndex = v7;
- }
- }
- else
- {
- sscanf(&Entry.Name[5], "%d", &pIndex);
- v7 = pIndex + 25511;
- pIndex += 25511;
- }
- }
- else
- {
- v9 = IplFilePool__locate(Entry.Name);
- pIndex = v9;
- if ( v9 == -1 )
- v9 = allocIplFile(Entry.Name);
- v7 = v9 + 25255;
- pIndex = v7;
- }
- }
- else
- {
- v8 = dummy_410390();
- pIndex = v8;
- if ( v8 == -1 )
- v8 = allocateCollisionFile(Entry.Name);
- v7 = v8 + 25000;
- pIndex = v7;
- }
- }
- else
- {
- v6 = txdIndexByName(Entry.Name);
- pIndex = v6;
- if ( v6 == -1 )
- {
- pIndex = CTxdStore__AddRef(Entry.Name);
- assignPaintjobToVehicle(Entry.Name, pIndex);
- v6 = pIndex;
- }
- v7 = v6 + 20000;
- pIndex = v7;
- }
- }
- else
- {
- if ( !getModelIndexByName(Entry.Name, &pIndex) )
- {
- Entry.Position |= ImgDescriptorNum << 24;
- CImgFile__addHeader(pDirectory, &Entry);
- goto LABEL_39;
- }
- v7 = pIndex;
- }
- if ( !GetLoadedObjectPositionAndSize(&loadedObjectInfo + v7, &p_Position, &p_Size) )
- {
- v11 = Entry.SizeFirstPriority;
- v10 = 20 * pIndex;
- v12 = Entry.SizeFirstPriority == 0;
- *(&loadedObjectInfo.ImgOffset + 20 * pIndex) = ImgDescriptorNum;
- if ( !v12 )
- Entry.SizeSecondPriority = v11;
- SetLoadedObjectInfoPositionAndFileSize(
- (LoadedObjectInfo *)((char *)&loadedObjectInfo + v10),
- Entry.Position,
- Entry.SizeSecondPriority);
- v13 = pIndex;
- *(&loadedObjectInfo.NumOfImgDescriptor + 20 * pIndex) = 0;
- if ( v3 != -1 )
- *(&loadedObjectInfo.NextFileIdInImg + 10 * v3) = v13;
- v3 = v13;
- continue;
- }
- LABEL_39:
- v3 = -1;
- }
- --AmountOfFiles;
- CFileMgr__CloseFile(file2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement