# Census query: (a) how the client consumes /settings configs (feature-flag gate),
# (b) the closed set of club/stats/%s kinds, (c) which URL suffix templates have
# live xrefs and from where.
import re

def find_str(s):
    hits = find_all(s.encode() + b"\x00", blocks=(".rdata", ".data", ".text"))
    return hits

TARGETS = [
    "/stats/%s", "/stats/%s/%d", "/stats/staff", "/consumables/%s", "/counts",
    "configs", "storeEnabled", "tradingEnabled", "enableSquadBuildingSetsFeature",
    "enableObjectives", "enableDraftMode", "friendlySeasonsEnabled",
    "/squadBuildingSets", "/sets", "/objective/", "/totw", "/loan/players",
    "/tutorialpopups", "/storymode/progress",
]

for t in TARGETS:
    hits = find_str(t)
    print("=== %-34s  %d string hit(s)" % (repr(t), len(hits)))
    for h in hits[:4]:
        xs = xrefs_to(h)
        print("    @%#x  xrefs=%d" % (h, len(xs)))
        for (fr, ty, fn, en) in xs[:8]:
            print("        %#x  %-12s %s @%#x" % (fr, ty, fn, en))
print()
print("#" * 70)
