Inori / FuckGalEngine

My tools to crack galgame
822 stars 146 forks source link

AdvHD - new Willplus script pattern #5

Closed mireado closed 8 years ago

mireado commented 8 years ago

I'm trying to convert 見上げてごらん、夜空の星を 体験版 script to txt. (unpacking arc works well)

command prompt looks working well. but, converted txt have 0 size or txt file doesn't existed output folder. I think pattern might be changed.

this is Rio.arc file on 見上げてごらん、夜空の星を 体験版 http://www.mediafire.com/download/0u8puf8izancdal/Rio.arc

sgqy commented 8 years ago

Maybe you need this first:

ahdprc ror -n 2 *.ws2

But, this tool seems old and I did not write an English document, so sorry for that. Here is my new code:

AdvHD/ws2.cpp

After you extracted the RIO.arc and get .ws2 files, you can use this code to deal with the text. Here is some usage:

#define PROC 1 // ROR every byte with 2 bit in ws2 files to decrypt
#define PROC 2 // Export the text for translationg (output: Shift_JIS, the same as source)
//#define CCR // This is designed for anothor game, you should not enable it

You should compile with PROC==1, decrypt the ws2 files; then compile with PROC==2, export the text. (This code should compiled by Microsoft Compiler / Visual Studio, for there is a "wmain" to support unicode filename.)

mireado commented 8 years ago

http://imgur.com/mQcpz42

build error... actually, I have small knowledge on programming... can you please help me.. T_T

sgqy commented 8 years ago

1 Just check this option and it will work :)

mireado commented 8 years ago

THX >_< btw.., i'm not sure building works well. Imgur http://www.mediafire.com/download/v36z66o1viebzrf/ws2.exe

I don't know what should i do. is need some special step to compile with 'define PROC'?

... sorry to bother you again.. T_T

sgqy commented 8 years ago

This instruction uses a simple extract tool: http://asmodean.reverse.net/pages/exoozoarc.html My own codepage converter: https://github.com/sgqy/wcpc/releases


Prepare the files:

all files in rio.arc will be put in ws2out 1

Filt the fiction

copy the story files into folder yozora 2

Decrypt files

you should compile ws2.exe with

#define PROC 1

3

Get the text

you should compile ws2.exe with

#define PROC 2

4 now what you want is put in the folder text

(Optional) Convert text to unicode

5 unicode can avoid garbled text open text directly in codepage 1252: 6

How about korean encoding?

just select one of the two commands ~ 7 some characters are not defined in korean encoding maybe you need this operation after translating the story into korean 8

How to compile with...?

don't worry, just change the value and compile ~ 9

mireado commented 8 years ago

god.... THX >< thank you for detail explanation it really works well. god... >< sorry for my poor english.. I don't have word that explain this kind explanation.

mireado commented 8 years ago

btw., when repackaging these file. Is it OK using this command?

ahdprc ror -n 2 INFILE -o OUTFILE ahdprc ws2 -i IN -t TXT0 -b BIN0 ahdprc rep -l LIST FILE1

sgqy commented 8 years ago

the outputed script format is new defined. it do not fit with adhprc. but i have not written an importing code. (:з」∠) for i have a translating project, so the importing code maybe later

mireado commented 8 years ago

aha. Ok. anyway, thank you for kind explanation again >_<

marcussacana commented 8 years ago

@sgqy Thanks for your source... Apparently you don't write a import string code correct?... I write my own tool to translate this format, thanks for the info about this engine ^^ https://github.com/marcussacana/WillPlusManager

sgqy commented 8 years ago

@marcussacana nice work! but there is an issue, appears in the script, which has route selection 1 2 i used spaces to fill the lines

    internal class CCRLine
    {
        public int order;

        public int offset_text = -1;
        public int srclen_text = -1;
        public string src_text;
        public string dst_text;

        public int offset_chara = -1;
        public int srclen_chara = -1;
        public string src_chara;
        public string dst_chara;

        public void ReplaceChara(Dictionary<string, string> dic)
        { try { dst_chara = dic[src_chara]; } catch { } }
    }
// ... ... ...
        private List<CCRLine> content = new List<CCRLine>();
        private static Encoding enc = Encoding.GetEncoding(936, new EncoderReplacementFallback("_"), new DecoderReplacementFallback("_"));
// ... ... ...
        private void FitLength()
        {
            // 1. calculate the diff of every line
            var errorList = new List<int>();

            for (int i = 0; i < content.Count; ++i)
            {
                var charaError = 0;
                if (content[i].srclen_chara != -1)
                    charaError = content[i].srclen_chara - enc.GetByteCount(content[i].dst_chara);
                var textError = content[i].srclen_text - enc.GetByteCount(content[i].dst_text);
                errorList.Add(charaError + textError);
            }

            // 2. balance the diffs
            int fit = 0;
            for (int i = 0; i < errorList.Count; ++i)
            {
                if (errorList[i] >= (-fit))
                {
                    errorList[i] += fit;
                    fit = 0;
                }
                else
                {
                    fit += errorList[i];
                    errorList[i] = 0;
                }
            }

            // 3. check the total diff
            if (fit != 0) throw new Exception("Translation is too long");

            // 4. apply the modification
            for (int i = 0; i < content.Count; ++i)
            {
                content[i].dst_text += new string(' ', errorList[i]);
            }
        }

it seems ugly, right? xD if the scenario is translated into english (lines longer than japanese), this solution is very... uh

so, here is another solution(?), AdvHD/dynamic now debugging, dealing with memory leak xD maybe i will write a version, which draw the modifyed text directly (results a multi-language game)

marcussacana commented 8 years ago

@sgqy you can send this script of the screenshot for me see here?

marcussacana commented 8 years ago

and this "values" is "jump point" in the script... shit... i don't know a way to detect this values... is allways after or before a "bytecode"? or "route option string"? this is bad... without edit this don't works...

sgqy commented 8 years ago

cocoro_com_004.zip @marcussacana Um... This file includes the branches. I tried a bit to modify the address months ago, and game crashed xD.

Veshurik commented 7 years ago

Found this thread and try to understand what to do to extract the .ws2 script from Ensemble game... And... I can't understand, really. Maybe, because I'm zero in programming.

Can anyone explain me "for noobs"? (I just don't want to paste the every line of script from VNR, it's madness). Thanks!

otomelo_scenario.zip

sgqy commented 7 years ago

get_ws2_text.7z.pdf @Veshurik You are just in time. I've packed the tools in a single 7z ball months ago. Rename get_ws2_text.7z.pdf to get_ws2_text.7z then extract it.

Veshurik commented 7 years ago

@sgqy I tried to extract, but something goes wrong. The system cannot find the file specified. And (No such file or directory). And "pause"... And the folder "text" is empty.

ghost commented 7 years ago

@Veshurik In the readme of sgqy's archive, what you need to do is just drag your Rio.arc file to the gettext.bat and then in the text folder is your text. Be sure that the tools has privilege to write. But I see you have already extract the Rio.arc and get the ws2 files. What you need to do next is decrypt the ws2 file and extract the text. How about this tool ? https://github.com/marcussacana/WillPlusManager My binary is here: WillPlusManager.zip.pdf rename the .pdf to .zip.

0xh3LL0 commented 7 years ago

tried sgqy tools with veshurik game scenario, ror the scenario seem fine, the file is readable with hex (rather that random gibberish from original file), but when the t command launched, its gave me error... when i launch t it says: me infile outfile addrfile so, what / which one is addr file? also, @sgqy is your tools possible to revert back from txt to ws2?

ghost commented 7 years ago

@0xh3LL0 As I know, addr file is the output of the tools you used. You can read the code in this repo/AdvHD/ws2.cpp.

if (argc < 3)
{
#if PROC == 1
        printf("<me> <infile> <outfile>\n");
#elif PROC == 2
        printf("<me> <infile> <textfile> <addrfile>\n");
#endif
        return 0;
}

The reason why you met the error msg, is that you didn't run the program correctly. t program is a commandline tool, you need launched it like: t input.ws2 output.txt output.addr to identify the output text and output addr file. Maybe the addr file is for reverting back. But as far as I know, ws2.cpp does not have revert feature. Currently speaking, https://github.com/marcussacana/WillPlusManager will be a convenient tool according your demand.

Veshurik commented 7 years ago

About WillPlusManager - that's a good tool. But editing every line and save every time can be very exhaustingly. And I don't talk about font in game (will they support necessary letters or not). And names doesn't appear in text. It's like SCN Editor for Kirikiri - works but "dreary". Anyway, thanks.

ghost commented 7 years ago

@Veshurik Well, WillPlusManager is a good tool, but for me it's also not convenient. The most valuable part is the code. Like most code in this repo, it give us the clue about the game. Understanding others code and writing your own tool will be more comfortable.

marcussacana commented 7 years ago

My tool is intentionally not convenient. I wrote them keeping in mind "If you want to translate your games, work on them!". You can see that my tools come separately in a DLL and an EXE, why this? Why I want the one who want translate learn how to create your tool to edit the scripts, I gave the DLL that does all the dirty work ... he needs to simply observe the GUI Source Code and write a tool to export to .txt... ...Why I do this? First as an attempt to promote newbies in the programming world, creating new hackers and consequently generating new tools for the community... but all I see is this... people giving up for this silly limitation... If your problem is the GUI just try wrote your tool you need in the max 10 basic commands to make my DLL import the strings and your code export to .txt! it's very easy, try learn, this is what i want...

marcussacana commented 7 years ago

WillPlusManager don't can extend strings length, i really don't like of this my tool :/

Veshurik commented 7 years ago

Agh... Eroge engines never be such easy for translations. Japanese is really sadists.

ghost commented 7 years ago

@sgqy 想问一下菊苣上面用的hex editor具体叫什么名字?

Inori commented 7 years ago

@Neroldy CrystalTile2

ghost commented 7 years ago

@Inori Thanks~

sgqy commented 7 years ago

@Veshurik Sorry for late reply. You can make a folder named rel beside of gettext.bat and copy the ws2 files into it. then double hit gettext.bat

Veshurik commented 7 years ago

@sgqy You're the best! It works! Brilliant! Hah, finally! Now I wonder, why every line in script has a second copy (with ##). And how to translate them - just copy or leave one of line. Anyway, thanks!

sgqy commented 7 years ago

@Veshurik Using double line format is because we let translating work go 2-pass. Many translators do first pass, then experienced do second, with original text in the file.

(##) label is used to fit this editor: https://github.com/regomne/lneditor (No English version) They can also be deleted by wildcard/regex replacing.

ghost commented 7 years ago

Well, here might be another new code for ws2. https://github.com/Neroldy/chinesize/blob/master/AdvPlayer/extWs2/extws2.go

Veshurik commented 7 years ago

@sgqy Like that? 23

sgqy commented 7 years ago

@Veshurik That is!

PurpleGeeZ commented 7 years ago

@sgqy i used your "get text" tool , works perfectly well. The only issue is that i dont know how to make these .txt files back .ws2. I need to do the opposite process otherwise the game i'm trying to translate won't read changed file, i suppose. Would be grateful for your help or advice

marcussacana commented 7 years ago

you can just overwrite the .ws2 strings, but looks he don't update the jump points, generating corrupted scripts... this is the reason to my tool don't allow extend the length size. To this engine, in my projects i create soft-translation patchs

PurpleGeeZ commented 7 years ago

@marcussacana your VNX+ tool seems to be working well but I have some questions.

What does the "/n" mean ? This "N" letter shows almost in every line of the text. IDK if I can delete it or not.

Also , Im still looking for a way to do the opposite proсess (.txt convert to .ws2) because it's not convenient for me to translate the text from your tool , it would be cool for me to convert these .ws2 file to .txt then translate them and finally convert them back to .ws2. Is this possible?

marcussacana commented 7 years ago

@PurpleGeeZ /n = new line This is a/nsample In game:

this is a
sample
KiritoCy commented 6 years ago

Idk if anyone is still active here but i need a favor.... Can anyone fix me these scripts to be actually readable? They are also .ws2 and use the same engine as yr talking about but they are from an append disk, which tend to come as a folder with them in it instead of an archive.. http://www.mediafire.com/file/dm84i00y0pztvv9/Golden+Marriage+Append+Scripts.rar

Veshurik commented 6 years ago

Eh, well... I need a help again.

If I create folder "rel" and gettext.bat, then files becomes 0Kb...

And... if I drag Rio.arc on .bat, it shows /pause and "click on any button"... That is all. What is wrong?

sgqy commented 6 years ago

@KiritoCy

get_ws2_text.7z.pdf

extract the pack, make folder rel in it. put the content of the folder into rel folder, invoke gettext.bat. it maybe works, i have not tried.

@Veshurik see content of gettext.bat, maybe you should go step by step in it. the file does extract(exoozoarc) -> decrypt(ror.exe) -> filt text(t.exe) after ror.exe: if open ws2 by CP932, you can see clear text, but get 0KB text, maybe it is using different style. if open ws2 by CP932 but no clear text, it may using different encrypt.

jpo05 commented 3 years ago

i am pretty new to these stuff, I don't know if it's too late....

i was able to get the txt files, made some translation fix (For personal use) but i'm struck on how to change the txt files back to ws2?

Can someone please be kind and explain me 2 things

1)How to get the txt files back to ws2? 2)How to put the ws2 files back into the Rio.arc file?