• Stars
    star
    528
  • Rank 83,345 (Top 2 %)
  • Language
    Python
  • License
    Do What The F*ck ...
  • Created about 12 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tool to work with Ren'Py archives.

rpatool

This is a simple tool allowing you to create, modify and extract Ren'Py Archive (.rpa/.rpi) files. Currently, only writing to RPAv2/RPAv3 archives is supported.

Usage

rpatool [-l|-x|-c|-d|-a] [-o OUTFILE] [-2] [-3] [-k KEY]
        [-p COUNT] [-h] [-v] [-V]
        ARCHIVE [FILE [FILE ...]]


positional arguments:
  ARCHIVE               The Ren'py archive file to operate on
  FILE                  Zero or more files to operate on

actions:
  -l, --list            List files in archive ARCHIVE
  -x, --extract         Extract FILEs from ARCHIVE
  -c, --create          Creative ARCHIVE from FILEs
  -d, --delete          Delete FILEs from ARCHIVE
  -a, --append          Append FILEs to ARCHIVE

optional arguments:
  -o OUTFILE, --outfile OUTFILE
                        An alternative output archive file when appending to or
                        deleting from archives, or output directory when extracting.
  -2, --two             Use the RPAv2 format for creating/appending to
                        archives
  -3, --three           Use the RPAv3 format for creating/appending to
                        archives (default)
  -k KEY, --key KEY     The obfuscation key used for creating RPAv3 archives 
                        (default: 0xDEADBEEF)
  -p COUNT, --padding COUNT
                        The maximum number of bytes of padding to add between
                        files (default: 0)
  -h, --help            Print this help and exit
  -v, --verbose         Be a bit more verbose while performing operations
  -V, --version         Show version information

The FILE argument can optionally be in ARCHIVE=REAL format, mapping a file in
the archive file system to a file on your real file system. An example of
this is: rpatool -x test.rpa script.rpyc=/home/foo/test.rpyc

Examples

rpatool -x foo.rpa

Will extract every file from foo.rpainto the current directory, making subdirectories when necessary.

rpatool -o output -x foo.rpa script.rpyc ui.png

Will extract the files script.rpyc and ui.png from foo.rpa into the directory output.

rpatool -c bar.rpa test.jpg script.rpy sprites

Will create the archive bar.rpa, containing the files test.jpg, script.rpy and the directory sprites.

rpatool -p 25 -k 12345 -c bar.rpa movies=C:\projects\vn\movies

Will create the archive bar.rpa with the obfuscation key 0x12345 and maximum padding of 25, taking files from C:\projects\vn\movies and placing them in the archive folder movies.

rpatool -l baz.rpa

Will list all files in the archive baz.rpa.

rpatool -v -a foo.rpa sprites=sprites_new

Will add all files from the directory sprites_new to the directory sprites in the archive, giving more information about what it's doing.

rpatool -o bar_new.rpa -d bar.rpa foo.jpg

Will remove the file foo.jpg from the archive bar.rpa, storing the result archive in bar_new.rpa.

API

rpatool can also be included in any other project (following the license conditions, of course) to provide the RenPyArchive class. A small overview:

RenPyArchive([file = None], [version = 3], [padlength = 0], [key = 0xDEADBEEF], [verbose = False])

The constructor, which will optionally load an archive file.

file: the archive file to open. If None, no archive will be attempted to open.

version: the archive format version used to save the archive when RenPyArchive.save([file]) is called. Default: 3

padlength: the maximum number of bytes of padding to put between files when saving. Default: 0

key: the obfuscation key used when saving RPAv3 archives. Default: 0xDEADBEEF

verbose: print info on what we are doing to the command line. Default: False

RenPyArchive.load(filename)

Loads an archive file from filename. Will raise an IOError if the file can't be accessed, or a ValueError if the file is not detected as a Ren'Py archive.

RenPyArchive.save([filename])

Save the archive to filename. Will raise ValueError if the filename isn't given with filename, nor previously defined, or an IOError if it couldn't save the file.

RenPyArchive.list()

Give a list of all filenames currently in the archive.

RenPyArchive.has_file(filename)

Returns True if filename is found in the archive, False otherwhise.

RenPyArchive.add(filename, content)

Add a file to the archive with file filename and contents content. Will raise a ValueError if the filename already exists in the archive.

RenPyArchive.change(filename, content)

Change the contents of a current file in the archive. Will raise an IOError if the file isn't known in the archive.

RenPyArchive.remove(filename)

Remove filename from the archive. Will raise an IOError if the filename isn't known in the archive.

RenPyArchive.read(filename)

Read and return the content of file filename in the archive. Will raise an IOError if the filename isn't known in the archive.

License

rpatool is licensed under the WTFPL. See the LICENSE file for more details.

Disclaimer

This tool is intended for use with files on which the authors allowed modification of and/or extraction from ONLY and the unpermitted use on files where such consent was not given is highly discouraged, and most likely a license violation as well. Support requests for help with dealing with such files will not be answered.

Credits

Credits for the creation of the Ren'Py archive format and the reference code in Ren'Py go to renpytom.

More Repositories

1

pydle

An IRCv3-compliant Python 3 IRC library.
Python
153
star
2

arcade-docs

Open arcade documentation repository
98
star
3

unimgc

HDD Raw Copy Tool IMGC format tools
C
57
star
4

smol

Shoddy minsize-oriented linker
Python
54
star
5

renpy2linux

Convert a Windows Ren'Py-based game into a Linux-compatible one.
Shell
27
star
6

res1gn

Simple pure-software System ES1 exploit
Shell
18
star
7

liner

Linux demoscene starter kit
Makefile
17
star
8

img4

various low-level Apple data structure tools
Python
14
star
9

restruct

Declarative binary file format parser and emitter library
Python
9
star
10

gfxi

PC-98 graphics library.
C
9
star
11

grsecurity-research

Shell
8
star
12

nene

Broadcast your currently watching shows to Discord!
JavaScript
7
star
13

binja-depanalyzer

Binary Ninja plugin to analyze dependencies in greater depth
Python
6
star
14

libgface

A library to easily include gface support in your application. Requires a gface license.
Python
5
star
15

reversion

Fix boobytrapped macOS system libraries
C
4
star
16

destruct

Declarative binary and text format parsing.
Python
4
star
17

mpv-ipc.js

Javascript IPC client for mpv
JavaScript
4
star
18

clippy

Easy Python clipboard management.
Python
3
star
19

dyld

Upstream dyld source hacked to compile with non-internal SDKs
C
3
star
20

seven-proxies

good luck finding me, I'm behind 7 proxied system DLLs
Shell
3
star
21

micromanage

sigma loop's AFK streamer and IRC bot.
Python
3
star
22

flashkit-mdc

Fork of git://notaz.gp2x.de/~notaz/flashkit-mdc.git with Windows support
C
3
star
23

upaste

Plain file based Python pastebin.
Python
3
star
24

focon-util

Utility to talk to some industrial devices from Focon Electronics Systems A/S
Python
3
star
25

rpy-to-pptx

Ren'Py to Powerpoint converter
Python
2
star
26

vm-utils

QEMU VM management scripts
Shell
2
star
27

arcade-docs-media

Media storage for arcade-docs repository
2
star
28

ida-tools

¯\_(ツ)_/¯
Python
2
star
29

finite

Fine init environment.
C
1
star
30

atwork

Easy progress UI library for Python
Python
1
star
31

tqsh

A vn engine in bash.
Shell
1
star
32

noissuu

Python
1
star