LazyDuchess / OpenTS2

Open source re-implementation of The Sims 2 in Unity
Mozilla Public License 2.0
221 stars 17 forks source link

Figure out .reia video files. #3

Closed LazyDuchess closed 1 year ago

LazyDuchess commented 1 year ago

Reia files can be found in each Neighborhood that comes with the game, they have a small compressed video showcasing the neighborhood. They're inside of a RIFF container.

Here's what I've figured out so far:

RIFF Header

CHAR[4] "RIFF" DWORD file size //size of reia chunk [REIA]

REIA Header

CHAR[8] "Reiahead" DWORD unknown //always 24? DWORD unknown //always 1? DWORD size of video metadata below [Video metadata]

Video metadata

DWORD X resolution DWORD Y resolution DWORD framerateFraction DWORD framerate //FPS turns out as framerateFraction / framerate DWORD length //Final length is this value minus 1, in frames. [Frame chunks]

Frame Chunks

CHAR[4] "frme" DWORD size of chunk below BYTE[size] unknown

Still need to figure out the frame chunks themselves. All I know is that they're Run Length Encoded.

ammaraskar commented 1 year ago

Took a stab at this, managed to figure out the format :)

Here's the video for Belladonna Cove:

https://user-images.githubusercontent.com/773529/204124123-9a72bdbb-1de3-4cf7-a1da-d0724fc9d3bc.mp4

I wrote out details about the format here https://github.com/ammaraskar/SimsReiaParser#format-details and wrote a very basic and dumb python script to parse it. Probably gonna make a simple tool to decode/encode from the format and write up a C# library later.

LazyDuchess commented 1 year ago

Took a stab at this, managed to figure out the format :)

Here's the video for Belladonna Cove:

Belladonna.Cove.mp4 I wrote out details about the format here https://github.com/ammaraskar/SimsReiaParser#format-details and wrote a very basic and dumb python script to parse it. Probably gonna make a simple tool to decode/encode from the format and write up a C# library later.

I'm blown away, thank you! Fantastic work.

LazyDuchess commented 1 year ago

There we go! I've implemented the ReiaFile and ReiaFrame classes based on your research and Python code.

https://user-images.githubusercontent.com/42678262/205526155-94ee672f-b214-4b42-af79-8a82e0403434.mp4

Still need to clean it up a little and add an iterator/coroutine like in your Python code to stream frames rather than do it all at once, but it's working perfectly nonetheless!

Probably a good time now to start working on parsing UI layouts and the like.