-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathsolver.py
executable file
·55 lines (51 loc) · 2.26 KB
/
solver.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
55
#!/usr/bin/env python3
from zorrom import solver
from zorrom.util import add_bool_arg
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(
description='Guess mask ROM layout based on constraints')
parser.add_argument(
'--bytes',
required=True,
help=
'Constraints as offset:byte,offset:byte,.. offset:byte:mask is also allowed'
)
parser.add_argument('--verbose', action='store_true', help='')
parser.add_argument('--all', action='store_true', help='')
add_bool_arg(parser, '--invert', default=None, help='')
parser.add_argument('--rotate', type=int, default=None, help='')
parser.add_argument('--bin-out',
default=None,
help='Require a single match')
parser.add_argument('--txt-out',
default=None,
help='Require a single match')
add_bool_arg(parser, '--flipx', default=None, help='')
parser.add_argument('--interleave', type=int, default=1, help='')
parser.add_argument('--interleave-dir', default=None, help='')
parser.add_argument('--layout-alg', type=str, default=None, help='')
parser.add_argument('--write-thresh', type=float, default=None, help='')
parser.add_argument('--word-bits', type=int, default=8, help='')
parser.add_argument('--words', type=int, default=None, help='')
parser.add_argument('--endian', default=None, help='')
parser.add_argument('fn_in', help='.txt file in')
parser.add_argument('dir_out', nargs='?', help='Write top .bin file')
args = parser.parse_args()
solver.run(args.fn_in,
solver.parse_ref_words(args.bytes),
args.dir_out,
bin_out=args.bin_out,
txt_out=args.txt_out,
all=args.all,
invert_force=args.invert,
rotate_force=args.rotate,
flipx_force=args.flipx,
interleave_force=args.interleave,
interleave_dir_force=args.interleave_dir,
layout_alg_force=args.layout_alg,
write_thresh=args.write_thresh,
word_bits=args.word_bits,
words=args.words,
endian_force=args.endian,
verbose=args.verbose)