void ResourceReader::openResourceBlock(const char *filename, Common::File *blockFile, uint32 resType) { blockFile->open(filename); blockFile->readUint16LE(); // Skip unused uint16 count = blockFile->readUint16LE(); blockFile->readUint16LE(); // Skip unused uint32 type = blockFile->readUint32BE(); if (type != kResFLEX) warning("openResourceBlocks: resource header is not 'FLEX'"); _resSlots[resType] = new ResourceSlots(); // Add dummy entry since the resources are 1-based _resSlots[resType]->push_back(ResourceSlot(0, 0)); for (uint16 i = 0; i < count; i++) { uint32 offset = blockFile->readUint32LE(); blockFile->readUint32LE(); uint32 size = blockFile->readUint32LE(); _resSlots[resType]->push_back(ResourceSlot(offset, size)); } }
void ResourceReader::loadIndex(ResourceSlots *slots) { _fd->readUint32LE(); // skip INDX _fd->readUint32LE(); // skip index size _fd->readUint32LE(); // skip unknown _fd->readUint32LE(); // skip res type uint16 count1 = _fd->readUint16LE(); uint16 count2 = _fd->readUint16LE(); uint16 count = MAX(count1, count2); _fd->readUint16LE(); // skip unknown count for (uint16 i = 0; i < count; i++) { uint32 offs = _fd->readUint32LE(); uint32 size = _fd->readUint32LE(); slots->push_back(ResourceSlot(offs, size)); } }