Skip to content

Commit b7f3675

Browse files
committed
Decode Effect script
1 parent 9e92be2 commit b7f3675

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

decode_effect.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/python
2+
#
3+
# Script decode/encode 'ZPTC' patch files from Zoom F/W
4+
# (c) Simon Wood, 13 May 2020
5+
#
6+
7+
import zoomzt2
8+
9+
#--------------------------------------------------
10+
def main():
11+
from optparse import OptionParser
12+
13+
usage = "usage: %prog [options] FILENAME"
14+
parser = OptionParser(usage)
15+
parser.add_option("-d", "--dump",
16+
help="dump configuration to text",
17+
action="store_true", dest="dump")
18+
parser.add_option("-s", "--summary",
19+
help="summarized configuration in human readable form",
20+
action="store_true", dest="summary")
21+
22+
(options, args) = parser.parse_args()
23+
24+
if len(args) != 1:
25+
parser.error("FILE not specified")
26+
27+
infile = open(args[0], "rb")
28+
if not infile:
29+
sys.exit("Unable to open FILE for reading")
30+
else:
31+
data = infile.read()
32+
infile.close()
33+
34+
if options.dump and data:
35+
config = zoomzt2.ZD2.parse(data)
36+
print(config)
37+
38+
if options.summary and data:
39+
config = zoomzt2.ZD2.parse(data)
40+
41+
print("0x%8.8x : %s (v%s), %s" % (config['id'], config['name'], config['version'], args[0]))
42+
43+
if __name__ == "__main__":
44+
main()
45+

0 commit comments

Comments
 (0)