From 13f706a0dcb28c60687bccee93a4ee14b20144fd Mon Sep 17 00:00:00 2001 From: Ian Burgwin Date: Sun, 12 Jul 2020 21:07:26 -0700 Subject: [PATCH] update to pyctr 0.4.1, catch exceptions when creating CIAReader --- custominstall.py | 11 +++++++++-- requirements.txt | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/custominstall.py b/custominstall.py index 4b7c899..4cb5801 100644 --- a/custominstall.py +++ b/custominstall.py @@ -20,7 +20,7 @@ if TYPE_CHECKING: from events import Events -from pyctr.crypto import CryptoEngine, Keyslot +from pyctr.crypto import CryptoEngine, Keyslot, load_seeddb from pyctr.type.cia import CIAReader, CIASection from pyctr.type.ncch import NCCHSection from pyctr.util import roundup @@ -173,12 +173,19 @@ class CustomInstall: title_info_entries = {} cifinish_data = load_cifinish(cifinish_path) + load_seeddb(self.seeddb) + # Now loop through all provided cia files for c in self.cias: self.log('Reading ' + c) - cia = CIAReader(c, seeddb=self.seeddb) + try: + cia = CIAReader(c) + except Exception as e: + self.log(f'Failed to load file: {type(e).__name__}: {e}') + continue + self.cia = cia tid_parts = (cia.tmd.title_id[0:8], cia.tmd.title_id[8:16]) diff --git a/requirements.txt b/requirements.txt index fb41186..078396f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ pycryptodomex<=3.9.4 events==0.3 -pyctr==0.1.0 +pyctr==0.4.1