-
Notifications
You must be signed in to change notification settings - Fork 0
/
__main__.py
39 lines (27 loc) · 960 Bytes
/
__main__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# example: python cy_NES_Emulator/main.py -run "Super Mario Bros (E).nes"
import argparse
import sys
import os
import tkinter
from tkinter import filedialog
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))
from cy_NES_Emulator import *
ftypes = [
('iNES files', '.nes'),
]
def search_for_file_path ():
currdir = os.getcwd()
return filedialog.askopenfilename(parent=root, initialdir=currdir, title='Select ROM', filetypes=ftypes)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="cy_NES_Emulator Command Line Utility")
parser.add_argument("-run", type=str, help="Path to ROM")
args = parser.parse_args()
if args.run:
rom_directory = args.run
else:
root = tkinter.Tk()
root.withdraw() #use to hide tkinter window
rom_directory = search_for_file_path()
nes = NES(rom_directory)
nes.run()