1
0
Fork 0

last hotfixes

This commit is contained in:
JoshuaMKW 2020-11-06 05:45:05 -06:00
parent 50cceb6245
commit f185dc072e
3 changed files with 47 additions and 17 deletions

View file

@ -307,12 +307,13 @@ class GUI(object):
self.sessionPath = None self.sessionPath = None
self.prefs = {"qtstyle": "Default", "darktheme": False} self.prefs = {"qtstyle": "Default", "darktheme": False}
self.style_log = [] self.style_log = []
self.compileCount = 0
self.log = logging.getLogger(f"GeckoLoader {self.cli.__version__}") self.log = logging.getLogger(f"GeckoLoader {self.cli.__version__}")
if not os.path.exists(get_program_folder("GeckoLoader")): if not os.path.exists(get_program_folder("GeckoLoader")):
os.mkdir(get_program_folder("GeckoLoader")) os.mkdir(get_program_folder("GeckoLoader"))
hdlr = logging.FileHandler(os.path.join(get_program_folder("GeckoLoader"), "error.log")) hdlr = logging.FileHandler(os.path.join(get_program_folder("GeckoLoader"), "error.log"))
formatter = logging.Formatter("\n%(levelname)s (%(asctime)s): %(message)s") formatter = logging.Formatter("\n%(levelname)s (%(asctime)s): %(message)s")
hdlr.setFormatter(formatter) hdlr.setFormatter(formatter)
@ -526,7 +527,7 @@ class GUI(object):
def close_session(self): def close_session(self):
self.dolPath = None self.dolPath = None
self.codePath = None self.codePath = None
self.gctData = None self.sessionPath = None
self.ui.dolTextBox.setText("") self.ui.dolTextBox.setText("")
self.ui.gctFileTextBox.setText("") self.ui.gctFileTextBox.setText("")
self.ui.gctFolderTextBox.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)) self.uiexSettings.kernelHookLineEdit.textChanged.connect(lambda: self._enforce_mask(self.uiexSettings.kernelHookLineEdit, 0x817FFFFC, 0x80000000))
def _exec_api(self): 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() != "": if self.ui.dolTextBox.isEnabled and self.ui.dolTextBox.text().strip() != "":
dol = os.path.normpath(self.ui.dolTextBox.text().strip()) dol = os.path.normpath(self.ui.dolTextBox.text().strip())
else: else:
@ -789,8 +793,7 @@ class GUI(object):
self.ui.responses.appendPlainText(_msg.strip() + "\n") self.ui.responses.appendPlainText(_msg.strip() + "\n")
else: else:
for line in self._remove_ansi(_outpipe.getvalue()).split("\n"): for line in self._remove_ansi(_outpipe.getvalue()).split("\n"):
if line.strip() != "": _msg += line.lstrip() + "\n"
_msg += line.lstrip()
self.ui.responses.appendPlainText(_msg.strip() + "\n") self.ui.responses.appendPlainText(_msg.strip() + "\n")
def run(self): def run(self):

View file

@ -361,17 +361,37 @@ class DolFile(object):
for i, (offset, addr, size, _, _) in enumerate(self.textSections): for i, (offset, addr, size, _, _) in enumerate(self.textSections):
header = f"| Text section {i} |" 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): for i, (offset, addr, size, _, _) in enumerate(self.dataSections):
header = f"| Data section {i} |" 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 |" 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 |" 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__": if __name__ == "__main__":
# Example usage (Reading global string "mario" from Super Mario Sunshine (NTSC-U)) # Example usage (Reading global string "mario" from Super Mario Sunshine (NTSC-U))

View file

@ -1,20 +1,27 @@
import os
import sys import sys
from cx_Freeze import setup, Executable from cx_Freeze import setup, Executable
include_files = [ "bin/" ]
excludes = [ "tkinter" ]
options = { options = {
'build_exe': { "build_exe": {
'optimize': 4, "optimize": 4,
'excludes': ['tkinter'] "excludes": excludes,
"include_files": include_files
} }
} }
executables = [ executables = [
Executable('GeckoLoader.py'), Executable("GeckoLoader.py"),
] ]
setup(name='GeckoLoader', setup(name = "GeckoLoader",
version='v7.0.0', version = "7.0.0",
description='DOL Patcher for extending the codespace of Wii/GC games', description = "DOL Patcher for extending the codespace of Wii/GC games",
executables=executables, executables = [Executable("GeckoLoader.py", icon=os.path.join("bin", "icon.ico"))],
options=options author = "JoshuaMK",
author_email = "joshuamkw2002@gmail.com",
options = options
) )