Closed sdfsddf33322d closed 1 year ago
gb2312
Sorry for it took for me so long, but I have finally gotten to the issue. Well, as I first saw the scripts, I thought that it has some kind of nasty encryption, so I tried to hack it... Especially without success.
But next I decided to take a different approach. And bingo! The encoding is not CP932, but CP936! This is specific to the Chinese patch, do note. You can use not the GUI tool, but rather the code of the tool itself and run via "main.py". To run the tool via "main.py", install Python and open "main.py" in any sort of editor.
To disassemble the script, type the following code and then run the "main.py".
new_script = AI6WINScript(script_mes, file_txt, encoding="cp936", verbose=True, debug=False, version=1) new_script.disassemble()
Where script_mes -- path to the mes script and file_txt -- path to the txt file.
To assemble the script, type the following code and then run the "main.py".
new_script = AI6WINScript(script_mes, file_txt, encoding="cp936", verbose=True, debug=False, version=1) new_script.assemble()
Where script_mes -- path to the mes script and file_txt -- path to the txt file.
=== Try it out and write the results.
from ai6win_mes_gui import AI6WINMesGUI
debug = False
def test(mode: str):
from ai6win_mes import AI6WINScript
base_name = "01asa_s02_01_03"
script_mes = "{}.mes".format(base_name)
file_txt = "{}.txt".format(base_name)
if mode == "diss":
new_script = AI6WINScript(script_mes, file_txt, encoding="cp936", verbose=True, debug=False, version=1)
new_script.disassemble()
del new_script
elif mode == "ass":
new_script = AI6WINScript(script_mes, file_txt, encoding="cp936", verbose=True, debug=False, version=1)
new_script.assemble()
del new_script
elif mode == "diss_for_hack":
new_script = AI6WINScript(script_mes, file_txt, verbose=True, debug=True, hackerman_mode=True)
new_script.disassemble()
del new_script
def main(): gui = AI6WINMesGUI() return True
if name == 'main': if debug: test("diss") else: main()
Do I make any mistakes in modifying main.py? I don't know why testing is not good
Actually, yes, you did. You have "name == 'main'", but this is incorrect.
You need...
if __name__ == '__main__':
Hi TesterTesterov, I hope you are still seeing this thread. Thank you for the wonderful tool - I think there are a couple of bugs though, each occurs when trying to assemble the files. First, I changed the two code lines in the main.py as you suggested, as follows (BTW, my target language is Korean in my case, so added cp949 instead of cp936):
(From the line 14 to 25 of main.py)
if mode == "diss": new_script = AI6WINScript(script_mes, file_txt, encoding="cp949", verbose=True, debug=False, version=1) new_script.disassemble() del new_script elif mode == "ass": new_script = AI6WINScript(script_mes, file_txt, encoding="cp949", verbose=True, debug=False, version=1) new_script.assemble() del new_script elif mode == "diss_for_hack": new_script = AI6WINScript(script_mes, file_txt, verbose=True, debug=True, hackerman_mode=True) new_script.disassemble() del new_script
I did this and launched main.py, and the following errors occur with the two modes, respectively: 1) when trying assembling with the "Directory" mode, an error message saying "[Errno 2] No such file or directory" pops up, seemingly because main.py reads the txt drive name twice - please see the attached.
2) I tried assembling the txt file with the "Single file" mode, the same old "'cp932' codec can't decode byte 0xf6 in position ****: illegal multibyte sequence" error occurs. So modifying the code did not work for me.
Would you please check and let me know if I should change other codes/scripts main.py is referencing?
Also, the I guess changing the encoding with disassembling (mes to txt) would not be necessary for the translation, since if the Japanese is encoded in another language, the characters would break up.
So the desired workflow for the translation is: 1) disassemble the mes to txt, using the Japanese encoding (cp 932), 2) translate the txt file, and then convert the encoding of the txt file to the target language, and 3) assemble the txt files into mes, and then repack the mes files into an arc file.
Please correct me if I am misunderstanding something.
Thank you, and hope to hear from you in the near future.
@Stuipid-Province, 1) Well, if you aim to disassemble the original scripts, you would need to disassemble with cp932 encoding indeed. 2) An error can occurre as cp949 does not support several characters. You would need to completely change cp932-unique symbols in all strings to cp949's ones. Otherwise, it won't work. If you still has the problem while assembling, change all "cp932" in the code to "cp949", not just in the "main.py". As for directory mode, well, it does work at least in my system without any problems. 3) Yes, but it is possible that the game can support it even without actually repacking.
@TesterTesterov Thank you for the quick answer! Reverted main.py to the original version and changed all the encoding-related codes from "self.encoding" to the desired encoding in "ai6winmes.py", and it worked - in the single file mode. I don't know why the directory mode does not work when assembling for me (works fine with disassembling), but I should be able to do this with the single file mode only - I will have to run this manually like 600-ish times, though.
@Stuipid-Province, you may want to try to enter input and output directories in the C: drive, in its root.
Hi again @TesterTesterov, I am sorry, but tried with my C: drive, in its root, but did not work ... 😭
Is it possible to use single file assembling with cmd commanding? Could you please advise if possible...?
@Stuipid-Province, currently not. I could code the functionality, if needed.
Hi @TesterTesterov, for the moment, it seems I am the only one who is trying to use this tool in the world, but if you implement it, I believe someone should benefit from the functionality someday!
@Stuipid-Province, okay, done. Use "ai6wincmd.py" (see the last commit). You need...
Try this out.
@TesterTesterov Wonderful! It worked, I love you!! But I think there is a typo in your previous comment -
Assembling is the same, but: python ai6wincmd.py e <...>
".py e" should be ".py a", I guess? used that command and it workd as desired.
Thank you, all the Korean players will thank you!
@Stuipid-Province, indeed, a. Fixed.
https://github.com/TesterTesterov/AI6WINScriptTool Biniku no Kaori ~Netori Netorare Yari Yarare~ by Cosetto.
Disassembling of C:\Users\0\Pictures\exbkarc\bgmmode.mes error./Дизассемблирование C:\Users\0\Pictures\exbkarc\bgmmode.mes не удалось.
'cp932' codec can't decode byte Oxec in position 29: illegal multibyte sequence