From eee4cb3196847b531fe243bf274a68a3beba343b Mon Sep 17 00:00:00 2001 From: Drew T <50529377+Druthulu@users.noreply.github.com> Date: Tue, 16 Jun 2026 17:05:23 -0600 Subject: [PATCH] =?UTF-8?q?feat(phase-13):=20T2=20=E2=80=94=20dup-pair=20c?= =?UTF-8?q?ollapse=20SC01/005=20=E2=89=A1=20006=20(one=20source,=20both=20?= =?UTF-8?q?green)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - src/shared/ov_setters.h: generic SETTER/RETCONST macro bodies (cookbook §11 source-level share), instantiated IN PLACE (address order preserved) in both ov_SC01_005.c and ov_SC01_006.c via ../shared/ relative include - config/dedup.us.yaml: D1/D2/D3 cross-overlay groups (members in BOTH 005 & 006) - both make check BINARY=ov_SC01_005 AND =ov_SC01_006 -> 56760dbe BYTE-IDENTICAL from the one shared source; dedup_integrate --check: 4 validated, 0 failed; REAL=3 credited to both members --- config/dedup.us.yaml | 30 ++++++++++++++++++++++++++++++ src/ov_SC01_005/ov_SC01_005.c | 7 ++++--- src/ov_SC01_006/ov_SC01_006.c | 7 ++++--- src/shared/ov_setters.h | 11 +++++++++++ 4 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 src/shared/ov_setters.h diff --git a/config/dedup.us.yaml b/config/dedup.us.yaml index 69e3acdc3..0b58c06b4 100644 --- a/config/dedup.us.yaml +++ b/config/dedup.us.yaml @@ -59,3 +59,33 @@ groups: members: - { binary: main, vram: 0x80037004, name: func_80037004 } - { binary: main, vram: 0x80037334, name: func_80037334 } + + # D1/D2/D3 — Phase-13 CROSS-OVERLAY proof: the byte-identical duplicate pair SC01/005 ≡ SC01/006 + # (one 0.4.dec, sha1 56760dbe) shares three trivial accessors from ONE source (src/shared/ov_setters.h), + # instantiated in place in both overlays' .c. Both `make check BINARY=ov_SC01_005` and `=ov_SC01_006` + # stay 56760dbe with the shared C (and with the INCLUDE_ASM stubs) — one match, two binaries. The + # generic SETTER/RETCONST macros are reusable fleet-wide (Phase 15 appends members as overlays onboard). + - id: D1_ov_dup_8012AD64 + tier: h_exact + hash: 89004be30998a495e3d94dbec7513e3d37f47d8d + source: src/shared/ov_setters.h + func: SETTER + members: + - { binary: ov_SC01_005, vram: 0x8012AD64, name: func_8012AD64 } + - { binary: ov_SC01_006, vram: 0x8012AD64, name: func_8012AD64 } + - id: D2_ov_dup_8012BF4C + tier: h_exact + hash: b039ed440779107270b60a3b2ca44b3b097b9c87 + source: src/shared/ov_setters.h + func: SETTER + members: + - { binary: ov_SC01_005, vram: 0x8012BF4C, name: func_8012BF4C } + - { binary: ov_SC01_006, vram: 0x8012BF4C, name: func_8012BF4C } + - id: D3_ov_dup_8012E27C + tier: h_exact + hash: 98ab17e54d84a098b4240053ee845921141318c1 + source: src/shared/ov_setters.h + func: RETCONST + members: + - { binary: ov_SC01_005, vram: 0x8012E27C, name: func_8012E27C } + - { binary: ov_SC01_006, vram: 0x8012E27C, name: func_8012E27C } diff --git a/src/ov_SC01_005/ov_SC01_005.c b/src/ov_SC01_005/ov_SC01_005.c index 5e0f35d66..d3252e6ac 100644 --- a/src/ov_SC01_005/ov_SC01_005.c +++ b/src/ov_SC01_005/ov_SC01_005.c @@ -1,4 +1,5 @@ #include "common.h" +#include "../shared/ov_setters.h" /* dedup share across the SC01/005 ≡ 006 pair (cookbook §11) */ INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005", func_80128158); @@ -188,7 +189,7 @@ INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005", func_8012AD44); INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005", func_8012AD50); -INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005", func_8012AD64); +SETTER(func_8012AD64, 0x34, s16) /* dedup: shared with ov_SC01_006 (src/shared/ov_setters.h) */ INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005", func_8012AD6C); @@ -264,7 +265,7 @@ INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005", func_8012BEE8); INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005", func_8012BF10); -INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005", func_8012BF4C); +SETTER(func_8012BF4C, 0x1C, s32) /* dedup: shared with ov_SC01_006 (src/shared/ov_setters.h) */ INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005", func_8012BF54); @@ -381,7 +382,7 @@ INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005", func_8012E014); INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005", func_8012E138); -INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005", func_8012E27C); +RETCONST(func_8012E27C, 1) /* dedup: shared with ov_SC01_006 (src/shared/ov_setters.h) */ void func_8012E284(void) { } diff --git a/src/ov_SC01_006/ov_SC01_006.c b/src/ov_SC01_006/ov_SC01_006.c index 97cead992..eaa38a881 100644 --- a/src/ov_SC01_006/ov_SC01_006.c +++ b/src/ov_SC01_006/ov_SC01_006.c @@ -1,4 +1,5 @@ #include "common.h" +#include "../shared/ov_setters.h" /* dedup share across the SC01/005 ≡ 006 pair (cookbook §11) */ INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006", func_80128158); @@ -188,7 +189,7 @@ INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006", func_8012AD44); INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006", func_8012AD50); -INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006", func_8012AD64); +SETTER(func_8012AD64, 0x34, s16) /* dedup: shared with ov_SC01_005 (src/shared/ov_setters.h) */ INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006", func_8012AD6C); @@ -264,7 +265,7 @@ INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006", func_8012BEE8); INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006", func_8012BF10); -INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006", func_8012BF4C); +SETTER(func_8012BF4C, 0x1C, s32) /* dedup: shared with ov_SC01_005 (src/shared/ov_setters.h) */ INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006", func_8012BF54); @@ -381,7 +382,7 @@ INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006", func_8012E014); INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006", func_8012E138); -INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006", func_8012E27C); +RETCONST(func_8012E27C, 1) /* dedup: shared with ov_SC01_005 (src/shared/ov_setters.h) */ void func_8012E284(void) { } diff --git a/src/shared/ov_setters.h b/src/shared/ov_setters.h new file mode 100644 index 000000000..348423f7b --- /dev/null +++ b/src/shared/ov_setters.h @@ -0,0 +1,11 @@ +/* src/shared/ov_setters.h — shared parameterized bodies for trivial overlay accessors. + * cookbook §11 source-level dedup ("match once, share many"): the body lives ONCE here and is + * instantiated IN PLACE (preserving each .c's address order — overlays link functions in source + * order) at every member's site. The byte-identical overlay pair SC01/005 ≡ SC01/006 (one + * 0.4.dec, sha1 56760dbe) shares these via config/dedup.us.yaml; tools/dedup_integrate.py + * byte-gates the share (h_exact). The macros are generic, so the 134-overlay fleet reuses them. */ +#ifndef OV_SETTERS_H +#define OV_SETTERS_H +#define SETTER(name, off, ty) void name(void *p, ty v) { *(ty *)((s32)p + (off)) = v; } +#define RETCONST(name, val) s32 name(void) { return (val); } +#endif