Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void __thiscall fb::StreamingPartitionReader::handleLayout(fb::StreamingPartitionReader *this)
- {
- fb::StreamingPartitionReader *streamingPartitionReader; // esi@1
- fb::TypeInfo **startTypeInfo; // edx@1
- unsigned int numTypeDescriptors; // eax@1
- const fb::TypeInfo *typeInfo; // ecx@1
- fb::TypeInfo *nextTypeInfo; // edi@1
- fb::StreamingPartitionInstanceEntry *currInstance; // edi@6
- unsigned int *currInstanceNameHash; // ebx@6
- fb::ClassInfo *classInfo; // eax@6
- const char *metaString; // ebx@7
- fb::OutAsciiStream *outStream; // eax@8
- unsigned int v11; // edi@12
- fb::TypeInfo **startTypeInfo2; // eax@15
- fb::StreamingPartitionTypeDescriptor *currType; // edi@20
- fb::DataContainerClassInfo *dataContainerClassInfo; // eax@21
- fb::LayoutDescriptor *layoutDescriptor; // eax@21
- fb::ValueTypeInfo *valueTypeInfo; // ebx@22
- int currIndex; // eax@22
- fb::LayoutDescriptor *layoutDescriptor2; // eax@26
- unsigned __int8 currAlign; // al@26
- char currAlign2; // cl@26
- fb::EnumTypeInfo *enumTypeInfo; // ebx@29
- int currPos; // eax@29
- fb::LayoutDescriptor *layoutDescriptor_1; // eax@33
- unsigned int nameHash; // ST0C_4@35
- const char *v25; // eax@35
- const void *targetArrayEnd; // edi@39
- unsigned int targetArrayStart; // ecx@39
- unsigned int arrayCount; // edx@39
- int indexLeft; // eax@39
- unsigned int alignedStartNext; // ebx@39 MAPDST
- int v31; // edx@41
- unsigned int arrayCount_1; // eax@47
- fb::StreamingPartitionArrayEntry *currArray; // ecx@49 MAPDST
- fb::StreamingPartitionFieldDescriptor *currField; // edi@49
- unsigned int realType; // eax@49
- int alignment; // edx@49
- fb::StreamingPartitionTypeDescriptor *currType_1; // eax@53
- int currPos_1; // eax@54
- int arrayStart; // ebx@54
- unsigned int *arrayOffsets; // edx@57
- unsigned int size; // ebx@58
- void *pBuff; // eax@58
- fb::Log::Stream logSteram; // [sp+Ch] [bp-150h]@8
- unsigned int count; // [sp+13Ch] [bp-20h]@47
- unsigned int elementSize; // [sp+144h] [bp-18h]@6
- unsigned int i; // [sp+148h] [bp-14h]@2
- int currPointer; // [sp+14Ch] [bp-10h]@5
- int v50; // [sp+158h] [bp-4h]@8
- streamingPartitionReader = this;
- startTypeInfo = this->m_typeInfos.mpBegin;
- numTypeDescriptors = this->m_header.typeDescriptorCount;
- typeInfo = (const fb::TypeInfo *)&this->m_typeInfos;
- nextTypeInfo = typeInfo->m_pNext;
- if ( numTypeDescriptors <= (signed int)((char *)typeInfo->m_pNext - (char *)startTypeInfo) >> 2 )
- {
- eastl::vector<fb::TypeInfo const *,eastl::fixed_vector_allocator<4,16,4,0,1,fb::eastl_arena_allocator>>::erase(
- (eastl::vector<fb::TypeInfo const *,eastl::fixed_vector_allocator<4,16,4,0,1,fb::eastl_arena_allocator> > *)typeInfo,
- &startTypeInfo[numTypeDescriptors],
- (fb::TypeInfo **)typeInfo->m_pNext);
- }
- else
- {
- i = 0;
- eastl::vector<fb::TypeInfo const *,eastl::fixed_vector_allocator<4,16,4,0,1,fb::eastl_arena_allocator>>::DoInsertValues(
- (eastl::vector<fb::TypeInfo const *,eastl::fixed_vector_allocator<4,16,4,0,1,fb::eastl_arena_allocator> > *)typeInfo,
- (fb::TypeInfo **)nextTypeInfo,
- numTypeDescriptors - (((char *)nextTypeInfo - (char *)startTypeInfo) >> 2),
- (fb::TypeInfo *const *)&i);
- }
- currArray = 0;
- i = 0;
- if ( streamingPartitionReader->m_header.typeCount )
- {
- currPointer = 0;
- do
- {
- currInstance = (fb::StreamingPartitionInstanceEntry *)((char *)streamingPartitionReader->m_instanceEntries
- + currPointer);
- currInstanceNameHash = &streamingPartitionReader->m_typeDescriptors[currInstance->typeDescriptorIndex].typeNameHash;
- classInfo = fb::TypeManager::findClassByHash(*currInstanceNameHash);
- elementSize = (unsigned int)classInfo;
- if ( classInfo )
- {
- currArray = (fb::StreamingPartitionArrayEntry *)(16 * currInstance->exportCount
- + HIWORD(classInfo->m_infoData->layoutDescriptor)
- * (currInstance->exportCount + currInstance->internalCount)
- + (~(LOBYTE(classInfo->m_infoData->instanceSize) - 1) & (unsigned int)((char *)currArray + LOBYTE(classInfo->m_infoData->instanceSize) - 1)));
- }
- else
- {
- metaString = fb::StreamingPartitionReader::metaString(streamingPartitionReader, *currInstanceNameHash);
- if ( fb::Log::c_logFilter & 0x20 )
- {
- fb::Log::Stream::Stream(&logSteram, &stru_39E0C38, s_logContext);
- v50 = 0;
- outStream = fb::operator<<((fb::OutAsciiStream *)&logSteram.vfptr, "Failed to resolve type: ");
- fb::operator<<(outStream, metaString);
- fb::Log::Stream::process(&logSteram);
- v50 = -1;
- fb::Log::Stream::~Stream(&logSteram);
- }
- if ( fb::Log::shouldBreak() )
- __debugbreak();
- }
- v11 = currInstance->typeDescriptorIndex;
- if ( v11 && v11 >= streamingPartitionReader->m_typeInfos.mpEnd - streamingPartitionReader->m_typeInfos.mpBegin )
- eastl::AssertionFailure("vector::operator[] -- out of range");
- startTypeInfo2 = streamingPartitionReader->m_typeInfos.mpBegin;
- currPointer += 12;
- startTypeInfo2[v11] = (fb::TypeInfo *)elementSize;
- ++i;
- }
- while ( i < streamingPartitionReader->m_header.typeCount );
- }
- if ( !(_S2_5 & 1) )
- {
- _S2_5 |= 1u;
- v50 = 1;
- fb::SerializationLayoutCache::SerializationLayoutCache(&cache);
- atexit(fb::getLayoutCache_::_2_::_dynamic_atexit_destructor_for__cache__);
- v50 = -1;
- }
- currPointer = 0;
- if ( streamingPartitionReader->m_header.typeDescriptorCount > 0 )
- {
- elementSize = 0;
- do
- {
- currType = (fb::StreamingPartitionTypeDescriptor *)((char *)streamingPartitionReader->m_typeDescriptors
- + elementSize);
- switch ( ((unsigned int)currType->typeFlags.flagBits >> 4) & 0x1F )
- {
- case 3u:
- dataContainerClassInfo = (fb::DataContainerClassInfo *)fb::TypeManager::findTypeByHash(currType->typeNameHash);
- layoutDescriptor = fb::SerializationLayoutCache::getDescriptor(&cache, dataContainerClassInfo);
- fb::StreamingPartitionReader::mapLayout(streamingPartitionReader, currType, layoutDescriptor);
- break;
- case 2u:
- valueTypeInfo = (fb::ValueTypeInfo *)fb::TypeManager::findTypeByHash(currType->typeNameHash);
- currIndex = currPointer;
- if ( currPointer
- && currPointer >= (unsigned int)(streamingPartitionReader->m_typeInfos.mpEnd
- - streamingPartitionReader->m_typeInfos.mpBegin) )
- {
- eastl::AssertionFailure("vector::operator[] -- out of range");
- currIndex = currPointer;
- }
- streamingPartitionReader->m_typeInfos.mpBegin[currIndex] = (fb::TypeInfo *)valueTypeInfo;
- if ( valueTypeInfo )
- {
- layoutDescriptor2 = fb::SerializationLayoutCache::getDescriptor(&cache, valueTypeInfo);
- fb::StreamingPartitionReader::mapLayout(streamingPartitionReader, currType, layoutDescriptor2);
- currType->secondaryInstanceSize = HIWORD(valueTypeInfo->m_infoData->layoutDescriptor);
- currAlign = LOBYTE(valueTypeInfo->m_infoData->instanceSize);
- currAlign2 = currType->alignment;
- if ( currAlign2 != currAlign )
- {
- fb::Log::formattedLog(&stru_39E0C24, "Alignment error, %d vs %d", (unsigned __int8)currAlign2, currAlign);
- goto LABEL_36;
- }
- }
- else
- {
- currType->secondaryInstanceSize = 0;
- }
- break;
- case 8u:
- enumTypeInfo = (fb::EnumTypeInfo *)fb::TypeManager::findTypeByHash(currType->typeNameHash);
- currPos = currPointer;
- if ( currPointer
- && currPointer >= (unsigned int)(streamingPartitionReader->m_typeInfos.mpEnd
- - streamingPartitionReader->m_typeInfos.mpBegin) )
- {
- eastl::AssertionFailure("vector::operator[] -- out of range");
- currPos = currPointer;
- }
- streamingPartitionReader->m_typeInfos.mpBegin[currPos] = (fb::TypeInfo *)enumTypeInfo;
- if ( enumTypeInfo )
- {
- layoutDescriptor_1 = fb::SerializationLayoutCache::getDescriptor(&cache, enumTypeInfo);
- fb::StreamingPartitionReader::mapLayout(streamingPartitionReader, currType, layoutDescriptor_1);
- }
- break;
- default:
- if ( fb::Log::c_logFilter & 0x20 )
- {
- fb::Log::Stream::Stream(&logSteram, &stru_39E0C10, s_logContext);
- nameHash = currType->typeNameHash;
- v50 = 2;
- v25 = fb::StreamingPartitionReader::metaString(streamingPartitionReader, nameHash);
- fb::operator<<((fb::OutAsciiStream *)&logSteram.vfptr, v25);
- fb::Log::Stream::process(&logSteram);
- v50 = -1;
- fb::Log::Stream::~Stream(&logSteram);
- }
- LABEL_36:
- if ( fb::Log::shouldBreak() )
- __debugbreak();
- break;
- case 4u:
- break;
- }
- elementSize += 16;
- ++currPointer;
- }
- while ( currPointer < streamingPartitionReader->m_header.typeDescriptorCount );
- }
- targetArrayEnd = streamingPartitionReader->targetArrayOffsets.mpEnd;
- targetArrayStart = (unsigned int)streamingPartitionReader->targetArrayOffsets.mpBegin;
- arrayCount = streamingPartitionReader->m_header.arrayCount;
- indexLeft = (signed int)((char *)streamingPartitionReader->targetArrayOffsets.mpEnd - targetArrayStart) >> 2;
- alignedStartNext = (unsigned int)((char *)&currArray[1].offset + 3) & 0xFFFFFFF0;
- if ( arrayCount <= indexLeft )
- {
- v31 = targetArrayStart + 4 * arrayCount;
- i = v31;
- if ( v31 < targetArrayStart
- || v31 > (unsigned int)targetArrayEnd
- || (unsigned int)targetArrayEnd < targetArrayStart
- || (unsigned int)targetArrayEnd < v31 )
- {
- eastl::AssertionFailure("vector::erase -- invalid position");
- v31 = i;
- }
- _memmove(
- (void *)v31,
- targetArrayEnd,
- (char *)streamingPartitionReader->targetArrayOffsets.mpEnd - (char *)targetArrayEnd);
- streamingPartitionReader->targetArrayOffsets.mpEnd -= (signed int)((char *)targetArrayEnd - i) >> 2;
- }
- else
- {
- i = 0;
- eastl::vector<unsigned int,eastl::fixed_vector_allocator<4,32,4,0,1,fb::eastl_arena_allocator>>::DoInsertValues(
- (eastl::vector<unsigned int,eastl::fixed_vector_allocator<4,32,4,0,1,fb::eastl_arena_allocator> > *)&streamingPartitionReader->targetArrayOffsets.mpBegin,
- (unsigned int *)targetArrayEnd,
- arrayCount - indexLeft,
- &i);
- }
- arrayCount_1 = streamingPartitionReader->m_header.arrayCount;
- currPointer = 0;
- count = arrayCount_1;
- if ( arrayCount_1 )
- {
- i = 0;
- do
- {
- currArray = (fb::StreamingPartitionArrayEntry *)((char *)streamingPartitionReader->m_arrayEntries + i);
- currField = &streamingPartitionReader->m_fieldDescriptors[streamingPartitionReader->m_typeDescriptors[currArray->typeDescriptorIndex].layoutDescriptor];
- currArray = (fb::StreamingPartitionArrayEntry *)((char *)streamingPartitionReader->m_arrayEntries + i);
- realType = ((unsigned int)currField->flags.flagBits >> 4) & 0x1F;
- elementSize = (unsigned __int8)mapTypeCodeToSize[realType];
- alignment = (unsigned __int8)mapTypeCodeToAlignment[realType];
- if ( !elementSize )
- {
- if ( realType != 2 )
- {
- fb::Log::formattedLog(&stru_39E0BFC, "%s", &secret);
- if ( fb::Log::shouldBreak() )
- __debugbreak();
- }
- currType_1 = &streamingPartitionReader->m_typeDescriptors[currField->fieldType];
- elementSize = currType_1->secondaryInstanceSize;
- alignment = currType_1->alignment;
- }
- currPos_1 = currPointer;
- arrayStart = ~(alignment - 1) & (alignment + alignedStartNext + 3);
- if ( currPointer
- && currPointer >= (unsigned int)(streamingPartitionReader->targetArrayOffsets.mpEnd
- - streamingPartitionReader->targetArrayOffsets.mpBegin) )
- {
- eastl::AssertionFailure("vector::operator[] -- out of range");
- currPos_1 = currPointer;
- }
- arrayOffsets = streamingPartitionReader->targetArrayOffsets.mpBegin;
- i += 12;
- arrayOffsets[currPos_1] = arrayStart;
- alignedStartNext = elementSize * currArray->elementCount + arrayStart;
- currPointer = currPos_1 + 1;
- }
- while ( currPos_1 + 1 != count );
- }
- size = streamingPartitionReader->m_header.stringTableSize + alignedStartNext;
- pBuff = fb::MemoryArena::alloc(streamingPartitionReader->m_domain->m_arena, size, 0x10u, 0);
- streamingPartitionReader->m_targetBuffer = (char *)pBuff;
- streamingPartitionReader->m_targetBufferSize = size;
- streamingPartitionReader->m_targetStringBase = (char *)pBuff + alignedStartNext;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement