Re: Star Stable Online - CSA & TGA files
Posted: Tue Jan 04, 2022 6:09 pm
Hi!
I stumbled on this forum thread while researching the CSA file format ("Cold Storage Archive" btw). I saw that there are a lot of discussions regarding the texture resources and thought that I should contribute.
Long Story Short
they are not encrypted. They are just compressed with a newer, optimized version of Crunch. Specifically the version that is bundled with Unity 2017.3. It's open source, so if you have a developer environment then you can build the tool from sources at https://github.com/Unity-Technologies/crunch/tree/unity.
Slightly Longer Story
No QuickBMS script I have seen does a very good job at unpacking the CSA files so I wrote my own tool for that. In my opinion, the best approach is to use the csaheader files to unpack the packed resources into a proper folder structure. The QBMS scripts tries to unpack with an internal source path, which is why the output folder looks so weird and many files are corrupted or duplicated.
Doing it properly, you will end up with ~52.000 files in a handful of different formats. The textures are as you already know stored in .PTE files, and there are about 19.000 of them. PTE is also a container format, but it only contains a single texture. The texture is always in DDS-format, but most of them are compressed with Crunch as mentioned above. ~15K textures are compressed, and the rest are plain old DDS.
So to summarize how to do this with code or a script:
3D Object Converter does a pretty good job with reading the mesh files, but unfortunately it doesn't work well with the textures, materials, bones and animations etc... If it was open source I would have fixed it, but it's not and I cant be bothered to write a new converter from scratch just for this.
I hope this helps anyone!
I stumbled on this forum thread while researching the CSA file format ("Cold Storage Archive" btw). I saw that there are a lot of discussions regarding the texture resources and thought that I should contribute.
Long Story Short
they are not encrypted. They are just compressed with a newer, optimized version of Crunch. Specifically the version that is bundled with Unity 2017.3. It's open source, so if you have a developer environment then you can build the tool from sources at https://github.com/Unity-Technologies/crunch/tree/unity.
Slightly Longer Story
No QuickBMS script I have seen does a very good job at unpacking the CSA files so I wrote my own tool for that. In my opinion, the best approach is to use the csaheader files to unpack the packed resources into a proper folder structure. The QBMS scripts tries to unpack with an internal source path, which is why the output folder looks so weird and many files are corrupted or duplicated.
Doing it properly, you will end up with ~52.000 files in a handful of different formats. The textures are as you already know stored in .PTE files, and there are about 19.000 of them. PTE is also a container format, but it only contains a single texture. The texture is always in DDS-format, but most of them are compressed with Crunch as mentioned above. ~15K textures are compressed, and the rest are plain old DDS.
So to summarize how to do this with code or a script:
- Loop through each header file and extract the name, size and offset of each resource in the corresponding csa data file.
- Save each resource you are interesting in from the datafiles as separate files.
- For each PTE, extract the texture as a CRN or DDS file depending on it's type
- Use Crunch to convert them into a common format such as PNG. Handily enough, Crunch can read both CRN & DDS, so you can convert all files in one go. I only found one file that Crunch failed on (Item_PandorianCompass.PTE), so that had to be converted by hand.
3D Object Converter does a pretty good job with reading the mesh files, but unfortunately it doesn't work well with the textures, materials, bones and animations etc... If it was open source I would have fixed it, but it's not and I cant be bothered to write a new converter from scratch just for this.
I hope this helps anyone!