From f185dc072efd5262ab3a8857e9f35b069b13d720 Mon Sep 17 00:00:00 2001 From: JoshuaMKW Date: Fri, 6 Nov 2020 05:45:05 -0600 Subject: [PATCH] last hotfixes --- GeckoLoader.py | 11 +++++++---- dolreader.py | 28 ++++++++++++++++++++++++---- setup.py | 25 ++++++++++++++++--------- 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/GeckoLoader.py b/GeckoLoader.py index cf3e0e4..e8b33b9 100644 --- a/GeckoLoader.py +++ b/GeckoLoader.py @@ -307,12 +307,13 @@ class GUI(object): self.sessionPath = None self.prefs = {"qtstyle": "Default", "darktheme": False} self.style_log = [] + self.compileCount = 0 self.log = logging.getLogger(f"GeckoLoader {self.cli.__version__}") if not os.path.exists(get_program_folder("GeckoLoader")): os.mkdir(get_program_folder("GeckoLoader")) - + hdlr = logging.FileHandler(os.path.join(get_program_folder("GeckoLoader"), "error.log")) formatter = logging.Formatter("\n%(levelname)s (%(asctime)s): %(message)s") hdlr.setFormatter(formatter) @@ -526,7 +527,7 @@ class GUI(object): def close_session(self): self.dolPath = None self.codePath = None - self.gctData = None + self.sessionPath = None self.ui.dolTextBox.setText("") self.ui.gctFileTextBox.setText("") self.ui.gctFolderTextBox.setText("") @@ -698,6 +699,9 @@ class GUI(object): self.uiexSettings.kernelHookLineEdit.textChanged.connect(lambda: self._enforce_mask(self.uiexSettings.kernelHookLineEdit, 0x817FFFFC, 0x80000000)) def _exec_api(self): + self.ui.responses.appendPlainText(f"| Session {self.compileCount} |".center(84, "=") + "\n") + self.compileCount += 1 + if self.ui.dolTextBox.isEnabled and self.ui.dolTextBox.text().strip() != "": dol = os.path.normpath(self.ui.dolTextBox.text().strip()) else: @@ -789,8 +793,7 @@ class GUI(object): self.ui.responses.appendPlainText(_msg.strip() + "\n") else: for line in self._remove_ansi(_outpipe.getvalue()).split("\n"): - if line.strip() != "": - _msg += line.lstrip() + _msg += line.lstrip() + "\n" self.ui.responses.appendPlainText(_msg.strip() + "\n") def run(self): diff --git a/dolreader.py b/dolreader.py index 2840482..62eb83f 100644 --- a/dolreader.py +++ b/dolreader.py @@ -361,17 +361,37 @@ class DolFile(object): for i, (offset, addr, size, _, _) in enumerate(self.textSections): header = f"| Text section {i} |" - print("-"*len(header) + "\n" + header + "\n" + "-"*len(header) + f"\n File offset:\t0x{offset:X}\n Virtual addr:\t0x{addr:X}\n Size:\t\t0x{size:X}\n") + info = [ "-"*len(header) + "\n" + header + "\n" + "-"*len(header), + "File Offset:".ljust(16, " ") + f"0x{offset:X}", + "Virtual addr:".ljust(16, " ") + f"0x{addr:X}", + "Size:".ljust(16, " ") + f"0x{size:X}" ] + + print("\n".join(info) + "\n") for i, (offset, addr, size, _, _) in enumerate(self.dataSections): header = f"| Data section {i} |" - print("-"*len(header) + "\n" + header + "\n" + "-"*len(header) + f"\n File offset:\t0x{offset:X}\n Virtual addr:\t0x{addr:X}\n Size:\t\t0x{size:X}\n") + info = [ "-"*len(header) + "\n" + header + "\n" + "-"*len(header), + "File Offset:".ljust(16, " ") + f"0x{offset:X}", + "Virtual addr:".ljust(16, " ") + f"0x{addr:X}", + "Size:".ljust(16, " ") + f"0x{size:X}" ] + + print("\n".join(info) + "\n") header = "| BSS section |" - print("-"*len(header) + "\n" + header + "\n" + "-"*len(header) + f"\n Virtual addr:\t0x{self.bssAddress:X}\n Size:\t\t0x{self.bssSize:X}\n End:\t\t0x{self.bssAddress+self.bssSize:X}\n") + info = [ "-"*len(header) + "\n" + header + "\n" + "-"*len(header), + "Virtual addr:".ljust(16, " ") + f"0x{self.bssAddress:X}", + "Size:".ljust(16, " ") + f"0x{self.bssSize:X}", + "End:".ljust(16, " ") + f"0x{self.bssAddress+self.bssSize:X}" ] + + print("\n".join(info) + "\n") header = "| Miscellaneous Info |" - print("-"*len(header) + "\n" + header + "\n" + "-"*len(header) + f"\n Text sections:\t{len(self.textSections)}\n Data sections:\t{len(self.dataSections)}\n File length:\t0x{self.get_full_size():X} bytes\n") + info = [ "-"*len(header) + "\n" + header + "\n" + "-"*len(header), + "Text sections:".ljust(16, " ") + f"0x{len(self.textSections):X}", + "Data sections:".ljust(16, " ") + f"0x{len(self.dataSections):X}", + "File length:".ljust(16, " ") + f"0x{self.get_full_size():X}" ] + + print("\n".join(info) + "\n") if __name__ == "__main__": # Example usage (Reading global string "mario" from Super Mario Sunshine (NTSC-U)) diff --git a/setup.py b/setup.py index 81dc642..e02211f 100644 --- a/setup.py +++ b/setup.py @@ -1,20 +1,27 @@ +import os import sys from cx_Freeze import setup, Executable +include_files = [ "bin/" ] +excludes = [ "tkinter" ] + options = { - 'build_exe': { - 'optimize': 4, - 'excludes': ['tkinter'] + "build_exe": { + "optimize": 4, + "excludes": excludes, + "include_files": include_files } } executables = [ - Executable('GeckoLoader.py'), + Executable("GeckoLoader.py"), ] -setup(name='GeckoLoader', - version='v7.0.0', - description='DOL Patcher for extending the codespace of Wii/GC games', - executables=executables, - options=options +setup(name = "GeckoLoader", + version = "7.0.0", + description = "DOL Patcher for extending the codespace of Wii/GC games", + executables = [Executable("GeckoLoader.py", icon=os.path.join("bin", "icon.ico"))], + author = "JoshuaMK", + author_email = "joshuamkw2002@gmail.com", + options = options ) \ No newline at end of file