Entry points and arg fix

This commit is contained in:
gsemaj 2022-08-10 21:01:51 -04:00
parent 8fbe59e5a1
commit 8725dd1e4e
3 changed files with 20 additions and 3 deletions

View File

@ -4,6 +4,7 @@
# ycc 08/08/2022
import re
import sys
legacy = False # True for 2.6
@ -281,3 +282,12 @@ def disassemble(text):
text += vertex_footer + "\n"
text += cg_footer
return text
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: disassembler.py <filename>")
else:
with open(sys.argv[1], "r") as fi:
buf = fi.read()
disasm = disassemble(buf)
print(disasm)

View File

@ -29,9 +29,9 @@ def process_batch(path, suffix="_hlsl"):
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: <shader-path> [outfile-suffix]")
print("Usage: main.py <folder> [outfile-suffix]")
elif len(sys.argv) == 2:
process_batch(sys.argv[1])
else:
process_batch(*sys.argv[1:2])
process_batch(*sys.argv[1:3])

View File

@ -4,6 +4,7 @@
# ycc 08/08/2022
import re
import sys
from disassembler import disassemble
tabs = 3
@ -14,7 +15,7 @@ def indent(block):
return "\n".join(lines)
def find_closing_bracket(block, i):
count = 0;
count = 0
while i < len(block):
if block[i] == '{':
count = count + 1
@ -62,3 +63,9 @@ def process(fn_in, fn_out):
fo.write(processed)
return True
return False
if __name__ == "__main__":
if len(sys.argv) < 3:
print("Usage: swapper.py <file-in> <file-out>")
else:
process(*sys.argv[1:3])