libxb
Python library for the ClapHanz XB archive format
libxb is available for installation via the pip package manager:
python3 -m pip install libxb
User Interface
libxb provides a command-line interface for those who wish to use it as a tool.
Once you install the package via pip, it can be accessed via the main module (python -m libxb ...), or via its entrypoint script (libxb ...).
Usage
usage: libxb [-h] [-o <path>] -g <name> (-x <archive> | -c <path> [<path> ...]) [-r <path>] [-v]
libxb command line interface
options:
-h, --help show this help message and exit
-o <path>, --output <path>
(optional) Output path for extraction/creation result
-g <name>, --game <name>
Target game for the XB archive
-x <archive>, --extract <archive>
Extract an XB archive to the specified output path. If no output path is specified, a directory
with the same name as the archive will be created (*.xb.d)
-c <path> [<path> ...], --create <path> [<path> ...]
Create an XB archive from the specified files and/or directories. If no output path is
specified, and only a single input path is specified, an archive with the same name as the
input path will be created (*.xb.d -> *.xb, otherwise: *.* -> *.*.xb)
-r <path>, --root <path>
(optional) Root path/prefix for files in the XB archive (i.e. ../ for MNGP)
-v, --verbose (optional) Enable verbose log output
Examples
# Extract mRoomSel.xb as MNGP archive (creates "mRoomSel.xb.d" directory)
libxb -g mngp -x mRoomSel.xb
# Extract mRoomSel.xb as MNGP archive (creates "my_cool_path" directory)
libxb -g mngp -o my_cool_path -x mRoomSel.xb
# Create a MNGP archive from files in mRoomSel.xb.d directory (creates "mRoomSel.xb" file)
libxb -g mngp -c mRoomSel.xb.d
# Create a MNGP archive from files in mRoomSel.xb.d directory (creates "mRoomSelNew.xb" file)
libxb -g mngp -o mRoomSelNew.xb -c mRoomSel.xb.d
# Create a MNGP archive from three specified files (creates "ss.xb" file)
# Root directory is specified as "../data/", so all files in the archive get that prefix.
libxb -g mngp -o ss.xb -c config.dat ss.info sponsor.dat -r ../data/
Developer Interface
libxb provides a simple interface for XB files which resembles that of Python's tarfile:
Example Usage
import libxb
###############################################################################
## Extract archive
###############################################################################
with libxb.XBArchive("my-file.xb", XBOpenMode.READ, XBEndian.LITTLE) as arc:
arc.extract_all(path="output-path/")
###############################################################################
## Create archive
###############################################################################
with libxb.XBArchive("my-file.xb", XBOpenMode.WRITE, XBEndian.LITTLE) as arc:
arc.add(path="all-these-files/",
xb_path="actually-go-here/", # optional
compression=XBCompression.DEFLATE # optional
recursive=True) # optional
###############################################################################
## Modify archive
###############################################################################
with libxb.XBArchive("my-file.xb", XBOpenMode.RW, XBEndian.LITTLE) as arc:
arc.add(path="just-one-file.XB",
xb_path="/data/config.dat", # optional
compression=XBCompression.LZ # optional
recursive=True) # optional
###############################################################################
## Process files
###############################################################################
with libxb.XBArchive("my-file.xb", XBOpenMode.READ, XBEndian.LITTLE) as arc:
for file in arc:
... # do whatever
Helper Classes
Additionally, subclasses are provided for each title to remove the need to specify byteorder/endianness, and to allow shorthand strings for the access modes ('r'/'w'/'+'/'x'):
| Title | Class |
|---|---|
| Minna no Golf 3 | MNG3Archive |
| Minna no Golf Online | MNGOArchive |
| Minna no Golf 4 | MNG4Archive |
| Minna no Golf Portable | MNGPArchive |
| Minna no Golf 5 | MNG5Archive |
| Minna no Golf 6 | Not yet supported |
| Minna no Tennis | MNTArchive |
| Minna no Tennis Portable | MNTPArchive |
from libxb import MNGPArchive
###############################################################################
## Create archive for Minna no Golf Portable
###############################################################################
with MNGPArchive("config.dat", "w") as arc:
arc.add(path="config.txt",
xb_path="/data/config.dat") # optional
API Documentation
See the XBArchive implementation for more information about the methods and members provided.
Metadata
Release files for libxb 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| libxb-0.2.0.tar.gz | 20.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| libxb-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.0 kB
Release files / libxb-0.2.0.tar.gz
| Download URL | libxb-0.2.0.tar.gz |
|---|---|
| Size | 20.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2d0cacd9363358cfaaec31b6db5eb5c25ea410b77dfac7d01255e7305c546371
|
|
BLAKE2b-256 checksum How to use checksums |
459d0cdfb091f722e15a2b5506d8d9d26bb9af894e5e36e981baecca48c32fd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.6
|
Release files / libxb-0.2.0-py3-none-any.whl
| Download URL | libxb-0.2.0-py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90414b4b3205e199b86d5f736342b84c886de68a31e91f95b10e89438b4e4524
|
|
BLAKE2b-256 checksum How to use checksums |
dd47721d9d33ef00e472481e5846bd4f1b4ccea7a954e65b71a1e6cd2e93ff66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.6
|
Security for libxb 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.