Read/write reserved data in tmd.py, since it mattered for the DSi, it may matter here

This commit is contained in:
Campbell 2024-05-09 11:19:29 -04:00
parent ecc68d9e57
commit 6a81722ec5
No known key found for this signature in database
GPG Key ID: E543751376940756

View File

@ -45,7 +45,9 @@ class TMD:
self.group_id: int = 0 # The ID of the publisher of the associated title. self.group_id: int = 0 # The ID of the publisher of the associated title.
self.region: int = 0 # The ID of the region of the associated title. self.region: int = 0 # The ID of the region of the associated title.
self.ratings: bytes = b'' # The parental controls rating of the associated title. self.ratings: bytes = b'' # The parental controls rating of the associated title.
self.reserved1: bytes = b'' # Unknown data labeled "Reserved" on WiiBrew.
self.ipc_mask: bytes = b'' self.ipc_mask: bytes = b''
self.reserved2: bytes = b'' # Other "Reserved" data from WiiBrew.
self.access_rights: bytes = b'' self.access_rights: bytes = b''
self.title_version: int = 0 # The version of the associated title. self.title_version: int = 0 # The version of the associated title.
self.num_contents: int = 0 # The number of contents contained in the associated title. self.num_contents: int = 0 # The number of contents contained in the associated title.
@ -110,9 +112,15 @@ class TMD:
# Content rating of the title for parental controls. Likely based on ESRB, CERO, PEGI, etc. rating. # Content rating of the title for parental controls. Likely based on ESRB, CERO, PEGI, etc. rating.
tmd_data.seek(0x19E) tmd_data.seek(0x19E)
self.ratings = tmd_data.read(16) self.ratings = tmd_data.read(16)
# "Reserved" data 1.
tmd_data.seek(0x1AE)
self.reserved1 = tmd_data.read(12)
# IPC mask. # IPC mask.
tmd_data.seek(0x1BA) tmd_data.seek(0x1BA)
self.ipc_mask = tmd_data.read(12) self.ipc_mask = tmd_data.read(12)
# "Reserved" data 2.
tmd_data.seek(0x1C6)
self.reserved2 = tmd_data.read(18)
# Access rights of the title; DVD-video access and AHBPROT. # Access rights of the title; DVD-video access and AHBPROT.
tmd_data.seek(0x1D8) tmd_data.seek(0x1D8)
self.access_rights = tmd_data.read(4) self.access_rights = tmd_data.read(4)
@ -175,12 +183,12 @@ class TMD:
tmd_data += int.to_bytes(self.region, 2) tmd_data += int.to_bytes(self.region, 2)
# Parental Controls Ratings. # Parental Controls Ratings.
tmd_data += self.ratings tmd_data += self.ratings
# Reserved (all \x00). # "Reserved" 1.
tmd_data += b'\x00' * 12 tmd_data += self.reserved1
# IPC mask. # IPC mask.
tmd_data += self.ipc_mask tmd_data += self.ipc_mask
# Reserved (all \x00). # "Reserved" 2.
tmd_data += b'\x00' * 18 tmd_data += self.reserved2
# Access rights. # Access rights.
tmd_data += self.access_rights tmd_data += self.access_rights
# Title version. # Title version.