Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Ren'Py RPA archive

From ReverseEngineering.wiki
Format
On this wiki Facts · Code · Notes · Topics

Ren'Py's archive format (.rpa, and .rpi for version 1): version 3 starts with the ASCII line RPA-3.0 plus a 16-digit hex index offset and an 8-digit hex key; the index is a zlib-compressed pickle mapping file names to lists of (offset, length) tuples that are XORed with the key.

Headers

The handlers in the engine are tried by file header:

  • RPA-3.0 followed by 16 hex digits (offset of the index), a space, 8 hex digits (key) and a newline; the loader reads 40 bytes.
  • RPA-2.0 followed by 16 hex digits (index offset) and a newline; 24 bytes. No key.
  • Version 1 is an index file .rpi that starts with a zlib stream (78 9C) and has no header.

Index

Seek to the offset, zlib-decompress to the end of the file, and unpickle: a dict from a path to a list of tuples. In v3 each (offset, length) is XORed with the key, and a three-element tuple (offset, length, prefix) carries a short prefix of bytes (the first bytes of the file) that go before the data.

Related

Library:Ren'Py, Format:Ren'Py RPYC, Format:Zlib stream

Unpickling is code execution: parse the pickle with a restricted unpickler.

Code & repositories

  • https://github.com/renpy/renpy @ 6202e7fb43fd23594ab866af83bf928525a06410 · license: MIT (declared by the contributor; GitHub's detector did not recognize a license file)
    Ren'Py engine source: renpy/loader.py (RPA handlers) and renpy/script.py (rpyc reading and writing) are the format references.
    Tested on: source read, not run: source read only · checked 2026-10-18