Skip to content

Commit

Permalink
Use m_Script.encode("utf-8", "surrogateescape") for script field
Browse files Browse the repository at this point in the history
Adhere to type tree reader changes
  • Loading branch information
mos9527 committed Oct 1, 2024
1 parent 9db0e09 commit 2d1525c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions sssekai/entrypoint/live2dextract.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ def main_live2dextract(args):
out_name += ".json"
with open(path.join(args.outdir, out_name), "wb") as fout:
logger.info("Extracting Live2D Asset %s" % out_name)
fout.write(data.script)
fout.write(data.m_Script.encode("utf-8", "surrogateescape"))
# Textures always needs conversion and is placed under specific folders
for texture in modelData["TextureNames"]:
for texture in modelData.TextureNames:
name = path.basename(texture)
folder = path.dirname(texture)
out_folder = path.join(args.outdir, folder)
Expand Down
4 changes: 3 additions & 1 deletion sssekai/entrypoint/moc3paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def main_moc3paths(args):
out_name: str = data.name
if out_name.endswith(".moc3"):
parts, parameters = read_moc3(
BytesIO(data.script.tobytes())
BytesIO(
data.m_Script.encode("utf-8", "surrogateescape")
)
)
ParameterNames.update(parameters)
PartNames.update(parts)
Expand Down
4 changes: 2 additions & 2 deletions sssekai/entrypoint/spineextract.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def main_spineextract(args):
if atlas:
logger.info("...has Atlas %s" % spine)
with open(os.path.join(outdir, spine, spine + ".atlas.txt"), "wb") as f:
f.write(atlas.script)
f.write(atlas.m_Script.encode("utf-8", "surrogateescape"))
texfiles = [line.strip() for line in atlas.text.split("\n")]
texfiles = [
".".join(line.split(".")[:-1])
Expand All @@ -59,6 +59,6 @@ def main_spineextract(args):
with open(
os.path.join(outdir, spine, spine + ".skel.bytes"), "wb"
) as f:
f.write(skel.script)
f.write(skel.m_Script.encode("utf-8", "surrogateescape"))
else:
logger.warning("No skel found for %s" % spine)
2 changes: 1 addition & 1 deletion sssekai/entrypoint/usmdemux.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def main_usmdemux(args):
for data in movieInfo["movieBundleDatas"]:
usm = data["usmFileName"][: -len(".bytes")]
usm = datas[usm]
usmstream.write(usm.script)
usmstream.write(usm.m_Script.encode("utf-8", "surrogateescape"))
usm = Usm.open(usm_temp, encoding="shift-jis")
usm.demux(path.join(args.outdir, usm_name), usm_name)
remove(usm_temp)
Expand Down

0 comments on commit 2d1525c

Please sign in to comment.