From a85beac60298c6ed918ed058b74d01705ea6485e Mon Sep 17 00:00:00 2001 From: NinjaCheetah <58050615+NinjaCheetah@users.noreply.github.com> Date: Sun, 14 Apr 2024 12:58:40 -0400 Subject: [PATCH] Correctly pack boot2 WADs as type "ib" and not "Is" --- pyproject.toml | 2 +- src/libWiiPy/crypto.py | 3 +-- src/libWiiPy/title.py | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ad45b1e..e2697c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "libWiiPy" -version = "0.2.1" +version = "0.2.2" authors = [ { name="NinjaCheetah", email="ninjacheetah@ncxprogramming.com" }, { name="Lillian Skinner", email="lillian@randommeaninglesscharacters.com" } diff --git a/src/libWiiPy/crypto.py b/src/libWiiPy/crypto.py index 1a6b57a..7e2c8b1 100644 --- a/src/libWiiPy/crypto.py +++ b/src/libWiiPy/crypto.py @@ -72,8 +72,7 @@ def decrypt_content(content_enc, title_key, content_index, content_length) -> by # Decrypt the content using the AES object. content_dec = aes.decrypt(content_enc) # Trim additional bytes that may have been added so the content is the correct size. - while len(content_dec) > content_length: - content_dec = content_dec[:-1] + content_dec = content_dec[:content_length] return content_dec diff --git a/src/libWiiPy/title.py b/src/libWiiPy/title.py index 081bbc7..4478a62 100644 --- a/src/libWiiPy/title.py +++ b/src/libWiiPy/title.py @@ -70,6 +70,9 @@ class Title: wad_data : bytes The raw data of the WAD. """ + # Set WAD type to ib if the title being packed is boot2. + if self.tmd.title_id == "0000000100000001": + self.wad.wad_type = "ib" # Dump the TMD and set it in the WAD. self.wad.set_tmd_data(self.tmd.dump()) # Dump the Ticket and set it in the WAD.