mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-02 22:23:42 +08:00
81da8ac9f4
date: 2024-06-11T01:36:39 master commit: f8cb04e4a8b032b72a909f68b808a50936184bee
19 lines
509 B
Python
19 lines
509 B
Python
import ctypes
|
|
import os
|
|
import pathlib
|
|
from hexdump import hexdump
|
|
|
|
fxn = None
|
|
def disasm(buf):
|
|
global fxn
|
|
if fxn is None:
|
|
shared = pathlib.Path(__file__).parent / "disasm.so"
|
|
if not shared.is_file():
|
|
os.system(f'cd {pathlib.Path(__file__).parent} && gcc -shared disasm-a3xx.c -o disasm.so')
|
|
fxn = ctypes.CDLL(shared.as_posix())['disasm']
|
|
#hexdump(buf)
|
|
END = b"\x00\x00\x00\x00\x00\x00\x00\x03"
|
|
buf = buf[0x510:] # this right?
|
|
buf = buf.split(END)[0] + END
|
|
fxn(buf, len(buf))
|