Gildor's Forums

Author Topic: Serialization of TArray Type  (Read 130 times)
Headshot
Sponsor
Jr. Member
*
Posts: 43


View Profile
Serialization of TArray Type
« on: December 31, 2019, 06:00 »

Hey there,

I have been working on a custom parser for UE2 Animation Sequences, however there is something i can't make sense of which includes how TArray types are stored.

The usual structure that i observed first based on the following entry TArray<float> SampleData results in:

byte ArrayCount;
float DataEntries[ArrayCount]

but now if the Array reaches a specific size there seems to be some other things going. Instead of a byte a short is used and this is where i got stuck because the Values make no sense at first.

I have a sample of this behaviour here:

https://mega.nz/#!iJhSQQQC!6erKE8vd2v10gsYyJl8KdfqH4Yn9C51r8aWjM3imxXQ

Its a simple array of float timings. The Total size is 772 bytes ( 4 bytes * 193 ) 193 is the sample count i used to write this with from Unreal. However the array information infront of the data makes no direct sense to me.

I tried looking into the actual Unreal Code and then UE Viewer but i could not spot any special case logic dealing with this specifically.

The other part i am wondering is how i would detect if only a byte is given for Array Count or this method? I assume this is probably another type of Array itself, i have done work with UE3 files in the past and i did not encounter this issue yet.

Any help is very appreciated.

Logged
Gildor
Administrator
Hero Member
*****
Posts: 7897



View Profile WWW
Re: Serialization of TArray Type
« Reply #1 on: December 31, 2019, 09:48 »

Hi,
Open UModel's UnCoreSerialize.cpp, read "FArchive& operator<<(FArchive &Ar, FCompactIndex &I)" function - it serializes count field for arrays and strings.
Logged
Headshot
Sponsor
Jr. Member
*
Posts: 43


View Profile
Re: Serialization of TArray Type
« Reply #2 on: January 01, 2020, 20:01 »

Hi,
Open UModel's UnCoreSerialize.cpp, read "FArchive& operator<<(FArchive &Ar, FCompactIndex &I)" function - it serializes count field for arrays and strings.

Thank you! Thats exactly what i needed. I didnt see it at first glance when briefly looking through the file.
Logged
Jump to:  

Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Leviathan design by Bloc | XHTML | CSS