Skip to main content

Mobile-friendly Supercell .sc/.sctx decoder and encoder for Python

Project description

mb-sc-tools

mb-sc-tools is a Python library and CLI for decoding and encoding Supercell .sc and .sctx files on phones and desktops.

It supports:

  • decoding .sc and .sctx into PNG textures and data.json
  • encoding edited PNGs back into .sc and .sctx
  • standalone .sctx rebuilds from data.json + PNG without requiring the original backup file
  • SC wrappers with zstd, lzma, and lz4 payloads
  • ARM64 phones and desktop systems
  • automatic astcenc download on first use for ASTC/KTX textures
  • configurable workspace, output paths, backup name, and ASTC encoder path

Install

pip install mb-sc-tools

CLI

mb-sc-tools

Or direct commands:

mb-sc-tools decode /path/to/ui.sc
mb-sc-tools decode /path/to/bgr.sctx
mb-sc-tools encode /path/to/sc_decoded/ui

More explicit control:

mb-sc-tools decode /path/to/ui.sc \
  --workspace-root /tmp/sc-work \
  --output-dir /tmp/sc-work/custom/ui \
  --source-backup-name source.sc

mb-sc-tools encode /tmp/sc-work/custom/ui \
  --workspace-root /tmp/sc-work \
  --output /tmp/sc-work/sc_encoded/ui.sc

Python API

from pathlib import Path

from mb_sc_tools import (
    DecodeOptions,
    EncodeOptions,
    WorkspaceConfig,
    decode_to_workspace,
    encode_folder,
)

workspace = WorkspaceConfig(root=Path("/tmp/sc-work"))

decoded_dir, data = decode_to_workspace(
    Path("/sdcard/ui.sc"),
    options=DecodeOptions(
        workspace=workspace,
        source_backup_name="source.sc",
    ),
)

encoded_path = encode_folder(
    decoded_dir,
    options=EncodeOptions(
        workspace=workspace,
        output_path=Path("/tmp/sc-work/sc_encoded/ui.sc"),
    ),
)

Output layout

On Android/Termux, if /sdcard/sc exists the tool writes to:

  • /sdcard/sc/sc_decoded/<file_stem>/
  • /sdcard/sc/sc_encoded/<original_name>.sc

Otherwise it writes to a local ./sc/ workspace.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mb_sc_tools-0.1.3.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mb_sc_tools-0.1.3-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file mb_sc_tools-0.1.3.tar.gz.

File metadata

  • Download URL: mb_sc_tools-0.1.3.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for mb_sc_tools-0.1.3.tar.gz
Algorithm Hash digest
SHA256 686392752cda8c1af79f32cafb974a1cfa5860d88097557053a07b8f64f92b1c
MD5 0768d58dfd94964cf8a828bf5fcb076f
BLAKE2b-256 df379c65abafdcd03bd48439eeb1c56afd9848f5f0c0b2121cb9219fae9b20be

See more details on using hashes here.

File details

Details for the file mb_sc_tools-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: mb_sc_tools-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for mb_sc_tools-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 294758878d7b85525838829f879e05245b0ae0425e7996a7fe551b002716d85f
MD5 7e9d477f74f2012d15bd189d3c5d855f
BLAKE2b-256 4268ff7ea13db6cc3d59da35890db869f97fe8a9cc9217b1c2d3cfaed9ad4418

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page