Add Public System Menu Versions (#16)

* Add System Menu Versions

* add ()

* fix comments

* Fix version getting messed up by public version

---------

Co-authored-by: Aep <itisinfactmark@gmail.com>
This commit is contained in:
Aep 2024-11-27 11:50:34 -05:00 committed by GitHub
parent dadcc02701
commit 08c2bd27f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 63 additions and 8 deletions

View File

@ -38,6 +38,7 @@ from modules.download_wii import run_nus_download_wii, run_nus_download_wii_batc
from modules.download_dsi import run_nus_download_dsi, run_nus_download_dsi_batch
nusget_version = "1.2.0"
current_selected_version = ""
regions = {"World": ["41"], "USA/NTSC": ["45"], "Europe/PAL": ["50"], "Japan": ["4A"], "Korea": ["4B"], "China": ["43"],
"Australia/NZ": ["55"]}
@ -129,7 +130,17 @@ class MainWindow(QMainWindow, Ui_MainWindow):
new_region.setText(0, region)
for title_version in title["Versions"][region]:
new_version = QTreeWidgetItem()
new_version.setText(0, "v" + str(title_version))
# Added public display versions (4.3U, 4.3J, etc)
# messy code can absolutely be cleaned up!!
strVersion = str(title_version)
public_versions = title.get("Public Versions", {})
if strVersion in public_versions:
public_version = " (" + public_versions[strVersion] + ")" # add ()
else:
public_version = ""
# changed to strVersion here
#current_selected_version = strVersion
new_version.setText(0, "v" + strVersion + public_version)
new_region.addChild(new_version)
new_title.addChild(new_region)
# Set an indicator icon to show if a ticket is offered for this title or not.
@ -173,7 +184,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
selected_title = SelectedTitle(title["TID"], title["Name"], title["Archive Name"], item.text(0)[1:],
title["Ticket"], item.parent().text(0), category,
self.ui.console_select_dropdown.currentText(), danger_text)
self.load_title_data(selected_title)
self.load_title_data(selected_title, selected_title.version.split(" ", 1)[0])
def tid_updated(self):
tid = self.ui.tid_entry.text()
@ -208,10 +219,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if ret == QMessageBox.StandardButton.Yes:
webbrowser.open("https://github.com/NinjaCheetah/NUSGet/releases/latest")
def load_title_data(self, selected_title: SelectedTitle):
def load_title_data(self, selected_title: SelectedTitle, real_version):
# Use the information passed from the double click callback to prepare a title for downloading.
# If the last two characters are "XX", then this title has multiple regions, and each region uses its own
# two-digit code. Use the region info passed to load the correct code.
global current_selected_version
current_selected_version = real_version
if selected_title.tid[-2:] == "XX":
global regions
region_code = regions[selected_title.region][0]
@ -220,14 +233,14 @@ class MainWindow(QMainWindow, Ui_MainWindow):
tid = selected_title.tid
# Load the TID and version into the entry boxes.
self.ui.tid_entry.setText(tid)
self.ui.version_entry.setText(selected_title.version)
self.ui.version_entry.setText(real_version)
# Load the WAD name, assuming it exists. This shouldn't ever be able to fail as the database has a WAD name
# for every single title, regardless of whether it can be packed or not.
try:
archive_name = f"{selected_title.archive_name}"
if selected_title.category != "System" and selected_title.category != "IOS":
archive_name += f"-{str(bytes.fromhex(tid).decode())[-4:]}"
archive_name += f"-v{selected_title.version}"
archive_name += f"-v{real_version}"
if selected_title.region != "World":
archive_name += f"-{selected_title.region.split('/')[0]}"
if self.ui.console_select_dropdown.currentText() == "DSi":
@ -249,7 +262,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
danger_text = danger_text + ("Note: This Title does not have a Ticket available, so it cannot be decrypted"
" or packed into a WAD/TAD.")
# Print log info about the selected title and version.
self.log_text = f"{tid} - {selected_title.name}\nVersion: {selected_title.version}\n\n{danger_text}\n"
self.log_text = f"{tid} - {selected_title.name}\nVersion: {real_version}\n\n{danger_text}\n"
self.ui.log_text_browser.setText(self.log_text)
def lock_ui_for_download(self):
@ -290,12 +303,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# Create a new worker object to handle the download in a new thread.
if self.ui.console_select_dropdown.currentText() == "DSi":
worker = Worker(run_nus_download_dsi, out_folder, self.ui.tid_entry.text(),
self.ui.version_entry.text(), self.ui.pack_archive_chkbox.isChecked(),
current_selected_version, self.ui.pack_archive_chkbox.isChecked(),
self.ui.keep_enc_chkbox.isChecked(), self.ui.create_dec_chkbox.isChecked(),
self.ui.use_local_chkbox.isChecked(), self.ui.archive_file_entry.text())
else:
worker = Worker(run_nus_download_wii, out_folder, self.ui.tid_entry.text(),
self.ui.version_entry.text(), self.ui.pack_archive_chkbox.isChecked(),
# don't use self.ui.version_entry.text(), use current_selected_version
current_selected_version, self.ui.pack_archive_chkbox.isChecked(),
self.ui.keep_enc_chkbox.isChecked(), self.ui.create_dec_chkbox.isChecked(),
self.ui.use_wiiu_nus_chkbox.isChecked(), self.ui.use_local_chkbox.isChecked(),
self.ui.pack_vwii_mode_chkbox.isChecked(), self.ui.patch_ios_chkbox.isChecked(),

View File

@ -39,6 +39,46 @@
"Japan": [128, 192, 224, 256, 288, 352, 384, 416, 448, 480, 512],
"Korea": [390, 454, 486, 518]
},
"Public Versions": {
"97": "2.0U",
"128": "2.0J",
"130": "2.0E",
"162": "2.1E",
"192": "2.2J",
"193": "2.2U",
"194": "2.2E",
"224": "3.0J",
"225": "3.0U",
"226": "3.0E",
"256": "3.1J",
"257": "3.1U",
"258": "3.1E",
"288": "3.2J",
"289": "3.2U",
"290": "3.2E",
"352": "3.3J",
"353": "3.3U",
"354": "3.3E",
"384": "3.4J",
"385": "3.4U",
"386": "3.4E",
"390": "3.5K",
"416": "4.0J",
"417": "4.0U",
"418": "4.0E",
"448": "4.1J",
"449": "4.1U",
"450": "4.1E",
"454": "4.1K",
"480": "4.2J",
"481": "4.2U",
"482": "4.2E",
"486": "4.2K",
"512": "4.3J",
"513": "4.3U",
"514": "4.3E",
"518": "4.3K"
},
"Ticket": true,
"Archive Name": "System-Menu",
"Danger": "The System Menu is a critical part of the Wii's operation, and should not be modified without proper brick prevention in place. You should have BootMii installed as boot2 if possible, and if not, Priiloader installed before making changes to the System Menu."

View File

@ -11,6 +11,7 @@ import libWiiPy
def run_nus_download_wii(out_folder: pathlib.Path, tid: str, version: str, pack_wad_chkbox: bool, keep_enc_chkbox: bool,
decrypt_contents_chkbox: bool, wiiu_nus_chkbox: bool, use_local_chkbox: bool,
repack_vwii_chkbox: bool, patch_ios: bool, wad_file_name: str, progress_callback=None):
#print(version)
# Actual NUS download function that runs in a separate thread.
# Immediately knock out any invalidly formatted Title IDs.
if len(tid) != 16: