Fix handling WADs where content index != actual index in the array

This commit is contained in:
Campbell 2024-07-20 15:07:23 -04:00
parent 4f96e1b0d9
commit e70b9570de
Signed by: NinjaCheetah
GPG Key ID: B547958AF96ED344
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,6 @@
[project] [project]
name = "libWiiPy" name = "libWiiPy"
version = "0.4.1" version = "0.4.2"
authors = [ authors = [
{ name="NinjaCheetah", email="ninjacheetah@ncxprogramming.com" }, { name="NinjaCheetah", email="ninjacheetah@ncxprogramming.com" },
{ name="Lillian Skinner", email="lillian@randommeaninglesscharacters.com" } { name="Lillian Skinner", email="lillian@randommeaninglesscharacters.com" }

View File

@ -355,7 +355,10 @@ class ContentRegion:
"Expected hash is: {}\n".format(self.content_records[index].content_hash.decode()) + "Expected hash is: {}\n".format(self.content_records[index].content_hash.decode()) +
"Actual hash is: {}".format(content_hash)) "Actual hash is: {}".format(content_hash))
# If the hash matches, encrypt the content and set it where it belongs. # 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): if (index + 1) > len(self.content_list):
self.content_list.append(enc_content) self.content_list.append(enc_content)
else: else: