
Ren'Py引擎rpa文件的解包与反编译
Unpacking and decompilation of rpa files for the Ren'Py engine
Ren'Py is a visual novel engine – used by thousands of creators from around the world – that helps you use words, images, and sounds to tell interactive stories that run on computers and mobile devices. These can be both visual novels and life simulation games. The easy to learn script language allows anyone to efficiently write large visual novels, while its Python scripting is enough for complex simulation games. Ren'Py is open source and free for commercial use.
.rpa
解包
我使用的是unrpa,具体用法可查看作者文档。
使用pip安装(需要python3):py -3 -m pip install unrpa
CLI用法如下:
1 | usage: unrpa [-h] [-v] [-s] [-l | -t] [-p PATH] [-m] [--version] |
一般我个人比较常用的就是unrpa -mp "PATH\TO\DEST" "PATH\TO\archive.rpa"
,其中-m
表示若目标路径不存在则创建该路径;当然如果已经cd
到目标目录那就执行unrpa "PATH\TO\archive.rpa"
即可。
反编译
此时解包出来的文件通常为.rpyc
,也就是经过Ren’Py编译.rpy
源码之后产生的文件,为了修改内容,此时就需要对其进行反编译。我用的是unrpyc,作者提供了命令行工具以及一个自动化的un.rpyc
工具(作者发布的release就是un.rpyc
,想要用CLI还需要自己去下源码)。
由于电脑上没安装python2(懒,所以本文使用的是基于python >=3.9
的unrpyc v2.0.2
。并且v2只支持 Ren’Py 8 以上,若是低版本还需安装v1(当然实际用下来好像没什么问题
对于命令行工具,我一般使用的命令为python unrpyc.py -c *.rpyc
,即直接反编译当前目录下所有.rpyc
文件,并使用-c
选项覆盖已存在的.rpy
文件。详细的选项在文档中也有给出,此处便不一一赘述,就贴一下--help
罢。
1 | $ py -3 unrpyc.py --help |