From e70b9570de123aef5aecb9f90df0b7b9f56227da Mon Sep 17 00:00:00 2001 From: NinjaCheetah <58050615+NinjaCheetah@users.noreply.github.com> Date: Sat, 20 Jul 2024 15:07:23 -0400 Subject: [PATCH] Fix handling WADs where content index != actual index in the array --- pyproject.toml | 2 +- src/libWiiPy/title/content.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 623e785..27b6772 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "libWiiPy" -version = "0.4.1" +version = "0.4.2" authors = [ { name="NinjaCheetah", email="ninjacheetah@ncxprogramming.com" }, { name="Lillian Skinner", email="lillian@randommeaninglesscharacters.com" } diff --git a/src/libWiiPy/title/content.py b/src/libWiiPy/title/content.py index 4a5c9db..e7ae048 100644 --- a/src/libWiiPy/title/content.py +++ b/src/libWiiPy/title/content.py @@ -355,7 +355,10 @@ class ContentRegion: "Expected hash is: {}\n".format(self.content_records[index].content_hash.decode()) + "Actual hash is: {}".format(content_hash)) # If the hash matches, encrypt the content and set it where it belongs. - enc_content = encrypt_content(dec_content, title_key, index) + # This uses the index from the content records instead of just the index given, because there are some strange + # circumstances where the actual index in the array and the assigned content index don't match up, and this + # needs to accommodate that. + enc_content = encrypt_content(dec_content, title_key, self.content_records[index].index) if (index + 1) > len(self.content_list): self.content_list.append(enc_content) else: