From 5f0ed4fb86ff713befc549745c908471df131b43 Mon Sep 17 00:00:00 2001 From: JoshuaMKW Date: Mon, 19 Oct 2020 23:15:33 -0500 Subject: [PATCH] Created icon, misc changes --- .gitignore | 2 ++ GeckoLoader.py | 2 +- icon.ico | Bin 0 -> 16958 bytes kernel.py | 57 ++++++++++++++++++++++++++----------------------- 4 files changed, 33 insertions(+), 28 deletions(-) create mode 100644 icon.ico diff --git a/.gitignore b/.gitignore index d5e5702..269aa22 100644 --- a/.gitignore +++ b/.gitignore @@ -134,3 +134,5 @@ dmypy.json # Gct files *.gct installer.py +children_ui.py +gui.py diff --git a/GeckoLoader.py b/GeckoLoader.py index 8e04b68..f1b5ec9 100644 --- a/GeckoLoader.py +++ b/GeckoLoader.py @@ -34,7 +34,7 @@ except ImportError: TRED = '' TREDLIT = '' -__version__ = 'v6.1.5' +__version__ = 'v6.2.0' def resource_path(relative_path: str): """ Get absolute path to resource, works for dev and for PyInstaller """ diff --git a/icon.ico b/icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..b08e314602af0adefcb0e310b1226e6f7f5f3c2b GIT binary patch literal 16958 zcmeHO33!y%)jpHSPRN9WECk3TfUH3l1woOZAov#*tqax-p;Rn_A|ih+2+`Iq_UYeR zwN-H;0wF;5kV!~PGT9TzzC&0-kRL@rM5STLoWAFNGhq@5&7;MPeY`w}JM+!A-1ppb z&w0Iu_{O|v3oil99lpx_r@5n z)-(NM>1o;ke48P_Kd&HwPv+ml`*QDOL!}GTZepiQ`lqpw-n1Ws>)Vvz@($(9I7H*^ zkN?mom@PSEkj^r?I?`yozApTU%f8q;Tx46 zWG(D~L=lgS_5N(2$+2U^ZO7<-W#h2_=h8-TTlRwr|KmAE<@3bvJ#)Z+dw2Nzo7^ra zE{OA&iZCi$$%`{5Ryhqy1Q3z91qH+ZHniB%e|j7Nnsbi zf4e!L1OF384DViUY%`D2eE18C_(x-=7jxZm$TEH|C!GCvAZ7?Z23Ju2LHLr`*au_@ z*ycDsQszb0tVnL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vvfY(q9|rr%1v)RybKU2>D1&1?34i4!6oASSLX z59`1`U^lG5fto%J?>0$%M(mHO02cA%h+{8g!Dj)x=)fz+`E&ar*npM0 z`0d1u+clSepwce6j@XFQ`Jumg=0W^nCH$gXUjS~D^N4!K@Yy|~9s8$)_JCD6Nb|`? z%}L&Mfp1z;8FGP3ey+uI#pxd7b+tn@zXd<2PlcUyX`Y**J&6aRBlrs8`l8Q?yA1rh zf>9h-I$7a=q12b_Cse3|C$OTt9 z0DSUE#LNqR)F7R!!TqHcX^na6xO|plwU7!3e78#i9q4ZC*u%KbcNdwQlj%#9H(2Y5 zN+)6;$Sw6-sI|N6zwhJvO>|U^P2zG11YAeOXwiwR38`I+4rDJ$e#1V6_(Pu$FU5k( zjrpMqG%Gld-szV{IUb4Bh}!RI@P%{w_vuhTqT{>|?j22k#ox1iqEDfdc)#_OdnUDp z?4hLbd+Ck)+i2NOzoHevC6unuLXBQ*T4LmThy@$ymCND&Z$5TSDJ|){g+9bz%l+ZM z8Rw7K99IMU&2}+DI~HkFy@j;?qP1_M_3HR(U9r~df3Nx$x8JDVY(O;|&1^(PSL-9B zk2FT&wK(ZX*QpO7?f4*aQ^!erP$X#&iquZ$NOhXUU{Pbc;^w87emNKUwQ@ ztvyDfj^lyo-7H$KZ_|2;wD$4@{Eo&JyvD0~H`T9aqk4^EJ)R`TwLT(J>y2$P0#XB! zUg1EG+iB-ZFLz$wrH`&$9^cR`5vuF_-@gFI7)|j2 literal 0 HcmV?d00001 diff --git a/kernel.py b/kernel.py index b5346d6..d08f8a5 100644 --- a/kernel.py +++ b/kernel.py @@ -218,6 +218,34 @@ class CodeHandler(object): 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: with open(r'{}'.format(geckoText), 'rb') as gecko: result = chardet.detect(gecko.read()) @@ -498,32 +526,7 @@ class KernelLoader(object): '''Initialize our codes''' - 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 + 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) + codeHandler.init_gct(gctFile, tmpdir) 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)) @@ -641,7 +644,7 @@ def determine_codehook(dolFile: DolFile, codeHandler: CodeHandler, hook=False): if hook: codeHandler.set_variables(dolFile) insert_code_hook(dolFile, codeHandler, codeHandler.hookAddress) - + return True