Closed srabouin closed 7 years ago
Decompressing works the same, but fileType 28 is new. I compaired an old tex.sc wih a new one. It seems, like you said already, that the pixels itself are stored the same way (colors are still correct), but they are ordered different. Not sure when and if I will fix this script for the new version :P.
what about clash of clans tex file? Is that can decompressing?
CoC uses LZHAM, I think, and I don't know how to adjust the header to be able to decompress the files. Last time I check (a few month ago) you could get the decompressed files from the cache folder inside your CoC installation path and could extract the images using this script. But I guess Supercell did the same changes to CoC's tex files like they did in CR.
Hi! This is the garbled image structure (tested with an image with width of 186 (chr_balloon_tex)):
pixels 0 to 31 (32 pixels) = pixels 0 to 31 of line 0 of final image pixels 32 to 63 = pixels 0 to 31 of line 1 of final image ... pixels 992 to 1023 = pixels 0 to 31 of line 31 of final image pixels 1024 to 1055 = pixels 32 to 63 of line 0 of final image ... pixels 2048 to 2079 = pixels 64 to 95 of line 0 of final image ... ... pixels 5088 to 5119 = pixels 128 to 159 of line 31 of final image pixels 5120 to 5145 (26 pixels = (width - (floor(width/32) * 32))) = pixels 160 to 185 of line 0 of final image pixels 5146 to 5171 (26 pixels) = pixels 160 to 185 of line 1 of final image ... pixels 5926 to 5951 = pixels 160 to 185 of line 31 of final image pixels 5952 to 5983 (32 pixels) = pixels 0 to 31 of line 32 of final image ... etc.
I'm currently testing with other images to check how it behaves at the end (chr_balloon_tex is all transparent pixels at the end).
Tested with level_goblin_arena_tex. If there are less than 32 lines remaining, use this number instead of 32 to iterate through the remaining 32-pixels blocks and rebuild the final lines.
@fpvolquind did you end up writing the code for this? you should submit a pull request :)
Well, I wrote the code, but in another language. I'm not so great with python, but I'll give a shot.
Can you paste the logic from whatever other language, I can also give it a shot
Ugly as hell, but works. Just ran through all _tex.sc files, no garbled images.
Tested in a few files and worked great, thank you @fpvolquind great work!
You're welcome. Glad to help the community =)
Hate to put that here, but any advice on getting the contents of the .sc file? like ui.sc contains all the clan badges -- it would be interesting to decode it?
Yes, decoding the .sc files would be great, I'd love to have the animated sprites. The files are LZMA-compressed, similar to the _tex.sc files. There is a script around for QuickBMS that can decompress most of them. I couldn't get much sense out of the decompressed files yet, but they are some sort of texture atlas. I'll try looking at ui_spells to try and get some sense of the data.
Looking at the clan badges csv, it looks like all the badges are in the ui.sc file -- using the bms script i can see all the file names in there too now, so at least getting somewhere... thanks for that!
Posted what I found here: http://zenhax.com/viewtopic.php?f=9&t=2369&p=18181
@umop-aplsdn did you have any progress? I just thought of something, maybe they're using the unity3d sprite packer since it's the engine used for the game. Something else to play with maybe :)
Check out my repository, just updated my script. AFAIK, Supercell uses it's own game engine. I couldn't find any sample Unity texture atlas to compare with the sc files.
Hello,
I tried running this on the new 1.5 version and most files end up being garbage images instead. Only a handful unpack correctly. It might be a change of image size, I see the right colors but they're all misplaced. Any help would be greatly appreciated :)
Thanks in advance!