I'm trying to use the dumpsc.py script on the latest APK for Clash of Clans (com.supercell.clashofclans_v8.709.24-844_Android-4.0.3.apk) to try and extract ui_tex.sc, and it is failing with the following message:
$ python3.5 ~/dumpsc.py ui_tex.sc
Traceback (most recent call last):
File "/home/eric/dumpsc.py", line 129, in <module>
process_sc(baseName, data[26:], path)
File "/home/eric/dumpsc.py", line 52, in process_sc
decompressed = lzma.LZMADecompressor().decompress(data)
_lzma.LZMAError: Input format not supported by decoder
But, it does work on some of the other files (info_babydragon_tex.sc for example).
I'll attach a ZIP containing the offending file. Can anybody help me extract the assets from it and convert them to PNG? It would be a bonus if the appropriate graphics could be extracted individually (with the polygons masked out, etc.), but I'll do that work manually if I have to.
EDIT: I tried the "Magic Editor" in the previous thread (in a VM of course), and it seems to work: it offers much more functionality than dumpsc.py including the ability to parse the information (the regular .sc file that ISN'T _tex.sc) about polygons and export resources and so on. However, it fails on the above files as well.
EDIT #2: I have come to the conclusion that it is simply a decompression problem--it seems that Supercell has switched to LZHAM compression, and I've downloaded the source code from richgel999's GitHub and compiled a test application, applied the header corrections from dumpsc.py to the target file (along with changing the first four bytes to 'LZH0') and I have successfully decompressed ui_tex.sc. I will post more information as I come across it.
EDIT #3: Success WITH BOTH FILES! I chopped the first 26 bytes from the beginning of each and added 4 bytes of 0x00 at position 9 (thanks for that info, dumpsc.py), altered the first four bytes to read "LZH0" in ASCII, ran them through the LZHAM test program which I compiled on Ubuntu 17.04 to decompress them without a problem, then loaded up the uncompressed files in Barbarianland's Magic Editor. The results are extremely satisfying. I can directly export any UI asset in the game, with full polygon, masking, and alpha channel support. It makes my custom Discord emojis look dope. Here's a screenshot for the curious:
Thanks to ., @barbossa42, and @Mr Hacker for helping me make this happen. If/when I publish this amateur fankit (don't want to run into Supercell's legal teams...
), I'll post a link here.