1
0
Fork 0

Created icon, misc changes

This commit is contained in:
JoshuaMKW 2020-10-19 23:15:33 -05:00
parent 8b5a57ba47
commit 5f0ed4fb86
4 changed files with 33 additions and 28 deletions

2
.gitignore vendored
View file

@ -134,3 +134,5 @@ dmypy.json
# Gct files # Gct files
*.gct *.gct
installer.py installer.py
children_ui.py
gui.py

View file

@ -34,7 +34,7 @@ except ImportError:
TRED = '' TRED = ''
TREDLIT = '' TREDLIT = ''
__version__ = 'v6.1.5' __version__ = 'v6.2.0'
def resource_path(relative_path: str): def resource_path(relative_path: str):
""" Get absolute path to resource, works for dev and for PyInstaller """ """ Get absolute path to resource, works for dev and for PyInstaller """

BIN
icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -218,6 +218,34 @@ class CodeHandler(object):
f.seek(0) f.seek(0)
def init_gct(self, gctFile: str, tmpdir: str=""):
if '.' in gctFile:
if os.path.splitext(gctFile)[1].lower() == '.txt':
with open(os.path.join(tmpdir, 'gct.bin'), 'wb+') as temp:
temp.write(bytes.fromhex('00D0C0DE'*2 + self.parse_input(gctFile) + 'F000000000000000'))
temp.seek(0)
self.geckoCodes = GCT(temp)
elif os.path.splitext(gctFile)[1].lower() == '.gct':
with open(gctFile, 'rb') as gct:
self.geckoCodes = GCT(gct)
else:
with open(os.path.join(tmpdir, 'gct.bin'), 'wb+') as temp:
temp.write(b'\x00\xD0\xC0\xDE'*2)
for file in os.listdir(gctFile):
if os.path.isfile(os.path.join(gctFile, file)):
if os.path.splitext(file)[1].lower() == '.txt':
temp.write(bytes.fromhex(self.parse_input(os.path.join(gctFile, file))))
elif os.path.splitext(file)[1].lower() == '.gct':
with open(os.path.join(gctFile, file), 'rb') as gct:
temp.write(gct.read()[8:-8])
else:
print(tools.color_text(f' :: HINT: {file} is not a .txt or .gct file', defaultColor=tools.TYELLOWLIT))
temp.write(b'\xF0\x00\x00\x00\x00\x00\x00\x00')
temp.seek(0)
self.geckoCodes = GCT(temp)
def parse_input(self, geckoText) -> str: def parse_input(self, geckoText) -> str:
with open(r'{}'.format(geckoText), 'rb') as gecko: with open(r'{}'.format(geckoText), 'rb') as gecko:
result = chardet.detect(gecko.read()) result = chardet.detect(gecko.read())
@ -498,32 +526,7 @@ class KernelLoader(object):
'''Initialize our codes''' '''Initialize our codes'''
if '.' in gctFile: codeHandler.init_gct(gctFile, tmpdir)
if os.path.splitext(gctFile)[1].lower() == '.txt':
with open(os.path.join(tmpdir, 'gct.bin'), 'wb+') as temp:
temp.write(bytes.fromhex('00D0C0DE'*2 + codeHandler.parse_input(gctFile) + 'F000000000000000'))
temp.seek(0)
codeHandler.geckoCodes = GCT(temp)
elif os.path.splitext(gctFile)[1].lower() == '.gct':
with open(gctFile, 'rb') as gct:
codeHandler.geckoCodes = GCT(gct)
else:
with open(os.path.join(tmpdir, 'gct.bin'), 'wb+') as temp:
temp.write(b'\x00\xD0\xC0\xDE'*2)
for file in os.listdir(gctFile):
if os.path.isfile(os.path.join(gctFile, file)):
if os.path.splitext(file)[1].lower() == '.txt':
temp.write(bytes.fromhex(codeHandler.parse_input(os.path.join(gctFile, file))))
elif os.path.splitext(file)[1].lower() == '.gct':
with open(os.path.join(gctFile, file), 'rb') as gct:
temp.write(gct.read()[8:-8])
else:
print(tools.color_text(f' :: HINT: {file} is not a .txt or .gct file', defaultColor=tools.TYELLOWLIT))
temp.write(b'\xF0\x00\x00\x00\x00\x00\x00\x00')
temp.seek(0)
codeHandler.geckoCodes = GCT(temp)
if codeHandler.geckoCodes is None: if codeHandler.geckoCodes is None:
self.error(tools.color_text('Valid codelist not found. Please provide a .txt/.gct file, or a folder of .txt/.gct files\n', defaultColor=tools.TREDLIT)) self.error(tools.color_text('Valid codelist not found. Please provide a .txt/.gct file, or a folder of .txt/.gct files\n', defaultColor=tools.TREDLIT))
@ -641,7 +644,7 @@ def determine_codehook(dolFile: DolFile, codeHandler: CodeHandler, hook=False):
if hook: if hook:
codeHandler.set_variables(dolFile) codeHandler.set_variables(dolFile)
insert_code_hook(dolFile, codeHandler, codeHandler.hookAddress) insert_code_hook(dolFile, codeHandler, codeHandler.hookAddress)
return True return True