trigger-segfault / TriggersTools.CatSystem2

A library for extracting from and working with the CatSystem 2 visual novel game engine.
MIT License
53 stars 9 forks source link

.FES file extract and repack Catsystem2 engine visual novel #5

Open tbhoang12 opened 3 years ago

tbhoang12 commented 3 years ago

Hi , when i'm using Garbro and extract fes.int in this game (which i'm thinking contains UI images for main menu and battle-gameplay part .hg3 files) >> I got a bunch of .fes files instead and can't extract it using Garbro https://vndb.org/r71356

My question here is how to extract ,edit and then repack .fes files ? I just want to make a simple UI patch to play with Textractor (correct me if I'm wrong about the files contains UI ,because according to online guide I found , the UI images of games using CS2 engine normally is in image.int or sth like that but in this new game I did't see any using Garbro) I can edit the script file scene.int using CatSceneEditor tool but stuck with UI images SKMK English script

trigger-segfault commented 3 years ago

I have a somewhat usable tool cs2_decompile.exe to extract FES (Front End Script) files into a text format. It can be obtained from the Decompile Tool link below, in my research repository.

Links

Decompile

As an example to decompile a single script meswnd.fes in the command line:

C:\>cs2_decompile meswnd.fes
:: CatSystem2 Script Decompiler
::  FES meswnd.fes -> meswnd.txt  (shift-jis)

By default, FES scripts are extracted in their original Shift_JIS text encoding, and it's recommended to keep it that way while modifying.

Modify

Once decompiled, you'll get a file that looks something like this. And they can be pretty massive >.>

Like this ```cpp // [...] #MACRO PX 0 PY 420 VY 720 // [...] #SYSVOICE if ($814>=900) if ($814==900) se2 load se900 if ($814==901) se2 load se901 if ($814==902) se2 load se902 if ($814==903) se2 load se903 se2 play 1 0 break endif if ($781==0) // [...] #OBJECT FILE ID.0 ID.1 ID.2 ID.3 ID.4 ID.5 DISP PL PRI img_autospd $str900 700 701 702 703 704 705 0 pl_base 410 #OBJECT FILE IDN img_font userfont -1 #START deletebgbutton getconf 1026 messpd \110 = $1026 call STRLAYOUT call NAMELAYOUT call WNDALPHA \200 = 1 \201 = 1 \202 = 1 \203 = 1 // [...] ```

The documentation pages linked above should help a bit, but hopefully whatever you need to accomplish isn't too difficult, I haven't done nearly enough research into working with FES scripts. :(

Note: If you find the following in your decompiled FES script: STRING8, LOGSTRING8, NVSTRING8. Then you may run into extra hurdles when de/recompiling the script. I never figured out exactly how CS2 does it, but some FES scripts may contain both Shift_JIS text and UTF-8 text. (but don't bother worrying about that unless you're actually experiencing issues)

Recompile

Once you're done modifications, you can recompile it using the official CS2 devkit tool fes.exe, linked above. If you run into errors or unexpected behavior while compiling, you might need to emulate the Japanese Locale in a command prompt when running the Tool.

C:\>fes meswnd.txt
:: <japanese>(fes)<japanese> fes.exe
:: convert to fes -> C:\meswnd3.txt ... done