all repos — m12-patcher @ b84de75f35171c4c5072063225f2e8270f9dfa49

patcher.py (view raw)

 1#!/usr/bin/python3
 2import tkinter as tk
 3import os
 4import Constants
 5from Gui import PatcherApp
 6from Functions import check_rom, show_warning
 7
 8tools_path = os.path.join('.', 'tools')
 9alt_path = os.path.join(tools_path, 'alt')
10
11if __name__ == "__main__":
12    
13    if not os.path.isdir(alt_path):
14        show_warning(Constants.WARNING_EXTRACT)
15        exit()
16
17    baserom = None
18    for file in os.listdir('.'):
19        if file.lower().endswith('.gba'):
20            filename = os.path.join('.', file)
21            if(check_rom(filename)):
22                baserom = filename
23    
24    root = tk.Tk()
25    root.title(Constants.VAR_WINDOW_TITLE)
26    app = PatcherApp(root, baserom)
27    app.run()