"""DIMENSION 4 q6: are the GOTO_* tile destinations consumed by native gate code or
only handed to the front-end script layer? And what do the draft/tournament mode-node
factories register?

Hypothesis: GOTO_DRAFT_ONLINE/OFFLINE/DISABLED and GOTO_*TOURNAMENT appear ONLY as
string VALUES passed to the UI property setter in FUN_1800b2680 (no native consumer),
i.e. the destination is dispatched by the packed front-end -> script layer.

Control: GOTO_DRAFT_DISABLED must appear in FUN_1800b2680 (we just read it there).
"""
import traceback
try:
    def whereis(lit):
        hits = find_all(lit.encode() + b"\x00", (".rdata",))
        print("\n--- %r : %d literal hit(s) ---" % (lit, len(hits)))
        for h in hits:
            xs = xrefs_to(h)
            if not xs:
                print("   @%#x  NO xref (string only referenced by offset math / not a lea target)" % h)
            for frm, typ, fn, ent in xs:
                print("   @%#x xref from %#x %s in %s (%#x)" % (h, frm, typ, fn, ent))

    for s in ("GOTO_DRAFT_ONLINE", "GOTO_DRAFT_OFFLINE", "GOTO_DRAFT_DISABLED",
              "GOTO_OFFLINE_TOURNAMENT", "GOTO_ONLINE_CHAMPIONS", "GOTO_OFFLINE_SEASON",
              "GOTO_ONLINE_SEASON"):
        whereis(s)

    # the draft mode-node factories (reference fefifa::FUTOnlineDraftMode / OfflineMode)
    for a, lbl in [(0x18006b820, "FUN_18006b820 (FUTOnlineDraftMode node)"),
                   (0x18006b960, "FUN_18006b960 (FUTDraftOfflineMode node)"),
                   (0x18006baa0, "FUN_18006baa0 (FUTOfflineTournament node)"),
                   (0x18006bd20, "FUN_18006bd20 (FUTOnlineTournament node)")]:
        d = dec(a)
        print("\n=== %s len=%d ===" % (lbl, len(d)))
        print(d)
except Exception:
    traceback.print_exc()
print("QUERY_DONE")
