/RpaKit

A application for the work on RenPy archives. Decompresses, lists the content or tests the format of a RPA.

Primary LanguagePythonApache License 2.0Apache-2.0

Python Version Ren'Py Version License App_version hits

RPA Kit

RPA Kit is a application for decompressing Ren'Py archives.

It needs as input a target archive-file or a directory wich contains such archives. These will if possible identified and the content of them unpacked in a directory of choice. It is also possible to output a read-only listing of the content or to test, if the format-type of the given archives supported is.

Usage

Command line parameter overview

~$ rpakit.py [-e|-l|-t|-s] [-o OUTPUT] [--verbose] [-version] [-h, --help] target

  • Positional options(required):

    • target Directory path to search OR path of a RPA file to work on.
  • Tasks(one required):

    • -e, --expand Unpacks all stored files.
    • -l, --list Gives a listing of all stored files.
    • -t, --test Tests if archive(s) are a known format.
    • -s, --simulate Simulates the expand process.
  • Optional:

    • -o, --outdir OUTPUT Extracts to the given path instead of standard.
    • --verbose Amount of info output. 0:none, 2:much, default:1
    • --version Shows version information
    • -h, --help Print this help

Example CLI usage

  • rpakit.py -e -o unpacked /home/{USERNAME}/somedir/search_here
  • rpakit.py -t /home/{USERNAME}/otherdir/file.rpa
  • rpakit.py --extract c:/Users/{USERNAME}/my_folder/A123.rpa

rpa_kit.py -e /home/{USERNAME}/otherdir/archive.rpa Will extract every file from archive into the default output directory, making subdirectories when necessary.

rpa_kit.py /home/{USERNAME}/somedir/search_here/ -e -o unpacked Searches RenPy archives in this directory and uncompresses them in the subdir 'unpacked'.

rpa_kit.py -t c:/Users/{username}/my_folder/A123.rpa This will test the given archive for his format and if valide prints it out.

rpa_kit.py -l c:/Users/{username}/game_dir/foo/ --verbose 2 Searches for RenPy archives in this directory and lists their file content in the console. The verboseness was also set to highest level (tell everything).

API

The API is possible not final!

To provide the functionality of Rpa Kit in other projects, the programs classes can be included. Besides the code for CLI use, the core functionality is organized in four classes in diamond inheritance. Short overview of this classes:

class RkMain

Entry class to process args and executing the related methods. Parameters:

  • inpath: str or pathlike, required The archive file-path to open or a directory path with archives. Absolute paths are preferred.
  • task: str, required Sets the wanted task. Possible arguments are exp (expand), lst (listing), tst(testing), sim(simulate)
  • outdir: str or pathlike, optional Sets the name of the output directory. If None the default is used.
  • verbose: int, optional Print info about what we are doing. Values: 0-2; Defaults to 1

class RkDepotWork

This class is the apps core for analyzing, testing and unpacking/decoding RPA files. All needed inputs (depot, output path) are internaly providet.

This class holds also two important dicts with the informations about the RPA formats. Here can be easily additional formats configured.

class RkPathwork

Support class for RPA Kit's path related tasks. Needet inputs (file-/dir path) are internaly provided. If input is a dir it searches there for archives, checks and filters them and puts them in a list. A archiv as input skips the search part.

If wanted, users can do the path preparations in some other way/place and provide the archives itself to the other classes, instead with use of this one.

class RkCommon

Simple base class to provide some shared methods and variables for the other classes.

Motivation - Why this project?

This started 2017 as another learning experience in Python and and to understand a bit more about RenPy internals. So i needed a project for this.

Some of the goals where:

  • Input as a directory with rpa files instead just a file
  • Easy extensibility for new formats
  • Support for more rpa formats
  • Additional info output

In the future there will possibly other changes if time allows it and motivation at the same time on a high is. Possible changes could be:

  • Info output with classic logging
  • Format specs and some mechanics move to dedicated classes per type

Legal

License

RPA Kit is licensed under Apache-2.0. See the LICENSE file for more details.

Disclaimer

This program is intended for people who have the legal rights or the consent of the target app authors to access or decompress the archive files. Any illegal or otherwise unindented usage of this software is discouraged and unsupported.

Credits

This software was developed with some orientation on RenPy's and rpatool's code for the work with RPA files. Credits for the development of the RenPy archive format belong to the contributors of the Ren'Py project.