Skip to content

Commit

Permalink
Hack to figure which binary doesn't have the function in generate_fun…
Browse files Browse the repository at this point in the history
…ction_diff
  • Loading branch information
roblabla committed Mar 10, 2024
1 parent 35f352c commit 16fc486
Showing 1 changed file with 39 additions and 30 deletions.
69 changes: 39 additions & 30 deletions scripts/generate_function_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,46 @@ def generate_function_diff(fn_name):

os.makedirs(diff_dir / fs_fn_name, exist_ok=True)
with open(orig_asm_path, "w") as out:
out = subprocess.run(
[
"satsuki",
"--mapping-file-csv",
str(config_dir / "mapping.csv"),
"disassemble",
str(resource_dir / "game.exe"),
"--resolve-names",
fn_name,
],
stdout=out,
stderr=subprocess.PIPE,
check=True,
)
try:
out = subprocess.run(
[
"satsuki",
"--mapping-file-csv",
str(config_dir / "mapping.csv"),
"disassemble",
str(resource_dir / "game.exe"),
"--resolve-names",
fn_name,
],
stdout=out,
stderr=subprocess.PIPE,
check=True,
)
except subprocess.CalledProcessError as e:
e.stderr = b"original: " + e.stderr
raise

with open(reimpl_asm_path, "w") as out:
out = subprocess.run(
[
"satsuki",
"--mapping-file-csv",
str(config_dir / "mapping.csv"),
"disassemble",
str(build_dir / "th06e.exe"),
"--pdb-file",
str(build_dir / "th06e.pdb"),
"--resolve-names",
fn_name,
],
stdout=out,
stderr=subprocess.PIPE,
check=True,
)
try:
out = subprocess.run(
[
"satsuki",
"--mapping-file-csv",
str(config_dir / "mapping.csv"),
"disassemble",
str(build_dir / "th06e.exe"),
"--pdb-file",
str(build_dir / "th06e.pdb"),
"--resolve-names",
fn_name,
],
stdout=out,
stderr=subprocess.PIPE,
check=True,
)
except subprocess.CalledProcessError as e:
e.stderr = b"reimpl: " + e.stderr
raise

return orig_asm_path.read_text(), reimpl_asm_path.read_text()

Expand Down

0 comments on commit 16fc486

Please sign in to comment.