diff --git a/docs/struct-map.md b/docs/struct-map.md index e7a008fc64..f6cd4b0bf8 100644 --- a/docs/struct-map.md +++ b/docs/struct-map.md @@ -1,6 +1,6 @@ # The struct map — the types the fleet's cast sites need (Phase 37 T1) -> **Generated by `tools/type_census.py` at `d71d4c179` (2026-09-30T18:37:30Z); never typed (R75).** Every raw pointer-cast dereference in `src/` was assigned to a base (a parameter, a local, a global by value or by address, an absolute address) and the bases were clustered by EVIDENCE only — the same global symbol, an argument passed to a callee's parameter, an assignment or return, a pointer field read, a shared body's fleet-wide identity — never by a similar offset signature. Each cluster is one type the tree needs. Names are placeholders (`Unkstruct_`: the lowest global instance's address, else the lowest member function's); fields are placeholders (`unk`) until Phase 38 cites evidence. +> **Generated by `tools/type_census.py` at `f9d3c125c` (2026-09-30T18:52:38Z); never typed (R75).** Every raw pointer-cast dereference in `src/` was assigned to a base (a parameter, a local, a global by value or by address, an absolute address) and the bases were clustered by EVIDENCE only — the same global symbol, an argument passed to a callee's parameter, an assignment or return, a pointer field read, a shared body's fleet-wide identity — never by a similar offset signature. Each cluster is one type the tree needs. Names are placeholders (`Unkstruct_`: the lowest global instance's address, else the lowest member function's); fields are placeholders (`unk`) until Phase 38 cites evidence. **19124 types explain 498868 of 502986 dereference sites (99.2 %); 4118 sites have a base the census could not classify; 857 types carry a width conflict.** Merges by evidence: param 38876, assign 16786, arg 10825, field 9909, ret-of 4330, return 1524, assign& 1184, arg& 270. diff --git a/include/struct_types.h b/include/struct_types.h index e10044a9c2..069872d5f9 100644 --- a/include/struct_types.h +++ b/include/struct_types.h @@ -1835,15 +1835,15 @@ typedef struct { /* 0x24 */ typedef struct { u32 tag; u8 r0, g0, b0, code; - short x0, y0; - u8 r1, g1, b1, pad1; - short x1, y1; - u8 r2, g2, b2, pad2; - short x2, y2; - u8 r3, g3, b3, pad3; - short x3, y3; -} POLY_G4; -typedef POLY_G4 G4_80017778; + s16 x0, y0; + u8 r1, g1, b1, p1; + s16 x1, y1; + u8 r2, g2, b2, p2; + s16 x2, y2; + u8 r3, g3, b3, p3; + s16 x3, y3; +} PG4_8017FD50; +typedef PG4_8017FD50 G4_80017778; typedef struct { u8 addr0, addr1, addr2, len; u32 code0; diff --git a/src/shared/engine_types.h b/src/shared/engine_types.h index 80d8d2a520..914fa73141 100644 --- a/src/shared/engine_types.h +++ b/src/shared/engine_types.h @@ -4376,22 +4376,21 @@ typedef struct { u16 f5C; } F5C_S; typedef struct { - u32 tag; - u8 r0, g0, b0, code; - short x0, y0; - u8 u0, v0; - u16 clut; - short x1, y1; - u8 u1, v1; - u16 tpage; - short x2, y2; - u8 u2, v2; - u16 pad1; - short x3, y3; - u8 u3, v3; - u16 pad2; -} POLY_FT4; -typedef POLY_FT4 FT4_801857A4; + /* 0x00 */ u32 tag; + /* 0x04 */ u8 r0, g0, b0, code; + /* 0x08 */ s16 x0, y0; + /* 0x0C */ u8 u0, v0; + /* 0x0E */ u16 clut; + /* 0x10 */ s16 x1, y1; + /* 0x14 */ u8 u1, v1; + /* 0x16 */ u16 tpage; + /* 0x18 */ s16 x2, y2; + /* 0x1C */ u8 u2, v2; + /* 0x1E */ u16 pad_1E; + /* 0x20 */ s16 x3, y3; + /* 0x24 */ u8 u3, v3; + /* 0x26 */ u16 pad_26; +} FT4_801857A4; typedef struct { /* 0x00 */ s16 f0; /* 0x02 */ s16 f2; /* OT depth */ @@ -4406,8 +4405,8 @@ typedef struct { s16 v; } Flag_S40_8018B238_80187EA0; typedef struct { s16 v; } Flag_S40_8018B238_80188478; typedef struct { s16 v; } Flag_S40_8018B238_80188778; typedef void (*Fn8017ECC4)(void); -typedef POLY_FT4 Ft4_80183DA4; -typedef POLY_FT4 Ft4_80184138; +typedef FT4_801857A4 Ft4_80183DA4; +typedef FT4_801857A4 Ft4_80184138; typedef struct { s32 unk0; /* 0x00 */ s16 unk4; /* 0x04 */ @@ -4810,7 +4809,6 @@ typedef struct { u16 x2, y2; u32 uv2; u16 x3, y3; u32 uv3; } PFT4_FD64; -typedef POLY_G4 PG4_8017FD50; typedef struct { u8 t0, t1, t2, len; /* 0x00 P_TAG */ u8 r0, g0, b0, code; /* 0x04 */ @@ -6893,10 +6891,10 @@ typedef struct { u32 c3; /* 0x1C */ u16 x3, y3; /* 0x20, 0x22 */ } PG4_80189340; -typedef POLY_G4 PG4_8018C960; -typedef POLY_G4 PG4_8018C960_801895C8; -typedef POLY_G4 PG4_8018C960_80189BA0; -typedef POLY_G4 PG4_8018C960_80189EA0; +typedef PG4_8017FD50 PG4_8018C960; +typedef PG4_8017FD50 PG4_8018C960_801895C8; +typedef PG4_8017FD50 PG4_8018C960_80189BA0; +typedef PG4_8017FD50 PG4_8018C960_80189EA0; typedef struct { u8 pad0[3]; u8 len; u8 pad_4[3]; u8 code; } PHdr_80189340; typedef PrimTag PTag_8017DD28; typedef PrimTag PTag_8018C960; diff --git a/tools/lift_types.py b/tools/lift_types.py index 6926ef7da2..c8384845b6 100644 --- a/tools/lift_types.py +++ b/tools/lift_types.py @@ -1067,7 +1067,7 @@ def fold_plan(tsv, only, exclude, want_tier1, want_sdk): continue lh = lh_all.pop() # SDK: the layout's SDK struct whose member names one of the class's defs carries (or whose name is in the class) - cands = [(sn, sm, sd) for sn, sm, sd in sdk.get(lh, []) if sn in c["names"] or any(_sdk_ev(d, sm) for d in ds)] + cands = [(sn, sm, sd) for sn, sm, sd in sdk.get(lh, []) if want_sdk and (sn in c["names"] or any(_sdk_ev(d, sm) for d in ds))] canon_text, sdk_name = None, None if len({sn for sn, _m, _d in cands}) == 1 and cands[0][0] in by_name and not any(cands[0][0] in d["names"] for d in ds): refused.append((c["lhash"] + " (note)", f"SDK {cands[0][0]} is defined with another layout: folded under a non-SDK name"))