From 3fcea08eb794813f3eb629f92abcd7dc3c50c81c Mon Sep 17 00:00:00 2001 From: VCoding Date: Mon, 22 Mar 2021 19:06:45 +0100 Subject: [PATCH] Update 2.3 Look at the changelogs file. --- CHANGELOGS | 9 +++ DarkU.py | 205 ++++++++++++++++++++++++-------------------------- assets/gui.py | 81 ++++++++++++++------ lastVersion | 2 +- 4 files changed, 168 insertions(+), 129 deletions(-) create mode 100644 CHANGELOGS diff --git a/CHANGELOGS b/CHANGELOGS new file mode 100644 index 0000000..4c481f7 --- /dev/null +++ b/CHANGELOGS @@ -0,0 +1,9 @@ + UPDATE 2.3 + 22/03/2021 + +- Adding a CHANGELOGS file +- Addition of an update checking system +- Deactivation of the "Get Current Color" option due to a bug (crash) +- Added support for version 5.5.5 +- Added support for version 5.5.3 for USA and JAP consoles. +- Added better support for the software icon for Windows (software crashed when the icon was not loaded.) \ No newline at end of file diff --git a/DarkU.py b/DarkU.py index 0d5df5a..599d003 100644 --- a/DarkU.py +++ b/DarkU.py @@ -5,7 +5,7 @@ # !usr/bin/env python # -*- coding: utf-8 -*- -import sys, os, re, calendar, time +import sys, os, re, calendar, time, requests from sys import platform sys.dont_write_bytecode = True @@ -21,7 +21,7 @@ sys.exit('The color.py file located in the assets folder is missing.') try: - from PyQt5 import QtWidgets + from PyQt5 import QtWidgets, QtGui from PyQt5.QtWidgets import QMessageBox except: sys.exit(color.red + "The PyQt5 module is missing.") @@ -42,24 +42,22 @@ except: sys.exit(color.red + "The gui.py file in the assets folder is missing!") - -# System Verification -if platform == "linux" or platform == "linux2" or platform == "darwin": - separator = "/" -elif platform == "win32": - separator = "\\" -else: - sys.exit(color.red + "Your system was not recognised.\nPlease contact me as soon as possible!") - +sep = os.path.sep # Variables -version = "2.2" +version = "2.3" error = 0 -filePath = os.getcwd() + separator + "assets" + separator + "config.darku" +filePath = os.getcwd() + sep + "assets" + sep + "config.darku" title = "DarkU v" + version -ram_55X = 0x105DD0A8 -ram_554 = 0x105DD2A8 -lastVer = "5.5.4" + + +EUR_554 = 0x105DD2A8 +EUR_55X = 0x105DD0A8 +ALL_55X = 0x105DD0A4 + +TITLE_ID_EUR = 0x0005001010040200 +TITLE_ID_USA = 0x0005001010040100 +TITLE_ID_JAP = 0x0005001010040000 # Discord RPC @@ -110,8 +108,21 @@ def __init__(self, parent = None): self.ui.connectionButton.clicked.connect(self.connection) self.ui.disconnectionButton.clicked.connect(self.disconnection) - self.ui.getCurrentColorButton.clicked.connect(self.getCurrentColor) + self.ui.regionComboBox.currentTextChanged.connect(self.regionChanged) + #self.ui.getCurrentColorButton.clicked.connect(self.getCurrentColor) self.ui.applyButton.clicked.connect(self.applyColor) + + try: + r = requests.get('https://raw.githubusercontent.com/vincent-coding/DarkU/2.X/lastVersion') + if r.status_code == 200: + lastVer = r.text.replace("\n", "") + if lastVer != version: + self.ui.newVersionLabel.setText("

New update available (" + lastVer + ")

") + else: + self.ui.newVersionLabel.setText("") + except: + self.ui.newVersionLabel.setText("Cannot detect if an update has been released.") + def closeEvent(self, event): if self.connected == True: @@ -149,10 +160,7 @@ def connection(self): self.ui.ipTextBox.setEnabled(False) self.ui.connectionButton.setEnabled(False) self.ui.disconnectionButton.setEnabled(True) - self.ui.versionComboBox.setEnabled(True) - self.ui.colorComboBox.setEnabled(True) - self.ui.applyButton.setEnabled(True) - self.ui.getCurrentColorButton.setEnabled(True) + self.ui.regionComboBox.setEnabled(True) self.connected = True QMessageBox.information(self, title, "The connection to " + wiiu_ip + " was a success!") @@ -172,105 +180,90 @@ def disconnection(self): self.ui.ipTextBox.setEnabled(True) self.ui.connectionButton.setEnabled(True) self.ui.disconnectionButton.setEnabled(False) + self.ui.regionComboBox.setEnabled(False) self.ui.versionComboBox.setEnabled(False) self.ui.colorComboBox.setEnabled(False) self.ui.applyButton.setEnabled(False) self.ui.getCurrentColorButton.setEnabled(False) + self.ui.regionComboBox.setCurrentIndex(0) + self.ui.versionComboBox.setCurrentIndex(0) + self.ui.colorComboBox.setCurrentIndex(0) QMessageBox.information(self, title, "Disconnection of the console was successful!") except: QMessageBox.critical(self, title, "An error occurred when disconnecting the console!") - def getCurrentColor(self): - wiiu_version = self.ui.versionComboBox.currentIndex() - if wiiu_version == 0: - return QMessageBox.critical(self, title, "Please choose a version!") - if wiiu_version == 1: - return QMessageBox.critical(self, title, "This option is only available for WiiUs with the latest available version (" + lastVer + ").") - if wiiu_version == 2: - value = self.gecko.readmem(ram_554, 4).hex() - if value.lower() == "3f800000": - return self.ui.colorComboBox.setCurrentIndex(1) - if value.lower() == "40000000": - return self.ui.colorComboBox.setCurrentIndex(2) - if value.lower() == "3e800000": - return self.ui.colorComboBox.setCurrentIndex(3) - if value.lower() == "3d800000": - return self.ui.colorComboBox.setCurrentIndex(4) - if value.lower() == "3c800000": - return self.ui.colorComboBox.setCurrentIndex(5) - if value.lower() == "3b800000": - return self.ui.colorComboBox.setCurrentIndex(6) - if value.lower() == "00000000": - return self.ui.colorComboBox.setCurrentIndex(7) - QMessageBox.critical(self, title, "No colour was determined.") - - def applyColor(self): - wiiu_version = self.ui.versionComboBox.currentIndex() - color_index = self.ui.colorComboBox.currentIndex() - if wiiu_version == 0: + def regionChanged(self): + regionComboBox = self.ui.regionComboBox.currentIndex() + if regionComboBox == 0: + self.ui.versionComboBox.setEnabled(False) + self.ui.colorComboBox.setEnabled(False) + self.ui.applyButton.setEnabled(False) + self.ui.getCurrentColorButton.setEnabled(False) + #QMessageBox.critical(self, title, "Please select a region!") + elif regionComboBox == 1 or regionComboBox == 2: + if regionComboBox == 1: + self.region = "EUR" + elif regionComboBox == 2: + self.region = "JAP-USA" + else: + return QMessageBox.critical(self, title, "An error has occurred!") + self.ui.versionComboBox.setEnabled(True) + self.ui.colorComboBox.setEnabled(True) + self.ui.applyButton.setEnabled(True) + #self.ui.getCurrentColorButton.setEnabled(True) + self.ui.getCurrentColorButton.setEnabled(False) + + def applyColor(self): + if self.ui.regionComboBox.currentIndex() == 0: + return QMessageBox.critical(self, title, "An unknown error has occurred!") + elif self.ui.versionComboBox.currentIndex() == 0: return QMessageBox.critical(self, title, "Please choose a version!") - if wiiu_version == 1: - if color_index == 0: - return QMessageBox.critical(self, title, "Please choose a color!") - QMessageBox.warning(self, title, "You are on an older version of the WiiU, the values do not always work.\n\nIf this does not work, please update your console version to the latest available version (" + lastVer + ").") - try: - if color_index == 1: - self.gecko.pokemem(ram_55X, 0x3f800000) - return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) - if color_index == 2: - self.gecko.pokemem(ram_55X, 0x40000000) - return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) - if color_index == 3: - self.gecko.pokemem(ram_55X, 0x3E800000) - return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) - if color_index == 4: - self.gecko.pokemem(ram_55X, 0x3D800000) - return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) - if color_index == 5: - self.gecko.pokemem(ram_55X, 0x3C800000) - return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) - if color_index == 6: - self.gecko.pokemem(ram_55X, 0x3B800000) - return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) - if color_index == 7: - self.gecko.pokemem(ram_55X, 0x00000000) - return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) - QMessageBox.critical(self, title, "An error occurred when determining the chosen colour.") - except: - QMessageBox.critical(self, title, "An error occurred when sending the request.") - if wiiu_version == 2: - if color_index == 0: - return QMessageBox.critical(self, title, "Please choose a color!") - try: - if color_index == 1: - self.gecko.pokemem(ram_554, 0x3f800000) - return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) - if color_index == 2: - self.gecko.pokemem(ram_554, 0x40000000) - return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) - if color_index == 3: - self.gecko.pokemem(ram_554, 0x3E800000) - return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) - if color_index == 4: - self.gecko.pokemem(ram_554, 0x3D800000) - return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) - if color_index == 5: - self.gecko.pokemem(ram_554, 0x3C800000) - return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) - if color_index == 6: - self.gecko.pokemem(ram_554, 0x3B800000) - return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) - if color_index == 7: - self.gecko.pokemem(ram_554, 0x00000000) - return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) - QMessageBox.critical(self, title, "An error occurred when determining the chosen colour.") - except: - QMessageBox.critical(self, title, "An error occurred when sending the request.") + elif self.ui.colorComboBox.currentIndex() == 0: + return QMessageBox.critical(self, title, "Please choose a colour!") + + if self.ui.regionComboBox.currentIndex() == 1: + if self.ui.versionComboBox.currentIndex() == 1: + usedRAM = EUR_55X + elif self.ui.versionComboBox.currentIndex() == 2: + usedRAM = EUR_554 + else: + return QMessageBox.critical(self, title, "An unknown error has occurred!") + elif self.ui.regionComboBox.currentIndex() == 2: + usedRAM = ALL_55X + + color_index = self.ui.colorComboBox.currentIndex() + if color_index == 1: + self.gecko.pokemem(usedRAM, 0x3f800000) + return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) + if color_index == 2: + self.gecko.pokemem(usedRAM, 0x40000000) + return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) + if color_index == 3: + self.gecko.pokemem(usedRAM, 0x3E800000) + return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) + if color_index == 4: + self.gecko.pokemem(usedRAM, 0x3D800000) + return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) + if color_index == 5: + self.gecko.pokemem(usedRAM, 0x3C800000) + return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) + if color_index == 6: + self.gecko.pokemem(ram_55X, 0x3B800000) + return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) + if color_index == 7: + self.gecko.pokemem(usedRAM, 0x00000000) + return QMessageBox.information(self, title, "The colour has been changed to: " + self.ui.colorComboBox.currentText()) + if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) window = MyWindow() window.setWindowTitle("DarkU v" + version) + try: + scriptDir = os.path.dirname(os.path.realpath(__file__)) + window.setWindowIcon(QtGui.QIcon(scriptDir + os.path.sep + 'assets' + os.path.sep + 'icons.png')) + except: + pass window.show() sys.exit(app.exec_()) \ No newline at end of file diff --git a/assets/gui.py b/assets/gui.py index ed17c21..41784ce 100644 --- a/assets/gui.py +++ b/assets/gui.py @@ -1,22 +1,11 @@ from PyQt5 import QtCore, QtGui, QtWidgets -from sys import platform -import os - -if platform == "linux" or platform == "linux2" or platform == "darwin": - separator = "/" -elif platform == "win32": - separator = "\\" - class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") - MainWindow.resize(300, 300) - MainWindow.setMinimumSize(QtCore.QSize(300, 300)) - MainWindow.setMaximumSize(QtCore.QSize(300, 300)) - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(os.getcwd() + separator + "assets" + separator + "icons.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) - MainWindow.setWindowIcon(icon) + MainWindow.resize(300, 340) + MainWindow.setMinimumSize(QtCore.QSize(300, 340)) + MainWindow.setMaximumSize(QtCore.QSize(300, 340)) MainWindow.setStyleSheet("background: #333; \n" "color: #fff;\n" "\n" @@ -51,7 +40,7 @@ def setupUi(self, MainWindow): " color: #fff;\n" "}") self.getCurrentColorButton.setObjectName("getCurrentColorButton") - self.gridLayout.addWidget(self.getCurrentColorButton, 8, 0, 1, 2) + self.gridLayout.addWidget(self.getCurrentColorButton, 9, 0, 1, 2) self.versionComboBox = QtWidgets.QComboBox(self.centralwidget) self.versionComboBox.setEnabled(False) self.versionComboBox.setStyleSheet(" QComboBox {\n" @@ -82,7 +71,7 @@ def setupUi(self, MainWindow): self.versionComboBox.addItem("") self.versionComboBox.addItem("") self.versionComboBox.addItem("") - self.gridLayout.addWidget(self.versionComboBox, 5, 0, 1, 2) + self.gridLayout.addWidget(self.versionComboBox, 6, 0, 1, 2) self.disconnectionButton = QtWidgets.QPushButton(self.centralwidget) self.disconnectionButton.setEnabled(False) self.disconnectionButton.setStyleSheet("QPushButton {\n" @@ -141,7 +130,8 @@ def setupUi(self, MainWindow): self.colorComboBox.addItem("") self.colorComboBox.addItem("") self.colorComboBox.addItem("") - self.gridLayout.addWidget(self.colorComboBox, 6, 0, 1, 2) + self.colorComboBox.addItem("") + self.gridLayout.addWidget(self.colorComboBox, 7, 0, 1, 2) self.ipTextBox = QtWidgets.QLineEdit(self.centralwidget) self.ipTextBox.setEnabled(True) self.ipTextBox.setStyleSheet("QLineEdit {\n" @@ -158,6 +148,7 @@ def setupUi(self, MainWindow): self.gridLayout.addWidget(self.ipTextBox, 1, 0, 1, 2) self.connectionButton = QtWidgets.QPushButton(self.centralwidget) self.connectionButton.setEnabled(True) + self.connectionButton.setTabletTracking(False) self.connectionButton.setStyleSheet("QPushButton {\n" " background-color: #444444;\n" " border-radius: 0px;\n" @@ -194,7 +185,7 @@ def setupUi(self, MainWindow): " color: #fff;\n" "}") self.applyButton.setObjectName("applyButton") - self.gridLayout.addWidget(self.applyButton, 7, 0, 1, 2) + self.gridLayout.addWidget(self.applyButton, 8, 0, 1, 2) self.copyrightLabel = QtWidgets.QLabel(self.centralwidget) self.copyrightLabel.setStyleSheet("a {\n" " color: red;\n" @@ -202,7 +193,49 @@ def setupUi(self, MainWindow): self.copyrightLabel.setAlignment(QtCore.Qt.AlignCenter) self.copyrightLabel.setOpenExternalLinks(True) self.copyrightLabel.setObjectName("copyrightLabel") - self.gridLayout.addWidget(self.copyrightLabel, 9, 0, 1, 2) + self.gridLayout.addWidget(self.copyrightLabel, 11, 0, 1, 2) + self.newVersionLabel = QtWidgets.QLabel(self.centralwidget) + font = QtGui.QFont() + font.setKerning(True) + self.newVersionLabel.setFont(font) + self.newVersionLabel.setTextFormat(QtCore.Qt.RichText) + self.newVersionLabel.setAlignment(QtCore.Qt.AlignCenter) + self.newVersionLabel.setOpenExternalLinks(True) + self.newVersionLabel.setObjectName("newVersionLabel") + self.gridLayout.addWidget(self.newVersionLabel, 10, 0, 1, 2) + self.regionComboBox = QtWidgets.QComboBox(self.centralwidget) + self.regionComboBox.setEnabled(False) + self.regionComboBox.setContextMenuPolicy(QtCore.Qt.NoContextMenu) + self.regionComboBox.setLayoutDirection(QtCore.Qt.LeftToRight) + self.regionComboBox.setStyleSheet(" QComboBox {\n" +" border: none;\n" +" border-radius: 3px;\n" +" padding: 1px 18px 1px 3px;\n" +" min-width: 6em;\n" +" }\n" +" QComboBox:!editable, QComboBox::drop-down:editable {\n" +" background: #444;\n" +" }\n" +"QComboBox:!editable:on, QComboBox::drop-down:editable:on {\n" +" background: #555;\n" +" }\n" +" QComboBox:on { \n" +" padding-top: 3px;\n" +" padding-left: 4px;\n" +" }\n" +" QComboBox QAbstractItemView {\n" +" border: 2px solid #444;\n" +" selection-background-color: #444;\n" +" }\n" +"QComboBox:disabled {\n" +" background: #373737;\n" +" color: #808080;\n" +"}") + self.regionComboBox.setObjectName("regionComboBox") + self.regionComboBox.addItem("") + self.regionComboBox.addItem("") + self.regionComboBox.addItem("") + self.gridLayout.addWidget(self.regionComboBox, 5, 0, 1, 2) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) @@ -210,11 +243,11 @@ def setupUi(self, MainWindow): def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate - MainWindow.setWindowTitle(_translate("MainWindow", "DarkU v???")) + MainWindow.setWindowTitle(_translate("MainWindow", "DarkU - v???")) self.getCurrentColorButton.setText(_translate("MainWindow", "Get current colour")) self.versionComboBox.setItemText(0, _translate("MainWindow", "-- Choose the version of your WiiU --")) - self.versionComboBox.setItemText(1, _translate("MainWindow", "5.5.1 / 5.5.2 / 5.5.3")) - self.versionComboBox.setItemText(2, _translate("MainWindow", "5.5.4")) + self.versionComboBox.setItemText(1, _translate("MainWindow", "5.5.3")) + self.versionComboBox.setItemText(2, _translate("MainWindow", "5.5.4 / 5.5.5")) self.disconnectionButton.setText(_translate("MainWindow", "Disconnection")) self.colorComboBox.setItemText(0, _translate("MainWindow", "-- Choose background colour --")) self.colorComboBox.setItemText(1, _translate("MainWindow", "Default")) @@ -224,7 +257,11 @@ def retranslateUi(self, MainWindow): self.colorComboBox.setItemText(5, _translate("MainWindow", "Dark Grey")) self.colorComboBox.setItemText(6, _translate("MainWindow", "Very Dark Grey")) self.colorComboBox.setItemText(7, _translate("MainWindow", "Black")) + self.colorComboBox.setItemText(8, _translate("MainWindow", " Dark Mode (Coming Soon)")) self.connectionButton.setText(_translate("MainWindow", "Connection")) self.wiiuIpLabel.setText(_translate("MainWindow", "WiiU IP:")) self.applyButton.setText(_translate("MainWindow", "Apply")) self.copyrightLabel.setText(_translate("MainWindow", "

© 2021 - By VCoding | Github

")) + self.regionComboBox.setItemText(0, _translate("MainWindow", "-- Choose the region of your WiiU --")) + self.regionComboBox.setItemText(1, _translate("MainWindow", "EUR")) + self.regionComboBox.setItemText(2, _translate("MainWindow", "USA / JAP")) diff --git a/lastVersion b/lastVersion index 8bbe6cf..c0943d3 100644 --- a/lastVersion +++ b/lastVersion @@ -1 +1 @@ -2.2 +2.3 \ No newline at end of file