LibRay/README.md

188 lines
5.7 KiB
Markdown
Raw Normal View History

2026-05-18 16:31:58 +02:00
# Libray
2018-06-20 22:28:52 +02:00
2026-05-18 16:31:58 +02:00
Libray: A portmanteau of Libre and Blu-Ray
2018-06-20 22:28:52 +02:00
2026-05-18 16:31:58 +02:00
Libray aims to be a Libre (FLOSS) Python application for unencrypting,
2018-06-20 22:28:52 +02:00
extracting, repackaging, and encrypting PS3 ISOs.
A hackable, crossplatform, alternative to ISOTools and ISO-Rebuilder.
2019-05-16 10:37:28 +02:00
## How to install
2019-06-07 09:19:33 +02:00
Note: You will need Python 3, so you might want to use `python3` and `pip3` instead of `python` and `pip` depending on your system.
### From PyPi:
1. `sudo pip install libray`
### Manually:
2019-05-16 10:37:28 +02:00
1. Clone this repository ```git clone https://notabug.org/necklace/libray```
2. Install dependencies with ```sudo pip install -r requirements.txt```
3. Run ```sudo python setup.py install```
2019-06-07 09:19:33 +02:00
### From AUR:
For Arch or Arch-based GNU/Linux distributions there's an option to [install libray from the AUR](https://aur.archlinux.org/packages/libray-git/) (Arch User Repository).
You will need an [AUR helper](https://wiki.archlinux.org/index.php/AUR_helpers) (of which there are many).
2019-06-07 09:19:33 +02:00
2020-11-26 21:09:39 +00:00
Then you will need to run the appropriate install command for that AUR helper using `libray` as package name.
2019-06-07 09:19:33 +02:00
This will essentially automatically do the manual method for you.
2026-05-18 16:31:58 +02:00
### With pipx:
- PyPi version: `pipx install libray`
2019-06-07 09:19:33 +02:00
### Done!
2019-05-16 10:37:28 +02:00
2019-06-07 09:19:33 +02:00
`libray` is now installed to your path.
2019-05-16 10:37:28 +02:00
2019-05-16 10:44:07 +02:00
## How do I use it?
```
2026-05-18 16:31:58 +02:00
usage: libray [-h] (-i ISO | -k IRD) [-o OUTPUT] [-d DECRYPTION_KEY] [-v] [-q] [-r] [-c] [-t CHECKSUM_TIMEOUT] [--info]
2021-06-02 20:25:49 +02:00
A Libre (FLOSS) Python application for unencrypting, extracting, repackaging, and encrypting PS3 ISOs
2019-05-16 10:44:07 +02:00
2026-05-18 16:31:58 +02:00
options:
-h, --help show this help message and exit
-i ISO, --iso ISO Path to .iso file or stream
2026-05-18 16:31:58 +02:00
-k IRD, --ird IRD Path to .ird file
2019-05-16 10:44:07 +02:00
optional arguments:
-o OUTPUT, --output OUTPUT
Output filename
2019-11-03 14:49:24 +01:00
-d DECRYPTION_KEY, --decryption-key DECRYPTION_KEY
Manually specify key
-v, --verbose Increase verbosity
2019-11-03 14:49:24 +01:00
-q, --quiet Quiet mode, only prints on error
2021-06-02 20:25:49 +02:00
-r, --re-encrypt Re-encrypt .iso
2026-05-18 16:31:58 +02:00
-c, --checksum Allow fallback to CRC32 checksum (disabled by default)
-t CHECKSUM_TIMEOUT, --checksum-timeout CHECKSUM_TIMEOUT
How many seconds to wait for CRC32 checksum (default 15)
--info Print info about .iso or .ird, then quit.
2019-05-16 10:44:07 +02:00
```
First off, even before you install libray, you will need a compatible Blu-Ray drive that can read PS3 discs.
2020-08-05 19:38:05 +00:00
There's a compiled list of compatible drives here: [https://rpcs3.net/quickstart](https://rpcs3.net/quickstart#compatible_drives) ([archive](https://web.archive.org/web/20190801060739/https://rpcs3.net/quickstart])) (see "Compatible Blu-ray disc drives section").
2020-08-03 11:19:20 +02:00
### 1. Decrypt
2019-05-16 10:44:07 +02:00
2021-06-05 22:03:31 +02:00
On some systems (eg. Linux), you can decrypt directly from the disc:
```
libray -i /dev/sr0 -o ps3_game_decrypted.iso
```
2021-06-05 22:03:31 +02:00
Libray is bundled with redump keys and will automatically try to decrypt the .iso if it finds a compatible key. If not, it will try to download an IRD decryption file for your iso. If you don't have internet connection, but you do have an .ird file you can specify that:
2019-08-01 08:23:04 +02:00
```
libray -i /dev/sr0 -k game_ird_file.ird -o ps3_game_decrypted.iso
```
Alternatively, you can first rip the disc to an ISO file and then decrypt from the ISO file:
2019-05-16 10:44:07 +02:00
```
libray -i ps3_game.iso -o ps3_game_decrypted.iso
```
2020-01-21 11:53:59 +00:00
If libray is unable to download an .ird for your game, you could manually give it the key, if you have it:
```
libray -i ps3_game.iso -d DECRYPTION_KEY -o ps3_game_decrypted.iso
```
2020-08-03 11:19:20 +02:00
### 2. Extract decrypted ISO
2019-05-16 10:44:07 +02:00
Then, if you want to feed it into RPCS3 just extract the contents of the .ISO:
```
7z x nfs_ps3_decrypted.iso
```
2026-05-18 16:31:58 +02:00
And move the resulting folders into a folder named after the game ID into the appropriate folder for RPCS3, for example:
2021-06-02 20:25:49 +02:00
- Linux: /home/username/.config/rpcs3/dev_hdd0/disc/BLUS0000
2026-05-18 16:31:58 +02:00
- macOS: ~/Library/Application Support/rpcs3/dev_hdd0/disc/BLUS0000
### 3. (Optional) Print info about .iso or .ird:
Get info from .iso without decrypting
```
libray -i ps3_game.iso --info
```
Get info from .ird
```
libray -k game_ird_file.ird --info
```
2019-05-16 10:44:07 +02:00
2019-05-16 10:37:28 +02:00
## License
2019-08-01 08:23:04 +02:00
This project is Free, Libre, and Open Source Software; FLOSS, licensed under the GNU General Public License version 3. GPLv3.
2018-06-20 22:28:52 +02:00
2019-08-01 08:42:14 +02:00
See also COPYING or LICENSE.txt
2026-05-18 16:31:58 +02:00
Copyright © 2018 - 2024 Nichlas Severinsen
2019-08-01 08:42:14 +02:00
2019-05-16 10:37:28 +02:00
## Error!
Help! I get
2019-05-16 10:37:28 +02:00
> ImportError: No module named Crypto.Cipher
or
> ImportError: cannot import name 'byte_string' from 'Crypto.Util.py3compat' (/usr/lib/python3.7/site-packages/Crypto/Util/py3compat.py)
This is due to multiple similarly named python crypto packages, one way to fix it is:
```
sudo pip uninstall crypto
sudo pip uninstall pycrypto
2020-08-03 11:19:20 +02:00
sudo pip install pycryptodome
2019-05-16 10:37:28 +02:00
```
If you get any other errors, or have any other problem with libray, please [create an issue](https://notabug.org/necklace/libray/issues/new)!
2019-05-16 10:37:28 +02:00
## Development
[Bluray disc encryption](http://www.psdevwiki.com/ps3/Bluray_disc#Encryption) ([archive.fo](https://archive.fo/hN1E6))
[.SFO](https://www.psdevwiki.com/ps3/PARAM.SFO) ([archive.fo](https://archive.fo/HLJZG))
[TITLE_ID for Physical Media](https://www.psdevwiki.com/ps3/Template:TITLE_ID_for_Physical_Media) ([archive.fo](https://archive.fo/R8tCz))
2018-06-21 22:02:47 +02:00
[7bit encoded int / RLE / CLP](https://github.com/microsoft/referencesource/blob/1acafe20a789a55daa17aac6bb47d1b0ec04519f/mscorlib/system/io/binaryreader.cs#L582-L600)
2018-06-21 22:02:47 +02:00
clp = compressed length prefix
2021-12-02 06:49:41 +01:00
## Tests
2026-05-18 16:31:58 +02:00
`python -m unittest discover -b`
2021-12-02 06:49:41 +01:00
## Deployment
2021-06-05 22:03:31 +02:00
0. `pip3 install wheel twine`
2021-06-05 22:03:31 +02:00
1. Place redump keys in tools/keys and .dat in tools/
2. Run keys2db.py, ensure it made a file in libray/data/keys.db
3. Run `python3 setup.py sdist bdist_wheel`
4. Run `twine upload dist/*`
## Todo
2020-01-21 11:53:59 +00:00
- Extract ISO (currently doable with `7z x output.iso`)
2021-06-05 22:03:31 +02:00
- Repackage (unextract) iso
- Test .irds with version < 9
- Custom command to backup all irds available
- Unit tests
2021-06-05 22:03:31 +02:00
- Download .irds from vimm.net?
- Parallelization?