From b528a8717520508305f77f0b7faf5702951438e0 Mon Sep 17 00:00:00 2001 From: NinjaCheetah <58050615+NinjaCheetah@users.noreply.github.com> Date: Wed, 10 Apr 2024 23:41:36 -0400 Subject: [PATCH] Added experimental new interface for selecting a title to download --- .github/workflows/python-build.yml | 6 +- NUSD-Py.py | 54 ++++-- qt/py/ui_MainMenu.py | 44 ++--- qt/ui/MainMenu.ui | 74 ++++---- wii-database.json | 264 +++++++++++++++++++++++++++++ 5 files changed, 376 insertions(+), 66 deletions(-) create mode 100644 wii-database.json diff --git a/.github/workflows/python-build.yml b/.github/workflows/python-build.yml index 2b528f8..d530218 100644 --- a/.github/workflows/python-build.yml +++ b/.github/workflows/python-build.yml @@ -31,7 +31,7 @@ jobs: pip install -r requirements.txt - name: Build Package run: | - nuitka3 --assume-yes-for-downloads --onefile --plugin-enable=pyside6 main.py + nuitka3 --assume-yes-for-downloads --onefile --plugin-enable=pyside6 NUSD-Py.py - name: Prepare Package for Upload run: | mv NUSD-Py.bin ~/NUSD-Py @@ -58,7 +58,7 @@ jobs: pip install -r requirements.txt - name: Build Package run: | - nuitka3 --assume-yes-for-downloads --onefile --plugin-enable=pyside6 main.py --macos-create-app-bundle --disable-console + nuitka3 --assume-yes-for-downloads --onefile --plugin-enable=pyside6 NUSD-Py.py --macos-create-app-bundle --disable-console - name: Prepare Package for Upload run: | mv NUSD-Py.app ~/NUSD-Py.app @@ -87,7 +87,7 @@ jobs: pip install -r requirements.txt - name: Build Package run: | - nuitka --assume-yes-for-downloads --onefile --plugin-enable=pyside6 main.py --disable-console + nuitka --assume-yes-for-downloads --onefile --plugin-enable=pyside6 NUSD-Py.py --disable-console - name: Upload Package uses: actions/upload-artifact@v4.3.0 with: diff --git a/NUSD-Py.py b/NUSD-Py.py index 14fcc81..32e8c6e 100644 --- a/NUSD-Py.py +++ b/NUSD-Py.py @@ -5,8 +5,8 @@ import pathlib import libWiiPy -from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox, QTreeWidgetItem, QTreeWidget -from PySide6.QtCore import QRunnable, Slot, QThreadPool, Signal, QObject, Qt +from PySide6.QtWidgets import QApplication, QMainWindow, QMessageBox, QTreeWidgetItem +from PySide6.QtCore import QRunnable, Slot, QThreadPool, Signal, QObject from qt.py.ui_MainMenu import Ui_MainWindow @@ -29,7 +29,7 @@ class Worker(QRunnable): def run(self): try: self.fn(**self.kwargs) - except ValueError as e: + except ValueError: self.signals.result.emit(1) else: self.signals.result.emit(0) @@ -46,10 +46,34 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.ui.pack_wad_chkbox.clicked.connect(self.pack_wad_chkbox_toggled) tree = self.ui.title_tree + self.tree_categories = [] - for title in sys_titles: - new_title = QTreeWidgetItem(tree) - new_title.setText(0, title["Name"]) + for key in wii_database: + new_category = QTreeWidgetItem() + new_category.setText(0, key) + for title in wii_database[key]: + new_title = QTreeWidgetItem() + new_title.setText(0, title["TID"] + " - " + title["Name"]) + for version in title["Versions"]: + new_version = QTreeWidgetItem() + new_version.setText(0, str(version)) + + new_title.addChild(new_version) + new_category.addChild(new_title) + self.tree_categories.append(new_category) + + tree.insertTopLevelItems(0, self.tree_categories) + tree.itemDoubleClicked.connect(self.onItemClicked) + + @Slot(QTreeWidgetItem, int) + def onItemClicked(self, item, col): + if item.parent() is not None and item.parent() not in self.tree_categories: + category = item.parent().parent().text(0) + for title in wii_database[category]: + if item.parent().text(0) == (title["TID"] + " - " + title["Name"]): + selected_title = title + selected_version = item.text(0) + self.load_title_data(selected_title, selected_version) def update_log_text(self, new_text): self.log_text += new_text + "\n" @@ -58,6 +82,20 @@ class MainWindow(QMainWindow, Ui_MainWindow): scrollBar = self.ui.log_text_browser.verticalScrollBar() scrollBar.setValue(scrollBar.maximum()) + def load_title_data(self, selected_title, selected_version): + self.ui.tid_entry.setText(selected_title["TID"]) + self.ui.version_entry.setText(selected_version) + wad_name = selected_title["WAD Name"] + "-v" + selected_version + ".wad" + self.ui.wad_file_entry.setText(wad_name) + danger_text = "" + try: + danger_text = selected_title["Danger"] + except KeyError: + pass + self.log_text = (selected_title["TID"] + " - " + selected_title["Name"] + "\n" + "Version: " + selected_version + + "\n\n" + danger_text + "\n") + self.ui.log_text_browser.setText(self.log_text) + def download_btn_pressed(self): self.ui.download_btn.setEnabled(False) self.log_text = "" @@ -182,10 +220,6 @@ if __name__ == "__main__": app = QApplication(sys.argv) wii_database = json.load(open("wii-database.json", "r")) - sys_titles = [] - for key in wii_database["SYS"]: - sys_titles.append(key) - print(sys_titles[0]["Name"]) out_folder = pathlib.Path("titles") if not out_folder.is_dir(): diff --git a/qt/py/ui_MainMenu.py b/qt/py/ui_MainMenu.py index 7b83f56..2dbf9d1 100644 --- a/qt/py/ui_MainMenu.py +++ b/qt/py/ui_MainMenu.py @@ -26,11 +26,21 @@ class Ui_MainWindow(object): MainWindow.setObjectName(u"MainWindow") MainWindow.resize(610, 605) MainWindow.setMinimumSize(QSize(610, 605)) - MainWindow.setMaximumSize(QSize(800, 605)) + MainWindow.setMaximumSize(QSize(610, 605)) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(u"centralwidget") self.horizontalLayout_3 = QHBoxLayout(self.centralwidget) self.horizontalLayout_3.setObjectName(u"horizontalLayout_3") + self.verticalLayout = QVBoxLayout() + self.verticalLayout.setObjectName(u"verticalLayout") + self.label_2 = QLabel(self.centralwidget) + self.label_2.setObjectName(u"label_2") + font = QFont() + font.setBold(True) + self.label_2.setFont(font) + + self.verticalLayout.addWidget(self.label_2) + self.title_tree = QTreeWidget(self.centralwidget) __qtreewidgetitem = QTreeWidgetItem() __qtreewidgetitem.setText(0, u"1"); @@ -39,25 +49,13 @@ class Ui_MainWindow(object): self.title_tree.setColumnCount(1) self.title_tree.header().setVisible(False) - self.horizontalLayout_3.addWidget(self.title_tree) + self.verticalLayout.addWidget(self.title_tree) + + + self.horizontalLayout_3.addLayout(self.verticalLayout) self.verticalLayout_3 = QVBoxLayout() self.verticalLayout_3.setObjectName(u"verticalLayout_3") - self.horizontalLayout = QHBoxLayout() - self.horizontalLayout.setObjectName(u"horizontalLayout") - self.show_titles_btn = QPushButton(self.centralwidget) - self.show_titles_btn.setObjectName(u"show_titles_btn") - - self.horizontalLayout.addWidget(self.show_titles_btn) - - self.show_more_btn = QPushButton(self.centralwidget) - self.show_more_btn.setObjectName(u"show_more_btn") - - self.horizontalLayout.addWidget(self.show_more_btn) - - - self.verticalLayout_3.addLayout(self.horizontalLayout) - self.horizontalLayout_2 = QHBoxLayout() self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") self.tid_entry = QLineEdit(self.centralwidget) @@ -141,14 +139,20 @@ class Ui_MainWindow(object): def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None)) - self.show_titles_btn.setText(QCoreApplication.translate("MainWindow", u"Titles", None)) - self.show_more_btn.setText(QCoreApplication.translate("MainWindow", u"More", None)) + self.label_2.setText(QCoreApplication.translate("MainWindow", u"Available Titles", None)) self.tid_entry.setText("") self.tid_entry.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Title ID", None)) self.label.setText(QCoreApplication.translate("MainWindow", u"v", None)) self.version_entry.setPlaceholderText(QCoreApplication.translate("MainWindow", u"Version", None)) self.download_btn.setText(QCoreApplication.translate("MainWindow", u"Start NUS Download!", None)) - self.log_text_browser.setMarkdown("") + self.log_text_browser.setMarkdown(QCoreApplication.translate("MainWindow", u"Select a title from the list on the left, or enter a Title ID to begin.\n" +"\n" +"", None)) + self.log_text_browser.setHtml(QCoreApplication.translate("MainWindow", u"\n" +"\n" +"

Select a title from the list on the left, or enter a Title ID to begin.

", None)) self.pack_wad_chkbox.setText(QCoreApplication.translate("MainWindow", u"Pack WAD", None)) self.wad_file_entry.setPlaceholderText(QCoreApplication.translate("MainWindow", u"File Name", None)) self.keep_enc_chkbox.setText(QCoreApplication.translate("MainWindow", u"Keep Enc. Contents", None)) diff --git a/qt/ui/MainMenu.ui b/qt/ui/MainMenu.ui index 4904e8d..e559ce5 100644 --- a/qt/ui/MainMenu.ui +++ b/qt/ui/MainMenu.ui @@ -18,7 +18,7 @@ - 800 + 610 605 @@ -28,40 +28,39 @@ - - - 1 - - - false - - - - 1 - - - + + + + + + 75 + true + + + + Available Titles + + + + + + + 1 + + + false + + + + 1 + + + + + - - - - - - Titles - - - - - - - More - - - - - @@ -106,7 +105,16 @@ - + Select a title from the list on the left, or enter a Title ID to begin. + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Select a title from the list on the left, or enter a Title ID to begin.</p></body></html> diff --git a/wii-database.json b/wii-database.json new file mode 100644 index 0000000..7f25c48 --- /dev/null +++ b/wii-database.json @@ -0,0 +1,264 @@ +{ + "System": [ + { + "Name": "boot2", + "TID": "0000000100000001", + "Versions": [4], + "Ticket": true, + "WAD Name": "boot2-NUS", + "Danger": "boot2 is a critical part of the Wii's boot process, and should not be modified. You're also likely to already be running boot2v4, which is the only version of boot2 available on the NUS." + }, + { + "Name": "System Menu", + "TID": "0000000100000002", + "Versions": [97, 128, 130, 162, 192, 193, 194, 224, 225, 226, 256, 257, 258, 288, 289, 290, 352, 353, 354, 384, 385, 386, 390, 416, 417, 418, 448, 449, 450, 454, 480, 481, 482, 486,512, 513, 514, 518], + "Ticket": true, + "WAD Name": "RVL-WiiSystemmenu", + "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." + }, + { + "Name": "BC", + "TID": "0000000100000100", + "Versions": [2, 4, 5, 6], + "Ticket": true, + "WAD Name": "BC-NUS", + "Danger": "BC is required for the Wii's backwards compatibility with the GameCube. GameCube games will not run properly if BC is damaged or not present, and BC will need to be reinstalled." + }, + { + "Name": "MIOS", + "TID": "0000000100000101", + "Versions": [4, 5, 8, 9, 10], + "Ticket": true, + "WAD Name": "MIOS-NUS", + "Danger": "MIOS is required for the Wii's backwards compatibility with the GameCube. GameCube games will not run properly if MIOS is damaged or not present, and MIOS will need to be reinstalled." + } + ], + "IOS": [ + { + "Name": "IOS 4", + "TID": "0000000100000004", + "Versions": [65280], + "Ticket": true, + "WAD Name": "IOS4-64", + "Danger": "This IOS is a stub, and no longer offers any functionality. It cannot be used to run any code." + }, + { + "Name": "IOS 9", + "TID": "0000000100000009", + "Versions": [520, 521, 778, 1034], + "Ticket": true, + "WAD Name": "IOS9-64" + }, + { + "Name": "IOS 10", + "TID": "000000010000000A", + "Versions": [768], + "Ticket": true, + "WAD Name": "IOS10-64" + }, + { + "Name": "IOS 11", + "TID": "000000010000000B", + "Versions": [10, 256], + "Ticket": true, + "WAD Name": "IOS11-64", + "Danger": "Version 256 of IOS 11 is a stub, and no longer offers any functionality. It cannot be used to run any code. If you're using System Menu 2.0-2.1, DO NOT install version 256, as the System Menu relies on IOS 11." + }, + { + "Name": "IOS 12", + "TID": "000000010000000C", + "Versions": [6, 11, 12, 269, 525, 526], + "Ticket": true, + "WAD Name": "IOS12-64" + }, + { + "Name": "IOS 13", + "TID": "000000010000000D", + "Versions": [10, 15, 16, 273, 1031, 1032], + "Ticket": true, + "WAD Name": "IOS13-64" + }, + { + "Name": "IOS 14", + "TID": "000000010000000E", + "Versions": [262, 263, 520, 1031, 1032], + "Ticket": true, + "WAD Name": "IOS14-64" + }, + { + "Name": "IOS 15", + "TID": "000000010000000F", + "Versions": [257, 258, 259, 260, 265, 266, 523, 1031, 1032], + "Ticket": true, + "WAD Name": "IOS15-64" + }, + { + "Name": "IOS 16", + "TID": "0000000100000010", + "Versions": [512], + "Ticket": true, + "WAD Name": "IOS16-64", + "Danger": "This IOS is a stub, and no longer offers any functionality. It cannot be used to run any code." + }, + { + "Name": "IOS 17", + "TID": "0000000100000011", + "Versions": [512, 517, 518, 775, 1031, 1032], + "Ticket": true, + "WAD Name": "IOS17-64" + }, + { + "Name": "IOS 20", + "TID": "0000000100000014", + "Versions": [12, 256], + "Ticket": true, + "WAD Name": "IOS20-64", + "Danger": "Version 256 of IOS 20 is a stub, and no longer offers any functionality. It cannot be used to run any code. If you're using System Menu 2.2, DO NOT install version 256, as the System Menu relies on IOS 20." + }, + { + "Name": "IOS 21", + "TID": "0000000100000015", + "Versions": [514, 515, 516, 517, 522, 525, 782, 1038, 1039], + "Ticket": true, + "WAD Name": "IOS21-64" + }, + { + "Name": "IOS 22", + "TID": "0000000100000016", + "Versions": [777, 780, 1037, 1293, 1294], + "Ticket": true, + "WAD Name": "IOS22-64" + }, + { + "Name": "IOS 28", + "TID": "000000010000001C", + "Versions": [1292, 1293, 1550, 1806, 1807], + "Ticket": true, + "WAD Name": "IOS28-64" + }, + { + "Name": "IOS 30", + "TID": "000000010000001E", + "Versions": [1037, 1039, 1040, 2576, 2816], + "Ticket": true, + "WAD Name": "IOS30-64", + "Danger": "Version 2816 of IOS 30 is a stub, and no longer offers any functionality. It cannot be used to run any code. If you're using System Menu 3.0-3.3, DO NOT install version 2816, as the System Menu relies on IOS 30." + }, + { + "Name": "IOS 31", + "TID": "000000010000001F", + "Versions": [1037, 1039, 1040, 2576, 3088, 3092, 3349, 3607, 3608], + "Ticket": true, + "WAD Name": "IOS31-64" + }, + { + "Name": "IOS 33", + "TID": "0000000100000021", + "Versions": [1040, 2832, 2834, 3091, 3607, 3608], + "Ticket": true, + "WAD Name": "IOS33-64" + }, + { + "Name": "IOS 34", + "TID": "0000000100000022", + "Versions": [1039, 3087, 3091, 3348, 3607, 3608], + "Ticket": true, + "WAD Name": "IOS34-64" + }, + { + "Name": "IOS 35", + "TID": "0000000100000023", + "Versions": [1040, 3088, 3092, 3349, 3607, 3608], + "Ticket": true, + "WAD Name": "IOS35-64" + }, + { + "Name": "IOS 36", + "TID": "0000000100000024", + "Versions": [1042, 3090, 3094, 3351, 3607, 3608], + "Ticket": true, + "WAD Name": "IOS36-64" + }, + { + "Name": "IOS 37", + "TID": "0000000100000025", + "Versions": [2070, 3609, 3612, 3869, 5662, 5663], + "Ticket": true, + "WAD Name": "IOS37-64" + }, + { + "Name": "IOS 38", + "TID": "0000000100000026", + "Versions": [3610, 3867, 4123, 4124], + "Ticket": true, + "WAD Name": "IOS38-64" + }, + { + "Name": "IOS 40", + "TID": "0000000100000028", + "Versions": [3072], + "Ticket": true, + "WAD Name": "IOS40-64", + "Danger": "Version 3072 of IOS 40 is a stub, and no longer offers any functionality. It cannot be used to run any code. If you're using System Menu 3.3K, DO NOT install version 3072, as the System Menu relies on IOS 40." + }, + { + "Name": "IOS 41", + "TID": "0000000100000029", + "Versions": [2835, 3091, 3348, 3606, 3607], + "Ticket": true, + "WAD Name": "IOS41-64" + }, + { + "Name": "IOS 43", + "TID": "000000010000002B", + "Versions": [2835, 3091, 3348, 3606, 3607], + "Ticket": true, + "WAD Name": "IOS43-64" + }, + { + "Name": "IOS 45", + "TID": "000000010000002D", + "Versions": [2835, 3091, 3348, 3606, 3607], + "Ticket": true, + "WAD Name": "IOS45-64" + }, + { + "Name": "IOS 46", + "TID": "000000010000002E", + "Versions": [2837, 3093, 3350, 3606, 3607], + "Ticket": true, + "WAD Name": "IOS46-64" + }, + { + "Name": "IOS 48", + "TID": "0000000100000030", + "Versions": [4123, 4124], + "Ticket": true, + "WAD Name": "IOS48-64" + }, + { + "Name": "IOS 50", + "TID": "0000000100000032", + "Versions": [4889, 5120], + "Ticket": true, + "WAD Name": "IOS50-64", + "Danger": "Version 5120 of IOS 50 is a stub, and no longer offers any functionality. It cannot be used to run any code. If you're using System Menu 3.3K, DO NOT install version 5120, as the System Menu relies on IOS 50." + }, + { + "Name": "IOS 51", + "TID": "0000000100000033", + "Versions": [4633, 4864], + "Ticket": true, + "WAD Name": "IOS51-64", + "Danger": "Version 4864 of IOS 50 is a stub, and no longer offers any functionality. It cannot be used to run any code." + }, + { + "Name": "IOS 52", + "TID": "0000000100000034", + "Versions": [5661, 5888], + "Ticket": true, + "WAD Name": "IOS52-64", + "Danger": "Version 5888 of IOS 50 is a stub, and no longer offers any functionality. It cannot be used to run any code. If you're using System Menu 3.5, DO NOT install version 5888, as the System Menu relies on IOS 50." + } + ] +} \ No newline at end of file