Compare commits

...

2 Commits
v0.6.0 ... main

5 changed files with 17 additions and 3 deletions

View File

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

View File

@ -128,6 +128,10 @@ class EmuNAND:
uid_sys = _UidSys()
if not uid_sys_path.exists():
uid_sys.create()
else:
uid_sys.load(uid_sys_path.read_bytes())
uid_sys.add(title.tmd.title_id)
uid_sys_path.write_bytes(uid_sys.dump())
def uninstall_title(self, tid: str) -> None:
"""

View File

@ -77,7 +77,8 @@ class UidSys:
def add(self, title_id: str | bytes) -> int:
"""
Adds a new Title ID to the uid.sys file and returns the UID assigned to that title.
Adds a new Title ID to the uid.sys file and returns the UID assigned to that title. The new entry will only
be added if the provided Title ID doesn't already have an assigned UID.
Parameters
----------
@ -106,6 +107,11 @@ class UidSys:
title_id_converted = title_id
else:
raise TypeError("Title ID type is not valid! It must be either type str or bytes.")
# Ensure this TID hasn't already been assigned a UID. If it has, just exit early and return the UID.
if self.uid_entries.count != 0:
for entry in self.uid_entries:
if entry.title_id == title_id_converted:
return entry.uid
# Generate the new UID by incrementing the current highest UID by 1.
try:
new_uid = self.uid_entries[-1].uid + 1

View File

@ -75,7 +75,7 @@ class Ticket:
self.title_version: int = 0 # Version of the ticket's associated title.
self.permitted_titles: bytes = b'' # Permitted titles mask
# "Permit mask. The current disc title is ANDed with the inverse of this mask to see if the result matches the
# Permitted Titles Mask."
# Permitted Titles Mask." -WiiBrew
self.permit_mask: bytes = b''
self.title_export_allowed: int = 0 # Whether title export is allowed with a PRNG key or not.
self.common_key_index: int = 0 # Which common key should be used. 0 = Common Key, 1 = Korean Key, 2 = vWii Key

View File

@ -194,6 +194,8 @@ class Title:
bytes
The decrypted content listed in the content record.
"""
if self.ticket.title_id == "":
raise ValueError("A Ticket must be loaded to get decrypted content.")
dec_content = self.content.get_content_by_index(index, self.ticket.get_title_key(), skip_hash)
return dec_content
@ -213,6 +215,8 @@ class Title:
bytes
The decrypted content listed in the content record.
"""
if self.ticket.title_id == "":
raise ValueError("A Ticket must be loaded to get decrypted content.")
dec_content = self.content.get_content_by_cid(cid, self.ticket.get_title_key(), skip_hash)
return dec_content