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

48 lines
2.1 KiB
Python

"""DIMENSION 5 SBC/Objectives.
HYPOTHESIS Q1: enableSquadBuildingSetsFeature (atom 0x100) is READ as an input that
gates the SBC menu -- OR it is an OUTPUT name only ever emitted (like IS_TRADING_ENABLED
turned out to be). Decide by string xrefs: if the only lea to the literal is inside a
publisher (contiguous .rdata name run, straight-line stores), it is output-only.
CONTROL: enableObjectives -- known to have a settings-switch arm (CLEAR-only). Its
literal should be referenced somewhere that is NOT a publisher. And IS_TRADING_ENABLED
literal -> should resolve to the publisher FUN_18006cc60 (proven output name), the
NEGATIVE control for "publisher == output-only".
Q2: SBC set-list deser 0x180154990 + FUT/SBC_USE_STUBS string. What gates stub SBCs.
"""
import traceback
try:
def show_str_xrefs(label, needle):
print("\n=== %s : %r ===" % (label, needle))
hits = find_all(needle)
print(" string occurrences:", [hex(h) for h in hits])
for h in hits:
print(" literal @%#x = %r" % (h, rd_str(h, 60)))
# references land on the string addr itself for lea r8,[rip+..]
for a in (h, h - 4):
xs = xrefs_to(a)
if xs:
print(" xrefs_to(%#x):" % a)
for frm, typ, fn, ent in xs:
print(" from %#x %s in %s (%#x)" % (frm, typ, fn, ent))
show_str_xrefs("SBC feature flag", b"enableSquadBuildingSetsFeature\x00")
show_str_xrefs("Objectives flag (control)", b"enableObjectives\x00")
show_str_xrefs("Objectives-as-mgr flag", b"enableObjectivesAsManagerTasks\x00")
show_str_xrefs("IS_TRADING_ENABLED (output-name neg control)", b"IS_TRADING_ENABLED\x00")
# SBC_USE_STUBS -- brief says deser 0x180154990 checks FUT/SBC_USE_STUBS
for n in (b"SBC_USE_STUBS", b"USE_STUBS", b"FUT/SBC"):
print("\n=== search %r ===" % n)
for h in find_all(n):
print(" @%#x = %r" % (h, rd_str(h - 8, 80)))
print("\n=== dec 0x180154990 (SBC set-list deser per brief) ===")
d = dec(0x180154990)
print("LEN", len(d))
print(d)
except Exception:
traceback.print_exc()