Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ verify_ssl = true

[packages]
pycdlib = "*"
pathlab = "*"
xxhash = "*"
numpy = "*"
libarchive-c = "*"
Expand All @@ -24,4 +23,4 @@ inflate64 = "*"
bitarray = "*"

[requires]
python_version = "3.8"
python_version = "3"
12 changes: 4 additions & 8 deletions common/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
from cdi.path_reader import CdiPathReader
from common.iso_path_reader.methods.compressed import CompressedPathReader
from common.iso_path_reader.methods.hfs import HfsPathReader
from common.iso_path_reader.methods.pathlab import PathlabPathReader
from common.iso_path_reader.methods.pycdlib import PyCdLibPathReader
from common.processor import GenericIsoProcessor
from common.udf.pycdlib_udf import PyCdlibUdf
from dreamcast.processor import DreamcastIsoProcessor
from gamecube.path_reader import GamecubePathReader
from gamecube.processor import GamecubeIsoProcessor
from iso_accessor import IsoAccessor
from machfs import Volume, Folder, File

from cdi.processor import CdiIsoProcessor
Expand Down Expand Up @@ -296,6 +294,8 @@ def get_iso_path_readers(fp, file_name, parent_container, pbar):
try:
iso.open_fp(wrapper)
except Exception as e:
exceptions["iso9660"] = e

# pycdlib may fail on reading the directory contents of an iso, but it should still correctly parse the PVD
if not hasattr(iso, "pvd") and hasattr(iso, "pvds") and iso.pvds:
iso.pvd = iso.pvds[0]
Expand Down Expand Up @@ -326,12 +326,8 @@ def get_iso_path_readers(fp, file_name, parent_container, pbar):
iso.open_fp(wrapper)
path_readers.append(path_reader_class(iso, wrapper, parent_container, volume_type="udf"))

if not iso._initialized and not iso._has_udf:
try:
iso_accessor = IsoAccessor(wrapper, ignore_susp=True)
path_readers.append(PathlabPathReader(iso_accessor, wrapper, parent_container, pvd=iso.pvd))
except Exception as e:
exceptions[PathlabPathReader.volume_type] = e
if (iso._initialized or iso._has_udf) and "iso9660" in exceptions:
exceptions.pop("iso9660")

return path_readers, exceptions

Expand Down
52 changes: 0 additions & 52 deletions common/iso_path_reader/methods/pathlab.py

This file was deleted.

7 changes: 3 additions & 4 deletions common/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from cdi.path_reader import CdiPathReader
from common.iso_path_reader.methods.compressed import CompressedPathReader
from common.iso_path_reader.methods.pathlab import PathlabPathReader
from common.iso_path_reader.methods.pycdlib import PyCdLibPathReader
from utils.common import format_bar_desc
from utils.hash_progress_wrapper import HashProgressWrapper
Expand All @@ -18,8 +17,8 @@

class BaseIsoProcessor:
globally_ignored_paths = [
re.compile(".*\.nfo$", re.IGNORECASE),
re.compile(".*\.diz$", re.IGNORECASE),
re.compile(r".*\.nfo$", re.IGNORECASE),
re.compile(r".*\.diz$", re.IGNORECASE),
]
ignored_paths = []
_hash_bar_fmt = ' Hashing {file_name} {desc_pad}{percentage:3.0f}%|{bar}| ' \
Expand Down Expand Up @@ -76,7 +75,7 @@ def get_system_type(iso_path_reader):
if fp.read(5) == b'CD-I ':
return "cdi"

if isinstance(iso_path_reader, (XboxPathReader, CompressedPathReader, PyCdLibPathReader, PathlabPathReader)):
if isinstance(iso_path_reader, (XboxPathReader, CompressedPathReader, PyCdLibPathReader)):
for sys_type, exe_type, expected_header in (("xbox360", ".xex", b"XEX"), ("xbox", ".xbe", b"XBE")):
for file in iso_path_reader.iso_iterator(iso_path_reader.get_root_dir(), recursive=False):
file_path = iso_path_reader.get_file_path(file)
Expand Down
65 changes: 0 additions & 65 deletions iso_accessor.py

This file was deleted.

4 changes: 2 additions & 2 deletions patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ def check_int_header(retcode, func, args):

import zipfile
orig_decodeExtra = zipfile.ZipInfo._decodeExtra
def _decodeExtra(self):
def _decodeExtra(*args):
try:
orig_decodeExtra(self)
orig_decodeExtra(*args)
except zipfile.BadZipfile:
pass
zipfile.ZipInfo._decodeExtra = _decodeExtra
Expand Down
6 changes: 3 additions & 3 deletions post_psx/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

class PostPsxIsoProcessor(BaseIsoProcessor):
exe_patterns = [
re.compile(".*/EBOOT\.BIN$", re.IGNORECASE),
re.compile(".*\.self$", re.IGNORECASE),
re.compile(".*\.sprx$", re.IGNORECASE)
re.compile(r".*/EBOOT\.BIN$", re.IGNORECASE),
re.compile(r".*\.self$", re.IGNORECASE),
re.compile(r".*\.sprx$", re.IGNORECASE)
]
SFO_HEADER_BYTES = 20

Expand Down
4 changes: 2 additions & 2 deletions ps3/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@


class Ps3IsoProcessor(PostPsxIsoProcessor):
update_folder = re.compile(".*PS3_UPDATE$", re.IGNORECASE)
update_folder = re.compile(r".*PS3_UPDATE$", re.IGNORECASE)
sfo_path = "/PS3_GAME/PARAM.SFO"

@property
def ignored_paths(self):
paths = self.exe_patterns + [self.update_folder]
paths.append(re.compile("(?!^\/PS3_GAME\/USRDIR\/)", re.IGNORECASE))
paths.append(re.compile(r"(?!^\/PS3_GAME\/USRDIR\/)", re.IGNORECASE))
return paths

def get_disc_type(self):
Expand Down
14 changes: 7 additions & 7 deletions ps3/self_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import io
import struct
import zlib
from dataclasses import dataclass
from dataclasses import dataclass, field

from Crypto.Cipher import AES
from Crypto.Util import Counter
Expand Down Expand Up @@ -126,18 +126,18 @@ class SegmentCertHeader(Struct):

@dataclass
class Attributes(Struct):
key: bytearray = bytearray(0x10)
iv: bytearray = bytearray(0x10)
key: bytearray = field(default_factory=lambda: bytearray(0x10))
iv: bytearray = field(default_factory=lambda: bytearray(0x10))

struct = struct.Struct(">16s16s")


@dataclass
class EncryptionRootHeader(Struct):
key: bytearray = bytearray(0x10)
key_pad: bytearray = bytearray(0x10)
iv: bytearray = bytearray(0x10)
iv_pad: bytearray = bytearray(0x10)
key: bytearray = field(default_factory=lambda: bytearray(0x10))
key_pad: bytearray = field(default_factory=lambda: bytearray(0x10))
iv: bytearray = field(default_factory=lambda: bytearray(0x10))
iv_pad: bytearray = field(default_factory=lambda: bytearray(0x10))

struct = struct.Struct(">16s16s16s16s")

Expand Down
2 changes: 1 addition & 1 deletion psp/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class PspIsoProcessor(PostPsxIsoProcessor):

update_folder = re.compile(".*/PSP_GAME/SYSDIR/UPDATE/$", re.IGNORECASE)
update_folder = re.compile(r".*/PSP_GAME/SYSDIR/UPDATE/$", re.IGNORECASE)
sfo_path = "/PSP_GAME/PARAM.SFO"

def __init__(self, iso_path_reader, iso_filename, system, progress_manager):
Expand Down
18 changes: 13 additions & 5 deletions utils/archives.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,13 @@ def _open_unrar(rar, inf, pwd=None, tmpfile=None, force_file=False):

if self.ctx.filelist:
flags = struct.unpack("<H", local_header[0x06:0x08])[0]
if flags & 0x800:
filename = filename_raw.decode('utf-8')
else:
filename = filename_raw.decode('cp437')
try:
if flags & 0x800:
filename = filename_raw.decode('utf-8')
else:
filename = filename_raw.decode('cp437')
except UnicodeDecodeError:
continue
zip_entry = None
for name_to_try in [filename, filename.replace("/", "\\"), filename.replace("\\", "/")]:
try:
Expand All @@ -367,7 +370,8 @@ def _open_unrar(rar, inf, pwd=None, tmpfile=None, force_file=False):
self.ctx.filelist.pop(self.ctx.filelist.index(zip_entry))
self.ctx.NameToInfo.pop(zip_entry.filename)
else:
self.fp.seek(struct.unpack("<L", local_header[0x12:0x16])[0], 1)
compress_size = struct.unpack("<L", local_header[0x12:0x16])[0] or zip_entry.compress_size
self.fp.seek(compress_size, 1)
continue
else:
num_entries += 1
Expand Down Expand Up @@ -629,6 +633,10 @@ def open(self, entry):
else:
raise
return self.archive.open(entry, "r")
elif str(e).startswith("Overlapped entries"):
entry._end_offset = None
LOGGER.warning(str(e) + " file: %s", self.name)
return self.archive.open(entry, "r")
LOGGER.warning(str(e) + " file: %s", self.name)

def _get_data(self, n, discard=False):
Expand Down
16 changes: 8 additions & 8 deletions xbox/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

class XboxIsoProcessor(BaseIsoProcessor):
ignored_paths = [
re.compile(".*\.xbe$", re.IGNORECASE)
re.compile(r".*\.xbe$", re.IGNORECASE)
]

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -326,13 +326,13 @@ class XEX2ResourceInfo(ctypes.BigEndianStructure):

class Xbox360IsoProcessor(XboxIsoProcessor):
ignored_paths = [
re.compile(".*\$SystemUpdate\/.*", re.IGNORECASE),
re.compile(".*nxeart$", re.IGNORECASE),
re.compile(".*AvatarAssetPack$", re.IGNORECASE),
re.compile(".*\.xex$", re.IGNORECASE),
re.compile(".*readme.html$", re.IGNORECASE),
re.compile(".*AvatarAssetPack$", re.IGNORECASE),
re.compile(".*AvatarAwards$", re.IGNORECASE),
re.compile(r".*\$SystemUpdate\/.*", re.IGNORECASE),
re.compile(r".*nxeart$", re.IGNORECASE),
re.compile(r".*AvatarAssetPack$", re.IGNORECASE),
re.compile(r".*\.xex$", re.IGNORECASE),
re.compile(r".*readme.html$", re.IGNORECASE),
re.compile(r".*AvatarAssetPack$", re.IGNORECASE),
re.compile(r".*AvatarAwards$", re.IGNORECASE),
]

XEX2_HEADER_RESOURCE_INFO = 0x2FF
Expand Down