Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

any chance of making a cstl decompiler #7

Open
the-math-god opened this issue Feb 10, 2022 · 3 comments
Open

any chance of making a cstl decompiler #7

the-math-god opened this issue Feb 10, 2022 · 3 comments

Comments

@the-math-god
Copy link

hi i'm working on Cyanotype Daydream on steam but all the English translations are on cstl files any chance of making a decompiler like the one you made foe CST files

@lhy-cpu
Copy link

lhy-cpu commented Sep 5, 2022

Maybe you can try notepad++

@zlc-dev
Copy link

zlc-dev commented Sep 9, 2022

you can easily do this with regular expressions.
this is a python script, which may be helpful.

# 用于粗略提取 CatSystem2 的 .cstl 文件中的翻译内容的脚本
# 输出在与脚本同目录下的 cstl_out.txt 文件中
# Script for rough extraction of translations in the cstl file of Catsystem2
# The output is in cstl_out.txt in the same directory as the script

import re

filename = "com04B.cstl"

f = open(filename, "r", encoding="utf-8", errors="ignore")

fo = open("cstl_out.txt","w", encoding="utf-8")

# 分割旁白的符号
# Symbols used to split narrations
dialogSep = re.compile(r"[\x00][\x00-\xff]")

# 分割对话与角色名的符号,但这可能不起作用
# Symbols used to split dialog and role names, but it may not work
roleSep = re.compile(r"[\x00-\xff]「|「")

unknowChar = re.compile(r"\\x[0-9a-f][0-9a-f]")

while True:
    line = f.readline()
    if not line:
        break
    line = re.sub(dialogSep, "\n", line)
    line = re.sub(roleSep, " 「", line)
    cstlStr = repr(line)

    # 替换剩余所有无法识别为文本的二进制为换行符
    # Replace any remaining binary unrecognized as text with a line break
    cstlStr = re.sub(unknowChar, "\n", cstlStr)

    cstlStr = cstlStr.split("\n")

    for s1 in cstlStr:
        betterStr = s1.split("\\n")

        for s2 in betterStr:

            # 过滤掉含日文假名的句子,目的是尽可能提取出翻译
            # Filter out sentences with Japanese kana 
            # in order to extract translations whenever possible
            if s2 and not re.search("[あ-んア-ン]", s2):
                fo.write('"{}"\n\n'.format(s2))

fo.close()

@masagrator
Copy link

masagrator commented Jan 11, 2023

This is my Python 3 CSTL extraction script that doesn't use regular expressions. There are no unknows left in terms of CSTL structure.

https://github.com/masagrator/NXGameScripts/blob/main/Cyanotype%20Daydream/CSTL_Extractor_PC.py

Just provide folder with cstl files as argument

f.e.

python CSTL_Extractor_PC.py scenes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants