mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-04 03:38:26 +02:00
simplified code and use OVERWRITE mode to patch bmg
This commit is contained in:
parent
c3f910694b
commit
70dc1fb43c
1 changed files with 13 additions and 11 deletions
|
@ -1,19 +1,21 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
|
import os
|
||||||
|
|
||||||
from .definition import *
|
from .definition import *
|
||||||
|
|
||||||
|
|
||||||
def patch_bmg(self, bmgfileszs):
|
def patch_bmg(self, gamefile): # gamefile est le fichier .szs trouvé dans le /files/Scene/UI/ du jeu
|
||||||
subprocess.call(["./tools/szs/wszst", "EXTRACT", bmgfileszs, "-d", bmgfileszs + ".d", "--overwrite"]
|
subprocess.call(["./tools/szs/wszst", "EXTRACT", gamefile, "-d", gamefile+".d", "--overwrite"]
|
||||||
, creationflags=CREATE_NO_WINDOW)
|
, creationflags=CREATE_NO_WINDOW)
|
||||||
|
|
||||||
bmgfile = "./file/" + get_nodir(bmgfileszs) + ".bmg"
|
bmglang = gamefile[-len("E.txt"):-len(".txt")] # Langue du fichier
|
||||||
print(bmgfile)
|
bmgtext = subprocess.check_output(["tools/szs/wctct", "bmg", "--le-code", "--long", "./file/CTFILE.txt",
|
||||||
filecopy(bmgfileszs + ".d/message/Common.bmg", bmgfile)
|
"--patch-bmg", "OVERWRITE="+gamefile+".d/message/Common.bmg"]
|
||||||
shutil.rmtree(bmgfileszs + ".d")
|
, creationflags=CREATE_NO_WINDOW)
|
||||||
|
shutil.rmtree(gamefile+".d")
|
||||||
|
|
||||||
bmgtext = subprocess.check_output(["tools/szs/wctct", "--le-code", "--long", "BMG", "./file/CTFILE.txt",
|
common_file = f"./file/Common_{bmglang}.txt"
|
||||||
"--patch-bmg", "REPLACE="+bmgfile], creationflags=CREATE_NO_WINDOW)
|
with open(common_file, "w", encoding="utf-8") as f: f.write(bmgtext.decode())
|
||||||
with open(bmgfile+".txt", "w", encoding="utf-8") as f: f.write(bmgtext.decode())
|
subprocess.call(["./tools/szs/wbmgt", "ENCODE", common_file, "--overwrite"])
|
||||||
subprocess.call(["./tools/szs/wbmgt", "ENCODE", bmgfile+".txt", "--overwrite"])
|
os.remove(common_file)
|
||||||
#os.remove(bmgfile+".txt")
|
|
Loading…
Reference in a new issue