Files
OpenFUT/fifa17-recon/tools/ghidra_queries/q_md_sbc_6.py
T

43 lines
2.0 KiB
Python

"""DIMENSION 5 -- query 6. The hub tile builder DOES compute enabled/disabled tile
destinations (GOTO_DRAFT_DISABLED, GOTO_MANAGER_QUEST_DISABLED). Find the SBC and
MANAGER-QUEST tile cases and the exact gate condition, and whether an ENABLED variant
destination exists (GOTO_MANAGER_QUEST / GOTO_SBC / GOTO_SQUAD_BUILDING...).
Map the gate-byte accessor vtable slots read at the top of FUN_1800b2680 to model
displacements (slot 0x2c8/0x2d0/0x320) by reading each stub's disp32.
"""
import traceback
try:
print("=== search enabled/disabled destination strings across binary ===")
for n in (b"GOTO_MANAGER_QUEST", b"GOTO_SBC", b"GOTO_SQUAD_BUILDING",
b"GOTO_SQUAD_BUILDING_SETS", b"MANAGER_QUEST", b"SQUAD_BUILDING_SETS",
b"GOTO_DRAFT"):
for h in find_all(n):
print(" %#x %r" % (h, rd_str(h, 60)))
# map model vtable slots to disp: read accessor stub bytes 0f b6 81 <disp32> c3
print("\n=== model gate-byte accessor slots (DAT_1802e6398 vtable static 0x18021c2a0) ===")
vtbase = 0x18021c2a0
for slot in (0x2c8, 0x2d0, 0x320, 0x2b0, 0x270, 0x2e0):
tgt = qword(vtbase + slot)
b = read_bytes(tgt, 8)
disp = None
if b[0:3] == bytes.fromhex("0fb681"):
disp = int.from_bytes(b[3:7], "little")
print(" slot +%#x -> %#x bytes=%s disp=%s"
% (slot, tgt, b.hex(), hex(disp) if disp is not None else "?"))
# Now dump the hub builder and print the SBC + manager-quest tile blocks with context
d = dec(0x1800b2680)
lines = d.splitlines()
print("\n=== hub builder around SBC tile image + 0x110 + 0x230 manager quest ===")
for i, ln in enumerate(lines):
if ("GameHub_SBS" in ln or "MANAGER_QUEST" in ln or "0x230" in ln
or "0x110" in ln or "DREAMSQUAD" in ln):
lo = max(0, i-14); hi = min(len(lines), i+4)
print(" --- ctx @line %d ---" % i)
for j in range(lo, hi):
print(" " + lines[j].strip()[:150])
except Exception:
traceback.print_exc()