diff --git a/.gitignore b/.gitignore index eed8bdf..1e683eb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ *.pyo *.rpy *.rpyc -*.txt __pycache__ /build /dist diff --git a/Pipfile.lock b/Pipfile.lock index 3a24309..f703afd 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -122,11 +122,11 @@ }, "idna": { "hashes": [ - "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4", - "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2" + "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca", + "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f" ], "markers": "python_version >= '3.5'", - "version": "==3.4" + "version": "==3.6" }, "ratelimit": { "hashes": [ diff --git a/README.md b/README.md index 5acf9b6..e43dad0 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,14 @@ A tools for decompiling and translating Ren'py compiled script files (.rpyc and .rpymc). -## Features +## How it works -- Decompile for Ren'py compiled script files .rpyc to .rpy files. -- Automatic scan translations in scripts and translate to target language (default using Google Translate). +All rpyc files are compiled from rpy files, renpy SDK read every file and parse it to AST object(renpy), and then use pickle to serialize the AST to rpyc file. So we use pickle to deserialize the rpyc file to AST, and then restore the rpy file from AST. + +We created a fake "renpy" package(unlikely unrpyc) and it's ast objects to make the pickle can be deserialized correctly. +Another reason to create a fake "renpy" package is that we can separate code generate logic (the `get_code(...)` function) to each AST object, it will be easier to future maintain and for multi-version renpy support. + +The most difficult part is generating the rpy file from AST. Different renpy version has different AST structure also different grammar. ## Usage @@ -43,6 +47,18 @@ Use pipenv to manage dependencies: pipenv install --dev ``` +## Contributing + +Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. + +## FAQ + +- **Q: It always raise pickle `import ** \nModuleNotFoundError: No module named '***'` error.** + + A: It's because the our fake packages("renpy","store") is not contains the object you want to decompile. Please open an issue and tell us the renpy version and the rpyc file you want to decompile. Join our telegram group to get help also be better. + ## Community +Welcome to join our community to discuss and get help. + - [Telegram Group](https://t.me/rpycdec) diff --git a/pyproject.toml b/pyproject.toml index b63a385..c80b535 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [build-system] -requires = ["hatchling","hatch-vcs"] +requires = ["hatchling", "hatch-vcs"] build-backend = "hatchling.build" [project] name = "rpycdec" -authors = [{ name = "cnfatl", email = "cnfatal@gmail.com" }] +authors = [{ name = "cnfatal", email = "cnfatal@gmail.com" }] description = "A tool to decrypt .rpyc files" readme = "README.md" requires-python = ">=3.7" @@ -15,7 +15,10 @@ classifiers = [ "Operating System :: OS Independent", ] dynamic = ["version"] - +dependencies = [ + "requests", + "ratelimit", +] [project.urls] "Homepage" = "https://github.com/cnfatal/rpycdec" "Bug Tracker" = "https://github.com/cnfatal/rpycdec/issues" @@ -27,7 +30,7 @@ rpycdec = "rpycdec:main" exclude = ["/.github", "/docs"] [tool.hatch.build.targets.wheel] -packages = ["renpy", "."] +packages = ["renpy", "store", "rpycdec.py"] [tool.hatch.version] source = "vcs"