YuriSizuku / GalgameReverse

Reverse Projects for Galgame
273 stars 19 forks source link

Criware iwaihime (translate) #2

Closed Kaii-h closed 2 years ago

Kaii-h commented 2 years ago

Hello. We want to translate the game into Russian. It is clear from the past problem that we will have to count the length of the string and change it. But so far, apart from fonts, I ran into a problem with starting "iwaihime_pc_decrypt.c". I tried to compile a program in visual studio 2022, but the entry "iwaihime_pc_decrypt.exe sn.bin" does not create in the same folder "out.bin", although it looks like something happens. What could be the problem?

And "xtx_font.py" with the command "xtx_font.py e font48.xtx" gives an error "Traceback (most recent call last): C:\Users\Andrey\Downloads\GalgameReverse-master\GalgameReverse-master\src\criware\xtx_font.py" file, line 170, in . main() File "C:\Users\Andrey\Downloads\GalgameReverse-master\GalgameReverse-master\src\criware\xtx_font.py", line 146, in main xtx_font_build(os.sys.argv[2], outpath) File "C:\Users\Andrey\Downloads\GalgameReverse-master\src\criware\xtx_font.py", line 122, in xtx_font_build height, width = gray.shape AttributeError: 'NoneType' object has no 'shape' attribute". Maybe the wrong version of python?

YuriSizuku commented 2 years ago

Thank you for the questions.

For the first question. I think the "out.bin" is in the same directory of sln file if you start the exe from the vs2022.

As for the second question, I am sorry I make a mistake in the help information. In xtx_font, 'e' means 'encode', 'd' means 'decode'. It should be as below: print("xtxfont d xtxpath [pngpath]") print("xtxfont e pngpath [xtxpath]")

imKota commented 2 years ago

@Kaii-h about font. Iwaihime originally supports Russian. So you don't need to edit the font.

image

Kaii-h commented 2 years ago

Thank you for the questions.

No, thank you for the utilities.

For the first question. I think the "out.bin" is in the same directory of sln file if you start the exe from the vs2022.

Platform x32. SubSystem Console(/SUBSYSTEM:CONSOLE). Compile as C Code (/TC). #pragma warning(disable : 4996) - because compiler warns about unsafe functions. Created in "C:\Users\Andrey\source\source\repos\Project1\Debug\iwaihime_pc_decrypt.exe" where I dropped sn.bin. I open cmd and that's it. 111

As for the second question, I am sorry I make a mistake in the help information. In xtx_font, 'e' means 'encode', 'd' means 'decode'. It should be as below: print("xtxfont d xtxpath [pngpath]") print("xtxfont e pngpath [xtxpath]")

I did that and it worked. Somehow I didn't think to do it that way.

Kaii-h commented 2 years ago

@Kaii-h about font. Iwaihime originally supports Russian. So you don't need to edit the font.

image

Yes, I noticed when the font was converted to a picture. The set is unicode, like in Blazblue. By the way, did you solve the string problem? Either manually or by software to put all the lengths.

YuriSizuku commented 2 years ago

Thank you for the questions.

No, thank you for the utilities.

For the first question. I think the "out.bin" is in the same directory of sln file if you start the exe from the vs2022.

Platform x32. SubSystem Console(/SUBSYSTEM:CONSOLE). Compile as C Code (/TC). #pragma warning(disable : 4996) - because compiler warns about unsafe functions. Created in "C:\Users\Andrey\source\source\repos\Project1\Debug\iwaihime_pc_decrypt.exe" where I dropped sn.bin. I open cmd and that's it. 111

As for the second question, I am sorry I make a mistake in the help information. In xtx_font, 'e' means 'encode', 'd' means 'decode'. It should be as below: print("xtxfont d xtxpath [pngpath]") print("xtxfont e pngpath [xtxpath]")

I did that and it worked. Somehow I didn't think to do it that way.

I think this is because you build the program in x64 mode.
These defines only works on x86 mode.

typedef unsigned int DWORD; typedef unsigned char BYTE;

Kaii-h commented 2 years ago

I think this is because you build the program in x64 mode. These defines only works on x86 mode.

typedef unsigned int DWORD; typedef unsigned char BYTE;

Ah, if only that were a problem. Or is there somewhere else to change the bit depth? 1111

YuriSizuku commented 2 years ago

I think this is because you build the program in x64 mode. These defines only works on x86 mode. typedef unsigned int DWORD; typedef unsigned char BYTE;

Ah, if only that were a problem. Or is there somewhere else to change the bit depth? 1111

The sizeof(int)=8 in x64 mode, else 4 in x86 mode. I think you can use 'int32_t' instead of 'int', if you want to build on x64 mode. This length is always 4.

Kaii-h commented 2 years ago

The sizeof(int)=8 in x64 mode, else 4 in x86 mode. I think you can use 'int32_t' instead of 'int', if you want to build on x64 mode. This length is always 4.

If I replace it with "typedef int32_t DWORD" (or uint32_t), nothing changes when compiling to x32, but when compiling x64, out.bin appears in a separate folder for x64, but the file is empty. Without stdint.h it won't compile at all. I have only messed with programming in industrial programmable controllers. Don't judge strictly for bluntness in the easiest one.

YuriSizuku commented 2 years ago

The sizeof(int)=8 in x64 mode, else 4 in x86 mode. I think you can use 'int32_t' instead of 'int', if you want to build on x64 mode. This length is always 4.

If I replace it with "typedef int32_t DWORD" (or uint32_t), nothing changes when compiling to x32, but when compiling x64, out.bin appears in a separate folder for x64, but the file is empty. Without stdint.h it won't compile at all. I have only messed with programming in industrial programmable controllers. Don't judge strictly for bluntness in the easiest one.

Actually I can not reproduce your result. If you still have some problems, please try to use this vs2022 project. I just modify a little to supoort both x86 and x64.

Iwaihime.zip

Kaii-h commented 2 years ago

Actually I can not reproduce your result. If you still have some problems, please try to use this vs2022 project. I just modify a little to supoort both x86 and x64.

Iwaihime.zip

Something is wrong with my visual studio 2022 installation or with windows 10. As your exe files (10 kilobytes) when running in console - gives the same emptiness. If I recompile - the exe files are 40 kilobytes, but the same void. If I run it through debugging, it does nothing giving exit code 0 (it used to be -1). If I run the exe in win7, the 10k file crashes immediately and the 40k requires vcruntime140d.dll and then probably crashes too.

imKota commented 2 years ago

@Kaii-h try this iwaihime_pc_decrypt.zip

builded with clang clang iwaihime_pc_decrypt.c -o iwaihime_pc_decrypt.exe

By the way, did you solve the string problem? Either manually or by software to put all the lengths.

Nope, since all our translators are busy right now. But I think if you ask @YuriSizuku, he will help you :)

imKota commented 2 years ago

@YuriSizuku lol, problem in game release. @Kaii-h using english release Iwaihime.

l/0.m (it's japanese sn.bin)
l/1.m (it's english sn.bin)
l/2.m (it's chinese simplified sn.bin)
l/3.m (it's chinese traditional sn.bin)

image image image image

You need use l/1.m :)

Kaii-h commented 2 years ago

@Kaii-h try this iwaihime_pc_decrypt.zip

builded with clang `clang iwaihime_pc_decrypt.c -o iwaihime_pc_decrypt.exe

You wouldn't believe it. The program creates a file that weighs 0 bytes. Maybe my sn.bin is wrong? Or something in windows? sn.zip

111

Nope, since all our translators are busy right now. But I think if you ask @YuriSizuku, he will help you :)

I'll probably ask a guy who did the same character count for blazblue to do it here as well. Only the file has to be split up properly. And there are already doubts that 6A is the length of the text because it is repeated everywhere in that out.bin, which would be in the archive Iwaihime.zip.

imKota commented 2 years ago

Maybe my sn.bin is wrong?

My comment is above;)

Kaii-h commented 2 years ago

My comment is above;)

For some reason I thought "l/1.m" was "1/1.m" and couldn't match the game files... I.e. rename 1.m to sn.bin convert and it works? Yes, it works. The program from respected @YuriSizuku works. And the packaging? But the question remains where are the lengths of text? Should I dig to these A0, A1 at the beginning of the file or somewhere else? It doesn't seem to make sense to change the A9...

Kaii-h commented 2 years ago

Oh no. I probably fumbled with how the string length is calculated. And I don't like it very much. 00A0 (40960) next 0CA0 (40972) - the difference between these numbers is the text length -1. And on and on and on...

Kaii-h commented 2 years ago

To encode "remove the first 0x4 bytes, use lzss to "encrypt"" - something doesn't work, or am I doing it wrong again. Parameters of lzss

define N 4096 / ring buffer size /

define F 18 / upper limit for match_length /

define THRESHOLD 2 / encode string to position and length if match_length is greater than this /

define NIL N / index for the root of the binary search tree /

It kind of encodes (size is the same), but the game doesn't see it.

Kaii-h commented 2 years ago

@Kaii-h tell me your relegram or discord

Kaii-h#1761 - I am on mangadex or ruranobe or novel.tl servers.

Berthog commented 2 years ago

Sorry to ask here, but is there any way to extract and repack the images files in sys.cpk? I find it too complicated for me, I've tried so many times in so many ways and I can't get it. The images in sys.cpk are system image (configuration system, title menu and etc).