A decompiler and compiler for the Yu-Ris engine, with parallelism.
Tested on v488 Natsuzora Asterism and v494 official example
pip install murmurhash2 xor-cipher deflate
See v494.py
Remeber to use multiprocessing.freeze_support() in your main:
from multiprocessing import freeze_support
if __name__ == '__main__':
freeze_support()
# Your Code Goes HereDownload 0.494 official sdk, use YSPac to pack all folders under システム/data/
Then copy data.ypf into example.
Also copy yscfg.dat, yu-ris.exe, エンジン設定.exe.
example
├── data.ypf
├── v494
├── v494-work
├── v494.ypf
├── yscfg.dat
├── yu-ris.exe
└── エンジン設定.exe
Run yu-ris.exe.
- Parallel
Actually, after parsingglobal.ystandglobal_f.ysts, all other.ysts can be compiled individually thus in parallel. After which, the compiler assign indices to variables and fill them into YSTB's code section, then compress YBN files and create YPF archive. The filling-in and compress step is also run in parallel.
To compare, Natsuzora Asterism's scripts takes around 50 seconds on the official YSCom (also 48 seconds when disabled parallelism on Yuri) on my machine. It only takes 10 seconds with parallelism enabled (12 core).
- read global.yst.yuri and global_f.yst.yuri(s)
- [parallel]: compile .yst.yuri files
- assign indices to variables
- [parallel]: fill indices into YBN and compress YBN
-
Fast
Actually, the 48 seconds above also include compressing YBN files, while YSCom's 50 seconds only include compiling YBN. -
Incremental
As long as relatedglobalandglobal_fdo not change, a YST does not need to be recompiled if its source doesn't change.
Also, as long as the code does not change (only add/del empty lines, comments), a YBN does not need to be re-compressed.
After an initial full compilation, subsequent compilations usually only takes a few seconds.
-
No
global.ystandglobal_f.ystentries inyst_list.ybnThe offical compiler writes an entry with
nvar=-1forglobal.ystinyst_list.ybn.
Official YSCom treatsglobal_f.ystlike normal scripts.
But Yuri does not leave entries nor create YBN for them at all. -
No
S_INT/S_FLT/S_STRcommands in YBN filesThe official compiler emits them, but actually they never get executed. Even the author himself recommends putting them out of execution path. So I skipped them completely, leaving only local INT/FLT/STR commands. They are still in ysv.ybn files
This two differences lead to that one cannot compile the code directly if they
run the decompiler again on the compiled YBN files (need to add G_/S_/F_ by themselves)
patch_text.py in the root folder has two functions: ext_text, pat_text. They are used to extract(ext) and edit(pat) text in .yuri files (dialog line only). Both their arguments are (.yuri directory, text directory). As usual, freeze_support is needed.
gbk.py has a patch_exe(infile, outfile) function, it makes the Yu-Ris exe uses gbk instead of shiftjis. modifed from https://github.com/jyxjyx1234/YURIS_TOOLS/blob/main/GBK.py
