mirror of
https://github.com/NinjaCheetah/libWiiPy.git
synced 2025-04-25 12:51:01 -04:00
Properly create/update uid.sys during EmuNAND title installs
This commit is contained in:
parent
8269a0db98
commit
e06bb39f4c
@ -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:
|
||||
"""
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user