diff --git a/.gitignore b/.gitignore index a2050b8..4c2ceec 100644 --- a/.gitignore +++ b/.gitignore @@ -159,4 +159,7 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -.idea/ \ No newline at end of file +.idea/ + +# Allows me to keep TMD files in my repository folder for testing without accidentally publishing them +*.tmd \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index cbc78eb..856390a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [ ] description = "A Wii-related library for Python" readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.10" classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", diff --git a/src/libWiiPy/commonkey.py b/src/libWiiPy/commonkey.py deleted file mode 100644 index dc70b3f..0000000 --- a/src/libWiiPy/commonkey.py +++ /dev/null @@ -1,17 +0,0 @@ -from .shared import hex_string_to_byte_array - - -class CommonKey: - def __init__(self): - self.default_key = "ebe42a225e8593e448d9c5457381aaf7" - self.korean_key = "63b82bb4f4614e2e13f2fefbba4c9b7e" - self.vwii_key = "30bfc76e7c19afbb23163330ced7c28d" - - def get_default_key(self): - return hex_string_to_byte_array(self.default_key) - - def get_korean_key(self): - return hex_string_to_byte_array(self.korean_key) - - def get_vwii_key(self): - return hex_string_to_byte_array(self.vwii_key) diff --git a/src/libWiiPy/commonkeys.py b/src/libWiiPy/commonkeys.py new file mode 100644 index 0000000..6b8687e --- /dev/null +++ b/src/libWiiPy/commonkeys.py @@ -0,0 +1,20 @@ +# "commonkeys.py" from libWiiPy by NinjaCheetah + +default_key = 'ebe42a225e8593e448d9c5457381aaf7' +korean_key = '63b82bb4f4614e2e13f2fefbba4c9b7e' +vwii_key = '30bfc76e7c19afbb23163330ced7c28d' + + +def get_default_key(): + """Returns the regular Wii Common Key used to encrypt most content.""" + return default_key + + +def get_korean_key(): + """Returns the Korean Wii Common Key used to encrypt Korean content.""" + return korean_key + + +def get_vwii_key(): + """Returns the vWii Common Key used to encrypt vWii-specific content.""" + return vwii_key diff --git a/src/libWiiPy/tmd.py b/src/libWiiPy/tmd.py index a34a2c1..e65615b 100644 --- a/src/libWiiPy/tmd.py +++ b/src/libWiiPy/tmd.py @@ -1,3 +1,6 @@ +# "tmd.py" from libWiiPy by NinjaCheetah +# See https://wiibrew.org/wiki/Title_metadata for details about the TMD format + import binascii from dataclasses import dataclass from typing import List @@ -5,6 +8,7 @@ from typing import List @dataclass class ContentRecord: + """Creates a content record object that contains the details of a content contained in a title.""" cid: int # Content ID index: int # Index in the list of contents content_type: int # normal: 0x0001; dlc: 0x4001; shared: 0x8001 @@ -13,11 +17,12 @@ class ContentRecord: class TMD: + """Creates a TMD object that can be used to read all the data contained in a TMD.""" def __init__(self, tmd): self.tmd = tmd self.sig_type: int self.sig: bytearray - self.issuer: bytearray # Root-CA%08x-CP%08x + self.issuer: bytearray # Follows the format "Root-CA%08x-CP%08x" self.version: bytearray # This seems to always be 0 no matter what? self.ca_crl_version: int self.signer_crl_version: int