"""Q26: FUN_1801bfac0 -- the one function that names ALL the club families.

It references 'Stadium', 'Badge', 'FUT_UC_KITS' and 'FUT_UC_BALL' (and the GK
attribute captions), and Q10 showed it queries fcc_matches. If it switches on
cardsubtypeid it will name the ball subtype, which FUN_180119bd0 (cardtype 7 only)
cannot.

Also dump the string cluster 0x180239000..0x180239180 which holds FUT_UC_BALL,
'Stadium' and 'badge' close together, with xrefs.

CONTROL: FUN_180119bd0 must appear as an xref of 'Stadium' 0x18021ce80 and 'Badge'
0x1802041b8 -- it did in Q25, so the literal identification is sound.
"""
import traceback

try:
    src = dec(0x1801BFAC0)
    print("=== FUN_1801bfac0 len=%d ===" % len(src))
    print(src if len(src) < 20000 else src[:20000] + "\n...[cut, len above]")
    print()
    print("=== strings 0x180238f80..0x180239200 ===")
    p = 0x180238F80
    while p < 0x180239200:
        try:
            b = mem.getByte(addr(p)) & 0xFF
        except Exception:
            p += 1
            continue
        if 0x20 <= b < 0x7F:
            s = rd_str(p, 120)
            if len(s) >= 3:
                who = ",".join(sorted({"%s(%#x)" % (fn, ent)
                                       for _f, _t, fn, ent in xrefs_to(p)}))
                print("  %#x %-40r %s" % (p, s, who))
            p += max(1, len(s)) + 1
        else:
            p += 1
except Exception:
    traceback.print_exc()
