-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdat2py.py
54 lines (40 loc) · 1.38 KB
/
dat2py.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import sys
import argparse
import disasm.ED9Disassembler as ED9Disassembler
def init_argparse() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
usage="%(prog)s [OPTION] [FILE]...",
description="Disassembles and reassembles ED9 script files (EXPERIMENTAL)."
)
parser.add_argument(
"-v", "--version", action="version",
version = f"{parser.prog} version 0.0"
)
parser.add_argument('--markers', nargs='?', type=str)
parser.add_argument('--decompile', nargs='?', type=str)
parser.add_argument('file')
return parser
def main() -> None:
global smallest_data_ptr
parser = init_argparse()
args = parser.parse_args()
if args.markers is None:
args.markers = "False"
if args.decompile is None:
args.decompile = "True"
#actually no idea how to handle that properly
if args.decompile == "True":
args.decompile = True
elif args.decompile == "False":
args.decompile = False
if args.markers == "True":
args.markers = True
elif args.markers == "False":
args.markers = False
if not args.file:
raise Exception("ED9Disassembler needs a file to disassemble!")
else:
disasm = ED9Disassembler.ED9Disassembler(args.markers, args.decompile)
disasm.parse(args.file)
if __name__ == "__main__":
main()