Files
BFM-decomp/src/shared/engine_core.h
T
Drew T 0c7619231d feat(phase-15): T2 — dedup_propagate.py (match-once -> propagate-many) proven on wave
- tools/dedup_propagate.py: lift a matched body -> DEFINE_func_<ADDR>() macro in
  src/shared/engine_core.h -> instantiate in place at every onboarded overlay sharing
  that h_exact -> snapshot + per-overlay byte-gate (fail-closed revert) -> register in
  config/dedup.us.yaml. Keyed by addr-int (sig lowercase vs splat func_%08X).
- proof: 4 medium funcs propagated across all 16 onboarded overlays; clean check-all
  18/18 byte-identical; dedup_integrate 8 validated/0 failed; idempotent; negative test
  (corrupt shared body) -> make check FAILS then restores
- Makefile: header-dependency tracking (cpp -MMD -MP + -include ) so editing a
  shared header recompiles dependents — closes a stale-build/false-pass gap the negative
  test exposed; output-neutral (R22 clean 18/18)
- structural self-check: a leftover INCLUDE_ASM stub is byte-identical, so the byte-gate
  can't catch under-application -> assert DEFINE present + stub gone
- FINDING: 577 of ov_SC01_077's 785 matches are h_exact across all 134 overlays
  (2.19 MB collapsible, already matched) -> T5 = bulk-propagate these + harvest the rest
- cookbook §14 (the propagation runbook + gotchas), SETUP tool inventory
- ghidra/ churn NOT staged (R23); build/asm/.run gitignored
2026-06-16 19:24:08 -06:00

43 lines
1.6 KiB
C

/* src/shared/engine_core.h — Phase 15 shared engine-core bodies (cross-overlay dedup, §14).
* Each DEFINE_func_XXXX() expands to the WHOLE matched body once; instantiated in place at the
* func_XXXX site in every overlay that shares it (address order preserved). Registry +
* byte-honesty: config/dedup.us.yaml + tools/dedup_integrate.py. Tool-generated; do not hand-edit. */
#ifndef SHARED_ENGINE_CORE_H
#define SHARED_ENGINE_CORE_H
#include "common.h"
#define DEFINE_func_80128EA8() \
void func_80128EA8(s32 a0, s32 a1, s32 a2) { \
*(s32 *)(a1 + 0x0) = a2; /* sw a2, 0x0(a1) */ \
*(s16 *)(a1 + 0x4) = 0; /* sh zero, 0x4(a1) */ \
*(s16 *)(a1 + 0x6) = (*(s32 *)(a2 + 0x4)) & 0x3F; /* lw; andi 0x3F; sh 0x6(a1) */ \
*(s16 *)(a0 + 0x28) = *(u16 *)(a2 + 0x0); /* lhu 0x0(a2); sh 0x28(a0) */ \
*(s16 *)(a0 + 0x2A) = *(u16 *)(a2 + 0x2); /* lhu 0x2(a2); sh 0x2A(a0) */ \
}
#define DEFINE_func_8012A568() \
extern void func_8012A598(void *a0); \
void func_8012A568(void (*a0)(void)) { \
func_8012A598(a0); \
a0(); \
}
#define DEFINE_func_80132EC4() \
void func_80132EC4(void *a0, s16 a1) { \
while (*(s32 *)a0 != 0) { \
*(s16 *)((s32)a0 + 4) = a1; \
a0 = (void *)((s32)a0 + 8); \
} \
}
#define DEFINE_func_80138C30() \
void func_80138C30(void *a0) { \
if (*(s16 *)((s32)a0 + 4) == 4) { \
*(s16 *)((s32)a0 + 4) = 2; \
} else { \
*(u32 *)((s32)a0 + 8) |= 0x800; \
} \
}
#endif