From 8dbde107520ca226f5491c021b75d1dc122bf063 Mon Sep 17 00:00:00 2001 From: Drew T <50529377+Druthulu@users.noreply.github.com> Date: Sat, 11 Jul 2026 23:40:01 -0600 Subject: [PATCH] =?UTF-8?q?feat(phase-26):=20Task-8=20validation=20slice?= =?UTF-8?q?=20=E2=80=94=20reconcile=E2=86=92bank=20proven=20(4=20cracks=20?= =?UTF-8?q?into=20ov077,=20R22=20136/136)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - pre-Fable5-window de-risk (Drew): validate reconcile→gate→template on the triage cracks before the window. - reconcile→bank WORKS: raw 0/23 (§41 def-side wall) -> canon_sig_reconcile v3.2 -> 4/15 banked into ov077 (func_801506A4/8016A73C/80167540/80155800), byte-identical, R22 clean-fleet 136/136. - templating a RECONCILED body x133 FAILS 0/4: reconciled bodies are ov077-TU-specific (canonical-sig casts + collision-renames) -> need per-sibling re-reconcile (§41c). Task-8 prerequisite: port the h_norm --reconcile M2 path into hseq_sweep so the type-using families (triage cracks + the 61 Fable5 cores) can template x134. PURE families already template plainly (Task 5: 399 banked). - decision-log 2026-07-11: the slice paid for itself — found the templating gap BEFORE spending the window. Paused before building the wiring per Drew. --- docs/decision-log.md | 33 ++++ docs/family-hseq.md | 56 +++--- phase-ends/CURRENT_PHASE.md | 3 +- src/ov_SC01_077/ov_SC01_077_after.c | 285 +++++++++++++++++++++++++++- 4 files changed, 344 insertions(+), 33 deletions(-) diff --git a/docs/decision-log.md b/docs/decision-log.md index 30e4dc963..d158f98ab 100644 --- a/docs/decision-log.md +++ b/docs/decision-log.md @@ -324,3 +324,36 @@ breakdown showed it is "the engine is perfect on the families it targets; the re solved problem." **LESSON:** when measuring a mechanical harvest, stratify by family/class before judging the rate — an aggregate mixes 100%-clean, 0%-type-blocked, and skipped-pinned populations that demand different follow-ons. + +## 2026-07-11 · Phase 26 — Task-8 pipeline-validation slice (pre-Fable5-window de-risk): reconcile→bank works; templating reconcile-class cracks needs per-sibling re-reconcile in --hseq + +**Context + decision (Drew):** before spending the closing Fable5 window (Task 7), validate that the +reconcile→gate→template pipeline actually banks an isolation-crack end-to-end — else the window's output +(same isolation-crack format) could pile up un-bankable. Ran optimal-order step 1 only ("bank the wins, +pause before Task 8"). + +**What the byte-gate revealed (R14), in two halves:** +1. **Reconcile→bank WORKS.** The 23 triage closeness-0 cracks gate **0/23 raw** (they carry standalone + `struct Obj`/scalar typedefs + Ghidra sigs → §41 def-side wall). Run through `canon_sig_reconcile` v3.2 + (strip ambient dups, canonicalize the sig, cast callees at use) they bank **4/15** into ov077 + (`func_801506A4`/`func_8016A73C`/`func_80167540`/`func_80155800`, byte-identical). The 11 residual fails + are a data-extern-typing gap (e.g. `conflicting types for D_801891B8`, a fn-ptr array the seed types + differently than the TU) the reconcile's pt-9 data-extern handling doesn't fully cover for these seeds. +2. **Templating a RECONCILED body ×133 FAILS (0/4).** The reconciled ov077 body is TU-SPECIFIC — its + canonical-sig casts + `Name_` collision-renames fit ov077, not the sibling TUs (each has its own + ambient types/sigs). Plain `remap_hseq` copies the ov077-reconciled body → re-hits the def-side wall in + every sibling. This is the decision-log 2026-07-11 lesson again: an exemplar match proves the crack in + ITS TU only; ×134 needs per-sibling work. + +**The implication (the point of validating first):** the PURE tracker-miss families template cleanly via +plain `--hseq` (Task 5: 399 banked). But the **type-using families — the triage cracks AND the 61 Fable5 +cores — are reconcile-class**: their cracks bank as ov077 exemplars but need **per-sibling re-reconcile** +to template ×134. That machinery EXISTS for h_norm (`family_sweep --reconcile` / `reconcile_remap`, the +Phase-25 M2 4,389-bank path) — it just needs porting into the `--hseq` path (over `remap_hseq`, i.e. with +cross-address + imm). **So the Task-8 prerequisite before the Fable5 window is productive: wire per-sibling +reconcile into `hseq_sweep`.** Otherwise Fable5 output stalls at ×1 (ov077-only). + +**Outcome:** kept the 4 real ov077 exemplar banks (byte-verified). Paused before building the per-sibling +reconcile wiring (that IS Task 8, per Drew). **LESSON:** the validation slice paid for itself — it converted +"the pipeline works, go spend the window" into "reconcile→bank works, but templating reconcile-class needs +one more wiring step first," a decision that would have been very expensive to learn after the window closed. diff --git a/docs/family-hseq.md b/docs/family-hseq.md index 4eae268da..179ca195d 100644 --- a/docs/family-hseq.md +++ b/docs/family-hseq.md @@ -2,11 +2,11 @@ > Generated by `tools/family_hseq.py` from the 134 overlay sigs + per-overlay src stubs. Ranked by TEMPLATABLE byte-weight (PURE+IMM members × nins × 4). The byte-gate is the arbiter. -**Fleet (overlays):** 74.8% fn / 58.2% instr / 30.3% distinct-code matched. Unmatched: 86,178 instances / 5,314,133 ins (55,654 distinct classes). +**Fleet (overlays):** 74.9% fn / 58.5% instr / 30.9% distinct-code matched. Unmatched: 85,642 instances / 5,265,412 ins (55,275 distinct classes). -**Tail cross-check (Phase-25 close):** 65,833 tail fns / 2,798,915 ins → 663 h_seq families ≥2, **186 substantial (nins≥80) / 1,847,597 ins**. +**Tail cross-check (Phase-25 close):** 65,031 tail fns / 2,766,598 ins → 660 h_seq families ≥2, **183 substantial (nins≥80) / 1,815,627 ins**. -**Full frontier (all unmatched by h_seq):** 2897 target families (≥2 members or a matched sibling) + 3553 singletons (Step-D residue). Substantial: **581 families / 3,222,713 templatable ins**, 29 with a matched sibling (zero-crack). Substantial member classes: 18,317 PURE · 39 IMM · 6 STRUCT-excluded. +**Full frontier (all unmatched by h_seq):** 2894 target families (≥2 members or a matched sibling) + 3553 singletons (Step-D residue). Substantial: **578 families / 3,173,992 templatable ins**, 30 with a matched sibling (zero-crack). Substantial member classes: 17,781 PURE · 39 IMM · 6 STRUCT-excluded. ## Top substantial families (by templatable byte-weight) @@ -38,28 +38,28 @@ | 23 | 231 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x80175da8 draft-ov077 | 30,954 | | 24 | 226 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x8012956c draft-ov077 | 30,284 | | 25 | 222 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x8015c32c draft-ov077 | 29,748 | -| 26 | 108 | 267 (267/0/0) | 2/134 | cross-address | PURE | 1 | · | 0x8014dd8c matched-ov077 | 28,836 | -| 27 | 213 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x8013ffd8 draft-ov077 | 28,542 | -| 28 | 209 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x8016cbc0 draft-ov077 | 28,006 | -| 29 | 204 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x8015ea3c draft-ov077 | 27,336 | -| 30 | 201 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x8015d738 draft-ov077 | 26,934 | -| 31 | 198 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x8013bd74 draft-ov077 | 26,532 | -| 32 | 198 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x801412a8 draft-ov077 | 26,532 | -| 33 | 188 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x8015f448 draft-ov077 | 25,192 | -| 34 | 188 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x8016ab6c draft-ov077 | 25,192 | -| 35 | 188 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x80175ab8 draft-ov077 | 25,192 | -| 36 | 93 | 268 (268/0/0) | 2/134 | cross-address | PURE | 0 | · | 0x8014ffdc draft-ov077 | 24,924 | -| 37 | 183 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x8014032c draft-ov077 | 24,522 | -| 38 | 181 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x80135a4c draft-ov077 | 24,254 | -| 39 | 174 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x8017ae2c draft-ov077 | 23,316 | -| 40 | 173 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x80154c24 draft-ov077 | 23,182 | -| 41 | 165 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x80178004 draft-ov077 | 22,110 | -| 42 | 162 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x80169bbc draft-ov077 | 21,708 | -| 43 | 161 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x80160534 draft-ov077 | 21,574 | -| 44 | 161 | 133 (133/0/0) | 1/133 | per-location | PURE | 1 | · | 0x8016dc20 matched-ov077 | 21,413 | -| 45 | 158 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x801299c8 draft-ov077 | 21,172 | -| 46 | 156 | 133 (133/0/0) | 1/133 | per-location | PURE | 1 | · | 0x8016df5c matched-ov077 | 20,748 | -| 47 | 154 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x8013c0f8 draft-ov077 | 20,636 | -| 48 | 155 | 133 (133/0/0) | 1/133 | per-location | PURE | 1 | · | 0x801365b8 matched-ov077 | 20,615 | -| 49 | 154 | 133 (133/0/0) | 1/133 | per-location | PURE | 1 | · | 0x80144090 matched-ov077 | 20,482 | -| 50 | 148 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x8016d1d8 draft-ov077 | 19,832 | +| 26 | 213 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x8013ffd8 draft-ov077 | 28,542 | +| 27 | 209 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x8016cbc0 draft-ov077 | 28,006 | +| 28 | 204 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x8015ea3c draft-ov077 | 27,336 | +| 29 | 201 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x8015d738 draft-ov077 | 26,934 | +| 30 | 198 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x8013bd74 draft-ov077 | 26,532 | +| 31 | 198 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x801412a8 draft-ov077 | 26,532 | +| 32 | 188 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x8015f448 draft-ov077 | 25,192 | +| 33 | 188 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x8016ab6c draft-ov077 | 25,192 | +| 34 | 188 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x80175ab8 draft-ov077 | 25,192 | +| 35 | 93 | 268 (268/0/0) | 2/134 | cross-address | PURE | 0 | · | 0x8014ffdc draft-ov077 | 24,924 | +| 36 | 183 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x8014032c draft-ov077 | 24,522 | +| 37 | 181 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x80135a4c draft-ov077 | 24,254 | +| 38 | 174 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x8017ae2c draft-ov077 | 23,316 | +| 39 | 173 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x80154c24 draft-ov077 | 23,182 | +| 40 | 165 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x80178004 draft-ov077 | 22,110 | +| 41 | 162 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x80169bbc draft-ov077 | 21,708 | +| 42 | 161 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x80160534 draft-ov077 | 21,574 | +| 43 | 161 | 133 (133/0/0) | 1/133 | per-location | PURE | 1 | · | 0x8016dc20 matched-ov077 | 21,413 | +| 44 | 158 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x801299c8 draft-ov077 | 21,172 | +| 45 | 156 | 133 (133/0/0) | 1/133 | per-location | PURE | 1 | · | 0x8016df5c matched-ov077 | 20,748 | +| 46 | 154 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | Y | 0x8013c0f8 draft-ov077 | 20,636 | +| 47 | 155 | 133 (133/0/0) | 1/133 | per-location | PURE | 1 | · | 0x801365b8 matched-ov077 | 20,615 | +| 48 | 154 | 133 (133/0/0) | 1/133 | per-location | PURE | 1 | · | 0x80144090 matched-ov077 | 20,482 | +| 49 | 148 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x8016d1d8 draft-ov077 | 19,832 | +| 50 | 147 | 134 (134/0/0) | 1/134 | per-location | PURE | 0 | · | 0x80177b5c draft-ov077 | 19,698 | diff --git a/phase-ends/CURRENT_PHASE.md b/phase-ends/CURRENT_PHASE.md index 059602164..49f8ffe50 100644 --- a/phase-ends/CURRENT_PHASE.md +++ b/phase-ends/CURRENT_PHASE.md @@ -24,7 +24,7 @@ The Phase-25 h_seq reframe: the "unique tail" is really per-location families - [ ] **Task 11 — Step-D residue map** `[xHigh]` — true singletons (~0.27M ins) + 5 behemoths → Phase-27 input doc. NO execution. - [ ] **Task 12 — PhaseEnd** `[Max — Tier 1; R27 prompt]` — P7 walk, milestone demo, gate 2, `PhaseEnd_Phase26.md`, worklog → `logs/Phase26.md` (R19), in-file recap (R25), decision-log current (R31). -## ▶ CURRENT TASK: **PAUSED before Task 8** (Drew, 2026-07-11). Triage done + all 119 seeds in `.run/phase26-seeds/`. Next: Task 8 = reconcile+gate+template the 23 cracked seeds (needs `--reconcile`/`canon_sig_reconcile`) + the type-family reconcile from Task 5 + mid/tiny harvest; Task 7 = Fable5 window on the 61 cores (needs Max+Fable5 toggle — R27). The 23 isolation-MATCH seeds are the crack; the reconcile is the plumbing. +## ▶ CURRENT TASK: **PAUSED before Task 8** (Drew). Validation slice done (below). **Task-8 PREREQUISITE discovered: wire per-sibling re-reconcile into `hseq_sweep`** (port the h_norm `reconcile_remap`/M2 path over `remap_hseq`) — reconcile-class cracks (triage cracks + the 61 Fable5 cores) bank as ov077 exemplars but need per-sibling reconcile to template ×134; plain `--hseq` gives 0/4. Then: reconcile-bank the 23 triage cracks + Task-5 type-families + mid/tiny. Task 7 = Fable5 window on the 61 cores (needs Max+Fable5 toggle — R27); build the reconcile wiring first so its output can template. ## Milestone (gate 2 — structural completion, per Drew) @@ -47,6 +47,7 @@ On approval → `/model opus` + `/effort xHigh` (Tasks 0–4; ALL Fable5 via `Ag ## Log +- **2026-07-11 (session 1, Task-8 validation slice — Drew-approved pre-window de-risk):** Ran reconcile→gate→template on the triage cracks. **Reconcile→bank WORKS:** raw 0/23 (§41 wall) → via `canon_sig_reconcile` v3.2 **4/15 banked into ov077** (`func_801506A4`/`8016A73C`/`80167540`/`80155800`, byte-identical). **Templating a reconciled body ×133 FAILS 0/4** — reconciled bodies are ov077-TU-specific (casts + collision-renames), need per-sibling re-reconcile (§41c). → **Task-8 prerequisite: port the h_norm `--reconcile` M2 path into `hseq_sweep`.** Kept the 4 ov077 banks. decision-log 2026-07-11 (R31). Paused before building the wiring per Drew. - **2026-07-11 (session 1, Task 6 — DONE + paused):** Ultracode triage Workflow (119 agents, 0 err, 5.3M tok): m2c draft (+§8 jtbl) → `match_one` closeness → class + lever + seed. **cheap 29 (23 closeness-0) / permuter 29 / fable5 61.** Curriculum → `docs/phase26-triage.md`. Attempted to bank the 23 cracked "wins" into ov077 (Drew: "bank the wins but pause before task8") → **0/23 gate** — the isolation-MATCHes carry standalone types/Ghidra-sigs that hit the §41 def-side wall in the real TU (`redefinition of struct Obj` / `conflicting types`); banking needs the Task-8 `--reconcile` pass. Seeds preserved in `.run/phase26-seeds/` + `.run/ov077_bank/`. **PAUSED before Task 8 per Drew.** src pristine, ov077 green. - **2026-07-11 (session 1, Task 5 — GO/NO-GO = GO):** Ran the real byte-gate on the substantial matched-exemplar band. Discovered + fixed the decl class (`remap_hseq.gather_externs` carries file-scope externs). **532 members banked**, R22 136/136 green, distinct 30.3→30.9% / instr 58.2→58.5%. Per-family: 3 tracker-miss PURE families bank 100% ×133 (399 byte-perfect free win); 9 type-using families → §41 reconcile (Task 8); 16 pinned → Task 7. Machinery byte-proven 100% correct on clean families → GO to scale. decision-log 2026-07-11 (R31). Committed. - **2026-07-11 (session 1, Task 4):** Added `family_sweep --hseq` (additive `hseq_sweep()`, h_norm path byte-untouched): manifest-driven templating via `remap_hseq`, unique per-group verified-out, static `__asm__("$N"` pin guard (skips the ×1-only pinned cracks → Task 7). Dry-run (`--stage-only`): substantial band stages 1507 clean / 267 groups, 1643 correctly skipped as pinned (16/29 families pinned, incl. the decision-log-named ones). Drafts byte-correct by construction; whole-TU gate = Task 5. Committed. diff --git a/src/ov_SC01_077/ov_SC01_077_after.c b/src/ov_SC01_077/ov_SC01_077_after.c index 99468c397..0ced81f2b 100644 --- a/src/ov_SC01_077/ov_SC01_077_after.c +++ b/src/ov_SC01_077/ov_SC01_077_after.c @@ -2249,7 +2249,51 @@ DEFINE_func_80150528() /* dedup: shared engine-core @0x80150528 (src/shared) */ DEFINE_func_801505FC() /* dedup: shared engine-core @0x801505FC (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_after", func_801506A4); + +struct Ent_801506A4 { + unsigned short unk0; /* 0x0 */ + char pad[0x5A]; + unsigned short unk5C; /* 0x5C */ + char pad2[0x12]; + short unk70; /* 0x70 */ +}; + +s32 func_801506A4(s32 arg0, s32 arg1) { + extern void func_80150820(int, unsigned short); + extern void func_8015086C(int); + extern unsigned short D_8018877C[]; + extern unsigned short D_80188784[]; + extern unsigned short D_8018878C[]; + + int mode; + + mode = ((struct Ent_801506A4 *)arg1)->unk0; + ((struct Ent_801506A4 *)arg1)->unk5C |= 1; + switch (mode) { + case 0x31: + ((void(*)(int))func_80147324)(0x452); + ((void(*)(int, unsigned))func_8014ADA8)(((int)arg0), D_8018877C[((struct Ent_801506A4 *)arg1)->unk70]); + ((void(*)(int, int, unsigned))func_8014ACE8)(((int)arg0), 3, D_8018877C[((struct Ent_801506A4 *)arg1)->unk70]); + break; + case 0x32: + if ((*(unsigned short*)&D_80078EB4) != 0) { + ((void(*)(int))func_80147324)(0x452); + ((void(*)(int, unsigned, int))func_8014BB24)(((int)arg0), D_80188784[((struct Ent_801506A4 *)arg1)->unk70], 1); + ((void(*)(int, int, unsigned))func_8014ACE8)(((int)arg0), 2, D_80188784[((struct Ent_801506A4 *)arg1)->unk70]); + } + break; + case 0x33: + ((void(*)(int))func_80147324)(0x452); + func_80150820(((int)arg0), D_8018878C[((struct Ent_801506A4 *)arg1)->unk70]); + break; + case 0xC5: + case 0x27B: + ((void(*)(int))func_80147324)(0x452); + func_8015086C(((int)arg0)); + break; + } +} + DEFINE_func_80150820() /* dedup: shared engine-core @0x80150820 (src/shared) */ @@ -3091,7 +3135,112 @@ DEFINE_func_801555BC() /* dedup: shared engine-core @0x801555BC (src/shared) */ INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_after", func_801555F4); -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_after", func_80155800); +#include "common.h" + +typedef struct { + u8 pad00[0x12]; + u16 unk12; /* 0x12 */ +} Sub_80155800_80155800; + +typedef struct { + u8 pad00[0x20]; + Sub_80155800_80155800 *unk20; /* 0x20 */ + u8 pad24[0x44 - 0x24]; + s32 unk44; /* 0x44 */ + u8 pad48[0xB8 - 0x48]; + u16 unkB8; /* 0xB8 */ + u8 padBA[0x1A8 - 0xBA]; + u8 unk1A8; /* 0x1A8 */ + u8 unk1A9; /* 0x1A9 */ + u8 unk1AA; /* 0x1AA */ + u8 pad1AB[0x1C0 - 0x1AB]; + u8 unk1C0; /* 0x1C0 */ + u8 pad1C1[0x234 - 0x1C1]; + u8 unk234; /* 0x234 */ +} Ent_80155800_80155800; + + +s32 func_80155800(s32 arg0) { + extern void func_80155A44(void *); + extern void func_80155F80(void *); + extern void func_80155FF8(void *, u8); + extern void func_8015A230(void *); + extern s32 func_80161208(void *); + + struct { s16 a, b, c, d, e, f, g, h, i, j, k, l; } sp10; + u8 temp_v0; + u8 temp_v1; + s32 var_v1; + + ((Ent_80155800_80155800 *)arg0)->unk44 |= 2; + if (((Ent_80155800_80155800 *)arg0)->unkB8 == 0x8000) { + ((void(*)(void *))func_801599A4)(((Ent_80155800_80155800 *)arg0)); + ((void(*)(void *))func_80159B3C)(((Ent_80155800_80155800 *)arg0)); + return; + } + func_80155A44(((Ent_80155800_80155800 *)arg0)); + if (((s32(*)(void *))func_80148800)(((Ent_80155800_80155800 *)arg0)) & 0x80) { + temp_v1 = ((Ent_80155800_80155800 *)arg0)->unk1A9; + if (temp_v1 >= 4U) { + if (((Ent_80155800_80155800 *)arg0)->unk1C0 != 0) { + ((void(*)(void *))func_80148AFC)(((Ent_80155800_80155800 *)arg0)); + func_80155F80(((Ent_80155800_80155800 *)arg0)); + ((void(*)(void *))func_80154134)(((Ent_80155800_80155800 *)arg0)); + temp_v0 = ((Ent_80155800_80155800 *)arg0)->unk1AA; + var_v1 = temp_v0 + 1; + if (temp_v0 == 0) { + var_v1 = 2; + } else if (var_v1 >= 5U) { + var_v1 = 1; + } + ((Ent_80155800_80155800 *)arg0)->unk1AA = var_v1; + ((void(*)(void *))func_80149B14)(((Ent_80155800_80155800 *)arg0)); + return; + } + if (((Ent_80155800_80155800 *)arg0)->unk1AA >= 2U) { + if (((Ent_80155800_80155800 *)arg0)->unk1A8 == 0) { + if (temp_v1 != 0) { + goto block_13; + } + goto block_15; + } + goto block_22; + } +block_13: + ((void(*)(void *))func_80148AFC)(((Ent_80155800_80155800 *)arg0)); + func_80155F80(((Ent_80155800_80155800 *)arg0)); + ((void(*)(void *))func_80154134)(((Ent_80155800_80155800 *)arg0)); + ((void(*)(void *))func_80149AD4)(((Ent_80155800_80155800 *)arg0)); + D_8011F730 |= 3; + return; + } + } +block_15: + if ((((Ent_80155800_80155800 *)arg0)->unk1A8 == 0) && (((Ent_80155800_80155800 *)arg0)->unk1A9 != 0)) { + if (((s32(*)(void *))func_801496D4)(((Ent_80155800_80155800 *)arg0)) != 0) { + ((void(*)(void *))func_801599A4)(((Ent_80155800_80155800 *)arg0)); + ((void(*)(void *))func_80149704)(((Ent_80155800_80155800 *)arg0)); + return; + } + if (!(((s32(*)(void *))func_801487F4)(((Ent_80155800_80155800 *)arg0)) & 8) && (((s32(*)(void *))func_801488A8)(((Ent_80155800_80155800 *)arg0)) != 0)) { + ((void(*)(void *))func_801599A4)(((Ent_80155800_80155800 *)arg0)); + func_8015A230(((Ent_80155800_80155800 *)arg0)); + return; + } + goto block_22; + } +block_22: + if (((s32(*)(void *))func_80146E98)(((Ent_80155800_80155800 *)arg0)) == 0) { + ((void(*)(s16, void *, void *))func_8001382C)((s16) -(s32) ((Ent_80155800_80155800 *)arg0)->unk20->unk12, &((Ent_80155800_80155800 *)arg0)->unk234, &sp10); + ((void(*)(void *, void *))func_80146DB8)(((Ent_80155800_80155800 *)arg0), &sp10); + ((void(*)(void *))func_80147A84)(((Ent_80155800_80155800 *)arg0)); + ((void(*)(void *))func_801473EC)(((Ent_80155800_80155800 *)arg0)); + } + if (func_80161208(((Ent_80155800_80155800 *)arg0)) == 0) { + func_80155FF8(((Ent_80155800_80155800 *)arg0), ((Ent_80155800_80155800 *)arg0)->unk1AA); + } +} + // @class: plumbing // @stuck: callee-conflict (func_8014BEF8/func_80149CB4 declared void in engine_core.h) — cast at call site @@ -6985,7 +7134,83 @@ INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_after", func_8016706C); INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_after", func_801670E4); -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_after", func_80167540); + +typedef struct { s32 m[8]; } Mat_80167540; /* 0x20 bytes */ + +struct Src_80167540 { + u8 pad0[0x34]; + Mat_80167540 mat; /* 0x34 */ +}; + +struct Sub2_80167540 { + u8 pad0[0x44]; + s32 unk44; /* 0x44 */ +}; + +struct Node_80167540 { + /* 0x0 */ u16 unk0; + u8 pad2[0x4]; + /* 0x6 */ s16 unk6; + u8 pad8[0x2]; + /* 0xA */ s16 unkA; + u8 padC[0x2]; + /* 0xE */ s16 unkE; + u8 pad10[0x10]; + /* 0x20 */ struct Src_80167540 *unk20; + u8 pad24[0x28]; + /* 0x4C */ struct Sub2_80167540 *unk4C; +}; + +struct Entity_80167540 { + /* 0x0 */ s16 unk0; + /* 0x2 */ u16 unk2; + u8 pad4[0xC]; + /* 0x10 */ s16 unk10; + /* 0x12 */ s16 unk12; + u8 pad14[0x8]; + /* 0x1C */ s32 unk1C; + u8 pad20[0x10]; + /* 0x30 */ s32 unk30; + /* 0x34 */ struct Node_80167540 *unk34; + /* 0x38 */ Mat_80167540 mat; +}; + + +s32 func_80167540(s32 arg0) { + struct Node_80167540 *node; + struct Entity_80167540 *ent; + s32 v; + + node = ((struct Entity_80167540 *)arg0)->unk34; + if (node->unk0 == 1) { + if (((struct Entity_80167540 *)arg0)->unk12 > ((struct Entity_80167540 *)arg0)->unk10) { + if (((struct Entity_80167540 *)arg0)->unk1C > 0) { + ((struct Entity_80167540 *)arg0)->unk10 = (s16) (((s32(*)())rand)() & 0x30); + v = -0x30; + goto shared; + } + } else if (((struct Entity_80167540 *)arg0)->unk1C < 0) { + ((struct Entity_80167540 *)arg0)->unk10 = (s16) ((((s32(*)())rand)() & 0x30) + 0x40); + v = 0x30; +shared: + ((struct Entity_80167540 *)arg0)->unk1C = v; + } + ((struct Entity_80167540 *)arg0)->unk12 = (s16) (((struct Entity_80167540 *)arg0)->unk12 + ((struct Entity_80167540 *)arg0)->unk1C); + ((struct Entity_80167540 *)arg0)->mat = node->unk20->mat; + ((void(*)(struct Entity_80167540 *, s32, s32, s32))func_801670E4)(((struct Entity_80167540 *)arg0), 0, 0, 0); + ent = ((struct Entity_80167540 *(*)(s32, struct Entity_80167540 *, s16, s16, s32, s32, s32))func_80146A6C)(0xE, ((struct Entity_80167540 *)arg0), node->unk6, node->unkA, node->unkE, 0, 0); + if (ent != 0) { + ent->mat = node->unk20->mat; + } + if (((struct Entity_80167540 *)arg0)->unk34->unk4C->unk44 & 0x20) { + ((struct Entity_80167540 *)arg0)->unk30 = 0x600; + ((struct Entity_80167540 *)arg0)->unk2 = (u16) (((struct Entity_80167540 *)arg0)->unk2 + 1); + } + } else { + ((void(*)(struct Entity_80167540 *))func_80146C3C)(((struct Entity_80167540 *)arg0)); + } +} + INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_after", func_80167714); @@ -7759,7 +7984,59 @@ void func_8016A700(void *a0) { D_80189C40[*(u16 *)((s32)a0 + 0x2)](); } -INCLUDE_ASM("asm/ov_SC01_077/nonmatchings/ov_SC01_077_after", func_8016A73C); +// Seed for func_8016A73C (ov_SC01_077 exemplar). Overlay-local struct guessed. +typedef struct SubB_8016A73C { char pad[0x20]; int unk20; } SubB_8016A73C; +typedef struct SubA_8016A73C { char pad[0x34]; SubB_8016A73C *unk34; } SubA_8016A73C; + +typedef struct Mat_8016A73C { int w[8]; } Mat_8016A73C; + +typedef struct Obj_8016A73C { + short unk0; + short unk2; + short unk4; + short unk6; + short unk8; + short unkA; + short unkC; + short unkE; + char pad10[0x24]; /* 0x10 .. 0x33 */ + SubA_8016A73C *unk34; /* 0x34 */ + Mat_8016A73C mat; /* 0x38 .. 0x57 */ +} Obj_8016A73C; + + + +s32 func_8016A73C(s32 arg0) { + int sp10[8]; + short v[3]; /* sp30, sp32, sp34 */ + int r; + short tmp; + + r = rand(); + v[1] = ((r & 0x7F) << 4) + 0x400; + v[0] = ((unsigned)(r & 0x7F00) >> 5) - 0x300; + v[2] = 0; + ((void(*)(short *, void *))RotMatrixYXZ)(v, sp10); + ((void(*)(int, void *))func_80048EAC)(((Obj_8016A73C *)arg0)->unk34->unk34->unk20 + 0x34, sp10); + v[0] = 0; + v[1] = 0; + v[2] = -0x50; + ((int(*)(void *, short *, short *))ApplyMatrixSV)(sp10, v, v); + + ((Obj_8016A73C *)arg0)->mat = (*(Mat_8016A73C*)&D_800AE620); + + tmp = ((Obj_8016A73C *)arg0)->unk6 + v[0]; + ((Obj_8016A73C *)arg0)->unk6 = tmp; + ((Obj_8016A73C *)arg0)->mat.w[5] = tmp; + tmp = ((Obj_8016A73C *)arg0)->unkA + v[1]; + ((Obj_8016A73C *)arg0)->unkA = tmp; + ((Obj_8016A73C *)arg0)->mat.w[6] = tmp; + tmp = ((Obj_8016A73C *)arg0)->unkE + v[2]; + ((Obj_8016A73C *)arg0)->unkE = tmp; + ((Obj_8016A73C *)arg0)->unk2 = ((Obj_8016A73C *)arg0)->unk2 + 1; + ((Obj_8016A73C *)arg0)->mat.w[7] = tmp; +} + DEFINE_func_8016A890() /* dedup: shared engine-core @0x8016A890 (src/shared) */