#!/usr/bin/env python3 """Map FIFA 17 resident record offsets using UNIQUE wire values as ground truth. v2: identifies each record by its wire instance id (large, unique) and only accepts a field mapping when the value is distinctive (>= 16) and the same offset holds the right value for EVERY identified record. This avoids the v1 failure where cardsubtypeid == 0 matched every zeroed field in the struct. Read-only. Never writes. usage: probe_layout2.py PID squad_active.json """ import re, struct, sys, json, collections PID = int(sys.argv[1]) SQUAD = json.load(open(sys.argv[2])) mem = open(f"/proc/{PID}/mem", "rb", buffering=0) def rd(a, n): mem.seek(a); return mem.read(n) def q(a): return struct.unpack("= 5 and ok == total and len(distinct) >= 2: consistent.setdefault(off, []).append((f, total, len(distinct))) print(f"\n === offsets consistently holding a distinctive wire field ===") for off in sorted(consistent): for f, total, nd in consistent[off]: print(f" +0x{off:<4x} {f:14s} (matched {total}/{total} records, {nd} distinct values)") # --- dump the manager and the three club staff for comparison --- print(f"\n === cardtype-2 slot (manager) ===") h = q(mgr + 0xc0 + 0x10) if h: r = rd(h, RECSZ) for off in sorted(consistent): f = consistent[off][0][0] print(f" +0x{off:<4x} {f:14s} = {struct.unpack_from('