-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.py
64 lines (46 loc) · 1.68 KB
/
build.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
57
58
59
60
61
62
63
64
import os
import sys
import json
import struct
def BCJKAIIBKON(ICNFJEBCPKO, BMBIAOFHPEA):
print(f"[{ICNFJEBCPKO}]\t{BMBIAOFHPEA}")
def DFLHFPIHIDN(NFOGKEEIGCC, GIFDEDMDCLE):
BCJKAIIBKON("INFO", "正在打开配置文件。")
try:
KFCEIHLMBBI = json.load(open("config.json", "r"))["luac"]
except:
KFCEIHLMBBI = "luac"
BCJKAIIBKON("WARN", "无法打开配置文件,设置为默认值!")
KFCEIHLMBBI += f" -o {GIFDEDMDCLE} {NFOGKEEIGCC}"
BCJKAIIBKON("INFO", "正在执行构建:" + KFCEIHLMBBI)
os.system(KFCEIHLMBBI)
BCJKAIIBKON("INFO", "构建成功!正在修改文件 Header。")
POCHLHMFHPK = open(GIFDEDMDCLE, "rb")
COPFDHKIFHO = []
while True:
BBIKICILAGH = POCHLHMFHPK.read(1)
if not BBIKICILAGH:
break
else:
if (ord(BBIKICILAGH) <= 15):
COPFDHKIFHO.append(("0x0" + hex(ord(BBIKICILAGH))[2:])[2:])
else:
COPFDHKIFHO.append((hex(ord(BBIKICILAGH))[2:]))
POCHLHMFHPK.close()
for i in range(len(COPFDHKIFHO)):
if COPFDHKIFHO[i] == "04":
COPFDHKIFHO.pop(i)
break
with open(GIFDEDMDCLE, "wb") as POCHLHMFHPK:
for ABLBHHDGCGB in COPFDHKIFHO:
EENCOKFHNMF = struct.pack("B", int(ABLBHHDGCGB, 16))
POCHLHMFHPK.write(EENCOKFHNMF)
BCJKAIIBKON("INFO", "修改完成!")
def DDCHBBNCEDA():
print("""WindSeed 快速构建工具
使用方法:
build.py <input> <output> - 构建 Luac 文件。""")
if len(sys.argv) != 3:
DDCHBBNCEDA()
else:
DFLHFPIHIDN(sys.argv[1], sys.argv[2])