"""Does a /settings flag gate the Seasons and Draft screens?

The hypothesis. Seasons refuses while making ZERO requests to any of the four
servers, so nothing on the wire can be wrong. A UI state key evaluated from a
client-side default explains that exactly. The settings deser writes
friendlySeasonsEnabled -> param_2[0x16] and enableDraftMode -> param_2[0x17], and
.rdata carries the UI keys IS_FRIENDLY_SEASON_ENABLED and IS_DRAFT_MODE_ENABLED.

This asks whether those two are the same value, and what it defaults to when the
configs array is empty (which is what the server has always sent).

A positive result is: the key's writer reads the settings field. A negative
result is: the writer reads something else, which kills the hypothesis cheaply.
CONTROL: IS_STORE_ENABLED, whose flag (storeEnabled -> param_2[0xb]) is attached
to a screen that is live-proven WORKING while we send an empty configs array, so
whatever it defaults to is a default that does NOT block.
"""
KEYS = ["IS_FRIENDLY_SEASON_ENABLED", "IS_DRAFT_MODE_ENABLED", "IS_STORE_ENABLED"]

for k in KEYS:
    print("=" * 78)
    print(k)
    print("=" * 78)
    hits = find_all(k.encode() + b"\x00")
    if not hits:
        print("  no string found -- check the literal")
        continue
    for h in hits:
        print("  string @ %#x" % h)
        xs = xrefs_to(h)
        if not xs:
            print("    NO XREFS (may be reached by table/pointer, not a direct lea)")
        for frm, typ, fn, ent in xs:
            print("    ref from %#x in %s (%#x)" % (frm, fn, ent))

print("\n\n" + "#" * 78)
print("# WHO CALLS THE SETTINGS DESER, and what object does it fill?")
print("#" * 78)
for a, n in callers(0x18013C6D0):
    print("  %#x  %s" % (a, n))
