Utility & Library for decoding stalcraft assets
Project description
SC FILE
Utility and Library for decoding and converting stalcraft assets files, such as models and textures into well-known formats.
You can use executable from Releases page.
[!WARNING] Do not use game assets directly. You can get banned for any changes in game client.
📁 Formats
Type | Source format | Output format |
---|---|---|
Model | .mcsa | .obj |
Texture | .ol | .dds |
Image | .mic | .png |
Model versions supported: 7.0, 8.0, 10.0
Texture formats supported: DXT1, DXT3, DXT5, RGBA8, BGRA8, RGBA32F, DXN_XY
Texture formats unsupported: Cubemaps (hdri, sky)
💻 CLI Utility
Usage
You can drag and drop one or multiple files to scfile.exe
.
From bash:
scfile [OPTIONS] [FILES]...
Arguments
FILES
: List of file paths to be converted. Multiple files should be separated by spaces. Accepts both full and relative paths. Does not accept directory.
Options
-O
,--output
: One path to output file or directory. Can be specified multiple times for different output files or directories. If not specified, file will be saved in the same directory with a new suffix. You can specify multipleFILES
and a single--output
directory.
Examples
-
Convert a single file:
scfile file.mcsa
Will be saved in the same directory with a new suffix.
-
Convert a single file with a specified path or name:
scfile file.mcsa --output path/to/file.obj
-
Convert multiple files to a specified directory:
scfile file1.mcsa file2.mcsa --output path/to/dir
-
Convert multiple files with explicitly specified output files:
scfile file1.mcsa file2.mcsa -O 1.obj -O 2.obj
If the count of
FILES
and--output
is different, as many files as possible will be converted. -
Convert all
.mcsa
files in the current directory:scfile *.mcsa
In this case,
--output
accepts only a directory. Subdirectories are not included. -
Convert all
.mcsa
files with subdirectories to a specified directory:scfile **/*.mcsa -O path/to/dir
In this case,
--output
accepts only a directory. With--output
specified, directory structure is not duplicated.
📚 Library
Install
Pip
pip install sc-file -U
Manual
git clone git@github.com:onejeuu/sc-file.git
cd sc-file
poetry install
Usage
Simple
from scfile import convert
# Output path is optional.
# Defaults to source path with new suffix.
convert.mcsa_to_obj("path/to/model.mcsa", "path/to/model.obj")
convert.ol_to_dds("path/to/texture.ol", "path/to/texture.dds")
convert.mic_to_png("path/to/image.mic", "path/to/image.png")
# Or determinate it automatically
convert.auto("path/to/model.mcsa")
Advanced
Default
from scfile.file.data import ModelData
from scfile.file.mcsa.decoder import McsaDecoder
from scfile.file.obj.encoder import ObjEncoder
mcsa = McsaDecoder("model.mcsa")
data: ModelData = mcsa.decode()
mcsa.close() # ? Necessary to close
obj = ObjEncoder(data)
obj.encode().save("model.obj") # ? Encoder closes after saving
Use encoding content bytes
obj = ObjEncoder(data)
obj.encode()
with open("model.obj", "wb") as fp:
fp.write(obj.content)
obj.close() # ? Necessary to close
Use convert methods
mcsa = McsaDecoder("model.mcsa")
mcsa.convert_to(ObjEncoder).save("model.obj")
mcsa.close() # ? Necessary to close
mcsa = McsaDecoder("model.mcsa")
mcsa.to_obj().save("model.obj")
mcsa.close() # ? Necessary to close
Use context manager
with McsaDecoder("model.mcsa") as mcsa:
data: ModelData = mcsa.decode()
with ObjEncoder(data) as obj:
obj.encode().save("model.obj")
Use context manager + convert methods
with McsaDecoder("model.mcsa") as mcsa:
mcsa.to_obj().save("model.obj")
Save multiple copies
with McsaDecoder("model.mcsa") as mcsa:
with mcsa.to_obj() as obj:
obj.save_as("model_1.obj")
obj.save_as("model_2.obj")
🛠️ Build
[!IMPORTANT] You will need poetry to do compilation.
[!TIP] Before proceeding, it's recommended to create virtual environment
poetry shell
Then install dependencies:
poetry install
And run script to compile:
poetry run build
Executable file will be created in /dist
directory.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.