Greatly improved how regions are handled

This commit is contained in:
Campbell 2024-04-29 21:18:17 -04:00
parent 3eff8d08fe
commit d2348f0b78
Signed by: NinjaCheetah
GPG Key ID: B547958AF96ED344
2 changed files with 71 additions and 87 deletions

View File

@ -13,8 +13,8 @@ from PySide6.QtCore import QRunnable, Slot, QThreadPool, Signal, QObject
from qt.py.ui_MainMenu import Ui_MainWindow from qt.py.ui_MainMenu import Ui_MainWindow
regions = [["World", "World", "41"], ["USA", "USA/NTSC", "45"], ["JAP", "Japan", "4A"], ["EUR", "Europe/PAL", "50"],
["KOR", "Korea", "4B"]] regions = {"World": ["41"], "USA/NTSC": ["45"], "Europe/PAL": ["50"], "Japan": ["4A"], "Korea": ["4B"]}
# Signals needed for the worker used for threading the downloads. # Signals needed for the worker used for threading the downloads.
@ -78,15 +78,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# Build the list of regions and what versions are offered for each region. # Build the list of regions and what versions are offered for each region.
for region in title["Versions"]: for region in title["Versions"]:
new_region = QTreeWidgetItem() new_region = QTreeWidgetItem()
region_title = "" new_region.setText(0, region)
# This part is probably done poorly and should be improved.
if region == "World":
region_title = "World"
else:
for entry in regions:
if entry[0] == region:
region_title = entry[1]
new_region.setText(0, region_title)
for version in title["Versions"][region]: for version in title["Versions"][region]:
new_version = QTreeWidgetItem() new_version = QTreeWidgetItem()
new_version.setText(0, "v" + str(version)) new_version.setText(0, "v" + str(version))
@ -106,10 +98,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
@Slot(QTreeWidgetItem, int) @Slot(QTreeWidgetItem, int)
def onItemClicked(self, item, col): def onItemClicked(self, item, col):
if self.ui.download_btn.isEnabled() is True: if self.ui.download_btn.isEnabled() is True:
global regions
region_names = []
for region in regions:
region_names.append(region[1])
# This is checking to make sure all category names, title names, and region names are not handled as # This is checking to make sure all category names, title names, and region names are not handled as
# valid choices. item.parent().parent().parent().text(0) is terrifying, I know. # valid choices. item.parent().parent().parent().text(0) is terrifying, I know.
if ((item.parent() is not None) and item.parent() not in self.tree_categories if ((item.parent() is not None) and item.parent() not in self.tree_categories
@ -138,11 +126,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# two-digit code. Use the region info passed to load the correct code. # two-digit code. Use the region info passed to load the correct code.
if selected_title["TID"][-2:] == "XX": if selected_title["TID"][-2:] == "XX":
global regions global regions
region_code = "" region_code = regions[selected_region][0]
# Similarly to previous region-related code, this can definitely be improved.
for region in regions:
if region[1] == selected_region:
region_code = region[2]
tid = selected_title["TID"][:-2] + region_code tid = selected_title["TID"][:-2] + region_code
else: else:
tid = selected_title["TID"] tid = selected_title["TID"]
@ -164,8 +148,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
pass pass
# Add warning text to the log if the selected title has no ticket. # Add warning text to the log if the selected title has no ticket.
if selected_title["Ticket"] is False: if selected_title["Ticket"] is False:
danger_text = danger_text + ("Note: This Title does not have a Ticket available, so it cannot be " danger_text = danger_text + ("Note: This Title does not have a Ticket available, so it cannot be packed "
"packed into a WAD or decrypted.") "into a WAD or be decrypted.")
# Print log info about the selected title and version. # Print log info about the selected title and version.
self.log_text = (tid + " - " + selected_title["Name"] + "\n" + "Version: " + selected_version + "\n\n" + self.log_text = (tid + " - " + selected_title["Name"] + "\n" + "Version: " + selected_version + "\n\n" +
danger_text + "\n") danger_text + "\n")

View File

@ -24,10 +24,10 @@
"Name": "EULA", "Name": "EULA",
"TID": "0001000848414BXX", "TID": "0001000848414BXX",
"Versions": { "Versions": {
"USA": [1, 2, 3], "USA/NTSC": [1, 2, 3],
"EUR": [1, 2, 3], "Europe/PAL": [1, 2, 3],
"JAP": [1, 2, 3], "Japan": [1, 2, 3],
"KOR": [1, 2, 3] "Korea": [1, 2, 3]
}, },
"Ticket": true, "Ticket": true,
"WAD Name": "EULA-NUS", "WAD Name": "EULA-NUS",
@ -47,10 +47,10 @@
"Name": "Region Select", "Name": "Region Select",
"TID": "0001000848414CXX", "TID": "0001000848414CXX",
"Versions": { "Versions": {
"USA": [1, 2], "USA/NTSC": [1, 2],
"EUR": [1, 2], "Europe/PAL": [1, 2],
"JAP": [1, 2], "Japan": [1, 2],
"KOR": [2] "Korea": [2]
}, },
"Ticket": true, "Ticket": true,
"WAD Name": "Region-Select-NUS", "WAD Name": "Region-Select-NUS",
@ -60,10 +60,10 @@
"Name": "System Menu", "Name": "System Menu",
"TID": "0000000100000002", "TID": "0000000100000002",
"Versions": { "Versions": {
"USA": [97, 193, 225, 257, 289, 353, 385, 417, 449, 481, 513], "USA/NTSC": [97, 193, 225, 257, 289, 353, 385, 417, 449, 481, 513],
"EUR": [130, 162, 194, 226, 258, 290, 354, 386, 418, 450, 482, 514], "Europe/PAL": [130, 162, 194, 226, 258, 290, 354, 386, 418, 450, 482, 514],
"JAP": [128, 192, 224, 256, 288, 352, 384, 416, 448, 480, 512], "Japan": [128, 192, 224, 256, 288, 352, 384, 416, 448, 480, 512],
"KOR": [390, 454, 486, 518] "Korea": [390, 454, 486, 518]
}, },
"Ticket": true, "Ticket": true,
"WAD Name": "Wii-System-Menu", "WAD Name": "Wii-System-Menu",
@ -76,9 +76,9 @@
"TID": "00010002484146XX", "TID": "00010002484146XX",
"Versions": { "Versions": {
"World": [3], "World": [3],
"USA": [6, 7], "USA/NTSC": [6, 7],
"EUR": [6, 7], "Europe/PAL": [6, 7],
"JAP": [6, 7] "Japan": [6, 7]
}, },
"Ticket": true, "Ticket": true,
"WAD Name": "Forecast-Channel-NUS" "WAD Name": "Forecast-Channel-NUS"
@ -97,9 +97,9 @@
"TID": "00010002484147XX", "TID": "00010002484147XX",
"Versions": { "Versions": {
"World": [3], "World": [3],
"USA": [6, 7], "USA/NTSC": [6, 7],
"EUR": [6, 7], "Europe/PAL": [6, 7],
"JAP": [6, 7] "Japan": [6, 7]
}, },
"Ticket": true, "Ticket": true,
"WAD Name": "News-Channel-NUS" "WAD Name": "News-Channel-NUS"
@ -118,7 +118,7 @@
"TID": "00010002484159XX", "TID": "00010002484159XX",
"Versions": { "Versions": {
"World": [1, 2, 3], "World": [1, 2, 3],
"KOR": [3] "Korea": [3]
}, },
"Ticket": true, "Ticket": true,
"WAD Name": "Photo-Channel-1.1-NUS" "WAD Name": "Photo-Channel-1.1-NUS"
@ -128,7 +128,7 @@
"TID": "00010002484142XX", "TID": "00010002484142XX",
"Versions": { "Versions": {
"World": [3, 4, 5, 6, 7, 8, 10, 13, 16, 17, 18, 19, 20, 21], "World": [3, 4, 5, 6, 7, 8, 10, 13, 16, 17, 18, 19, 20, 21],
"KOR": [3, 4, 5, 6, 7, 8, 10, 13, 14, 16, 17, 18, 19, 20, 21] "Korea": [3, 4, 5, 6, 7, 8, 10, 13, 14, 16, 17, 18, 19, 20, 21]
}, },
"Ticket": true, "Ticket": true,
"WAD Name": "Shopping-Channel-NUS" "WAD Name": "Shopping-Channel-NUS"
@ -139,7 +139,7 @@
"Name": "Amazon Instant Video", "Name": "Amazon Instant Video",
"TID": "00010001484357XX", "TID": "00010001484357XX",
"Versions": { "Versions": {
"USA": [1280] "USA/NTSC": [1280]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "Amazon-Instant-Video-NUS" "WAD Name": "Amazon-Instant-Video-NUS"
@ -148,7 +148,7 @@
"Name": "BBC iPlayer Channel", "Name": "BBC iPlayer Channel",
"TID": "0001000148434AXX", "TID": "0001000148434AXX",
"Versions": { "Versions": {
"EUR": [768] "Europe/PAL": [768]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "BBC-iPlayer-Channel-NUS" "WAD Name": "BBC-iPlayer-Channel-NUS"
@ -157,9 +157,9 @@
"Name": "Check Mii Out Channel", "Name": "Check Mii Out Channel",
"TID": "00010001484150XX", "TID": "00010001484150XX",
"Versions": { "Versions": {
"USA": [1, 3, 512], "USA/NTSC": [1, 3, 512],
"EUR": [1, 3, 512], "Europe/PAL": [1, 3, 512],
"JAP": [1, 3, 512] "Japan": [1, 3, 512]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "Check-Mii-Out-Channel-NUS" "WAD Name": "Check-Mii-Out-Channel-NUS"
@ -168,7 +168,7 @@
"Name": "Demae Channel", "Name": "Demae Channel",
"TID": "00010008484343XX", "TID": "00010008484343XX",
"Versions": { "Versions": {
"JAP": [0, 1, 2] "Japan": [0, 1, 2]
}, },
"Ticket": true, "Ticket": true,
"WAD Name": "Demae-Channel-NUS" "WAD Name": "Demae-Channel-NUS"
@ -177,7 +177,7 @@
"Name": "Digicam Print Channel", "Name": "Digicam Print Channel",
"TID": "00010001484344XX", "TID": "00010001484344XX",
"Versions": { "Versions": {
"JAP": [1024] "Japan": [1024]
}, },
"Ticket": true, "Ticket": true,
"WAD Name": "Digicam-Print-Channel-NUS" "WAD Name": "Digicam-Print-Channel-NUS"
@ -186,9 +186,9 @@
"Name": "Everyone Votes Channel", "Name": "Everyone Votes Channel",
"TID": "0001000148414AXX", "TID": "0001000148414AXX",
"Versions": { "Versions": {
"USA": [1, 2, 3], "USA/NTSC": [1, 2, 3],
"EUR": [1, 2, 3], "Europe/PAL": [1, 2, 3],
"JAP": [1, 2, 3] "Japan": [1, 2, 3]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "Everyone-Votes-Channel-NUS" "WAD Name": "Everyone-Votes-Channel-NUS"
@ -197,8 +197,8 @@
"Name": "Hulu Plus", "Name": "Hulu Plus",
"TID": "00010001484351XX", "TID": "00010001484351XX",
"Versions": { "Versions": {
"USA": [1283], "USA/NTSC": [1283],
"JAP": [1024] "Japan": [1024]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "Hulu-Plus-NUS" "WAD Name": "Hulu-Plus-NUS"
@ -207,9 +207,9 @@
"Name": "Internet Channel", "Name": "Internet Channel",
"TID": "00010001484144XX", "TID": "00010001484144XX",
"Versions": { "Versions": {
"USA": [1, 3, 257, 512, 1024], "USA/NTSC": [1, 3, 257, 512, 1024],
"EUR": [1, 3, 257, 512, 1024], "Europe/PAL": [1, 3, 257, 512, 1024],
"JAP": [1, 3, 257, 512, 1024] "Japan": [1, 3, 257, 512, 1024]
}, },
"Ticket": true, "Ticket": true,
"WAD Name": "Internet-Channel-NUS" "WAD Name": "Internet-Channel-NUS"
@ -218,8 +218,8 @@
"Name": "Jam With The Band Live Channel", "Name": "Jam With The Band Live Channel",
"TID": "00010001484341XX", "TID": "00010001484341XX",
"Versions": { "Versions": {
"EUR": [2], "Europe/PAL": [2],
"JAP": [2] "Japan": [2]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "Jam-With-The-Band-Live-Channel-NUS" "WAD Name": "Jam-With-The-Band-Live-Channel-NUS"
@ -228,7 +228,7 @@
"Name": "Kirby TV Channel", "Name": "Kirby TV Channel",
"TID": "0001000148434DXX", "TID": "0001000148434DXX",
"Versions": { "Versions": {
"EUR": [257] "Europe/PAL": [257]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "Kirby-TV-Channel-NUS" "WAD Name": "Kirby-TV-Channel-NUS"
@ -237,8 +237,8 @@
"Name": "Metroid Prime 3 Preview", "Name": "Metroid Prime 3 Preview",
"TID": "00010001484157XX", "TID": "00010001484157XX",
"Versions": { "Versions": {
"EUR": [1, 2], "Europe/PAL": [1, 2],
"JAP": [1, 2] "Japan": [1, 2]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "Metroid-Prime-3-Preview-NUS" "WAD Name": "Metroid-Prime-3-Preview-NUS"
@ -247,8 +247,8 @@
"Name": "Netflix Channel", "Name": "Netflix Channel",
"TID": "0001000148434CXX", "TID": "0001000148434CXX",
"Versions": { "Versions": {
"USA": [2049], "USA/NTSC": [2049],
"EUR": [2049] "Europe/PAL": [2049]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "Netflix-Channel-NUS" "WAD Name": "Netflix-Channel-NUS"
@ -257,9 +257,9 @@
"Name": "Nintendo Channel", "Name": "Nintendo Channel",
"TID": "00010001484154XX", "TID": "00010001484154XX",
"Versions": { "Versions": {
"USA": [1792], "USA/NTSC": [1792],
"EUR": [1792], "Europe/PAL": [1792],
"JAP": [1792] "Japan": [1792]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "Nintendo-Channel-NUS" "WAD Name": "Nintendo-Channel-NUS"
@ -268,7 +268,7 @@
"Name": "Photo Channel 1.0 Restore Program", "Name": "Photo Channel 1.0 Restore Program",
"TID": "00010001484342XX", "TID": "00010001484342XX",
"Versions": { "Versions": {
"JAP": [0] "Japan": [0]
}, },
"Ticket": true, "Ticket": true,
"WAD Name": "Photo-Channel-1.0-Restore-Program-NUS" "WAD Name": "Photo-Channel-1.0-Restore-Program-NUS"
@ -277,9 +277,9 @@
"Name": "The Legend of Zelda: Skyward Sword Save Data Update Channel", "Name": "The Legend of Zelda: Skyward Sword Save Data Update Channel",
"TID": "00010001484352XX", "TID": "00010001484352XX",
"Versions": { "Versions": {
"USA": [1], "USA/NTSC": [1],
"EUR": [0], "Europe/PAL": [0],
"JAP": [1] "Japan": [1]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "Skyward-Sword-Save-Data-Update-Channel-NUS" "WAD Name": "Skyward-Sword-Save-Data-Update-Channel-NUS"
@ -288,8 +288,8 @@
"Name": "Today and Tomorrow Channel", "Name": "Today and Tomorrow Channel",
"TID": "00010001484156XX", "TID": "00010001484156XX",
"Versions": { "Versions": {
"EUR": [1], "Europe/PAL": [1],
"JAP": [1] "Japan": [1]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "Today-and-Tomorrow-Channel-NUS" "WAD Name": "Today-and-Tomorrow-Channel-NUS"
@ -298,7 +298,7 @@
"Name": "TV Friend Channel / G-Guide for Wii", "Name": "TV Friend Channel / G-Guide for Wii",
"TID": "0001000148424EXX", "TID": "0001000148424EXX",
"Versions": { "Versions": {
"JAP": [1] "Japan": [1]
}, },
"Ticket": true, "Ticket": true,
"WAD Name": "TV-Friend-Channel-NUS" "WAD Name": "TV-Friend-Channel-NUS"
@ -307,7 +307,7 @@
"Name": "USB Memory Repair Program", "Name": "USB Memory Repair Program",
"TID": "00010001484333XX", "TID": "00010001484333XX",
"Versions": { "Versions": {
"JAP": [12] "Japan": [12]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "USB-Repair-Program-NUS" "WAD Name": "USB-Repair-Program-NUS"
@ -316,7 +316,7 @@
"Name": "Wii no Ma Channel", "Name": "Wii no Ma Channel",
"TID": "00010001484349XX", "TID": "00010001484349XX",
"Versions": { "Versions": {
"JAP": [0] "Japan": [0]
}, },
"Ticket": true, "Ticket": true,
"WAD Name": "Wii-no-Ma-Channel-NUS" "WAD Name": "Wii-no-Ma-Channel-NUS"
@ -325,9 +325,9 @@
"Name": "Wii Speak Channel", "Name": "Wii Speak Channel",
"TID": "00010001484346XX", "TID": "00010001484346XX",
"Versions": { "Versions": {
"USA": [1, 256, 512], "USA/NTSC": [1, 256, 512],
"EUR": [1, 256, 512], "Europe/PAL": [1, 256, 512],
"JAP": [1, 256, 512] "Japan": [1, 256, 512]
}, },
"Ticket": true, "Ticket": true,
"WAD Name": "Wii-Speak-Channel-NUS" "WAD Name": "Wii-Speak-Channel-NUS"
@ -336,9 +336,9 @@
"Name": "Wii U Transfer Tool", "Name": "Wii U Transfer Tool",
"TID": "00010001484353XX", "TID": "00010001484353XX",
"Versions": { "Versions": {
"USA": [516], "USA/NTSC": [516],
"EUR": [516], "Europe/PAL": [516],
"JAP": [516] "Japan": [516]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "Wii-U-Transfer-Tool-NUS" "WAD Name": "Wii-U-Transfer-Tool-NUS"
@ -347,8 +347,8 @@
"Name": "YouTube", "Name": "YouTube",
"TID": "00010001484358XX", "TID": "00010001484358XX",
"Versions": { "Versions": {
"USA": [1536], "USA/NTSC": [1536],
"JAP": [768] "Japan": [768]
}, },
"Ticket": false, "Ticket": false,
"WAD Name": "YouTube-NUS" "WAD Name": "YouTube-NUS"
@ -801,9 +801,9 @@
"Name": "Brain Challenge", "Name": "Brain Challenge",
"TID": "00010001573243XX", "TID": "00010001573243XX",
"Versions": { "Versions": {
"USA": [1], "USA/NTSC": [1],
"EUR": [1], "Europe/PAL": [1],
"JAP": [1] "Japan": [1]
}, },
"Ticket": false "Ticket": false
} }