disasm_script.py: error if api func not in symbol_addrs.txt

This commit is contained in:
Alex Bates 2021-02-04 15:35:34 +00:00
parent 211b271c07
commit 1041c62a7a

View File

@ -600,8 +600,15 @@ class ScriptDSLDisassembler(ScriptDisassembler):
elif opcode == 0x41: self.write_line(f"{self.var(argv[0])} &=c {argv[1]:X};")
elif opcode == 0x42: self.write_line(f"{self.var(argv[0])} |=c {argv[1]:X};")
elif opcode == 0x43:
argv_str = ", ".join(self.var(arg) for arg in argv[1:])
self.write_line(f"{self.addr_ref(argv[0])}({argv_str});")
addr = argv[0]
if addr in self.symbol_map:
func_name = self.symbol_map[addr]
argv_str = ", ".join(self.var(arg) for arg in argv[1:])
self.write_line(f"{func_name}({argv_str});")
else:
print(f"script API function {addr:X} is not present in symbol_addrs.txt, please add it")
exit(1)
elif opcode == 0x44: self.write_line(f"spawn {self.addr_ref(argv[0])};")
elif opcode == 0x45: self.write_line(f"{self.var(argv[1])} = spawn {self.addr_ref(argv[0])};")
elif opcode == 0x46: self.write_line(f"await {self.addr_ref(argv[0])};")