Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Loads CD directory item and returns file ID
- __int32 __cdecl LoadCDdirectoryItem(const CDirectoryEntryExtended& entry, int imgId)
- {
- // return UNDEFINED_FILE_ID_INT32;
- CDirectoryEntryExtended xEntry = entry;
- char* pDot = strchr(xEntry.Name, '.');
- if (!pDot)
- return UNDEFINED_FILE_ID_INT32;
- *pDot = NULL;
- const char* pExtension = pDot + 1;
- if (strlen(pExtension) < 3)
- return UNDEFINED_FILE_ID_INT32;
- const char* name = xEntry.Name;
- __int32 fileIndex;
- // printf("filename: %s", entry->Filename);
- if (!memicmp(pExtension, "DFF", 3))
- {
- if (!CModelInfo::GetModelInfo(name, &fileIndex))
- {
- xEntry.PositionInSectors |= imgId << 24;
- // CDirectoryEntry convertedEntry;
- // convertedEntry.SetDataBasedOnExtendedEntry(xEntry);
- /*
- printf_MessageBox(
- "entry details\n"
- "name: %s\n"
- "pos: 0x%X\n"
- "size priority2: %d\n"
- "size priority1: %d\n"
- ,
- convertedEntry.Filename,
- (int)(entry.PositionInSectors & 0xFFFFFF) * IMG_ARCHIVE_SECTOR_SIZE,
- (int)convertedEntry.sizePriority2 * IMG_ARCHIVE_SECTOR_SIZE,
- (int)convertedEntry.sizePriority1 * IMG_ARCHIVE_SECTOR_SIZE
- );
- */
- CStreaming::ms_pExtraObjectsDir->AddItem(xEntry);
- return UNDEFINED_FILE_ID_INT32;
- }
- else
- return fileIndex;
- }
- else if (!memicmp(pExtension, "TXD", 3))
- {
- // CGenericLogStorage::SaveFormattedTextLn("TXD name: %s", name);
- int TXDslot =
- ((int(__cdecl *)(const char *))0x731850)(
- name
- ); // CTxdStore::FindTxdSlot
- if (TXDslot == -1)
- {
- TXDslot = ((int(__cdecl *)(const char *))0x731C80)(
- name
- ); // CTxdStore::AddTxdSlot
- ((void(__cdecl *)(const char *, int))0x4C9360)(
- name,
- TXDslot
- ); // set paintjobs for vehicle model.
- }
- // printf_MessageBox("returned file ID: %d", TXDslot + ModelIDlimit::GetBaseID(FILE_TYPE_TXD));
- return TXDslot + ModelIDlimit::GetBaseID(FILE_TYPE_TXD);
- }
- else if (!memicmp(pExtension, "COL", 3))
- {
- int COLslot =
- ((int(__cdecl *)(const char *))0x410390)(
- name
- ); // CColStore::FindColSlot
- if (COLslot == -1)
- COLslot = ((int(__cdecl *)(const char *))0x411140)(
- name
- ); // CColStore::AddColSlot
- return COLslot + ModelIDlimit::GetBaseID(FILE_TYPE_COL);
- }
- else if (!memicmp(pExtension, "IPL", 3))
- {
- int IPLslot =
- ((int(__cdecl *)(const char *))0x404AC0)(
- name
- ); // CIplStore::FindIplSlot
- if (IPLslot == -1)
- IPLslot = ((int(__cdecl *)(const char *))0x405AC0)(
- name
- ); // CIplStore::AddIplSlot
- return IPLslot + ModelIDlimit::GetBaseID(FILE_TYPE_IPL);
- }
- else if (!memicmp(pExtension, "DAT", 3))
- {
- int DATslot = 0xCCCCCCCC;
- sscanf(name + 5, "%d", &DATslot);
- return DATslot + ModelIDlimit::GetBaseID(FILE_TYPE_DAT);
- }
- else if (!memicmp(pExtension, "IFP", 3))
- {
- int IFPslot = ((int(__cdecl *)(const char *))0x4D3E50)(
- name
- ); // CAnimManager::RegisterAnimBlock
- return IFPslot + ModelIDlimit::GetBaseID(FILE_TYPE_IFP);
- }
- if (!memicmp(pExtension, "RRR", 3))
- {
- int RRRslot = ((int(__cdecl *)(const char *))0x459F80)(
- name
- ); // CVehicleRecording::RegisterRecordingFile
- return RRRslot + ModelIDlimit::GetBaseID(FILE_TYPE_RRR);
- }
- else if (!memicmp(pExtension, "SCM", 3))
- {
- int SCMslot = ((int(__thiscall *)(char*, const char *))0x4706C0)(
- ModelIDlimit::CTheScripts__StreamedScripts,
- name
- ); // CStreamedScripts::RegisterScript
- return SCMslot + ModelIDlimit::GetBaseID(FILE_TYPE_SCM);
- }
- else
- {
- // printf_MessageBox("filename: %s unknown extension: %s", entry.Filename, pExtension);
- return UNDEFINED_FILE_ID_INT32;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement