This repository has been archived by the owner on Jan 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
56 lines (36 loc) · 1.7 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import time
import argparse
from sc_compression.signatures import Signatures
from sc_compression import Decompressor, Compressor
from lib.console import Console, Time
def main():
parser = argparse.ArgumentParser(description="SC tool by SCW Make - github.com/scwmake/SC")
parser.add_argument("-d", "--decompile", help="Convert *.sc file to *.fla", type=str)
parser.add_argument("-dx", "--decompress", help="Decompress *.sc files with Supercell compression", type=str)
parser.add_argument("-cx", "--compress", help="Compress *.sc files with Supercell compression (LZMA | SC | version 1)", type=str)
args = parser.parse_args()
start_time = time.time()
if args.decompile:
from lib import sc_to_fla
sc_to_fla(args.decompile)
elif args.decompress:
file = args.decompress
decompressor = Decompressor()
decompressed = decompressor.decompress(open(file, 'rb').read().split(b"START")[0])
open(file + ".dec", 'wb').write(decompressed)
elif args.compress:
file = args.compress
compressor = Compressor()
compressed = compressor.compress(open(file, 'rb').read(), Signatures.SC, 1)
open(file + ".cmp", 'wb').write(compressed)
else:
Console.title("SC tool by SCW Make - github.com/scwmake/SC")
print("-d, --decompile : Convert *.sc file to *.fla")
print("-dx, --decompress : Decompress *.sc files with Supercell compression")
print("-cx, --compress : Compress *.sc files with Supercell compression (LZMA | SC | version 1)")
exit(0)
result_time = time.time() - start_time
print(f"Done in {Time(result_time)} seconds!")
if __name__ == "__main__":
main()