Skip to main content

Huaxu asset retriever for Punishing: Gray Raven

Project description

PGR Assets

Backbone for Huaxu's asset database

Installation

This package is not available on PyPI, so you will need to install it from source.

pip install pgr_assets@git+https://github.com/huaxu-app/pgr-assets
# or the dev version
pip install pgr_assets@git+https://github.com/huaxu-app/pgr-assets@dev

Commands

  • list — print every bundle name resolvable for a server. Pass search terms to filter (case-insensitive substrings, terms are AND-ed together).
  • bundles — download raw bundle blobs to disk, without extracting or converting them.
  • extract — download, decrypt, extract and convert images/audio/video/text.
  • spines — reconstruct Spine2D rigs (atlas + skeleton + textures) from the game's spine bundles.

extract and bundles pick what to process with selection flags: --all, --all-temp (text), --all-images, --all-audio, --all-video, or explicit bundle names (discover them with list).

Common usages

# List every asset (defaults to the global server)
pgr-assets list

# Switch servers with --preset: global, korea, japan, taiwan, china, china-beta
pgr-assets list --preset korea

# Search the manifest: prints only bundles matching ALL given terms case-insensitively
pgr-assets list spine lucia

# Extract every image bundle into ./out
pgr-assets extract --preset global --all-images --output ./out

# Extract specific bundles by name (discover them with `list` above)
pgr-assets extract --preset global assets/product/ui/spine/lucia/lucia.ab --output ./out

# Re-run after a game update, the sha1 cache skips unchanged bundles
pgr-assets extract --preset global --all --output ./out --cache ./out/.sha1cache.json

# More verbose logging
pgr-assets extract --preset global --all-audio --output ./out --log-level debug

# For full usage instructions see the help output of the various commands

Output

extract mirrors each bundle's internal path under the output directory, converting as it goes:

  • Images.png and .webp; character art under image/rolecharacter/ also gets a 256px .256.webp thumbnail.
  • Text → decoded in place (the .bytes suffix is dropped). With --convert-binary-tables, /temp/bytes/*.tab.bytes tables are also written as .csv.
  • Audioaudio/<name>/*.mp3 (use --raw-audio to keep the decoded .wav instead).
  • Videovideo/<name>.mp4 with each language as a tagged audio track; --hls additionally emits an HLS master playlist + segments.

--write-settings drops a settings.json (server + version) in the output directory.

Requirements

You'll need Python 3.13+ and ffmpeg installed. Just use your platform's recommended way of installing ffmpeg, such as:

# Arch Linux
$ pacman -Syu ffmpeg
# Fedora / RHEL (derivatives)
$ dnf install ffmpeg
# Debian / Ubuntu
$ apt install ffmpeg
# MacOS
$ brew install ffmpeg
# Windows
$ winget install --id=Gyan.FFmpeg  -e

Alternatively, follow the official download instructions for your platform.

The china-beta server additionally requires a PATCH_SIGN_KEY environment variable.

Considerations

Why?

While there are similar tools (like CNStudio) that can fulfill the primary task, pgr-assets specializes itself towards Huaxu's goals, providing some major benefits:

  • It does not require you to have any local copy of the entire game worth of game bundles
    • It instead downloads the required files on-demand from the game's CDN servers
  • It supports the internal encryption and signature scheme used for text assets
  • It is aware of the file storage methods that PGR uses and properly extracts and decrypts the flavors of audio and video
  • It converts assets into more web-friendly formats on the fly
  • It can do partial updates (by relying on the sha1 cache)

All of these things made this worthwhile enough to invest in this custom tooling.

Python

Python was chosen for this project not specifically because I like it, but because it has the proper intersection of libraries to fulfill my use-cases. While C# has some alternatives (You can grab the internal libraries of VGMtoolbox and AssetStudio), these alternatives come with major downsides and hacking around their non-officially-a-library status.

In the end, I really didn't feel like building parsers for Unity Asset Bundles and Criware's formats, and wanted to just focus on getting shit done.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pgr_assets-3.1.0.tar.gz (333.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pgr_assets-3.1.0-py3-none-any.whl (66.5 kB view details)

Uploaded Python 3

File details

Details for the file pgr_assets-3.1.0.tar.gz.

File metadata

  • Download URL: pgr_assets-3.1.0.tar.gz
  • Upload date:
  • Size: 333.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pgr_assets-3.1.0.tar.gz
Algorithm Hash digest
SHA256 ed2a1140a620365e61535da60fc00924324bef3d7f9bf110cfad2aa4e1ccd2fe
MD5 d41d14afab04ec4d2209c8d0ea43d298
BLAKE2b-256 708dc3f720fc4ade4e6d6559e717a37bc92c8958f034396a6774db8639887c2a

See more details on using hashes here.

File details

Details for the file pgr_assets-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: pgr_assets-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 66.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pgr_assets-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fb2929c393f4ee0921458734201028534d1a89438658e857f91bad5fbb29cb6
MD5 edf1f0e8793241af9dd0c6b2aaef0f34
BLAKE2b-256 7c1a23868182aa27a84bf106be19e47d90f5e211aaeecc2eaff54c6c0adcb172

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page