mirror of
https://github.com/NinjaCheetah/libWiiPy.git
synced 2025-04-25 12:51:01 -04:00
Change title version handling in tmd module
Now saving the version number (like v513) straight from the TMD and using that to dump the TMD, in case the converted version number (like v2.2) doesn't work right, which mostly applies to the system menu.
This commit is contained in:
parent
f96da98d23
commit
adac67b158
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "libWiiPy"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
authors = [
|
||||
{ name="NinjaCheetah", email="ninjacheetah@ncxprogramming.com" },
|
||||
{ name="Lillian Skinner", email="lillian@randommeaninglesscharacters.com" }
|
||||
|
@ -50,6 +50,7 @@ class TMD:
|
||||
self.reserved2: bytes = b'' # Other "Reserved" data from WiiBrew.
|
||||
self.access_rights: bytes = b''
|
||||
self.title_version: int = 0 # The version of the associated title.
|
||||
self.title_version_converted: int = 0 # The title version in vX.X format.
|
||||
self.num_contents: int = 0 # The number of contents contained in the associated title.
|
||||
self.boot_index: int = 0 # The content index that contains the bootable executable.
|
||||
self.content_records: List[_ContentRecord] = []
|
||||
@ -128,12 +129,14 @@ class TMD:
|
||||
# Access rights of the title; DVD-video access and AHBPROT.
|
||||
tmd_data.seek(0x1D8)
|
||||
self.access_rights = tmd_data.read(4)
|
||||
# Calculate the version number by multiplying 0x1DC by 256 and adding 0x1DD.
|
||||
# Version number straight from the TMD.
|
||||
tmd_data.seek(0x1DC)
|
||||
self.title_version = int.from_bytes(tmd_data.read(2))
|
||||
# Calculate the converted version number by multiplying 0x1DC by 256 and adding 0x1DD.
|
||||
tmd_data.seek(0x1DC)
|
||||
title_version_high = int.from_bytes(tmd_data.read(1)) * 256
|
||||
tmd_data.seek(0x1DD)
|
||||
title_version_low = int.from_bytes(tmd_data.read(1))
|
||||
self.title_version = title_version_high + title_version_low
|
||||
self.title_version_converted = title_version_high + title_version_low
|
||||
# The number of contents listed in the TMD.
|
||||
tmd_data.seek(0x1DE)
|
||||
self.num_contents = int.from_bytes(tmd_data.read(2))
|
||||
@ -200,10 +203,7 @@ class TMD:
|
||||
# Access rights.
|
||||
tmd_data += self.access_rights
|
||||
# Title version.
|
||||
title_version_high = round(self.title_version / 256)
|
||||
tmd_data += int.to_bytes(title_version_high, 1)
|
||||
title_version_low = self.title_version % 256
|
||||
tmd_data += int.to_bytes(title_version_low, 1)
|
||||
tmd_data += int.to_bytes(self.title_version, 2)
|
||||
# Number of contents.
|
||||
tmd_data += int.to_bytes(self.num_contents, 2)
|
||||
# Boot index.
|
||||
|
Loading…
x
Reference in New Issue
Block a user