Release 0.0.8

Fixed:
- Issue #7: fix manually supplied .ird files not being used.
This commit is contained in:
Nichlas Severinsen 2021-11-27 22:22:19 +01:00
parent 52bf2bad01
commit 88d1b48167
6 changed files with 36 additions and 7 deletions

1
.gitignore vendored
View file

@ -2,6 +2,7 @@
*.ird
*.gz
*.db
*.zip
PS3_GAME/
PS3_UPDATE/

View file

@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [0.0.8] - 2021-11-27
### Fixed
- Issue #7: fix manually supplied .ird files not being used.
## [0.0.7] - 2021-06-29
### Added
- PARAM.SFO reader (sfo.py)

View file

@ -51,10 +51,10 @@ class IRD:
MAGIC_STRING = b'3IRD'
def __init__(self, args):
def __init__(self, ird_path, verbose=False):
"""IRD constructor using args from argparse."""
self.uncompress(args.ird) # TODO: Try/Except?
self.uncompress(ird_path) # TODO: Try/Except?
self.size = core.size(self.TEMP_FILE)
@ -107,7 +107,7 @@ class IRD:
if self.version < 7:
self.uid = core.to_int(input_ird.read(4), self.ORDER)
if args.verbose:
if verbose:
self.print_info()
os.remove(self.TEMP_FILE)

View file

@ -174,8 +174,6 @@ class ISO:
db = sqlite3.connect((pathlib.Path(__file__).resolve() / 'data/') / 'keys.db')
c = db.cursor()
#core.vprint('Calculating crc32', args)
#input_iso.seek(0)
@ -228,7 +226,7 @@ class ISO:
core.warning('No IRD file specified, finding required file', args)
args.ird = core.ird_by_game_id(self.game_id) # Download ird
self.ird = ird.IRD(args)
self.ird = ird.IRD(args.ird)
if self.ird.region_count != len(self.regions)-1:
core.error('Corrupt ISO or error in IRD. Expected %s regions, found %s regions' % (self.ird.region_count, len(self.regions)-1))
@ -237,6 +235,21 @@ class ISO:
core.error('Corrupt ISO or error in IRD. Expected filesize larger than %.2f GiB, actual size is %.2f GiB' % (self.regions[-1]['start'] / 1024**3, self.size / 1024**3 ) )
self.disc_key = cipher.encrypt(self.ird.data1)
else:
# .ird file given with -k / --ird
self.ird = ird.IRD(args.ird)
if self.ird.region_count != len(self.regions)-1:
core.error('Corrupt ISO or error in IRD. Expected %s regions, found %s regions' % (self.ird.region_count, len(self.regions)-1))
if self.regions[-1]['start'] > self.size:
core.error('Corrupt ISO or error in IRD. Expected filesize larger than %.2f GiB, actual size is %.2f GiB' % (self.regions[-1]['start'] / 1024**3, self.size / 1024**3 ) )
self.disc_key = cipher.encrypt(self.ird.data1)
else:
self.disc_key = core.to_bytes(args.decryption_key)

View file

@ -11,7 +11,7 @@ with open('README.md') as f:
setup(
name="libray",
version="0.0.7",
version="0.0.8",
description='A Libre (FLOSS) Python application for unencrypting, extracting, repackaging, and encrypting PS3 ISOs',
long_description=long_description,
long_description_content_type='text/markdown',

View file

@ -47,6 +47,12 @@ if __name__ == '__main__':
cwd = pathlib.Path(__file__).resolve().parent
keys_path = cwd / 'keys'
if not keys_path.exists():
print('Error: No keys/ folder. Place the .key files in a tools/keys/ folder')
sys.exit()
any_dats = [x for x in cwd.glob('*.dat')]
if not any_dats:
@ -82,6 +88,11 @@ if __name__ == '__main__':
db.close()
data_path = (cwd.parent / 'libray') / 'data/'
if not data_path.exists():
data_path.mkdir()
shutil.copyfile(db_path, ((cwd.parent / 'libray') / 'data/') / db_path.name)
print('Warning: no keyfiles for %s titles' % str(warnings))