"""(a) maximumTradePileSize -> FUN_18011f380(model+0x15f00, N): is that the trade-list
CAPACITY (the second 0 in the red "TRANSFER LIST 0/0")?
(b) FUN_18000d550's decompile hit a jumptable; dump the raw listing so no published
name is missed.
(c) enumerate the whole published-name family in .rdata around IS_TRADING_ENABLED
(0x1801fc118) so every UI-visible term is on the table, including any online/connected
one. CONTROL: IS_STORE_ENABLED and IS_DRAFT_MODE_ENABLED must appear in the dump.
"""
import traceback
try:
    print("=== FUN_18011f380 (maximumTradePileSize consumer) ===")
    s = dec(0x18011f380); print("len=%d" % len(s)); print(s)

    print("\n=== raw listing 0x18000d550..0x18000d640 ===")
    ci = listing.getCodeUnits(addr(0x18000d550), True)
    n = 0
    while ci.hasNext() and n < 70:
        cu = ci.next()
        if int(cu.getAddress().getOffset()) > 0x18000d640: break
        print("  %#x  %s" % (int(cu.getAddress().getOffset()), cu))
        n += 1

    print("\n=== .rdata string family around 0x1801fc118 ===")
    b = read_bytes(0x1801fbe00, 0x900)
    cur = b""; start = 0
    for i, ch in enumerate(b):
        if 32 <= ch < 127:
            if not cur: start = i
            cur += bytes([ch])
        else:
            if len(cur) >= 6:
                print("  %#x  %s" % (0x1801fbe00 + start, cur.decode()))
            cur = b""

    print("\n=== every UI context name published anywhere: strings starting IS_ ===")
    seen = set()
    for h in find_all(b"IS_", blocks=(".rdata",)):
        s2 = rd_str(h, 60)
        if s2.isupper() or "_" in s2:
            if len(s2) > 5 and s2 not in seen:
                seen.add(s2)
                xr = xrefs_to(h)
                if xr:
                    print("  %#x %-46s %s" % (h, s2, [(hex(x[0]), x[2]) for x in xr][:3]))
except Exception:
    traceback.print_exc()
