Git Product home page Git Product logo

cr-sc-dump's Introduction

cr-sc-dump

Python script to extract pngs from Supercell’s *.sc, *_dl.sc, *_tex.sc, or *.csv files.

Installation

pip install -r requirements.txt

Optional: If you want to use dumpsc.py inside a contianer

docker build --pull -t dumpsc .

Usage

Download Clash Royale APK, unzip and navigate to path/to/assets/sc/. Works the same for any other Supercell game.

Or pull /data/data/com.supercell.clashroyale/update/ from your rooted Android device.

To extract pngs from files ending with _tex.sc try

python dumpsc.py path/to/filename_tex.sc

To extract pngs from files ending with .sc or _dl.sc try

python dumpsc.py path/to/filename_dl.sc --old

To decompress files ending with .csv try

python dumpsc.py path/to/filename.csv

Here an example on how to use the contianer

docker run --rm -it --volume "$PWD":/data --user="$(id -u):$(id -g)" dumpsc <*_tex.sc>

Additional Links

Credits

cr-sc-dump's People

Contributors

123456abcdef avatar fpvolquind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cr-sc-dump's Issues

Can't get this to work on Windows

Hi!
The lzma package can't be compiled on Windows (with Python 2.7), so I used Python 3 (with native support of lzma : https://docs.python.org/3/library/lzma.html).
But it doesn't work too :

C:\Users\y3n\Documents\Projects\cr-sc-dump>python dumpsc.py chr_skeleton_tex.sc
chr_skeleton_tex.sc
Traceback (most recent call last):
  File "dumpsc.py", line 99, in <module>
    process_sc(baseName, data[26:], path)
  File "dumpsc.py", line 44, in process_sc
    data = data[0:9] + ('\x00' * 4) + data[9:]
TypeError: can't concat bytes to str

Please help me,

Thx

how to use cr-sc-dump

I always get an error when I enter the following command in the console:
python dumpsc.py C:\Users\KID\Desktop\CC\SC-Assets-Downloader-GUI-master\output\96f15130347e2669f85dca5769def13e2e541912\sc/to/arena_training_tex.sc

Error:FileNotFoundError [Errno 2] No such file or directory: 'C:\Users\KID\Desktop\CC\SC-Assets-Downloader-GUI-master\output\96f15130347e2669f85dca5769def13e2e541912\sc/to/arena_training_tex.sc'

Storage path of all downloaded SC files:C:\Users\KID\Desktop\CC\SC-Assets-Downloader-GUI-master\output\96f15130347e2669f85dca5769def13e2e541912\sc

The name of the file I want to convert:arena_training_tex.sc

LZMAError

I ran through the setup and executed the command:

python dumpsc.py chr_goblin_archer_tex.sc
chr_goblin_archer_tex.sc
LZMAError Input format not supported by decoder

Not sure what this means.

.csv Unknown header

Hi!
I'm having trouble using the script:
Any .csv file gives Exception Unknown header
Any .sc file gives LZMAError Input format not supported by decoder

OS: Windows 11 Version 10.0.22621 Build 22621
Python: 3.10.11
Packages: Pillow-9.5.0 pylzham-0.1.3 zstandard-0.21.0
Res source: CoC 15.83.29

Any help will be appreciated, thank you

Decoding does not work for CoC v15.0.3 apk

Hi!

I tried to extract *_tex.sc files from CoC v15.0.3 apk.
Many times an image can be extracted but I also get error

background_cc_gamearea_tex.sc
SystemError PY_SSIZE_T_CLEAN macro must be defined for '#' formats

or

background_gamearea_tex.sc
file_type: 28, file_size: 4686189, sub_type: 4, width: 1286, height: 1822
with a totally messed up image.
Especially buildings_cc_tex_0.png and some more look more like art wall papers :-)

When extracting *.sc files with option --old I get "empty" images (at least irfanview decodes but shows nothing) and lots of errors:

background_cc_gamearea.sc
SystemError PY_SSIZE_T_CLEAN macro must be defined for '#' formats

background_player.sc
file_type: 1, file_size: 5, sub_type: 0, width: 1930, height: 3072
ValueError not enough image data

Any idea?

buffer error

i get this error !

struct.error: unpack_from requires a buffer of at least 116960 bytes

can you help?
Tahnks

lzma

it cannot work seemingly
707da986d6297d6b
.

Decoder Error LZMA

Screenshot (2)

I try python 3.9 and 3.10 both get same error.
maybe I do something wrong?

Issue with new cards

a while back SC started using a new way of storing new cards
and I failed to "unpack" said cards using this tool
the cards are

  • ui_spell_zappies.sc
  • ui_spell_hunter.sc
  • ui_spell_magic_archer.sc
  • ui_spell_ghost.sc

and they can be found in data\data\update
any help would be apriciated

LZMAError Input format not supported by decoder

\path\to\assets\sc\ui_spells.sc --old
ui_spells.sc
LZMAError Input format not supported by decoder

\path\to\assets\sc\ui_spells.sc
ui_spells.sc
LZMAError Input format not supported by decoder

I am using python 3.11.5 (latest 09/02/23)
I have retrieved the Clash Royale files by installing them from apkpure.com Clash Royale version 3.33145, then renaming the file to end in .zip, and extracting.
I am using Windows 10 Pro OS Build 19045.3324 on Command Prompt (cmd).

Help needed with pyliblzma

Everything was fine when installing pillow, but I start encountering problems when I try to type "python -m pip install pyliblzma" into the terminal. All I got when I typed the command in was this:

Collecting pyliblzma

  Using cached pyliblzma-0.5.3.tar.bz2
Installing collected packages: pyliblzma
  Running setup.py install for pyliblzma ... error
    Complete output from command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/f8/m568lsl97152p2_r2g2rscnw0000gp/T/pip-build-Jsii5J/pyliblzma/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/f8/m568lsl97152p2_r2g2rscnw0000gp/T/pip-XguBrV-record/install-record.txt --single-version-externally-managed --compile:
    /bin/sh: pkg-config: command not found
    /bin/sh: pkg-config: command not found
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.6-intel-2.7
    copying liblzma.py -> build/lib.macosx-10.6-intel-2.7
    running build_ext
    building 'lzma' extension
    creating build/temp.macosx-10.6-intel-2.7
    creating build/temp.macosx-10.6-intel-2.7/src
    /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DVERSION="0.5.3" -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/liblzma.c -o build/temp.macosx-10.6-intel-2.7/src/liblzma.o -Wall -Wextra -pedantic -Wswitch-enum -Wswitch-default -std=gnu99
    In file included from src/liblzma.c:1:
    src/liblzma.h:24:10: fatal error: 'lzma.h' file not found
    #include <lzma.h>
             ^
    1 error generated.
    error: command '/usr/bin/clang' failed with exit status 1
    
    ----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/f8/m568lsl97152p2_r2g2rscnw0000gp/T/pip-build-Jsii5J/pyliblzma/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/f8/m568lsl97152p2_r2g2rscnw0000gp/T/pip-XguBrV-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/f8/m568lsl97152p2_r2g2rscnw0000gp/T/pip-build-Jsii5J/pyliblzma/

I am still new to using python so please tell me what is happening.

I am using Mac and python version 2.7.13

PNG to SC

Is .png to .sc possible?
If so, I would love to see it here!

Does this work with 1.5 ? Getting garbled images.

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!

Decoding new _dl.sc files

Do you have any idea on how to decode Supercell's new sc files ending with _dl.sc? This scipt doesn't work anymore.

Unknown header (dl.sc)

Why does not it work? What should be done?

C:\DECODE\cr-sc-dump-master>python dumpsc.py ex/emotes_bday_03_dl.sc --old
ex/emotes_bday_03_dl.sc
Exception Unknown header

Encoding CSV support?

I've seen other tools to encode decoded .sc files but I haven't found one that works. I tried this one but it doesn't work properly. Will encoding support for .csv files ever be released?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.