From 88e7efaa0b211796d8221636190a159e33901ba7 Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Thu, 23 Aug 2012 13:35:48 +0200 Subject: [PATCH] region selector in NUS Downloader --- ChangeLog | 2 +- GUI/Ui_VenPri.py | 11 ++- GUI/VenPri.py | 48 ++++++++++-- GUI/VenPri.ui | 38 +++++++++- TitleIDs.py | 190 ++++++++++++++++++++++++++++++++++------------- 5 files changed, 222 insertions(+), 67 deletions(-) diff --git a/ChangeLog b/ChangeLog index d6c332d..2a079f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,7 +6,7 @@ taken from: [http://code.activestate.com/recipes/135435/] * ensure Python 2.x is used, Python 3.x is not yet supported * separate combobox for choosing channels, system-menu in downloader - as of now, region-code must be changed manually (instructions given) +* combobox to choose region for channels (JAP, PAL or USA) * changed order of tabs, downloader is now default tab * improved TMD Viewer - display title ID as ascii diff --git a/GUI/Ui_VenPri.py b/GUI/Ui_VenPri.py index fcd612e..330adcf 100644 --- a/GUI/Ui_VenPri.py +++ b/GUI/Ui_VenPri.py @@ -178,13 +178,17 @@ class Ui_Qwad(object): self.comboBox2.addItem(QtCore.QString()) self.decryptCheck = QtGui.QCheckBox(self.NUStab) self.decryptCheck.setEnabled(False) - self.decryptCheck.setGeometry(QtCore.QRect(40, 122, 171, 23)) + self.decryptCheck.setGeometry(QtCore.QRect(40, 122, 130, 23)) self.decryptCheck.setChecked(False) self.decryptCheck.setObjectName("decryptCheck") self.pack_in_WAD_checkbox = QtGui.QCheckBox(self.NUStab) - self.pack_in_WAD_checkbox.setGeometry(QtCore.QRect(170, 122, 181, 23)) + self.pack_in_WAD_checkbox.setGeometry(QtCore.QRect(120, 122, 150, 23)) self.pack_in_WAD_checkbox.setChecked(True) self.pack_in_WAD_checkbox.setObjectName("pack_in_WAD_checkbox") + self.ChooseRegion = QtGui.QComboBox(self.NUStab) + self.ChooseRegion.setGeometry(QtCore.QRect(230, 122, 150, 23)) + self.ChooseRegion.setObjectName("ChooseRegion") + self.ChooseRegion.addItem(QtCore.QString()) self.VersionlineEdit = QtGui.QLineEdit(self.NUStab) self.VersionlineEdit.setGeometry(QtCore.QRect(325, 45, 71, 25)) self.VersionlineEdit.setObjectName("VersionlineEdit") @@ -262,7 +266,8 @@ class Ui_Qwad(object): self.TitleIDlabel.setText(QtGui.QApplication.translate("Qwad", "Title ID", None, QtGui.QApplication.UnicodeUTF8)) self.Title.setText(QtGui.QApplication.translate("Qwad", "Choose title:", None, QtGui.QApplication.UnicodeUTF8)) self.comboBox.setItemText(0, QtGui.QApplication.translate("Qwad", "Choose IOS", None, QtGui.QApplication.UnicodeUTF8)) - self.comboBox2.setItemText(0, QtGui.QApplication.translate("Qwad", "Choose Channel/Menu", None, QtGui.QApplication.UnicodeUTF8)) + self.comboBox2.setItemText(0, QtGui.QApplication.translate("Qwad", "Choose Region First!", None, QtGui.QApplication.UnicodeUTF8)) + self.ChooseRegion.setItemText(0, QtGui.QApplication.translate("Qwad", "Choose Region", None, QtGui.QApplication.UnicodeUTF8)) self.decryptCheck.setText(QtGui.QApplication.translate("Qwad", "Decrypt", None, QtGui.QApplication.UnicodeUTF8)) self.pack_in_WAD_checkbox.setText(QtGui.QApplication.translate("Qwad", "Pack as WAD", None, QtGui.QApplication.UnicodeUTF8)) self.versionlabel.setText(QtGui.QApplication.translate("Qwad", "Version:", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/GUI/VenPri.py b/GUI/VenPri.py index 68ec280..56ef91f 100644 --- a/GUI/VenPri.py +++ b/GUI/VenPri.py @@ -30,9 +30,10 @@ class MWQwad(QMainWindow, Ui_Qwad): self.VersionlineEdit.setText(self.defaultversion) for key in TitleIDs.sorted_copy(TitleIDs.TitleDict): self.comboBox.addItem(key) - for key in TitleIDs.sorted_copy(TitleIDs.ChannelDict): - self.comboBox2.addItem(key) + for key in TitleIDs.SupportedRegions: + self.ChooseRegion.addItem(key) self.getReady() + self.default_region = "" def Status(self,status): print status @@ -210,7 +211,10 @@ class MWQwad(QMainWindow, Ui_Qwad): """ Show the title ID of the selected title """ - if self.comboBox.findText(selection) != 0: + if self.comboBox.findText(selection) == 0: + self.enteredTitleID.setText("") + self.availableVersions.setText("") + elif self.comboBox.findText(selection) > 0: self.enteredTitleID.enabled = False self.enteredTitleID.setText(TitleIDs.TitleDict[str(selection)]) self.availableVersions.setText(TitleIDs.IOSdict[str(selection)]) @@ -220,10 +224,42 @@ class MWQwad(QMainWindow, Ui_Qwad): """ Show the title ID of the selected title """ - if self.comboBox2.findText(selection) != 0: + print self.comboBox2.findText(selection) + if self.comboBox2.findText(selection) == 0: + self.enteredTitleID.setText("") + self.availableVersions.setText("") + elif self.comboBox2.findText(selection) > 0: self.enteredTitleID.enabled = False - self.enteredTitleID.setText(TitleIDs.ChannelDict[str(selection)]) - self.availableVersions.setText(TitleIDs.ChannelRegionDict[str(selection)]) + if self.default_region == "JAP": + self.enteredTitleID.setText(TitleIDs.ChannelJAPDict[str(selection)]) + self.availableVersions.setText(TitleIDs.ChannelJAPVerDict[str(selection)]) + elif self.default_region == "PAL": + self.enteredTitleID.setText(TitleIDs.ChannelPALDict[str(selection)]) + self.availableVersions.setText(TitleIDs.ChannelPALVerDict[str(selection)]) + elif self.default_region == "USA": + self.enteredTitleID.setText(TitleIDs.ChannelUSADict[str(selection)]) + self.availableVersions.setText(TitleIDs.ChannelUSAVerDict[str(selection)]) + + @pyqtSignature("QString") + def on_ChooseRegion_currentIndexChanged(self, selection): + self.default_region = "JAP" + if self.default_region != "": + count = self.comboBox2.count() + while count > -1 : + self.comboBox2.removeItem(count) + count = count - 1 + if self.ChooseRegion.findText(selection) != 0: + self.default_region = str(selection) + self.comboBox2.addItem("Choose Channel") + if self.default_region == "JAP": + for key in TitleIDs.sorted_copy(TitleIDs.ChannelJAPDict): + self.comboBox2.addItem(key) + elif self.default_region == "PAL": + for key in TitleIDs.sorted_copy(TitleIDs.ChannelPALDict): + self.comboBox2.addItem(key) + elif self.default_region == "USA": + for key in TitleIDs.sorted_copy(TitleIDs.ChannelUSADict): + self.comboBox2.addItem(key) @pyqtSignature("") def on_enteredTitleID_returnPressed(self): diff --git a/GUI/VenPri.ui b/GUI/VenPri.ui index ad0ea01..2307c30 100644 --- a/GUI/VenPri.ui +++ b/GUI/VenPri.ui @@ -46,7 +46,7 @@ false - 1 + 3 @@ -539,7 +539,7 @@ 40 120 - 171 + 111 23 @@ -553,9 +553,9 @@ - 220 + 150 120 - 181 + 131 23 @@ -633,6 +633,36 @@ + + + + 280 + 120 + 161 + 23 + + + + + Choose a Region + + + + + JAP + + + + + USA + + + + + PAL + + + diff --git a/TitleIDs.py b/TitleIDs.py index 4baafe4..182eefc 100644 --- a/TitleIDs.py +++ b/TitleIDs.py @@ -47,6 +47,8 @@ def swap_dic(original_dict): ####################### Swap Keys and Values of a dictionary ###################### return dict([(v, k) for (k, v) in original_dict.iteritems()]) +SupportedRegions = [ "JAP", "USA", "PAL" ] + TitleDict = { "IOS4":"0000000100000004", "IOS9":"0000000100000009", @@ -91,69 +93,151 @@ TitleDict = { TitleSwapDict = swap_dic(TitleDict) -ChannelDict = { +ChannelJAPDict = { "BOOT2":"0000000100000001", -"System Menu [JAP]":"0000000100000002", -"System Menu [PAL]":"0000000100000002", -"System Menu [KOR]":"0000000100000002", -"System Menu [USA]":"0000000100000002", +"System Menu":"0000000100000002", "BC":"0000000100000100", "MIOS":"0000000100000101", -"BBC iPlayer [PAL]":"0001000148434A50", -"Check Mii Out":"00010001484150**", -"Digicam Print [JAP]":"000100014843444A", -"EULA":"0001000848414B**", -"Everyone Votes":"0001000148414A**", -"Jam With The Band":"00010001484341**", -"Japan Food Service [JAP]":"000100084843434A", -"Mii Channel [ALL]":"0001000248414341", +"Check Mii Out":"000100014841504A", +"Digicam Print":"000100014843444A", +"EULA":"0001000848414B4A", +"Everyone Votes":"0001000148414A4A", +"Jam With The Band":"000100014843414A", +"Japan Food Service":"000100084843434A", +"Mii Channel":"0001000248414341", "News":"0001000248414741", -"Nintendo":"00010001484154**", -"Opera":"00010001484144**", -"Photo [ALL]":"0001000248414141", -"Photo 1.1":"00010002484159**", -"Region Select":"0001000848414C**", -"Shashin Channel [JAP]":"000100014843424A", -"Shop":"00010002484142**", -"Today & Tomorrow":"00010001484156**", -"TV Friend / G-Guide [JAP]":"0001000148424E4A", -"Weather":"00010002484146**", -"Wii No Ma [JAP]":"000100014843494A", -"Wii Speak":"00010001484346**" +"Nintendo":"000100014841544A", +"Opera":"000100014841444A", +"Photo":"0001000248414141", +"Photo 1.1":"000100024841594A", +"Region Select":"0001000848414C4A", +"Shashin Channel":"000100014843424A", +"Shop":"000100024841424A", +"Today & Tomorrow":"000100014841564A", +"TV Friend / G-Guide":"0001000148424E4A", +"Weather":"000100024841464A", +"Wii No Ma":"000100014843494A", +"Wii Speak":"000100014843464A" } -ChannelRegionDict = { +ChannelJAPVerDict = { "BOOT2":"4", -"System Menu [JAP]":"128 2.0, 192 2.1, 224 3.0, 256 3.1, 288 3.2,\ +"System Menu":"128 2.0, 192 2.1, 224 3.0, 256 3.1, 288 3.2,\ \n352 3.3, 384 3.4, 416 4.0, 448 4.1, 480 4.2,\n512 4.3", -"System Menu [PAL]":"130 2.0, 162 2.1, 194 2.2, 226 3.0, 257 3.1,\ -\n290 3.2, 354 3.3, 386 3.4, 418 4.0, 450 4.1,\n482 4.2, 514 4.3", -"System Menu [USA]":"97 2.0, 193 2.2, 225 3.0, 257 3.1, 289 3.2,\ -\n353 3.3, 385 3.4, 417 4.0, 449 4.1, 481 4.2,\n513 4.3", -"System Menu [KOR]":"390 3.5, 454 4.1, 486 4.2, 518 4.3", "BC":"2, 4, 5, 6", "MIOS":"4, 5, 8, 9, 10", -"BBC iPlayer [PAL]":"latest (PAL only)", -"Check Mii Out":"1, 3, 512,\n** = 45 (USA), 4A (JAP), 50 (PAL)", -"Digicam Print [JAP]":"latest (JAP only)", -"EULA":"1, 2, 3,\n** = 45 (USA), 4A (JAP), 4B (KOR), 50 (PAL)", -"Everyone Votes":"latest\n** = 45 (USA), 4A (JAP), 50 (PAL)", -"Japan Food Service [JAP]":"latest (JAP only)", -"Jam With The Band":"latest\n** = 4A (JAP), 50 (PAL)", -"Mii Channel [ALL]":"2, 3, 4, 5, 6", -"News":"3, 6, 7,\n** = 41 (ALL), 45 (USA), 4A (JAP), 50 (PAL)", -"Nintendo":"latest\n** = 45 (USA), 4A (JAP), 50 (PAL)", -"Opera":"1, 3, 257, 512, 1024\n** = 45 (USA), 4A (JAP), 50 (PAL)", -"Photo [ALL]":"1, 2", -"Photo 1.1":"1, 2, 3,\n** = 41 (ALL), 4B (KOR)", -"Region Select":"1, 2,\n** = 45 (USA), 4A (JAP), 4B (KOR), 50 (PAL)", -"Shashin Channel [JAP]":"latest (JAP only)", -"Shop":"3, 4, 5, 6, 7, 8, 10, 13, 14 (KOR only), 16,\n17, 18, 19, 20, ** = 41 (ALL), 4B (KOR)", -"Today & Tomorrow":"latest, ** = 4A (JAP), 50 (PAL)", -"TV Friend / G-Guide [JAP]":"latest (JAP only)", -"Weather":"3, 6, 7\n** = 41 (ALL), 45 (USA), 4A (JAP), 50 (PAL)", -"Wii No Ma [JAP]":"latest (JAP only)", -"Wii Speak":"1, 256, 512,\n** = 45 (USA), 4A (JAP), 50 (PAL)" +"Check Mii Out":"1, 3, 512", +"Digicam Print":"latest", +"EULA":"1, 2, 3,", +"Everyone Votes":"latest", +"Japan Food Service":"latest", +"Jam With The Band":"latest", +"Mii Channel":"2, 3, 4, 5, 6", +"News":"3, 6, 7,", +"Nintendo":"latest", +"Opera":"1, 3, 257, 512, 1024", +"Photo":"1, 2", +"Photo 1.1":"1, 2, 3,", +"Region Select":"1, 2,", +"Shashin Channel":"latest", +"Shop":"3, 4, 5, 6, 7, 8, 10, 13, 16,\n17, 18, 19, 20,", +"Today & Tomorrow":"latest", +"TV Friend / G-Guide":"latest", +"Weather":"3, 6, 7", +"Wii No Ma":"latest", +"Wii Speak":"1, 256, 512" +} + +ChannelPALDict = { +"BOOT2":"0000000100000001", +"System Menu":"0000000100000002", +"BC":"0000000100000100", +"MIOS":"0000000100000101", +"BBC iPlayer":"0001000148434A50", +"Check Mii Out":"0001000148415050", +"EULA":"0001000848414B50", +"Everyone Votes":"0001000148414A50", +"Jam With The Band":"0001000148434150", +"Mii Channel":"0001000248414341", +"News":"0001000248414741", +"Nintendo":"0001000148415450", +"Opera":"0001000148414450", +"Photo":"0001000248414141", +"Photo 1.1":"0001000248415950", +"Region Select":"0001000848414C50", +"Shop":"0001000248414250", +"Today & Tomorrow":"0001000148415650", +"Weather":"0001000248414650", +"Wii Speak":"0001000148434650" +} + +ChannelPALVerDict = { +"BOOT2":"4", +"System Menu":"130 2.0, 162 2.1, 194 2.2, 226 3.0, 257 3.1,\ +\n290 3.2, 354 3.3, 386 3.4, 418 4.0, 450 4.1,\n482 4.2, 514 4.3", +"BC":"2, 4, 5, 6", +"MIOS":"4, 5, 8, 9, 10", +"BBC iPlayer":"latest", +"Check Mii Out":"1, 3, 512,", +"EULA":"1, 2, 3,", +"Everyone Votes":"latest", +"Jam With The Band":"latest", +"Mii Channel":"2, 3, 4, 5, 6", +"News":"3, 6, 7,", +"Nintendo":"latest", +"Opera":"1, 3, 257, 512, 1024", +"Photo":"1, 2", +"Photo 1.1":"1, 2, 3,", +"Region Select":"1, 2,", +"Shop":"3, 4, 5, 6, 7, 8, 10, 13, 16,\n17, 18, 19, 20", +"Today & Tomorrow":"latest", +"Weather":"3, 6, 7", +"Wii Speak":"1, 256, 512" +} + +ChannelUSADict = { +"BOOT2":"0000000100000001", +"System Menu":"0000000100000002", +"BC":"0000000100000100", +"MIOS":"0000000100000101", +"Check Mii Out":"0001000148415045", +"EULA":"0001000848414B45", +"Everyone Votes":"0001000148414A45", +"Jam With The Band":"0001000148434145", +"Mii Channel":"0001000248414341", +"News":"0001000248414741", +"Nintendo":"0001000148415445", +"Opera":"0001000148414445", +"Photo":"0001000248414141", +"Photo 1.1":"0001000248415945", +"Region Select":"0001000848414C45", +"Shop":"0001000248414245", +"Today & Tomorrow":"0001000148415645", +"Weather":"0001000248414645", +"Wii Speak":"0001000148434650" +} + +ChannelUSAVerDict = { +"BOOT2":"4", +"System Menu":"97 2.0, 193 2.2, 225 3.0, 257 3.1, 289 3.2,\ +\n353 3.3, 385 3.4, 417 4.0, 449 4.1, 481 4.2,\n513 4.3", +"BC":"2, 4, 5, 6", +"MIOS":"4, 5, 8, 9, 10", +"Check Mii Out":"1, 3, 512,", +"EULA":"1, 2, 3,", +"Everyone Votes":"latest", +"Jam With The Band":"latest", +"Mii Channel":"2, 3, 4, 5, 6", +"News":"3, 6, 7,", +"Nintendo":"latest", +"Opera":"1, 3, 257, 512, 1024", +"Photo":"1, 2", +"Photo 1.1":"1, 2, 3,", +"Region Select":"1, 2,", +"Shop":"3, 4, 5, 6, 7, 8, 10, 13, 16,\n17, 18, 19, 20", +"Today & Tomorrow":"latest", +"Weather":"3, 6, 7", +"Wii Speak":"1, 256, 512" } IOSdict = {