nunuhara/xsystem4

doesn't extract Offical DLsite chinese version of RanceX

Closed this issue · 15 comments

when i tried to use "aindump -t -o out.txt --input-encoding GBK//TRANSLIT Rance10.ain" to extract the text from Chinese version Rance10.ain it pop up this message as pic shown:

https://images2.imgbox.com/a6/be/t7HjoMaq_o.png
http://imgbox.com/t7HjoMaq
it pop up this message:
WARNING(../src/ain.c:init_member_functions:133): Failed to find struct type for function "锝o緛锝o緹锞愶涧锝归嫄銉伙緡锝継锝続"

Hi, thanks for the report.
I think I know what the problem is. I'll try to get it fixed this weekend.

Actually, are you sure that it isn't working? When I ran that command on the Chinese version it produced an out.txt file containing the Chinese script. The warning message can be safely ignored in this case, it only affects macro generation when dumping bytecode (-c option).

lcsa commented

It seems working when dumping the text but I met the same problem when dumping the code and it prevented me from reinserting to ain file.

PS D:\download\alice-tools-0.5.0\alice-tools-0.5.0> .\ainedit -c out.jam -o out.ain --output-encoding GBK//TRANSLIT Rance10.ain
WARNING(../src/ain.c:init_member_functions:133): Failed to find struct type for function "锝o緛锝o緹锞愶涧锝归嫄銉伙緡锝継锝続"
Parsing...
Encoding...
ERROR(../src/tools/ainedit/asm.c:get_member_no:464): Unable to resolve struct member: menu::detail::CMenuView._m_鍙栨 秷瀛樺湪

And I found some code generated strange like "<dummy : CASFont@SetSiZeの戻り值>"(big z).
So can that be fixed?

Okay, I will investigate this further. In the meantime, you can try dumping the code with the --no-macros flag to avoid this error. E.g.

aindump -c -o out.jam --input-encoding GBK --no-macros Rance10.ain
ainedit -c out.jam -o out.ain --output-encoding GBK Rance10.ain

I was able to successfully rebuild the file with ainedit using this workaround. I'm not sure if the rebuilt file actually runs properly however. Let me know if it doesn't.

lcsa commented

Thanks for quick reply. It seems working well right now and I will take some time to check if it runs properly.

Okay, I will investigate this further. In the meantime, you can try dumping the code with the --no-macros flag to avoid this error. E.g.

aindump -c -o out.jam --input-encoding GBK --no-macros Rance10.ain
ainedit -c out.jam -o out.ain --output-encoding GBK Rance10.ain

I was able to successfully rebuild the file with ainedit using this workaround. I'm not sure if the rebuilt file actually runs properly however. Let me know if it doesn't.

Thank you! That workaround worked to dump the full code and script in chinese. Hope to see the fix for error message soon.

I believe I have properly fixed this now and I will upload Windows binaries shortly.

New Windows build can be downloaded here: https://haniwa.technology/alice-tools/alice-tools-0.5.1.zip

lcsa commented

I tried the new build but ainedit didn't created new ain file for the chinese version. It works for japanese version ain file.

PS D:\download\alice-tools-0.5.1\alice-tools-0.5.1> .\ainedit -c out.jam -o out.ain --output-encoding GBK Rance10.ain
Parsing...
Encoding...
PS D:\download\alice-tools-0.5.1\alice-tools-0.5.1> .\aindump -c -o out.jam D:\AliceSoft\ランス10\Rance10.ain
PS D:\download\alice-tools-0.5.1\alice-tools-0.5.1> .\ainedit -c out.jam -o out.ain D:\AliceSoft\ランス10\Rance10.ain
Parsing...
Encoding...
Writing AIN file...
PS D:\download\alice-tools-0.5.1\alice-tools-0.5.1>

It doesn't print an error message after "Encoding.."? That's very strange. I was able to run these commands successfully and create a new ain file:

aindump.exe -c -o out.jam --input-encoding GBK Rance10.ain
ainedit.exe -c out.jam -o out.ain --output-encoding GBK Rance10.ain

Was your out.jam dumped from the 0.5.0 version? I don't think it should matter but maybe that could have something to do with it.

lcsa commented

I dumped out.jam again with 0.5.1 version before using the ainedit.
Just now I tried again and it seems ainedit is working as expected with direct generated out.jam file but not with the modified one.
Besides the jam file contains break "\n" string in new line generating Unterminated string literal error which could be fixed manually. I'm not sure if it's caused by my editor.

Yes that sounds like it could be an editor problem. I tried making a small change to out.jam and saving, and it did not cause any problems for me.

You could try dumping to GBK instead of UTF-8 if your editor handles that better. E.g.

aindump -c -o out.jam --input-encoding GBK --output-encoding GBK Rance10.ain
ainedit -c out.jam -o out.ain --input-encoding GBK --output-encoding GBK Rance10.ain

Or maybe it's just the large file size that's causing problems when you save the edited file.

lcsa commented

I compared original and edited jam file in hex mode and found that there is CR character sometimes before \n but it's autofixed to CRLF by vscode when saving.
Although it can't explain why the ain file not generated (I also used vscode with 0.5.0 and met the same problem), It's better for me to change my editor.
Besides, I tried another times, if the edited file contains new string (but not msg) which not exists in the original one, new ain file won't be generated. It doesn't occured with 0.5.0 version.

I have replaced the 0.5.1 zip file here with a fixed version: https://haniwa.technology/alice-tools/alice-tools-0.5.1.zip
Hopefully this fixes both of the issues you mentioned.

lcsa commented

I just had some tests and the second issue is fixed. CR issue still exists but it doesn't matter. Thanks for your effort.