second commit
Marco Andronaco andronacomarco@gmail.com
Tue, 05 Jul 2022 18:34:29 +0200
1 files changed,
5 insertions(+),
13 deletions(-)
jump to
M
patcher.py
→
patcher.py
@@ -1,34 +1,26 @@
#!/usr/bin/python3 import tkinter as tk import os -from hashlib import md5 +import Constants from Gui import PatcherApp +from Functions import check_rom, show_warning -m12_md5 = 'f41e36204356974c94fabf7d144dd32a' tools_path = os.path.join('.', 'tools') alt_path = os.path.join(tools_path, 'alt') -def check_rom(filename): - with open(filename, 'rb') as f: - file_hash = md5() - while chunk := f.read(8192): - file_hash.update(chunk) - - return file_hash.hexdigest() == m12_md5 - if __name__ == "__main__": if not os.path.isdir(alt_path): - print('\nErrore: รจ necessario estrarre l\'archivio.') + show_warning(Constants.WARNING_EXTRACT) exit() baserom = None for file in os.listdir('.'): - if file.endswith('.gba'): + if file.lower().endswith('.gba'): filename = os.path.join('.', file) if(check_rom(filename)): baserom = filename root = tk.Tk() - app = PatcherApp(root) + app = PatcherApp(root, baserom) app.run()