| 731 | } |
| 732 | |
| 733 | void BlCodeView::WriteTypeData(int streamId, BlTypeInfo& typeInfo) |
| 734 | { |
| 735 | int hashStream = StartStream(); |
| 736 | int pos = 0; |
| 737 | uint8 tempData[0x10002]; |
| 738 | |
| 739 | int hashBucketsSize = 0x3FFFF; |
| 740 | int numTags = typeInfo.mCurTagId - 0x1000; |
| 741 | |
| 742 | struct _JumpEntry |
| 743 | { |
| 744 | int mTypeIdx; |
| 745 | int mOfs; |
| 746 | }; |
| 747 | |
| 748 | Array<_JumpEntry> indexEntries; |
| 749 | uint8* curChunk = NULL; |
| 750 | |
| 751 | typeInfo.mData.SetReadPos(0); |
| 752 | for (int tagId = 0x1000; tagId < typeInfo.mCurTagId; tagId++) |
| 753 | { |
| 754 | // Align |
| 755 | typeInfo.mData.mReadCurPtr = (uint8*)(((intptr)typeInfo.mData.mReadCurPtr + 3) & ~3); |
| 756 | |
| 757 | // Chunks are every 8k, which is perfect for the jump table |
| 758 | if (curChunk != typeInfo.mData.mReadCurAlloc) |
| 759 | { |
| 760 | indexEntries.Add({ tagId, typeInfo.mData.GetReadPos() }); |
| 761 | curChunk = typeInfo.mData.mReadCurAlloc; |
| 762 | } |
| 763 | |
| 764 | uint8* dataHead = (uint8*)typeInfo.mData.FastRead(tempData, 4); |
| 765 | // Pointer not valid |
| 766 | uint8* data = dataHead; |
| 767 | int trLength = GET(uint16); |
| 768 | if (dataHead == tempData) |
| 769 | { |
| 770 | typeInfo.mData.Read(tempData + 4, trLength - 2); |
| 771 | } |
| 772 | else |
| 773 | { |
| 774 | uint8* leafData = (uint8*)typeInfo.mData.FastRead(tempData + 4, trLength - 2); |
| 775 | if (leafData != dataHead + 4) |
| 776 | { |
| 777 | memcpy(tempData, dataHead, 4); |
| 778 | dataHead = tempData; |
| 779 | } |
| 780 | } |
| 781 | |
| 782 | data = dataHead; |
| 783 | int32 hashVal = BlHash::GetTypeHash(data) % hashBucketsSize; |
| 784 | mWriter.WriteT(hashVal); |
| 785 | |
| 786 | //typeInfo.mData.TryGetPtr |
| 787 | } |
| 788 | |
| 789 | mWriter.Write(&indexEntries[0], (int)indexEntries.size() * 8); |
| 790 |
nothing calls this directly
no test coverage detected