11
|
1 import sys, argparse, os
|
|
2
|
|
3 def prog_type(byte):
|
|
4 if byte == 0xF6:
|
|
5 return "Movie Studio"
|
|
6 elif byte == 0xEF:
|
|
7 return "VEGAS Pro"
|
|
8 else:
|
|
9 return "Unknown"
|
|
10
|
|
11 def type_hex(type):
|
|
12 if type == "vf" or type == 1:
|
|
13 return "MS", [0xF6, 0x1B, 0x3C, 0x53, 0x35, 0xD6, 0xF3, 0x43, 0x8A, 0x90, 0x64, 0xB8, 0x87, 0x23, 0x1F, 0x7F]
|
|
14 elif type == "veg" or type == 0:
|
|
15 return "PRO", [0xEF, 0x29, 0xC4, 0x46, 0x4A, 0x90, 0xD2, 0x11, 0x87, 0x22, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A]
|
|
16 else:
|
|
17 return
|
|
18
|
|
19 def main(args):
|
|
20 if args.input:
|
|
21 inputfile = args.input
|
|
22 if os.path.exists(inputfile):
|
|
23 with open(inputfile, "rb") as fp:
|
|
24 test = bytearray(fp.read())
|
|
25 else:
|
|
26 print("Input file doesn't exist!")
|
|
27 exit()
|
|
28 project = prog_type(test[0x18])
|
|
29 print("Project file version: " + project + " " + str(test[0x46]) + ".0")
|
|
30 if not args.version:
|
|
31 answer = ""
|
|
32 else:
|
|
33 answer = args.version
|
|
34 while answer not in ["8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18"]:
|
|
35 answer = str(input("Which version of VEGAS would you like it to be spoofed to? [8-18]: "))
|
|
36 if not args.type:
|
|
37 answer2 = ""
|
|
38 while answer2 not in ["veg", "vf"]:
|
|
39 answer2 = input("Would you like it to be VEGAS Pro or Movie Studio? [veg,vf]: ").lower()
|
|
40 else:
|
|
41 answer2 = args.type
|
|
42 filename_prefix, typehex = type_hex(answer2)
|
|
43 test[0x18:0x27] = typehex
|
|
44 test[0x46] = int(answer)
|
|
45 filename_wo_ext = os.path.basename(os.path.splitext(inputfile)[0])
|
|
46 if args.output:
|
|
47 outputfile = args.output
|
|
48 else:
|
|
49 outputfile = os.path.abspath(os.path.dirname(inputfile)) + "/" + filename_prefix + "_V" + answer + "_" + str(filename_wo_ext) + "." + answer2
|
|
50 with open(outputfile, 'wb') as target:
|
|
51 target.write(test)
|
|
52 if __name__ == "__main__":
|
|
53 parser = argparse.ArgumentParser()
|
|
54 parser.add_argument('-i', '--input', help="input file", metavar='<input>', required=True)
|
|
55 parser.add_argument('-o', '--output', help="output file, defaults to '(MS,VEG)_(version)_(original name).(vf,veg)'", metavar='<output>')
|
|
56 parser.add_argument('-v', '--version', help="output file version", metavar='<version>')
|
|
57 parser.add_argument('-t', '--type', help="output file type, vf/veg", metavar='<type>')
|
|
58 args = parser.parse_args()
|
|
59 main(args)
|