diff --git a/docs/backlog.md b/docs/backlog.md index 996aab2660..3ac5af60cd 100644 --- a/docs/backlog.md +++ b/docs/backlog.md @@ -2,1262 +2,1231 @@ > Generated by `tools/backlog.py render` from `.run/backlog.jsonl`. These are functions the Phase-21 automation got **close** on but did NOT byte-match. The whole-binary byte-gate is the sole arbiter (G3/P9): **byte-matches bank and are NOT listed here** — only genuine near-misses/blockers are. Ranked by hand-session priority: **reach** (×N propagation leverage) → **closeness** (match_one mismatch count, lower = closer) → **size**. Each row's `best_draft` is the closest C the machine reached — resume from there. -**Open near-misses:** 1255 · by status {'near': 1201, 'failed': 54} · by class {'regalloc-order': 14, 'schedule': 5, 'struct': 13, 'plumbing': 6, 'STUB': 1, 'remat': 1, None: 1209, 'other': 1, 'WAVE': 3, 'STRUCT': 1, 'loose-typing': 1} +**Open near-misses:** 1224 · by status {'near': 1173, 'failed': 51} · by class {'schedule': 5, 'struct': 13, 'plumbing': 6, 'STUB': 1, 'remat': 1, 'regalloc-order': 13, None: 1179, 'other': 1, 'WAVE': 3, 'STRUCT': 1, 'loose-typing': 1} | # | addr | reach | class | nins | status | closeness | where it stuck | best draft | |--:|------|------:|-------|-----:|--------|----------:|----------------|------------| -| 1 | func_8012F49C | 138 | regalloc-order | 51 | near | 0 | none — MATCH (51 ins, relocation-masked) | `.run/backlog_drafts/func_8012F49C.c` | -| 2 | func_80176144 | 138 | schedule | 53 | near | 0 | none — MATCH | `.run/backlog_drafts/func_80176144.c` | -| 3 | func_8014F4C0 | 138 | struct | 141 | near | 130 | none — MATCH (expansion of proven DEFINE_func_8014F4C0 macro, matched in 137 sibling overlays) | `.run/backlog_drafts/func_8014F4C0.c` | -| 4 | func_80161208 | 134 | plumbing | 14 | near | 0 | none — MATCH expected (param saved across call → natural $s0, no pin needed) | `.run/backlog_drafts/func_80161208.c` | -| 5 | func_80162CCC | 134 | plumbing | 23 | near | 0 | none — MATCH expected; direct translation, psVar1 as u16* gives lhu, $s0=param_1 survives both calls | `.run/backlog_drafts/func_80162CCC.c` | -| 6 | func_801758FC | 134 | schedule | 55 | near | 0 | none — MATCH (55 ins) | `.run/backlog_drafts/func_801758FC.c` | -| 7 | func_8016BA68 | 134 | STUB | 29 | near | 1 | STUB: 1 mismatch | `.run/backlog_drafts/func_8016BA68.c` | -| 8 | func_80147364 | 134 | remat | 30 | near | 4 | none — MATCH (30 ins). Lever: hoist &D_80126B58 into a local ptr `u8 *p=&D_80126B58;` so gcc | `.run/backlog_drafts/func_80147364.c` | -| 9 | func_80146A6C | 134 | struct | 18 | near | 5 | none — MATCH | `.run/backlog_drafts/func_80146A6C.c` | -| 10 | func_8012B77C | 134 | schedule | 58 | near | 33 | gcc instruction-scheduler load-ordering + 1st-ratan2 delay-slot fill differ (s2 subtraction lands early instead of in the delay slot; `lh s1,2(a2)` hoisted ahead of the iVar8 loads). All regs/ops correct (result pinned $s4 reads uninit then RMW-builds the u32; iVar8 unpinned so both halves load to temps -> `subu s5,v1,v0`). Residual is the §20 store-vs-load/delay-slot scheduler tie-break (source reorder/barrier/precompute all tried, do not move it); ~3-4 real slots, count inflated by offset cascade. move==addu rd,rs,zero byte-identical. | `.run/backlog_drafts/func_8012B77C.c` | -| 11 | func_80178004 | 134 | regalloc-order | 165 | near | 91 | [Phase-27 T8 corrected] close=91 pure local-alloc regalloc wall (§52 flagship; the 'MATCH' claim was a retracted myth — never a real match) | `.run/backlog_drafts/func_80178004.c` | -| 12 | func_801412A8 | 134 | regalloc-order | 198 | near | 110 | 110 mismatch (count-exact 198/198). S11 LUID(x)alloc: register-assignment permutation + prim2 store-schedule. §31 permuter seed (was mis-logged 164). | `.run/backlog_drafts/func_801412A8.c` | -| 13 | func_8017C294 | 2 | regalloc-order | 246 | near | 230 | structurally matched (246 ins, param_3 in $fp, spurious psVar7[1] giv killed via | `.run/backlog_drafts/func_8017C294.c` | -| 14 | func_80182988 | 1 | plumbing | 22 | near | 0 | none — MATCH (u16 store of 0xAA10 forces ori, not sign-extended addiu) | `.run/backlog_drafts/func_80182988.c` | -| 15 | func_8017E224 | 1 | struct | 29 | near | 0 | none — MATCH (unaligned 8-byte memcpy of global onto stack + cond byte incr) | `.run/backlog_drafts/func_8017E224.c` | -| 16 | func_80183BAC | 1 | struct | 41 | near | 0 | switch jump-table dispatch (jtbl_801D9420); verifying case grouping 0,1,2,5,6/3,7/4 emits the target table + tail | `.run/backlog_drafts/func_80183BAC.c` | -| 17 | func_80183C50 | 1 | struct | 41 | near | 0 | none — MATCH (cross-jump exploit §cookbook L1543: dup func_8012C218 into case3/7 + case4 → merged jal;nop) | `.run/backlog_drafts/func_80183C50.c` | -| 18 | func_80183AF0 | 1 | regalloc-order | 47 | near | 0 | none — MATCH (mask pinned $a1/$5 + p pinned $v0/$2; switch w/ distributed func_8012C218 tail via dup calls + cross-jump merge) | `.run/backlog_drafts/func_80183AF0.c` | -| 19 | func_8017EC7C | 1 | struct | 52 | near | 0 | none — MATCH (52 ins, relocation-masked) | `.run/backlog_drafts/func_8017EC7C.c` | -| 20 | func_80183CF4 | 1 | struct | 57 | near | 0 | none — MATCH (clean switch + jtbl; orchestrator owns jtbl/rodata migration) | `.run/backlog_drafts/func_80183CF4.c` | -| 21 | func_801842C8 | 1 | plumbing | 62 | near | 0 | none — MATCH | `.run/backlog_drafts/func_801842C8.c` | -| 22 | func_8018281C | 1 | struct | 76 | near | 0 | none — MATCH (76 ins). jtbl forced via explicit case 4/6 (count>=5 over MIPS tablejump threshold); case-5 block placed between if-block and default via goto so the if-block emits j default w/ e2=0 in the delay slot | `.run/backlog_drafts/func_8018281C.c` | -| 23 | func_80182E7C | 1 | struct | 85 | near | 0 | none — MATCH (85 ins, relocation-masked). Two switch-codegen levers: | `.run/backlog_drafts/func_80182E7C.c` | -| 24 | func_801820DC | 1 | struct | 94 | near | 0 | none — MATCH (switch on entity state at 0x34, inner jtbl on (s8)(u70>>8)) | `.run/backlog_drafts/func_801820DC.c` | -| 25 | func_80184D50 | 1 | schedule | 98 | near | 0 | none — MATCH (98 ins, relocation-masked) | `.run/backlog_drafts/func_80184D50.c` | -| 26 | func_8017F1C8 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017F1C8.c` | -| 27 | func_80182B9C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80182B9C.c` | -| 28 | func_8017C150 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017C150.c` | -| 29 | func_8017C078 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017C078.c` | -| 30 | func_801803A0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_801803A0.c` | -| 31 | func_80185D6C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80185D6C.c` | -| 32 | func_801832D0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_801832D0.c` | -| 33 | func_80180EF4 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80180EF4.c` | -| 34 | func_8017D880 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D880.c` | -| 35 | func_80180EE0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80180EE0.c` | -| 36 | func_8017D9FC | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D9FC.c` | -| 37 | func_8017E2A0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017E2A0.c` | -| 38 | func_8017D798 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D798.c` | -| 39 | func_8017D770 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D770.c` | -| 40 | func_8017DE84 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017DE84.c` | -| 41 | func_8017D7C0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D7C0.c` | -| 42 | func_8017DE6C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017DE6C.c` | -| 43 | func_8017DF1C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017DF1C.c` | -| 44 | func_8017E1C0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017E1C0.c` | -| 45 | func_8017DF54 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017DF54.c` | -| 46 | func_8017F060 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017F060.c` | -| 47 | func_8018234C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8018234C.c` | -| 48 | func_80180FF8 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80180FF8.c` | -| 49 | func_80180EAC | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80180EAC.c` | -| 50 | func_8017DB78 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017DB78.c` | -| 51 | func_8017DD30 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017DD30.c` | -| 52 | func_80184674 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80184674.c` | -| 53 | func_80184C90 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80184C90.c` | -| 54 | func_80184884 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80184884.c` | -| 55 | func_80185D00 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80185D00.c` | -| 56 | func_80182C88 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80182C88.c` | -| 57 | func_8017F54C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017F54C.c` | -| 58 | func_8017E58C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017E58C.c` | -| 59 | func_8017DDE0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017DDE0.c` | -| 60 | func_8017FD88 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017FD88.c` | -| 61 | func_8017F630 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017F630.c` | -| 62 | func_80182148 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80182148.c` | -| 63 | func_80186BD8 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80186BD8.c` | -| 64 | func_80182A18 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80182A18.c` | -| 65 | func_80186C1C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80186C1C.c` | -| 66 | func_80180264 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80180264.c` | -| 67 | func_8017D700 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D700.c` | -| 68 | func_80186BF8 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80186BF8.c` | -| 69 | func_8017D4C0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D4C0.c` | -| 70 | func_8017D5A0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D5A0.c` | -| 71 | func_80183554 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80183554.c` | -| 72 | func_8017D5D0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D5D0.c` | -| 73 | func_8017D944 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D944.c` | -| 74 | func_8018540C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8018540C.c` | -| 75 | func_80183DF8 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80183DF8.c` | -| 76 | func_80180534 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80180534.c` | -| 77 | func_80183100 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80183100.c` | -| 78 | func_8017D9AC | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D9AC.c` | -| 79 | func_8018C118 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8018C118.c` | -| 80 | func_80188720 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80188720.c` | -| 81 | func_8018C3EC | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8018C3EC.c` | -| 82 | func_80180944 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80180944.c` | -| 83 | func_8018603C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8018603C.c` | -| 84 | func_80181D30 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80181D30.c` | -| 85 | func_8018C2CC | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8018C2CC.c` | -| 86 | func_8017E464 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017E464.c` | -| 87 | func_800CFE60 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_800CFE60.c` | -| 88 | func_800D0214 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_800D0214.c` | -| 89 | func_80187DD0 | None | regalloc-order | None | near | 0 | none — MATCH (174 ins). Levers: obj = *(*(b+0x20)+0x20) reads via b not a (store side uses a); | `.run/backlog_drafts/func_80187DD0.c` | -| 90 | func_801886B0 | None | struct | None | near | 0 | none — MATCH (276 ins, relocation-masked) | `.run/backlog_drafts/func_801886B0.c` | -| 91 | func_8017F714 | 1 | plumbing | 27 | near | 1 | none — MATCH (27/27 ins, match_one verified) | `.run/backlog_drafts/func_8017F714.c` | -| 92 | func_80184C0C | 1 | struct | 48 | near | 1 | none — MATCH (array-of-struct %lo-fold for &D_8018AEB8[idx], stride 0x34) | `.run/backlog_drafts/func_80184C0C.c` | -| 93 | func_801803B0 | 1 | other | 51 | near | 1 | none — MATCH expected; simple if/else, no call-crossing locals beyond param in $s0 | `.run/backlog_drafts/func_801803B0.c` | -| 94 | func_8017F114 | 1 | regalloc-order | 75 | near | 1 | none — MATCH | `.run/backlog_drafts/func_8017F114.c` | -| 95 | func_801807D8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801807D8.c` | -| 96 | func_80180AD0 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80180AD0.c` | -| 97 | func_8017FDB0 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017FDB0.c` | -| 98 | func_80180720 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80180720.c` | -| 99 | func_80184A28 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80184A28.c` | -| 100 | func_80183AFC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80183AFC.c` | -| 101 | func_8017EE50 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017EE50.c` | -| 102 | func_80181FF8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80181FF8.c` | -| 103 | func_801832F4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801832F4.c` | -| 104 | func_8017FE4C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017FE4C.c` | -| 105 | func_801827C4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801827C4.c` | -| 106 | func_80182B68 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80182B68.c` | -| 107 | func_80185E38 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80185E38.c` | -| 108 | func_8017FD70 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017FD70.c` | -| 109 | func_801811D4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801811D4.c` | -| 110 | func_801819DC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801819DC.c` | -| 111 | func_8018ADF8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018ADF8.c` | -| 112 | func_80186554 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80186554.c` | -| 113 | func_801873FC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801873FC.c` | -| 114 | func_80180E7C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80180E7C.c` | -| 115 | func_801835FC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801835FC.c` | -| 116 | func_80184970 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80184970.c` | -| 117 | func_801863D4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801863D4.c` | -| 118 | func_80181540 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80181540.c` | -| 119 | func_801809D4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801809D4.c` | -| 120 | func_801802A4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801802A4.c` | -| 121 | func_801830A8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801830A8.c` | -| 122 | func_8017E858 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017E858.c` | -| 123 | func_80186BD4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80186BD4.c` | -| 124 | func_8017FB98 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017FB98.c` | -| 125 | func_8017EE14 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017EE14.c` | -| 126 | func_80181DA0 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80181DA0.c` | -| 127 | func_80187840 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80187840.c` | -| 128 | func_80184E58 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80184E58.c` | -| 129 | func_80184354 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80184354.c` | -| 130 | func_8018011C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018011C.c` | -| 131 | func_8017E29C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017E29C.c` | -| 132 | func_8017D930 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017D930.c` | -| 133 | func_80182A8C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80182A8C.c` | -| 134 | func_80181FCC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80181FCC.c` | -| 135 | func_801893E0 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801893E0.c` | -| 136 | func_80186908 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80186908.c` | -| 137 | func_80189DC4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80189DC4.c` | -| 138 | func_80182AB0 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80182AB0.c` | -| 139 | func_80183EA4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80183EA4.c` | -| 140 | func_8018B344 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018B344.c` | -| 141 | func_80188858 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80188858.c` | -| 142 | func_8018773C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018773C.c` | -| 143 | func_80182E9C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80182E9C.c` | -| 144 | func_8017F378 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017F378.c` | -| 145 | func_80184BAC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80184BAC.c` | -| 146 | func_801852D4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801852D4.c` | -| 147 | func_80189B60 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80189B60.c` | -| 148 | func_8018445C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018445C.c` | -| 149 | func_8018AA08 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018AA08.c` | -| 150 | func_80182CEC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80182CEC.c` | -| 151 | func_8018944C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018944C.c` | -| 152 | func_8018A598 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018A598.c` | -| 153 | func_8017EA40 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017EA40.c` | -| 154 | func_801826C8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801826C8.c` | -| 155 | func_801854C0 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801854C0.c` | -| 156 | func_8017EC64 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017EC64.c` | -| 157 | func_80184C94 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80184C94.c` | -| 158 | func_80185CE4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80185CE4.c` | -| 159 | func_8017EA68 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017EA68.c` | -| 160 | func_80180074 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80180074.c` | -| 161 | func_801847E4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801847E4.c` | -| 162 | func_80182470 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80182470.c` | -| 163 | func_8017E3D8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017E3D8.c` | -| 164 | func_8018386C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018386C.c` | -| 165 | func_80187A0C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80187A0C.c` | -| 166 | func_8018893C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018893C.c` | -| 167 | func_80186AE8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80186AE8.c` | -| 168 | func_80185BEC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80185BEC.c` | -| 169 | func_801900B0 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801900B0.c` | -| 170 | func_8017BFC8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017BFC8.c` | -| 171 | func_8017F6B0 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8017F6B0.c` | -| 172 | func_8017DDFC | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8017DDFC.c` | -| 173 | func_801817DC | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_801817DC.c` | -| 174 | func_80182264 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80182264.c` | -| 175 | func_80181834 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80181834.c` | -| 176 | func_8018558C | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8018558C.c` | -| 177 | func_801843CC | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_801843CC.c` | -| 178 | func_8017FC8C | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8017FC8C.c` | -| 179 | func_80183228 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80183228.c` | -| 180 | func_80183118 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80183118.c` | -| 181 | func_8017E404 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8017E404.c` | -| 182 | func_80183B4C | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80183B4C.c` | -| 183 | func_801879B0 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_801879B0.c` | -| 184 | func_801828C8 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_801828C8.c` | -| 185 | func_8017FA80 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8017FA80.c` | -| 186 | func_8017E874 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8017E874.c` | -| 187 | func_80185000 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80185000.c` | -| 188 | func_80180F18 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80180F18.c` | -| 189 | func_8018C658 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8018C658.c` | -| 190 | func_80183F48 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80183F48.c` | -| 191 | func_80180834 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80180834.c` | -| 192 | func_8018BA9C | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8018BA9C.c` | -| 193 | func_80186DAC | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80186DAC.c` | -| 194 | func_8017EE78 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8017EE78.c` | -| 195 | func_801804C8 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_801804C8.c` | -| 196 | func_8017D468 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8017D468.c` | -| 197 | func_801816FC | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_801816FC.c` | -| 198 | func_8017DE90 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8017DE90.c` | -| 199 | func_80190480 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_80190480.c` | -| 200 | func_8018AFDC | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018AFDC.c` | -| 201 | func_80180D34 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_80180D34.c` | -| 202 | func_8017F38C | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8017F38C.c` | -| 203 | func_8018AE6C | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018AE6C.c` | -| 204 | func_80181720 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_80181720.c` | -| 205 | func_80183BC8 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_80183BC8.c` | -| 206 | func_8017F0C0 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8017F0C0.c` | -| 207 | func_8018D4B4 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018D4B4.c` | -| 208 | func_801874E8 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_801874E8.c` | -| 209 | func_80183320 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_80183320.c` | -| 210 | func_801857D4 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_801857D4.c` | -| 211 | func_8018A184 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018A184.c` | -| 212 | func_8018B234 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018B234.c` | -| 213 | func_8017F534 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8017F534.c` | -| 214 | func_801861DC | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_801861DC.c` | -| 215 | func_801896EC | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_801896EC.c` | -| 216 | func_8018C7C8 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018C7C8.c` | -| 217 | func_80187B80 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_80187B80.c` | -| 218 | func_801806C8 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_801806C8.c` | -| 219 | func_8018672C | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018672C.c` | -| 220 | func_801894B0 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_801894B0.c` | -| 221 | func_8018B1E0 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018B1E0.c` | -| 222 | func_80184870 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_80184870.c` | -| 223 | func_8017E6B0 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8017E6B0.c` | -| 224 | func_8017F8E4 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8017F8E4.c` | -| 225 | func_80187074 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80187074.c` | -| 226 | func_8017FF90 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8017FF90.c` | -| 227 | func_8017FAE0 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8017FAE0.c` | -| 228 | func_8017E918 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8017E918.c` | -| 229 | func_80180ED4 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80180ED4.c` | -| 230 | func_80186700 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80186700.c` | -| 231 | func_80184880 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80184880.c` | -| 232 | func_8018CC04 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8018CC04.c` | -| 233 | func_8017DED8 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8017DED8.c` | -| 234 | func_8018455C | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8018455C.c` | -| 235 | func_80181B08 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80181B08.c` | -| 236 | func_801823F0 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_801823F0.c` | -| 237 | func_80188510 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80188510.c` | -| 238 | func_80181A44 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80181A44.c` | -| 239 | func_80182CD4 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80182CD4.c` | -| 240 | func_8018119C | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8018119C.c` | -| 241 | func_8018C394 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8018C394.c` | -| 242 | func_801803F0 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_801803F0.c` | -| 243 | func_8017F7D8 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8017F7D8.c` | -| 244 | func_80181B8C | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80181B8C.c` | -| 245 | func_80180564 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80180564.c` | -| 246 | func_801809F4 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_801809F4.c` | -| 247 | func_8017F250 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8017F250.c` | -| 248 | func_8017F66C | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8017F66C.c` | -| 249 | func_80181E18 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80181E18.c` | -| 250 | func_801852C8 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_801852C8.c` | -| 251 | func_80180100 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80180100.c` | -| 252 | func_80181EF0 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80181EF0.c` | -| 253 | func_801821B8 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_801821B8.c` | -| 254 | func_8018312C | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8018312C.c` | -| 255 | func_8017F11C | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8017F11C.c` | -| 256 | func_80182810 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80182810.c` | -| 257 | func_8017FDA8 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8017FDA8.c` | -| 258 | func_80182938 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80182938.c` | -| 259 | func_8018517C | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8018517C.c` | -| 260 | func_80182B18 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80182B18.c` | -| 261 | func_8017DA90 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8017DA90.c` | -| 262 | func_80181BB4 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80181BB4.c` | -| 263 | func_80185338 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80185338.c` | -| 264 | func_80185978 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80185978.c` | -| 265 | func_80185E54 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80185E54.c` | -| 266 | func_80187DAC | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80187DAC.c` | -| 267 | func_80183DB8 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80183DB8.c` | -| 268 | func_80180AE8 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80180AE8.c` | -| 269 | func_8017D398 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8017D398.c` | -| 270 | func_80184A58 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80184A58.c` | -| 271 | func_80182280 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80182280.c` | -| 272 | func_80181C78 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80181C78.c` | -| 273 | func_801855DC | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_801855DC.c` | -| 274 | func_8017FCD4 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8017FCD4.c` | -| 275 | func_80183158 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80183158.c` | -| 276 | func_80182E2C | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80182E2C.c` | -| 277 | func_8017F704 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8017F704.c` | -| 278 | func_8017E06C | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8017E06C.c` | -| 279 | func_80187AD4 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80187AD4.c` | -| 280 | func_8018595C | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8018595C.c` | -| 281 | func_80185B20 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80185B20.c` | -| 282 | func_801802CC | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_801802CC.c` | -| 283 | func_8017E2C4 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8017E2C4.c` | -| 284 | func_8017F0EC | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8017F0EC.c` | -| 285 | func_80180FFC | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80180FFC.c` | -| 286 | func_80188F80 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80188F80.c` | -| 287 | func_80181FF4 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80181FF4.c` | -| 288 | func_80189240 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80189240.c` | -| 289 | func_80184618 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80184618.c` | -| 290 | func_8018413C | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8018413C.c` | -| 291 | func_801819A0 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_801819A0.c` | -| 292 | func_801855F0 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_801855F0.c` | -| 293 | func_80186A28 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80186A28.c` | -| 294 | func_80186A88 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80186A88.c` | -| 295 | func_80180F4C | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80180F4C.c` | -| 296 | func_80186C88 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80186C88.c` | -| 297 | func_801815D8 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_801815D8.c` | -| 298 | func_80189898 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80189898.c` | -| 299 | func_8017CF40 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_8017CF40.c` | -| 300 | func_80180458 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80180458.c` | -| 301 | func_80185C6C | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80185C6C.c` | -| 302 | func_8018146C | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_8018146C.c` | -| 303 | func_8017C104 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_8017C104.c` | -| 304 | func_80180410 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80180410.c` | -| 305 | func_80180754 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80180754.c` | -| 306 | func_80186720 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80186720.c` | -| 307 | func_8017EA60 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_8017EA60.c` | -| 308 | func_8017F710 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_8017F710.c` | -| 309 | func_80184990 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80184990.c` | -| 310 | func_80185344 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80185344.c` | -| 311 | func_80182230 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80182230.c` | -| 312 | func_80185F24 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80185F24.c` | -| 313 | func_80189858 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80189858.c` | -| 314 | func_8017FFF0 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8017FFF0.c` | -| 315 | func_8017E908 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8017E908.c` | -| 316 | func_8017CF9C | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8017CF9C.c` | -| 317 | func_801832B0 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_801832B0.c` | -| 318 | func_801813B8 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_801813B8.c` | -| 319 | func_80184734 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80184734.c` | -| 320 | func_801825C8 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_801825C8.c` | -| 321 | func_80183430 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80183430.c` | -| 322 | func_80186120 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80186120.c` | -| 323 | func_80188508 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80188508.c` | -| 324 | func_8018D330 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8018D330.c` | -| 325 | func_80186A70 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80186A70.c` | -| 326 | func_8017F474 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8017F474.c` | -| 327 | func_8017E804 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8017E804.c` | -| 328 | func_80182D50 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80182D50.c` | -| 329 | func_801843B8 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_801843B8.c` | -| 330 | func_80181C84 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80181C84.c` | -| 331 | func_801842D4 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_801842D4.c` | -| 332 | func_80185EB4 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80185EB4.c` | -| 333 | func_80188690 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80188690.c` | -| 334 | func_80185F20 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80185F20.c` | -| 335 | func_8018F658 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8018F658.c` | -| 336 | func_8017F228 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8017F228.c` | -| 337 | func_801801F4 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_801801F4.c` | -| 338 | func_8017F358 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017F358.c` | -| 339 | func_80180E9C | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80180E9C.c` | -| 340 | func_8017BEBC | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017BEBC.c` | -| 341 | func_80180854 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80180854.c` | -| 342 | func_80180E54 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80180E54.c` | -| 343 | func_8017F7F4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017F7F4.c` | -| 344 | func_8017EF28 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017EF28.c` | -| 345 | func_801816E4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801816E4.c` | -| 346 | func_8017D400 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017D400.c` | -| 347 | func_8017D6E8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017D6E8.c` | -| 348 | func_8017E4F8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017E4F8.c` | -| 349 | func_801829F4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801829F4.c` | -| 350 | func_801822A8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801822A8.c` | -| 351 | func_8017E954 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017E954.c` | -| 352 | func_80181F84 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80181F84.c` | -| 353 | func_801827FC | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801827FC.c` | -| 354 | func_8017FE88 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017FE88.c` | -| 355 | func_80180EC0 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80180EC0.c` | -| 356 | func_80181C4C | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80181C4C.c` | -| 357 | func_801817A4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801817A4.c` | -| 358 | func_8017E52C | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017E52C.c` | -| 359 | func_801805B0 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801805B0.c` | -| 360 | func_8018897C | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8018897C.c` | -| 361 | func_8018AA88 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8018AA88.c` | -| 362 | func_8017FED4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017FED4.c` | -| 363 | func_801835F0 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801835F0.c` | -| 364 | func_8017CCD4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017CCD4.c` | -| 365 | func_801858C4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801858C4.c` | -| 366 | func_8018C310 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8018C310.c` | -| 367 | func_80182AD4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80182AD4.c` | -| 368 | func_8018868C | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8018868C.c` | -| 369 | func_8017F624 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017F624.c` | -| 370 | func_8017FEB4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017FEB4.c` | -| 371 | func_80182298 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80182298.c` | -| 372 | func_80187114 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80187114.c` | -| 373 | func_80184590 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80184590.c` | -| 374 | func_80181B34 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80181B34.c` | -| 375 | func_801860F8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801860F8.c` | -| 376 | func_8017FFD8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017FFD8.c` | -| 377 | func_80188BF8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80188BF8.c` | -| 378 | func_80183BD0 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80183BD0.c` | -| 379 | func_801860F4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801860F4.c` | -| 380 | func_80183628 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80183628.c` | -| 381 | func_8018964C | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8018964C.c` | -| 382 | func_801854C8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801854C8.c` | -| 383 | func_80184664 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80184664.c` | -| 384 | func_80185528 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80185528.c` | -| 385 | func_80187454 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80187454.c` | -| 386 | func_8017F7BC | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017F7BC.c` | -| 387 | func_801830C8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801830C8.c` | -| 388 | func_8017D4F0 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017D4F0.c` | -| 389 | func_801825E8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801825E8.c` | -| 390 | func_80183C1C | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80183C1C.c` | -| 391 | func_80185A00 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80185A00.c` | -| 392 | func_8017FCC0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017FCC0.c` | -| 393 | func_801833C8 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801833C8.c` | -| 394 | func_8017FFD0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017FFD0.c` | -| 395 | func_80180E34 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80180E34.c` | -| 396 | func_801844C4 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801844C4.c` | -| 397 | func_8018AB24 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018AB24.c` | -| 398 | func_80188C84 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80188C84.c` | -| 399 | func_8017E184 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017E184.c` | -| 400 | func_80181434 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80181434.c` | -| 401 | func_80181A70 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80181A70.c` | -| 402 | func_8017DF88 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017DF88.c` | -| 403 | func_801841D0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801841D0.c` | -| 404 | func_80184204 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80184204.c` | -| 405 | func_8018534C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018534C.c` | -| 406 | func_80184940 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80184940.c` | -| 407 | func_80180B60 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80180B60.c` | -| 408 | func_8017FB0C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017FB0C.c` | -| 409 | func_8017E72C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017E72C.c` | -| 410 | func_80189C4C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80189C4C.c` | -| 411 | func_8017E670 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017E670.c` | -| 412 | func_80180014 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80180014.c` | -| 413 | func_80180B90 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80180B90.c` | -| 414 | func_801848E8 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801848E8.c` | -| 415 | func_8017E094 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017E094.c` | -| 416 | func_8018082C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018082C.c` | -| 417 | func_8018373C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018373C.c` | -| 418 | func_8017DF48 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017DF48.c` | -| 419 | func_80182724 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80182724.c` | -| 420 | func_80182EC0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80182EC0.c` | -| 421 | func_80188E8C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80188E8C.c` | -| 422 | func_801806E0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801806E0.c` | -| 423 | func_8018A5A4 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018A5A4.c` | -| 424 | func_80181AC0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80181AC0.c` | -| 425 | func_801841A0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801841A0.c` | -| 426 | func_80183744 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80183744.c` | -| 427 | func_8018924C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018924C.c` | -| 428 | func_80185778 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80185778.c` | -| 429 | func_801870B4 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801870B4.c` | -| 430 | func_80185E3C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80185E3C.c` | -| 431 | func_8017F5E8 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017F5E8.c` | -| 432 | func_801823D4 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801823D4.c` | -| 433 | func_80186EE4 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80186EE4.c` | -| 434 | func_80180AF4 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80180AF4.c` | -| 435 | func_801831FC | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801831FC.c` | -| 436 | func_801862D4 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801862D4.c` | -| 437 | func_80184578 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80184578.c` | -| 438 | func_8017F804 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017F804.c` | -| 439 | func_80183888 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80183888.c` | -| 440 | func_80187224 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80187224.c` | -| 441 | func_801850F8 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801850F8.c` | -| 442 | func_80183F7C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80183F7C.c` | -| 443 | func_801800DC | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801800DC.c` | -| 444 | func_80182190 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80182190.c` | -| 445 | func_80182380 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80182380.c` | -| 446 | func_8018EDB8 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018EDB8.c` | -| 447 | func_80190298 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80190298.c` | -| 448 | func_8018311C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018311C.c` | -| 449 | func_8018A594 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018A594.c` | -| 450 | func_8017DED0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017DED0.c` | -| 451 | func_8018228C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018228C.c` | -| 452 | func_801889E0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801889E0.c` | -| 453 | func_8017DEEC | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017DEEC.c` | -| 454 | func_8017F300 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017F300.c` | -| 455 | func_80184794 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80184794.c` | -| 456 | func_80185648 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80185648.c` | -| 457 | func_80186D64 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80186D64.c` | -| 458 | func_8018151C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018151C.c` | -| 459 | func_8017F7E8 | 1 | WAVE | 177 | near | 11 | WAVE: 11 mismatch | `.run/backlog_drafts/func_8017F7E8.c` | -| 460 | func_801824D0 | 1 | WAVE | 181 | near | 11 | WAVE: 11 mismatch | `.run/backlog_drafts/func_801824D0.c` | -| 461 | func_80182F4C | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80182F4C.c` | -| 462 | func_801835C8 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_801835C8.c` | -| 463 | func_8017D6C4 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017D6C4.c` | -| 464 | func_80181960 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80181960.c` | -| 465 | func_8017D7C8 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017D7C8.c` | -| 466 | func_8017F67C | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017F67C.c` | -| 467 | func_80181724 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80181724.c` | -| 468 | func_8017F128 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017F128.c` | -| 469 | func_80180154 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80180154.c` | -| 470 | func_80180240 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80180240.c` | -| 471 | func_80185274 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80185274.c` | -| 472 | func_801833D4 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_801833D4.c` | -| 473 | func_80180EA8 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80180EA8.c` | -| 474 | func_8018F91C | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8018F91C.c` | -| 475 | func_801835F4 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_801835F4.c` | -| 476 | func_801848B4 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_801848B4.c` | -| 477 | func_8017E5D4 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017E5D4.c` | -| 478 | func_80182118 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80182118.c` | -| 479 | func_8017E2C0 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017E2C0.c` | -| 480 | func_80181744 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80181744.c` | -| 481 | func_8017EECC | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017EECC.c` | -| 482 | func_80182F78 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80182F78.c` | -| 483 | func_8017F154 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017F154.c` | -| 484 | func_8018150C | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8018150C.c` | -| 485 | func_801803A4 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_801803A4.c` | -| 486 | func_8017D7F8 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017D7F8.c` | -| 487 | func_8017FFFC | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017FFFC.c` | -| 488 | func_8018766C | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8018766C.c` | -| 489 | func_8017DFF8 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017DFF8.c` | -| 490 | func_8017D08C | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017D08C.c` | -| 491 | func_8017DBD8 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017DBD8.c` | -| 492 | func_8017F574 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017F574.c` | -| 493 | func_80183AC8 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80183AC8.c` | -| 494 | func_80181C08 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80181C08.c` | -| 495 | func_801822C8 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_801822C8.c` | -| 496 | func_80181388 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80181388.c` | -| 497 | func_80185C2C | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80185C2C.c` | -| 498 | func_80183BEC | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80183BEC.c` | -| 499 | func_80184DB4 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80184DB4.c` | -| 500 | func_8018AE08 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8018AE08.c` | -| 501 | func_80184698 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80184698.c` | -| 502 | func_80184718 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80184718.c` | -| 503 | func_8018134C | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8018134C.c` | -| 504 | func_8017F4BC | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017F4BC.c` | -| 505 | func_80181070 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80181070.c` | -| 506 | func_801810A4 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_801810A4.c` | -| 507 | func_801810D8 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_801810D8.c` | -| 508 | func_801819CC | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_801819CC.c` | -| 509 | func_80180554 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80180554.c` | -| 510 | func_80181E5C | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80181E5C.c` | -| 511 | func_80189DDC | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80189DDC.c` | -| 512 | func_8018ABE0 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8018ABE0.c` | -| 513 | func_80189A60 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80189A60.c` | -| 514 | func_8018278C | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8018278C.c` | -| 515 | func_801827C0 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_801827C0.c` | -| 516 | func_80186A58 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80186A58.c` | -| 517 | func_8017F2BC | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017F2BC.c` | -| 518 | func_8017F184 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017F184.c` | -| 519 | func_80185F58 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80185F58.c` | -| 520 | func_8018A3C8 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8018A3C8.c` | -| 521 | func_8017EA20 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017EA20.c` | -| 522 | func_80180528 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80180528.c` | -| 523 | func_80180BCC | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80180BCC.c` | -| 524 | func_801818EC | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_801818EC.c` | -| 525 | func_8017DA3C | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017DA3C.c` | -| 526 | func_8017EDA8 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017EDA8.c` | -| 527 | func_801816CC | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_801816CC.c` | -| 528 | func_8017D914 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017D914.c` | -| 529 | func_801828A8 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_801828A8.c` | -| 530 | func_8017FD58 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017FD58.c` | -| 531 | func_8017F830 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017F830.c` | -| 532 | func_8018276C | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8018276C.c` | -| 533 | func_80183AF8 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80183AF8.c` | -| 534 | func_801858D0 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_801858D0.c` | -| 535 | func_80180C34 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80180C34.c` | -| 536 | func_8018BDA4 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8018BDA4.c` | -| 537 | func_8017C8E4 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017C8E4.c` | -| 538 | func_80186D30 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80186D30.c` | -| 539 | func_8017F0D8 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017F0D8.c` | -| 540 | func_8017D3BC | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017D3BC.c` | -| 541 | func_8017E358 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017E358.c` | -| 542 | func_80180420 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80180420.c` | -| 543 | func_8017CFE4 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017CFE4.c` | -| 544 | func_8017E35C | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017E35C.c` | -| 545 | func_801834E4 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_801834E4.c` | -| 546 | func_801811B4 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_801811B4.c` | -| 547 | func_8017DEC4 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017DEC4.c` | -| 548 | func_8017CDBC | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017CDBC.c` | -| 549 | func_80187BAC | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80187BAC.c` | -| 550 | func_80180D10 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80180D10.c` | -| 551 | func_8018316C | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8018316C.c` | -| 552 | func_8017E808 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017E808.c` | -| 553 | func_8017EDC4 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017EDC4.c` | -| 554 | func_80180654 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80180654.c` | -| 555 | func_8017C6F4 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017C6F4.c` | -| 556 | func_8017E4F0 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017E4F0.c` | -| 557 | func_8018B2DC | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8018B2DC.c` | -| 558 | func_80183398 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80183398.c` | -| 559 | func_80181468 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80181468.c` | -| 560 | func_80184384 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80184384.c` | -| 561 | func_8018A934 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8018A934.c` | -| 562 | func_8018B50C | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8018B50C.c` | -| 563 | func_80182844 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80182844.c` | -| 564 | func_80181B90 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80181B90.c` | -| 565 | func_80185F98 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80185F98.c` | -| 566 | func_80185EEC | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80185EEC.c` | -| 567 | func_80186DE8 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80186DE8.c` | -| 568 | func_801838EC | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_801838EC.c` | -| 569 | func_80182348 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80182348.c` | -| 570 | func_80185CD4 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80185CD4.c` | -| 571 | func_801892C0 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_801892C0.c` | -| 572 | func_801859E4 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_801859E4.c` | -| 573 | func_80184B70 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80184B70.c` | -| 574 | func_801871C4 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_801871C4.c` | -| 575 | func_80189504 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80189504.c` | -| 576 | func_8017C918 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017C918.c` | -| 577 | func_8017D63C | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017D63C.c` | -| 578 | func_801813F0 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_801813F0.c` | -| 579 | func_80181F6C | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80181F6C.c` | -| 580 | func_8017EA04 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017EA04.c` | -| 581 | func_8017EF68 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017EF68.c` | -| 582 | func_8017EBA8 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017EBA8.c` | -| 583 | func_80185404 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80185404.c` | -| 584 | func_8017D7C4 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017D7C4.c` | -| 585 | func_8017D974 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017D974.c` | -| 586 | func_80180950 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80180950.c` | -| 587 | func_80181784 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80181784.c` | -| 588 | func_8017FFE8 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017FFE8.c` | -| 589 | func_801820F0 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_801820F0.c` | -| 590 | func_8018B0EC | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8018B0EC.c` | -| 591 | func_801803F4 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_801803F4.c` | -| 592 | func_8017E818 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E818.c` | -| 593 | func_80181B0C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80181B0C.c` | -| 594 | func_80184010 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80184010.c` | -| 595 | func_8018648C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8018648C.c` | -| 596 | func_8017F138 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017F138.c` | -| 597 | func_8017D9B8 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D9B8.c` | -| 598 | func_8017F3C0 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017F3C0.c` | -| 599 | func_80180DB0 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80180DB0.c` | -| 600 | func_8017E290 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E290.c` | -| 601 | func_8017EDC8 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017EDC8.c` | -| 602 | func_80181A94 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80181A94.c` | -| 603 | func_8017E318 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E318.c` | -| 604 | func_80181B44 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80181B44.c` | -| 605 | func_8017D1B4 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D1B4.c` | -| 606 | func_8017E778 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E778.c` | -| 607 | func_80180D5C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80180D5C.c` | -| 608 | func_8017CDB8 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017CDB8.c` | -| 609 | func_8017CE20 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017CE20.c` | -| 610 | func_8017CE40 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017CE40.c` | -| 611 | func_8017D220 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D220.c` | -| 612 | func_8017E89C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E89C.c` | -| 613 | func_8017E8DC | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E8DC.c` | -| 614 | func_80183718 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80183718.c` | -| 615 | func_8017EB1C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017EB1C.c` | -| 616 | func_80181028 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80181028.c` | -| 617 | func_8017DACC | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017DACC.c` | -| 618 | func_8018533C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8018533C.c` | -| 619 | func_8017D104 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D104.c` | -| 620 | func_8017F268 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017F268.c` | -| 621 | func_8017F120 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017F120.c` | -| 622 | func_80185A68 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80185A68.c` | -| 623 | func_8017CE48 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017CE48.c` | -| 624 | func_8017CEB0 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017CEB0.c` | -| 625 | func_80180E88 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80180E88.c` | -| 626 | func_801801C4 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_801801C4.c` | -| 627 | func_8017CEEC | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017CEEC.c` | -| 628 | func_8017CDDC | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017CDDC.c` | -| 629 | func_8017DDD8 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017DDD8.c` | -| 630 | func_8017DD9C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017DD9C.c` | -| 631 | func_8017DF80 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017DF80.c` | -| 632 | func_8017D49C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D49C.c` | -| 633 | func_8017F5E0 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017F5E0.c` | -| 634 | func_8017DFCC | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017DFCC.c` | -| 635 | func_80181C1C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80181C1C.c` | -| 636 | func_8017D22C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D22C.c` | -| 637 | func_8018338C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8018338C.c` | -| 638 | func_8017EEB8 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017EEB8.c` | -| 639 | func_8017E9F4 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E9F4.c` | -| 640 | func_8017E6CC | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E6CC.c` | -| 641 | func_8017F3A8 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017F3A8.c` | -| 642 | func_8017D040 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D040.c` | -| 643 | func_8017E7AC | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E7AC.c` | -| 644 | func_8017E304 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E304.c` | -| 645 | func_8017D084 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D084.c` | -| 646 | func_8017D19C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D19C.c` | -| 647 | func_8017E700 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E700.c` | -| 648 | func_8017E0F0 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017E0F0.c` | -| 649 | func_8017E7D8 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017E7D8.c` | -| 650 | func_80183988 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80183988.c` | -| 651 | func_80184154 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80184154.c` | -| 652 | func_80182D78 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80182D78.c` | -| 653 | func_80183074 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80183074.c` | -| 654 | func_80184EA4 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80184EA4.c` | -| 655 | func_8017F920 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017F920.c` | -| 656 | func_80180EDC | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80180EDC.c` | -| 657 | func_80187A8C | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80187A8C.c` | -| 658 | func_8017F1F8 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017F1F8.c` | -| 659 | func_8017EC84 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017EC84.c` | -| 660 | func_8017E9CC | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017E9CC.c` | -| 661 | func_8017EAE0 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017EAE0.c` | -| 662 | func_80186984 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80186984.c` | -| 663 | func_8017F414 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017F414.c` | -| 664 | func_8017E090 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017E090.c` | -| 665 | func_801853F8 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_801853F8.c` | -| 666 | func_8017F20C | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017F20C.c` | -| 667 | func_80182654 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80182654.c` | -| 668 | func_8017CDE4 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017CDE4.c` | -| 669 | func_8017DFAC | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017DFAC.c` | -| 670 | func_8017EF1C | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017EF1C.c` | -| 671 | func_8017EEF4 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8017EEF4.c` | -| 672 | func_8017E814 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8017E814.c` | -| 673 | func_80184EE0 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_80184EE0.c` | -| 674 | func_8017FA44 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8017FA44.c` | -| 675 | func_80182D1C | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_80182D1C.c` | -| 676 | func_8018384C | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8018384C.c` | -| 677 | func_8017E950 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8017E950.c` | -| 678 | func_8017CDD8 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8017CDD8.c` | -| 679 | func_80180890 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_80180890.c` | -| 680 | func_8017D5F8 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8017D5F8.c` | -| 681 | func_80180D74 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_80180D74.c` | -| 682 | func_8017F568 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8017F568.c` | -| 683 | func_80180D14 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_80180D14.c` | -| 684 | func_80183C58 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_80183C58.c` | -| 685 | func_8018208C | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8018208C.c` | -| 686 | func_8017FD6C | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017FD6C.c` | -| 687 | func_801877DC | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_801877DC.c` | -| 688 | func_8017D010 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017D010.c` | -| 689 | func_8017D84C | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017D84C.c` | -| 690 | func_8017DA10 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017DA10.c` | -| 691 | func_80189630 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_80189630.c` | -| 692 | func_80184630 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_80184630.c` | -| 693 | func_80185334 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_80185334.c` | -| 694 | func_8017E850 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017E850.c` | -| 695 | func_8017DCF4 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017DCF4.c` | -| 696 | func_8017D988 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017D988.c` | -| 697 | func_80182E38 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_80182E38.c` | -| 698 | func_80183138 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_80183138.c` | -| 699 | func_80180B54 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_80180B54.c` | -| 700 | func_8017DC2C | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017DC2C.c` | -| 701 | func_8017D600 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017D600.c` | -| 702 | func_8017F6C4 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017F6C4.c` | -| 703 | func_8017E9E4 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017E9E4.c` | -| 704 | func_801827D4 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_801827D4.c` | -| 705 | func_80185888 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80185888.c` | -| 706 | func_80180574 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80180574.c` | -| 707 | func_80183F1C | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80183F1C.c` | -| 708 | func_8017FFCC | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017FFCC.c` | -| 709 | func_80182344 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80182344.c` | -| 710 | func_801811F4 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_801811F4.c` | -| 711 | func_80180DB8 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80180DB8.c` | -| 712 | func_8017D184 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017D184.c` | -| 713 | func_8017F160 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017F160.c` | -| 714 | func_8017F4D0 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017F4D0.c` | -| 715 | func_8018033C | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8018033C.c` | -| 716 | func_80181138 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80181138.c` | -| 717 | func_8017E048 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017E048.c` | -| 718 | func_8017F3BC | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017F3BC.c` | -| 719 | func_80180DEC | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80180DEC.c` | -| 720 | func_801845B4 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_801845B4.c` | -| 721 | func_80181C74 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80181C74.c` | -| 722 | func_80182234 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80182234.c` | -| 723 | func_8017FF30 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017FF30.c` | -| 724 | func_80185288 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80185288.c` | -| 725 | func_8017E890 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017E890.c` | -| 726 | func_8018555C | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8018555C.c` | -| 727 | func_801826EC | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_801826EC.c` | -| 728 | func_8017DB00 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017DB00.c` | -| 729 | func_80181054 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_80181054.c` | -| 730 | func_8017F87C | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017F87C.c` | -| 731 | func_8017D704 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017D704.c` | -| 732 | func_80180AD8 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_80180AD8.c` | -| 733 | func_8018774C | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8018774C.c` | -| 734 | func_8017DE7C | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017DE7C.c` | -| 735 | func_8017FA00 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017FA00.c` | -| 736 | func_8018B6F4 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8018B6F4.c` | -| 737 | func_8017EEC8 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017EEC8.c` | -| 738 | func_8017E134 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017E134.c` | -| 739 | func_8017C6B8 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017C6B8.c` | -| 740 | func_801871E8 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_801871E8.c` | -| 741 | func_80188668 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_80188668.c` | -| 742 | func_8017DB44 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017DB44.c` | -| 743 | func_80187050 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_80187050.c` | -| 744 | func_8017DD18 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017DD18.c` | -| 745 | func_8018288C | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8018288C.c` | -| 746 | func_8017E1C8 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017E1C8.c` | -| 747 | func_8017D308 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017D308.c` | -| 748 | func_8017EAC8 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017EAC8.c` | -| 749 | func_8017D8B0 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017D8B0.c` | -| 750 | func_8017F080 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017F080.c` | -| 751 | func_8017CD14 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017CD14.c` | -| 752 | func_80180548 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_80180548.c` | -| 753 | func_8017DE78 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017DE78.c` | -| 754 | func_80185A18 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_80185A18.c` | -| 755 | func_8017D990 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017D990.c` | -| 756 | func_8017FF2C | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017FF2C.c` | -| 757 | func_801803E0 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_801803E0.c` | -| 758 | func_8017D828 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017D828.c` | -| 759 | func_80180E18 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_80180E18.c` | -| 760 | func_8017DC08 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017DC08.c` | -| 761 | func_80184388 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_80184388.c` | -| 762 | func_80187C64 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_80187C64.c` | -| 763 | func_8018A030 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8018A030.c` | -| 764 | func_8017D688 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017D688.c` | -| 765 | func_8017FA90 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017FA90.c` | -| 766 | func_8017F320 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017F320.c` | -| 767 | func_801813AC | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_801813AC.c` | -| 768 | func_80181478 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_80181478.c` | -| 769 | func_801868E0 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_801868E0.c` | -| 770 | func_8018AB74 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8018AB74.c` | -| 771 | func_8017DE70 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017DE70.c` | -| 772 | func_8018A640 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8018A640.c` | -| 773 | func_8017DC54 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8017DC54.c` | -| 774 | func_8017F480 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8017F480.c` | -| 775 | func_8017EF7C | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8017EF7C.c` | -| 776 | func_80182FF0 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_80182FF0.c` | -| 777 | func_80182EE8 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_80182EE8.c` | -| 778 | func_8017E240 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8017E240.c` | -| 779 | func_8017CE94 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8017CE94.c` | -| 780 | func_8017D2A4 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8017D2A4.c` | -| 781 | func_8017FAC8 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8017FAC8.c` | -| 782 | func_80181E1C | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_80181E1C.c` | -| 783 | func_80181F60 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_80181F60.c` | -| 784 | func_8018381C | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8018381C.c` | -| 785 | func_80182488 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_80182488.c` | -| 786 | func_8017F500 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017F500.c` | -| 787 | func_8017D1E0 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017D1E0.c` | -| 788 | func_8017DDBC | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017DDBC.c` | -| 789 | func_8017F1BC | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017F1BC.c` | -| 790 | func_8017D384 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017D384.c` | -| 791 | func_8017EFB0 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017EFB0.c` | -| 792 | func_80182708 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_80182708.c` | -| 793 | func_8017F8A8 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017F8A8.c` | -| 794 | func_8017EBEC | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017EBEC.c` | -| 795 | func_801850A0 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_801850A0.c` | -| 796 | func_80184DE8 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_80184DE8.c` | -| 797 | func_801834B4 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_801834B4.c` | -| 798 | func_8018333C | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8018333C.c` | -| 799 | func_8018056C | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8018056C.c` | -| 800 | func_80182154 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_80182154.c` | -| 801 | func_80182C68 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_80182C68.c` | -| 802 | func_8017EA18 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017EA18.c` | -| 803 | func_80180EB8 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_80180EB8.c` | -| 804 | func_801856F0 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_801856F0.c` | -| 805 | func_8018DFDC | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_8018DFDC.c` | -| 806 | func_801827A8 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_801827A8.c` | -| 807 | func_8017CFC4 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_8017CFC4.c` | -| 808 | func_8017D7A4 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_8017D7A4.c` | -| 809 | func_80182514 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_80182514.c` | -| 810 | func_8018545C | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_8018545C.c` | -| 811 | func_80189FCC | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_80189FCC.c` | -| 812 | func_80181134 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_80181134.c` | -| 813 | func_8017FE10 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_8017FE10.c` | -| 814 | func_80185AF8 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_80185AF8.c` | -| 815 | func_80182E34 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_80182E34.c` | -| 816 | func_8017D864 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_8017D864.c` | -| 817 | func_8017DB70 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_8017DB70.c` | -| 818 | func_8017FB68 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_8017FB68.c` | -| 819 | func_8018ACB4 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_8018ACB4.c` | -| 820 | func_8017EBF4 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_8017EBF4.c` | -| 821 | func_80180A5C | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_80180A5C.c` | -| 822 | func_801830EC | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_801830EC.c` | -| 823 | func_801804F4 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_801804F4.c` | -| 824 | func_8017E6C0 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_8017E6C0.c` | -| 825 | func_8017DD64 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_8017DD64.c` | -| 826 | func_8017F024 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_8017F024.c` | -| 827 | func_80181254 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_80181254.c` | -| 828 | func_80181020 | None | | None | near | 27 | residual: 27 mismatch | `.run/backlog_drafts/func_80181020.c` | -| 829 | func_80184A1C | None | | None | near | 27 | residual: 27 mismatch | `.run/backlog_drafts/func_80184A1C.c` | -| 830 | func_80184430 | None | | None | near | 27 | residual: 27 mismatch | `.run/backlog_drafts/func_80184430.c` | -| 831 | func_80185934 | None | | None | near | 27 | residual: 27 mismatch | `.run/backlog_drafts/func_80185934.c` | -| 832 | func_801841B0 | None | | None | near | 27 | residual: 27 mismatch | `.run/backlog_drafts/func_801841B0.c` | -| 833 | func_80180D28 | None | | None | near | 27 | residual: 27 mismatch | `.run/backlog_drafts/func_80180D28.c` | -| 834 | func_8017E1F4 | None | | None | near | 27 | residual: 27 mismatch | `.run/backlog_drafts/func_8017E1F4.c` | -| 835 | func_80182C24 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80182C24.c` | -| 836 | func_8017DAD0 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_8017DAD0.c` | -| 837 | func_8017EE08 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_8017EE08.c` | -| 838 | func_80183C4C | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80183C4C.c` | -| 839 | func_80181300 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80181300.c` | -| 840 | func_8017E218 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_8017E218.c` | -| 841 | func_8017F8AC | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_8017F8AC.c` | -| 842 | func_80180E98 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80180E98.c` | -| 843 | func_8017D21C | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_8017D21C.c` | -| 844 | func_80188650 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80188650.c` | -| 845 | func_801810C0 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_801810C0.c` | -| 846 | func_8017D004 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_8017D004.c` | -| 847 | func_80183A18 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80183A18.c` | -| 848 | func_80182324 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80182324.c` | -| 849 | func_80183A24 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80183A24.c` | -| 850 | func_8017D404 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_8017D404.c` | -| 851 | func_80182544 | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_80182544.c` | -| 852 | func_80180CA0 | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_80180CA0.c` | -| 853 | func_8017ED0C | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_8017ED0C.c` | -| 854 | func_8017FB4C | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_8017FB4C.c` | -| 855 | func_801840C0 | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_801840C0.c` | -| 856 | func_8017F344 | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_8017F344.c` | -| 857 | func_80180214 | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_80180214.c` | -| 858 | func_801803DC | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_801803DC.c` | -| 859 | func_80181304 | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_80181304.c` | -| 860 | func_8018B9DC | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_8018B9DC.c` | -| 861 | func_80180840 | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_80180840.c` | -| 862 | func_80182E08 | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_80182E08.c` | -| 863 | func_8018AF0C | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_8018AF0C.c` | -| 864 | func_8017F750 | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_8017F750.c` | -| 865 | func_8018133C | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_8018133C.c` | -| 866 | func_80183C10 | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_80183C10.c` | -| 867 | func_80180B2C | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_80180B2C.c` | -| 868 | func_8017D894 | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_8017D894.c` | -| 869 | func_8017D1DC | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_8017D1DC.c` | -| 870 | func_8017D9A8 | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_8017D9A8.c` | -| 871 | func_801845E8 | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_801845E8.c` | -| 872 | func_8017CE0C | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_8017CE0C.c` | -| 873 | func_80182268 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_80182268.c` | -| 874 | func_8018337C | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_8018337C.c` | -| 875 | func_801800F4 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_801800F4.c` | -| 876 | func_80181990 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_80181990.c` | -| 877 | func_8017D8C8 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_8017D8C8.c` | -| 878 | func_80184AA8 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_80184AA8.c` | -| 879 | func_8017E9EC | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_8017E9EC.c` | -| 880 | func_80182D18 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_80182D18.c` | -| 881 | func_8017D524 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_8017D524.c` | -| 882 | func_8017D784 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_8017D784.c` | -| 883 | func_801856E4 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_801856E4.c` | -| 884 | func_8017D1D0 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017D1D0.c` | -| 885 | func_8017EEFC | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017EEFC.c` | -| 886 | func_8017FC50 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017FC50.c` | -| 887 | func_8017D554 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017D554.c` | -| 888 | func_80183018 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_80183018.c` | -| 889 | func_8017F370 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017F370.c` | -| 890 | func_8018739C | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8018739C.c` | -| 891 | func_8017DBC0 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017DBC0.c` | -| 892 | func_80182000 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_80182000.c` | -| 893 | func_8017E55C | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017E55C.c` | -| 894 | func_80182600 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_80182600.c` | -| 895 | func_8017FCE8 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017FCE8.c` | -| 896 | func_8017FEC8 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017FEC8.c` | -| 897 | func_8017D874 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017D874.c` | -| 898 | func_8017FACC | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017FACC.c` | -| 899 | func_8017F7F8 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017F7F8.c` | -| 900 | func_8017FB78 | None | | None | near | 33 | residual: 33 mismatch | `.run/backlog_drafts/func_8017FB78.c` | -| 901 | func_80181A40 | None | | None | near | 33 | residual: 33 mismatch | `.run/backlog_drafts/func_80181A40.c` | -| 902 | func_801800D4 | None | | None | near | 33 | residual: 33 mismatch | `.run/backlog_drafts/func_801800D4.c` | -| 903 | func_80182E1C | None | | None | near | 33 | residual: 33 mismatch | `.run/backlog_drafts/func_80182E1C.c` | -| 904 | func_80181F4C | None | | None | near | 33 | residual: 33 mismatch | `.run/backlog_drafts/func_80181F4C.c` | -| 905 | func_8017EEB0 | None | | None | near | 33 | residual: 33 mismatch | `.run/backlog_drafts/func_8017EEB0.c` | -| 906 | func_8017BF14 | None | | None | near | 34 | residual: 34 mismatch | `.run/backlog_drafts/func_8017BF14.c` | -| 907 | func_801859A0 | None | | None | near | 34 | residual: 34 mismatch | `.run/backlog_drafts/func_801859A0.c` | -| 908 | func_8017F8E0 | None | | None | near | 34 | residual: 34 mismatch | `.run/backlog_drafts/func_8017F8E0.c` | -| 909 | func_8017E740 | None | | None | near | 34 | residual: 34 mismatch | `.run/backlog_drafts/func_8017E740.c` | -| 910 | func_8017D804 | None | | None | near | 35 | residual: 35 mismatch | `.run/backlog_drafts/func_8017D804.c` | -| 911 | func_8017DA0C | None | | None | near | 35 | residual: 35 mismatch | `.run/backlog_drafts/func_8017DA0C.c` | -| 912 | func_80180030 | None | | None | near | 35 | residual: 35 mismatch | `.run/backlog_drafts/func_80180030.c` | -| 913 | func_8017E038 | None | | None | near | 35 | residual: 35 mismatch | `.run/backlog_drafts/func_8017E038.c` | -| 914 | func_8017E32C | None | | None | near | 35 | residual: 35 mismatch | `.run/backlog_drafts/func_8017E32C.c` | -| 915 | func_80181090 | None | | None | near | 36 | residual: 36 mismatch | `.run/backlog_drafts/func_80181090.c` | -| 916 | func_8017EC78 | None | | None | near | 36 | residual: 36 mismatch | `.run/backlog_drafts/func_8017EC78.c` | -| 917 | func_8017E79C | None | | None | near | 36 | residual: 36 mismatch | `.run/backlog_drafts/func_8017E79C.c` | -| 918 | func_80182A08 | None | | None | near | 36 | residual: 36 mismatch | `.run/backlog_drafts/func_80182A08.c` | -| 919 | func_8017F0E8 | None | | None | near | 36 | residual: 36 mismatch | `.run/backlog_drafts/func_8017F0E8.c` | -| 920 | func_8017D294 | None | | None | near | 36 | residual: 36 mismatch | `.run/backlog_drafts/func_8017D294.c` | -| 921 | func_80189B38 | None | | None | near | 36 | residual: 36 mismatch | `.run/backlog_drafts/func_80189B38.c` | -| 922 | func_80180F08 | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_80180F08.c` | -| 923 | func_8017D024 | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_8017D024.c` | -| 924 | func_8017EB5C | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_8017EB5C.c` | -| 925 | func_8017EB4C | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_8017EB4C.c` | -| 926 | func_8017EAD8 | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_8017EAD8.c` | -| 927 | func_8017D29C | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_8017D29C.c` | -| 928 | func_8017D450 | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_8017D450.c` | -| 929 | func_8017E230 | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_8017E230.c` | -| 930 | func_8017DA00 | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_8017DA00.c` | -| 931 | func_8017E6FC | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_8017E6FC.c` | -| 932 | func_8017FE08 | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_8017FE08.c` | -| 933 | func_8017D80C | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_8017D80C.c` | -| 934 | func_8018263C | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_8018263C.c` | -| 935 | func_80186FA8 | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_80186FA8.c` | -| 936 | func_80180A38 | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_80180A38.c` | -| 937 | func_8017D740 | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_8017D740.c` | -| 938 | func_8017DD44 | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_8017DD44.c` | -| 939 | func_8017E840 | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017E840.c` | -| 940 | func_8017D1F0 | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017D1F0.c` | -| 941 | func_8017E014 | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017E014.c` | -| 942 | func_8017D09C | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017D09C.c` | -| 943 | func_8017EC70 | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017EC70.c` | -| 944 | func_80180C2C | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_80180C2C.c` | -| 945 | func_8017ECC0 | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017ECC0.c` | -| 946 | func_8017F724 | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017F724.c` | -| 947 | func_8017E36C | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017E36C.c` | -| 948 | func_8018ACD4 | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8018ACD4.c` | -| 949 | func_8017ED80 | None | | None | near | 40 | residual: 40 mismatch | `.run/backlog_drafts/func_8017ED80.c` | -| 950 | func_80180850 | None | | None | near | 40 | residual: 40 mismatch | `.run/backlog_drafts/func_80180850.c` | -| 951 | func_80181438 | None | | None | near | 40 | residual: 40 mismatch | `.run/backlog_drafts/func_80181438.c` | -| 952 | func_8017D0BC | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_8017D0BC.c` | -| 953 | func_8017E94C | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_8017E94C.c` | -| 954 | func_8017E170 | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_8017E170.c` | -| 955 | func_8018043C | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_8018043C.c` | -| 956 | func_8018A3F0 | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_8018A3F0.c` | -| 957 | func_80183364 | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_80183364.c` | -| 958 | func_801824F0 | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_801824F0.c` | -| 959 | func_8017F4A0 | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_8017F4A0.c` | -| 960 | func_801877E4 | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_801877E4.c` | -| 961 | func_80183F4C | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_80183F4C.c` | -| 962 | func_80186044 | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_80186044.c` | -| 963 | func_80180010 | None | | None | near | 42 | residual: 42 mismatch | `.run/backlog_drafts/func_80180010.c` | -| 964 | func_8017E824 | None | | None | near | 42 | residual: 42 mismatch | `.run/backlog_drafts/func_8017E824.c` | -| 965 | func_80183598 | None | | None | near | 42 | residual: 42 mismatch | `.run/backlog_drafts/func_80183598.c` | -| 966 | func_8017ECF4 | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_8017ECF4.c` | -| 967 | func_8018118C | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_8018118C.c` | -| 968 | func_8018FB8C | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_8018FB8C.c` | -| 969 | func_8017D6D0 | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_8017D6D0.c` | -| 970 | func_8017D96C | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_8017D96C.c` | -| 971 | func_8017DF44 | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_8017DF44.c` | -| 972 | func_801812FC | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_801812FC.c` | -| 973 | func_80186B08 | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_80186B08.c` | -| 974 | func_8017E578 | None | | None | near | 44 | residual: 44 mismatch | `.run/backlog_drafts/func_8017E578.c` | -| 975 | func_80185C70 | None | | None | near | 44 | residual: 44 mismatch | `.run/backlog_drafts/func_80185C70.c` | -| 976 | func_8017F90C | None | | None | near | 44 | residual: 44 mismatch | `.run/backlog_drafts/func_8017F90C.c` | -| 977 | func_8017D6FC | None | | None | near | 44 | residual: 44 mismatch | `.run/backlog_drafts/func_8017D6FC.c` | -| 978 | func_8017E7D0 | None | | None | near | 45 | residual: 45 mismatch | `.run/backlog_drafts/func_8017E7D0.c` | -| 979 | func_80189304 | None | | None | near | 45 | residual: 45 mismatch | `.run/backlog_drafts/func_80189304.c` | -| 980 | func_8017D01C | None | | None | near | 45 | residual: 45 mismatch | `.run/backlog_drafts/func_8017D01C.c` | -| 981 | func_8017E380 | None | | None | near | 45 | residual: 45 mismatch | `.run/backlog_drafts/func_8017E380.c` | -| 982 | func_80180A88 | None | | None | near | 45 | residual: 45 mismatch | `.run/backlog_drafts/func_80180A88.c` | -| 983 | func_8017E9D8 | None | | None | near | 45 | residual: 45 mismatch | `.run/backlog_drafts/func_8017E9D8.c` | -| 984 | func_80189DB4 | None | | None | near | 45 | residual: 45 mismatch | `.run/backlog_drafts/func_80189DB4.c` | -| 985 | func_8018001C | None | | None | near | 46 | residual: 46 mismatch | `.run/backlog_drafts/func_8018001C.c` | -| 986 | func_8017F2A0 | None | | None | near | 46 | residual: 46 mismatch | `.run/backlog_drafts/func_8017F2A0.c` | -| 987 | func_8017EF24 | None | | None | near | 46 | residual: 46 mismatch | `.run/backlog_drafts/func_8017EF24.c` | -| 988 | func_80185EA8 | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_80185EA8.c` | -| 989 | func_8018912C | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_8018912C.c` | -| 990 | func_80188BEC | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_80188BEC.c` | -| 991 | func_801804DC | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_801804DC.c` | -| 992 | func_801808D8 | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_801808D8.c` | -| 993 | func_8017E8D0 | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_8017E8D0.c` | -| 994 | func_801846AC | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_801846AC.c` | -| 995 | func_801805DC | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_801805DC.c` | -| 996 | func_80184D0C | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_80184D0C.c` | -| 997 | func_8017F84C | None | | None | near | 48 | residual: 48 mismatch | `.run/backlog_drafts/func_8017F84C.c` | -| 998 | func_8017EF54 | None | | None | near | 48 | residual: 48 mismatch | `.run/backlog_drafts/func_8017EF54.c` | -| 999 | func_80181CE0 | None | | None | near | 48 | residual: 48 mismatch | `.run/backlog_drafts/func_80181CE0.c` | -| 1000 | func_8017FCF0 | None | | None | near | 48 | residual: 48 mismatch | `.run/backlog_drafts/func_8017FCF0.c` | -| 1001 | func_8017D6F0 | None | | None | near | 49 | residual: 49 mismatch | `.run/backlog_drafts/func_8017D6F0.c` | -| 1002 | func_8017DF40 | None | | None | near | 49 | residual: 49 mismatch | `.run/backlog_drafts/func_8017DF40.c` | -| 1003 | func_801845EC | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_801845EC.c` | -| 1004 | func_8017F4C4 | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_8017F4C4.c` | -| 1005 | func_80188BB0 | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_80188BB0.c` | -| 1006 | func_80181B78 | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_80181B78.c` | -| 1007 | func_8017DE74 | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_8017DE74.c` | -| 1008 | func_80183D48 | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_80183D48.c` | -| 1009 | func_8017EC08 | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_8017EC08.c` | -| 1010 | func_80184130 | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_80184130.c` | -| 1011 | func_80181124 | None | | None | near | 52 | residual: 52 mismatch | `.run/backlog_drafts/func_80181124.c` | -| 1012 | func_8017FB48 | None | | None | near | 52 | residual: 52 mismatch | `.run/backlog_drafts/func_8017FB48.c` | -| 1013 | func_80186A0C | None | | None | near | 53 | residual: 53 mismatch | `.run/backlog_drafts/func_80186A0C.c` | -| 1014 | func_8017F050 | None | | None | near | 53 | residual: 53 mismatch | `.run/backlog_drafts/func_8017F050.c` | -| 1015 | func_8018592C | None | | None | near | 53 | residual: 53 mismatch | `.run/backlog_drafts/func_8018592C.c` | -| 1016 | func_8018CFF4 | None | | None | near | 53 | residual: 53 mismatch | `.run/backlog_drafts/func_8018CFF4.c` | -| 1017 | func_8017DB6C | None | | None | near | 53 | residual: 53 mismatch | `.run/backlog_drafts/func_8017DB6C.c` | -| 1018 | func_8018048C | None | | None | near | 53 | residual: 53 mismatch | `.run/backlog_drafts/func_8018048C.c` | -| 1019 | func_8018465C | None | | None | near | 54 | residual: 54 mismatch | `.run/backlog_drafts/func_8018465C.c` | -| 1020 | func_80183C54 | None | | None | near | 54 | residual: 54 mismatch | `.run/backlog_drafts/func_80183C54.c` | -| 1021 | func_80180B7C | None | | None | near | 54 | residual: 54 mismatch | `.run/backlog_drafts/func_80180B7C.c` | -| 1022 | func_8017FE54 | None | | None | near | 55 | residual: 55 mismatch | `.run/backlog_drafts/func_8017FE54.c` | -| 1023 | func_8017ED60 | None | | None | near | 55 | residual: 55 mismatch | `.run/backlog_drafts/func_8017ED60.c` | -| 1024 | func_80183C9C | None | | None | near | 55 | residual: 55 mismatch | `.run/backlog_drafts/func_80183C9C.c` | -| 1025 | func_801802BC | None | | None | near | 55 | residual: 55 mismatch | `.run/backlog_drafts/func_801802BC.c` | -| 1026 | func_80182030 | None | | None | near | 55 | residual: 55 mismatch | `.run/backlog_drafts/func_80182030.c` | -| 1027 | func_80180204 | None | | None | near | 55 | residual: 55 mismatch | `.run/backlog_drafts/func_80180204.c` | -| 1028 | func_80181DEC | None | | None | near | 57 | residual: 57 mismatch | `.run/backlog_drafts/func_80181DEC.c` | -| 1029 | func_8017E524 | None | | None | near | 57 | residual: 57 mismatch | `.run/backlog_drafts/func_8017E524.c` | -| 1030 | func_8018A538 | None | | None | near | 57 | residual: 57 mismatch | `.run/backlog_drafts/func_8018A538.c` | -| 1031 | func_8017ECB0 | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_8017ECB0.c` | -| 1032 | func_801898C8 | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_801898C8.c` | -| 1033 | func_80184920 | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_80184920.c` | -| 1034 | func_80182EA0 | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_80182EA0.c` | -| 1035 | func_8017F1C4 | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_8017F1C4.c` | -| 1036 | func_80181A5C | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_80181A5C.c` | -| 1037 | func_8017D544 | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_8017D544.c` | -| 1038 | func_8017EA2C | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_8017EA2C.c` | -| 1039 | func_80182BF4 | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_80182BF4.c` | -| 1040 | func_8017F24C | None | | None | near | 59 | residual: 59 mismatch | `.run/backlog_drafts/func_8017F24C.c` | -| 1041 | func_8017D4CC | None | | None | near | 59 | residual: 59 mismatch | `.run/backlog_drafts/func_8017D4CC.c` | -| 1042 | func_80183624 | None | | None | near | 59 | residual: 59 mismatch | `.run/backlog_drafts/func_80183624.c` | -| 1043 | func_80180B50 | None | | None | near | 59 | residual: 59 mismatch | `.run/backlog_drafts/func_80180B50.c` | -| 1044 | func_8018567C | None | | None | near | 59 | residual: 59 mismatch | `.run/backlog_drafts/func_8018567C.c` | -| 1045 | func_8017E75C | None | | None | near | 61 | residual: 61 mismatch | `.run/backlog_drafts/func_8017E75C.c` | -| 1046 | func_80184778 | None | | None | near | 61 | residual: 61 mismatch | `.run/backlog_drafts/func_80184778.c` | -| 1047 | func_8017EEE0 | None | | None | near | 62 | residual: 62 mismatch | `.run/backlog_drafts/func_8017EEE0.c` | -| 1048 | func_80188204 | None | | None | near | 62 | residual: 62 mismatch | `.run/backlog_drafts/func_80188204.c` | -| 1049 | func_8017F25C | None | | None | near | 62 | residual: 62 mismatch | `.run/backlog_drafts/func_8017F25C.c` | -| 1050 | func_8017EB74 | None | | None | near | 63 | residual: 63 mismatch | `.run/backlog_drafts/func_8017EB74.c` | -| 1051 | func_8017E798 | None | | None | near | 64 | residual: 64 mismatch | `.run/backlog_drafts/func_8017E798.c` | -| 1052 | func_8017D610 | None | | None | near | 64 | residual: 64 mismatch | `.run/backlog_drafts/func_8017D610.c` | -| 1053 | func_8017CD10 | None | | None | near | 64 | residual: 64 mismatch | `.run/backlog_drafts/func_8017CD10.c` | -| 1054 | func_8017F1A0 | None | | None | near | 64 | residual: 64 mismatch | `.run/backlog_drafts/func_8017F1A0.c` | -| 1055 | func_8017D928 | None | | None | near | 64 | residual: 64 mismatch | `.run/backlog_drafts/func_8017D928.c` | -| 1056 | func_8018656C | None | | None | near | 65 | residual: 65 mismatch | `.run/backlog_drafts/func_8018656C.c` | -| 1057 | func_80184854 | None | | None | near | 66 | residual: 66 mismatch | `.run/backlog_drafts/func_80184854.c` | -| 1058 | func_80185B5C | None | | None | near | 67 | residual: 67 mismatch | `.run/backlog_drafts/func_80185B5C.c` | -| 1059 | func_8017E910 | None | | None | near | 68 | residual: 68 mismatch | `.run/backlog_drafts/func_8017E910.c` | -| 1060 | func_80182378 | None | | None | near | 69 | residual: 69 mismatch | `.run/backlog_drafts/func_80182378.c` | -| 1061 | func_80183544 | None | | None | near | 69 | residual: 69 mismatch | `.run/backlog_drafts/func_80183544.c` | -| 1062 | func_8018434C | None | | None | near | 69 | residual: 69 mismatch | `.run/backlog_drafts/func_8018434C.c` | -| 1063 | func_80180224 | None | | None | near | 71 | residual: 71 mismatch | `.run/backlog_drafts/func_80180224.c` | -| 1064 | func_80184238 | None | | None | near | 72 | residual: 72 mismatch | `.run/backlog_drafts/func_80184238.c` | -| 1065 | func_801866B0 | None | | None | near | 72 | residual: 72 mismatch | `.run/backlog_drafts/func_801866B0.c` | -| 1066 | func_8017D9E4 | None | | None | near | 73 | residual: 73 mismatch | `.run/backlog_drafts/func_8017D9E4.c` | -| 1067 | func_80181344 | None | | None | near | 73 | residual: 73 mismatch | `.run/backlog_drafts/func_80181344.c` | -| 1068 | func_80189B3C | None | | None | near | 74 | residual: 74 mismatch | `.run/backlog_drafts/func_80189B3C.c` | -| 1069 | func_80182B90 | None | | None | near | 74 | residual: 74 mismatch | `.run/backlog_drafts/func_80182B90.c` | -| 1070 | func_8018165C | None | | None | near | 74 | residual: 74 mismatch | `.run/backlog_drafts/func_8018165C.c` | -| 1071 | func_8017F468 | None | | None | near | 74 | residual: 74 mismatch | `.run/backlog_drafts/func_8017F468.c` | -| 1072 | func_8017DAB4 | None | | None | near | 75 | residual: 75 mismatch | `.run/backlog_drafts/func_8017DAB4.c` | -| 1073 | func_80181500 | None | | None | near | 75 | residual: 75 mismatch | `.run/backlog_drafts/func_80181500.c` | -| 1074 | func_801814A8 | None | | None | near | 76 | residual: 76 mismatch | `.run/backlog_drafts/func_801814A8.c` | -| 1075 | func_8017E81C | None | | None | near | 76 | residual: 76 mismatch | `.run/backlog_drafts/func_8017E81C.c` | -| 1076 | func_8018474C | None | | None | near | 76 | residual: 76 mismatch | `.run/backlog_drafts/func_8018474C.c` | -| 1077 | func_80184DDC | None | | None | near | 77 | residual: 77 mismatch | `.run/backlog_drafts/func_80184DDC.c` | -| 1078 | func_8017E2F4 | None | | None | near | 77 | residual: 77 mismatch | `.run/backlog_drafts/func_8017E2F4.c` | -| 1079 | func_8017EDBC | None | | None | near | 78 | residual: 78 mismatch | `.run/backlog_drafts/func_8017EDBC.c` | -| 1080 | func_8017E5F0 | None | | None | near | 79 | residual: 79 mismatch | `.run/backlog_drafts/func_8017E5F0.c` | -| 1081 | func_801815AC | None | | None | near | 79 | residual: 79 mismatch | `.run/backlog_drafts/func_801815AC.c` | -| 1082 | func_8017D54C | None | | None | near | 79 | residual: 79 mismatch | `.run/backlog_drafts/func_8017D54C.c` | -| 1083 | func_80181260 | None | | None | near | 79 | residual: 79 mismatch | `.run/backlog_drafts/func_80181260.c` | -| 1084 | func_801805D0 | None | | None | near | 79 | residual: 79 mismatch | `.run/backlog_drafts/func_801805D0.c` | -| 1085 | func_8017F290 | 1 | regalloc-order | 86 | near | 81 | none — MATCH. Two levers: (1) hold &D_801270CC in a `int *state` local so its | `.run/backlog_drafts/func_8017F290.c` | -| 1086 | func_80181068 | None | | None | near | 81 | residual: 81 mismatch | `.run/backlog_drafts/func_80181068.c` | -| 1087 | func_80184E00 | None | | None | near | 82 | residual: 82 mismatch | `.run/backlog_drafts/func_80184E00.c` | -| 1088 | func_8017EB88 | None | | None | near | 82 | residual: 82 mismatch | `.run/backlog_drafts/func_8017EB88.c` | -| 1089 | func_8017FB3C | None | | None | near | 82 | residual: 82 mismatch | `.run/backlog_drafts/func_8017FB3C.c` | -| 1090 | func_8017F840 | None | | None | near | 82 | residual: 82 mismatch | `.run/backlog_drafts/func_8017F840.c` | -| 1091 | func_8017DA9C | None | | None | near | 83 | residual: 83 mismatch | `.run/backlog_drafts/func_8017DA9C.c` | -| 1092 | func_801829F0 | None | | None | near | 83 | residual: 83 mismatch | `.run/backlog_drafts/func_801829F0.c` | -| 1093 | func_8017FBA4 | None | | None | near | 83 | residual: 83 mismatch | `.run/backlog_drafts/func_8017FBA4.c` | -| 1094 | func_801848AC | None | | None | near | 84 | residual: 84 mismatch | `.run/backlog_drafts/func_801848AC.c` | -| 1095 | func_8017DC9C | None | | None | near | 84 | residual: 84 mismatch | `.run/backlog_drafts/func_8017DC9C.c` | -| 1096 | func_801840FC | None | | None | near | 85 | residual: 85 mismatch | `.run/backlog_drafts/func_801840FC.c` | -| 1097 | func_80186094 | None | | None | near | 85 | residual: 85 mismatch | `.run/backlog_drafts/func_80186094.c` | -| 1098 | func_801847FC | None | | None | near | 86 | residual: 86 mismatch | `.run/backlog_drafts/func_801847FC.c` | -| 1099 | func_8018006C | None | | None | near | 86 | residual: 86 mismatch | `.run/backlog_drafts/func_8018006C.c` | -| 1100 | func_8017DFD8 | None | | None | near | 87 | residual: 87 mismatch | `.run/backlog_drafts/func_8017DFD8.c` | -| 1101 | func_8017D1F8 | None | | None | near | 87 | residual: 87 mismatch | `.run/backlog_drafts/func_8017D1F8.c` | -| 1102 | func_8017CE68 | None | | None | near | 87 | residual: 87 mismatch | `.run/backlog_drafts/func_8017CE68.c` | -| 1103 | func_8017D7D0 | None | | None | near | 88 | residual: 88 mismatch | `.run/backlog_drafts/func_8017D7D0.c` | -| 1104 | func_80181838 | None | | None | near | 88 | residual: 88 mismatch | `.run/backlog_drafts/func_80181838.c` | -| 1105 | func_801821D4 | None | | None | near | 90 | residual: 90 mismatch | `.run/backlog_drafts/func_801821D4.c` | -| 1106 | func_8017F0A8 | None | | None | near | 90 | residual: 90 mismatch | `.run/backlog_drafts/func_8017F0A8.c` | -| 1107 | func_8018AD3C | None | | None | near | 90 | residual: 90 mismatch | `.run/backlog_drafts/func_8018AD3C.c` | -| 1108 | func_8017DD5C | None | | None | near | 90 | residual: 90 mismatch | `.run/backlog_drafts/func_8017DD5C.c` | -| 1109 | func_8017EDC0 | None | | None | near | 91 | residual: 91 mismatch | `.run/backlog_drafts/func_8017EDC0.c` | -| 1110 | func_801807DC | None | | None | near | 92 | residual: 92 mismatch | `.run/backlog_drafts/func_801807DC.c` | -| 1111 | func_80180170 | None | | None | near | 92 | residual: 92 mismatch | `.run/backlog_drafts/func_80180170.c` | -| 1112 | func_8017D98C | 1 | plumbing | 31 | near | 93 | none — MATCH (expected): straight global stores + tail call; const 0x140 reused for two halves | `.run/backlog_drafts/func_8017D98C.c` | -| 1113 | func_8017EFFC | None | | None | near | 93 | residual: 93 mismatch | `.run/backlog_drafts/func_8017EFFC.c` | -| 1114 | func_8017D940 | None | | None | near | 94 | residual: 94 mismatch | `.run/backlog_drafts/func_8017D940.c` | -| 1115 | func_8017D934 | None | | None | near | 95 | residual: 95 mismatch | `.run/backlog_drafts/func_8017D934.c` | -| 1116 | func_8017DAB8 | None | | None | near | 97 | residual: 97 mismatch | `.run/backlog_drafts/func_8017DAB8.c` | -| 1117 | func_80180040 | None | | None | near | 97 | residual: 97 mismatch | `.run/backlog_drafts/func_80180040.c` | -| 1118 | func_8017FBE0 | None | | None | near | 97 | residual: 97 mismatch | `.run/backlog_drafts/func_8017FBE0.c` | -| 1119 | func_8017F240 | 1 | regalloc-order | 20 | near | 98 | none — MATCH (base &D_801270D0 pinned to $s0 holds across call; one lui/addiu reused for load+store) | `.run/backlog_drafts/func_8017F240.c` | -| 1120 | func_801863B0 | None | | None | near | 98 | residual: 98 mismatch | `.run/backlog_drafts/func_801863B0.c` | -| 1121 | func_80182728 | None | | None | near | 98 | residual: 98 mismatch | `.run/backlog_drafts/func_80182728.c` | -| 1122 | func_8018038C | None | | None | near | 100 | residual: 100 mismatch | `.run/backlog_drafts/func_8018038C.c` | -| 1123 | func_8017D808 | None | | None | near | 102 | residual: 102 mismatch | `.run/backlog_drafts/func_8017D808.c` | -| 1124 | func_80182D10 | None | | None | near | 102 | residual: 102 mismatch | `.run/backlog_drafts/func_80182D10.c` | -| 1125 | func_8017DC40 | None | | None | near | 104 | residual: 104 mismatch | `.run/backlog_drafts/func_8017DC40.c` | -| 1126 | func_80180F34 | None | | None | near | 105 | residual: 105 mismatch | `.run/backlog_drafts/func_80180F34.c` | -| 1127 | func_80181C44 | None | | None | near | 105 | residual: 105 mismatch | `.run/backlog_drafts/func_80181C44.c` | -| 1128 | func_8017F96C | None | | None | near | 106 | residual: 106 mismatch | `.run/backlog_drafts/func_8017F96C.c` | -| 1129 | func_8017EFEC | None | | None | near | 107 | residual: 107 mismatch | `.run/backlog_drafts/func_8017EFEC.c` | -| 1130 | func_80182BC8 | None | | None | near | 107 | residual: 107 mismatch | `.run/backlog_drafts/func_80182BC8.c` | -| 1131 | func_8017F69C | None | | None | near | 107 | residual: 107 mismatch | `.run/backlog_drafts/func_8017F69C.c` | -| 1132 | func_80184828 | None | | None | near | 109 | residual: 109 mismatch | `.run/backlog_drafts/func_80184828.c` | -| 1133 | func_8017F3E4 | None | | None | near | 110 | residual: 110 mismatch | `.run/backlog_drafts/func_8017F3E4.c` | -| 1134 | func_8017DAF4 | None | | None | near | 111 | residual: 111 mismatch | `.run/backlog_drafts/func_8017DAF4.c` | -| 1135 | func_8017FE9C | None | | None | near | 111 | residual: 111 mismatch | `.run/backlog_drafts/func_8017FE9C.c` | -| 1136 | func_8017F768 | None | | None | near | 112 | residual: 112 mismatch | `.run/backlog_drafts/func_8017F768.c` | -| 1137 | func_8017F3B8 | None | | None | near | 112 | residual: 112 mismatch | `.run/backlog_drafts/func_8017F3B8.c` | -| 1138 | func_8017D508 | None | | None | near | 113 | residual: 113 mismatch | `.run/backlog_drafts/func_8017D508.c` | -| 1139 | func_8018788C | None | | None | near | 113 | residual: 113 mismatch | `.run/backlog_drafts/func_8018788C.c` | -| 1140 | func_8017E978 | None | | None | near | 115 | residual: 115 mismatch | `.run/backlog_drafts/func_8017E978.c` | -| 1141 | func_80181858 | None | | None | near | 117 | residual: 117 mismatch | `.run/backlog_drafts/func_80181858.c` | -| 1142 | func_80184CD0 | None | | None | near | 118 | residual: 118 mismatch | `.run/backlog_drafts/func_80184CD0.c` | -| 1143 | func_8017E8F8 | None | | None | near | 120 | residual: 120 mismatch | `.run/backlog_drafts/func_8017E8F8.c` | -| 1144 | func_80184358 | None | | None | near | 121 | residual: 121 mismatch | `.run/backlog_drafts/func_80184358.c` | -| 1145 | func_8017F074 | None | | None | near | 121 | residual: 121 mismatch | `.run/backlog_drafts/func_8017F074.c` | -| 1146 | func_8017D890 | None | | None | near | 124 | residual: 124 mismatch | `.run/backlog_drafts/func_8017D890.c` | -| 1147 | func_8017DECC | None | | None | near | 125 | residual: 125 mismatch | `.run/backlog_drafts/func_8017DECC.c` | -| 1148 | func_80185020 | None | | None | near | 125 | residual: 125 mismatch | `.run/backlog_drafts/func_80185020.c` | -| 1149 | func_8017DD2C | None | | None | near | 125 | residual: 125 mismatch | `.run/backlog_drafts/func_8017DD2C.c` | -| 1150 | func_801884BC | None | | None | near | 125 | residual: 125 mismatch | `.run/backlog_drafts/func_801884BC.c` | -| 1151 | func_801892CC | None | | None | near | 127 | residual: 127 mismatch | `.run/backlog_drafts/func_801892CC.c` | -| 1152 | func_8017EB00 | None | | None | near | 127 | residual: 127 mismatch | `.run/backlog_drafts/func_8017EB00.c` | -| 1153 | func_8017E538 | None | | None | near | 128 | residual: 128 mismatch | `.run/backlog_drafts/func_8017E538.c` | -| 1154 | func_8017D50C | None | | None | near | 128 | residual: 128 mismatch | `.run/backlog_drafts/func_8017D50C.c` | -| 1155 | func_801803F8 | None | | None | near | 129 | residual: 129 mismatch | `.run/backlog_drafts/func_801803F8.c` | -| 1156 | func_80185E68 | 1 | STRUCT | 132 | near | 131 | STRUCT: 131 mismatch | `.run/backlog_drafts/func_80185E68.c` | -| 1157 | func_8017E378 | None | | None | near | 134 | residual: 134 mismatch | `.run/backlog_drafts/func_8017E378.c` | -| 1158 | func_80185730 | None | | None | near | 136 | residual: 136 mismatch | `.run/backlog_drafts/func_80185730.c` | -| 1159 | func_8018523C | None | | None | near | 136 | residual: 136 mismatch | `.run/backlog_drafts/func_8018523C.c` | -| 1160 | func_80186530 | None | | None | near | 139 | residual: 139 mismatch | `.run/backlog_drafts/func_80186530.c` | -| 1161 | func_80184F08 | None | regalloc-order | None | near | 141 | none — MATCH (145/145 ins, match_one confirmed) | `.run/backlog_drafts/func_80184F08.c` | -| 1162 | func_80185668 | None | | None | near | 142 | residual: 142 mismatch | `.run/backlog_drafts/func_80185668.c` | -| 1163 | func_8017DB0C | None | | None | near | 142 | residual: 142 mismatch | `.run/backlog_drafts/func_8017DB0C.c` | -| 1164 | func_801814B0 | None | | None | near | 144 | residual: 144 mismatch | `.run/backlog_drafts/func_801814B0.c` | -| 1165 | func_801801A4 | None | | None | near | 148 | residual: 148 mismatch | `.run/backlog_drafts/func_801801A4.c` | -| 1166 | func_80180868 | None | | None | near | 148 | residual: 148 mismatch | `.run/backlog_drafts/func_80180868.c` | -| 1167 | func_801829BC | None | | None | near | 150 | residual: 150 mismatch | `.run/backlog_drafts/func_801829BC.c` | -| 1168 | func_8017FBE8 | None | | None | near | 151 | residual: 151 mismatch | `.run/backlog_drafts/func_8017FBE8.c` | -| 1169 | func_8018200C | None | | None | near | 152 | residual: 152 mismatch | `.run/backlog_drafts/func_8018200C.c` | -| 1170 | func_80181984 | None | | None | near | 153 | residual: 153 mismatch | `.run/backlog_drafts/func_80181984.c` | -| 1171 | func_80183280 | None | | None | near | 154 | residual: 154 mismatch | `.run/backlog_drafts/func_80183280.c` | -| 1172 | func_80184CA0 | None | | None | near | 162 | residual: 162 mismatch | `.run/backlog_drafts/func_80184CA0.c` | -| 1173 | func_8017FA54 | None | | None | near | 166 | residual: 166 mismatch | `.run/backlog_drafts/func_8017FA54.c` | -| 1174 | func_8017D708 | None | | None | near | 166 | residual: 166 mismatch | `.run/backlog_drafts/func_8017D708.c` | -| 1175 | func_8017E6EC | None | | None | near | 172 | residual: 172 mismatch | `.run/backlog_drafts/func_8017E6EC.c` | -| 1176 | func_8017D5DC | None | | None | near | 173 | residual: 173 mismatch | `.run/backlog_drafts/func_8017D5DC.c` | -| 1177 | func_8017D47C | None | | None | near | 173 | residual: 173 mismatch | `.run/backlog_drafts/func_8017D47C.c` | -| 1178 | func_8017F40C | None | | None | near | 174 | residual: 174 mismatch | `.run/backlog_drafts/func_8017F40C.c` | -| 1179 | func_80184210 | None | | None | near | 176 | residual: 176 mismatch | `.run/backlog_drafts/func_80184210.c` | -| 1180 | func_80185E34 | None | | None | near | 185 | residual: 185 mismatch | `.run/backlog_drafts/func_80185E34.c` | -| 1181 | func_80180568 | None | | None | near | 185 | residual: 185 mismatch | `.run/backlog_drafts/func_80180568.c` | -| 1182 | func_801809C4 | None | | None | near | 190 | residual: 190 mismatch | `.run/backlog_drafts/func_801809C4.c` | -| 1183 | func_80183D84 | None | | None | near | 192 | residual: 192 mismatch | `.run/backlog_drafts/func_80183D84.c` | -| 1184 | func_80183FEC | None | | None | near | 198 | residual: 198 mismatch | `.run/backlog_drafts/func_80183FEC.c` | -| 1185 | func_801823B8 | None | | None | near | 204 | residual: 204 mismatch | `.run/backlog_drafts/func_801823B8.c` | -| 1186 | func_801826C4 | None | | None | near | 207 | residual: 207 mismatch | `.run/backlog_drafts/func_801826C4.c` | -| 1187 | func_8017E374 | None | | None | near | 234 | residual: 234 mismatch | `.run/backlog_drafts/func_8017E374.c` | -| 1188 | func_8018C3F8 | None | | None | near | 236 | residual: 236 mismatch | `.run/backlog_drafts/func_8018C3F8.c` | -| 1189 | func_80183438 | None | | None | near | 237 | residual: 237 mismatch | `.run/backlog_drafts/func_80183438.c` | -| 1190 | func_8017E7D4 | None | | None | near | 241 | residual: 241 mismatch | `.run/backlog_drafts/func_8017E7D4.c` | -| 1191 | func_80183BF8 | None | | None | near | 258 | residual: 258 mismatch | `.run/backlog_drafts/func_80183BF8.c` | -| 1192 | func_8017EB30 | None | | None | near | 278 | residual: 278 mismatch | `.run/backlog_drafts/func_8017EB30.c` | -| 1193 | func_801804A0 | None | | None | near | 280 | residual: 280 mismatch | `.run/backlog_drafts/func_801804A0.c` | -| 1194 | func_80187EDC | None | | None | near | 296 | residual: 296 mismatch | `.run/backlog_drafts/func_80187EDC.c` | -| 1195 | func_8017F554 | None | | None | near | 299 | residual: 299 mismatch | `.run/backlog_drafts/func_8017F554.c` | -| 1196 | func_8017FEF0 | None | | None | near | 304 | residual: 304 mismatch | `.run/backlog_drafts/func_8017FEF0.c` | -| 1197 | func_80181670 | None | | None | near | 311 | residual: 311 mismatch | `.run/backlog_drafts/func_80181670.c` | -| 1198 | func_801833F0 | None | | None | near | 328 | residual: 328 mismatch | `.run/backlog_drafts/func_801833F0.c` | -| 1199 | func_80181128 | None | | None | near | 385 | residual: 385 mismatch | `.run/backlog_drafts/func_80181128.c` | -| 1200 | func_8017EA84 | None | | None | near | 578 | residual: 578 mismatch | `.run/backlog_drafts/func_8017EA84.c` | -| 1201 | func_8018057C | None | | None | near | 897 | residual: 897 mismatch | `.run/backlog_drafts/func_8018057C.c` | -| 1202 | func_80184A68 | 1 | regalloc-order | 33 | failed | | none — MATCH | `.run/backlog_drafts/func_80184A68.c` | -| 1203 | func_80180B64 | 1 | struct | 75 | failed | | none — MATCH (75 ins, relocation-masked) | `.run/backlog_drafts/func_80180B64.c` | -| 1204 | func_80183DE0 | 1 | regalloc-order | 91 | failed | | testing if(!=1) layout + counter-before-pointer init order | `.run/backlog_drafts/func_80183DE0.c` | -| 1205 | func_80182C9C | 1 | schedule | 101 | failed | | none — MATCH (101 ins). Inner-switch break-to-shared-tail must be written as | `.run/backlog_drafts/func_80182C9C.c` | -| 1206 | func_80183FB8 | 1 | loose-typing | 101 | failed | | none — MATCH (relocation-masked match_one, 101/101 ins) | `.run/backlog_drafts/func_80183FB8.c` | -| 1207 | func_80185BA4 | 1 | WAVE | 177 | failed | | won't compile standalone (loose-typing / missing decl) | | -| 1208 | func_8017D8DC | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017D8DC.c` | -| 1209 | func_80187750 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80187750.c` | -| 1210 | func_8017FFEC | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017FFEC.c` | -| 1211 | func_80184018 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80184018.c` | -| 1212 | func_8017DC18 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017DC18.c` | -| 1213 | func_801853CC | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801853CC.c` | -| 1214 | func_80181894 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80181894.c` | -| 1215 | func_8018BFBC | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8018BFBC.c` | -| 1216 | func_801807F4 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801807F4.c` | -| 1217 | func_8017FFC8 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017FFC8.c` | -| 1218 | func_8017E99C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017E99C.c` | -| 1219 | func_80180294 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80180294.c` | -| 1220 | func_80184504 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80184504.c` | -| 1221 | func_80180B1C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80180B1C.c` | -| 1222 | func_8017E76C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017E76C.c` | -| 1223 | func_8017F29C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017F29C.c` | -| 1224 | func_8018253C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8018253C.c` | -| 1225 | func_8017F00C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017F00C.c` | -| 1226 | func_801802B0 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801802B0.c` | -| 1227 | func_80181FDC | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80181FDC.c` | -| 1228 | func_8017DA1C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017DA1C.c` | -| 1229 | func_8017FFC4 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017FFC4.c` | -| 1230 | func_8017E2F0 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017E2F0.c` | -| 1231 | func_8018358C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8018358C.c` | -| 1232 | func_801841E4 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801841E4.c` | -| 1233 | func_80181738 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80181738.c` | -| 1234 | func_801873D8 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801873D8.c` | -| 1235 | func_80181E90 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80181E90.c` | -| 1236 | func_80185628 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80185628.c` | -| 1237 | func_80182384 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80182384.c` | -| 1238 | func_801829D8 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801829D8.c` | -| 1239 | func_80181A78 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80181A78.c` | -| 1240 | func_80186E58 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80186E58.c` | -| 1241 | func_801805D4 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801805D4.c` | -| 1242 | func_8017EA1C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017EA1C.c` | -| 1243 | func_8017F098 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017F098.c` | -| 1244 | func_801822CC | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801822CC.c` | -| 1245 | func_80185BA8 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80185BA8.c` | -| 1246 | func_8018E710 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8018E710.c` | -| 1247 | func_801852D0 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801852D0.c` | -| 1248 | func_8017E3F4 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017E3F4.c` | -| 1249 | func_800D1658 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_800D1658.c` | -| 1250 | func_800D1984 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_800D1984.c` | -| 1251 | func_800D24A0 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_800D24A0.c` | -| 1252 | func_8018457C | None | regalloc-order | None | failed | | none — MATCH (160 ins). case1-tail needed a $a0 pin on the state temp | `.run/backlog_drafts/func_8018457C.c` | -| 1253 | func_8018D870 | None | regalloc-order | None | failed | | none — MATCH (match_one 380/380, relocation-masked). Levers: &&-DeMorgan for the mult block layout; lhu-corrected reads; split temps (t=func_8012C658 ret->v1, d8p=d8 load-temp->a0, s60/amt pinned $v1/$a1 for the mult chain); accumulate-in-place for the 0xe add; unsigned-short store for ori 0x8800; d8-load-via-temp to force the addu s3,a0 copy (fixes -1 length drift). | `.run/backlog_drafts/func_8018D870.c` | -| 1254 | func_80144B9C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80144B9C.c` | -| 1255 | func_8013DD68 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8013DD68.c` | +| 1 | func_80176144 | 138 | schedule | 53 | near | 0 | none — MATCH | `.run/backlog_drafts/func_80176144.c` | +| 2 | func_8014F4C0 | 138 | struct | 141 | near | 130 | none — MATCH (expansion of proven DEFINE_func_8014F4C0 macro, matched in 137 sibling overlays) | `.run/backlog_drafts/func_8014F4C0.c` | +| 3 | func_80161208 | 134 | plumbing | 14 | near | 0 | none — MATCH expected (param saved across call → natural $s0, no pin needed) | `.run/backlog_drafts/func_80161208.c` | +| 4 | func_80162CCC | 134 | plumbing | 23 | near | 0 | none — MATCH expected; direct translation, psVar1 as u16* gives lhu, $s0=param_1 survives both calls | `.run/backlog_drafts/func_80162CCC.c` | +| 5 | func_801758FC | 134 | schedule | 55 | near | 0 | none — MATCH (55 ins) | `.run/backlog_drafts/func_801758FC.c` | +| 6 | func_8016BA68 | 134 | STUB | 29 | near | 1 | STUB: 1 mismatch | `.run/backlog_drafts/func_8016BA68.c` | +| 7 | func_80147364 | 134 | remat | 30 | near | 4 | none — MATCH (30 ins). Lever: hoist &D_80126B58 into a local ptr `u8 *p=&D_80126B58;` so gcc | `.run/backlog_drafts/func_80147364.c` | +| 8 | func_80146A6C | 134 | struct | 18 | near | 5 | none — MATCH | `.run/backlog_drafts/func_80146A6C.c` | +| 9 | func_8012B77C | 134 | schedule | 58 | near | 33 | gcc instruction-scheduler load-ordering + 1st-ratan2 delay-slot fill differ (s2 subtraction lands early instead of in the delay slot; `lh s1,2(a2)` hoisted ahead of the iVar8 loads). All regs/ops correct (result pinned $s4 reads uninit then RMW-builds the u32; iVar8 unpinned so both halves load to temps -> `subu s5,v1,v0`). Residual is the §20 store-vs-load/delay-slot scheduler tie-break (source reorder/barrier/precompute all tried, do not move it); ~3-4 real slots, count inflated by offset cascade. move==addu rd,rs,zero byte-identical. | `.run/backlog_drafts/func_8012B77C.c` | +| 10 | func_80178004 | 134 | regalloc-order | 165 | near | 91 | [Phase-27 T8 corrected] close=91 pure local-alloc regalloc wall (§52 flagship; the 'MATCH' claim was a retracted myth — never a real match) | `.run/backlog_drafts/func_80178004.c` | +| 11 | func_801412A8 | 134 | regalloc-order | 198 | near | 110 | 110 mismatch (count-exact 198/198). S11 LUID(x)alloc: register-assignment permutation + prim2 store-schedule. §31 permuter seed (was mis-logged 164). | `.run/backlog_drafts/func_801412A8.c` | +| 12 | func_8017C294 | 2 | regalloc-order | 246 | near | 230 | structurally matched (246 ins, param_3 in $fp, spurious psVar7[1] giv killed via | `.run/backlog_drafts/func_8017C294.c` | +| 13 | func_80182988 | 1 | plumbing | 22 | near | 0 | none — MATCH (u16 store of 0xAA10 forces ori, not sign-extended addiu) | `.run/backlog_drafts/func_80182988.c` | +| 14 | func_8017E224 | 1 | struct | 29 | near | 0 | none — MATCH (unaligned 8-byte memcpy of global onto stack + cond byte incr) | `.run/backlog_drafts/func_8017E224.c` | +| 15 | func_80183BAC | 1 | struct | 41 | near | 0 | switch jump-table dispatch (jtbl_801D9420); verifying case grouping 0,1,2,5,6/3,7/4 emits the target table + tail | `.run/backlog_drafts/func_80183BAC.c` | +| 16 | func_80183C50 | 1 | struct | 41 | near | 0 | none — MATCH (cross-jump exploit §cookbook L1543: dup func_8012C218 into case3/7 + case4 → merged jal;nop) | `.run/backlog_drafts/func_80183C50.c` | +| 17 | func_80183AF0 | 1 | regalloc-order | 47 | near | 0 | none — MATCH (mask pinned $a1/$5 + p pinned $v0/$2; switch w/ distributed func_8012C218 tail via dup calls + cross-jump merge) | `.run/backlog_drafts/func_80183AF0.c` | +| 18 | func_8017EC7C | 1 | struct | 52 | near | 0 | none — MATCH (52 ins, relocation-masked) | `.run/backlog_drafts/func_8017EC7C.c` | +| 19 | func_80183CF4 | 1 | struct | 57 | near | 0 | none — MATCH (clean switch + jtbl; orchestrator owns jtbl/rodata migration) | `.run/backlog_drafts/func_80183CF4.c` | +| 20 | func_801842C8 | 1 | plumbing | 62 | near | 0 | none — MATCH | `.run/backlog_drafts/func_801842C8.c` | +| 21 | func_8018281C | 1 | struct | 76 | near | 0 | none — MATCH (76 ins). jtbl forced via explicit case 4/6 (count>=5 over MIPS tablejump threshold); case-5 block placed between if-block and default via goto so the if-block emits j default w/ e2=0 in the delay slot | `.run/backlog_drafts/func_8018281C.c` | +| 22 | func_80182E7C | 1 | struct | 85 | near | 0 | none — MATCH (85 ins, relocation-masked). Two switch-codegen levers: | `.run/backlog_drafts/func_80182E7C.c` | +| 23 | func_801820DC | 1 | struct | 94 | near | 0 | none — MATCH (switch on entity state at 0x34, inner jtbl on (s8)(u70>>8)) | `.run/backlog_drafts/func_801820DC.c` | +| 24 | func_80184D50 | 1 | schedule | 98 | near | 0 | none — MATCH (98 ins, relocation-masked) | `.run/backlog_drafts/func_80184D50.c` | +| 25 | func_8017F1C8 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017F1C8.c` | +| 26 | func_80182B9C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80182B9C.c` | +| 27 | func_8017C150 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017C150.c` | +| 28 | func_8017C078 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017C078.c` | +| 29 | func_801803A0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_801803A0.c` | +| 30 | func_80185D6C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80185D6C.c` | +| 31 | func_801832D0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_801832D0.c` | +| 32 | func_80180EF4 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80180EF4.c` | +| 33 | func_8017D880 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D880.c` | +| 34 | func_80180EE0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80180EE0.c` | +| 35 | func_8017D9FC | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D9FC.c` | +| 36 | func_8017E2A0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017E2A0.c` | +| 37 | func_8017D798 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D798.c` | +| 38 | func_8017D770 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D770.c` | +| 39 | func_8017DE84 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017DE84.c` | +| 40 | func_8017D7C0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D7C0.c` | +| 41 | func_8017DE6C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017DE6C.c` | +| 42 | func_8017DF1C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017DF1C.c` | +| 43 | func_8017E1C0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017E1C0.c` | +| 44 | func_8017DF54 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017DF54.c` | +| 45 | func_8017F060 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017F060.c` | +| 46 | func_8018234C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8018234C.c` | +| 47 | func_80180FF8 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80180FF8.c` | +| 48 | func_8017DB78 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017DB78.c` | +| 49 | func_8017DD30 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017DD30.c` | +| 50 | func_80184674 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80184674.c` | +| 51 | func_80184C90 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80184C90.c` | +| 52 | func_80184884 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80184884.c` | +| 53 | func_80185D00 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80185D00.c` | +| 54 | func_8017F54C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017F54C.c` | +| 55 | func_8017E58C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017E58C.c` | +| 56 | func_8017DDE0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017DDE0.c` | +| 57 | func_8017FD88 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017FD88.c` | +| 58 | func_8017F630 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017F630.c` | +| 59 | func_80182148 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80182148.c` | +| 60 | func_80186BD8 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80186BD8.c` | +| 61 | func_80182A18 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80182A18.c` | +| 62 | func_80186C1C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80186C1C.c` | +| 63 | func_80180264 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80180264.c` | +| 64 | func_8017D700 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D700.c` | +| 65 | func_80186BF8 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80186BF8.c` | +| 66 | func_8017D4C0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D4C0.c` | +| 67 | func_8017D5A0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D5A0.c` | +| 68 | func_80183554 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80183554.c` | +| 69 | func_8017D5D0 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D5D0.c` | +| 70 | func_8017D944 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D944.c` | +| 71 | func_8018540C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8018540C.c` | +| 72 | func_80183DF8 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80183DF8.c` | +| 73 | func_80180534 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80180534.c` | +| 74 | func_80183100 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80183100.c` | +| 75 | func_8017D9AC | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017D9AC.c` | +| 76 | func_8018C118 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8018C118.c` | +| 77 | func_80188720 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80188720.c` | +| 78 | func_8018C3EC | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8018C3EC.c` | +| 79 | func_80180944 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80180944.c` | +| 80 | func_8018603C | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8018603C.c` | +| 81 | func_80181D30 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_80181D30.c` | +| 82 | func_8018C2CC | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8018C2CC.c` | +| 83 | func_8017E464 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_8017E464.c` | +| 84 | func_800CFE60 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_800CFE60.c` | +| 85 | func_800D0214 | None | | None | near | 0 | match_one MATCH but gate rejected (declaration/TU plumbing) | `.run/backlog_drafts/func_800D0214.c` | +| 86 | func_80187DD0 | None | regalloc-order | None | near | 0 | none — MATCH (174 ins). Levers: obj = *(*(b+0x20)+0x20) reads via b not a (store side uses a); | `.run/backlog_drafts/func_80187DD0.c` | +| 87 | func_801886B0 | None | struct | None | near | 0 | none — MATCH (276 ins, relocation-masked) | `.run/backlog_drafts/func_801886B0.c` | +| 88 | func_8017F714 | 1 | plumbing | 27 | near | 1 | none — MATCH (27/27 ins, match_one verified) | `.run/backlog_drafts/func_8017F714.c` | +| 89 | func_80184C0C | 1 | struct | 48 | near | 1 | none — MATCH (array-of-struct %lo-fold for &D_8018AEB8[idx], stride 0x34) | `.run/backlog_drafts/func_80184C0C.c` | +| 90 | func_801803B0 | 1 | other | 51 | near | 1 | none — MATCH expected; simple if/else, no call-crossing locals beyond param in $s0 | `.run/backlog_drafts/func_801803B0.c` | +| 91 | func_8017F114 | 1 | regalloc-order | 75 | near | 1 | none — MATCH | `.run/backlog_drafts/func_8017F114.c` | +| 92 | func_801807D8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801807D8.c` | +| 93 | func_80180AD0 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80180AD0.c` | +| 94 | func_8017FDB0 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017FDB0.c` | +| 95 | func_80180720 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80180720.c` | +| 96 | func_80184A28 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80184A28.c` | +| 97 | func_80183AFC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80183AFC.c` | +| 98 | func_8017EE50 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017EE50.c` | +| 99 | func_80181FF8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80181FF8.c` | +| 100 | func_801832F4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801832F4.c` | +| 101 | func_8017FE4C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017FE4C.c` | +| 102 | func_801827C4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801827C4.c` | +| 103 | func_80182B68 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80182B68.c` | +| 104 | func_80185E38 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80185E38.c` | +| 105 | func_8017FD70 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017FD70.c` | +| 106 | func_801811D4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801811D4.c` | +| 107 | func_801819DC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801819DC.c` | +| 108 | func_8018ADF8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018ADF8.c` | +| 109 | func_80186554 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80186554.c` | +| 110 | func_801873FC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801873FC.c` | +| 111 | func_80180E7C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80180E7C.c` | +| 112 | func_801835FC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801835FC.c` | +| 113 | func_80184970 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80184970.c` | +| 114 | func_801863D4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801863D4.c` | +| 115 | func_80181540 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80181540.c` | +| 116 | func_801809D4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801809D4.c` | +| 117 | func_801802A4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801802A4.c` | +| 118 | func_801830A8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801830A8.c` | +| 119 | func_8017E858 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017E858.c` | +| 120 | func_80186BD4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80186BD4.c` | +| 121 | func_8017FB98 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017FB98.c` | +| 122 | func_8017EE14 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017EE14.c` | +| 123 | func_80181DA0 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80181DA0.c` | +| 124 | func_80187840 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80187840.c` | +| 125 | func_80184E58 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80184E58.c` | +| 126 | func_80184354 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80184354.c` | +| 127 | func_8018011C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018011C.c` | +| 128 | func_8017E29C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017E29C.c` | +| 129 | func_8017D930 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017D930.c` | +| 130 | func_80182A8C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80182A8C.c` | +| 131 | func_80181FCC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80181FCC.c` | +| 132 | func_801893E0 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801893E0.c` | +| 133 | func_80186908 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80186908.c` | +| 134 | func_80189DC4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80189DC4.c` | +| 135 | func_80182AB0 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80182AB0.c` | +| 136 | func_80183EA4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80183EA4.c` | +| 137 | func_8018B344 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018B344.c` | +| 138 | func_80188858 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80188858.c` | +| 139 | func_8018773C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018773C.c` | +| 140 | func_80182E9C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80182E9C.c` | +| 141 | func_8017F378 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017F378.c` | +| 142 | func_80184BAC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80184BAC.c` | +| 143 | func_801852D4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801852D4.c` | +| 144 | func_80189B60 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80189B60.c` | +| 145 | func_8018445C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018445C.c` | +| 146 | func_8018AA08 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018AA08.c` | +| 147 | func_80182CEC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80182CEC.c` | +| 148 | func_8018944C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018944C.c` | +| 149 | func_8018A598 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018A598.c` | +| 150 | func_8017EA40 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017EA40.c` | +| 151 | func_801826C8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801826C8.c` | +| 152 | func_801854C0 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801854C0.c` | +| 153 | func_8017EC64 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017EC64.c` | +| 154 | func_80184C94 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80184C94.c` | +| 155 | func_80185CE4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80185CE4.c` | +| 156 | func_8017EA68 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017EA68.c` | +| 157 | func_80180074 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80180074.c` | +| 158 | func_801847E4 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801847E4.c` | +| 159 | func_80182470 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80182470.c` | +| 160 | func_8017E3D8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017E3D8.c` | +| 161 | func_8018386C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018386C.c` | +| 162 | func_80187A0C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80187A0C.c` | +| 163 | func_8018893C | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8018893C.c` | +| 164 | func_80185BEC | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_80185BEC.c` | +| 165 | func_801900B0 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_801900B0.c` | +| 166 | func_8017BFC8 | None | | None | near | 1 | residual: 1 mismatch | `.run/backlog_drafts/func_8017BFC8.c` | +| 167 | func_8017F6B0 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8017F6B0.c` | +| 168 | func_8017DDFC | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8017DDFC.c` | +| 169 | func_801817DC | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_801817DC.c` | +| 170 | func_80182264 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80182264.c` | +| 171 | func_80181834 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80181834.c` | +| 172 | func_8018558C | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8018558C.c` | +| 173 | func_801843CC | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_801843CC.c` | +| 174 | func_8017FC8C | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8017FC8C.c` | +| 175 | func_80183228 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80183228.c` | +| 176 | func_80183118 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80183118.c` | +| 177 | func_8017E404 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8017E404.c` | +| 178 | func_80183B4C | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80183B4C.c` | +| 179 | func_801879B0 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_801879B0.c` | +| 180 | func_801828C8 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_801828C8.c` | +| 181 | func_8017FA80 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8017FA80.c` | +| 182 | func_8017E874 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8017E874.c` | +| 183 | func_80185000 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80185000.c` | +| 184 | func_80180F18 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80180F18.c` | +| 185 | func_8018C658 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8018C658.c` | +| 186 | func_80183F48 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80183F48.c` | +| 187 | func_80180834 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80180834.c` | +| 188 | func_8018BA9C | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8018BA9C.c` | +| 189 | func_80186DAC | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_80186DAC.c` | +| 190 | func_8017EE78 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_8017EE78.c` | +| 191 | func_801804C8 | None | | None | near | 2 | residual: 2 mismatch | `.run/backlog_drafts/func_801804C8.c` | +| 192 | func_8017D468 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8017D468.c` | +| 193 | func_801816FC | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_801816FC.c` | +| 194 | func_8017DE90 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8017DE90.c` | +| 195 | func_80190480 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_80190480.c` | +| 196 | func_8018AFDC | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018AFDC.c` | +| 197 | func_80180D34 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_80180D34.c` | +| 198 | func_8017F38C | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8017F38C.c` | +| 199 | func_8018AE6C | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018AE6C.c` | +| 200 | func_80181720 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_80181720.c` | +| 201 | func_80183BC8 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_80183BC8.c` | +| 202 | func_8017F0C0 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8017F0C0.c` | +| 203 | func_8018D4B4 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018D4B4.c` | +| 204 | func_801874E8 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_801874E8.c` | +| 205 | func_80183320 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_80183320.c` | +| 206 | func_801857D4 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_801857D4.c` | +| 207 | func_8018A184 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018A184.c` | +| 208 | func_8018B234 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018B234.c` | +| 209 | func_8017F534 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8017F534.c` | +| 210 | func_801861DC | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_801861DC.c` | +| 211 | func_801896EC | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_801896EC.c` | +| 212 | func_8018C7C8 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018C7C8.c` | +| 213 | func_80187B80 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_80187B80.c` | +| 214 | func_801806C8 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_801806C8.c` | +| 215 | func_8018672C | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018672C.c` | +| 216 | func_801894B0 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_801894B0.c` | +| 217 | func_8018B1E0 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8018B1E0.c` | +| 218 | func_80184870 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_80184870.c` | +| 219 | func_8017E6B0 | None | | None | near | 3 | residual: 3 mismatch | `.run/backlog_drafts/func_8017E6B0.c` | +| 220 | func_8017F8E4 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8017F8E4.c` | +| 221 | func_80187074 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80187074.c` | +| 222 | func_8017FF90 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8017FF90.c` | +| 223 | func_8017FAE0 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8017FAE0.c` | +| 224 | func_8017E918 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8017E918.c` | +| 225 | func_80180ED4 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80180ED4.c` | +| 226 | func_80186700 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80186700.c` | +| 227 | func_80184880 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80184880.c` | +| 228 | func_8018CC04 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8018CC04.c` | +| 229 | func_8017DED8 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8017DED8.c` | +| 230 | func_8018455C | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8018455C.c` | +| 231 | func_80181B08 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80181B08.c` | +| 232 | func_801823F0 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_801823F0.c` | +| 233 | func_80188510 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80188510.c` | +| 234 | func_80181A44 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80181A44.c` | +| 235 | func_80182CD4 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_80182CD4.c` | +| 236 | func_8018119C | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8018119C.c` | +| 237 | func_8018C394 | None | | None | near | 4 | residual: 4 mismatch | `.run/backlog_drafts/func_8018C394.c` | +| 238 | func_801803F0 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_801803F0.c` | +| 239 | func_8017F7D8 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8017F7D8.c` | +| 240 | func_80181B8C | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80181B8C.c` | +| 241 | func_80180564 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80180564.c` | +| 242 | func_801809F4 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_801809F4.c` | +| 243 | func_8017F250 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8017F250.c` | +| 244 | func_8017F66C | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8017F66C.c` | +| 245 | func_80181E18 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80181E18.c` | +| 246 | func_801852C8 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_801852C8.c` | +| 247 | func_80180100 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80180100.c` | +| 248 | func_80181EF0 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80181EF0.c` | +| 249 | func_801821B8 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_801821B8.c` | +| 250 | func_8018312C | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8018312C.c` | +| 251 | func_8017F11C | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8017F11C.c` | +| 252 | func_80182810 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80182810.c` | +| 253 | func_8017FDA8 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8017FDA8.c` | +| 254 | func_80182938 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80182938.c` | +| 255 | func_8018517C | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8018517C.c` | +| 256 | func_80182B18 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80182B18.c` | +| 257 | func_8017DA90 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_8017DA90.c` | +| 258 | func_80181BB4 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80181BB4.c` | +| 259 | func_80185338 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80185338.c` | +| 260 | func_80185978 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80185978.c` | +| 261 | func_80185E54 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80185E54.c` | +| 262 | func_80187DAC | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80187DAC.c` | +| 263 | func_80183DB8 | None | | None | near | 5 | residual: 5 mismatch | `.run/backlog_drafts/func_80183DB8.c` | +| 264 | func_80180AE8 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80180AE8.c` | +| 265 | func_8017D398 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8017D398.c` | +| 266 | func_80184A58 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80184A58.c` | +| 267 | func_80182280 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80182280.c` | +| 268 | func_80181C78 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80181C78.c` | +| 269 | func_801855DC | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_801855DC.c` | +| 270 | func_8017FCD4 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8017FCD4.c` | +| 271 | func_80183158 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80183158.c` | +| 272 | func_80182E2C | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80182E2C.c` | +| 273 | func_8017F704 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8017F704.c` | +| 274 | func_8017E06C | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8017E06C.c` | +| 275 | func_80187AD4 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80187AD4.c` | +| 276 | func_8018595C | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8018595C.c` | +| 277 | func_80185B20 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80185B20.c` | +| 278 | func_801802CC | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_801802CC.c` | +| 279 | func_8017E2C4 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8017E2C4.c` | +| 280 | func_8017F0EC | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8017F0EC.c` | +| 281 | func_80180FFC | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80180FFC.c` | +| 282 | func_80188F80 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80188F80.c` | +| 283 | func_80181FF4 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80181FF4.c` | +| 284 | func_80189240 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80189240.c` | +| 285 | func_80184618 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80184618.c` | +| 286 | func_8018413C | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_8018413C.c` | +| 287 | func_801819A0 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_801819A0.c` | +| 288 | func_801855F0 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_801855F0.c` | +| 289 | func_80186A28 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80186A28.c` | +| 290 | func_80186A88 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80186A88.c` | +| 291 | func_80180F4C | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80180F4C.c` | +| 292 | func_80186C88 | None | | None | near | 6 | residual: 6 mismatch | `.run/backlog_drafts/func_80186C88.c` | +| 293 | func_801815D8 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_801815D8.c` | +| 294 | func_80189898 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80189898.c` | +| 295 | func_8017CF40 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_8017CF40.c` | +| 296 | func_80180458 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80180458.c` | +| 297 | func_80185C6C | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80185C6C.c` | +| 298 | func_8018146C | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_8018146C.c` | +| 299 | func_8017C104 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_8017C104.c` | +| 300 | func_80180410 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80180410.c` | +| 301 | func_80180754 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80180754.c` | +| 302 | func_80186720 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80186720.c` | +| 303 | func_8017EA60 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_8017EA60.c` | +| 304 | func_8017F710 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_8017F710.c` | +| 305 | func_80184990 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80184990.c` | +| 306 | func_80185344 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80185344.c` | +| 307 | func_80182230 | None | | None | near | 7 | residual: 7 mismatch | `.run/backlog_drafts/func_80182230.c` | +| 308 | func_80185F24 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80185F24.c` | +| 309 | func_80189858 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80189858.c` | +| 310 | func_8017FFF0 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8017FFF0.c` | +| 311 | func_8017E908 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8017E908.c` | +| 312 | func_8017CF9C | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8017CF9C.c` | +| 313 | func_801832B0 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_801832B0.c` | +| 314 | func_801813B8 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_801813B8.c` | +| 315 | func_80184734 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80184734.c` | +| 316 | func_801825C8 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_801825C8.c` | +| 317 | func_80183430 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80183430.c` | +| 318 | func_80186120 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80186120.c` | +| 319 | func_80188508 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80188508.c` | +| 320 | func_8018D330 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8018D330.c` | +| 321 | func_80186A70 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80186A70.c` | +| 322 | func_8017F474 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8017F474.c` | +| 323 | func_8017E804 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8017E804.c` | +| 324 | func_80182D50 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80182D50.c` | +| 325 | func_801843B8 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_801843B8.c` | +| 326 | func_80181C84 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80181C84.c` | +| 327 | func_801842D4 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_801842D4.c` | +| 328 | func_80185EB4 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80185EB4.c` | +| 329 | func_80188690 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80188690.c` | +| 330 | func_80185F20 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_80185F20.c` | +| 331 | func_8018F658 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8018F658.c` | +| 332 | func_8017F228 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_8017F228.c` | +| 333 | func_801801F4 | None | | None | near | 8 | residual: 8 mismatch | `.run/backlog_drafts/func_801801F4.c` | +| 334 | func_8017F358 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017F358.c` | +| 335 | func_80180E9C | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80180E9C.c` | +| 336 | func_8017BEBC | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017BEBC.c` | +| 337 | func_80180854 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80180854.c` | +| 338 | func_80180E54 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80180E54.c` | +| 339 | func_8017F7F4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017F7F4.c` | +| 340 | func_8017EF28 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017EF28.c` | +| 341 | func_801816E4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801816E4.c` | +| 342 | func_8017D400 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017D400.c` | +| 343 | func_8017D6E8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017D6E8.c` | +| 344 | func_8017E4F8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017E4F8.c` | +| 345 | func_801829F4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801829F4.c` | +| 346 | func_801822A8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801822A8.c` | +| 347 | func_8017E954 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017E954.c` | +| 348 | func_80181F84 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80181F84.c` | +| 349 | func_801827FC | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801827FC.c` | +| 350 | func_8017FE88 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017FE88.c` | +| 351 | func_80180EC0 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80180EC0.c` | +| 352 | func_80181C4C | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80181C4C.c` | +| 353 | func_801817A4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801817A4.c` | +| 354 | func_8017E52C | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017E52C.c` | +| 355 | func_801805B0 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801805B0.c` | +| 356 | func_8018897C | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8018897C.c` | +| 357 | func_8018AA88 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8018AA88.c` | +| 358 | func_8017FED4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017FED4.c` | +| 359 | func_8017CCD4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017CCD4.c` | +| 360 | func_801858C4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801858C4.c` | +| 361 | func_8018C310 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8018C310.c` | +| 362 | func_80182AD4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80182AD4.c` | +| 363 | func_8018868C | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8018868C.c` | +| 364 | func_8017F624 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017F624.c` | +| 365 | func_8017FEB4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017FEB4.c` | +| 366 | func_80182298 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80182298.c` | +| 367 | func_80187114 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80187114.c` | +| 368 | func_80184590 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80184590.c` | +| 369 | func_80181B34 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80181B34.c` | +| 370 | func_801860F8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801860F8.c` | +| 371 | func_8017FFD8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017FFD8.c` | +| 372 | func_80188BF8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80188BF8.c` | +| 373 | func_80183BD0 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80183BD0.c` | +| 374 | func_801860F4 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801860F4.c` | +| 375 | func_80183628 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80183628.c` | +| 376 | func_8018964C | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8018964C.c` | +| 377 | func_801854C8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801854C8.c` | +| 378 | func_80184664 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80184664.c` | +| 379 | func_80185528 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80185528.c` | +| 380 | func_80187454 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80187454.c` | +| 381 | func_8017F7BC | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017F7BC.c` | +| 382 | func_801830C8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801830C8.c` | +| 383 | func_8017D4F0 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_8017D4F0.c` | +| 384 | func_801825E8 | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_801825E8.c` | +| 385 | func_80183C1C | None | | None | near | 9 | residual: 9 mismatch | `.run/backlog_drafts/func_80183C1C.c` | +| 386 | func_80185A00 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80185A00.c` | +| 387 | func_8017FCC0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017FCC0.c` | +| 388 | func_801833C8 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801833C8.c` | +| 389 | func_8017FFD0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017FFD0.c` | +| 390 | func_80180E34 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80180E34.c` | +| 391 | func_801844C4 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801844C4.c` | +| 392 | func_8018AB24 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018AB24.c` | +| 393 | func_80188C84 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80188C84.c` | +| 394 | func_8017E184 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017E184.c` | +| 395 | func_80181434 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80181434.c` | +| 396 | func_80181A70 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80181A70.c` | +| 397 | func_8017DF88 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017DF88.c` | +| 398 | func_801841D0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801841D0.c` | +| 399 | func_80184204 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80184204.c` | +| 400 | func_8018534C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018534C.c` | +| 401 | func_80184940 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80184940.c` | +| 402 | func_80180B60 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80180B60.c` | +| 403 | func_8017FB0C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017FB0C.c` | +| 404 | func_8017E72C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017E72C.c` | +| 405 | func_80189C4C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80189C4C.c` | +| 406 | func_8017E670 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017E670.c` | +| 407 | func_80180014 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80180014.c` | +| 408 | func_80180B90 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80180B90.c` | +| 409 | func_801848E8 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801848E8.c` | +| 410 | func_8017E094 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017E094.c` | +| 411 | func_8018082C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018082C.c` | +| 412 | func_8018373C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018373C.c` | +| 413 | func_8017DF48 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017DF48.c` | +| 414 | func_80182724 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80182724.c` | +| 415 | func_80182EC0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80182EC0.c` | +| 416 | func_80188E8C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80188E8C.c` | +| 417 | func_801806E0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801806E0.c` | +| 418 | func_8018A5A4 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018A5A4.c` | +| 419 | func_80181AC0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80181AC0.c` | +| 420 | func_801841A0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801841A0.c` | +| 421 | func_80183744 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80183744.c` | +| 422 | func_8018924C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018924C.c` | +| 423 | func_80185778 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80185778.c` | +| 424 | func_801870B4 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801870B4.c` | +| 425 | func_80185E3C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80185E3C.c` | +| 426 | func_8017F5E8 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017F5E8.c` | +| 427 | func_801823D4 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801823D4.c` | +| 428 | func_80186EE4 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80186EE4.c` | +| 429 | func_80180AF4 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80180AF4.c` | +| 430 | func_801831FC | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801831FC.c` | +| 431 | func_801862D4 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801862D4.c` | +| 432 | func_80184578 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80184578.c` | +| 433 | func_8017F804 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017F804.c` | +| 434 | func_80183888 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80183888.c` | +| 435 | func_80187224 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80187224.c` | +| 436 | func_801850F8 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801850F8.c` | +| 437 | func_80183F7C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80183F7C.c` | +| 438 | func_801800DC | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801800DC.c` | +| 439 | func_80182190 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80182190.c` | +| 440 | func_80182380 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80182380.c` | +| 441 | func_8018EDB8 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018EDB8.c` | +| 442 | func_80190298 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80190298.c` | +| 443 | func_8018311C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018311C.c` | +| 444 | func_8018A594 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018A594.c` | +| 445 | func_8017DED0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017DED0.c` | +| 446 | func_8018228C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018228C.c` | +| 447 | func_801889E0 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_801889E0.c` | +| 448 | func_8017DEEC | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017DEEC.c` | +| 449 | func_8017F300 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8017F300.c` | +| 450 | func_80184794 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80184794.c` | +| 451 | func_80185648 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80185648.c` | +| 452 | func_80186D64 | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_80186D64.c` | +| 453 | func_8018151C | None | | None | near | 10 | residual: 10 mismatch | `.run/backlog_drafts/func_8018151C.c` | +| 454 | func_8017F7E8 | 1 | WAVE | 177 | near | 11 | WAVE: 11 mismatch | `.run/backlog_drafts/func_8017F7E8.c` | +| 455 | func_801824D0 | 1 | WAVE | 181 | near | 11 | WAVE: 11 mismatch | `.run/backlog_drafts/func_801824D0.c` | +| 456 | func_80182F4C | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80182F4C.c` | +| 457 | func_801835C8 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_801835C8.c` | +| 458 | func_8017D6C4 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017D6C4.c` | +| 459 | func_80181960 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80181960.c` | +| 460 | func_8017D7C8 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017D7C8.c` | +| 461 | func_8017F67C | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017F67C.c` | +| 462 | func_80181724 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80181724.c` | +| 463 | func_8017F128 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017F128.c` | +| 464 | func_80180154 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80180154.c` | +| 465 | func_80180240 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80180240.c` | +| 466 | func_80185274 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80185274.c` | +| 467 | func_801833D4 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_801833D4.c` | +| 468 | func_80180EA8 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80180EA8.c` | +| 469 | func_8018F91C | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8018F91C.c` | +| 470 | func_801835F4 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_801835F4.c` | +| 471 | func_801848B4 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_801848B4.c` | +| 472 | func_8017E5D4 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017E5D4.c` | +| 473 | func_80182118 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80182118.c` | +| 474 | func_8017E2C0 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017E2C0.c` | +| 475 | func_80181744 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80181744.c` | +| 476 | func_8017EECC | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017EECC.c` | +| 477 | func_80182F78 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_80182F78.c` | +| 478 | func_8017F154 | None | | None | near | 11 | residual: 11 mismatch | `.run/backlog_drafts/func_8017F154.c` | +| 479 | func_8018150C | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8018150C.c` | +| 480 | func_801803A4 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_801803A4.c` | +| 481 | func_8017D7F8 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017D7F8.c` | +| 482 | func_8017FFFC | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017FFFC.c` | +| 483 | func_8018766C | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8018766C.c` | +| 484 | func_8017DFF8 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017DFF8.c` | +| 485 | func_8017D08C | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017D08C.c` | +| 486 | func_8017DBD8 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017DBD8.c` | +| 487 | func_8017F574 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017F574.c` | +| 488 | func_80183AC8 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80183AC8.c` | +| 489 | func_80181C08 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80181C08.c` | +| 490 | func_801822C8 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_801822C8.c` | +| 491 | func_80181388 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80181388.c` | +| 492 | func_80185C2C | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80185C2C.c` | +| 493 | func_80183BEC | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80183BEC.c` | +| 494 | func_80184DB4 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80184DB4.c` | +| 495 | func_8018AE08 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8018AE08.c` | +| 496 | func_80184698 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80184698.c` | +| 497 | func_80184718 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80184718.c` | +| 498 | func_8018134C | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8018134C.c` | +| 499 | func_8017F4BC | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017F4BC.c` | +| 500 | func_80181070 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80181070.c` | +| 501 | func_801810A4 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_801810A4.c` | +| 502 | func_801810D8 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_801810D8.c` | +| 503 | func_801819CC | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_801819CC.c` | +| 504 | func_80180554 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80180554.c` | +| 505 | func_80181E5C | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80181E5C.c` | +| 506 | func_80189DDC | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80189DDC.c` | +| 507 | func_8018ABE0 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8018ABE0.c` | +| 508 | func_80189A60 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80189A60.c` | +| 509 | func_8018278C | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8018278C.c` | +| 510 | func_801827C0 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_801827C0.c` | +| 511 | func_80186A58 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_80186A58.c` | +| 512 | func_8017F2BC | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017F2BC.c` | +| 513 | func_8017F184 | None | | None | near | 12 | residual: 12 mismatch | `.run/backlog_drafts/func_8017F184.c` | +| 514 | func_80185F58 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80185F58.c` | +| 515 | func_8018A3C8 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8018A3C8.c` | +| 516 | func_8017EA20 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017EA20.c` | +| 517 | func_80180528 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80180528.c` | +| 518 | func_80180BCC | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80180BCC.c` | +| 519 | func_801818EC | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_801818EC.c` | +| 520 | func_8017DA3C | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017DA3C.c` | +| 521 | func_8017EDA8 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017EDA8.c` | +| 522 | func_801816CC | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_801816CC.c` | +| 523 | func_8017D914 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017D914.c` | +| 524 | func_801828A8 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_801828A8.c` | +| 525 | func_8017FD58 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017FD58.c` | +| 526 | func_8017F830 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017F830.c` | +| 527 | func_8018276C | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8018276C.c` | +| 528 | func_80183AF8 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80183AF8.c` | +| 529 | func_801858D0 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_801858D0.c` | +| 530 | func_80180C34 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80180C34.c` | +| 531 | func_8018BDA4 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8018BDA4.c` | +| 532 | func_8017C8E4 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017C8E4.c` | +| 533 | func_80186D30 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80186D30.c` | +| 534 | func_8017F0D8 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017F0D8.c` | +| 535 | func_8017E358 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017E358.c` | +| 536 | func_80180420 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_80180420.c` | +| 537 | func_8017E35C | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017E35C.c` | +| 538 | func_801834E4 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_801834E4.c` | +| 539 | func_801811B4 | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_801811B4.c` | +| 540 | func_8017CDBC | None | | None | near | 13 | residual: 13 mismatch | `.run/backlog_drafts/func_8017CDBC.c` | +| 541 | func_80180D10 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80180D10.c` | +| 542 | func_8018316C | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8018316C.c` | +| 543 | func_8017E808 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017E808.c` | +| 544 | func_8017EDC4 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017EDC4.c` | +| 545 | func_80180654 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80180654.c` | +| 546 | func_8017C6F4 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017C6F4.c` | +| 547 | func_8017E4F0 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017E4F0.c` | +| 548 | func_8018B2DC | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8018B2DC.c` | +| 549 | func_80183398 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80183398.c` | +| 550 | func_80181468 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80181468.c` | +| 551 | func_80184384 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80184384.c` | +| 552 | func_8018A934 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8018A934.c` | +| 553 | func_8018B50C | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8018B50C.c` | +| 554 | func_80182844 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80182844.c` | +| 555 | func_80181B90 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80181B90.c` | +| 556 | func_80185F98 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80185F98.c` | +| 557 | func_80185EEC | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80185EEC.c` | +| 558 | func_80186DE8 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80186DE8.c` | +| 559 | func_801838EC | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_801838EC.c` | +| 560 | func_80182348 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80182348.c` | +| 561 | func_80185CD4 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80185CD4.c` | +| 562 | func_801892C0 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_801892C0.c` | +| 563 | func_801859E4 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_801859E4.c` | +| 564 | func_80184B70 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80184B70.c` | +| 565 | func_801871C4 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_801871C4.c` | +| 566 | func_80189504 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80189504.c` | +| 567 | func_8017C918 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017C918.c` | +| 568 | func_801813F0 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_801813F0.c` | +| 569 | func_80181F6C | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80181F6C.c` | +| 570 | func_8017EA04 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017EA04.c` | +| 571 | func_8017EF68 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017EF68.c` | +| 572 | func_8017EBA8 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017EBA8.c` | +| 573 | func_80185404 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80185404.c` | +| 574 | func_8017D7C4 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017D7C4.c` | +| 575 | func_8017D974 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_8017D974.c` | +| 576 | func_80180950 | None | | None | near | 14 | residual: 14 mismatch | `.run/backlog_drafts/func_80180950.c` | +| 577 | func_80181784 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80181784.c` | +| 578 | func_8017FFE8 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017FFE8.c` | +| 579 | func_801820F0 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_801820F0.c` | +| 580 | func_8018B0EC | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8018B0EC.c` | +| 581 | func_801803F4 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_801803F4.c` | +| 582 | func_8017E818 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E818.c` | +| 583 | func_80181B0C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80181B0C.c` | +| 584 | func_80184010 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80184010.c` | +| 585 | func_8018648C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8018648C.c` | +| 586 | func_8017F138 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017F138.c` | +| 587 | func_8017D9B8 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D9B8.c` | +| 588 | func_80180DB0 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80180DB0.c` | +| 589 | func_8017E290 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E290.c` | +| 590 | func_8017EDC8 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017EDC8.c` | +| 591 | func_80181A94 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80181A94.c` | +| 592 | func_8017E318 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E318.c` | +| 593 | func_80181B44 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80181B44.c` | +| 594 | func_8017D1B4 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D1B4.c` | +| 595 | func_8017E778 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E778.c` | +| 596 | func_80180D5C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80180D5C.c` | +| 597 | func_8017CDB8 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017CDB8.c` | +| 598 | func_8017CE20 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017CE20.c` | +| 599 | func_8017CE40 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017CE40.c` | +| 600 | func_8017D220 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D220.c` | +| 601 | func_80183718 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80183718.c` | +| 602 | func_8017EB1C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017EB1C.c` | +| 603 | func_80181028 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80181028.c` | +| 604 | func_8017DACC | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017DACC.c` | +| 605 | func_8018533C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8018533C.c` | +| 606 | func_8017D104 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D104.c` | +| 607 | func_8017F268 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017F268.c` | +| 608 | func_8017F120 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017F120.c` | +| 609 | func_80185A68 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80185A68.c` | +| 610 | func_8017CE48 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017CE48.c` | +| 611 | func_8017CEB0 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017CEB0.c` | +| 612 | func_801801C4 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_801801C4.c` | +| 613 | func_8017CEEC | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017CEEC.c` | +| 614 | func_8017DDD8 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017DDD8.c` | +| 615 | func_8017DD9C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017DD9C.c` | +| 616 | func_8017DF80 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017DF80.c` | +| 617 | func_8017D49C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D49C.c` | +| 618 | func_8017F5E0 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017F5E0.c` | +| 619 | func_8017DFCC | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017DFCC.c` | +| 620 | func_80181C1C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_80181C1C.c` | +| 621 | func_8017D22C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D22C.c` | +| 622 | func_8018338C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8018338C.c` | +| 623 | func_8017EEB8 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017EEB8.c` | +| 624 | func_8017E9F4 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E9F4.c` | +| 625 | func_8017E6CC | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E6CC.c` | +| 626 | func_8017F3A8 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017F3A8.c` | +| 627 | func_8017D040 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D040.c` | +| 628 | func_8017E7AC | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E7AC.c` | +| 629 | func_8017E304 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E304.c` | +| 630 | func_8017D084 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D084.c` | +| 631 | func_8017D19C | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017D19C.c` | +| 632 | func_8017E700 | None | | None | near | 15 | residual: 15 mismatch | `.run/backlog_drafts/func_8017E700.c` | +| 633 | func_8017E0F0 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017E0F0.c` | +| 634 | func_8017E7D8 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017E7D8.c` | +| 635 | func_80183988 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80183988.c` | +| 636 | func_80184154 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80184154.c` | +| 637 | func_80182D78 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80182D78.c` | +| 638 | func_80183074 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80183074.c` | +| 639 | func_80184EA4 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80184EA4.c` | +| 640 | func_8017F920 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017F920.c` | +| 641 | func_80180EDC | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80180EDC.c` | +| 642 | func_80187A8C | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80187A8C.c` | +| 643 | func_8017F1F8 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017F1F8.c` | +| 644 | func_8017EC84 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017EC84.c` | +| 645 | func_8017E9CC | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017E9CC.c` | +| 646 | func_8017EAE0 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017EAE0.c` | +| 647 | func_80186984 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80186984.c` | +| 648 | func_8017F414 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017F414.c` | +| 649 | func_8017E090 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017E090.c` | +| 650 | func_801853F8 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_801853F8.c` | +| 651 | func_8017F20C | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017F20C.c` | +| 652 | func_80182654 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_80182654.c` | +| 653 | func_8017CDE4 | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017CDE4.c` | +| 654 | func_8017DFAC | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017DFAC.c` | +| 655 | func_8017EF1C | None | | None | near | 16 | residual: 16 mismatch | `.run/backlog_drafts/func_8017EF1C.c` | +| 656 | func_8017EEF4 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8017EEF4.c` | +| 657 | func_8017E814 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8017E814.c` | +| 658 | func_80184EE0 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_80184EE0.c` | +| 659 | func_8017FA44 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8017FA44.c` | +| 660 | func_80182D1C | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_80182D1C.c` | +| 661 | func_8018384C | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8018384C.c` | +| 662 | func_8017E950 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8017E950.c` | +| 663 | func_8017CDD8 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8017CDD8.c` | +| 664 | func_80180890 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_80180890.c` | +| 665 | func_8017D5F8 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8017D5F8.c` | +| 666 | func_80180D74 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_80180D74.c` | +| 667 | func_8017F568 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_8017F568.c` | +| 668 | func_80180D14 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_80180D14.c` | +| 669 | func_80183C58 | None | | None | near | 17 | residual: 17 mismatch | `.run/backlog_drafts/func_80183C58.c` | +| 670 | func_8018208C | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8018208C.c` | +| 671 | func_8017FD6C | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017FD6C.c` | +| 672 | func_801877DC | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_801877DC.c` | +| 673 | func_8017DA10 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017DA10.c` | +| 674 | func_80189630 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_80189630.c` | +| 675 | func_80184630 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_80184630.c` | +| 676 | func_80185334 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_80185334.c` | +| 677 | func_8017E850 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017E850.c` | +| 678 | func_8017DCF4 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017DCF4.c` | +| 679 | func_8017D988 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017D988.c` | +| 680 | func_80182E38 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_80182E38.c` | +| 681 | func_80183138 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_80183138.c` | +| 682 | func_80180B54 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_80180B54.c` | +| 683 | func_8017D600 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017D600.c` | +| 684 | func_8017F6C4 | None | | None | near | 18 | residual: 18 mismatch | `.run/backlog_drafts/func_8017F6C4.c` | +| 685 | func_8017E9E4 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017E9E4.c` | +| 686 | func_801827D4 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_801827D4.c` | +| 687 | func_80185888 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80185888.c` | +| 688 | func_80180574 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80180574.c` | +| 689 | func_80183F1C | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80183F1C.c` | +| 690 | func_8017FFCC | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017FFCC.c` | +| 691 | func_80182344 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80182344.c` | +| 692 | func_801811F4 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_801811F4.c` | +| 693 | func_80180DB8 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80180DB8.c` | +| 694 | func_8017D184 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017D184.c` | +| 695 | func_8017F160 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017F160.c` | +| 696 | func_8017F4D0 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017F4D0.c` | +| 697 | func_8018033C | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8018033C.c` | +| 698 | func_80181138 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80181138.c` | +| 699 | func_8017E048 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017E048.c` | +| 700 | func_8017F3BC | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017F3BC.c` | +| 701 | func_80180DEC | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80180DEC.c` | +| 702 | func_801845B4 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_801845B4.c` | +| 703 | func_80181C74 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80181C74.c` | +| 704 | func_80182234 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80182234.c` | +| 705 | func_8017FF30 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_8017FF30.c` | +| 706 | func_80185288 | None | | None | near | 19 | residual: 19 mismatch | `.run/backlog_drafts/func_80185288.c` | +| 707 | func_8017E890 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017E890.c` | +| 708 | func_8018555C | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8018555C.c` | +| 709 | func_801826EC | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_801826EC.c` | +| 710 | func_8017DB00 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017DB00.c` | +| 711 | func_80181054 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_80181054.c` | +| 712 | func_8017F87C | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017F87C.c` | +| 713 | func_8017D704 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017D704.c` | +| 714 | func_80180AD8 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_80180AD8.c` | +| 715 | func_8018774C | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8018774C.c` | +| 716 | func_8017DE7C | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017DE7C.c` | +| 717 | func_8017FA00 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017FA00.c` | +| 718 | func_8018B6F4 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8018B6F4.c` | +| 719 | func_8017EEC8 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017EEC8.c` | +| 720 | func_8017E134 | None | | None | near | 20 | residual: 20 mismatch | `.run/backlog_drafts/func_8017E134.c` | +| 721 | func_8017C6B8 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017C6B8.c` | +| 722 | func_801871E8 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_801871E8.c` | +| 723 | func_80188668 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_80188668.c` | +| 724 | func_8017DB44 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017DB44.c` | +| 725 | func_80187050 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_80187050.c` | +| 726 | func_8017DD18 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017DD18.c` | +| 727 | func_8018288C | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8018288C.c` | +| 728 | func_8017E1C8 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017E1C8.c` | +| 729 | func_8017D308 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017D308.c` | +| 730 | func_8017EAC8 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017EAC8.c` | +| 731 | func_8017D8B0 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017D8B0.c` | +| 732 | func_8017F080 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017F080.c` | +| 733 | func_8017CD14 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017CD14.c` | +| 734 | func_80180548 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_80180548.c` | +| 735 | func_8017DE78 | None | | None | near | 21 | residual: 21 mismatch | `.run/backlog_drafts/func_8017DE78.c` | +| 736 | func_80185A18 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_80185A18.c` | +| 737 | func_8017FF2C | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017FF2C.c` | +| 738 | func_801803E0 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_801803E0.c` | +| 739 | func_8017D828 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017D828.c` | +| 740 | func_8017DC08 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017DC08.c` | +| 741 | func_80184388 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_80184388.c` | +| 742 | func_80187C64 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_80187C64.c` | +| 743 | func_8018A030 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8018A030.c` | +| 744 | func_8017D688 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017D688.c` | +| 745 | func_8017FA90 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017FA90.c` | +| 746 | func_8017F320 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017F320.c` | +| 747 | func_801813AC | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_801813AC.c` | +| 748 | func_80181478 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_80181478.c` | +| 749 | func_801868E0 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_801868E0.c` | +| 750 | func_8018AB74 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8018AB74.c` | +| 751 | func_8017DE70 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8017DE70.c` | +| 752 | func_8018A640 | None | | None | near | 22 | residual: 22 mismatch | `.run/backlog_drafts/func_8018A640.c` | +| 753 | func_8017DC54 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8017DC54.c` | +| 754 | func_8017F480 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8017F480.c` | +| 755 | func_8017EF7C | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8017EF7C.c` | +| 756 | func_80182FF0 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_80182FF0.c` | +| 757 | func_80182EE8 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_80182EE8.c` | +| 758 | func_8017E240 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8017E240.c` | +| 759 | func_8017CE94 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8017CE94.c` | +| 760 | func_8017D2A4 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8017D2A4.c` | +| 761 | func_8017FAC8 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8017FAC8.c` | +| 762 | func_80181E1C | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_80181E1C.c` | +| 763 | func_80181F60 | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_80181F60.c` | +| 764 | func_8018381C | None | | None | near | 23 | residual: 23 mismatch | `.run/backlog_drafts/func_8018381C.c` | +| 765 | func_80182488 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_80182488.c` | +| 766 | func_8017F500 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017F500.c` | +| 767 | func_8017D1E0 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017D1E0.c` | +| 768 | func_8017DDBC | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017DDBC.c` | +| 769 | func_8017F1BC | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017F1BC.c` | +| 770 | func_8017D384 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017D384.c` | +| 771 | func_8017EFB0 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017EFB0.c` | +| 772 | func_80182708 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_80182708.c` | +| 773 | func_8017F8A8 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017F8A8.c` | +| 774 | func_8017EBEC | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017EBEC.c` | +| 775 | func_80184DE8 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_80184DE8.c` | +| 776 | func_801834B4 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_801834B4.c` | +| 777 | func_8018333C | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8018333C.c` | +| 778 | func_8018056C | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8018056C.c` | +| 779 | func_80182C68 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_80182C68.c` | +| 780 | func_8017EA18 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_8017EA18.c` | +| 781 | func_80180EB8 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_80180EB8.c` | +| 782 | func_801856F0 | None | | None | near | 24 | residual: 24 mismatch | `.run/backlog_drafts/func_801856F0.c` | +| 783 | func_8018DFDC | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_8018DFDC.c` | +| 784 | func_801827A8 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_801827A8.c` | +| 785 | func_8017CFC4 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_8017CFC4.c` | +| 786 | func_8017D7A4 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_8017D7A4.c` | +| 787 | func_80182514 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_80182514.c` | +| 788 | func_8018545C | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_8018545C.c` | +| 789 | func_80189FCC | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_80189FCC.c` | +| 790 | func_80181134 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_80181134.c` | +| 791 | func_8017FE10 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_8017FE10.c` | +| 792 | func_80185AF8 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_80185AF8.c` | +| 793 | func_80182E34 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_80182E34.c` | +| 794 | func_8017D864 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_8017D864.c` | +| 795 | func_8017DB70 | None | | None | near | 25 | residual: 25 mismatch | `.run/backlog_drafts/func_8017DB70.c` | +| 796 | func_8017FB68 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_8017FB68.c` | +| 797 | func_8018ACB4 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_8018ACB4.c` | +| 798 | func_8017EBF4 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_8017EBF4.c` | +| 799 | func_80180A5C | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_80180A5C.c` | +| 800 | func_801830EC | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_801830EC.c` | +| 801 | func_801804F4 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_801804F4.c` | +| 802 | func_8017E6C0 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_8017E6C0.c` | +| 803 | func_8017DD64 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_8017DD64.c` | +| 804 | func_8017F024 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_8017F024.c` | +| 805 | func_80181254 | None | | None | near | 26 | residual: 26 mismatch | `.run/backlog_drafts/func_80181254.c` | +| 806 | func_80181020 | None | | None | near | 27 | residual: 27 mismatch | `.run/backlog_drafts/func_80181020.c` | +| 807 | func_80184A1C | None | | None | near | 27 | residual: 27 mismatch | `.run/backlog_drafts/func_80184A1C.c` | +| 808 | func_80184430 | None | | None | near | 27 | residual: 27 mismatch | `.run/backlog_drafts/func_80184430.c` | +| 809 | func_80185934 | None | | None | near | 27 | residual: 27 mismatch | `.run/backlog_drafts/func_80185934.c` | +| 810 | func_801841B0 | None | | None | near | 27 | residual: 27 mismatch | `.run/backlog_drafts/func_801841B0.c` | +| 811 | func_80180D28 | None | | None | near | 27 | residual: 27 mismatch | `.run/backlog_drafts/func_80180D28.c` | +| 812 | func_8017E1F4 | None | | None | near | 27 | residual: 27 mismatch | `.run/backlog_drafts/func_8017E1F4.c` | +| 813 | func_80182C24 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80182C24.c` | +| 814 | func_8017DAD0 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_8017DAD0.c` | +| 815 | func_8017EE08 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_8017EE08.c` | +| 816 | func_80183C4C | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80183C4C.c` | +| 817 | func_80181300 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80181300.c` | +| 818 | func_8017E218 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_8017E218.c` | +| 819 | func_8017F8AC | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_8017F8AC.c` | +| 820 | func_80180E98 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80180E98.c` | +| 821 | func_8017D21C | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_8017D21C.c` | +| 822 | func_80188650 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80188650.c` | +| 823 | func_801810C0 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_801810C0.c` | +| 824 | func_8017D004 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_8017D004.c` | +| 825 | func_80183A18 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80183A18.c` | +| 826 | func_80182324 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80182324.c` | +| 827 | func_80183A24 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_80183A24.c` | +| 828 | func_8017D404 | None | | None | near | 28 | residual: 28 mismatch | `.run/backlog_drafts/func_8017D404.c` | +| 829 | func_80182544 | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_80182544.c` | +| 830 | func_80180CA0 | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_80180CA0.c` | +| 831 | func_8017ED0C | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_8017ED0C.c` | +| 832 | func_8017FB4C | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_8017FB4C.c` | +| 833 | func_801840C0 | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_801840C0.c` | +| 834 | func_8017F344 | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_8017F344.c` | +| 835 | func_80180214 | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_80180214.c` | +| 836 | func_801803DC | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_801803DC.c` | +| 837 | func_80181304 | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_80181304.c` | +| 838 | func_8018B9DC | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_8018B9DC.c` | +| 839 | func_80180840 | None | | None | near | 29 | residual: 29 mismatch | `.run/backlog_drafts/func_80180840.c` | +| 840 | func_80182E08 | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_80182E08.c` | +| 841 | func_8018AF0C | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_8018AF0C.c` | +| 842 | func_8017F750 | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_8017F750.c` | +| 843 | func_8018133C | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_8018133C.c` | +| 844 | func_80183C10 | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_80183C10.c` | +| 845 | func_80180B2C | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_80180B2C.c` | +| 846 | func_8017D894 | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_8017D894.c` | +| 847 | func_8017D1DC | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_8017D1DC.c` | +| 848 | func_8017D9A8 | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_8017D9A8.c` | +| 849 | func_801845E8 | None | | None | near | 30 | residual: 30 mismatch | `.run/backlog_drafts/func_801845E8.c` | +| 850 | func_8017CE0C | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_8017CE0C.c` | +| 851 | func_80182268 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_80182268.c` | +| 852 | func_8018337C | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_8018337C.c` | +| 853 | func_801800F4 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_801800F4.c` | +| 854 | func_80181990 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_80181990.c` | +| 855 | func_8017D8C8 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_8017D8C8.c` | +| 856 | func_80184AA8 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_80184AA8.c` | +| 857 | func_8017E9EC | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_8017E9EC.c` | +| 858 | func_80182D18 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_80182D18.c` | +| 859 | func_8017D524 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_8017D524.c` | +| 860 | func_8017D784 | None | | None | near | 31 | residual: 31 mismatch | `.run/backlog_drafts/func_8017D784.c` | +| 861 | func_801856E4 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_801856E4.c` | +| 862 | func_8017D1D0 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017D1D0.c` | +| 863 | func_8017EEFC | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017EEFC.c` | +| 864 | func_8017FC50 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017FC50.c` | +| 865 | func_8017D554 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017D554.c` | +| 866 | func_80183018 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_80183018.c` | +| 867 | func_8017F370 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017F370.c` | +| 868 | func_8018739C | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8018739C.c` | +| 869 | func_8017DBC0 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017DBC0.c` | +| 870 | func_80182000 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_80182000.c` | +| 871 | func_8017E55C | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017E55C.c` | +| 872 | func_80182600 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_80182600.c` | +| 873 | func_8017FCE8 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017FCE8.c` | +| 874 | func_8017FEC8 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017FEC8.c` | +| 875 | func_8017D874 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017D874.c` | +| 876 | func_8017FACC | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017FACC.c` | +| 877 | func_8017F7F8 | None | | None | near | 32 | residual: 32 mismatch | `.run/backlog_drafts/func_8017F7F8.c` | +| 878 | func_8017FB78 | None | | None | near | 33 | residual: 33 mismatch | `.run/backlog_drafts/func_8017FB78.c` | +| 879 | func_80181A40 | None | | None | near | 33 | residual: 33 mismatch | `.run/backlog_drafts/func_80181A40.c` | +| 880 | func_801800D4 | None | | None | near | 33 | residual: 33 mismatch | `.run/backlog_drafts/func_801800D4.c` | +| 881 | func_80182E1C | None | | None | near | 33 | residual: 33 mismatch | `.run/backlog_drafts/func_80182E1C.c` | +| 882 | func_80181F4C | None | | None | near | 33 | residual: 33 mismatch | `.run/backlog_drafts/func_80181F4C.c` | +| 883 | func_8017EEB0 | None | | None | near | 33 | residual: 33 mismatch | `.run/backlog_drafts/func_8017EEB0.c` | +| 884 | func_8017BF14 | None | | None | near | 34 | residual: 34 mismatch | `.run/backlog_drafts/func_8017BF14.c` | +| 885 | func_801859A0 | None | | None | near | 34 | residual: 34 mismatch | `.run/backlog_drafts/func_801859A0.c` | +| 886 | func_8017F8E0 | None | | None | near | 34 | residual: 34 mismatch | `.run/backlog_drafts/func_8017F8E0.c` | +| 887 | func_8017E740 | None | | None | near | 34 | residual: 34 mismatch | `.run/backlog_drafts/func_8017E740.c` | +| 888 | func_8017D804 | None | | None | near | 35 | residual: 35 mismatch | `.run/backlog_drafts/func_8017D804.c` | +| 889 | func_8017DA0C | None | | None | near | 35 | residual: 35 mismatch | `.run/backlog_drafts/func_8017DA0C.c` | +| 890 | func_80180030 | None | | None | near | 35 | residual: 35 mismatch | `.run/backlog_drafts/func_80180030.c` | +| 891 | func_8017E038 | None | | None | near | 35 | residual: 35 mismatch | `.run/backlog_drafts/func_8017E038.c` | +| 892 | func_8017E32C | None | | None | near | 35 | residual: 35 mismatch | `.run/backlog_drafts/func_8017E32C.c` | +| 893 | func_80181090 | None | | None | near | 36 | residual: 36 mismatch | `.run/backlog_drafts/func_80181090.c` | +| 894 | func_8017EC78 | None | | None | near | 36 | residual: 36 mismatch | `.run/backlog_drafts/func_8017EC78.c` | +| 895 | func_8017E79C | None | | None | near | 36 | residual: 36 mismatch | `.run/backlog_drafts/func_8017E79C.c` | +| 896 | func_80182A08 | None | | None | near | 36 | residual: 36 mismatch | `.run/backlog_drafts/func_80182A08.c` | +| 897 | func_8017F0E8 | None | | None | near | 36 | residual: 36 mismatch | `.run/backlog_drafts/func_8017F0E8.c` | +| 898 | func_8017D294 | None | | None | near | 36 | residual: 36 mismatch | `.run/backlog_drafts/func_8017D294.c` | +| 899 | func_80189B38 | None | | None | near | 36 | residual: 36 mismatch | `.run/backlog_drafts/func_80189B38.c` | +| 900 | func_80180F08 | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_80180F08.c` | +| 901 | func_8017D024 | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_8017D024.c` | +| 902 | func_8017EB5C | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_8017EB5C.c` | +| 903 | func_8017EB4C | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_8017EB4C.c` | +| 904 | func_8017EAD8 | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_8017EAD8.c` | +| 905 | func_8017D29C | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_8017D29C.c` | +| 906 | func_8017D450 | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_8017D450.c` | +| 907 | func_8017E230 | None | | None | near | 37 | residual: 37 mismatch | `.run/backlog_drafts/func_8017E230.c` | +| 908 | func_8017DA00 | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_8017DA00.c` | +| 909 | func_8017E6FC | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_8017E6FC.c` | +| 910 | func_8017FE08 | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_8017FE08.c` | +| 911 | func_8017D80C | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_8017D80C.c` | +| 912 | func_8018263C | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_8018263C.c` | +| 913 | func_80186FA8 | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_80186FA8.c` | +| 914 | func_80180A38 | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_80180A38.c` | +| 915 | func_8017D740 | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_8017D740.c` | +| 916 | func_8017DD44 | None | | None | near | 38 | residual: 38 mismatch | `.run/backlog_drafts/func_8017DD44.c` | +| 917 | func_8017E840 | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017E840.c` | +| 918 | func_8017D1F0 | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017D1F0.c` | +| 919 | func_8017E014 | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017E014.c` | +| 920 | func_8017D09C | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017D09C.c` | +| 921 | func_8017EC70 | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017EC70.c` | +| 922 | func_80180C2C | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_80180C2C.c` | +| 923 | func_8017ECC0 | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017ECC0.c` | +| 924 | func_8017F724 | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017F724.c` | +| 925 | func_8017E36C | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8017E36C.c` | +| 926 | func_8018ACD4 | None | | None | near | 39 | residual: 39 mismatch | `.run/backlog_drafts/func_8018ACD4.c` | +| 927 | func_8017ED80 | None | | None | near | 40 | residual: 40 mismatch | `.run/backlog_drafts/func_8017ED80.c` | +| 928 | func_80180850 | None | | None | near | 40 | residual: 40 mismatch | `.run/backlog_drafts/func_80180850.c` | +| 929 | func_80181438 | None | | None | near | 40 | residual: 40 mismatch | `.run/backlog_drafts/func_80181438.c` | +| 930 | func_8017D0BC | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_8017D0BC.c` | +| 931 | func_8017E94C | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_8017E94C.c` | +| 932 | func_8017E170 | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_8017E170.c` | +| 933 | func_8018043C | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_8018043C.c` | +| 934 | func_8018A3F0 | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_8018A3F0.c` | +| 935 | func_80183364 | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_80183364.c` | +| 936 | func_801824F0 | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_801824F0.c` | +| 937 | func_8017F4A0 | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_8017F4A0.c` | +| 938 | func_801877E4 | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_801877E4.c` | +| 939 | func_80183F4C | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_80183F4C.c` | +| 940 | func_80186044 | None | | None | near | 41 | residual: 41 mismatch | `.run/backlog_drafts/func_80186044.c` | +| 941 | func_80180010 | None | | None | near | 42 | residual: 42 mismatch | `.run/backlog_drafts/func_80180010.c` | +| 942 | func_8017E824 | None | | None | near | 42 | residual: 42 mismatch | `.run/backlog_drafts/func_8017E824.c` | +| 943 | func_80183598 | None | | None | near | 42 | residual: 42 mismatch | `.run/backlog_drafts/func_80183598.c` | +| 944 | func_8017ECF4 | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_8017ECF4.c` | +| 945 | func_8018118C | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_8018118C.c` | +| 946 | func_8018FB8C | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_8018FB8C.c` | +| 947 | func_8017D6D0 | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_8017D6D0.c` | +| 948 | func_8017D96C | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_8017D96C.c` | +| 949 | func_8017DF44 | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_8017DF44.c` | +| 950 | func_801812FC | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_801812FC.c` | +| 951 | func_80186B08 | None | | None | near | 43 | residual: 43 mismatch | `.run/backlog_drafts/func_80186B08.c` | +| 952 | func_8017E578 | None | | None | near | 44 | residual: 44 mismatch | `.run/backlog_drafts/func_8017E578.c` | +| 953 | func_8017D6FC | None | | None | near | 44 | residual: 44 mismatch | `.run/backlog_drafts/func_8017D6FC.c` | +| 954 | func_8017E7D0 | None | | None | near | 45 | residual: 45 mismatch | `.run/backlog_drafts/func_8017E7D0.c` | +| 955 | func_8017D01C | None | | None | near | 45 | residual: 45 mismatch | `.run/backlog_drafts/func_8017D01C.c` | +| 956 | func_8017E380 | None | | None | near | 45 | residual: 45 mismatch | `.run/backlog_drafts/func_8017E380.c` | +| 957 | func_80180A88 | None | | None | near | 45 | residual: 45 mismatch | `.run/backlog_drafts/func_80180A88.c` | +| 958 | func_8017E9D8 | None | | None | near | 45 | residual: 45 mismatch | `.run/backlog_drafts/func_8017E9D8.c` | +| 959 | func_80189DB4 | None | | None | near | 45 | residual: 45 mismatch | `.run/backlog_drafts/func_80189DB4.c` | +| 960 | func_8018001C | None | | None | near | 46 | residual: 46 mismatch | `.run/backlog_drafts/func_8018001C.c` | +| 961 | func_8017F2A0 | None | | None | near | 46 | residual: 46 mismatch | `.run/backlog_drafts/func_8017F2A0.c` | +| 962 | func_80185EA8 | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_80185EA8.c` | +| 963 | func_8018912C | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_8018912C.c` | +| 964 | func_80188BEC | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_80188BEC.c` | +| 965 | func_801804DC | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_801804DC.c` | +| 966 | func_801808D8 | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_801808D8.c` | +| 967 | func_8017E8D0 | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_8017E8D0.c` | +| 968 | func_801846AC | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_801846AC.c` | +| 969 | func_801805DC | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_801805DC.c` | +| 970 | func_80184D0C | None | | None | near | 47 | residual: 47 mismatch | `.run/backlog_drafts/func_80184D0C.c` | +| 971 | func_8017F84C | None | | None | near | 48 | residual: 48 mismatch | `.run/backlog_drafts/func_8017F84C.c` | +| 972 | func_8017EF54 | None | | None | near | 48 | residual: 48 mismatch | `.run/backlog_drafts/func_8017EF54.c` | +| 973 | func_80181CE0 | None | | None | near | 48 | residual: 48 mismatch | `.run/backlog_drafts/func_80181CE0.c` | +| 974 | func_8017FCF0 | None | | None | near | 48 | residual: 48 mismatch | `.run/backlog_drafts/func_8017FCF0.c` | +| 975 | func_8017D6F0 | None | | None | near | 49 | residual: 49 mismatch | `.run/backlog_drafts/func_8017D6F0.c` | +| 976 | func_8017DF40 | None | | None | near | 49 | residual: 49 mismatch | `.run/backlog_drafts/func_8017DF40.c` | +| 977 | func_801845EC | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_801845EC.c` | +| 978 | func_8017F4C4 | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_8017F4C4.c` | +| 979 | func_80188BB0 | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_80188BB0.c` | +| 980 | func_80181B78 | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_80181B78.c` | +| 981 | func_8017DE74 | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_8017DE74.c` | +| 982 | func_80183D48 | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_80183D48.c` | +| 983 | func_80184130 | None | | None | near | 50 | residual: 50 mismatch | `.run/backlog_drafts/func_80184130.c` | +| 984 | func_80181124 | None | | None | near | 52 | residual: 52 mismatch | `.run/backlog_drafts/func_80181124.c` | +| 985 | func_8017FB48 | None | | None | near | 52 | residual: 52 mismatch | `.run/backlog_drafts/func_8017FB48.c` | +| 986 | func_80186A0C | None | | None | near | 53 | residual: 53 mismatch | `.run/backlog_drafts/func_80186A0C.c` | +| 987 | func_8017F050 | None | | None | near | 53 | residual: 53 mismatch | `.run/backlog_drafts/func_8017F050.c` | +| 988 | func_8018592C | None | | None | near | 53 | residual: 53 mismatch | `.run/backlog_drafts/func_8018592C.c` | +| 989 | func_8018CFF4 | None | | None | near | 53 | residual: 53 mismatch | `.run/backlog_drafts/func_8018CFF4.c` | +| 990 | func_8017DB6C | None | | None | near | 53 | residual: 53 mismatch | `.run/backlog_drafts/func_8017DB6C.c` | +| 991 | func_8018048C | None | | None | near | 53 | residual: 53 mismatch | `.run/backlog_drafts/func_8018048C.c` | +| 992 | func_8018465C | None | | None | near | 54 | residual: 54 mismatch | `.run/backlog_drafts/func_8018465C.c` | +| 993 | func_80183C54 | None | | None | near | 54 | residual: 54 mismatch | `.run/backlog_drafts/func_80183C54.c` | +| 994 | func_80180B7C | None | | None | near | 54 | residual: 54 mismatch | `.run/backlog_drafts/func_80180B7C.c` | +| 995 | func_8017FE54 | None | | None | near | 55 | residual: 55 mismatch | `.run/backlog_drafts/func_8017FE54.c` | +| 996 | func_8017ED60 | None | | None | near | 55 | residual: 55 mismatch | `.run/backlog_drafts/func_8017ED60.c` | +| 997 | func_801802BC | None | | None | near | 55 | residual: 55 mismatch | `.run/backlog_drafts/func_801802BC.c` | +| 998 | func_80182030 | None | | None | near | 55 | residual: 55 mismatch | `.run/backlog_drafts/func_80182030.c` | +| 999 | func_80180204 | None | | None | near | 55 | residual: 55 mismatch | `.run/backlog_drafts/func_80180204.c` | +| 1000 | func_80181DEC | None | | None | near | 57 | residual: 57 mismatch | `.run/backlog_drafts/func_80181DEC.c` | +| 1001 | func_8017E524 | None | | None | near | 57 | residual: 57 mismatch | `.run/backlog_drafts/func_8017E524.c` | +| 1002 | func_8018A538 | None | | None | near | 57 | residual: 57 mismatch | `.run/backlog_drafts/func_8018A538.c` | +| 1003 | func_8017ECB0 | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_8017ECB0.c` | +| 1004 | func_801898C8 | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_801898C8.c` | +| 1005 | func_80184920 | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_80184920.c` | +| 1006 | func_80182EA0 | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_80182EA0.c` | +| 1007 | func_8017F1C4 | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_8017F1C4.c` | +| 1008 | func_80181A5C | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_80181A5C.c` | +| 1009 | func_8017D544 | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_8017D544.c` | +| 1010 | func_8017EA2C | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_8017EA2C.c` | +| 1011 | func_80182BF4 | None | | None | near | 58 | residual: 58 mismatch | `.run/backlog_drafts/func_80182BF4.c` | +| 1012 | func_8017F24C | None | | None | near | 59 | residual: 59 mismatch | `.run/backlog_drafts/func_8017F24C.c` | +| 1013 | func_8017D4CC | None | | None | near | 59 | residual: 59 mismatch | `.run/backlog_drafts/func_8017D4CC.c` | +| 1014 | func_80183624 | None | | None | near | 59 | residual: 59 mismatch | `.run/backlog_drafts/func_80183624.c` | +| 1015 | func_80180B50 | None | | None | near | 59 | residual: 59 mismatch | `.run/backlog_drafts/func_80180B50.c` | +| 1016 | func_8018567C | None | | None | near | 59 | residual: 59 mismatch | `.run/backlog_drafts/func_8018567C.c` | +| 1017 | func_8017E75C | None | | None | near | 61 | residual: 61 mismatch | `.run/backlog_drafts/func_8017E75C.c` | +| 1018 | func_80184778 | None | | None | near | 61 | residual: 61 mismatch | `.run/backlog_drafts/func_80184778.c` | +| 1019 | func_8017EEE0 | None | | None | near | 62 | residual: 62 mismatch | `.run/backlog_drafts/func_8017EEE0.c` | +| 1020 | func_80188204 | None | | None | near | 62 | residual: 62 mismatch | `.run/backlog_drafts/func_80188204.c` | +| 1021 | func_8017F25C | None | | None | near | 62 | residual: 62 mismatch | `.run/backlog_drafts/func_8017F25C.c` | +| 1022 | func_8017EB74 | None | | None | near | 63 | residual: 63 mismatch | `.run/backlog_drafts/func_8017EB74.c` | +| 1023 | func_8017E798 | None | | None | near | 64 | residual: 64 mismatch | `.run/backlog_drafts/func_8017E798.c` | +| 1024 | func_8017D610 | None | | None | near | 64 | residual: 64 mismatch | `.run/backlog_drafts/func_8017D610.c` | +| 1025 | func_8017CD10 | None | | None | near | 64 | residual: 64 mismatch | `.run/backlog_drafts/func_8017CD10.c` | +| 1026 | func_8017F1A0 | None | | None | near | 64 | residual: 64 mismatch | `.run/backlog_drafts/func_8017F1A0.c` | +| 1027 | func_8017D928 | None | | None | near | 64 | residual: 64 mismatch | `.run/backlog_drafts/func_8017D928.c` | +| 1028 | func_8018656C | None | | None | near | 65 | residual: 65 mismatch | `.run/backlog_drafts/func_8018656C.c` | +| 1029 | func_80184854 | None | | None | near | 66 | residual: 66 mismatch | `.run/backlog_drafts/func_80184854.c` | +| 1030 | func_80185B5C | None | | None | near | 67 | residual: 67 mismatch | `.run/backlog_drafts/func_80185B5C.c` | +| 1031 | func_8017E910 | None | | None | near | 68 | residual: 68 mismatch | `.run/backlog_drafts/func_8017E910.c` | +| 1032 | func_80182378 | None | | None | near | 69 | residual: 69 mismatch | `.run/backlog_drafts/func_80182378.c` | +| 1033 | func_80183544 | None | | None | near | 69 | residual: 69 mismatch | `.run/backlog_drafts/func_80183544.c` | +| 1034 | func_8018434C | None | | None | near | 69 | residual: 69 mismatch | `.run/backlog_drafts/func_8018434C.c` | +| 1035 | func_80180224 | None | | None | near | 71 | residual: 71 mismatch | `.run/backlog_drafts/func_80180224.c` | +| 1036 | func_80184238 | None | | None | near | 72 | residual: 72 mismatch | `.run/backlog_drafts/func_80184238.c` | +| 1037 | func_801866B0 | None | | None | near | 72 | residual: 72 mismatch | `.run/backlog_drafts/func_801866B0.c` | +| 1038 | func_8017D9E4 | None | | None | near | 73 | residual: 73 mismatch | `.run/backlog_drafts/func_8017D9E4.c` | +| 1039 | func_80181344 | None | | None | near | 73 | residual: 73 mismatch | `.run/backlog_drafts/func_80181344.c` | +| 1040 | func_80189B3C | None | | None | near | 74 | residual: 74 mismatch | `.run/backlog_drafts/func_80189B3C.c` | +| 1041 | func_80182B90 | None | | None | near | 74 | residual: 74 mismatch | `.run/backlog_drafts/func_80182B90.c` | +| 1042 | func_8018165C | None | | None | near | 74 | residual: 74 mismatch | `.run/backlog_drafts/func_8018165C.c` | +| 1043 | func_8017F468 | None | | None | near | 74 | residual: 74 mismatch | `.run/backlog_drafts/func_8017F468.c` | +| 1044 | func_8017DAB4 | None | | None | near | 75 | residual: 75 mismatch | `.run/backlog_drafts/func_8017DAB4.c` | +| 1045 | func_80181500 | None | | None | near | 75 | residual: 75 mismatch | `.run/backlog_drafts/func_80181500.c` | +| 1046 | func_801814A8 | None | | None | near | 76 | residual: 76 mismatch | `.run/backlog_drafts/func_801814A8.c` | +| 1047 | func_8017E81C | None | | None | near | 76 | residual: 76 mismatch | `.run/backlog_drafts/func_8017E81C.c` | +| 1048 | func_8018474C | None | | None | near | 76 | residual: 76 mismatch | `.run/backlog_drafts/func_8018474C.c` | +| 1049 | func_80184DDC | None | | None | near | 77 | residual: 77 mismatch | `.run/backlog_drafts/func_80184DDC.c` | +| 1050 | func_8017E2F4 | None | | None | near | 77 | residual: 77 mismatch | `.run/backlog_drafts/func_8017E2F4.c` | +| 1051 | func_8017EDBC | None | | None | near | 78 | residual: 78 mismatch | `.run/backlog_drafts/func_8017EDBC.c` | +| 1052 | func_8017E5F0 | None | | None | near | 79 | residual: 79 mismatch | `.run/backlog_drafts/func_8017E5F0.c` | +| 1053 | func_801815AC | None | | None | near | 79 | residual: 79 mismatch | `.run/backlog_drafts/func_801815AC.c` | +| 1054 | func_8017D54C | None | | None | near | 79 | residual: 79 mismatch | `.run/backlog_drafts/func_8017D54C.c` | +| 1055 | func_80181260 | None | | None | near | 79 | residual: 79 mismatch | `.run/backlog_drafts/func_80181260.c` | +| 1056 | func_801805D0 | None | | None | near | 79 | residual: 79 mismatch | `.run/backlog_drafts/func_801805D0.c` | +| 1057 | func_8017F290 | 1 | regalloc-order | 86 | near | 81 | none — MATCH. Two levers: (1) hold &D_801270CC in a `int *state` local so its | `.run/backlog_drafts/func_8017F290.c` | +| 1058 | func_80181068 | None | | None | near | 81 | residual: 81 mismatch | `.run/backlog_drafts/func_80181068.c` | +| 1059 | func_80184E00 | None | | None | near | 82 | residual: 82 mismatch | `.run/backlog_drafts/func_80184E00.c` | +| 1060 | func_8017EB88 | None | | None | near | 82 | residual: 82 mismatch | `.run/backlog_drafts/func_8017EB88.c` | +| 1061 | func_8017FB3C | None | | None | near | 82 | residual: 82 mismatch | `.run/backlog_drafts/func_8017FB3C.c` | +| 1062 | func_8017F840 | None | | None | near | 82 | residual: 82 mismatch | `.run/backlog_drafts/func_8017F840.c` | +| 1063 | func_8017DA9C | None | | None | near | 83 | residual: 83 mismatch | `.run/backlog_drafts/func_8017DA9C.c` | +| 1064 | func_801829F0 | None | | None | near | 83 | residual: 83 mismatch | `.run/backlog_drafts/func_801829F0.c` | +| 1065 | func_8017FBA4 | None | | None | near | 83 | residual: 83 mismatch | `.run/backlog_drafts/func_8017FBA4.c` | +| 1066 | func_801848AC | None | | None | near | 84 | residual: 84 mismatch | `.run/backlog_drafts/func_801848AC.c` | +| 1067 | func_8017DC9C | None | | None | near | 84 | residual: 84 mismatch | `.run/backlog_drafts/func_8017DC9C.c` | +| 1068 | func_801840FC | None | | None | near | 85 | residual: 85 mismatch | `.run/backlog_drafts/func_801840FC.c` | +| 1069 | func_80186094 | None | | None | near | 85 | residual: 85 mismatch | `.run/backlog_drafts/func_80186094.c` | +| 1070 | func_801847FC | None | | None | near | 86 | residual: 86 mismatch | `.run/backlog_drafts/func_801847FC.c` | +| 1071 | func_8018006C | None | | None | near | 86 | residual: 86 mismatch | `.run/backlog_drafts/func_8018006C.c` | +| 1072 | func_8017DFD8 | None | | None | near | 87 | residual: 87 mismatch | `.run/backlog_drafts/func_8017DFD8.c` | +| 1073 | func_8017D1F8 | None | | None | near | 87 | residual: 87 mismatch | `.run/backlog_drafts/func_8017D1F8.c` | +| 1074 | func_8017CE68 | None | | None | near | 87 | residual: 87 mismatch | `.run/backlog_drafts/func_8017CE68.c` | +| 1075 | func_8017D7D0 | None | | None | near | 88 | residual: 88 mismatch | `.run/backlog_drafts/func_8017D7D0.c` | +| 1076 | func_80181838 | None | | None | near | 88 | residual: 88 mismatch | `.run/backlog_drafts/func_80181838.c` | +| 1077 | func_801821D4 | None | | None | near | 90 | residual: 90 mismatch | `.run/backlog_drafts/func_801821D4.c` | +| 1078 | func_8017F0A8 | None | | None | near | 90 | residual: 90 mismatch | `.run/backlog_drafts/func_8017F0A8.c` | +| 1079 | func_8018AD3C | None | | None | near | 90 | residual: 90 mismatch | `.run/backlog_drafts/func_8018AD3C.c` | +| 1080 | func_8017DD5C | None | | None | near | 90 | residual: 90 mismatch | `.run/backlog_drafts/func_8017DD5C.c` | +| 1081 | func_8017EDC0 | None | | None | near | 91 | residual: 91 mismatch | `.run/backlog_drafts/func_8017EDC0.c` | +| 1082 | func_801807DC | None | | None | near | 92 | residual: 92 mismatch | `.run/backlog_drafts/func_801807DC.c` | +| 1083 | func_80180170 | None | | None | near | 92 | residual: 92 mismatch | `.run/backlog_drafts/func_80180170.c` | +| 1084 | func_8017D98C | 1 | plumbing | 31 | near | 93 | none — MATCH (expected): straight global stores + tail call; const 0x140 reused for two halves | `.run/backlog_drafts/func_8017D98C.c` | +| 1085 | func_8017EFFC | None | | None | near | 93 | residual: 93 mismatch | `.run/backlog_drafts/func_8017EFFC.c` | +| 1086 | func_8017D940 | None | | None | near | 94 | residual: 94 mismatch | `.run/backlog_drafts/func_8017D940.c` | +| 1087 | func_8017D934 | None | | None | near | 95 | residual: 95 mismatch | `.run/backlog_drafts/func_8017D934.c` | +| 1088 | func_8017DAB8 | None | | None | near | 97 | residual: 97 mismatch | `.run/backlog_drafts/func_8017DAB8.c` | +| 1089 | func_80180040 | None | | None | near | 97 | residual: 97 mismatch | `.run/backlog_drafts/func_80180040.c` | +| 1090 | func_8017FBE0 | None | | None | near | 97 | residual: 97 mismatch | `.run/backlog_drafts/func_8017FBE0.c` | +| 1091 | func_8017F240 | 1 | regalloc-order | 20 | near | 98 | none — MATCH (base &D_801270D0 pinned to $s0 holds across call; one lui/addiu reused for load+store) | `.run/backlog_drafts/func_8017F240.c` | +| 1092 | func_801863B0 | None | | None | near | 98 | residual: 98 mismatch | `.run/backlog_drafts/func_801863B0.c` | +| 1093 | func_80182728 | None | | None | near | 98 | residual: 98 mismatch | `.run/backlog_drafts/func_80182728.c` | +| 1094 | func_8018038C | None | | None | near | 100 | residual: 100 mismatch | `.run/backlog_drafts/func_8018038C.c` | +| 1095 | func_8017D808 | None | | None | near | 102 | residual: 102 mismatch | `.run/backlog_drafts/func_8017D808.c` | +| 1096 | func_80182D10 | None | | None | near | 102 | residual: 102 mismatch | `.run/backlog_drafts/func_80182D10.c` | +| 1097 | func_8017DC40 | None | | None | near | 104 | residual: 104 mismatch | `.run/backlog_drafts/func_8017DC40.c` | +| 1098 | func_80180F34 | None | | None | near | 105 | residual: 105 mismatch | `.run/backlog_drafts/func_80180F34.c` | +| 1099 | func_80181C44 | None | | None | near | 105 | residual: 105 mismatch | `.run/backlog_drafts/func_80181C44.c` | +| 1100 | func_8017F96C | None | | None | near | 106 | residual: 106 mismatch | `.run/backlog_drafts/func_8017F96C.c` | +| 1101 | func_8017EFEC | None | | None | near | 107 | residual: 107 mismatch | `.run/backlog_drafts/func_8017EFEC.c` | +| 1102 | func_80182BC8 | None | | None | near | 107 | residual: 107 mismatch | `.run/backlog_drafts/func_80182BC8.c` | +| 1103 | func_8017F69C | None | | None | near | 107 | residual: 107 mismatch | `.run/backlog_drafts/func_8017F69C.c` | +| 1104 | func_80184828 | None | | None | near | 109 | residual: 109 mismatch | `.run/backlog_drafts/func_80184828.c` | +| 1105 | func_8017F3E4 | None | | None | near | 110 | residual: 110 mismatch | `.run/backlog_drafts/func_8017F3E4.c` | +| 1106 | func_8017DAF4 | None | | None | near | 111 | residual: 111 mismatch | `.run/backlog_drafts/func_8017DAF4.c` | +| 1107 | func_8017FE9C | None | | None | near | 111 | residual: 111 mismatch | `.run/backlog_drafts/func_8017FE9C.c` | +| 1108 | func_8017F768 | None | | None | near | 112 | residual: 112 mismatch | `.run/backlog_drafts/func_8017F768.c` | +| 1109 | func_8017F3B8 | None | | None | near | 112 | residual: 112 mismatch | `.run/backlog_drafts/func_8017F3B8.c` | +| 1110 | func_8017D508 | None | | None | near | 113 | residual: 113 mismatch | `.run/backlog_drafts/func_8017D508.c` | +| 1111 | func_8018788C | None | | None | near | 113 | residual: 113 mismatch | `.run/backlog_drafts/func_8018788C.c` | +| 1112 | func_8017E978 | None | | None | near | 115 | residual: 115 mismatch | `.run/backlog_drafts/func_8017E978.c` | +| 1113 | func_80181858 | None | | None | near | 117 | residual: 117 mismatch | `.run/backlog_drafts/func_80181858.c` | +| 1114 | func_80184CD0 | None | | None | near | 118 | residual: 118 mismatch | `.run/backlog_drafts/func_80184CD0.c` | +| 1115 | func_8017E8F8 | None | | None | near | 120 | residual: 120 mismatch | `.run/backlog_drafts/func_8017E8F8.c` | +| 1116 | func_80184358 | None | | None | near | 121 | residual: 121 mismatch | `.run/backlog_drafts/func_80184358.c` | +| 1117 | func_8017F074 | None | | None | near | 121 | residual: 121 mismatch | `.run/backlog_drafts/func_8017F074.c` | +| 1118 | func_8017D890 | None | | None | near | 124 | residual: 124 mismatch | `.run/backlog_drafts/func_8017D890.c` | +| 1119 | func_8017DECC | None | | None | near | 125 | residual: 125 mismatch | `.run/backlog_drafts/func_8017DECC.c` | +| 1120 | func_80185020 | None | | None | near | 125 | residual: 125 mismatch | `.run/backlog_drafts/func_80185020.c` | +| 1121 | func_8017DD2C | None | | None | near | 125 | residual: 125 mismatch | `.run/backlog_drafts/func_8017DD2C.c` | +| 1122 | func_801884BC | None | | None | near | 125 | residual: 125 mismatch | `.run/backlog_drafts/func_801884BC.c` | +| 1123 | func_801892CC | None | | None | near | 127 | residual: 127 mismatch | `.run/backlog_drafts/func_801892CC.c` | +| 1124 | func_8017EB00 | None | | None | near | 127 | residual: 127 mismatch | `.run/backlog_drafts/func_8017EB00.c` | +| 1125 | func_8017E538 | None | | None | near | 128 | residual: 128 mismatch | `.run/backlog_drafts/func_8017E538.c` | +| 1126 | func_8017D50C | None | | None | near | 128 | residual: 128 mismatch | `.run/backlog_drafts/func_8017D50C.c` | +| 1127 | func_801803F8 | None | | None | near | 129 | residual: 129 mismatch | `.run/backlog_drafts/func_801803F8.c` | +| 1128 | func_80185E68 | 1 | STRUCT | 132 | near | 131 | STRUCT: 131 mismatch | `.run/backlog_drafts/func_80185E68.c` | +| 1129 | func_8017E378 | None | | None | near | 134 | residual: 134 mismatch | `.run/backlog_drafts/func_8017E378.c` | +| 1130 | func_80185730 | None | | None | near | 136 | residual: 136 mismatch | `.run/backlog_drafts/func_80185730.c` | +| 1131 | func_8018523C | None | | None | near | 136 | residual: 136 mismatch | `.run/backlog_drafts/func_8018523C.c` | +| 1132 | func_80186530 | None | | None | near | 139 | residual: 139 mismatch | `.run/backlog_drafts/func_80186530.c` | +| 1133 | func_80184F08 | None | regalloc-order | None | near | 141 | none — MATCH (145/145 ins, match_one confirmed) | `.run/backlog_drafts/func_80184F08.c` | +| 1134 | func_80185668 | None | | None | near | 142 | residual: 142 mismatch | `.run/backlog_drafts/func_80185668.c` | +| 1135 | func_8017DB0C | None | | None | near | 142 | residual: 142 mismatch | `.run/backlog_drafts/func_8017DB0C.c` | +| 1136 | func_801814B0 | None | | None | near | 144 | residual: 144 mismatch | `.run/backlog_drafts/func_801814B0.c` | +| 1137 | func_801801A4 | None | | None | near | 148 | residual: 148 mismatch | `.run/backlog_drafts/func_801801A4.c` | +| 1138 | func_80180868 | None | | None | near | 148 | residual: 148 mismatch | `.run/backlog_drafts/func_80180868.c` | +| 1139 | func_801829BC | None | | None | near | 150 | residual: 150 mismatch | `.run/backlog_drafts/func_801829BC.c` | +| 1140 | func_8017FBE8 | None | | None | near | 151 | residual: 151 mismatch | `.run/backlog_drafts/func_8017FBE8.c` | +| 1141 | func_8018200C | None | | None | near | 152 | residual: 152 mismatch | `.run/backlog_drafts/func_8018200C.c` | +| 1142 | func_80181984 | None | | None | near | 153 | residual: 153 mismatch | `.run/backlog_drafts/func_80181984.c` | +| 1143 | func_80183280 | None | | None | near | 154 | residual: 154 mismatch | `.run/backlog_drafts/func_80183280.c` | +| 1144 | func_80184CA0 | None | | None | near | 162 | residual: 162 mismatch | `.run/backlog_drafts/func_80184CA0.c` | +| 1145 | func_8017FA54 | None | | None | near | 166 | residual: 166 mismatch | `.run/backlog_drafts/func_8017FA54.c` | +| 1146 | func_8017D708 | None | | None | near | 166 | residual: 166 mismatch | `.run/backlog_drafts/func_8017D708.c` | +| 1147 | func_8017E6EC | None | | None | near | 172 | residual: 172 mismatch | `.run/backlog_drafts/func_8017E6EC.c` | +| 1148 | func_8017D5DC | None | | None | near | 173 | residual: 173 mismatch | `.run/backlog_drafts/func_8017D5DC.c` | +| 1149 | func_8017D47C | None | | None | near | 173 | residual: 173 mismatch | `.run/backlog_drafts/func_8017D47C.c` | +| 1150 | func_8017F40C | None | | None | near | 174 | residual: 174 mismatch | `.run/backlog_drafts/func_8017F40C.c` | +| 1151 | func_80184210 | None | | None | near | 176 | residual: 176 mismatch | `.run/backlog_drafts/func_80184210.c` | +| 1152 | func_80185E34 | None | | None | near | 185 | residual: 185 mismatch | `.run/backlog_drafts/func_80185E34.c` | +| 1153 | func_80180568 | None | | None | near | 185 | residual: 185 mismatch | `.run/backlog_drafts/func_80180568.c` | +| 1154 | func_801809C4 | None | | None | near | 190 | residual: 190 mismatch | `.run/backlog_drafts/func_801809C4.c` | +| 1155 | func_80183D84 | None | | None | near | 192 | residual: 192 mismatch | `.run/backlog_drafts/func_80183D84.c` | +| 1156 | func_80183FEC | None | | None | near | 198 | residual: 198 mismatch | `.run/backlog_drafts/func_80183FEC.c` | +| 1157 | func_801823B8 | None | | None | near | 204 | residual: 204 mismatch | `.run/backlog_drafts/func_801823B8.c` | +| 1158 | func_801826C4 | None | | None | near | 207 | residual: 207 mismatch | `.run/backlog_drafts/func_801826C4.c` | +| 1159 | func_8017E374 | None | | None | near | 234 | residual: 234 mismatch | `.run/backlog_drafts/func_8017E374.c` | +| 1160 | func_8018C3F8 | None | | None | near | 236 | residual: 236 mismatch | `.run/backlog_drafts/func_8018C3F8.c` | +| 1161 | func_80183438 | None | | None | near | 237 | residual: 237 mismatch | `.run/backlog_drafts/func_80183438.c` | +| 1162 | func_8017E7D4 | None | | None | near | 241 | residual: 241 mismatch | `.run/backlog_drafts/func_8017E7D4.c` | +| 1163 | func_80183BF8 | None | | None | near | 258 | residual: 258 mismatch | `.run/backlog_drafts/func_80183BF8.c` | +| 1164 | func_8017EB30 | None | | None | near | 278 | residual: 278 mismatch | `.run/backlog_drafts/func_8017EB30.c` | +| 1165 | func_801804A0 | None | | None | near | 280 | residual: 280 mismatch | `.run/backlog_drafts/func_801804A0.c` | +| 1166 | func_80187EDC | None | | None | near | 296 | residual: 296 mismatch | `.run/backlog_drafts/func_80187EDC.c` | +| 1167 | func_8017F554 | None | | None | near | 299 | residual: 299 mismatch | `.run/backlog_drafts/func_8017F554.c` | +| 1168 | func_8017FEF0 | None | | None | near | 304 | residual: 304 mismatch | `.run/backlog_drafts/func_8017FEF0.c` | +| 1169 | func_80181670 | None | | None | near | 311 | residual: 311 mismatch | `.run/backlog_drafts/func_80181670.c` | +| 1170 | func_801833F0 | None | | None | near | 328 | residual: 328 mismatch | `.run/backlog_drafts/func_801833F0.c` | +| 1171 | func_80181128 | None | | None | near | 385 | residual: 385 mismatch | `.run/backlog_drafts/func_80181128.c` | +| 1172 | func_8017EA84 | None | | None | near | 578 | residual: 578 mismatch | `.run/backlog_drafts/func_8017EA84.c` | +| 1173 | func_8018057C | None | | None | near | 897 | residual: 897 mismatch | `.run/backlog_drafts/func_8018057C.c` | +| 1174 | func_80184A68 | 1 | regalloc-order | 33 | failed | | none — MATCH | `.run/backlog_drafts/func_80184A68.c` | +| 1175 | func_80180B64 | 1 | struct | 75 | failed | | none — MATCH (75 ins, relocation-masked) | `.run/backlog_drafts/func_80180B64.c` | +| 1176 | func_80183DE0 | 1 | regalloc-order | 91 | failed | | testing if(!=1) layout + counter-before-pointer init order | `.run/backlog_drafts/func_80183DE0.c` | +| 1177 | func_80182C9C | 1 | schedule | 101 | failed | | none — MATCH (101 ins). Inner-switch break-to-shared-tail must be written as | `.run/backlog_drafts/func_80182C9C.c` | +| 1178 | func_80183FB8 | 1 | loose-typing | 101 | failed | | none — MATCH (relocation-masked match_one, 101/101 ins) | `.run/backlog_drafts/func_80183FB8.c` | +| 1179 | func_80185BA4 | 1 | WAVE | 177 | failed | | won't compile standalone (loose-typing / missing decl) | | +| 1180 | func_8017D8DC | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017D8DC.c` | +| 1181 | func_80187750 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80187750.c` | +| 1182 | func_8017FFEC | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017FFEC.c` | +| 1183 | func_80184018 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80184018.c` | +| 1184 | func_8017DC18 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017DC18.c` | +| 1185 | func_801853CC | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801853CC.c` | +| 1186 | func_80181894 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80181894.c` | +| 1187 | func_8018BFBC | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8018BFBC.c` | +| 1188 | func_801807F4 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801807F4.c` | +| 1189 | func_8017FFC8 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017FFC8.c` | +| 1190 | func_8017E99C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017E99C.c` | +| 1191 | func_80180294 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80180294.c` | +| 1192 | func_8017E76C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017E76C.c` | +| 1193 | func_8017F29C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017F29C.c` | +| 1194 | func_8018253C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8018253C.c` | +| 1195 | func_8017F00C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017F00C.c` | +| 1196 | func_801802B0 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801802B0.c` | +| 1197 | func_80181FDC | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80181FDC.c` | +| 1198 | func_8017DA1C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017DA1C.c` | +| 1199 | func_8017FFC4 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017FFC4.c` | +| 1200 | func_8017E2F0 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017E2F0.c` | +| 1201 | func_801841E4 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801841E4.c` | +| 1202 | func_80181738 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80181738.c` | +| 1203 | func_801873D8 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801873D8.c` | +| 1204 | func_80181E90 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80181E90.c` | +| 1205 | func_80185628 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80185628.c` | +| 1206 | func_80182384 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80182384.c` | +| 1207 | func_801829D8 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801829D8.c` | +| 1208 | func_80181A78 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80181A78.c` | +| 1209 | func_80186E58 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80186E58.c` | +| 1210 | func_801805D4 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801805D4.c` | +| 1211 | func_8017EA1C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017EA1C.c` | +| 1212 | func_8017F098 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017F098.c` | +| 1213 | func_801822CC | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801822CC.c` | +| 1214 | func_80185BA8 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80185BA8.c` | +| 1215 | func_8018E710 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8018E710.c` | +| 1216 | func_801852D0 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_801852D0.c` | +| 1217 | func_8017E3F4 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8017E3F4.c` | +| 1218 | func_800D1658 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_800D1658.c` | +| 1219 | func_800D1984 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_800D1984.c` | +| 1220 | func_800D24A0 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_800D24A0.c` | +| 1221 | func_8018457C | None | regalloc-order | None | failed | | none — MATCH (160 ins). case1-tail needed a $a0 pin on the state temp | `.run/backlog_drafts/func_8018457C.c` | +| 1222 | func_8018D870 | None | regalloc-order | None | failed | | none — MATCH (match_one 380/380, relocation-masked). Levers: &&-DeMorgan for the mult block layout; lhu-corrected reads; split temps (t=func_8012C658 ret->v1, d8p=d8 load-temp->a0, s60/amt pinned $v1/$a1 for the mult chain); accumulate-in-place for the 0xe add; unsigned-short store for ori 0x8800; d8-load-via-temp to force the addu s3,a0 copy (fixes -1 length drift). | `.run/backlog_drafts/func_8018D870.c` | +| 1223 | func_80144B9C | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_80144B9C.c` | +| 1224 | func_8013DD68 | None | | None | failed | | won't compile standalone (loose-typing / missing decl) | `.run/backlog_drafts/func_8013DD68.c` | diff --git a/docs/progress.fleet.md b/docs/progress.fleet.md index b37545d2fd..eb72815158 100644 --- a/docs/progress.fleet.md +++ b/docs/progress.fleet.md @@ -4,157 +4,157 @@ # cross-binary collapsible-byte leverage: docs/duplicates.cross.md. # THREE progress metrics (all matter — see the labels): -FLEET fn-count byte-ident: 334031 / 353721 = 94.43% (REAL+LINKED+empties; FUNCTION-count, ×134-inflated — one crack counts per overlay) -FLEET instr-weighted : 12010894 / 13141652 = 91.4% (shipped .text across main + resident + 138 overlays; the decomp.dev-DISPLAY number) -FLEET distinct-code(uniq): 4735984 / 5634875 = 84.0% (73787/87459 unique fns; the DISTINCT-RE number) +FLEET fn-count byte-ident: 334873 / 353721 = 94.67% (REAL+LINKED+empties; FUNCTION-count, ×134-inflated — one crack counts per overlay) +FLEET instr-weighted : 12039773 / 13141652 = 91.6% (shipped .text across main + resident + 138 overlays; the decomp.dev-DISPLAY number) +FLEET distinct-code(uniq): 4758745 / 5634875 = 84.5% (74401/87459 unique fns; the DISTINCT-RE number) MAIN game-code weighted : 436 / 60201 = 0.7% (INCLUDED in the fleet numbers above since 2026-07-22 — roadmap §1 metrics contract; LINKED-excluding Ghidra sig dated 2026-06-14; caveat is R34: no independent second oracle for a PS-X EXE, NOT drift) - (fleet EXCLUDING main, for continuity with pre-2026-07-22 readings: 12010458 / 13081451 = 91.8%) + (fleet EXCLUDING main, for continuity with pre-2026-07-22 readings: 12039337 / 13081451 = 92.0%) -FLEET REAL substantive : 332176 (of which dedup-shared 240422 via 1905 groups / 240496 instances) +FLEET REAL substantive : 333018 (of which dedup-shared 240422 via 1905 groups / 240496 instances) FLEET LINKED PsyQ objs : 959 FLEET NON_MATCHING : 7 (0 in any default build — G4) -FLEET INCLUDE_ASM stubs : 19683 +FLEET INCLUDE_ASM stubs : 18841 FLEET matchable : 353721 | binary | REAL | shared | LINKED | byte-ident | matchable | byte-ident % | |---|---:|---:|---:|---:|---:|---:| | main | 54 | 2 | 959 | 1055 | 2096 | 50.3% | | resident | 129 | 0 | 0 | 131 | 145 | 90.3% | -| ov_SC01_000 | 2368 | 1748 | 0 | 2368 | 2403 | 98.5% | -| ov_SC01_001 | 2375 | 1749 | 0 | 2377 | 2466 | 96.4% | -| ov_SC01_004 | 2366 | 1740 | 0 | 2367 | 2414 | 98.1% | -| ov_SC01_005 | 2397 | 1763 | 0 | 2397 | 2503 | 95.8% | -| ov_SC01_006 | 2397 | 1763 | 0 | 2397 | 2503 | 95.8% | -| ov_SC01_008 | 2366 | 1740 | 0 | 2368 | 2426 | 97.6% | -| ov_SC01_009 | 2391 | 1741 | 0 | 2392 | 2507 | 95.4% | -| ov_SC01_074 | 2372 | 1741 | 0 | 2374 | 2425 | 97.9% | +| ov_SC01_000 | 2370 | 1748 | 0 | 2370 | 2403 | 98.6% | +| ov_SC01_001 | 2377 | 1749 | 0 | 2379 | 2466 | 96.5% | +| ov_SC01_004 | 2368 | 1740 | 0 | 2369 | 2414 | 98.1% | +| ov_SC01_005 | 2399 | 1763 | 0 | 2399 | 2503 | 95.8% | +| ov_SC01_006 | 2399 | 1763 | 0 | 2399 | 2503 | 95.8% | +| ov_SC01_008 | 2368 | 1740 | 0 | 2370 | 2426 | 97.7% | +| ov_SC01_009 | 2393 | 1741 | 0 | 2394 | 2507 | 95.5% | +| ov_SC01_074 | 2374 | 1741 | 0 | 2376 | 2425 | 98.0% | | ov_SC01_077 | 2535 | 1707 | 0 | 2537 | 2586 | 98.1% | -| ov_SC01_080 | 2406 | 1744 | 0 | 2406 | 2512 | 95.8% | -| ov_SC01_084 | 2427 | 1749 | 0 | 2432 | 2579 | 94.3% | -| ov_SC02_000 | 2483 | 1788 | 0 | 2483 | 2683 | 92.5% | -| ov_SC02_003 | 2482 | 1788 | 0 | 2482 | 2683 | 92.5% | -| ov_SC02_004 | 2371 | 1744 | 0 | 2371 | 2401 | 98.8% | -| ov_SC02_005 | 2508 | 1740 | 0 | 2518 | 2927 | 86.0% | -| ov_SC02_011 | 2519 | 1747 | 0 | 2530 | 2893 | 87.5% | -| ov_SC02_015 | 2377 | 1746 | 0 | 2377 | 2414 | 98.5% | -| ov_SC02_016 | 2420 | 1746 | 0 | 2423 | 2545 | 95.2% | -| ov_SC02_017 | 2479 | 1746 | 0 | 2487 | 2732 | 91.0% | -| ov_SC02_021 | 2381 | 1746 | 0 | 2381 | 2437 | 97.7% | -| ov_SC02_026 | 2408 | 1744 | 0 | 2414 | 2572 | 93.9% | -| ov_SC02_027 | 2435 | 1744 | 0 | 2444 | 2692 | 90.8% | -| ov_SC02_028 | 2432 | 1744 | 0 | 2442 | 2701 | 90.4% | -| ov_SC02_031 | 2419 | 1745 | 0 | 2424 | 2562 | 94.6% | -| ov_SC02_035 | 2393 | 1744 | 0 | 2396 | 2520 | 95.1% | -| ov_SC02_039 | 2370 | 1744 | 0 | 2370 | 2416 | 98.1% | -| ov_SC02_041 | 2420 | 1744 | 0 | 2423 | 2561 | 94.6% | -| ov_SC03_001 | 2522 | 1745 | 0 | 2539 | 2869 | 88.5% | -| ov_SC03_002 | 2433 | 1749 | 0 | 2448 | 2631 | 93.0% | -| ov_SC03_003 | 2378 | 1744 | 0 | 2379 | 2423 | 98.2% | -| ov_SC03_006 | 2463 | 1750 | 0 | 2472 | 2767 | 89.3% | -| ov_SC03_007 | 2431 | 1744 | 0 | 2435 | 2623 | 92.8% | -| ov_SC03_010 | 2389 | 1744 | 0 | 2389 | 2471 | 96.7% | -| ov_SC03_011 | 2394 | 1744 | 0 | 2400 | 2527 | 95.0% | -| ov_SC03_012 | 2368 | 1744 | 0 | 2369 | 2406 | 98.5% | -| ov_SC03_013 | 2395 | 1744 | 0 | 2395 | 2493 | 96.1% | -| ov_SC03_014 | 2483 | 1772 | 0 | 2483 | 2685 | 92.5% | -| ov_SC03_015 | 2471 | 1772 | 0 | 2471 | 2685 | 92.0% | -| ov_SC03_023 | 2379 | 1744 | 0 | 2380 | 2435 | 97.7% | -| ov_SC03_024 | 2445 | 1749 | 0 | 2452 | 2641 | 92.8% | -| ov_SC03_028 | 2415 | 1744 | 0 | 2419 | 2664 | 90.8% | -| ov_SC03_029 | 2432 | 1746 | 0 | 2442 | 2644 | 92.4% | -| ov_SC03_030 | 2391 | 1749 | 0 | 2393 | 2495 | 95.9% | -| ov_SC03_031 | 2391 | 1744 | 0 | 2394 | 2514 | 95.2% | -| ov_SC03_089 | 2416 | 1749 | 0 | 2423 | 2581 | 93.9% | -| ov_SC03_090 | 2419 | 1749 | 0 | 2427 | 2625 | 92.5% | -| ov_SC03_091 | 2416 | 1744 | 0 | 2424 | 2640 | 91.8% | -| ov_SC03_092 | 2439 | 1749 | 0 | 2451 | 2587 | 94.7% | -| ov_SC03_093 | 2404 | 1744 | 0 | 2408 | 2563 | 94.0% | -| ov_SC03_094 | 2395 | 1744 | 0 | 2401 | 2577 | 93.2% | -| ov_SC03_095 | 2383 | 1744 | 0 | 2386 | 2474 | 96.4% | -| ov_SC03_096 | 2384 | 1744 | 0 | 2387 | 2465 | 96.8% | -| ov_SC03_097 | 2426 | 1744 | 0 | 2433 | 2603 | 93.5% | -| ov_SC03_098 | 2395 | 1744 | 0 | 2398 | 2541 | 94.4% | -| ov_SC03_099 | 2385 | 1744 | 0 | 2388 | 2504 | 95.4% | -| ov_SC03_100 | 2399 | 1744 | 0 | 2403 | 2539 | 94.6% | -| ov_SC03_101 | 2407 | 1749 | 0 | 2411 | 2528 | 95.4% | -| ov_SC03_102 | 2385 | 1744 | 0 | 2388 | 2492 | 95.8% | -| ov_SC03_103 | 2391 | 1746 | 0 | 2394 | 2510 | 95.4% | -| ov_SC03_104 | 2425 | 1749 | 0 | 2432 | 2616 | 93.0% | -| ov_SC03_105 | 2405 | 1744 | 0 | 2412 | 2597 | 92.9% | -| ov_SC03_108 | 2373 | 1744 | 0 | 2373 | 2443 | 97.1% | -| ov_SC03_109 | 2376 | 1744 | 0 | 2378 | 2424 | 98.1% | -| ov_SC03_110 | 2381 | 1744 | 0 | 2381 | 2468 | 96.5% | -| ov_SC03_111 | 2397 | 1744 | 0 | 2400 | 2510 | 95.6% | -| ov_SC03_112 | 2391 | 1746 | 0 | 2393 | 2526 | 94.7% | -| ov_SC03_113 | 2380 | 1746 | 0 | 2383 | 2468 | 96.6% | -| ov_SC03_114 | 2366 | 1744 | 0 | 2368 | 2415 | 98.1% | -| ov_SC03_115 | 2388 | 1744 | 0 | 2390 | 2472 | 96.7% | -| ov_SC03_116 | 2374 | 1744 | 0 | 2377 | 2438 | 97.5% | -| ov_SC03_117 | 2412 | 1744 | 0 | 2418 | 2557 | 94.6% | -| ov_SC03_118 | 2462 | 1768 | 0 | 2463 | 2685 | 91.7% | -| ov_SC03_119 | 2458 | 1768 | 0 | 2459 | 2685 | 91.6% | -| ov_SC03_121 | 2382 | 1744 | 0 | 2385 | 2459 | 97.0% | -| ov_SC03_124 | 2477 | 1740 | 0 | 2497 | 2741 | 91.1% | -| ov_SC03_125 | 2420 | 1744 | 0 | 2432 | 2588 | 94.0% | -| ov_SC03_126 | 2379 | 1746 | 0 | 2379 | 2423 | 98.2% | -| ov_SC04_000 | 2406 | 1748 | 0 | 2415 | 2546 | 94.9% | -| ov_SC04_002 | 2430 | 1744 | 0 | 2434 | 2636 | 92.3% | -| ov_SC04_003 | 2394 | 1744 | 0 | 2398 | 2502 | 95.8% | -| ov_SC04_004 | 2408 | 1744 | 0 | 2410 | 2558 | 94.2% | -| ov_SC04_005 | 2419 | 1744 | 0 | 2425 | 2612 | 92.8% | -| ov_SC04_006 | 2383 | 1744 | 0 | 2385 | 2454 | 97.2% | -| ov_SC04_007 | 2413 | 1744 | 0 | 2417 | 2569 | 94.1% | -| ov_SC04_008 | 2373 | 1744 | 0 | 2373 | 2415 | 98.3% | -| ov_SC04_009 | 2387 | 1744 | 0 | 2390 | 2441 | 97.9% | -| ov_SC04_010 | 2375 | 1744 | 0 | 2376 | 2419 | 98.2% | -| ov_SC04_011 | 2451 | 1749 | 0 | 2457 | 2803 | 87.7% | -| ov_SC04_012 | 2374 | 1744 | 0 | 2375 | 2420 | 98.1% | -| ov_SC04_015 | 2446 | 1745 | 0 | 2457 | 2611 | 94.1% | -| ov_SC04_016 | 2375 | 1744 | 0 | 2377 | 2440 | 97.4% | -| ov_SC04_018 | 2528 | 1780 | 0 | 2528 | 2857 | 88.5% | -| ov_SC04_019 | 2524 | 1780 | 0 | 2524 | 2857 | 88.3% | -| ov_SC04_020 | 2408 | 1744 | 0 | 2420 | 2567 | 94.3% | -| ov_SC04_021 | 2379 | 1746 | 0 | 2379 | 2423 | 98.2% | -| ov_SC05_000 | 2377 | 1748 | 0 | 2380 | 2422 | 98.3% | -| ov_SC05_001 | 2409 | 1744 | 0 | 2414 | 2574 | 93.8% | -| ov_SC05_002 | 2385 | 1744 | 0 | 2388 | 2442 | 97.8% | -| ov_SC05_003 | 2381 | 1744 | 0 | 2382 | 2481 | 96.0% | -| ov_SC05_004 | 2377 | 1744 | 0 | 2379 | 2464 | 96.6% | -| ov_SC05_005 | 2392 | 1749 | 0 | 2393 | 2491 | 96.1% | -| ov_SC05_006 | 2377 | 1744 | 0 | 2377 | 2430 | 97.8% | -| ov_SC05_007 | 2386 | 1744 | 0 | 2391 | 2482 | 96.3% | -| ov_SC05_008 | 2405 | 1744 | 0 | 2407 | 2543 | 94.7% | -| ov_SC05_009 | 2381 | 1744 | 0 | 2385 | 2438 | 97.8% | -| ov_SC05_010 | 2411 | 1744 | 0 | 2415 | 2588 | 93.3% | -| ov_SC05_011 | 2374 | 1744 | 0 | 2375 | 2409 | 98.6% | -| ov_SC05_017 | 2506 | 1741 | 0 | 2517 | 2842 | 88.6% | -| ov_SC05_018 | 2439 | 1744 | 0 | 2452 | 2673 | 91.7% | -| ov_SC05_019 | 2379 | 1746 | 0 | 2379 | 2423 | 98.2% | -| ov_SC06_000 | 2465 | 1753 | 0 | 2468 | 2691 | 91.7% | -| ov_SC06_006 | 2398 | 1744 | 0 | 2399 | 2511 | 95.5% | -| ov_SC06_008 | 2423 | 1746 | 0 | 2429 | 2542 | 95.6% | -| ov_SC06_010 | 2404 | 1744 | 0 | 2409 | 2517 | 95.7% | -| ov_SC06_011 | 2383 | 1744 | 0 | 2387 | 2468 | 96.7% | -| ov_SC06_013 | 2377 | 1744 | 0 | 2378 | 2425 | 98.1% | -| ov_SC06_014 | 2384 | 1744 | 0 | 2386 | 2453 | 97.3% | -| ov_SC06_015 | 2382 | 1744 | 0 | 2382 | 2421 | 98.4% | -| ov_SC06_016 | 2399 | 1744 | 0 | 2401 | 2549 | 94.2% | -| ov_SC06_018 | 2428 | 1746 | 0 | 2435 | 2665 | 91.4% | -| ov_SC06_020 | 2394 | 1746 | 0 | 2395 | 2518 | 95.1% | -| ov_SC06_022 | 2419 | 1744 | 0 | 2427 | 2642 | 91.9% | -| ov_SC06_024 | 2430 | 1744 | 0 | 2436 | 2667 | 91.3% | -| ov_SC06_025 | 2409 | 1744 | 0 | 2414 | 2572 | 93.9% | -| ov_SC06_027 | 2369 | 1744 | 0 | 2370 | 2408 | 98.4% | -| ov_SC06_029 | 2434 | 1744 | 0 | 2446 | 2662 | 91.9% | -| ov_SC06_030 | 2382 | 1744 | 0 | 2382 | 2456 | 97.0% | -| ov_SC06_032 | 2416 | 1745 | 0 | 2423 | 2658 | 91.2% | -| ov_SC06_033 | 2416 | 1745 | 0 | 2423 | 2631 | 92.1% | -| ov_SC07_000 | 2395 | 1748 | 0 | 2397 | 2521 | 95.1% | -| ov_SC07_001 | 2382 | 1744 | 0 | 2384 | 2454 | 97.1% | -| ov_SC07_002 | 2409 | 1744 | 0 | 2413 | 2579 | 93.6% | -| ov_SC07_006 | 2272 | 1560 | 0 | 2352 | 2456 | 95.8% | -| ov_SC07_007 | 2292 | 1592 | 0 | 2376 | 2613 | 90.9% | -| ov_SC07_008 | 2363 | 1744 | 0 | 2363 | 2386 | 99.0% | -| ov_SC07_009 | 2374 | 1744 | 0 | 2376 | 2430 | 97.8% | -| ov_SC07_010 | 2283 | 1614 | 0 | 2366 | 2524 | 93.7% | -| ov_SC07_011 | 2292 | 1591 | 0 | 2372 | 2449 | 96.9% | +| ov_SC01_080 | 2408 | 1744 | 0 | 2408 | 2512 | 95.9% | +| ov_SC01_084 | 2429 | 1749 | 0 | 2434 | 2579 | 94.4% | +| ov_SC02_000 | 2490 | 1788 | 0 | 2490 | 2683 | 92.8% | +| ov_SC02_003 | 2489 | 1788 | 0 | 2489 | 2683 | 92.8% | +| ov_SC02_004 | 2373 | 1744 | 0 | 2373 | 2401 | 98.8% | +| ov_SC02_005 | 2510 | 1740 | 0 | 2520 | 2927 | 86.1% | +| ov_SC02_011 | 2526 | 1747 | 0 | 2537 | 2893 | 87.7% | +| ov_SC02_015 | 2379 | 1746 | 0 | 2379 | 2414 | 98.6% | +| ov_SC02_016 | 2428 | 1746 | 0 | 2431 | 2545 | 95.5% | +| ov_SC02_017 | 2490 | 1746 | 0 | 2498 | 2732 | 91.4% | +| ov_SC02_021 | 2383 | 1746 | 0 | 2383 | 2437 | 97.8% | +| ov_SC02_026 | 2411 | 1744 | 0 | 2417 | 2572 | 94.0% | +| ov_SC02_027 | 2449 | 1744 | 0 | 2458 | 2692 | 91.3% | +| ov_SC02_028 | 2449 | 1744 | 0 | 2459 | 2701 | 91.0% | +| ov_SC02_031 | 2429 | 1745 | 0 | 2434 | 2562 | 95.0% | +| ov_SC02_035 | 2400 | 1744 | 0 | 2403 | 2520 | 95.4% | +| ov_SC02_039 | 2372 | 1744 | 0 | 2372 | 2416 | 98.2% | +| ov_SC02_041 | 2426 | 1744 | 0 | 2429 | 2561 | 94.8% | +| ov_SC03_001 | 2533 | 1745 | 0 | 2550 | 2869 | 88.9% | +| ov_SC03_002 | 2439 | 1749 | 0 | 2454 | 2631 | 93.3% | +| ov_SC03_003 | 2380 | 1744 | 0 | 2381 | 2423 | 98.3% | +| ov_SC03_006 | 2480 | 1750 | 0 | 2489 | 2767 | 90.0% | +| ov_SC03_007 | 2437 | 1744 | 0 | 2441 | 2623 | 93.1% | +| ov_SC03_010 | 2391 | 1744 | 0 | 2391 | 2471 | 96.8% | +| ov_SC03_011 | 2396 | 1744 | 0 | 2402 | 2527 | 95.1% | +| ov_SC03_012 | 2370 | 1744 | 0 | 2371 | 2406 | 98.5% | +| ov_SC03_013 | 2397 | 1744 | 0 | 2397 | 2493 | 96.1% | +| ov_SC03_014 | 2490 | 1772 | 0 | 2490 | 2685 | 92.7% | +| ov_SC03_015 | 2484 | 1772 | 0 | 2484 | 2685 | 92.5% | +| ov_SC03_023 | 2381 | 1744 | 0 | 2382 | 2435 | 97.8% | +| ov_SC03_024 | 2447 | 1749 | 0 | 2454 | 2641 | 92.9% | +| ov_SC03_028 | 2419 | 1744 | 0 | 2423 | 2664 | 91.0% | +| ov_SC03_029 | 2440 | 1746 | 0 | 2450 | 2644 | 92.7% | +| ov_SC03_030 | 2398 | 1749 | 0 | 2400 | 2495 | 96.2% | +| ov_SC03_031 | 2398 | 1744 | 0 | 2401 | 2514 | 95.5% | +| ov_SC03_089 | 2426 | 1749 | 0 | 2433 | 2581 | 94.3% | +| ov_SC03_090 | 2430 | 1749 | 0 | 2438 | 2625 | 92.9% | +| ov_SC03_091 | 2432 | 1744 | 0 | 2440 | 2640 | 92.4% | +| ov_SC03_092 | 2445 | 1749 | 0 | 2457 | 2587 | 95.0% | +| ov_SC03_093 | 2418 | 1744 | 0 | 2422 | 2563 | 94.5% | +| ov_SC03_094 | 2408 | 1744 | 0 | 2414 | 2577 | 93.7% | +| ov_SC03_095 | 2391 | 1744 | 0 | 2394 | 2474 | 96.8% | +| ov_SC03_096 | 2391 | 1744 | 0 | 2394 | 2465 | 97.1% | +| ov_SC03_097 | 2439 | 1744 | 0 | 2446 | 2603 | 94.0% | +| ov_SC03_098 | 2409 | 1744 | 0 | 2412 | 2541 | 94.9% | +| ov_SC03_099 | 2399 | 1744 | 0 | 2402 | 2504 | 95.9% | +| ov_SC03_100 | 2416 | 1744 | 0 | 2420 | 2539 | 95.3% | +| ov_SC03_101 | 2418 | 1749 | 0 | 2422 | 2528 | 95.8% | +| ov_SC03_102 | 2394 | 1744 | 0 | 2397 | 2492 | 96.2% | +| ov_SC03_103 | 2404 | 1746 | 0 | 2407 | 2510 | 95.9% | +| ov_SC03_104 | 2432 | 1749 | 0 | 2439 | 2616 | 93.2% | +| ov_SC03_105 | 2413 | 1744 | 0 | 2420 | 2597 | 93.2% | +| ov_SC03_108 | 2375 | 1744 | 0 | 2375 | 2443 | 97.2% | +| ov_SC03_109 | 2378 | 1744 | 0 | 2380 | 2424 | 98.2% | +| ov_SC03_110 | 2392 | 1744 | 0 | 2392 | 2468 | 96.9% | +| ov_SC03_111 | 2405 | 1744 | 0 | 2408 | 2510 | 95.9% | +| ov_SC03_112 | 2400 | 1746 | 0 | 2402 | 2526 | 95.1% | +| ov_SC03_113 | 2386 | 1746 | 0 | 2389 | 2468 | 96.8% | +| ov_SC03_114 | 2368 | 1744 | 0 | 2370 | 2415 | 98.1% | +| ov_SC03_115 | 2399 | 1744 | 0 | 2401 | 2472 | 97.1% | +| ov_SC03_116 | 2376 | 1744 | 0 | 2379 | 2438 | 97.6% | +| ov_SC03_117 | 2420 | 1744 | 0 | 2426 | 2557 | 94.9% | +| ov_SC03_118 | 2467 | 1768 | 0 | 2468 | 2685 | 91.9% | +| ov_SC03_119 | 2463 | 1768 | 0 | 2464 | 2685 | 91.8% | +| ov_SC03_121 | 2386 | 1744 | 0 | 2389 | 2459 | 97.2% | +| ov_SC03_124 | 2480 | 1740 | 0 | 2500 | 2741 | 91.2% | +| ov_SC03_125 | 2425 | 1744 | 0 | 2437 | 2588 | 94.2% | +| ov_SC03_126 | 2381 | 1746 | 0 | 2381 | 2423 | 98.3% | +| ov_SC04_000 | 2417 | 1748 | 0 | 2426 | 2546 | 95.3% | +| ov_SC04_002 | 2444 | 1744 | 0 | 2448 | 2636 | 92.9% | +| ov_SC04_003 | 2398 | 1744 | 0 | 2402 | 2502 | 96.0% | +| ov_SC04_004 | 2420 | 1744 | 0 | 2422 | 2558 | 94.7% | +| ov_SC04_005 | 2430 | 1744 | 0 | 2436 | 2612 | 93.3% | +| ov_SC04_006 | 2389 | 1744 | 0 | 2391 | 2454 | 97.4% | +| ov_SC04_007 | 2423 | 1744 | 0 | 2427 | 2569 | 94.5% | +| ov_SC04_008 | 2377 | 1744 | 0 | 2377 | 2415 | 98.4% | +| ov_SC04_009 | 2391 | 1744 | 0 | 2394 | 2441 | 98.1% | +| ov_SC04_010 | 2379 | 1744 | 0 | 2380 | 2419 | 98.4% | +| ov_SC04_011 | 2461 | 1749 | 0 | 2467 | 2803 | 88.0% | +| ov_SC04_012 | 2378 | 1744 | 0 | 2379 | 2420 | 98.3% | +| ov_SC04_015 | 2449 | 1745 | 0 | 2460 | 2611 | 94.2% | +| ov_SC04_016 | 2377 | 1744 | 0 | 2379 | 2440 | 97.5% | +| ov_SC04_018 | 2536 | 1780 | 0 | 2536 | 2857 | 88.8% | +| ov_SC04_019 | 2536 | 1780 | 0 | 2536 | 2857 | 88.8% | +| ov_SC04_020 | 2413 | 1744 | 0 | 2425 | 2567 | 94.5% | +| ov_SC04_021 | 2381 | 1746 | 0 | 2381 | 2423 | 98.3% | +| ov_SC05_000 | 2379 | 1748 | 0 | 2382 | 2422 | 98.3% | +| ov_SC05_001 | 2422 | 1744 | 0 | 2427 | 2574 | 94.3% | +| ov_SC05_002 | 2390 | 1744 | 0 | 2393 | 2442 | 98.0% | +| ov_SC05_003 | 2387 | 1744 | 0 | 2388 | 2481 | 96.3% | +| ov_SC05_004 | 2380 | 1744 | 0 | 2382 | 2464 | 96.7% | +| ov_SC05_005 | 2395 | 1749 | 0 | 2396 | 2491 | 96.2% | +| ov_SC05_006 | 2384 | 1744 | 0 | 2384 | 2430 | 98.1% | +| ov_SC05_007 | 2397 | 1744 | 0 | 2402 | 2482 | 96.8% | +| ov_SC05_008 | 2407 | 1744 | 0 | 2409 | 2543 | 94.7% | +| ov_SC05_009 | 2383 | 1744 | 0 | 2387 | 2438 | 97.9% | +| ov_SC05_010 | 2418 | 1744 | 0 | 2422 | 2588 | 93.6% | +| ov_SC05_011 | 2376 | 1744 | 0 | 2377 | 2409 | 98.7% | +| ov_SC05_017 | 2518 | 1741 | 0 | 2529 | 2842 | 89.0% | +| ov_SC05_018 | 2444 | 1744 | 0 | 2457 | 2673 | 91.9% | +| ov_SC05_019 | 2381 | 1746 | 0 | 2381 | 2423 | 98.3% | +| ov_SC06_000 | 2473 | 1753 | 0 | 2476 | 2691 | 92.0% | +| ov_SC06_006 | 2402 | 1744 | 0 | 2403 | 2511 | 95.7% | +| ov_SC06_008 | 2427 | 1746 | 0 | 2433 | 2542 | 95.7% | +| ov_SC06_010 | 2408 | 1744 | 0 | 2413 | 2517 | 95.9% | +| ov_SC06_011 | 2385 | 1744 | 0 | 2389 | 2468 | 96.8% | +| ov_SC06_013 | 2379 | 1744 | 0 | 2380 | 2425 | 98.1% | +| ov_SC06_014 | 2388 | 1744 | 0 | 2390 | 2453 | 97.4% | +| ov_SC06_015 | 2384 | 1744 | 0 | 2384 | 2421 | 98.5% | +| ov_SC06_016 | 2404 | 1744 | 0 | 2406 | 2549 | 94.4% | +| ov_SC06_018 | 2432 | 1746 | 0 | 2439 | 2665 | 91.5% | +| ov_SC06_020 | 2401 | 1746 | 0 | 2402 | 2518 | 95.4% | +| ov_SC06_022 | 2429 | 1744 | 0 | 2437 | 2642 | 92.2% | +| ov_SC06_024 | 2440 | 1744 | 0 | 2446 | 2667 | 91.7% | +| ov_SC06_025 | 2414 | 1744 | 0 | 2419 | 2572 | 94.1% | +| ov_SC06_027 | 2371 | 1744 | 0 | 2372 | 2408 | 98.5% | +| ov_SC06_029 | 2438 | 1744 | 0 | 2450 | 2662 | 92.0% | +| ov_SC06_030 | 2384 | 1744 | 0 | 2384 | 2456 | 97.1% | +| ov_SC06_032 | 2424 | 1745 | 0 | 2431 | 2658 | 91.5% | +| ov_SC06_033 | 2425 | 1745 | 0 | 2432 | 2631 | 92.4% | +| ov_SC07_000 | 2398 | 1748 | 0 | 2400 | 2521 | 95.2% | +| ov_SC07_001 | 2384 | 1744 | 0 | 2386 | 2454 | 97.2% | +| ov_SC07_002 | 2412 | 1744 | 0 | 2416 | 2579 | 93.7% | +| ov_SC07_006 | 2276 | 1560 | 0 | 2356 | 2456 | 95.9% | +| ov_SC07_007 | 2303 | 1592 | 0 | 2387 | 2613 | 91.4% | +| ov_SC07_008 | 2365 | 1744 | 0 | 2365 | 2386 | 99.1% | +| ov_SC07_009 | 2376 | 1744 | 0 | 2378 | 2430 | 97.9% | +| ov_SC07_010 | 2286 | 1614 | 0 | 2369 | 2524 | 93.9% | +| ov_SC07_011 | 2297 | 1591 | 0 | 2377 | 2449 | 97.1% | diff --git a/phase-ends/CURRENT_PHASE.md b/phase-ends/CURRENT_PHASE.md index 2d3f76c783..7a3f30431f 100644 --- a/phase-ends/CURRENT_PHASE.md +++ b/phase-ends/CURRENT_PHASE.md @@ -518,6 +518,47 @@ the T2 log entries; check both background tasks' outcomes first (`git log` for t ## Per-task log +### ▶ S6a — the source-agnostic zero-crack sweep: 842 banked, and the residue is OUR TOOLING again (2026-08-01) +**Setup, measured before running anything (R37 — probe before costing).** The 190 zero-crack families +(129,997 templatable ins) were decomposed with **zero builds** by remapping each family's exemplar onto one +member and type-checking the resulting draft statically: +· **117 families / 92,368 ins / 2,735 member-slots** — draft self-contained ⇒ sweepable now. +· **17 / 24,332 ins** — the §94/§100 class: the body uses a **file-scope MULTI-LINE typedef**, which + `extract_unit` cannot carry (it carries single-line ones only). Head prizes `0x8012b77c` (ov_SC07_006, + 139 members, `Ang2_8012B77C`) and `0x80128c98` (ov_SC01_077_a, **275 members**, `CdFileLoc`) = 14,937 ins. +· **9 / 9,364 ins** — `has_mid_jr` ⇒ the §53 carve path, not this sweep. +· **47 / 3,933 ins** — `remap_hseq` REFUSES (mostly unresolved immediates). Genuine, small. + +**⚠ PREMISE CORRECTION (R14) — the checkpoint's stated mechanism was wrong.** The post-wave frontier says +these families were unreachable because "every sweep this project has run passed `--source ov_SC01_077`". +It is not the mechanism: `--source ov_SC01_077` is the **default**, and `hseq_sweep`'s override block only +fires when `source != EX_OV`, so the manifest's own non-ov077 exemplar was already being used. The real gate +is **`--band substantial`** (the default): of the 181 non-jr zero-crack families only **13 are substantial** +— 114 `mid`, 54 `tiny`. **`--band all` is the unlock**, exactly as the S1 trap note warned. (The 106 +non-ov077 exemplars are real and interesting; they were not what blocked the sweep.) + +**Result:** `family_sweep --hseq --band all -j12 --only <117 addrs>` staged **2,735 drafts / 1,239 groups, +0 skips** → **BANKED 842 / 1,893 failed**. **R22 clean-fleet `make clean` + extract-all + check-all → 140 +passed, 0 failed of 140.** Fleet **94.43→94.67% fn-count · 91.4→91.6% instr · 84.0→84.5% distinct**. + +**The residue is bimodal, and that is the finding: 57 families banked ALL members, 52 banked ZERO, 8 +partial.** A per-member compiler wall does not produce that shape; one per-family blocker does. Eight +zero-banked families were probed with a new generic blocker-capture (`.run/s6_diag.py` — the any-overlay +sibling of S29's ov077-only `.run/uc_capture.py`: remap → splice → build THAT overlay → read the compiler's +own error → revert; **one build per family, not 137**). **Seven of eight are declaration/carry plumbing; +one is a genuine byte DIFF.** Two are proven defects in `tools/family_remap.py`, both located at source: +- **D1 — the preamble backscan's `{`-guard does not exempt comment lines.** The guard is a real T65 fix + (`extern void f(int); int g(){…}` on one line), but it fires on any *documentation* line that merely + mentions a brace, so the carry stops mid-comment and the sibling receives a dangling ` * …` fragment → + `parse error before 'the'` (`0x80176144`, `0x80146afc`). +- **D2 — `_def_head_at` returns `True` on "param list continues past this line ⇒ ANSI definition".** False + for a **wrapped multi-line DECLARATION** (`extern void func_801466F0(s32 a0, …,\n s32 sp8);`), so + `extract_unit` accepts line 457 of `ov_SC01_077_after.c` as a definition head and returns a **16-line + fragment that contains no function body at all** (`DEFINE_func_801466B4()` + `#include "common.h"` + a + comment), terminated by a brace pair *inside* that comment. Verified directly: + `_def_head_at('extern void func_801466F0(s32 a0, s32 a1, s32 a2, s32 a3,', idx) -> True`. + This is the §110/R35 class again — a silent 0/137 wearing a compiler wall's clothes. + ### ✅ S3 — the close=0 stored-draft DIAGNOSTIC pass: measured, classified, and correctly NOT scaled (2026-08-01) Chartered as "classify, and only build a fix if ≥3 share a named class". Ran exactly that; the answer is that no cheap shared class exists, so nothing was scaled. **The population is bigger than the plan diff --git a/src/ov_SC01_000/ov_SC01_000_jr_80135D20.c b/src/ov_SC01_000/ov_SC01_000_jr_80135D20.c index b53680b5bb..d31fd7763a 100644 --- a/src/ov_SC01_000/ov_SC01_000_jr_80135D20.c +++ b/src/ov_SC01_000/ov_SC01_000_jr_80135D20.c @@ -1427,7 +1427,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_000/nonmatchings/ov_SC01_000_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017F1BC[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017F1BC[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017F1BC[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017F1BC[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017F1BC[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC01_000/ov_SC01_000_jr_80154C24.c b/src/ov_SC01_000/ov_SC01_000_jr_80154C24.c index 68eb254a2b..33e754aeb5 100644 --- a/src/ov_SC01_000/ov_SC01_000_jr_80154C24.c +++ b/src/ov_SC01_000/ov_SC01_000_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_000/nonmatchings/ov_SC01_000_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80180F44)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80180F44[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80180F44[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC01_001/ov_SC01_001_jr_80135D20.c b/src/ov_SC01_001/ov_SC01_001_jr_80135D20.c index 435e38b4bc..35b450eb3c 100644 --- a/src/ov_SC01_001/ov_SC01_001_jr_80135D20.c +++ b/src/ov_SC01_001/ov_SC01_001_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_001/nonmatchings/ov_SC01_001_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80183E0C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80183E0C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80183E0C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80183E0C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80183E0C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC01_001/ov_SC01_001_jr_80154C24.c b/src/ov_SC01_001/ov_SC01_001_jr_80154C24.c index 2a94ddea02..6c27abd6c8 100644 --- a/src/ov_SC01_001/ov_SC01_001_jr_80154C24.c +++ b/src/ov_SC01_001/ov_SC01_001_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_001/nonmatchings/ov_SC01_001_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80185B94)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80185B94[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80185B94[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC01_004/ov_SC01_004_jr_80135D20.c b/src/ov_SC01_004/ov_SC01_004_jr_80135D20.c index bd3da957b1..3376bb7471 100644 --- a/src/ov_SC01_004/ov_SC01_004_jr_80135D20.c +++ b/src/ov_SC01_004/ov_SC01_004_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_004/nonmatchings/ov_SC01_004_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017F7D0[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017F7D0[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017F7D0[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017F7D0[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017F7D0[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC01_004/ov_SC01_004_jr_80154C24.c b/src/ov_SC01_004/ov_SC01_004_jr_80154C24.c index 736f830f77..2b665233f5 100644 --- a/src/ov_SC01_004/ov_SC01_004_jr_80154C24.c +++ b/src/ov_SC01_004/ov_SC01_004_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_004/nonmatchings/ov_SC01_004_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80181558)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80181558[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80181558[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC01_005/ov_SC01_005_jr_80135D20.c b/src/ov_SC01_005/ov_SC01_005_jr_80135D20.c index af9d110e6c..2855ce92dc 100644 --- a/src/ov_SC01_005/ov_SC01_005_jr_80135D20.c +++ b/src/ov_SC01_005/ov_SC01_005_jr_80135D20.c @@ -1427,7 +1427,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80182964[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80182964[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80182964[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80182964[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80182964[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC01_005/ov_SC01_005_jr_80154C24.c b/src/ov_SC01_005/ov_SC01_005_jr_80154C24.c index 7c33ee8b63..55cc7e339c 100644 --- a/src/ov_SC01_005/ov_SC01_005_jr_80154C24.c +++ b/src/ov_SC01_005/ov_SC01_005_jr_80154C24.c @@ -1660,7 +1660,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_005/nonmatchings/ov_SC01_005_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801846EC)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801846EC[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801846EC[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC01_006/ov_SC01_006_jr_80135D20.c b/src/ov_SC01_006/ov_SC01_006_jr_80135D20.c index e93e04671f..2855ce92dc 100644 --- a/src/ov_SC01_006/ov_SC01_006_jr_80135D20.c +++ b/src/ov_SC01_006/ov_SC01_006_jr_80135D20.c @@ -1427,7 +1427,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80182964[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80182964[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80182964[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80182964[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80182964[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC01_006/ov_SC01_006_jr_80154C24.c b/src/ov_SC01_006/ov_SC01_006_jr_80154C24.c index 38f206abc4..55cc7e339c 100644 --- a/src/ov_SC01_006/ov_SC01_006_jr_80154C24.c +++ b/src/ov_SC01_006/ov_SC01_006_jr_80154C24.c @@ -1660,7 +1660,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_006/nonmatchings/ov_SC01_006_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801846EC)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801846EC[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801846EC[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC01_008/ov_SC01_008_jr_80135D20.c b/src/ov_SC01_008/ov_SC01_008_jr_80135D20.c index cb7cc49496..02ea5cec0b 100644 --- a/src/ov_SC01_008/ov_SC01_008_jr_80135D20.c +++ b/src/ov_SC01_008/ov_SC01_008_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_008/nonmatchings/ov_SC01_008_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017FD44[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017FD44[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017FD44[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017FD44[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017FD44[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC01_008/ov_SC01_008_jr_80154C24.c b/src/ov_SC01_008/ov_SC01_008_jr_80154C24.c index 1a3c4f6858..7c5794af67 100644 --- a/src/ov_SC01_008/ov_SC01_008_jr_80154C24.c +++ b/src/ov_SC01_008/ov_SC01_008_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_008/nonmatchings/ov_SC01_008_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80181ACC)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80181ACC[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80181ACC[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC01_009/ov_SC01_009_jr_80135D20.c b/src/ov_SC01_009/ov_SC01_009_jr_80135D20.c index aa5a282e72..9a12660c1b 100644 --- a/src/ov_SC01_009/ov_SC01_009_jr_80135D20.c +++ b/src/ov_SC01_009/ov_SC01_009_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_009/nonmatchings/ov_SC01_009_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80182F2C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80182F2C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80182F2C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80182F2C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80182F2C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC01_009/ov_SC01_009_jr_80154C24.c b/src/ov_SC01_009/ov_SC01_009_jr_80154C24.c index 796ed4c7bf..9d15b67770 100644 --- a/src/ov_SC01_009/ov_SC01_009_jr_80154C24.c +++ b/src/ov_SC01_009/ov_SC01_009_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_009/nonmatchings/ov_SC01_009_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80184CB4)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80184CB4[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80184CB4[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC01_074/ov_SC01_074_jr_80135D20.c b/src/ov_SC01_074/ov_SC01_074_jr_80135D20.c index c1c3de9f79..119d7b923a 100644 --- a/src/ov_SC01_074/ov_SC01_074_jr_80135D20.c +++ b/src/ov_SC01_074/ov_SC01_074_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_074/nonmatchings/ov_SC01_074_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017EBAC[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017EBAC[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017EBAC[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017EBAC[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017EBAC[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC01_074/ov_SC01_074_jr_80154C24.c b/src/ov_SC01_074/ov_SC01_074_jr_80154C24.c index b4069dcade..bf7f384508 100644 --- a/src/ov_SC01_074/ov_SC01_074_jr_80154C24.c +++ b/src/ov_SC01_074/ov_SC01_074_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_074/nonmatchings/ov_SC01_074_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80180934)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80180934[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80180934[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC01_080/ov_SC01_080_jr_80135D20.c b/src/ov_SC01_080/ov_SC01_080_jr_80135D20.c index 370ba64f57..384c5181f5 100644 --- a/src/ov_SC01_080/ov_SC01_080_jr_80135D20.c +++ b/src/ov_SC01_080/ov_SC01_080_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_080/nonmatchings/ov_SC01_080_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80183B0C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80183B0C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80183B0C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80183B0C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80183B0C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC01_080/ov_SC01_080_jr_80154C24.c b/src/ov_SC01_080/ov_SC01_080_jr_80154C24.c index ea71f928c2..9f459645f1 100644 --- a/src/ov_SC01_080/ov_SC01_080_jr_80154C24.c +++ b/src/ov_SC01_080/ov_SC01_080_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_080/nonmatchings/ov_SC01_080_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80185894)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80185894[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80185894[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC01_084/ov_SC01_084_jr_80135D20.c b/src/ov_SC01_084/ov_SC01_084_jr_80135D20.c index 4969dea926..0263a623d5 100644 --- a/src/ov_SC01_084/ov_SC01_084_jr_80135D20.c +++ b/src/ov_SC01_084/ov_SC01_084_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_084/nonmatchings/ov_SC01_084_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80186E00[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80186E00[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80186E00[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80186E00[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80186E00[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC01_084/ov_SC01_084_jr_80154C24.c b/src/ov_SC01_084/ov_SC01_084_jr_80154C24.c index 05c6d96235..6b821ff835 100644 --- a/src/ov_SC01_084/ov_SC01_084_jr_80154C24.c +++ b/src/ov_SC01_084/ov_SC01_084_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC01_084/nonmatchings/ov_SC01_084_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80188B88)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80188B88[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80188B88[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_000/ov_SC02_000_jr_80135D20.c b/src/ov_SC02_000/ov_SC02_000_jr_80135D20.c index d9426182e5..2e4b12879e 100644 --- a/src/ov_SC02_000/ov_SC02_000_jr_80135D20.c +++ b/src/ov_SC02_000/ov_SC02_000_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018B1B0[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018B1B0[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018B1B0[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018B1B0[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018B1B0[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_000/ov_SC02_000_jr_80154C24.c b/src/ov_SC02_000/ov_SC02_000_jr_80154C24.c index 99a9649ccf..7f08f3c6ce 100644 --- a/src/ov_SC02_000/ov_SC02_000_jr_80154C24.c +++ b/src/ov_SC02_000/ov_SC02_000_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018CF38)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018CF38[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018CF38[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_000/ov_SC02_000_jr_8017FCB0.c b/src/ov_SC02_000/ov_SC02_000_jr_8017FCB0.c index 9a441f6b67..8e396616fe 100644 --- a/src/ov_SC02_000/ov_SC02_000_jr_8017FCB0.c +++ b/src/ov_SC02_000/ov_SC02_000_jr_8017FCB0.c @@ -3382,7 +3382,39 @@ INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_80183BA DEFINE_func_80183C94() /* dedup: shared engine-core @0x80183C94 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_80183C9C); +extern s32 func_8013767C(s32 a0); +extern void func_80147324(s32 a0); +void func_80183C9C(s32 a0) { + + extern s16 D_8018EDD8[]; + extern u8 D_801A7CB0; + s16 v; + s16 d; + v = D_8018EDD8[*(u8 *)(a0 + 0x20C)]; + if (v != 0) { + d = v - *(u16 *)(a0 + 0xE); + v = d; + if (d < 0) { + v = -d; + } + if (v < 0x180) { + *(s32 *)(a0 + 0x198) = func_8013767C((s32)&D_801A7CB0); + switch (*(u8 *)(a0 + 0x20C)) { + case 0: + func_80147324(0x5A1); + break; + case 1: + func_80147324(0x5F1); + break; + case 2: + func_80147324(0x5F2); + break; + } + *(u8 *)(a0 + 0x20C) += 1; + } + } +} + INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_80183D80); @@ -3590,9 +3622,42 @@ INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_8018711 INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_801871B8); -INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_80187254); +extern void func_8012CBCC(s32 a0); +extern s32 func_80143B6C(s32 a0, s32 a1); +s32 func_80187254(s32 param_1) { + s32 p; + p = *(s32 *)(param_1 + 0x20); + *(s16 *)(p + 0x12) = *(u16 *)(p + 0x12) + 0x100; + if (((s32 (*)(void))func_8012CBCC)() != 0) { + *(s32 *)(param_1 + 0x18) = 0xFFE80000; + *(s32 *)(param_1 + 0x14) = 0xFFC80000; + *(s32 *)(param_1 + 0x44) = 0; + *(s32 *)(param_1 + 0x48) = 0x80000; + *(s32 *)(param_1 + 0x4C) = 0; + func_80143B6C(param_1, 0); + *(s16 *)(param_1 + 0xFC) = 0x40; + *(s16 *)(param_1 + 0x2) = *(u16 *)(param_1 + 0x2) + 1; + } +} + + +extern void func_8012AD80(s32 a0); +extern void func_8012C218(void *a0); +void func_801872D8(int param_1) { + short v; + *(short *)(*(int *)(param_1 + 0x20) + 0x12) = + *(short *)(*(int *)(param_1 + 0x20) + 0x12) + 0x100; + *(short *)(*(int *)(param_1 + 0x20) + 0x14) = + *(short *)(*(int *)(param_1 + 0x20) + 0x14) + 0x20; + v = *(unsigned short *)(param_1 + 0xFC) - 1; + *(short *)(param_1 + 0xFC) = v; + if (v == 0) { + ((void (*)(void))func_8012C218)(); + } else { + ((void (*)(void))func_8012AD80)(); + } +} -INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_801872D8); INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_80187354); @@ -3614,7 +3679,23 @@ INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_8018773 INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_80187834); -INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_801878D0); +extern void func_8012AD80(s32 a0); +extern void func_8012C218(void *a0); +void func_801878D0(int param_1) { + short v; + *(short *)(*(int *)(param_1 + 0x20) + 0x12) = + *(short *)(*(int *)(param_1 + 0x20) + 0x12) + 0x100; + *(short *)(*(int *)(param_1 + 0x20) + 0x14) = + *(short *)(*(int *)(param_1 + 0x20) + 0x14) + 0x20; + v = *(unsigned short *)(param_1 + 0xFC) - 1; + *(short *)(param_1 + 0xFC) = v; + if (v == 0) { + ((void (*)(void))func_8012C218)(); + } else { + ((void (*)(void))func_8012AD80)(); + } +} + extern void (*D_8018F46C[])(void); @@ -3630,7 +3711,23 @@ INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_80187B4 INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_80187DB8); -INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_80187EB4); +extern void func_8012AD80(s32 a0); +extern void func_8012C218(void *a0); +void func_80187EB4(int param_1) { + short v; + *(short *)(*(int *)(param_1 + 0x20) + 0x12) = + *(short *)(*(int *)(param_1 + 0x20) + 0x12) + 0x100; + *(short *)(*(int *)(param_1 + 0x20) + 0x14) = + *(short *)(*(int *)(param_1 + 0x20) + 0x14) + 0x20; + v = *(unsigned short *)(param_1 + 0xFC) - 1; + *(short *)(param_1 + 0xFC) = v; + if (v == 0) { + ((void (*)(void))func_8012C218)(); + } else { + ((void (*)(void))func_8012AD80)(); + } +} + INCLUDE_ASM("asm/ov_SC02_000/nonmatchings/ov_SC02_000_jr_8017FCB0", func_80187F30); diff --git a/src/ov_SC02_003/ov_SC02_003_jr_80135D20.c b/src/ov_SC02_003/ov_SC02_003_jr_80135D20.c index 23737b8c00..2e4b12879e 100644 --- a/src/ov_SC02_003/ov_SC02_003_jr_80135D20.c +++ b/src/ov_SC02_003/ov_SC02_003_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018B1B0[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018B1B0[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018B1B0[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018B1B0[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018B1B0[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_003/ov_SC02_003_jr_80154C24.c b/src/ov_SC02_003/ov_SC02_003_jr_80154C24.c index 16563eba3e..7f08f3c6ce 100644 --- a/src/ov_SC02_003/ov_SC02_003_jr_80154C24.c +++ b/src/ov_SC02_003/ov_SC02_003_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018CF38)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018CF38[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018CF38[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_003/ov_SC02_003_jr_8017FCB0.c b/src/ov_SC02_003/ov_SC02_003_jr_8017FCB0.c index 2803c665a3..b3c71d2db5 100644 --- a/src/ov_SC02_003/ov_SC02_003_jr_8017FCB0.c +++ b/src/ov_SC02_003/ov_SC02_003_jr_8017FCB0.c @@ -3366,7 +3366,39 @@ INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_80183BA DEFINE_func_80183C94() /* dedup: shared engine-core @0x80183C94 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_80183C9C); +extern s32 func_8013767C(s32 a0); +extern void func_80147324(s32 a0); +void func_80183C9C(s32 a0) { + + extern s16 D_8018EDD8[]; + extern u8 D_801A7CB0; + s16 v; + s16 d; + v = D_8018EDD8[*(u8 *)(a0 + 0x20C)]; + if (v != 0) { + d = v - *(u16 *)(a0 + 0xE); + v = d; + if (d < 0) { + v = -d; + } + if (v < 0x180) { + *(s32 *)(a0 + 0x198) = func_8013767C((s32)&D_801A7CB0); + switch (*(u8 *)(a0 + 0x20C)) { + case 0: + func_80147324(0x5A1); + break; + case 1: + func_80147324(0x5F1); + break; + case 2: + func_80147324(0x5F2); + break; + } + *(u8 *)(a0 + 0x20C) += 1; + } + } +} + INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_80183D80); @@ -3565,9 +3597,42 @@ INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_8018711 INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_801871B8); -INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_80187254); +extern void func_8012CBCC(s32 a0); +extern s32 func_80143B6C(s32 a0, s32 a1); +s32 func_80187254(s32 param_1) { + s32 p; + p = *(s32 *)(param_1 + 0x20); + *(s16 *)(p + 0x12) = *(u16 *)(p + 0x12) + 0x100; + if (((s32 (*)(void))func_8012CBCC)() != 0) { + *(s32 *)(param_1 + 0x18) = 0xFFE80000; + *(s32 *)(param_1 + 0x14) = 0xFFC80000; + *(s32 *)(param_1 + 0x44) = 0; + *(s32 *)(param_1 + 0x48) = 0x80000; + *(s32 *)(param_1 + 0x4C) = 0; + func_80143B6C(param_1, 0); + *(s16 *)(param_1 + 0xFC) = 0x40; + *(s16 *)(param_1 + 0x2) = *(u16 *)(param_1 + 0x2) + 1; + } +} + + +extern void func_8012AD80(s32 a0); +extern void func_8012C218(void *a0); +void func_801872D8(int param_1) { + short v; + *(short *)(*(int *)(param_1 + 0x20) + 0x12) = + *(short *)(*(int *)(param_1 + 0x20) + 0x12) + 0x100; + *(short *)(*(int *)(param_1 + 0x20) + 0x14) = + *(short *)(*(int *)(param_1 + 0x20) + 0x14) + 0x20; + v = *(unsigned short *)(param_1 + 0xFC) - 1; + *(short *)(param_1 + 0xFC) = v; + if (v == 0) { + ((void (*)(void))func_8012C218)(); + } else { + ((void (*)(void))func_8012AD80)(); + } +} -INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_801872D8); INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_80187354); @@ -3589,7 +3654,23 @@ INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_8018773 INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_80187834); -INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_801878D0); +extern void func_8012AD80(s32 a0); +extern void func_8012C218(void *a0); +void func_801878D0(int param_1) { + short v; + *(short *)(*(int *)(param_1 + 0x20) + 0x12) = + *(short *)(*(int *)(param_1 + 0x20) + 0x12) + 0x100; + *(short *)(*(int *)(param_1 + 0x20) + 0x14) = + *(short *)(*(int *)(param_1 + 0x20) + 0x14) + 0x20; + v = *(unsigned short *)(param_1 + 0xFC) - 1; + *(short *)(param_1 + 0xFC) = v; + if (v == 0) { + ((void (*)(void))func_8012C218)(); + } else { + ((void (*)(void))func_8012AD80)(); + } +} + extern void (*D_8018F46C[])(void); @@ -3605,7 +3686,23 @@ INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_80187B4 INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_80187DB8); -INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_80187EB4); +extern void func_8012AD80(s32 a0); +extern void func_8012C218(void *a0); +void func_80187EB4(int param_1) { + short v; + *(short *)(*(int *)(param_1 + 0x20) + 0x12) = + *(short *)(*(int *)(param_1 + 0x20) + 0x12) + 0x100; + *(short *)(*(int *)(param_1 + 0x20) + 0x14) = + *(short *)(*(int *)(param_1 + 0x20) + 0x14) + 0x20; + v = *(unsigned short *)(param_1 + 0xFC) - 1; + *(short *)(param_1 + 0xFC) = v; + if (v == 0) { + ((void (*)(void))func_8012C218)(); + } else { + ((void (*)(void))func_8012AD80)(); + } +} + INCLUDE_ASM("asm/ov_SC02_003/nonmatchings/ov_SC02_003_jr_8017FCB0", func_80187F30); diff --git a/src/ov_SC02_004/ov_SC02_004_jr_80135D20.c b/src/ov_SC02_004/ov_SC02_004_jr_80135D20.c index cf55f05512..12675093e0 100644 --- a/src/ov_SC02_004/ov_SC02_004_jr_80135D20.c +++ b/src/ov_SC02_004/ov_SC02_004_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_004/nonmatchings/ov_SC02_004_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017E290[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017E290[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017E290[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017E290[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017E290[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_004/ov_SC02_004_jr_80154C24.c b/src/ov_SC02_004/ov_SC02_004_jr_80154C24.c index f439ca2e1b..9f9890a09c 100644 --- a/src/ov_SC02_004/ov_SC02_004_jr_80154C24.c +++ b/src/ov_SC02_004/ov_SC02_004_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_004/nonmatchings/ov_SC02_004_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80180018)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80180018[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80180018[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_005/ov_SC02_005_jr_80135D20.c b/src/ov_SC02_005/ov_SC02_005_jr_80135D20.c index e05297b9f0..f408b909e4 100644 --- a/src/ov_SC02_005/ov_SC02_005_jr_80135D20.c +++ b/src/ov_SC02_005/ov_SC02_005_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_005/nonmatchings/ov_SC02_005_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80190E94[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80190E94[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80190E94[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80190E94[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80190E94[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_005/ov_SC02_005_jr_80154C24.c b/src/ov_SC02_005/ov_SC02_005_jr_80154C24.c index 334174b0af..94331c137e 100644 --- a/src/ov_SC02_005/ov_SC02_005_jr_80154C24.c +++ b/src/ov_SC02_005/ov_SC02_005_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_005/nonmatchings/ov_SC02_005_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80192C1C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80192C1C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80192C1C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_011/ov_SC02_011_jr_80135D20.c b/src/ov_SC02_011/ov_SC02_011_jr_80135D20.c index 55c965346c..a310487166 100644 --- a/src/ov_SC02_011/ov_SC02_011_jr_80135D20.c +++ b/src/ov_SC02_011/ov_SC02_011_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_011/nonmatchings/ov_SC02_011_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801912E4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801912E4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801912E4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801912E4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801912E4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_011/ov_SC02_011_jr_80154C24.c b/src/ov_SC02_011/ov_SC02_011_jr_80154C24.c index 2dc63bc5f1..214bd90c02 100644 --- a/src/ov_SC02_011/ov_SC02_011_jr_80154C24.c +++ b/src/ov_SC02_011/ov_SC02_011_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_011/nonmatchings/ov_SC02_011_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8019306C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8019306C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8019306C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c b/src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c index 105bdcfcc0..cfb6e6de8a 100644 --- a/src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c +++ b/src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c @@ -3755,7 +3755,15 @@ void func_8018045C(void *a0) { } -INCLUDE_ASM("asm/ov_SC02_011/nonmatchings/ov_SC02_011_jr_8017AE2C", func_80180498); +extern void func_80147324(s32 arg0); +void func_80180498(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3784,7 +3792,20 @@ INCLUDE_ASM("asm/ov_SC02_011/nonmatchings/ov_SC02_011_jr_8017AE2C", func_8018054 INCLUDE_ASM("asm/ov_SC02_011/nonmatchings/ov_SC02_011_jr_8017AE2C", func_801805C8); -INCLUDE_ASM("asm/ov_SC02_011/nonmatchings/ov_SC02_011_jr_8017AE2C", func_80180730); +extern void func_8018077C(int); +extern void func_80146C3C(void); +void func_80180730(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8018077C(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC02_011/nonmatchings/ov_SC02_011_jr_8017AE2C", func_8018077C); @@ -3796,7 +3817,13 @@ void func_80180A88(void *a0) { } -INCLUDE_ASM("asm/ov_SC02_011/nonmatchings/ov_SC02_011_jr_8017AE2C", func_80180AC4); +extern void func_80147324(s32 arg0); +void func_80180AC4(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_80180B04 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3898,7 +3925,25 @@ void func_80180C00(void *a0) } -INCLUDE_ASM("asm/ov_SC02_011/nonmatchings/ov_SC02_011_jr_8017AE2C", func_80180CD4); +extern void func_8018077C(int); +extern void func_80146C3C(void); +void func_80180CD4(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8018077C)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_80194ED8[])(void); @@ -3910,7 +3955,22 @@ void func_80180D28(void *a0) { INCLUDE_ASM("asm/ov_SC02_011/nonmatchings/ov_SC02_011_jr_8017AE2C", func_80180D64); -INCLUDE_ASM("asm/ov_SC02_011/nonmatchings/ov_SC02_011_jr_8017AE2C", func_80180E18); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_80180E74(void *a0); +void func_80180E18(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_80180E74(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC02_011/nonmatchings/ov_SC02_011_jr_8017AE2C", func_80180E74); diff --git a/src/ov_SC02_015/ov_SC02_015_jr_80135D20.c b/src/ov_SC02_015/ov_SC02_015_jr_80135D20.c index 8f0f92f682..b65c158b3b 100644 --- a/src/ov_SC02_015/ov_SC02_015_jr_80135D20.c +++ b/src/ov_SC02_015/ov_SC02_015_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_015/nonmatchings/ov_SC02_015_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017E7F8[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017E7F8[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017E7F8[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017E7F8[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017E7F8[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_015/ov_SC02_015_jr_80154C24.c b/src/ov_SC02_015/ov_SC02_015_jr_80154C24.c index 62bea43ad1..a741691e25 100644 --- a/src/ov_SC02_015/ov_SC02_015_jr_80154C24.c +++ b/src/ov_SC02_015/ov_SC02_015_jr_80154C24.c @@ -1657,7 +1657,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_015/nonmatchings/ov_SC02_015_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80180580)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80180580[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80180580[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_016/ov_SC02_016_jr_80135D20.c b/src/ov_SC02_016/ov_SC02_016_jr_80135D20.c index b6257cb315..83d2f1415c 100644 --- a/src/ov_SC02_016/ov_SC02_016_jr_80135D20.c +++ b/src/ov_SC02_016/ov_SC02_016_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80184A30[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80184A30[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80184A30[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80184A30[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80184A30[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_016/ov_SC02_016_jr_80154C24.c b/src/ov_SC02_016/ov_SC02_016_jr_80154C24.c index fa27ccfbe5..33bed27ce6 100644 --- a/src/ov_SC02_016/ov_SC02_016_jr_80154C24.c +++ b/src/ov_SC02_016/ov_SC02_016_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801867B8)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801867B8[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801867B8[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_016/ov_SC02_016_jr_8017AE2C.c b/src/ov_SC02_016/ov_SC02_016_jr_8017AE2C.c index 331bcd8f50..a5e06ebaca 100644 --- a/src/ov_SC02_016/ov_SC02_016_jr_8017AE2C.c +++ b/src/ov_SC02_016/ov_SC02_016_jr_8017AE2C.c @@ -3485,7 +3485,15 @@ void func_8017D0E8(void *a0) { } -INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_8017AE2C", func_8017D124); +extern void func_80147324(s32 arg0); +void func_8017D124(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3514,7 +3522,20 @@ INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_8017AE2C", func_8017D1D INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_8017AE2C", func_8017D254); -INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_8017AE2C", func_8017D3BC); +extern void func_8017D408(int); +extern void func_80146C3C(void); +void func_8017D3BC(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D408(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_8017AE2C", func_8017D408); @@ -3526,7 +3547,13 @@ void func_8017D714(void *a0) { } -INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_8017AE2C", func_8017D750); +extern void func_80147324(s32 arg0); +void func_8017D750(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D790 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3628,7 +3655,25 @@ void func_8017D88C(void *a0) } -INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_8017AE2C", func_8017D960); +extern void func_8017D408(int); +extern void func_80146C3C(void); +void func_8017D960(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D408)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_80188020[])(void); @@ -3640,7 +3685,22 @@ void func_8017D9B4(void *a0) { INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_8017AE2C", func_8017D9F0); -INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_8017AE2C", func_8017DAA4); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017DB00(void *a0); +void func_8017DAA4(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017DB00(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_8017AE2C", func_8017DB00); diff --git a/src/ov_SC02_016/ov_SC02_016_jr_8017DC70.c b/src/ov_SC02_016/ov_SC02_016_jr_8017DC70.c index 0f00bb3e1a..1f4f940c50 100644 --- a/src/ov_SC02_016/ov_SC02_016_jr_8017DC70.c +++ b/src/ov_SC02_016/ov_SC02_016_jr_8017DC70.c @@ -3546,7 +3546,17 @@ INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_8017DC70", func_8018214 INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_8017DC70", func_80182184); -INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_8017DC70", func_801821CC); + +extern void func_80019064(void *a0); + +void func_801821CC(void *a0) { + + extern u8 D_801886BC; + extern void (*D_801886E4[])(void *); + func_80019064(&D_801886BC); + D_801886E4[*(u16 *)((s32)a0 + 0x2)](a0); +} + INCLUDE_ASM("asm/ov_SC02_016/nonmatchings/ov_SC02_016_jr_8017DC70", func_80182224); diff --git a/src/ov_SC02_017/ov_SC02_017_jr_80135D20.c b/src/ov_SC02_017/ov_SC02_017_jr_80135D20.c index 30188e28c7..06fb96aaaf 100644 --- a/src/ov_SC02_017/ov_SC02_017_jr_80135D20.c +++ b/src/ov_SC02_017/ov_SC02_017_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018AA88[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018AA88[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018AA88[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018AA88[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018AA88[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_017/ov_SC02_017_jr_80154C24.c b/src/ov_SC02_017/ov_SC02_017_jr_80154C24.c index 4152ff06c1..b0c2627945 100644 --- a/src/ov_SC02_017/ov_SC02_017_jr_80154C24.c +++ b/src/ov_SC02_017/ov_SC02_017_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018C810)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018C810[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018C810[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_017/ov_SC02_017_jr_8017AE2C.c b/src/ov_SC02_017/ov_SC02_017_jr_8017AE2C.c index 60f35a65ce..7de4b5ea89 100644 --- a/src/ov_SC02_017/ov_SC02_017_jr_8017AE2C.c +++ b/src/ov_SC02_017/ov_SC02_017_jr_8017AE2C.c @@ -3479,7 +3479,15 @@ void func_8017D0E8(void *a0) { } -INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017AE2C", func_8017D124); +extern void func_80147324(s32 arg0); +void func_8017D124(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3508,7 +3516,20 @@ INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017AE2C", func_8017D1D INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017AE2C", func_8017D254); -INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017AE2C", func_8017D3BC); +extern void func_8017D408(int); +extern void func_80146C3C(void); +void func_8017D3BC(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D408(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017AE2C", func_8017D408); @@ -3520,7 +3541,13 @@ void func_8017D714(void *a0) { } -INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017AE2C", func_8017D750); +extern void func_80147324(s32 arg0); +void func_8017D750(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D790 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3622,7 +3649,25 @@ void func_8017D88C(void *a0) } -INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017AE2C", func_8017D960); +extern void func_8017D408(int); +extern void func_80146C3C(void); +void func_8017D960(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D408)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_8018E078[])(void); @@ -3634,7 +3679,22 @@ void func_8017D9B4(void *a0) { INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017AE2C", func_8017D9F0); -INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017AE2C", func_8017DAA4); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017DB00(void *a0); +void func_8017DAA4(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017DB00(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017AE2C", func_8017DB00); diff --git a/src/ov_SC02_017/ov_SC02_017_jr_8017DF34.c b/src/ov_SC02_017/ov_SC02_017_jr_8017DF34.c index 5d9e12a50f..39235177fc 100644 --- a/src/ov_SC02_017/ov_SC02_017_jr_8017DF34.c +++ b/src/ov_SC02_017/ov_SC02_017_jr_8017DF34.c @@ -383,7 +383,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -613,7 +612,6 @@ extern s32 func_8014E83C(s32 arg0, s16 * arg1, s16 * arg2); extern void func_8014E934(s32 _arg0); extern s32 func_8014EA4C(void *a0, void *a1, void *a2, s32 a3); extern s32 func_8014E98C(void *a0); -extern u16 D_800B99DA; extern s32 D_801150D8; extern s16 D_801152AA; extern u8 D_80126720[]; @@ -3353,7 +3351,50 @@ INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017DF34", func_8017F3B INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017DF34", func_8017F474); -INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017DF34", func_8017F4AC); + +// func_8017F4AC — MATCH (60 ins), match_one + rtu_match. Two levers: +// 1) §20 pointer-var-to-the-global: `u16 *p = &D_800B99DA;` and read `*p` +// twice. The bare global would fold %lo into each access independently +// (two lui/lhu pairs, no $s1); the pointer var force_regs the address so +// CSE hoists it into the callee-saved $s1 across both calls. +// 2) SEPARATE temps `t` and `u` for the two call results (NOT one reused +// `t`). gcc-2.7.2 expand_divmod emits `move temp,op0; bgez temp; temp+=d-1` +// for a signed /2^k; cse.c make_regs_eqv only makes `temp` the canonical +// reg of the quantity when temp's REGNO_LAST_UID outlives op0's. Reusing +// one `t` across both calls stretches op0's last-use past temp's, so op0 +// stays canonical and cse rewrites the pair to `bgez $v0` + `addiu +// $v1,$v0,3` — the copy then fills the delay slot and the function comes +// out 1 instruction short. Split temps ⇒ op0 dies immediately ⇒ target's +// `addu $v1,$v0,$zero; bgez $v1; nop; addiu $v1,$v1,3`. +// (The 2nd division still coalesces temp/u into $v0, matching `bgez $v0`.) + +extern s32 func_80012F74(s32 a0, s32 a1, s32 a2, s32 a3); +extern s32 func_80047948(s32 a0); +extern s32 func_8004787C(s32 a0); + +void func_8017F4AC(s32 param_1) { + + extern u16 D_800B99DA; + u16 *p = &D_800B99DA; + s32 t; + s32 u; + + *(s16 *)(param_1 + 0x20E) = func_80012F74(*(s16 *)(param_1 + 0x20E), 0, 10, 1); + *(s16 *)(param_1 + 0x12E) = 1; + t = func_8004787C((*p & 0x3F) << 6); + *(s16 *)(param_1 + 0x128) = *(s16 *)(param_1 + 0x20E) + t / 4; + u = func_80047948((*p & 0x3F) << 6); + *(s16 *)(param_1 + 0x12C) = u / 8; + if (*(s16 *)(param_1 + 0x13A) != 0) { + *(s16 *)(param_1 + 0x13A) += *(s8 *)(param_1 + 0x20D); + *(s16 *)(param_1 + 0x20C) -= 0xE0; + if (*(s16 *)(param_1 + 0x13A) < 0) { + *(s16 *)(param_1 + 0x13A) = 0; + *(s16 *)(param_1 + 0x20C) = 0; + } + } +} + extern void func_8016EE40(s32 a0, s32 a1, s32 a2); extern s32 D_8018E17C; @@ -4664,7 +4705,34 @@ extern void func_8012C098(void); INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017DF34", func_80187F18); -INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017DF34", func_80187F84); + +/* func_80187F84 — light/colour ramp-up on the entity's attached prim block. + * + * If the s16 flag at 0xFE is set, bump the three u16 colour words at + * 0x18/0x1A/0x1C of the block pointed to by the word at 0x20 by 0x40 each, + * then clamp all three to 0x1800 once the first one reaches it. + * + * Widths pinned off the target: `lh` at 0xFE and at 0x18 (the signed compare), + * `lhu` for the three read-modify-writes, `sh` for every store. The pointer at + * 0x20 is re-loaded before each RMW (the `sh` stores may alias it), which is + * exactly what writing the deref inline gives. + */ +void func_80187F84(int param_1) { + int v1; + + if (*(short *)(param_1 + 0xfe) != 0) { + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x18) += 0x40; + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x1a) += 0x40; + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x1c) += 0x40; + v1 = *(int *)(param_1 + 0x20); + if (*(short *)(v1 + 0x18) >= 0x1800) { + *(short *)(v1 + 0x1c) = 0x1800; + *(short *)(v1 + 0x1a) = 0x1800; + *(short *)(v1 + 0x18) = 0x1800; + } + } +} + INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017DF34", func_8018800C); @@ -5363,7 +5431,31 @@ INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017DF34", func_80189EE INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017DF34", func_8018A17C); -INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017DF34", func_8018A310); + +/* func_8018A310 — "is another entity of type 0x35C sharing my 0x64 owner?" + * + * Walks the 0x60-entry entity table at D_801202A0 (stride 0x10C) with an int + * counter (the target keeps the count in $a2 and `slti ...,0x60`, so it is a + * counted loop, NOT the D_80126720 pointer-bound idiom the sibling walkers + * use). Returns 1 for the first entry whose u16 kind == 0x35C, whose word at + * 0x64 equals the caller's word at 0x64, and which is not the caller itself. + */ +s32 func_8018A310(s32 arg0) { + extern u8 D_801202A0[]; + u8 *p; + s32 i; + + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == 0x35C && *(s32 *)(arg0 + 0x64) == *(s32 *)(p + 0x64) && + arg0 != (s32)p) { + return 1; + } + p += 0x10C; + } + return 0; +} + extern void func_8012EC04(s32 param_1, s32 param_2, s32 *param_3); @@ -5385,7 +5477,24 @@ void func_8018A368(s32 arg0) { } -INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017DF34", func_8018A3E4); + +/* func_8018A3E4 — guard-then-free tail (cookbook §71 sibling shape: + * src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c func_80144458 tail, and + * src/ov_SC03_099/ov_SC03_099_jr_80140608.c:2432 func_80016714(x, 0x38)). */ + +extern void func_80016714(void *a0, s32 a1); +extern void func_8012C218(void *a0); + +void func_8018A3E4(void *arg0) { + void *temp_a0; + + temp_a0 = *(void **)((char *)arg0 + 0xCC); + if (temp_a0 != NULL) { + func_80016714(temp_a0, 0x38); + } + func_8012C218(arg0); +} + INCLUDE_ASM("asm/ov_SC02_017/nonmatchings/ov_SC02_017_jr_8017DF34", func_8018A428); diff --git a/src/ov_SC02_021/ov_SC02_021_jr_80135D20.c b/src/ov_SC02_021/ov_SC02_021_jr_80135D20.c index ddc823ea52..b8abf78b58 100644 --- a/src/ov_SC02_021/ov_SC02_021_jr_80135D20.c +++ b/src/ov_SC02_021/ov_SC02_021_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_021/nonmatchings/ov_SC02_021_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018007C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018007C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018007C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018007C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018007C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_021/ov_SC02_021_jr_80154C24.c b/src/ov_SC02_021/ov_SC02_021_jr_80154C24.c index 8a6bfc4db3..8340768535 100644 --- a/src/ov_SC02_021/ov_SC02_021_jr_80154C24.c +++ b/src/ov_SC02_021/ov_SC02_021_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_021/nonmatchings/ov_SC02_021_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80181E04)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80181E04[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80181E04[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_026/ov_SC02_026_jr_80135D20.c b/src/ov_SC02_026/ov_SC02_026_jr_80135D20.c index 854bc490bd..c824173ad9 100644 --- a/src/ov_SC02_026/ov_SC02_026_jr_80135D20.c +++ b/src/ov_SC02_026/ov_SC02_026_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_026/nonmatchings/ov_SC02_026_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801866D0[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801866D0[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801866D0[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801866D0[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801866D0[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_026/ov_SC02_026_jr_80154C24.c b/src/ov_SC02_026/ov_SC02_026_jr_80154C24.c index c9f6fa5e0e..d91274abdf 100644 --- a/src/ov_SC02_026/ov_SC02_026_jr_80154C24.c +++ b/src/ov_SC02_026/ov_SC02_026_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_026/nonmatchings/ov_SC02_026_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80188458)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80188458[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80188458[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_026/ov_SC02_026_jr_8017C180.c b/src/ov_SC02_026/ov_SC02_026_jr_8017C180.c index e294aae8f0..5f9715e653 100644 --- a/src/ov_SC02_026/ov_SC02_026_jr_8017C180.c +++ b/src/ov_SC02_026/ov_SC02_026_jr_8017C180.c @@ -3175,7 +3175,21 @@ void func_8017C180(s32 arg0) INCLUDE_ASM("asm/ov_SC02_026/nonmatchings/ov_SC02_026_jr_8017C180", func_8017D060); -INCLUDE_ASM("asm/ov_SC02_026/nonmatchings/ov_SC02_026_jr_8017C180", func_8017D0A0); + +extern int func_8017D918(int param_1); + +void func_8017D0A0(void) +{ + + extern u8 D_80189FA4[]; + extern u8 D_8018A01C[]; + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_80189FA4; + D_801274CC = D_8018A01C; + func_8017D918(1); +} + extern void (*D_80189BBC[])(void); diff --git a/src/ov_SC02_027/ov_SC02_027_jr_80135D20.c b/src/ov_SC02_027/ov_SC02_027_jr_80135D20.c index 21f367188b..f650012f8d 100644 --- a/src/ov_SC02_027/ov_SC02_027_jr_80135D20.c +++ b/src/ov_SC02_027/ov_SC02_027_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018B7F4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018B7F4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018B7F4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018B7F4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018B7F4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_027/ov_SC02_027_jr_80154C24.c b/src/ov_SC02_027/ov_SC02_027_jr_80154C24.c index bfdd309711..544755361b 100644 --- a/src/ov_SC02_027/ov_SC02_027_jr_80154C24.c +++ b/src/ov_SC02_027/ov_SC02_027_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018D57C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018D57C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018D57C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_027/ov_SC02_027_jr_8017AE2C.c b/src/ov_SC02_027/ov_SC02_027_jr_8017AE2C.c index fba96d5fab..b991fbe394 100644 --- a/src/ov_SC02_027/ov_SC02_027_jr_8017AE2C.c +++ b/src/ov_SC02_027/ov_SC02_027_jr_8017AE2C.c @@ -3370,7 +3370,15 @@ void func_8017CD10(void *a0) { } -INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017AE2C", func_8017CD4C); +extern void func_80147324(s32 arg0); +void func_8017CD4C(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3399,7 +3407,20 @@ INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017AE2C", func_8017CDF INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017AE2C", func_8017CE7C); -INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017AE2C", func_8017CFE4); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017CFE4(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D030(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017AE2C", func_8017D030); @@ -3411,7 +3432,13 @@ void func_8017D33C(void *a0) { } -INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017AE2C", func_8017D378); +extern void func_80147324(s32 arg0); +void func_8017D378(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D3B8 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3513,7 +3540,25 @@ void func_8017D4B4(void *a0) } -INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017AE2C", func_8017D588); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017D588(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D030)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_8018EDBC[])(void); @@ -3525,7 +3570,22 @@ void func_8017D5DC(void *a0) { INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017AE2C", func_8017D618); -INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017AE2C", func_8017D6CC); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017D728(void *a0); +void func_8017D6CC(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017D728(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017AE2C", func_8017D728); diff --git a/src/ov_SC02_027/ov_SC02_027_jr_8017D898.c b/src/ov_SC02_027/ov_SC02_027_jr_8017D898.c index a8a7672707..612c523633 100644 --- a/src/ov_SC02_027/ov_SC02_027_jr_8017D898.c +++ b/src/ov_SC02_027/ov_SC02_027_jr_8017D898.c @@ -3187,12 +3187,15 @@ INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017D898", func_8017E77 extern u8 D_8018F8F0[]; extern u8 D_8018F990[]; -extern u8 *D_801274C8; -extern void *D_801274CC; extern int func_8017FAB0(int param_1); void func_8017E7B8(void) { + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; D_801274C8 = D_8018F8F0; D_801274CC = D_8018F990; func_8017FAB0(1); @@ -3201,11 +3204,59 @@ void func_8017E7B8(void) INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017D898", func_8017E7F8); -INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017D898", func_8017E844); -INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017D898", func_8017E884); +extern int func_8017FAB0(int param_1); + +void func_8017E844(void) +{ + + extern u8 D_8018FB0C[]; + extern u8 D_8018FBC0[]; + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018FB0C; + D_801274CC = D_8018FBC0; + func_8017FAB0(3); +} + + + +extern int func_8017FAB0(int param_1); + +void func_8017E884(void) +{ + + extern u8 D_8018FBD4[]; + extern u8 D_8018FC38[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018FBD4; + D_801274CC = D_8018FC38; + func_8017FAB0(4); +} + + + +extern int func_8017FAB0(int param_1); + +void func_8017E8C4(void) +{ + + extern u8 D_8018FC4C[]; + extern u8 D_8018FCD8[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018FC4C; + D_801274CC = D_8018FCD8; + func_8017FAB0(5); +} -INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017D898", func_8017E8C4); INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017D898", func_8017E904); @@ -3864,7 +3915,38 @@ INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017D898", func_80184EE INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017D898", func_80184F10); -INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017D898", func_80184F94); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_80184F94(s32 a0) { + + extern u8 D_801AD670[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_801AD670); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -3933,9 +4015,70 @@ void func_801851A8(s32 a0) { void func_80185284(void) { } -INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017D898", func_8018528C); -INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017D898", func_80185344); +/* func_8018528C — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_8018528C(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32 a0, s32 a1); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_80185344(s32 a0) { + + extern u8 D_801AD738[]; + extern u8 D_8018B56C[]; + extern u16 D_801AD76C[]; + extern u16 D_801AD76E[]; + extern u16 D_801AD770[]; + extern s16 D_801AD772[]; + if (func_8012C354(a0, (s32)D_801AD738) != 0) { + func_8012A828(a0, (s32)D_8018B56C); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_801AD76C[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_801AD76E[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_801AD770[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_801AD772[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017D898", func_80185408); @@ -3980,7 +4123,29 @@ void func_801854D8(s32 param_1) } -INCLUDE_ASM("asm/ov_SC02_027/nonmatchings/ov_SC02_027_jr_8017D898", func_801855BC); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_801855BC(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); diff --git a/src/ov_SC02_028/ov_SC02_028_jr_80135D20.c b/src/ov_SC02_028/ov_SC02_028_jr_80135D20.c index 0bc3560cd2..88a63732d3 100644 --- a/src/ov_SC02_028/ov_SC02_028_jr_80135D20.c +++ b/src/ov_SC02_028/ov_SC02_028_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018B9F8[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018B9F8[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018B9F8[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018B9F8[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018B9F8[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_028/ov_SC02_028_jr_80154C24.c b/src/ov_SC02_028/ov_SC02_028_jr_80154C24.c index 2c84ecda42..ac6deeef4a 100644 --- a/src/ov_SC02_028/ov_SC02_028_jr_80154C24.c +++ b/src/ov_SC02_028/ov_SC02_028_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018D780)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018D780[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018D780[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_028/ov_SC02_028_jr_8017AE2C.c b/src/ov_SC02_028/ov_SC02_028_jr_8017AE2C.c index 900e92be07..6f6a6a2609 100644 --- a/src/ov_SC02_028/ov_SC02_028_jr_8017AE2C.c +++ b/src/ov_SC02_028/ov_SC02_028_jr_8017AE2C.c @@ -3370,7 +3370,15 @@ void func_8017CD10(void *a0) { } -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017AE2C", func_8017CD4C); +extern void func_80147324(s32 arg0); +void func_8017CD4C(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3399,7 +3407,20 @@ INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017AE2C", func_8017CDF INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017AE2C", func_8017CE7C); -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017AE2C", func_8017CFE4); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017CFE4(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D030(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017AE2C", func_8017D030); @@ -3411,7 +3432,13 @@ void func_8017D33C(void *a0) { } -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017AE2C", func_8017D378); +extern void func_80147324(s32 arg0); +void func_8017D378(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D3B8 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3513,7 +3540,25 @@ void func_8017D4B4(void *a0) } -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017AE2C", func_8017D588); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017D588(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D030)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_8018EFC0[])(void); @@ -3525,7 +3570,22 @@ void func_8017D5DC(void *a0) { INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017AE2C", func_8017D618); -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017AE2C", func_8017D6CC); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017D728(void *a0); +void func_8017D6CC(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017D728(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017AE2C", func_8017D728); diff --git a/src/ov_SC02_028/ov_SC02_028_jr_8017D898.c b/src/ov_SC02_028/ov_SC02_028_jr_8017D898.c index 11b19c7376..b337d274ce 100644 --- a/src/ov_SC02_028/ov_SC02_028_jr_8017D898.c +++ b/src/ov_SC02_028/ov_SC02_028_jr_8017D898.c @@ -3185,13 +3185,64 @@ INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_8017E77 INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_8017E7C4); -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_8017E810); + +extern int func_8017FB44(int param_1); + +void func_8017E810(void) +{ + + extern u8 D_8018F584[]; + extern u8 D_8018F624[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018F584; + D_801274CC = D_8018F624; + func_8017FB44(1); +} + INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_8017E850); -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_8017E89C); -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_8017E8DC); +extern int func_8017FB44(int param_1); + +void func_8017E89C(void) +{ + + extern u8 D_8018F7B4[]; + extern u8 D_8018F854[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018F7B4; + D_801274CC = D_8018F854; + func_8017FB44(3); +} + + + +extern int func_8017FB44(int param_1); + +void func_8017E8DC(void) +{ + + extern u8 D_8018F868[]; + extern u8 D_8018F91C[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018F868; + D_801274CC = D_8018F91C; + func_8017FB44(4); +} + INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_8017E91C); @@ -3985,7 +4036,38 @@ INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_801858C INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_801858F4); -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_80185978); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_80185978(s32 a0) { + + extern u8 D_801A7510[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_801A7510); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -4054,9 +4136,70 @@ void func_80185B8C(s32 a0) { void func_80185C68(void) { } -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_80185C70); -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_80185D28); +/* func_80185C70 — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_80185C70(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32 a0, s32 a1); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_80185D28(s32 a0) { + + extern u8 D_801A75D8[]; + extern u8 D_8018B770[]; + extern u16 D_801A760C[]; + extern u16 D_801A760E[]; + extern u16 D_801A7610[]; + extern s16 D_801A7612[]; + if (func_8012C354(a0, (s32)D_801A75D8) != 0) { + func_8012A828(a0, (s32)D_8018B770); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_801A760C[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_801A760E[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_801A7610[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_801A7612[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_80185DEC); @@ -4101,7 +4244,29 @@ void func_80185EBC(s32 param_1) } -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_80185FA0); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_80185FA0(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); @@ -4389,11 +4554,153 @@ INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_8018A89 INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_8018A90C); -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_8018A9BC); -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_8018AA74); -INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_8018AB34); +extern s32 func_8012E778(int param_1, int param_2); +extern s32 func_8012C51C(int a0, int a1); + +void func_8018A9BC(int param_1, int param_2) +{ + + extern u16 D_800AF7BC; + extern u16 D_800AF7BE; + extern u8 D_801D34C8[]; + s32 i; + + i = 0; + if (func_8012E778(param_1, ((s32)(D_800AF7BE >> 1) << 16) | (D_800AF7BC >> 1)) != 0) { + do { + if (D_801D34C8[i] == 0) { + D_801D34C8[i] = 1; + *(s32 *)(param_2 + 0x10) = i | 0x80000000; + *(u16 *)(param_2 + 8) = *(u16 *)(param_1 + 0x70); + func_8012C51C(param_2, param_1); + return; + } + i++; + } while (i < 5); + } +} + + + +extern s32 func_8012C194(void); +extern void func_8001CD50(s32 a0, s32 a1); +extern void func_800233CC(void *, unsigned short); +extern void func_8018AE00(s32 a0); + +void func_8018AA74(void *a0) +{ + + extern u32 D_801D3388; + s32 iVar2; + u32 *puVar3; + + *(s16 *)((s32)a0 + 0xFC) = 0x7000; + *(s16 *)((s32)a0 + 0x100) = 0; + *(s16 *)((s32)a0 + 0xFE) = 0; + *(s16 *)((s32)a0 + 0x104) = 0; + *(s16 *)((s32)a0 + 0x106) = 0; + puVar3 = (u32 *)((u8 *)&D_801D3388 + (*(s16 *)((s32)a0 + 0xDC) * 0x40)); + iVar2 = func_8012C194(); + *(s32 *)((s32)a0 + 0x20) = iVar2; + if (iVar2 != 0) { + func_8001CD50(iVar2, (s32)puVar3); + *(s16 *)(iVar2 + 0x10) = 0x400; + *(u32 *)(iVar2 + 4) = *(u32 *)(iVar2 + 4) | 0x60000000; + func_800233CC(puVar3, 0x40); + puVar3[0] = 0x808080; + puVar3[1] = 0x808080; + func_8018AE00((s32)a0); + *(s16 *)((s32)a0 + 2) = 3; + } +} + + + +/* func_8018AB34 — per-frame entity tick: decay the sound-handle envelope at + * +0x20, ramp the s16 pair at +0xFE/+0x106 up to a 0x6000 ceiling, then ramp + * the pair at +0xFC/+0x104 down; when the +0xFC accumulator goes negative the + * entity releases its D_801D34C8 slot and hands off to func_8012C218, + * otherwise it continues in func_8018AC00. + * + * §71 sibling-first: func_8018A090 (same TU, 0xC0 bytes earlier) is the + * initialiser for exactly these fields (+0xFC/+0xFE/+0x100/+0x104/+0x106, the + * +0x20 handle and the +0xDC slot index) and pins the widths/casts used here. + * D_801D34C8[] is the 5-entry slot table func_80189FD8 (same TU) claims from. + * + * Levers (all three were needed; each is byte-verified by removal): + * 1. §3-T4 branch polarity — the 0x6000 guard is written `>= 0x6000` with the + * CLAMP as the then-arm, which is what puts `slti/bnez` + the `j` over the + * ramp arm in the target order. Writing it `< 0x6000` gives `beqz` and the + * arms swapped. + * 2. Zero-byte `__asm__ __volatile__("" : : : "memory")` at the head of the + * ramp arm (§34 toolkit). Without it cse.c relates the guard's + * `lh 0xFE` to the ramp's `lhu 0xFE` — same MEM, sign- vs zero-extend — + * and rewrites the second as `move`+`andi 0xffff`. That also lands both + * arms' final store in $v0, which lets the post-reload jump pass CROSS-JUMP + * the two `sh 0xFE` tails (§5a) and eats the `j .L8018A1C4`. The clobber + * invalidates the MEM in the hash table so the real second load survives, + * the arms end in different registers, and the cross-jump cannot fire. + * 3. The +0x104 store is SUNK to immediately after the subtract, before the + * +0xFC accumulate. Both tail quantities are otherwise born in the same + * block, and local-alloc's QTY_CMP_PRI (n_refs*log2(n_refs)/live_length) + * then ranks the accumulator ABOVE the delta, handing it $v0 and swapping + * the whole block's register pair. Storing the delta early kills its live + * range at insn 3, which flips the priority back so the delta takes $v0. + * Purely a scheduling/priority dial — the emitted order is unchanged + * because reorg pulls `sh 0x104` back into the `bgez` delay slot. + * Also note the two tail blocks are BLOCK-SCOPED: sharing one function-scope + * pair across the 0xFE and 0xFC ramps makes them global allocnos (§76), which + * costs $a1 for the deltas and an extra 8 bytes of frame (0x20 vs 0x18). + */ + +extern void func_8012C218(void *a0); +extern void func_8018AC00(void *a0); + +void func_8018AB34(void *a0) +{ + + extern u8 D_801D34C8[]; + s32 p; + s32 v; + + p = *(s32 *)((s32)a0 + 0x20); + if (p != 0) { + v = *(u16 *)(p + 0x1A) - 0x100; + *(s16 *)(p + 0x1A) = v; + *(s16 *)(p + 0x18) = v; + if (*(s16 *)(p + 0x1A) < 0) { + *(s16 *)(p + 0x1A) = 0; + *(s16 *)(p + 0x18) = 0; + } + } + if (*(s16 *)((s32)a0 + 0xFE) >= 0x6000) { + *(s16 *)((s32)a0 + 0xFE) = 0x6000; + } else { + s32 dv, sv; + __asm__ __volatile__("" : : : "memory"); + dv = *(u16 *)((s32)a0 + 0x106) + 0x400; + sv = *(u16 *)((s32)a0 + 0xFE) + dv; + *(s16 *)((s32)a0 + 0x106) = dv; + *(s16 *)((s32)a0 + 0xFE) = sv; + } + { + s32 d = *(u16 *)((s32)a0 + 0x104) - 0x80; + s16 s; + + *(s16 *)((s32)a0 + 0x104) = d; + s = *(u16 *)((s32)a0 + 0xFC) + d; + *(s16 *)((s32)a0 + 0xFC) = s; + if (s < 0) { + D_801D34C8[*(s16 *)((s32)a0 + 0xDC)] = 0; + func_8012C218(a0); + } else { + func_8018AC00(a0); + } + } +} + INCLUDE_ASM("asm/ov_SC02_028/nonmatchings/ov_SC02_028_jr_8017D898", func_8018AC00); diff --git a/src/ov_SC02_031/ov_SC02_031_jr_80135D20.c b/src/ov_SC02_031/ov_SC02_031_jr_80135D20.c index a62211de7f..8710c612d8 100644 --- a/src/ov_SC02_031/ov_SC02_031_jr_80135D20.c +++ b/src/ov_SC02_031/ov_SC02_031_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80185224[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80185224[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80185224[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80185224[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80185224[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_031/ov_SC02_031_jr_80154C24.c b/src/ov_SC02_031/ov_SC02_031_jr_80154C24.c index 399723c894..15eab86912 100644 --- a/src/ov_SC02_031/ov_SC02_031_jr_80154C24.c +++ b/src/ov_SC02_031/ov_SC02_031_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80186FAC)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80186FAC[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80186FAC[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_031/ov_SC02_031_jr_8017AE2C.c b/src/ov_SC02_031/ov_SC02_031_jr_8017AE2C.c index 45e7bfbcdc..7f95a305c5 100644 --- a/src/ov_SC02_031/ov_SC02_031_jr_8017AE2C.c +++ b/src/ov_SC02_031/ov_SC02_031_jr_8017AE2C.c @@ -1548,7 +1548,6 @@ extern void func_80164744(s32 param_1); extern void func_8001C810(s32 a0, s32 a1); extern void func_80164A74(s32 *a0); extern void func_80164930(s32 a); -extern u16 D_800DF2E0; extern s32 D_8018783C; extern s16 D_80187870; extern s16 D_8018786E; @@ -3383,7 +3382,15 @@ void func_8017CFD4(void *a0) { } -INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017D010); +extern void func_80147324(s32 arg0); +void func_8017D010(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3412,7 +3419,20 @@ INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017D0B INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017D140); -INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017D2A8); +extern void func_8017D2F4(int); +extern void func_80146C3C(void); +void func_8017D2A8(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D2F4(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017D2F4); @@ -3424,7 +3444,13 @@ void func_8017D600(void *a0) { } -INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017D63C); +extern void func_80147324(s32 arg0); +void func_8017D63C(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D67C — a state-tick: bump the frame counter at 0x1C; while it is @@ -3526,7 +3552,25 @@ void func_8017D778(void *a0) } -INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017D84C); +extern void func_8017D2F4(int); +extern void func_80146C3C(void); +void func_8017D84C(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D2F4)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_80188800[])(void); @@ -3538,7 +3582,22 @@ void func_8017D8A0(void *a0) { INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017D8DC); -INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017D990); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017D9EC(void *a0); +void func_8017D990(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017D9EC(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017D9EC); @@ -3550,7 +3609,17 @@ void func_8017DB5C(void *a0) { } -INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017DB98); +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern s32 func_80171990(u8 *a0); +void func_8017DB98(s32 a0) { + + extern u8 D_80188808; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_80188808); + func_80171990((u8 *)a0); +} + INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017DBD8); @@ -3616,7 +3685,33 @@ INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017E06 INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017E0C0); -INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017E124); +extern void func_8014659C(void); +extern void func_8001C810(s32 a0, s32 a1); +extern void func_80146CA0(void *a0); +extern void func_80162CCC(void); +void func_8017E124(int param_1) { + + extern u16 D_800DF2E0; + extern s32 D_801888C8; + extern s32 D_80188924[]; + s32 iVar1; + iVar1 = ((s32 (*)(void))func_8014659C)(); + *(s32 *)(param_1 + 0x20) = iVar1; + if (iVar1 != 0) { + ((void (*)(s32, void *))func_8001C810)(iVar1, &D_800DF2E0); + *(s32 **)(iVar1 + 0x80) = &D_801888C8; + *(u32 *)(iVar1 + 4) = *(u32 *)(iVar1 + 4) | 0x50000000; + *(u16 *)(iVar1 + 0x2c) = *(u16 *)(iVar1 + 0x2c) | 0xb0; + *(s32 *)(param_1 + 0x58) = (s32)&D_80188924[*(s32 *)(param_1 + 0x50) * 2]; + *(u16 *)(iVar1 + 0x1c) = 0; + *(u16 *)(iVar1 + 0x1a) = 0; + *(u16 *)(iVar1 + 0x18) = 0; + ((void (*)(s32))func_80146CA0)(param_1); + } else { + ((void (*)(s32))func_80162CCC)(param_1); + } +} + /* func_8017E1D4 — per-frame spin + clamp handler (ov_SC03_014, reach x8). @@ -3719,7 +3814,17 @@ void func_8017F384(void *a0) { } -INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017F3C0); +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern s32 func_80171990(u8 *a0); +void func_8017F3C0(s32 a0) { + + extern u8 D_80188808; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_80188808); + func_80171990((u8 *)a0); +} + INCLUDE_ASM("asm/ov_SC02_031/nonmatchings/ov_SC02_031_jr_8017AE2C", func_8017F400); diff --git a/src/ov_SC02_035/ov_SC02_035_jr_80135D20.c b/src/ov_SC02_035/ov_SC02_035_jr_80135D20.c index c2a6c84ef5..2793143ae7 100644 --- a/src/ov_SC02_035/ov_SC02_035_jr_80135D20.c +++ b/src/ov_SC02_035/ov_SC02_035_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_035/nonmatchings/ov_SC02_035_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80184A84[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80184A84[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80184A84[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80184A84[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80184A84[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_035/ov_SC02_035_jr_80154C24.c b/src/ov_SC02_035/ov_SC02_035_jr_80154C24.c index d7bf81f624..3aef494f9e 100644 --- a/src/ov_SC02_035/ov_SC02_035_jr_80154C24.c +++ b/src/ov_SC02_035/ov_SC02_035_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_035/nonmatchings/ov_SC02_035_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018680C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018680C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018680C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_035/ov_SC02_035_jr_8017BEBC.c b/src/ov_SC02_035/ov_SC02_035_jr_8017BEBC.c index adc7227df1..4be3eadcf0 100644 --- a/src/ov_SC02_035/ov_SC02_035_jr_8017BEBC.c +++ b/src/ov_SC02_035/ov_SC02_035_jr_8017BEBC.c @@ -3415,7 +3415,43 @@ void func_8017D7A4(s32 a0) { } -INCLUDE_ASM("asm/ov_SC02_035/nonmatchings/ov_SC02_035_jr_8017BEBC", func_8017D85C); + +extern s32 func_8004787C(s32 a0); +extern s32 func_80047948(s32 a0); + +// @class: none — MATCH (46 ins), iteration 1. rtu_match MATCH too. +// @stuck: none. +// Derivation was pure OPCODE-WIDTH reading (no cookbook section needed beyond +// §3-T4 for the two branch senses): +// * 0x108 `lh`/`sh` -> s16 counter. +// * 0x106,0xFE `lhu`+`addu`+`sh` -> u16 += u16 (a signed s16 pair would have +// loaded `lh`). The `sll 16/sra 16` immediately after is NOT part of the +// add — it is the `(s16)` cast of the just-stored u16 being handed to +// func_8004787C, which CSE serves out of the store's register instead of +// re-loading. Writing the arg as `*(s16 *)(a0 + 0x106)` after the store +// reproduces it exactly; the SECOND call re-loads with `lh` on its own +// because $v0/$a0 died across the first jal. +// * 0x104 `lh` -> s16 multiplicand; mult/mflo/`sra 12` == plain int `>> 12`. +// * 0x88,0x8A `lhu` -> u16 bases; 0x6,0xA `sh`. +// * §3-T4 both branches: `beqz` at the top => source condition is `!= 0` with +// an early return; `bnez` at the bottom => source condition is `== 0`. +// The shared `sh $v0,0x108($s0)` tail is gcc's own cross-jump merge of the +// `- 1` arm and the `= 0xF` arm — do NOT hand-write it as a merged tail. +void func_8017D85C(s32 a0) { + if (*(s16 *)(a0 + 0x108) != 0) { + *(s16 *)(a0 + 0x108) = *(s16 *)(a0 + 0x108) - 1; + return; + } + *(u16 *)(a0 + 0x106) = *(u16 *)(a0 + 0x106) + *(u16 *)(a0 + 0xFE); + *(s16 *)(a0 + 0x6) = *(u16 *)(a0 + 0x88) + + ((func_8004787C(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + *(s16 *)(a0 + 0xA) = *(u16 *)(a0 + 0x8A) + + ((func_80047948(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + if ((*(u16 *)(a0 + 0x106) & 0x7FF) == 0) { + *(s16 *)(a0 + 0x108) = 0xF; + } +} + INCLUDE_ASM("asm/ov_SC02_035/nonmatchings/ov_SC02_035_jr_8017BEBC", func_8017D914); @@ -3499,7 +3535,38 @@ INCLUDE_ASM("asm/ov_SC02_035/nonmatchings/ov_SC02_035_jr_8017BEBC", func_8017EA2 INCLUDE_ASM("asm/ov_SC02_035/nonmatchings/ov_SC02_035_jr_8017BEBC", func_8017EA50); -INCLUDE_ASM("asm/ov_SC02_035/nonmatchings/ov_SC02_035_jr_8017BEBC", func_8017EAD4); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_8017EAD4(s32 a0) { + + extern u8 D_80196C80[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_80196C80); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -3568,9 +3635,70 @@ void func_8017ECE8(s32 a0) { void func_8017EDC4(void) { } -INCLUDE_ASM("asm/ov_SC02_035/nonmatchings/ov_SC02_035_jr_8017BEBC", func_8017EDCC); -INCLUDE_ASM("asm/ov_SC02_035/nonmatchings/ov_SC02_035_jr_8017BEBC", func_8017EE84); +/* func_8017EDCC — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_8017EDCC(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32*, s32); +extern void func_8012A828(s32*, s32); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_8017EE84(s32 a0) { + + extern u8 D_80196D48[]; + extern u8 D_801847FC[]; + extern u16 D_80196D7C[]; + extern u16 D_80196D7E[]; + extern u16 D_80196D80[]; + extern s16 D_80196D82[]; + if (((s32 (*)(s32, s32))func_8012C354)(a0, (s32)D_80196D48) != 0) { + ((void (*)(s32, s32))func_8012A828)(a0, (s32)D_801847FC); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_80196D7C[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_80196D7E[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_80196D80[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_80196D82[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC02_035/nonmatchings/ov_SC02_035_jr_8017BEBC", func_8017EF48); @@ -3615,7 +3743,29 @@ void func_8017F018(s32 param_1) } -INCLUDE_ASM("asm/ov_SC02_035/nonmatchings/ov_SC02_035_jr_8017BEBC", func_8017F0FC); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_8017F0FC(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); diff --git a/src/ov_SC02_039/ov_SC02_039_jr_80135D20.c b/src/ov_SC02_039/ov_SC02_039_jr_80135D20.c index 7a1f4b9648..e4f778b56e 100644 --- a/src/ov_SC02_039/ov_SC02_039_jr_80135D20.c +++ b/src/ov_SC02_039/ov_SC02_039_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_039/nonmatchings/ov_SC02_039_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017F6B0[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017F6B0[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017F6B0[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017F6B0[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017F6B0[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_039/ov_SC02_039_jr_80154C24.c b/src/ov_SC02_039/ov_SC02_039_jr_80154C24.c index dfc0c901b0..56c4a4b68c 100644 --- a/src/ov_SC02_039/ov_SC02_039_jr_80154C24.c +++ b/src/ov_SC02_039/ov_SC02_039_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_039/nonmatchings/ov_SC02_039_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80181438)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80181438[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80181438[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_041/ov_SC02_041_jr_80135D20.c b/src/ov_SC02_041/ov_SC02_041_jr_80135D20.c index bfb68b25c5..7b02027ab0 100644 --- a/src/ov_SC02_041/ov_SC02_041_jr_80135D20.c +++ b/src/ov_SC02_041/ov_SC02_041_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_041/nonmatchings/ov_SC02_041_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80185380[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80185380[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80185380[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80185380[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80185380[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC02_041/ov_SC02_041_jr_80154C24.c b/src/ov_SC02_041/ov_SC02_041_jr_80154C24.c index aba07ccece..9ef7d056e8 100644 --- a/src/ov_SC02_041/ov_SC02_041_jr_80154C24.c +++ b/src/ov_SC02_041/ov_SC02_041_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC02_041/nonmatchings/ov_SC02_041_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80187108)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80187108[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80187108[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC02_041/ov_SC02_041_jr_8017BEBC.c b/src/ov_SC02_041/ov_SC02_041_jr_8017BEBC.c index ad4e46fcc4..d10dfbfafe 100644 --- a/src/ov_SC02_041/ov_SC02_041_jr_8017BEBC.c +++ b/src/ov_SC02_041/ov_SC02_041_jr_8017BEBC.c @@ -384,7 +384,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3207,7 +3206,17 @@ extern void func_80151664(void); } -INCLUDE_ASM("asm/ov_SC02_041/nonmatchings/ov_SC02_041_jr_8017BEBC", func_8017D0B8); + +extern void func_80019064(void *a0); + +void func_8017D0B8(void *a0) { + + extern u8 D_8018885C; + extern void (*D_80188880[])(void *); + func_80019064(&D_8018885C); + D_80188880[*(u16 *)((s32)a0 + 0x2)](a0); +} + extern void func_8014E934(s32 a0); extern void func_8014CC28(s32 a0); @@ -3460,10 +3469,13 @@ extern void func_8012F214(s32 a0, s32 a1, s32 a2); extern s32 func_8012E544(s32 a0); extern u8 *func_801290DC(s32 a0, u8 *a1); extern s32 D_80126B58; -extern u8 D_801202A0[]; extern u8 D_80188C98[]; void func_8017E7A4(void *a0) { + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 D_801202A0[]; s32 t; u8 *r; u8 *p; @@ -3617,7 +3629,17 @@ void func_8017EA1C(int param_1) } -INCLUDE_ASM("asm/ov_SC02_041/nonmatchings/ov_SC02_041_jr_8017BEBC", func_8017EB08); + +extern void func_80019064(void *a0); + +void func_8017EB08(void *a0) { + + extern u8 D_8019AB88; + extern void (*D_8019ABB0[])(void *); + func_80019064(&D_8019AB88); + D_8019ABB0[*(u16 *)((s32)a0 + 0x2)](a0); +} + INCLUDE_ASM("asm/ov_SC02_041/nonmatchings/ov_SC02_041_jr_8017BEBC", func_8017EB60); @@ -4497,7 +4519,31 @@ INCLUDE_ASM("asm/ov_SC02_041/nonmatchings/ov_SC02_041_jr_8017BEBC", func_801847E INCLUDE_ASM("asm/ov_SC02_041/nonmatchings/ov_SC02_041_jr_8017BEBC", func_80184A74); -INCLUDE_ASM("asm/ov_SC02_041/nonmatchings/ov_SC02_041_jr_8017BEBC", func_80184C08); + +/* func_80184C08 — "is another entity of type 0x35C sharing my 0x64 owner?" + * + * Walks the 0x60-entry entity table at D_801202A0 (stride 0x10C) with an int + * counter (the target keeps the count in $a2 and `slti ...,0x60`, so it is a + * counted loop, NOT the D_80126720 pointer-bound idiom the sibling walkers + * use). Returns 1 for the first entry whose u16 kind == 0x35C, whose word at + * 0x64 equals the caller's word at 0x64, and which is not the caller itself. + */ +s32 func_80184C08(s32 arg0) { + extern u8 D_801202A0[]; + u8 *p; + s32 i; + + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == 0x35C && *(s32 *)(arg0 + 0x64) == *(s32 *)(p + 0x64) && + arg0 != (s32)p) { + return 1; + } + p += 0x10C; + } + return 0; +} + extern void func_8012EC04(s32 param_1, s32 param_2, s32 *param_3); @@ -4519,7 +4565,24 @@ void func_80184C60(s32 arg0) { } -INCLUDE_ASM("asm/ov_SC02_041/nonmatchings/ov_SC02_041_jr_8017BEBC", func_80184CDC); + +/* func_80184CDC — guard-then-free tail (cookbook §71 sibling shape: + * src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c func_80144458 tail, and + * src/ov_SC03_099/ov_SC03_099_jr_80140608.c:2432 func_80016714(x, 0x38)). */ + +extern void func_80016714(void *a0, s32 a1); +extern void func_8012C218(void *a0); + +void func_80184CDC(void *arg0) { + void *temp_a0; + + temp_a0 = *(void **)((char *)arg0 + 0xCC); + if (temp_a0 != NULL) { + func_80016714(temp_a0, 0x38); + } + func_8012C218(arg0); +} + INCLUDE_ASM("asm/ov_SC02_041/nonmatchings/ov_SC02_041_jr_8017BEBC", func_80184D20); diff --git a/src/ov_SC03_001/ov_SC03_001_jr_80135D20.c b/src/ov_SC03_001/ov_SC03_001_jr_80135D20.c index 995be554a2..93939a77f1 100644 --- a/src/ov_SC03_001/ov_SC03_001_jr_80135D20.c +++ b/src/ov_SC03_001/ov_SC03_001_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018DAC0[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018DAC0[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018DAC0[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018DAC0[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018DAC0[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_001/ov_SC03_001_jr_80154C24.c b/src/ov_SC03_001/ov_SC03_001_jr_80154C24.c index 870a323b80..2284b4d5e8 100644 --- a/src/ov_SC03_001/ov_SC03_001_jr_80154C24.c +++ b/src/ov_SC03_001/ov_SC03_001_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018F848)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018F848[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018F848[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_001/ov_SC03_001_jr_8017AE2C.c b/src/ov_SC03_001/ov_SC03_001_jr_8017AE2C.c index 377823a64d..d430144c76 100644 --- a/src/ov_SC03_001/ov_SC03_001_jr_8017AE2C.c +++ b/src/ov_SC03_001/ov_SC03_001_jr_8017AE2C.c @@ -4869,7 +4869,34 @@ s32 func_80182058(void *a0) INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80182148); -INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_801821C0); + +extern s32 func_801886A0(s32 a0); +extern s32 func_80187A64(s32 a0); +extern void func_80187994(s32, s32, s32, s32); +extern void func_80181CAC(void *a0); + +void func_801821C0(void *a0) +{ + + extern u8 D_801B9354[]; + if (*(u16 *)((s32)a0 + 0x34) == 0) { + if (func_801886A0(6) == 0) { + return; + } + if (func_80187A64((s32)a0) == 0) { + return; + } + ((void (*)(void *, void *, s32, s32))func_80187994)(a0, D_801B9354, 0, 0x40); + *(s16 *)((s32)a0 + 0x34) = 1; + return; + } + + *(s32 *)(*(s32 *)((s32)a0 + 0xCC) + 0xB0) = 2; + if (func_80187A64((s32)a0) != 0) { + func_80181CAC(a0); + } +} + /* func_80182254 — guarded dispatch: ask func_8018766C(10, 0x10); if it answers @@ -4964,7 +4991,23 @@ INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_801828C INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80182928); -INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80182968); + +/* func_80182968 — guarded dispatch: ask func_8018766C(9, 0x12); if it answers + * NON-zero, run func_801824DC on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_8018766C(s32 arg0, s32 arg1); +extern void func_801824DC(void *arg0); + +void func_80182968(void *arg0) { + if (func_8018766C(9, 0x12) != 0) { + func_801824DC(arg0); + } +} + INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_801829A8); @@ -4986,7 +5029,27 @@ void func_80182A34(void *arg0) { INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80182A74); -INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80182AEC); + +extern s32 func_80187A64(s32 a0); +extern void func_80187994(s32 a0, s32 a1, s32 a2, s32 a3); +extern s32 func_801886A0(s32 a0); +extern void func_8018260C(short*); + +void func_80182AEC(void *arg0) { + + extern u8 D_801B9360[]; + if (*(u16 *)((char *)arg0 + 0x34) == 0) { + if (((s32 (*)(void))func_80187A64)() != 0) { + func_80187994((s32)arg0, (s32)&D_801B9360[0], 1, 0x80); + *(s16 *)((char *)arg0 + 0x34) = 1; + } + } else if (func_801886A0(3) != 0) { + if (func_80187A64((s32)arg0) != 0) { + ((void (*)(void *))func_8018260C)(arg0); + } + } +} + /* func_80182B78 — guarded dispatch: ask func_8018766C(15, 0x11); if it answers @@ -5135,13 +5198,60 @@ s32 func_801834C0(void *a0) INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_801835B0); -INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80183628); + +extern s32 func_801886A0(s32 a0); +extern s32 func_80187A64(s32 a0); +extern void func_80187994(s32, s32, s32, s32); +extern void func_80182EE4(void *a0); + +void func_80183628(void *a0) +{ + + extern u8 D_801B940C[]; + if (*(u16 *)((s32)a0 + 0x34) == 0) { + if (func_801886A0(3) == 0) { + return; + } + if (func_80187A64((s32)a0) == 0) { + return; + } + ((void (*)(void *, void *, s32, s32))func_80187994)(a0, D_801B940C, 0, 0x40); + *(s16 *)((s32)a0 + 0x34) = 1; + return; + } + + *(s32 *)(*(s32 *)((s32)a0 + 0xCC) + 0xB0) = 2; + if (func_80187A64((s32)a0) != 0) { + func_80182EE4(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_801836BC); INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80183708); -INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80183778); + +extern s32 func_80187A64(s32 a0); +extern void func_80187994(s32 a0, s32 a1, s32 a2, s32 a3); +extern s32 func_801886A0(s32 a0); +extern void func_801831F0(short*); + +void func_80183778(void *arg0) { + + extern u8 D_801B9400[]; + if (*(u16 *)((char *)arg0 + 0x34) == 0) { + if (((s32 (*)(void))func_80187A64)() != 0) { + func_80187994((s32)arg0, (s32)&D_801B9400[0], 1, 0x40); + *(s16 *)((char *)arg0 + 0x34) = 1; + } + } else if (func_801886A0(3) != 0) { + if (func_80187A64((s32)arg0) != 0) { + ((void (*)(void *))func_801831F0)(arg0); + } + } +} + INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80183804); @@ -5198,7 +5308,23 @@ extern s32 func_80029178(s32 arg); } -INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80183BF0); + +/* func_80183BF0 — guarded dispatch: ask func_8018766C(7, 0xe); if it answers + * NON-zero, run func_80183948 on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_8018766C(s32 arg0, s32 arg1); +extern void func_80183948(void *arg0); + +void func_80183BF0(void *arg0) { + if (func_8018766C(7, 0xe) != 0) { + func_80183948(arg0); + } +} + INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80183C30); @@ -5329,7 +5455,32 @@ void func_80184784(void *a0) { INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80184794); -INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_801847D0); + +/* func_801847D0 — state-entry init (family exemplar, reach x11). + * Sets the actor's state id (halfword @ +0x2) then runs the fixed + * five-call entry chain. Sibling style copied from func_80180164 + * in the same TU (cookbook §71). */ + +extern void func_8012E8E0(s32, s32); +extern void func_8012E88C(s32); +extern void func_8012A828(s32, s32); +extern void func_80187750(s32); +extern void func_80187994(s32, s32, s32, s32); + + +void func_801847D0(void *arg0) { + + extern short D_8019254C; + extern short D_801C3990; + extern short D_801B94FC; + *(short *)((char *)arg0 + 0x2) = 2; + func_8012E8E0((s32)arg0, (s32)&D_8019254C); + func_8012E88C((s32)arg0); + ((void (*)(s32 *, s32))func_8012A828)((s32 *)arg0, (s32)&D_801C3990); + func_80187750((s32)arg0); + func_80187994((s32)arg0, (s32)&D_801B94FC, 0, 0x60); +} + INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80184840); @@ -5663,7 +5814,23 @@ extern void func_80178CBC(s32*, s32); INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_8018631C); -INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_8018640C); + +/* func_8018640C — guarded dispatch: ask func_8018766C(8, 0x14); if it answers + * NON-zero, run func_80186288 on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_8018766C(s32 arg0, s32 arg1); +extern void func_80186288(short*); + +void func_8018640C(void *arg0) { + if (func_8018766C(8, 0x14) != 0) { + ((void (*)(void *))func_80186288)(arg0); + } +} + INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_8018644C); @@ -6055,7 +6222,21 @@ INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_8018835 INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_801883C4); -INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80188438); +void func_80188438(s32 a0) { + + extern s16 D_801C0B68[]; + extern s32 D_801C0B28[][2]; + *(s16 *)(a0 + 0x2) = 3; + *(s16 *)(a0 + 0x34) = 0; + *(s16 *)(a0 + 0xFE) = 0; + *(s16 *)(a0 + 0x100) = 0; + *(s16 *)(a0 + 0x102) = 2; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x24) = D_801C0B28[D_801C0B68[*(s16 *)(a0 + 0x70)]][0]; + *(s16 *)(a0 + 0x84) = 0; + *(s16 *)(a0 + 0x5C) = 0x800; + *(s32 *)(a0 + 0xB0) = 0; +} + INCLUDE_ASM("asm/ov_SC03_001/nonmatchings/ov_SC03_001_jr_8017AE2C", func_80188498); diff --git a/src/ov_SC03_002/ov_SC03_002_jr_80135D20.c b/src/ov_SC03_002/ov_SC03_002_jr_80135D20.c index e4c091f8a4..4fb7e1a360 100644 --- a/src/ov_SC03_002/ov_SC03_002_jr_80135D20.c +++ b/src/ov_SC03_002/ov_SC03_002_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80185AB0[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80185AB0[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80185AB0[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80185AB0[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80185AB0[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_002/ov_SC03_002_jr_80154C24.c b/src/ov_SC03_002/ov_SC03_002_jr_80154C24.c index dd0bc5f4ab..112f361296 100644 --- a/src/ov_SC03_002/ov_SC03_002_jr_80154C24.c +++ b/src/ov_SC03_002/ov_SC03_002_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80187838)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80187838[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80187838[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_002/ov_SC03_002_jr_8017D604.c b/src/ov_SC03_002/ov_SC03_002_jr_8017D604.c index f8216f9f64..c0995be0aa 100644 --- a/src/ov_SC03_002/ov_SC03_002_jr_8017D604.c +++ b/src/ov_SC03_002/ov_SC03_002_jr_8017D604.c @@ -1675,7 +1675,6 @@ extern void func_8016634C(void *a0); extern void func_801663A4(void *a0); extern void (*D_801883E4[])(void); extern void func_801663FC(void *a0); -extern u8 D_800D387C[]; extern u8 D_800D3888[]; extern s32 func_800D21C4(s32 a0, void *a1, s32 a2); extern void func_800D1FC8(s32 a0, s32 a1); @@ -3234,7 +3233,27 @@ void func_8017F1C4(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_8017D604", func_8017F200); + +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); + +void func_8017F200(s32 arg0) { + + extern u8 D_800D387C[]; + s32 iVar1; + + iVar1 = *(s32 *)(arg0 + 0x20); + ((void (*)(s32, s32, s32, s32))func_8001CC3C)(iVar1, (s32)&D_800D387C, 0x270, 0x120); + *(u8 *)(iVar1 + 0x27) = 0x9C; + *(u16 *)(iVar1 + 0x1A) = 0x7000; + *(u16 *)(iVar1 + 0x18) = 0x7000; + *(u8 *)(iVar1 + 0x26) = 0x90; + *(u8 *)(iVar1 + 0x25) = 0x90; + *(u8 *)(iVar1 + 0x24) = 0x90; + *(u32 *)(iVar1 + 4) = *(u32 *)(iVar1 + 4) | 0x50000000; + *(s16 *)(arg0 + 0x2C) = 0x20; + *(s16 *)(arg0 + 0x2) += 1; +} + INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_8017D604", func_8017F290); @@ -3433,7 +3452,17 @@ INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_8017D604", func_801802F INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_8017D604", func_80180378); -INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_8017D604", func_80180570); +extern void func_80147060(u8*); +extern void func_80172358(u8*, u8*); +extern void func_80171928(void*); +void func_80180570(s32 a0) { + + extern u8 D_80189830; + ((void (*)(void *))func_80147060)((void *)a0); + ((void (*)(s32 *, s32))func_80172358)((s32 *)a0, (s32)&D_80189830); + ((s32 (*)(u8 *))func_80171928)((u8 *)a0); +} + INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_8017D604", func_801805B0); @@ -3548,7 +3577,23 @@ INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_8017D604", func_8018112 INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_8017D604", func_8018118C); -INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_8017D604", func_80181200); + +/* func_80181200 — guarded dispatch: ask func_80183158(9, 0x12); if it answers + * NON-zero, run func_80180DF4 on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_80183158(s32 arg0, s32 arg1); +extern void func_80180DF4(void *arg0); + +void func_80181200(void *arg0) { + if (func_80183158(9, 0x12) != 0) { + func_80180DF4(arg0); + } +} + /* func_80181240 — guarded dispatch: ask func_80183158(9, 0x12); if it answers @@ -3996,7 +4041,21 @@ INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_8017D604", func_80183E4 INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_8017D604", func_80183EB0); -INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_8017D604", func_80183F24); +void func_80183F24(s32 a0) { + + extern s16 D_801A850C[]; + extern s32 D_801A84CC[][2]; + *(s16 *)(a0 + 0x2) = 3; + *(s16 *)(a0 + 0x34) = 0; + *(s16 *)(a0 + 0xFE) = 0; + *(s16 *)(a0 + 0x100) = 0; + *(s16 *)(a0 + 0x102) = 2; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x24) = D_801A84CC[D_801A850C[*(s16 *)(a0 + 0x70)]][0]; + *(s16 *)(a0 + 0x84) = 0; + *(s16 *)(a0 + 0x5C) = 0x800; + *(s32 *)(a0 + 0xB0) = 0; +} + INCLUDE_ASM("asm/ov_SC03_002/nonmatchings/ov_SC03_002_jr_8017D604", func_80183F84); diff --git a/src/ov_SC03_003/ov_SC03_003_jr_80135D20.c b/src/ov_SC03_003/ov_SC03_003_jr_80135D20.c index c28c14b17d..d0a11a841a 100644 --- a/src/ov_SC03_003/ov_SC03_003_jr_80135D20.c +++ b/src/ov_SC03_003/ov_SC03_003_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_003/nonmatchings/ov_SC03_003_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017F878[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017F878[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017F878[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017F878[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017F878[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_003/ov_SC03_003_jr_80154C24.c b/src/ov_SC03_003/ov_SC03_003_jr_80154C24.c index 62c8d0ff92..abe750c6cf 100644 --- a/src/ov_SC03_003/ov_SC03_003_jr_80154C24.c +++ b/src/ov_SC03_003/ov_SC03_003_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_003/nonmatchings/ov_SC03_003_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80181600)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80181600[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80181600[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_006/ov_SC03_006_jr_80135D20.c b/src/ov_SC03_006/ov_SC03_006_jr_80135D20.c index 2a1f5857f9..6920977b15 100644 --- a/src/ov_SC03_006/ov_SC03_006_jr_80135D20.c +++ b/src/ov_SC03_006/ov_SC03_006_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018CB94[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018CB94[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018CB94[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018CB94[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018CB94[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_006/ov_SC03_006_jr_80154C24.c b/src/ov_SC03_006/ov_SC03_006_jr_80154C24.c index ac93efae53..bdaa125c03 100644 --- a/src/ov_SC03_006/ov_SC03_006_jr_80154C24.c +++ b/src/ov_SC03_006/ov_SC03_006_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018E91C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018E91C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018E91C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_006/ov_SC03_006_jr_8017AE2C.c b/src/ov_SC03_006/ov_SC03_006_jr_8017AE2C.c index 26626fdc87..87b0e7ade9 100644 --- a/src/ov_SC03_006/ov_SC03_006_jr_8017AE2C.c +++ b/src/ov_SC03_006/ov_SC03_006_jr_8017AE2C.c @@ -382,7 +382,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -1548,7 +1547,6 @@ extern void func_80164744(s32 param_1); extern void func_8001C810(s32 a0, s32 a1); extern void func_80164A74(s32 *a0); extern void func_80164930(s32 a); -extern u16 D_800DF2E0; extern s32 D_8018F1AC; extern s16 D_8018F1E0; extern s16 D_8018F1DE; @@ -3478,7 +3476,15 @@ void func_8017D0E8(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017D124); +extern void func_80147324(s32 arg0); +void func_8017D124(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3507,7 +3513,20 @@ INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017D1D INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017D254); -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017D3BC); +extern void func_8017D408(int); +extern void func_80146C3C(void); +void func_8017D3BC(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D408(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017D408); @@ -3519,7 +3538,13 @@ void func_8017D714(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017D750); +extern void func_80147324(s32 arg0); +void func_8017D750(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D790 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3621,7 +3646,25 @@ void func_8017D88C(void *a0) } -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017D960); +extern void func_8017D408(int); +extern void func_80146C3C(void); +void func_8017D960(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D408)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_80190184[])(void); @@ -3633,7 +3676,22 @@ void func_8017D9B4(void *a0) { INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017D9F0); -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017DAA4); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017DB00(void *a0); +void func_8017DAA4(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017DB00(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017DB00); @@ -3676,7 +3734,17 @@ void func_8017EC58(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017EC94); +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern s32 func_80171990(u8 *a0); +void func_8017EC94(s32 a0) { + + extern u8 D_80190484; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_80190484); + func_80171990((u8 *)a0); +} + INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017ECD4); @@ -3741,7 +3809,33 @@ INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017F16 INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017F1BC); -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8017F220); +extern void func_8014659C(void); +extern void func_8001C810(s32 a0, s32 a1); +extern void func_80146CA0(void *a0); +extern void func_80162CCC(void); +void func_8017F220(int param_1) { + + extern u16 D_800DF2E0; + extern s32 D_80190544; + extern s32 D_801905A0[]; + s32 iVar1; + iVar1 = ((s32 (*)(void))func_8014659C)(); + *(s32 *)(param_1 + 0x20) = iVar1; + if (iVar1 != 0) { + ((void (*)(s32, void *))func_8001C810)(iVar1, &D_800DF2E0); + *(s32 **)(iVar1 + 0x80) = &D_80190544; + *(u32 *)(iVar1 + 4) = *(u32 *)(iVar1 + 4) | 0x50000000; + *(u16 *)(iVar1 + 0x2c) = *(u16 *)(iVar1 + 0x2c) | 0xb0; + *(s32 *)(param_1 + 0x58) = (s32)&D_801905A0[*(s32 *)(param_1 + 0x50) * 2]; + *(u16 *)(iVar1 + 0x1c) = 0; + *(u16 *)(iVar1 + 0x1a) = 0; + *(u16 *)(iVar1 + 0x18) = 0; + ((void (*)(s32))func_80146CA0)(param_1); + } else { + ((void (*)(s32))func_80162CCC)(param_1); + } +} + /* func_8017F2D0 — per-frame spin + clamp handler (ov_SC03_014, reach x8). @@ -4989,7 +5083,34 @@ void func_801840D8(void) { INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_801840E0); -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8018415C); + +/* func_8018415C — light/colour ramp-up on the entity's attached prim block. + * + * If the s16 flag at 0xFE is set, bump the three u16 colour words at + * 0x18/0x1A/0x1C of the block pointed to by the word at 0x20 by 0x40 each, + * then clamp all three to 0x1800 once the first one reaches it. + * + * Widths pinned off the target: `lh` at 0xFE and at 0x18 (the signed compare), + * `lhu` for the three read-modify-writes, `sh` for every store. The pointer at + * 0x20 is re-loaded before each RMW (the `sh` stores may alias it), which is + * exactly what writing the deref inline gives. + */ +void func_8018415C(int param_1) { + int v1; + + if (*(short *)(param_1 + 0xfe) != 0) { + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x18) += 0x40; + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x1a) += 0x40; + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x1c) += 0x40; + v1 = *(int *)(param_1 + 0x20); + if (*(short *)(v1 + 0x18) >= 0x1800) { + *(short *)(v1 + 0x1c) = 0x1800; + *(short *)(v1 + 0x1a) = 0x1800; + *(short *)(v1 + 0x18) = 0x1800; + } + } +} + INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_801841E4); @@ -5386,7 +5507,58 @@ extern void func_8012A828(s32, void*); } -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_80188DD0); + +extern s32 func_8012BCCC(s32 a0); +extern void func_8001C924(s32 a0, void *a1); +extern void func_8012A828(s32 a0, void *a1); +extern s32 func_8012B8E4(s32 a0, s32 a1); +extern s32 func_8012BEE8(s32 a0); + +// @class: straight-derive +// @stuck: none — MATCH (52 ins) on iteration 1, confirmed by rtu_match. +// +// Two things that could have been mis-read off the target asm: +// +// 1. RELOAD_CSE DELETES A REDUNDANT ARG MOVE — do not read "no arg setup" as +// "zero-arg call". `jal func_8012BCCC` at 0x80184C7C has a bare `nop` delay +// slot and NO `addu $a0,$s0,$zero` before it, which looks like `f()`. It is +// `f(a0)`: the incoming param is still live in $a0 in that fall-through +// block, so gcc-2.7.2's reload_cse_regs (reload1.c) deletes the redundant +// `move $a0,$s0`. The SAME move survives at .L80184CD0 (0x80184CD0) because +// reload_cse's value tracking resets at a CODE_LABEL. So: an arg move that +// is present on the labelled arm and absent on the fall-through arm is ONE +// source-level call shape, not two. +// +// 2. `lui $v1,1 / slt $v1,$v1,$v0` is `ret <= 0x10000`, not `ret < 0x10001`. +// gcc lowers `a <= C` to `!(C < a)` and puts the CONSTANT in the first slt +// operand; writing `< 0x10001` would have materialised 0x10001 instead. +// +// Statement order in the then-arm is the Ghidra order (0x1C store, then the +// 0x34 increment): memrefs_conflict_p disambiguates `+0x1C`/4 from `+0x34`/2 +// off the same base, so sched2 legally hoists the `lhu 0x34` above the `sw` +// to cover its load delay — which is exactly the target's interleave. +void func_80188DD0(s32 a0) { + + extern u8 D_801D477C; + extern u8 D_801D78A8[]; + s32 v; + + if (*(u16 *)(a0 + 0x34) == 0) { + if (func_8012BCCC(a0) <= 0x10000) { + func_8001C924(*(s32 *)(a0 + 0x20), (void *)&D_801D477C); + func_8012A828(a0, (void *)&(*(u8 *)D_801D78A8)); + *(s32 *)(a0 + 0x1C) = 0x1E; + *(u16 *)(a0 + 0x34) += 1; + } + } else { + v = func_8012B8E4(a0, 0xA); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) += v; + if (func_8012BEE8(a0) != 0 || v == 0) { + *(s16 *)(a0 + 0x2) = 5; + } + } +} + INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_80188EA0); @@ -5408,7 +5580,48 @@ INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8018919 INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_801891DC); -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_80189304); + +/* func_80189304 — entity state-kick #0xB. + * Sets the state word at 0x02 to 0xB, hands the entity to the script runner + * func_8012A828 with table D_801D78A8, clears bit 3 of the flag word at 0xDC, + * then picks the timer at 0x1C: a fixed 30 when bit 6 was set (also clearing + * bit 6), otherwise rand() % 16 + 15. Finally, if func_8012BD3C(e,0x400,0x8000) + * returns 0, bit 3 at 0xDC is set again. + * + * §71 sibling-first: func_80184D28 (same TU, same D_801D78A8 script table) is + * the same `sh 0x2 / jal func_8012A828 / jal rand / sw 0x1C` skeleton and pins + * the widths: `sh` at 0x02, `sw` at 0x1C/0xDC, and the s16 store scheduled into + * the jal delay slot. + */ + +extern void func_8012A828(s32 a0, void *a1); +extern s32 func_8012BD3C(s32 a0, s32 a1, s32 a2); +extern s32 rand(void); + +void func_80189304(void *a0) { + + extern u8 D_801D78A8[]; + s32 flags; + s32 cleared; + s32 timer; + + *(s16 *)((s32)a0 + 0x2) = 0xB; + func_8012A828((s32)a0, D_801D78A8); + flags = *(s32 *)((s32)a0 + 0xDC); + cleared = flags & ~8; + *(s32 *)((s32)a0 + 0xDC) = cleared; + if (flags & 0x40) { + *(s32 *)((s32)a0 + 0xDC) = cleared & ~0x40; + timer = 30; + } else { + timer = rand() % 16 + 15; + } + *(s32 *)((s32)a0 + 0x1C) = timer; + if (func_8012BD3C((s32)a0, 0x400, 0x8000) == 0) { + *(s32 *)((s32)a0 + 0xDC) |= 8; + } +} + INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_801893BC); @@ -5507,13 +5720,130 @@ void func_801897E8(s32 *a0) { } -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_801897F8); + +// @class: regalloc (WIDTH/li!=addu -> MATCH) +// @stuck: none — MATCH (58 ins), match_one + rtu_match. PIN-FREE (no register __asm__). +// Three levers, in the order they mattered: +// +// 1) The join block indexes every field off $a0, not $s0: the target COPIES the entity into $a0 +// at the TOP of the join block (`addu $a0,$s0,$zero`) and reads 0x5C/0x5E/0x60/0x62/0x20 off +// that copy. A naive `e = param_1;` at the join is deleted — cse.c's make_regs_eqv keeps the +// PARAMETER as qty_first_reg, so canon_reg rewrites every use of `e` back to param_1 and the +// copy dies. Writing the copy at the end of the ARMS instead is worse (2 mismatches worse): +// gcc hoists it above the inner `if` into the beqz delay slot and the arms then read off $a0. +// +// 2) THE LEVER: make the copy's variable ALSO the 0x20 pointer of the /4 arm. make_regs_eqv only +// lets the new pseudo take over the quantity when its live range escapes the cse basic block +// AND outlives the param's last use. Reusing `a` in the /4 arm (which sits *after* the join in +// the insn stream, and whose last mention `sh $v0,0x18($a0)` comes after param_1's last mention +// `lh $v0,0x100($s0)`) satisfies both clauses at once, so `a` becomes canonical, the copy +// survives, and the block addresses off it. The same reuse is what puts `lw $a0,0x20($s0)` / +// `lh $v1,0x18($a0)` in the /4 arm in the target's register order — two separate locals there +// give the mirrored $v1/$a0 pair (6 extra mismatches; verified). The reuse must be paired with +// the join-top copy: `a` shared but copied in the arm instead makes it a plain global allocno, +// global.c hands it a callee-saved reg and the function grows an $s1 save/restore (60 ins). +// A `register s32 a __asm__("$4")` pin also reaches 0 here (canon_reg bails on hard regs), but +// the pin is unnecessary and would trip the §42e/§86 pin guard on the ×6 family remap. +// +// 3) Tail statement order is 0x5C, 0x60, 0x62, 0x5E — the 0x5E store must be LAST. sched2 works +// the ready list LIFO, so a 0x5E written third floats to the front of the block as +// `li $v0,1 / sh $v0,0x5E` and steals $v0 from the 0x5C load-modify-store (9 mismatches). +// Written last it sinks past `lhu $v0,0x12($v1)`, reuses the now-dead $v1 for its constant and +// lands where the target has it. (All 24 orderings byte-swept: only 5C-60-62-5E and +// 60-5C-62-5E reach 0.) +// +// Widths: 0x100 is read at TWO widths on purpose — `u16` in the flag arm (target `lhu`) and `s16` +// in the /4 arm (target `lh`); combine folds the extend into the load, so the cast at the use site +// picks the opcode. Ditto `|= 1` on the s16 0x5C field giving `lhu`. §3-T4: both `beqz`es mean +// the NON-zero arm falls through, i.e. `func_8012BEE8(..) != 0` and `flags & 0x80` are the +// fall-through arms (Ghidra's seed for this address was a different function entirely). + +extern s32 func_8012BEE8(s32 a0); +extern void func_80131E00(); + +void func_801897F8(s32 param_1) { + s32 a; + s32 p; + s32 q; + s32 x; + s32 t; + u16 h; + + if (func_8012BEE8(param_1) != 0) { + if (*(s32 *)(param_1 + 0xDC) & 0x80) { + p = *(s32 *)(param_1 + 0x20); + *(s16 *)(p + 0x1C) = 0x1000; + *(s16 *)(p + 0x18) = 0x1000; + *(s32 *)(param_1 + 0xDC) &= ~0x80; + } else { + p = *(s32 *)(param_1 + 0x20); + h = *(u16 *)(param_1 + 0x100); + *(s16 *)(p + 0x1C) = h; + *(s16 *)(p + 0x18) = h; + } + a = param_1; + *(s16 *)(a + 0x5C) |= 1; + *(s16 *)(a + 0x60) = 0; + q = *(s32 *)(a + 0x20); + *(s16 *)(a + 0x62) = *(u16 *)(q + 0x12) + 0x800; + *(s16 *)(a + 0x5E) = 1; + ((void (*)(s32, s32))func_80131E00)(a, 1); + } else { + a = *(s32 *)(param_1 + 0x20); + x = *(s16 *)(a + 0x18); + t = x + (*(s16 *)(param_1 + 0x100) - x) / 4; + *(s16 *)(a + 0x1C) = t; + *(s16 *)(a + 0x18) = t; + } +} + INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_801898E0); INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8018993C); -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_801899B4); +// the beqz delay slot), so it is the FIRST statement, above the if; (3) both `*(s32*)(p+0x20)` +// reads in arm A are written as separate expressions — the intervening `sh` to 0x10 blocks CSE, +// which is why the target reloads 0x20 twice; (4) the tail compare is `iVar1 <= 0x8FFF`, NOT +// Ghidra's `< 0x9000`: 0x9000 does not fit the signed 16-bit `slti` immediate, so gcc +// materialises the bound with `ori $v1,$zero,0x8FFF` and emits the operand-reversed +// `slt $v1,$v1,$v0` + `bnez` over the 0x51F assignment (write the constant as 0x8FFF). +extern void func_8012A828(s32 a0, void *a1); +extern void func_8001C924(s32 a0, void *a1); +extern s32 func_8012BCCC(s32 a0); +extern void func_8002D4C8(s32 a0, s32 a1); + + +void func_801899B4(s32 param_1) { + + extern u8 D_801D7E70; + extern u8 D_801D612C; + extern u8 D_801D7D90; + s32 iVar1; + s32 uVar2; + + *(s16 *)(param_1 + 0x5C) = 0; + if (*(s32 *)(param_1 + 0xDC) & 2) { + *(s32 *)(param_1 + 0x1C) = 0x2D; + func_8012A828(param_1, &D_801D7E70); + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x10) = 0; + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = + (*(u16 *)(param_1 + 0x62) + 0x800) & 0xFFF; + *(s16 *)(param_1 + 0x52) = 0; + } else { + *(s32 *)(param_1 + 0x1C) = 0x37; + func_8001C924(*(s32 *)(param_1 + 0x20), &D_801D612C); + func_8012A828(param_1, &D_801D7D90); + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = *(u16 *)(param_1 + 0x62); + } + iVar1 = func_8012BCCC(param_1); + uVar2 = 0x520; + if (iVar1 <= 0x8FFF) { + uVar2 = 0x51F; + } + func_8002D4C8(uVar2, 0); +} + INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_80189A84); @@ -5606,7 +5936,34 @@ extern void func_8012C098(void); INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8018AD9C); -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8018AE08); + +/* func_8018AE08 — light/colour ramp-up on the entity's attached prim block. + * + * If the s16 flag at 0xFE is set, bump the three u16 colour words at + * 0x18/0x1A/0x1C of the block pointed to by the word at 0x20 by 0x40 each, + * then clamp all three to 0x1800 once the first one reaches it. + * + * Widths pinned off the target: `lh` at 0xFE and at 0x18 (the signed compare), + * `lhu` for the three read-modify-writes, `sh` for every store. The pointer at + * 0x20 is re-loaded before each RMW (the `sh` stores may alias it), which is + * exactly what writing the deref inline gives. + */ +void func_8018AE08(int param_1) { + int v1; + + if (*(short *)(param_1 + 0xfe) != 0) { + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x18) += 0x40; + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x1a) += 0x40; + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x1c) += 0x40; + v1 = *(int *)(param_1 + 0x20); + if (*(short *)(v1 + 0x18) >= 0x1800) { + *(short *)(v1 + 0x1c) = 0x1800; + *(short *)(v1 + 0x1a) = 0x1800; + *(short *)(v1 + 0x18) = 0x1800; + } + } +} + INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8018AE90); @@ -5861,7 +6218,31 @@ INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8018BB5 INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8018BDE4); -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8018BF78); + +/* func_8018BF78 — "is another entity of type 0x35C sharing my 0x64 owner?" + * + * Walks the 0x60-entry entity table at D_801202A0 (stride 0x10C) with an int + * counter (the target keeps the count in $a2 and `slti ...,0x60`, so it is a + * counted loop, NOT the D_80126720 pointer-bound idiom the sibling walkers + * use). Returns 1 for the first entry whose u16 kind == 0x35C, whose word at + * 0x64 equals the caller's word at 0x64, and which is not the caller itself. + */ +s32 func_8018BF78(s32 arg0) { + extern u8 D_801202A0[]; + u8 *p; + s32 i; + + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == 0x35C && *(s32 *)(arg0 + 0x64) == *(s32 *)(p + 0x64) && + arg0 != (s32)p) { + return 1; + } + p += 0x10C; + } + return 0; +} + extern void func_8012EC04(s32 param_1, s32 param_2, s32 *param_3); @@ -5883,7 +6264,24 @@ void func_8018BFD0(s32 arg0) { } -INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8018C04C); + +/* func_8018C04C — guard-then-free tail (cookbook §71 sibling shape: + * src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c func_80144458 tail, and + * src/ov_SC03_099/ov_SC03_099_jr_80140608.c:2432 func_80016714(x, 0x38)). */ + +extern void func_80016714(void *a0, s32 a1); +extern void func_8012C218(void *a0); + +void func_8018C04C(void *arg0) { + void *temp_a0; + + temp_a0 = *(void **)((char *)arg0 + 0xCC); + if (temp_a0 != NULL) { + func_80016714(temp_a0, 0x38); + } + func_8012C218(arg0); +} + INCLUDE_ASM("asm/ov_SC03_006/nonmatchings/ov_SC03_006_jr_8017AE2C", func_8018C090); diff --git a/src/ov_SC03_007/ov_SC03_007_jr_80135D20.c b/src/ov_SC03_007/ov_SC03_007_jr_80135D20.c index 31e74e633d..4817f92563 100644 --- a/src/ov_SC03_007/ov_SC03_007_jr_80135D20.c +++ b/src/ov_SC03_007/ov_SC03_007_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_007/nonmatchings/ov_SC03_007_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018798C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018798C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018798C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018798C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018798C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_007/ov_SC03_007_jr_80154C24.c b/src/ov_SC03_007/ov_SC03_007_jr_80154C24.c index a31d411ed5..9f0294bb96 100644 --- a/src/ov_SC03_007/ov_SC03_007_jr_80154C24.c +++ b/src/ov_SC03_007/ov_SC03_007_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_007/nonmatchings/ov_SC03_007_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80189714)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80189714[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80189714[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_007/ov_SC03_007_jr_8017AE2C.c b/src/ov_SC03_007/ov_SC03_007_jr_8017AE2C.c index 1f2b110c69..2e717e275a 100644 --- a/src/ov_SC03_007/ov_SC03_007_jr_8017AE2C.c +++ b/src/ov_SC03_007/ov_SC03_007_jr_8017AE2C.c @@ -382,7 +382,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3820,7 +3819,34 @@ void func_8017E748(void) { INCLUDE_ASM("asm/ov_SC03_007/nonmatchings/ov_SC03_007_jr_8017AE2C", func_8017E750); -INCLUDE_ASM("asm/ov_SC03_007/nonmatchings/ov_SC03_007_jr_8017AE2C", func_8017E7B4); + +/* func_8017E7B4 — light/colour ramp-up on the entity's attached prim block. + * + * If the s16 flag at 0xFE is set, bump the three u16 colour words at + * 0x18/0x1A/0x1C of the block pointed to by the word at 0x20 by 0x40 each, + * then clamp all three to 0x1800 once the first one reaches it. + * + * Widths pinned off the target: `lh` at 0xFE and at 0x18 (the signed compare), + * `lhu` for the three read-modify-writes, `sh` for every store. The pointer at + * 0x20 is re-loaded before each RMW (the `sh` stores may alias it), which is + * exactly what writing the deref inline gives. + */ +void func_8017E7B4(int param_1) { + int v1; + + if (*(short *)(param_1 + 0xfe) != 0) { + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x18) += 0x40; + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x1a) += 0x40; + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x1c) += 0x40; + v1 = *(int *)(param_1 + 0x20); + if (*(short *)(v1 + 0x18) >= 0x1800) { + *(short *)(v1 + 0x1c) = 0x1800; + *(short *)(v1 + 0x1a) = 0x1800; + *(short *)(v1 + 0x18) = 0x1800; + } + } +} + INCLUDE_ASM("asm/ov_SC03_007/nonmatchings/ov_SC03_007_jr_8017AE2C", func_8017E83C); @@ -4089,7 +4115,34 @@ extern void func_8002A04C(s32 a0); INCLUDE_ASM("asm/ov_SC03_007/nonmatchings/ov_SC03_007_jr_8017AE2C", func_801820DC); -INCLUDE_ASM("asm/ov_SC03_007/nonmatchings/ov_SC03_007_jr_8017AE2C", func_80182148); + +/* func_80182148 — light/colour ramp-up on the entity's attached prim block. + * + * If the s16 flag at 0xFE is set, bump the three u16 colour words at + * 0x18/0x1A/0x1C of the block pointed to by the word at 0x20 by 0x40 each, + * then clamp all three to 0x1800 once the first one reaches it. + * + * Widths pinned off the target: `lh` at 0xFE and at 0x18 (the signed compare), + * `lhu` for the three read-modify-writes, `sh` for every store. The pointer at + * 0x20 is re-loaded before each RMW (the `sh` stores may alias it), which is + * exactly what writing the deref inline gives. + */ +void func_80182148(int param_1) { + int v1; + + if (*(short *)(param_1 + 0xfe) != 0) { + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x18) += 0x40; + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x1a) += 0x40; + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x1c) += 0x40; + v1 = *(int *)(param_1 + 0x20); + if (*(short *)(v1 + 0x18) >= 0x1800) { + *(short *)(v1 + 0x1c) = 0x1800; + *(short *)(v1 + 0x1a) = 0x1800; + *(short *)(v1 + 0x18) = 0x1800; + } + } +} + INCLUDE_ASM("asm/ov_SC03_007/nonmatchings/ov_SC03_007_jr_8017AE2C", func_801821D0); @@ -4681,7 +4734,31 @@ INCLUDE_ASM("asm/ov_SC03_007/nonmatchings/ov_SC03_007_jr_8017AE2C", func_80186DF INCLUDE_ASM("asm/ov_SC03_007/nonmatchings/ov_SC03_007_jr_8017AE2C", func_80187080); -INCLUDE_ASM("asm/ov_SC03_007/nonmatchings/ov_SC03_007_jr_8017AE2C", func_80187214); + +/* func_80187214 — "is another entity of type 0x35C sharing my 0x64 owner?" + * + * Walks the 0x60-entry entity table at D_801202A0 (stride 0x10C) with an int + * counter (the target keeps the count in $a2 and `slti ...,0x60`, so it is a + * counted loop, NOT the D_80126720 pointer-bound idiom the sibling walkers + * use). Returns 1 for the first entry whose u16 kind == 0x35C, whose word at + * 0x64 equals the caller's word at 0x64, and which is not the caller itself. + */ +s32 func_80187214(s32 arg0) { + extern u8 D_801202A0[]; + u8 *p; + s32 i; + + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == 0x35C && *(s32 *)(arg0 + 0x64) == *(s32 *)(p + 0x64) && + arg0 != (s32)p) { + return 1; + } + p += 0x10C; + } + return 0; +} + extern void func_8012EC04(s32 param_1, s32 param_2, s32 *param_3); @@ -4703,7 +4780,24 @@ void func_8018726C(s32 arg0) { } -INCLUDE_ASM("asm/ov_SC03_007/nonmatchings/ov_SC03_007_jr_8017AE2C", func_801872E8); + +/* func_801872E8 — guard-then-free tail (cookbook §71 sibling shape: + * src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c func_80144458 tail, and + * src/ov_SC03_099/ov_SC03_099_jr_80140608.c:2432 func_80016714(x, 0x38)). */ + +extern void func_80016714(void *a0, s32 a1); +extern void func_8012C218(void *a0); + +void func_801872E8(void *arg0) { + void *temp_a0; + + temp_a0 = *(void **)((char *)arg0 + 0xCC); + if (temp_a0 != NULL) { + func_80016714(temp_a0, 0x38); + } + func_8012C218(arg0); +} + INCLUDE_ASM("asm/ov_SC03_007/nonmatchings/ov_SC03_007_jr_8017AE2C", func_8018732C); diff --git a/src/ov_SC03_010/ov_SC03_010_jr_80135D20.c b/src/ov_SC03_010/ov_SC03_010_jr_80135D20.c index 01ef83f182..35156537f8 100644 --- a/src/ov_SC03_010/ov_SC03_010_jr_80135D20.c +++ b/src/ov_SC03_010/ov_SC03_010_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_010/nonmatchings/ov_SC03_010_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801804AC[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801804AC[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801804AC[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801804AC[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801804AC[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_010/ov_SC03_010_jr_80154C24.c b/src/ov_SC03_010/ov_SC03_010_jr_80154C24.c index a20e8a4f0f..f35846231f 100644 --- a/src/ov_SC03_010/ov_SC03_010_jr_80154C24.c +++ b/src/ov_SC03_010/ov_SC03_010_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_010/nonmatchings/ov_SC03_010_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80182234)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80182234[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80182234[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_011/ov_SC03_011_jr_80135D20.c b/src/ov_SC03_011/ov_SC03_011_jr_80135D20.c index ab7568b016..fa68a4ce29 100644 --- a/src/ov_SC03_011/ov_SC03_011_jr_80135D20.c +++ b/src/ov_SC03_011/ov_SC03_011_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_011/nonmatchings/ov_SC03_011_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018181C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018181C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018181C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018181C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018181C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_011/ov_SC03_011_jr_80154C24.c b/src/ov_SC03_011/ov_SC03_011_jr_80154C24.c index f011a1110a..ac0515e15a 100644 --- a/src/ov_SC03_011/ov_SC03_011_jr_80154C24.c +++ b/src/ov_SC03_011/ov_SC03_011_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_011/nonmatchings/ov_SC03_011_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801835A4)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801835A4[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801835A4[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_012/ov_SC03_012_jr_80135D20.c b/src/ov_SC03_012/ov_SC03_012_jr_80135D20.c index a3cad2862d..45c8a9a493 100644 --- a/src/ov_SC03_012/ov_SC03_012_jr_80135D20.c +++ b/src/ov_SC03_012/ov_SC03_012_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_012/nonmatchings/ov_SC03_012_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017E6FC[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017E6FC[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017E6FC[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017E6FC[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017E6FC[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_012/ov_SC03_012_jr_80154C24.c b/src/ov_SC03_012/ov_SC03_012_jr_80154C24.c index 9db2204e52..7a2df38c89 100644 --- a/src/ov_SC03_012/ov_SC03_012_jr_80154C24.c +++ b/src/ov_SC03_012/ov_SC03_012_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_012/nonmatchings/ov_SC03_012_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80180484)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80180484[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80180484[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_013/ov_SC03_013_jr_80135D20.c b/src/ov_SC03_013/ov_SC03_013_jr_80135D20.c index 81def293b2..09c5a39a5e 100644 --- a/src/ov_SC03_013/ov_SC03_013_jr_80135D20.c +++ b/src/ov_SC03_013/ov_SC03_013_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_013/nonmatchings/ov_SC03_013_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801814E4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801814E4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801814E4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801814E4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801814E4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_013/ov_SC03_013_jr_80154C24.c b/src/ov_SC03_013/ov_SC03_013_jr_80154C24.c index 99e440c8a1..63be89dc0c 100644 --- a/src/ov_SC03_013/ov_SC03_013_jr_80154C24.c +++ b/src/ov_SC03_013/ov_SC03_013_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_013/nonmatchings/ov_SC03_013_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018326C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018326C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018326C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_014/ov_SC03_014_jr_80135D20.c b/src/ov_SC03_014/ov_SC03_014_jr_80135D20.c index e6b8df7235..bf2301139b 100644 --- a/src/ov_SC03_014/ov_SC03_014_jr_80135D20.c +++ b/src/ov_SC03_014/ov_SC03_014_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_014/nonmatchings/ov_SC03_014_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018BB20[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018BB20[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018BB20[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018BB20[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018BB20[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_014/ov_SC03_014_jr_80154C24.c b/src/ov_SC03_014/ov_SC03_014_jr_80154C24.c index 799fea0d28..7ef6ae0fd5 100644 --- a/src/ov_SC03_014/ov_SC03_014_jr_80154C24.c +++ b/src/ov_SC03_014/ov_SC03_014_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_014/nonmatchings/ov_SC03_014_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018D8A8)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018D8A8[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018D8A8[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_014/ov_SC03_014_jr_8017EB7C.c b/src/ov_SC03_014/ov_SC03_014_jr_8017EB7C.c index 8db05642f6..77b6a68535 100644 --- a/src/ov_SC03_014/ov_SC03_014_jr_8017EB7C.c +++ b/src/ov_SC03_014/ov_SC03_014_jr_8017EB7C.c @@ -4055,7 +4055,15 @@ void func_80182028(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_014/nonmatchings/ov_SC03_014_jr_8017EB7C", func_80182064); +extern void func_80147324(s32 arg0); +void func_80182064(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -4084,7 +4092,20 @@ INCLUDE_ASM("asm/ov_SC03_014/nonmatchings/ov_SC03_014_jr_8017EB7C", func_8018211 INCLUDE_ASM("asm/ov_SC03_014/nonmatchings/ov_SC03_014_jr_8017EB7C", func_80182194); -INCLUDE_ASM("asm/ov_SC03_014/nonmatchings/ov_SC03_014_jr_8017EB7C", func_801822FC); +extern void func_80182348(int); +extern void func_80146C3C(void); +void func_801822FC(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_80182348(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC03_014/nonmatchings/ov_SC03_014_jr_8017EB7C", func_80182348); @@ -4096,7 +4117,13 @@ void func_80182654(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_014/nonmatchings/ov_SC03_014_jr_8017EB7C", func_80182690); +extern void func_80147324(s32 arg0); +void func_80182690(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_801826D0 — a state-tick: bump the frame counter at 0x1C; while it is @@ -4198,7 +4225,25 @@ void func_801827CC(void *a0) } -INCLUDE_ASM("asm/ov_SC03_014/nonmatchings/ov_SC03_014_jr_8017EB7C", func_801828A0); +extern void func_80182348(int); +extern void func_80146C3C(void); +void func_801828A0(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_80182348)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_8018F750[])(void); @@ -4210,7 +4255,22 @@ void func_801828F4(void *a0) { INCLUDE_ASM("asm/ov_SC03_014/nonmatchings/ov_SC03_014_jr_8017EB7C", func_80182930); -INCLUDE_ASM("asm/ov_SC03_014/nonmatchings/ov_SC03_014_jr_8017EB7C", func_801829E4); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_80182A40(void *a0); +void func_801829E4(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_80182A40(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_014/nonmatchings/ov_SC03_014_jr_8017EB7C", func_80182A40); diff --git a/src/ov_SC03_015/ov_SC03_015_jr_80135D20.c b/src/ov_SC03_015/ov_SC03_015_jr_80135D20.c index 2b3a5242b3..bf2301139b 100644 --- a/src/ov_SC03_015/ov_SC03_015_jr_80135D20.c +++ b/src/ov_SC03_015/ov_SC03_015_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018BB20[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018BB20[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018BB20[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018BB20[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018BB20[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_015/ov_SC03_015_jr_80154C24.c b/src/ov_SC03_015/ov_SC03_015_jr_80154C24.c index 86960123db..7ef6ae0fd5 100644 --- a/src/ov_SC03_015/ov_SC03_015_jr_80154C24.c +++ b/src/ov_SC03_015/ov_SC03_015_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018D8A8)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018D8A8[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018D8A8[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_015/ov_SC03_015_jr_8017EB7C.c b/src/ov_SC03_015/ov_SC03_015_jr_8017EB7C.c index 0a66e558d5..8e253a4e82 100644 --- a/src/ov_SC03_015/ov_SC03_015_jr_8017EB7C.c +++ b/src/ov_SC03_015/ov_SC03_015_jr_8017EB7C.c @@ -3959,7 +3959,15 @@ void func_80182028(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_8017EB7C", func_80182064); +extern void func_80147324(s32 arg0); +void func_80182064(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3988,7 +3996,20 @@ INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_8017EB7C", func_8018211 INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_8017EB7C", func_80182194); -INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_8017EB7C", func_801822FC); +extern void func_80182348(int); +extern void func_80146C3C(void); +void func_801822FC(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_80182348(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_8017EB7C", func_80182348); @@ -4000,7 +4021,13 @@ void func_80182654(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_8017EB7C", func_80182690); +extern void func_80147324(s32 arg0); +void func_80182690(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_801826D0 — a state-tick: bump the frame counter at 0x1C; while it is @@ -4102,7 +4129,25 @@ void func_801827CC(void *a0) } -INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_8017EB7C", func_801828A0); +extern void func_80182348(int); +extern void func_80146C3C(void); +void func_801828A0(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_80182348)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_8018F750[])(void); @@ -4114,7 +4159,22 @@ void func_801828F4(void *a0) { INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_8017EB7C", func_80182930); -INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_8017EB7C", func_801829E4); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_80182A40(void *a0); +void func_801829E4(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_80182A40(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_jr_8017EB7C", func_80182A40); diff --git a/src/ov_SC03_015/ov_SC03_015_o0c.c b/src/ov_SC03_015/ov_SC03_015_o0c.c index ca22ed5dd8..323b2f56d7 100644 --- a/src/ov_SC03_015/ov_SC03_015_o0c.c +++ b/src/ov_SC03_015/ov_SC03_015_o0c.c @@ -2756,12 +2756,50 @@ INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_o0c", func_80183D50); INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_o0c", func_80183F28); -INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_o0c", func_80184028); + + + +s32 func_80184028(void) { + + extern s32 D_801EAC68; + return D_801EAC68; +} + INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_o0c", func_80184058); INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_o0c", func_80184264); -INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_o0c", func_801842E0); -INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_o0c", func_80184354); + + +s32 func_801842E0(void) { + + extern s32 D_801270C8; + if (D_801270C8 == 0) { + D_801270C8 = 1; + } else if (D_801270C8 == 2) { + return 1; + } + return 0; +} + + + +extern void func_800183E0(s32 a0); + +void func_80184354(void) { + + extern u32 D_801EAC40; + extern u16 D_801EAC44[]; + extern u16 D_8018F864[]; + extern u16 D_8018F884[]; + u32 i; + + for (i = 0; i < 16; i++) { + D_801EAC44[i] = D_8018F864[((D_801EAC40 >> 8) + i) & 0xF]; + } + func_800183E0((s32)&D_8018F884); + D_801EAC40 += 0x40; +} + diff --git a/src/ov_SC03_015/ov_SC03_015_o0d.c b/src/ov_SC03_015/ov_SC03_015_o0d.c index 1168716908..5691c32332 100644 --- a/src/ov_SC03_015/ov_SC03_015_o0d.c +++ b/src/ov_SC03_015/ov_SC03_015_o0d.c @@ -2747,12 +2747,29 @@ extern void (*D_8018F850[])(void); extern void func_80183A18(void *a0); extern s32 func_80012ABC(s32 a0, s32 a1, s32 a2); extern void func_80183B58(s32 param_1, s16 *param_2); -extern s32 D_801EAC64; -extern s32 D_801EAC68; extern void func_80184440(void); /* ==== end §8b carried decl layer ==== */ -INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_o0d", func_80184474); + +extern void func_80184538(s32 a0); + +void func_80184474(void) { + + extern s32 D_801EAC64; + extern s32 D_801EAC68; + extern u8 D_8018F8A4[]; + s32 unused; /* -O0 frame padding: original had a dead local (0x20 frame, not 0x18) */ + + --D_801EAC64; + if (D_801EAC64 == 0) { + func_80184538(D_801EAC68); + D_801EAC64 = D_8018F8A4[D_801EAC68] * 2; + if (++D_801EAC68 >= 30) { + D_801EAC68 = 0; + } + } +} + INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_o0d", func_80184538); @@ -2789,6 +2806,40 @@ s32 func_80184794(void) { } -INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_o0d", func_801847EC); -INCLUDE_ASM("asm/ov_SC03_015/nonmatchings/ov_SC03_015_o0d", func_80184868); + +extern s32 func_8001ABBC(s32 a0, s32 a1, void *a2, s32 a3, s32 sp10); + +s32 func_801847EC(void) { + + extern s32 D_800C7C60; + extern s32 *D_800C7C64; + extern s32 D_800A2E20; + extern u8 D_800AEE40; + s32 ret; + + D_800C7C60 = 0x41; + D_800C7C64 = &D_800A2E20; + ret = func_8001ABBC(0, 0, &D_800AEE40, 0, (s32)&D_800C7C60); + return ret; +} + + + + +extern s32 func_8001ABBC(s32 a0, s32 a1, void *a2, s32 a3, s32 sp10); + +s32 func_80184868(void) { + + extern s32 D_800C7C60; + extern s32 *D_800C7C64; + extern s32 D_800A2E20; + extern u8 D_800AEE48; + s32 ret; + + D_800C7C60 = 0x39; + D_800C7C64 = &D_800A2E20; + ret = func_8001ABBC(0, 0, &D_800AEE48, 0, (s32)&D_800C7C60); + return ret; +} + diff --git a/src/ov_SC03_023/ov_SC03_023_jr_80135D20.c b/src/ov_SC03_023/ov_SC03_023_jr_80135D20.c index bc2f49c84f..d8354cde08 100644 --- a/src/ov_SC03_023/ov_SC03_023_jr_80135D20.c +++ b/src/ov_SC03_023/ov_SC03_023_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_023/nonmatchings/ov_SC03_023_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017F49C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017F49C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017F49C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017F49C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017F49C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_023/ov_SC03_023_jr_80154C24.c b/src/ov_SC03_023/ov_SC03_023_jr_80154C24.c index 980320e9b6..ebec6079ed 100644 --- a/src/ov_SC03_023/ov_SC03_023_jr_80154C24.c +++ b/src/ov_SC03_023/ov_SC03_023_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_023/nonmatchings/ov_SC03_023_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80181224)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80181224[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80181224[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_024/ov_SC03_024_jr_80135D20.c b/src/ov_SC03_024/ov_SC03_024_jr_80135D20.c index 1ca098e5df..35cbb066ea 100644 --- a/src/ov_SC03_024/ov_SC03_024_jr_80135D20.c +++ b/src/ov_SC03_024/ov_SC03_024_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_024/nonmatchings/ov_SC03_024_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801874C0[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801874C0[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801874C0[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801874C0[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801874C0[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_024/ov_SC03_024_jr_80154C24.c b/src/ov_SC03_024/ov_SC03_024_jr_80154C24.c index 51bd0b8685..1e455bde3a 100644 --- a/src/ov_SC03_024/ov_SC03_024_jr_80154C24.c +++ b/src/ov_SC03_024/ov_SC03_024_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_024/nonmatchings/ov_SC03_024_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80189248)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80189248[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80189248[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_028/ov_SC03_028_jr_80135D20.c b/src/ov_SC03_028/ov_SC03_028_jr_80135D20.c index e60dfb2d5a..299e00a09d 100644 --- a/src/ov_SC03_028/ov_SC03_028_jr_80135D20.c +++ b/src/ov_SC03_028/ov_SC03_028_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_028/nonmatchings/ov_SC03_028_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018BF8C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018BF8C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018BF8C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018BF8C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018BF8C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_028/ov_SC03_028_jr_80154C24.c b/src/ov_SC03_028/ov_SC03_028_jr_80154C24.c index 2cbd3ad826..787f90702d 100644 --- a/src/ov_SC03_028/ov_SC03_028_jr_80154C24.c +++ b/src/ov_SC03_028/ov_SC03_028_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_028/nonmatchings/ov_SC03_028_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018DD14)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018DD14[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018DD14[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_028/ov_SC03_028_jr_8017AE2C.c b/src/ov_SC03_028/ov_SC03_028_jr_8017AE2C.c index 6ab60d9c86..5a84bc20f7 100644 --- a/src/ov_SC03_028/ov_SC03_028_jr_8017AE2C.c +++ b/src/ov_SC03_028/ov_SC03_028_jr_8017AE2C.c @@ -50,7 +50,6 @@ extern s32 func_80165A50(s32); extern void func_80029514(s32); extern u8 D_800AF630[]; extern u8 D_80078EC0; -extern s32 D_80126B58; extern s32 func_80028FBC(void); extern s32 func_80029000(void); extern s32 func_80028D9C(void); @@ -3929,7 +3928,48 @@ void func_801860BC(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_028/nonmatchings/ov_SC03_028_jr_8017AE2C", func_801860F8); + +// @stuck: none — MATCH (42 ins), iteration 1, rtu_match clean. +// Saturating add of a 3-byte RGB triple by a signed delta. +// Idioms: (1) `s8` by-value param => entry `sll/sra 24` for the sign test only; +// combine folds the extension back out of `~a1`/`-a1`/`a0[i]+a1` because every +// consumer is 8-bit (andi 0xFF / sb), so $a1 is used RAW after the test. +// (2) branch sense read off the target `sltu` operand ORDER (§3-T4): positive arm +// `sltu lim,p[i]` => store when `p[i] <= lim`; negative arm `sltu p[i],lim` +// => store when `p[i] >= lim`. +// (3) the third `if` written out in BOTH arms; jump.c cross-jumps the identical +// tails into the shared `j .L8018C344` (§5a) — do not hoist it after the if/else. +void func_801860F8(u8 *a0, s8 a1) { + u8 lim; + + if (a1 == 0) { + return; + } + if (a1 > 0) { + lim = ~a1; + if (a0[0] <= lim) { + a0[0] = a0[0] + a1; + } + if (a0[1] <= lim) { + a0[1] = a0[1] + a1; + } + if (a0[2] <= lim) { + a0[2] = a0[2] + a1; + } + } else { + lim = -a1; + if (a0[0] >= lim) { + a0[0] = a0[0] + a1; + } + if (a0[1] >= lim) { + a0[1] = a0[1] + a1; + } + if (a0[2] >= lim) { + a0[2] = a0[2] + a1; + } + } +} + extern void (*D_80190BF4[])(void); @@ -4352,7 +4392,20 @@ INCLUDE_ASM("asm/ov_SC03_028/nonmatchings/ov_SC03_028_jr_8017AE2C", func_8018B1D INCLUDE_ASM("asm/ov_SC03_028/nonmatchings/ov_SC03_028_jr_8017AE2C", func_8018B234); -INCLUDE_ASM("asm/ov_SC03_028/nonmatchings/ov_SC03_028_jr_8017AE2C", func_8018B260); + +extern s32 func_8014C050(s32 a0, s32 a1); + +void func_8018B260(void) { + + extern s32 D_80126B58; + s32 t; + + t = func_8014C050((s32)&D_80126B58, 0x28); + if (t != 0) { + *(u16 *)(t + 2) += 1; + } +} + extern void (*D_80190E8C[])(void); diff --git a/src/ov_SC03_029/ov_SC03_029_jr_80135D20.c b/src/ov_SC03_029/ov_SC03_029_jr_80135D20.c index 9742d545e3..86b3743784 100644 --- a/src/ov_SC03_029/ov_SC03_029_jr_80135D20.c +++ b/src/ov_SC03_029/ov_SC03_029_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80187DC4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80187DC4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80187DC4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80187DC4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80187DC4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_029/ov_SC03_029_jr_80154C24.c b/src/ov_SC03_029/ov_SC03_029_jr_80154C24.c index 915eceb480..9c77175dd1 100644 --- a/src/ov_SC03_029/ov_SC03_029_jr_80154C24.c +++ b/src/ov_SC03_029/ov_SC03_029_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80189B4C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80189B4C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80189B4C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_029/ov_SC03_029_jr_8017AE2C.c b/src/ov_SC03_029/ov_SC03_029_jr_8017AE2C.c index 6e0ecb27c4..93f1c0f9ea 100644 --- a/src/ov_SC03_029/ov_SC03_029_jr_8017AE2C.c +++ b/src/ov_SC03_029/ov_SC03_029_jr_8017AE2C.c @@ -3479,7 +3479,15 @@ void func_8017D0E8(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_8017AE2C", func_8017D124); +extern void func_80147324(s32 arg0); +void func_8017D124(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3508,7 +3516,20 @@ INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_8017AE2C", func_8017D1D INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_8017AE2C", func_8017D254); -INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_8017AE2C", func_8017D3BC); +extern void func_8017D408(int); +extern void func_80146C3C(void); +void func_8017D3BC(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D408(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_8017AE2C", func_8017D408); @@ -3520,7 +3541,13 @@ void func_8017D714(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_8017AE2C", func_8017D750); +extern void func_80147324(s32 arg0); +void func_8017D750(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D790 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3622,7 +3649,25 @@ void func_8017D88C(void *a0) } -INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_8017AE2C", func_8017D960); +extern void func_8017D408(int); +extern void func_80146C3C(void); +void func_8017D960(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D408)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_8018B3B4[])(void); @@ -3634,7 +3679,22 @@ void func_8017D9B4(void *a0) { INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_8017AE2C", func_8017D9F0); -INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_8017AE2C", func_8017DAA4); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017DB00(void *a0); +void func_8017DAA4(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017DB00(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_8017AE2C", func_8017DB00); diff --git a/src/ov_SC03_029/ov_SC03_029_jr_8017DC70.c b/src/ov_SC03_029/ov_SC03_029_jr_8017DC70.c index 2321b5cfb1..ac8953a2d5 100644 --- a/src/ov_SC03_029/ov_SC03_029_jr_8017DC70.c +++ b/src/ov_SC03_029/ov_SC03_029_jr_8017DC70.c @@ -614,7 +614,6 @@ extern s32 func_8014E83C(s32 arg0, s16 * arg1, s16 * arg2); extern void func_8014E934(s32 _arg0); extern s32 func_8014EA4C(void *a0, void *a1, void *a2, s32 a3); extern s32 func_8014E98C(void *a0); -extern u16 D_800B99DA; extern s32 D_801150D8; extern s16 D_801152AA; extern u8 D_80126720[]; @@ -3352,7 +3351,50 @@ INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_8017DC70", func_8017F31 INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_8017DC70", func_8017F378); -INCLUDE_ASM("asm/ov_SC03_029/nonmatchings/ov_SC03_029_jr_8017DC70", func_8017F3AC); + +// func_8017F3AC — MATCH (60 ins), match_one + rtu_match. Two levers: +// 1) §20 pointer-var-to-the-global: `u16 *p = &D_800B99DA;` and read `*p` +// twice. The bare global would fold %lo into each access independently +// (two lui/lhu pairs, no $s1); the pointer var force_regs the address so +// CSE hoists it into the callee-saved $s1 across both calls. +// 2) SEPARATE temps `t` and `u` for the two call results (NOT one reused +// `t`). gcc-2.7.2 expand_divmod emits `move temp,op0; bgez temp; temp+=d-1` +// for a signed /2^k; cse.c make_regs_eqv only makes `temp` the canonical +// reg of the quantity when temp's REGNO_LAST_UID outlives op0's. Reusing +// one `t` across both calls stretches op0's last-use past temp's, so op0 +// stays canonical and cse rewrites the pair to `bgez $v0` + `addiu +// $v1,$v0,3` — the copy then fills the delay slot and the function comes +// out 1 instruction short. Split temps ⇒ op0 dies immediately ⇒ target's +// `addu $v1,$v0,$zero; bgez $v1; nop; addiu $v1,$v1,3`. +// (The 2nd division still coalesces temp/u into $v0, matching `bgez $v0`.) + +extern s32 func_80012F74(s32 a0, s32 a1, s32 a2, s32 a3); +extern s32 func_80047948(s32 a0); +extern s32 func_8004787C(s32 a0); + +void func_8017F3AC(s32 param_1) { + + extern u16 D_800B99DA; + u16 *p = &D_800B99DA; + s32 t; + s32 u; + + *(s16 *)(param_1 + 0x20E) = func_80012F74(*(s16 *)(param_1 + 0x20E), 0, 10, 1); + *(s16 *)(param_1 + 0x12E) = 1; + t = func_8004787C((*p & 0x3F) << 6); + *(s16 *)(param_1 + 0x128) = *(s16 *)(param_1 + 0x20E) + t / 4; + u = func_80047948((*p & 0x3F) << 6); + *(s16 *)(param_1 + 0x12C) = u / 8; + if (*(s16 *)(param_1 + 0x13A) != 0) { + *(s16 *)(param_1 + 0x13A) += *(s8 *)(param_1 + 0x20D); + *(s16 *)(param_1 + 0x20C) -= 0xE0; + if (*(s16 *)(param_1 + 0x13A) < 0) { + *(s16 *)(param_1 + 0x13A) = 0; + *(s16 *)(param_1 + 0x20C) = 0; + } + } +} + extern void func_8016EE40(s32 a0, s32 a1, s32 a2); void func_8017F49C(void) { diff --git a/src/ov_SC03_030/ov_SC03_030_jr_80135D20.c b/src/ov_SC03_030/ov_SC03_030_jr_80135D20.c index 49e210ec7f..e4582cd5fd 100644 --- a/src/ov_SC03_030/ov_SC03_030_jr_80135D20.c +++ b/src/ov_SC03_030/ov_SC03_030_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80182400[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80182400[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80182400[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80182400[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80182400[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_030/ov_SC03_030_jr_80154C24.c b/src/ov_SC03_030/ov_SC03_030_jr_80154C24.c index 7f69fedd02..42fb5219dc 100644 --- a/src/ov_SC03_030/ov_SC03_030_jr_80154C24.c +++ b/src/ov_SC03_030/ov_SC03_030_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80184188)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80184188[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80184188[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_030/ov_SC03_030_jr_8017AE2C.c b/src/ov_SC03_030/ov_SC03_030_jr_8017AE2C.c index 2e9fc51dd8..72cf3920f3 100644 --- a/src/ov_SC03_030/ov_SC03_030_jr_8017AE2C.c +++ b/src/ov_SC03_030/ov_SC03_030_jr_8017AE2C.c @@ -612,7 +612,6 @@ extern s32 func_8014E83C(s32 arg0, s16 * arg1, s16 * arg2); extern void func_8014E934(s32 _arg0); extern s32 func_8014EA4C(void *a0, void *a1, void *a2, s32 a3); extern s32 func_8014E98C(void *a0); -extern u16 D_800B99DA; extern s32 D_801150D8; extern s16 D_801152AA; extern u8 D_80126720[]; @@ -3547,7 +3546,50 @@ INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_8017DF1 INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_8017DF54); -INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_8017DFA0); + +// func_8017DFA0 — MATCH (60 ins), match_one + rtu_match. Two levers: +// 1) §20 pointer-var-to-the-global: `u16 *p = &D_800B99DA;` and read `*p` +// twice. The bare global would fold %lo into each access independently +// (two lui/lhu pairs, no $s1); the pointer var force_regs the address so +// CSE hoists it into the callee-saved $s1 across both calls. +// 2) SEPARATE temps `t` and `u` for the two call results (NOT one reused +// `t`). gcc-2.7.2 expand_divmod emits `move temp,op0; bgez temp; temp+=d-1` +// for a signed /2^k; cse.c make_regs_eqv only makes `temp` the canonical +// reg of the quantity when temp's REGNO_LAST_UID outlives op0's. Reusing +// one `t` across both calls stretches op0's last-use past temp's, so op0 +// stays canonical and cse rewrites the pair to `bgez $v0` + `addiu +// $v1,$v0,3` — the copy then fills the delay slot and the function comes +// out 1 instruction short. Split temps ⇒ op0 dies immediately ⇒ target's +// `addu $v1,$v0,$zero; bgez $v1; nop; addiu $v1,$v1,3`. +// (The 2nd division still coalesces temp/u into $v0, matching `bgez $v0`.) + +extern s32 func_80012F74(s32 a0, s32 a1, s32 a2, s32 a3); +extern s32 func_80047948(s32 a0); +extern s32 func_8004787C(s32 a0); + +void func_8017DFA0(s32 param_1) { + + extern u16 D_800B99DA; + u16 *p = &D_800B99DA; + s32 t; + s32 u; + + *(s16 *)(param_1 + 0x20E) = func_80012F74(*(s16 *)(param_1 + 0x20E), 0, 10, 1); + *(s16 *)(param_1 + 0x12E) = 1; + t = func_8004787C((*p & 0x3F) << 6); + *(s16 *)(param_1 + 0x128) = *(s16 *)(param_1 + 0x20E) + t / 4; + u = func_80047948((*p & 0x3F) << 6); + *(s16 *)(param_1 + 0x12C) = u / 8; + if (*(s16 *)(param_1 + 0x13A) != 0) { + *(s16 *)(param_1 + 0x13A) += *(s8 *)(param_1 + 0x20D); + *(s16 *)(param_1 + 0x20C) -= 0xE0; + if (*(s16 *)(param_1 + 0x13A) < 0) { + *(s16 *)(param_1 + 0x13A) = 0; + *(s16 *)(param_1 + 0x20C) = 0; + } + } +} + INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_8017E090); @@ -3750,7 +3792,18 @@ INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_8018049 INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_801804F4); -INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_8018055C); + +extern s32 func_8012C0EC(s32); + +void func_8018055C(void *a0) { + + extern void (*D_8018689C[])(void); + D_8018689C[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)a0 != 0) { + ((void (*)(void *))func_8012C0EC)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_801805BC); @@ -3769,7 +3822,18 @@ INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_801806A INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_80180714); -INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_801807A0); + +extern s32 func_8012C0EC(s32); + +void func_801807A0(void *a0) { + + extern void (*D_80186934[])(void); + D_80186934[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)a0 != 0) { + ((void (*)(void *))func_8012C0EC)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_80180800); @@ -3816,13 +3880,35 @@ void func_80180D6C(s32 a0) { } -INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_80180DAC); + +extern s32 func_8012C0EC(s32); + +void func_80180DAC(void *a0) { + + extern void (*D_801869C4[])(void); + D_801869C4[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)a0 != 0) { + ((void (*)(void *))func_8012C0EC)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_80180E0C); INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_80180F14); -INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_8018101C); + +extern s32 func_8012C0EC(s32); + +void func_8018101C(void *a0) { + + extern void (*D_801869CC[])(void); + D_801869CC[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)a0 != 0) { + ((void (*)(void *))func_8012C0EC)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_030/nonmatchings/ov_SC03_030_jr_8017AE2C", func_8018107C); diff --git a/src/ov_SC03_031/ov_SC03_031_jr_80135D20.c b/src/ov_SC03_031/ov_SC03_031_jr_80135D20.c index 4f3aff9207..947227b002 100644 --- a/src/ov_SC03_031/ov_SC03_031_jr_80135D20.c +++ b/src/ov_SC03_031/ov_SC03_031_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_031/nonmatchings/ov_SC03_031_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018291C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018291C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018291C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018291C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018291C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_031/ov_SC03_031_jr_80154C24.c b/src/ov_SC03_031/ov_SC03_031_jr_80154C24.c index e83f40cf53..5c2f92131b 100644 --- a/src/ov_SC03_031/ov_SC03_031_jr_80154C24.c +++ b/src/ov_SC03_031/ov_SC03_031_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_031/nonmatchings/ov_SC03_031_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801846A4)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801846A4[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801846A4[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_031/ov_SC03_031_jr_8017AE2C.c b/src/ov_SC03_031/ov_SC03_031_jr_8017AE2C.c index 7f38003663..8d3370b15e 100644 --- a/src/ov_SC03_031/ov_SC03_031_jr_8017AE2C.c +++ b/src/ov_SC03_031/ov_SC03_031_jr_8017AE2C.c @@ -3384,7 +3384,15 @@ void func_8017CFD4(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_031/nonmatchings/ov_SC03_031_jr_8017AE2C", func_8017D010); +extern void func_80147324(s32 arg0); +void func_8017D010(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3413,7 +3421,20 @@ INCLUDE_ASM("asm/ov_SC03_031/nonmatchings/ov_SC03_031_jr_8017AE2C", func_8017D0B INCLUDE_ASM("asm/ov_SC03_031/nonmatchings/ov_SC03_031_jr_8017AE2C", func_8017D140); -INCLUDE_ASM("asm/ov_SC03_031/nonmatchings/ov_SC03_031_jr_8017AE2C", func_8017D2A8); +extern void func_8017D2F4(int); +extern void func_80146C3C(void); +void func_8017D2A8(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D2F4(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC03_031/nonmatchings/ov_SC03_031_jr_8017AE2C", func_8017D2F4); @@ -3425,7 +3446,13 @@ void func_8017D600(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_031/nonmatchings/ov_SC03_031_jr_8017AE2C", func_8017D63C); +extern void func_80147324(s32 arg0); +void func_8017D63C(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D67C — a state-tick: bump the frame counter at 0x1C; while it is @@ -3527,7 +3554,25 @@ void func_8017D778(void *a0) } -INCLUDE_ASM("asm/ov_SC03_031/nonmatchings/ov_SC03_031_jr_8017AE2C", func_8017D84C); +extern void func_8017D2F4(int); +extern void func_80146C3C(void); +void func_8017D84C(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D2F4)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_80185EF8[])(void); @@ -3539,7 +3584,22 @@ void func_8017D8A0(void *a0) { INCLUDE_ASM("asm/ov_SC03_031/nonmatchings/ov_SC03_031_jr_8017AE2C", func_8017D8DC); -INCLUDE_ASM("asm/ov_SC03_031/nonmatchings/ov_SC03_031_jr_8017AE2C", func_8017D990); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017D9EC(void *a0); +void func_8017D990(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017D9EC(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_031/nonmatchings/ov_SC03_031_jr_8017AE2C", func_8017D9EC); diff --git a/src/ov_SC03_089/ov_SC03_089_jr_80135D20.c b/src/ov_SC03_089/ov_SC03_089_jr_80135D20.c index 02ccf88673..9281bc603f 100644 --- a/src/ov_SC03_089/ov_SC03_089_jr_80135D20.c +++ b/src/ov_SC03_089/ov_SC03_089_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80189C18[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80189C18[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80189C18[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80189C18[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80189C18[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_089/ov_SC03_089_jr_80154C24.c b/src/ov_SC03_089/ov_SC03_089_jr_80154C24.c index e7e04fae53..1e33e42f3c 100644 --- a/src/ov_SC03_089/ov_SC03_089_jr_80154C24.c +++ b/src/ov_SC03_089/ov_SC03_089_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018B9A0)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018B9A0[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018B9A0[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_089/ov_SC03_089_jr_8017CA80.c b/src/ov_SC03_089/ov_SC03_089_jr_8017CA80.c index ba61643a96..1e8e689a36 100644 --- a/src/ov_SC03_089/ov_SC03_089_jr_8017CA80.c +++ b/src/ov_SC03_089/ov_SC03_089_jr_8017CA80.c @@ -3885,11 +3885,62 @@ void func_8017D960(s32 arg0) INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_8017CA80", func_80180D88); -INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_8017CA80", func_80180DC8); -INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_8017CA80", func_80180E08); +extern int func_80181D6C(int param_1); + +void func_80180DC8(void) +{ + + extern u8 D_8018D630[]; + extern u8 D_8018D8B0[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018D630; + D_801274CC = D_8018D8B0; + func_80181D6C(1); +} + + + +extern int func_80181D6C(int param_1); + +void func_80180E08(void) +{ + + extern u8 D_8018D8C4[]; + extern u8 D_8018D93C[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018D8C4; + D_801274CC = D_8018D93C; + func_80181D6C(2); +} + + + +extern int func_80181D6C(int param_1); + +void func_80180E48(void) +{ + + extern u8 D_8018D950[]; + extern u8 D_8018DA18[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018D950; + D_801274CC = D_8018DA18; + func_80181D6C(3); +} -INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_8017CA80", func_80180E48); extern void (*D_8018D2D8[])(void); @@ -4301,7 +4352,38 @@ INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_8017CA80", func_801833D INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_8017CA80", func_80183404); -INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_8017CA80", func_80183488); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_80183488(s32 a0) { + + extern u8 D_801A19E0[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_801A19E0); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -4370,9 +4452,70 @@ void func_8018369C(s32 a0) { void func_80183778(void) { } -INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_8017CA80", func_80183780); -INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_8017CA80", func_80183838); +/* func_80183780 — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_80183780(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32 a0, s32 a1); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_80183838(s32 a0) { + + extern u8 D_801A1AA8[]; + extern u8 D_80189990[]; + extern u16 D_801A1ADC[]; + extern u16 D_801A1ADE[]; + extern u16 D_801A1AE0[]; + extern s16 D_801A1AE2[]; + if (func_8012C354(a0, (s32)D_801A1AA8) != 0) { + func_8012A828(a0, (s32)D_80189990); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_801A1ADC[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_801A1ADE[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_801A1AE0[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_801A1AE2[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_8017CA80", func_801838FC); @@ -4417,7 +4560,29 @@ void func_801839CC(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_8017CA80", func_80183AB0); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_80183AB0(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); @@ -4467,7 +4632,21 @@ INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_8017CA80", func_80183FA void func_80183FE8(void) { } -INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_8017CA80", func_80183FF0); + +extern void func_80184CBC(void *a0); + +void func_80183FF0(void *a0) { + + extern void (*D_801A3ADC[])(void); + D_801A3ADC[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)((s32)a0 + 0x0) != 0) { + *(s32 *)((s32)a0 + 0xE4) = *(s32 *)((s32)a0 + 0xE4) + 1; + if ((*(s32 *)((s32)a0 + 0xE4) & 0xF) == 0) { + func_80184CBC(a0); + } + } +} + INCLUDE_ASM("asm/ov_SC03_089/nonmatchings/ov_SC03_089_jr_8017CA80", func_8018406C); diff --git a/src/ov_SC03_090/ov_SC03_090_jr_80135D20.c b/src/ov_SC03_090/ov_SC03_090_jr_80135D20.c index aa3a508eec..cc31f86445 100644 --- a/src/ov_SC03_090/ov_SC03_090_jr_80135D20.c +++ b/src/ov_SC03_090/ov_SC03_090_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018C03C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018C03C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018C03C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018C03C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018C03C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_090/ov_SC03_090_jr_80154C24.c b/src/ov_SC03_090/ov_SC03_090_jr_80154C24.c index 863942f8d0..3cfeba13b5 100644 --- a/src/ov_SC03_090/ov_SC03_090_jr_80154C24.c +++ b/src/ov_SC03_090/ov_SC03_090_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018DDC4)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018DDC4[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018DDC4[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_090/ov_SC03_090_jr_8017CA80.c b/src/ov_SC03_090/ov_SC03_090_jr_8017CA80.c index 4d565846b5..45c2800e9d 100644 --- a/src/ov_SC03_090/ov_SC03_090_jr_8017CA80.c +++ b/src/ov_SC03_090/ov_SC03_090_jr_8017CA80.c @@ -3884,13 +3884,81 @@ void func_8017D960(s32 arg0) INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_80180D88); -INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_80180DC8); -INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_80180E08); +extern int func_80181ED0(int param_1); -INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_80180E48); +void func_80180DC8(void) +{ + + extern u8 D_8018F9C4[]; + extern u8 D_8018FA8C[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018F9C4; + D_801274CC = D_8018FA8C; + func_80181ED0(1); +} + + + +extern int func_80181ED0(int param_1); + +void func_80180E08(void) +{ + + extern u8 D_8018FAA0[]; + extern u8 D_8018FB54[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018FAA0; + D_801274CC = D_8018FB54; + func_80181ED0(2); +} + + + +extern int func_80181ED0(int param_1); + +void func_80180E48(void) +{ + + extern u8 D_8018FB68[]; + extern u8 D_8018FCBC[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018FB68; + D_801274CC = D_8018FCBC; + func_80181ED0(3); +} + + + +extern int func_80181ED0(int param_1); + +void func_80180E88(void) +{ + + extern u8 D_8018FCD0[]; + extern u8 D_8018FDD4[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018FCD0; + D_801274CC = D_8018FDD4; + func_80181ED0(4); +} -INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_80180E88); extern void (*D_8018F6F0[])(void); @@ -4272,7 +4340,38 @@ INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_801830B INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_801830E0); -INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_80183164); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_80183164(s32 a0) { + + extern u8 D_801A0E88[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_801A0E88); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -4341,9 +4440,70 @@ void func_80183378(s32 a0) { void func_80183454(void) { } -INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_8018345C); -INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_80183514); +/* func_8018345C — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_8018345C(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32 a0, s32 a1); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_80183514(s32 a0) { + + extern u8 D_801A0F50[]; + extern u8 D_8018BDB4[]; + extern u16 D_801A0F84[]; + extern u16 D_801A0F86[]; + extern u16 D_801A0F88[]; + extern s16 D_801A0F8A[]; + if (func_8012C354(a0, (s32)D_801A0F50) != 0) { + func_8012A828(a0, (s32)D_8018BDB4); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_801A0F84[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_801A0F86[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_801A0F88[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_801A0F8A[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_801835D8); @@ -4388,7 +4548,29 @@ void func_801836A8(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_8018378C); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_8018378C(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); @@ -4438,7 +4620,21 @@ INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_80183C8 void func_80183CC4(void) { } -INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_80183CCC); + +extern void func_80184998(void *a0); + +void func_80183CCC(void *a0) { + + extern void (*D_801A2F84[])(void); + D_801A2F84[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)((s32)a0 + 0x0) != 0) { + *(s32 *)((s32)a0 + 0xE4) = *(s32 *)((s32)a0 + 0xE4) + 1; + if ((*(s32 *)((s32)a0 + 0xE4) & 0xF) == 0) { + func_80184998(a0); + } + } +} + INCLUDE_ASM("asm/ov_SC03_090/nonmatchings/ov_SC03_090_jr_8017CA80", func_80183D48); diff --git a/src/ov_SC03_091/ov_SC03_091_jr_80135D20.c b/src/ov_SC03_091/ov_SC03_091_jr_80135D20.c index bf82c853f4..f7232c87b2 100644 --- a/src/ov_SC03_091/ov_SC03_091_jr_80135D20.c +++ b/src/ov_SC03_091/ov_SC03_091_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018CEE4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018CEE4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018CEE4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018CEE4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018CEE4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_091/ov_SC03_091_jr_80154C24.c b/src/ov_SC03_091/ov_SC03_091_jr_80154C24.c index d7423505f2..2d04150451 100644 --- a/src/ov_SC03_091/ov_SC03_091_jr_80154C24.c +++ b/src/ov_SC03_091/ov_SC03_091_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018EC6C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018EC6C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018EC6C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_091/ov_SC03_091_jr_8017AE2C.c b/src/ov_SC03_091/ov_SC03_091_jr_8017AE2C.c index 28cc94de79..3ae55665be 100644 --- a/src/ov_SC03_091/ov_SC03_091_jr_8017AE2C.c +++ b/src/ov_SC03_091/ov_SC03_091_jr_8017AE2C.c @@ -3370,7 +3370,15 @@ void func_8017CD10(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017AE2C", func_8017CD4C); +extern void func_80147324(s32 arg0); +void func_8017CD4C(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3399,7 +3407,20 @@ INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017AE2C", func_8017CDF INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017AE2C", func_8017CE7C); -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017AE2C", func_8017CFE4); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017CFE4(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D030(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017AE2C", func_8017D030); @@ -3411,7 +3432,13 @@ void func_8017D33C(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017AE2C", func_8017D378); +extern void func_80147324(s32 arg0); +void func_8017D378(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D3B8 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3513,7 +3540,25 @@ void func_8017D4B4(void *a0) } -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017AE2C", func_8017D588); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017D588(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D030)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_801904AC[])(void); @@ -3525,7 +3570,22 @@ void func_8017D5DC(void *a0) { INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017AE2C", func_8017D618); -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017AE2C", func_8017D6CC); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017D728(void *a0); +void func_8017D6CC(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017D728(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017AE2C", func_8017D728); diff --git a/src/ov_SC03_091/ov_SC03_091_jr_8017D898.c b/src/ov_SC03_091/ov_SC03_091_jr_8017D898.c index fed0c85e79..2a1db8b488 100644 --- a/src/ov_SC03_091/ov_SC03_091_jr_8017D898.c +++ b/src/ov_SC03_091/ov_SC03_091_jr_8017D898.c @@ -3889,13 +3889,81 @@ void func_8017E778(s32 arg0) INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017D898", func_80181BA0); -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017D898", func_80181BE0); -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017D898", func_80181C20); +extern int func_80182CE8(int param_1); -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017D898", func_80181C60); +void func_80181BE0(void) +{ + + extern u8 D_80190A5C[]; + extern u8 D_80190B4C[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_80190A5C; + D_801274CC = D_80190B4C; + func_80182CE8(1); +} + + + +extern int func_80182CE8(int param_1); + +void func_80181C20(void) +{ + + extern u8 D_80190B60[]; + extern u8 D_80190C00[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_80190B60; + D_801274CC = D_80190C00; + func_80182CE8(2); +} + + + +extern int func_80182CE8(int param_1); + +void func_80181C60(void) +{ + + extern u8 D_80190C14[]; + extern u8 D_80190D54[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_80190C14; + D_801274CC = D_80190D54; + func_80182CE8(3); +} + + + +extern int func_80182CE8(int param_1); + +void func_80181CA0(void) +{ + + extern u8 D_80190D68[]; + extern u8 D_80190E6C[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_80190D68; + D_801274CC = D_80190E6C; + func_80182CE8(4); +} -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_8017D898", func_80181CA0); extern void (*D_8019068C[])(void); diff --git a/src/ov_SC03_091/ov_SC03_091_jr_80182268.c b/src/ov_SC03_091/ov_SC03_091_jr_80182268.c index 7b569ac961..cec7649cd3 100644 --- a/src/ov_SC03_091/ov_SC03_091_jr_80182268.c +++ b/src/ov_SC03_091/ov_SC03_091_jr_80182268.c @@ -2174,7 +2174,6 @@ extern s32 func_80012F74(s32 a0, s32 a1, s32 a2, s32 a3); extern void func_80171384(void *a0); extern void (*D_8018FEA0[])(void); extern void func_801714E4(void *a0); -extern struct B16 D_800A5E88; extern struct B16 D_800A5E98; extern void func_8017162C(void *a0); extern void func_80171520(s32 a0); @@ -2903,7 +2902,38 @@ INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_80182268", func_80183F5 INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_80182268", func_80183F88); -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_80182268", func_8018400C); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_8018400C(s32 a0) { + + extern u8 D_801A3EB4[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_801A3EB4); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -2972,9 +3002,70 @@ void func_80184220(s32 a0) { void func_801842FC(void) { } -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_80182268", func_80184304); -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_80182268", func_801843BC); +/* func_80184304 — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_80184304(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32 a0, s32 a1); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_801843BC(s32 a0) { + + extern u8 D_801A3F7C[]; + extern u8 D_8018CC5C[]; + extern u16 D_801A3FB0[]; + extern u16 D_801A3FB2[]; + extern u16 D_801A3FB4[]; + extern s16 D_801A3FB6[]; + if (func_8012C354(a0, (s32)D_801A3F7C) != 0) { + func_8012A828(a0, (s32)D_8018CC5C); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_801A3FB0[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_801A3FB2[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_801A3FB4[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_801A3FB6[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_80182268", func_80184480); @@ -3019,7 +3110,29 @@ void func_80184550(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_80182268", func_80184634); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_80184634(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); @@ -3069,7 +3182,21 @@ INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_80182268", func_80184B2 void func_80184B6C(void) { } -INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_80182268", func_80184B74); + +extern void func_80185840(void *a0); + +void func_80184B74(void *a0) { + + extern void (*D_801A5FB0[])(void); + D_801A5FB0[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)((s32)a0 + 0x0) != 0) { + *(s32 *)((s32)a0 + 0xE4) = *(s32 *)((s32)a0 + 0xE4) + 1; + if ((*(s32 *)((s32)a0 + 0xE4) & 0xF) == 0) { + func_80185840(a0); + } + } +} + INCLUDE_ASM("asm/ov_SC03_091/nonmatchings/ov_SC03_091_jr_80182268", func_80184BF0); diff --git a/src/ov_SC03_092/ov_SC03_092_jr_80135D20.c b/src/ov_SC03_092/ov_SC03_092_jr_80135D20.c index f2f5002119..204234f890 100644 --- a/src/ov_SC03_092/ov_SC03_092_jr_80135D20.c +++ b/src/ov_SC03_092/ov_SC03_092_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_092/nonmatchings/ov_SC03_092_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801852B4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801852B4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801852B4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801852B4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801852B4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_092/ov_SC03_092_jr_80154C24.c b/src/ov_SC03_092/ov_SC03_092_jr_80154C24.c index a765ec8e63..f7c276cda8 100644 --- a/src/ov_SC03_092/ov_SC03_092_jr_80154C24.c +++ b/src/ov_SC03_092/ov_SC03_092_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_092/nonmatchings/ov_SC03_092_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018703C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018703C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018703C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_092/ov_SC03_092_jr_8017AE2C.c b/src/ov_SC03_092/ov_SC03_092_jr_8017AE2C.c index 53ce004a18..a979a8cfed 100644 --- a/src/ov_SC03_092/ov_SC03_092_jr_8017AE2C.c +++ b/src/ov_SC03_092/ov_SC03_092_jr_8017AE2C.c @@ -4284,7 +4284,38 @@ INCLUDE_ASM("asm/ov_SC03_092/nonmatchings/ov_SC03_092_jr_8017AE2C", func_8018238 INCLUDE_ASM("asm/ov_SC03_092/nonmatchings/ov_SC03_092_jr_8017AE2C", func_801823B0); -INCLUDE_ASM("asm/ov_SC03_092/nonmatchings/ov_SC03_092_jr_8017AE2C", func_80182434); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_80182434(s32 a0) { + + extern u8 D_801AD68C[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_801AD68C); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -4353,9 +4384,70 @@ void func_80182648(s32 a0) { void func_80182724(void) { } -INCLUDE_ASM("asm/ov_SC03_092/nonmatchings/ov_SC03_092_jr_8017AE2C", func_8018272C); -INCLUDE_ASM("asm/ov_SC03_092/nonmatchings/ov_SC03_092_jr_8017AE2C", func_801827E4); +/* func_8018272C — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_8018272C(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32, void*); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_801827E4(s32 a0) { + + extern u8 D_801AD754[]; + extern u8 D_8018502C[]; + extern u16 D_801AD788[]; + extern u16 D_801AD78A[]; + extern u16 D_801AD78C[]; + extern s16 D_801AD78E[]; + if (func_8012C354(a0, (s32)D_801AD754) != 0) { + ((void (*)(s32, s32))func_8012A828)(a0, (s32)D_8018502C); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_801AD788[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_801AD78A[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_801AD78C[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_801AD78E[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_092/nonmatchings/ov_SC03_092_jr_8017AE2C", func_801828A8); @@ -4400,7 +4492,29 @@ void func_80182978(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_092/nonmatchings/ov_SC03_092_jr_8017AE2C", func_80182A5C); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_80182A5C(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); diff --git a/src/ov_SC03_093/ov_SC03_093_jr_80135D20.c b/src/ov_SC03_093/ov_SC03_093_jr_80135D20.c index 8980f17937..7db59eb77f 100644 --- a/src/ov_SC03_093/ov_SC03_093_jr_80135D20.c +++ b/src/ov_SC03_093/ov_SC03_093_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018648C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018648C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018648C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018648C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018648C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_093/ov_SC03_093_jr_80154C24.c b/src/ov_SC03_093/ov_SC03_093_jr_80154C24.c index a92e52ca95..ac89023760 100644 --- a/src/ov_SC03_093/ov_SC03_093_jr_80154C24.c +++ b/src/ov_SC03_093/ov_SC03_093_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80188214)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80188214[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80188214[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_093/ov_SC03_093_jr_8017AE2C.c b/src/ov_SC03_093/ov_SC03_093_jr_8017AE2C.c index d3cf1bdc1e..5e206730f6 100644 --- a/src/ov_SC03_093/ov_SC03_093_jr_8017AE2C.c +++ b/src/ov_SC03_093/ov_SC03_093_jr_8017AE2C.c @@ -3370,7 +3370,15 @@ void func_8017CD10(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017AE2C", func_8017CD4C); +extern void func_80147324(s32 arg0); +void func_8017CD4C(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3399,7 +3407,20 @@ INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017AE2C", func_8017CDF INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017AE2C", func_8017CE7C); -INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017AE2C", func_8017CFE4); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017CFE4(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D030(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017AE2C", func_8017D030); @@ -3411,7 +3432,13 @@ void func_8017D33C(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017AE2C", func_8017D378); +extern void func_80147324(s32 arg0); +void func_8017D378(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D3B8 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3513,7 +3540,25 @@ void func_8017D4B4(void *a0) } -INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017AE2C", func_8017D588); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017D588(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D030)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_80189A54[])(void); @@ -3525,7 +3570,22 @@ void func_8017D5DC(void *a0) { INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017AE2C", func_8017D618); -INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017AE2C", func_8017D6CC); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017D728(void *a0); +void func_8017D6CC(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017D728(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017AE2C", func_8017D728); diff --git a/src/ov_SC03_093/ov_SC03_093_jr_8017D898.c b/src/ov_SC03_093/ov_SC03_093_jr_8017D898.c index c1aa56e9fd..8a5ee7672f 100644 --- a/src/ov_SC03_093/ov_SC03_093_jr_8017D898.c +++ b/src/ov_SC03_093/ov_SC03_093_jr_8017D898.c @@ -76,7 +76,6 @@ extern s32 func_80146128(void); extern void func_80146360(void); extern void func_801463A0(); extern void func_8014607C(void); -extern s32 *D_80126B78; extern u8 D_80078EC1; extern s32 D_80078EC8; extern s32 D_80126B9C; @@ -360,7 +359,6 @@ extern s32 func_801498E0(s32 *a0); extern s32 func_8012E5CC(s32 a0, s32 a1, s32 a2); extern void func_80147364(u16 a0, s32 a1); extern s32 func_800CCF28(s32 a0); -extern u8 D_80126B5C; extern s32 func_80149954(s32 s0); extern s32 func_80149A64(s32 *a0); extern void func_8015DAC4(s32 *a0); @@ -3181,9 +3179,43 @@ void func_8017D898(s32 arg0) INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017D898", func_8017E778); -INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017D898", func_8017E7B8); -INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017D898", func_8017E7F8); +extern int func_8017F0B8(int param_1); + +void func_8017E7B8(void) +{ + + extern u8 D_8018A048[]; + extern u8 D_8018A188[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018A048; + D_801274CC = D_8018A188; + func_8017F0B8(1); +} + + + +extern int func_8017F0B8(int param_1); + +void func_8017E7F8(void) +{ + + extern u8 D_8018A19C[]; + extern u8 D_8018A304[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018A19C; + D_801274CC = D_8018A304; + func_8017F0B8(2); +} + extern void (*D_80189B9C[])(void); @@ -3500,7 +3532,38 @@ INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017D898", func_80180B6 INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017D898", func_80180B90); -INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017D898", func_80180C14); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_80180C14(s32 a0) { + + extern u8 D_801A24CC[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_801A24CC); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -3569,9 +3632,70 @@ void func_80180E28(s32 a0) { void func_80180F04(void) { } -INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017D898", func_80180F0C); -INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017D898", func_80180FC4); +/* func_80180F0C — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); ((void (*)(void *))func_8012C218)((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void); + +void func_80180F0C(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + ((void (*)(void *))func_8012C218)(temp); + } + } + func_8002A04C(arg0); + ((void (*)(void *))func_8012C218)((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32 a0, s32 a1); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_80180FC4(s32 a0) { + + extern u8 D_801A2594[]; + extern u8 D_80186204[]; + extern u16 D_801A25C8[]; + extern u16 D_801A25CA[]; + extern u16 D_801A25CC[]; + extern s16 D_801A25CE[]; + if (func_8012C354(a0, (s32)D_801A2594) != 0) { + func_8012A828(a0, (s32)D_80186204); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_801A25C8[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_801A25CA[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_801A25CC[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_801A25CE[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017D898", func_80181088); @@ -3616,7 +3740,29 @@ void func_80181158(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017D898", func_8018123C); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_8018123C(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); @@ -3712,7 +3858,33 @@ void func_80182144(void *a0) { INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017D898", func_80182164); -INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017D898", func_80182208); + +extern s32 func_8012B6D4(s16 *a0, s16 *a1); + +// @class: branch-polarity +// @stuck: none — MATCH (32 ins), iteration 2. §3-T4: gcc-2.7.2 lays this out as +// "branch TO the then-arm, fall through to the else", so the source condition is +// `d < 0x800` (the bnez sense read off the target opcode), NOT Ghidra's inverted +// arm order. The wrong polarity also cost one instruction (match_one printed +// LENGTH-DRIFT/-1): with the arms swapped, the `sll $v0,$s0,16` of the s16 param +// lands in the branch delay slot and is SHARED by both arms; the correct polarity +// puts `addiu $v1,$zero,0x1000` there and each arm gets its own sll/sra. +// a1 is an ANSI s16 param (sign-extended at each use, once per arm) — not K&R §43. +s32 func_80182208(s32 a0, s16 a1) { + + extern u8 D_80126B5C; + extern s32 *D_80126B78; + s32 d; + + d = (func_8012B6D4((s16 *)&D_80126B5C, (s16 *)(a0 + 4)) - + *(s16 *)((s32)D_80126B78 + 0x12)) & 0xFFF; + if (d < 0x800) { + return d < a1; + } else { + return (0x1000 - d) < a1; + } +} + INCLUDE_ASM("asm/ov_SC03_093/nonmatchings/ov_SC03_093_jr_8017D898", func_80182288); diff --git a/src/ov_SC03_094/ov_SC03_094_jr_80135D20.c b/src/ov_SC03_094/ov_SC03_094_jr_80135D20.c index b1f066a8dc..56334275b8 100644 --- a/src/ov_SC03_094/ov_SC03_094_jr_80135D20.c +++ b/src/ov_SC03_094/ov_SC03_094_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80187E88[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80187E88[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80187E88[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80187E88[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80187E88[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_094/ov_SC03_094_jr_80154C24.c b/src/ov_SC03_094/ov_SC03_094_jr_80154C24.c index 66f7e4f7ff..170c938298 100644 --- a/src/ov_SC03_094/ov_SC03_094_jr_80154C24.c +++ b/src/ov_SC03_094/ov_SC03_094_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80189C10)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80189C10[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80189C10[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_094/ov_SC03_094_jr_8017BEBC.c b/src/ov_SC03_094/ov_SC03_094_jr_8017BEBC.c index 25b582e9cc..66bd50a8fe 100644 --- a/src/ov_SC03_094/ov_SC03_094_jr_8017BEBC.c +++ b/src/ov_SC03_094/ov_SC03_094_jr_8017BEBC.c @@ -76,7 +76,6 @@ extern s32 func_80146128(void); extern void func_80146360(void); extern void func_801463A0(); extern void func_8014607C(void); -extern s32 *D_80126B78; extern u8 D_80078EC1; extern s32 D_80078EC8; extern s32 D_80126B9C; @@ -360,7 +359,6 @@ extern s32 func_801498E0(s32 *a0); extern s32 func_8012E5CC(s32 a0, s32 a1, s32 a2); extern void func_80147364(u16 a0, s32 a1); extern s32 func_800CCF28(s32 a0); -extern u8 D_80126B5C; extern s32 func_80149954(s32 s0); extern s32 func_80149A64(s32 *a0); extern void func_8015DAC4(s32 *a0); @@ -3171,11 +3169,62 @@ void func_8017BEBC(s32 arg0) INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_8017CD9C); -INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_8017CDDC); -INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_8017CE1C); +extern int func_8017D868(int param_1); + +void func_8017CDDC(void) +{ + + extern u8 D_8018BB74[]; + extern u8 D_8018BC3C[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018BB74; + D_801274CC = D_8018BC3C; + func_8017D868(1); +} + + + +extern int func_8017D868(int param_1); + +void func_8017CE1C(void) +{ + + extern u8 D_8018BC50[]; + extern u8 D_8018BD18[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018BC50; + D_801274CC = D_8018BD18; + func_8017D868(2); +} + + + +extern int func_8017D868(int param_1); + +void func_8017CE5C(void) +{ + + extern u8 D_8018BD2C[]; + extern u8 D_8018BE30[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018BD2C; + D_801274CC = D_8018BE30; + func_8017D868(3); +} -INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_8017CE5C); extern void (*D_8018B450[])(void); @@ -3470,7 +3519,38 @@ INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_8017FDA INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_8017FDD8); -INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_8017FE5C); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_8017FE5C(s32 a0) { + + extern u8 D_801A6C08[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_801A6C08); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -3539,9 +3619,70 @@ void func_80180070(s32 a0) { void func_8018014C(void) { } -INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_80180154); -INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_8018020C); +/* func_80180154 — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_80180154(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32 a0, s32 a1); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_8018020C(s32 a0) { + + extern u8 D_801A6CD0[]; + extern u8 D_80187C00[]; + extern u16 D_801A6D04[]; + extern u16 D_801A6D06[]; + extern u16 D_801A6D08[]; + extern s16 D_801A6D0A[]; + if (func_8012C354(a0, (s32)D_801A6CD0) != 0) { + func_8012A828(a0, (s32)D_80187C00); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_801A6D04[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_801A6D06[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_801A6D08[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_801A6D0A[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_801802D0); @@ -3586,7 +3727,29 @@ void func_801803A0(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_80180484); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_80180484(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); @@ -3717,7 +3880,21 @@ void func_80182034(void *a0) { INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_8018205C); -INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_801820DC); + +extern void func_80182DB0(void *a0); + +void func_801820DC(void *a0) { + + extern void (*D_801AC1A0[])(void); + D_801AC1A0[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)((s32)a0 + 0x0) != 0) { + *(s32 *)((s32)a0 + 0xE8) = *(s32 *)((s32)a0 + 0xE8) + 1; + if ((*(s32 *)((s32)a0 + 0xE8) & 0xF) == 0) { + func_80182DB0(a0); + } + } +} + INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_80182158); @@ -3733,11 +3910,48 @@ INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_8018289 INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_801829A4); -INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_80182B40); + +extern s32 func_8012BEE8(s32 a0); +extern s32 func_8012E778(s32 a0, s32 a1); +extern void func_8012E88C(s32 a0); +extern void func_8012A828(s32, s32); + +void func_80182B40(void *arg0) { + + extern s32 D_801AE690; + if (func_8012BEE8((s32)arg0)) { + if (!func_8012E778((s32)arg0, 0xA000C8)) { + { + s32 t; + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + *(s16 *)((char *)arg0 + 0x2) = (t == 0) ? 1 : 3; + } + *(s16 *)((char *)arg0 + 0x5C) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78) + 0x2); + *(s16 *)((char *)arg0 + 0x76) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78)); + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1A) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1C) = 0x1000; + *(u16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x2C) &= 0x10; + func_8012E88C((s32)arg0); + ((void (*)(s32 *, s32))func_8012A828)(arg0, &D_801AE690); + } + } +} + INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_80182BFC); -INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_80182C88); + +extern void func_8012A828(s32, s32); + extern s32 D_801AE690; + void func_80182C88(void *arg0) { + *(s16 *)((char *)arg0 + 0x2) = 1; + *(s16 *)((char *)arg0 + 0x5c) = *(u16 *)(*(s32 *)((char *)arg0 + 0x78) + 0x2); + ((void (*)(s32 *, s32))func_8012A828)(arg0, &D_801AE690); + } + extern s32 func_8012D5E4(s32 a0, s32 a1, s32 a2, s32 a3); @@ -3827,7 +4041,33 @@ void func_80183B80(s32 arg0) { INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_80183BA0); -INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_80183C44); + +extern s32 func_8012B6D4(s16 *a0, s16 *a1); + +// @class: branch-polarity +// @stuck: none — MATCH (32 ins), iteration 2. §3-T4: gcc-2.7.2 lays this out as +// "branch TO the then-arm, fall through to the else", so the source condition is +// `d < 0x800` (the bnez sense read off the target opcode), NOT Ghidra's inverted +// arm order. The wrong polarity also cost one instruction (match_one printed +// LENGTH-DRIFT/-1): with the arms swapped, the `sll $v0,$s0,16` of the s16 param +// lands in the branch delay slot and is SHARED by both arms; the correct polarity +// puts `addiu $v1,$zero,0x1000` there and each arm gets its own sll/sra. +// a1 is an ANSI s16 param (sign-extended at each use, once per arm) — not K&R §43. +s32 func_80183C44(s32 a0, s16 a1) { + + extern u8 D_80126B5C; + extern s32 *D_80126B78; + s32 d; + + d = (func_8012B6D4((s16 *)&D_80126B5C, (s16 *)(a0 + 4)) - + *(s16 *)((s32)D_80126B78 + 0x12)) & 0xFFF; + if (d < 0x800) { + return d < a1; + } else { + return (0x1000 - d) < a1; + } +} + INCLUDE_ASM("asm/ov_SC03_094/nonmatchings/ov_SC03_094_jr_8017BEBC", func_80183CC4); diff --git a/src/ov_SC03_095/ov_SC03_095_jr_80135D20.c b/src/ov_SC03_095/ov_SC03_095_jr_80135D20.c index d941753783..e4adb85e57 100644 --- a/src/ov_SC03_095/ov_SC03_095_jr_80135D20.c +++ b/src/ov_SC03_095/ov_SC03_095_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_095/nonmatchings/ov_SC03_095_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801814E8[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801814E8[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801814E8[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801814E8[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801814E8[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_095/ov_SC03_095_jr_80154C24.c b/src/ov_SC03_095/ov_SC03_095_jr_80154C24.c index 1535b588d5..669e678803 100644 --- a/src/ov_SC03_095/ov_SC03_095_jr_80154C24.c +++ b/src/ov_SC03_095/ov_SC03_095_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_095/nonmatchings/ov_SC03_095_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80183270)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80183270[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80183270[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_095/ov_SC03_095_jr_8017BEBC.c b/src/ov_SC03_095/ov_SC03_095_jr_8017BEBC.c index 44730c59ec..87651d00da 100644 --- a/src/ov_SC03_095/ov_SC03_095_jr_8017BEBC.c +++ b/src/ov_SC03_095/ov_SC03_095_jr_8017BEBC.c @@ -76,7 +76,6 @@ extern s32 func_80146128(void); extern void func_80146360(void); extern void func_801463A0(); extern void func_8014607C(void); -extern s32 *D_80126B78; extern u8 D_80078EC1; extern s32 D_80078EC8; extern s32 D_80126B9C; @@ -360,7 +359,6 @@ extern s32 func_801498E0(s32 *a0); extern s32 func_8012E5CC(s32 a0, s32 a1, s32 a2); extern void func_80147364(u16 a0, s32 a1); extern s32 func_800CCF28(s32 a0); -extern u8 D_80126B5C; extern s32 func_80149954(s32 s0); extern s32 func_80149A64(s32 *a0); extern void func_8015DAC4(s32 *a0); @@ -3173,7 +3171,24 @@ void func_8017BEBC(s32 arg0) INCLUDE_ASM("asm/ov_SC03_095/nonmatchings/ov_SC03_095_jr_8017BEBC", func_8017CD9C); -INCLUDE_ASM("asm/ov_SC03_095/nonmatchings/ov_SC03_095_jr_8017BEBC", func_8017CDDC); + +extern int func_8017D528(int param_1); + +void func_8017CDDC(void) +{ + + extern u8 D_80184C48[]; + extern u8 D_80184D88[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_80184C48; + D_801274CC = D_80184D88; + func_8017D528(1); +} + extern void (*D_801849C0[])(void); @@ -3477,7 +3492,38 @@ INCLUDE_ASM("asm/ov_SC03_095/nonmatchings/ov_SC03_095_jr_8017BEBC", func_8017F12 INCLUDE_ASM("asm/ov_SC03_095/nonmatchings/ov_SC03_095_jr_8017BEBC", func_8017F158); -INCLUDE_ASM("asm/ov_SC03_095/nonmatchings/ov_SC03_095_jr_8017BEBC", func_8017F1DC); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_8017F1DC(s32 a0) { + + extern u8 D_80192E10[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_80192E10); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -3546,9 +3592,70 @@ void func_8017F3F0(s32 a0) { void func_8017F4CC(void) { } -INCLUDE_ASM("asm/ov_SC03_095/nonmatchings/ov_SC03_095_jr_8017BEBC", func_8017F4D4); -INCLUDE_ASM("asm/ov_SC03_095/nonmatchings/ov_SC03_095_jr_8017BEBC", func_8017F58C); +/* func_8017F4D4 — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_8017F4D4(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32 a0, s32 a1); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_8017F58C(s32 a0) { + + extern u8 D_80192ED8[]; + extern u8 D_80181260[]; + extern u16 D_80192F0C[]; + extern u16 D_80192F0E[]; + extern u16 D_80192F10[]; + extern s16 D_80192F12[]; + if (func_8012C354(a0, (s32)D_80192ED8) != 0) { + func_8012A828(a0, (s32)D_80181260); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_80192F0C[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_80192F0E[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_80192F10[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_80192F12[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_095/nonmatchings/ov_SC03_095_jr_8017BEBC", func_8017F650); @@ -3593,7 +3700,29 @@ void func_8017F720(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_095/nonmatchings/ov_SC03_095_jr_8017BEBC", func_8017F804); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_8017F804(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); @@ -3690,7 +3819,33 @@ void func_8018070C(void *a0) { INCLUDE_ASM("asm/ov_SC03_095/nonmatchings/ov_SC03_095_jr_8017BEBC", func_8018072C); -INCLUDE_ASM("asm/ov_SC03_095/nonmatchings/ov_SC03_095_jr_8017BEBC", func_801807D0); + +extern s32 func_8012B6D4(s16 *a0, s16 *a1); + +// @class: branch-polarity +// @stuck: none — MATCH (32 ins), iteration 2. §3-T4: gcc-2.7.2 lays this out as +// "branch TO the then-arm, fall through to the else", so the source condition is +// `d < 0x800` (the bnez sense read off the target opcode), NOT Ghidra's inverted +// arm order. The wrong polarity also cost one instruction (match_one printed +// LENGTH-DRIFT/-1): with the arms swapped, the `sll $v0,$s0,16` of the s16 param +// lands in the branch delay slot and is SHARED by both arms; the correct polarity +// puts `addiu $v1,$zero,0x1000` there and each arm gets its own sll/sra. +// a1 is an ANSI s16 param (sign-extended at each use, once per arm) — not K&R §43. +s32 func_801807D0(s32 a0, s16 a1) { + + extern u8 D_80126B5C; + extern s32 *D_80126B78; + s32 d; + + d = (func_8012B6D4((s16 *)&D_80126B5C, (s16 *)(a0 + 4)) - + *(s16 *)((s32)D_80126B78 + 0x12)) & 0xFFF; + if (d < 0x800) { + return d < a1; + } else { + return (0x1000 - d) < a1; + } +} + INCLUDE_ASM("asm/ov_SC03_095/nonmatchings/ov_SC03_095_jr_8017BEBC", func_80180850); diff --git a/src/ov_SC03_096/ov_SC03_096_jr_80135D20.c b/src/ov_SC03_096/ov_SC03_096_jr_80135D20.c index 0f3276a37c..54d9e3ec8b 100644 --- a/src/ov_SC03_096/ov_SC03_096_jr_80135D20.c +++ b/src/ov_SC03_096/ov_SC03_096_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_096/nonmatchings/ov_SC03_096_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80181068[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80181068[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80181068[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80181068[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80181068[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_096/ov_SC03_096_jr_80154C24.c b/src/ov_SC03_096/ov_SC03_096_jr_80154C24.c index 4532a8675c..b4554d9189 100644 --- a/src/ov_SC03_096/ov_SC03_096_jr_80154C24.c +++ b/src/ov_SC03_096/ov_SC03_096_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_096/nonmatchings/ov_SC03_096_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80182DF0)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80182DF0[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80182DF0[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_096/ov_SC03_096_jr_8017BEBC.c b/src/ov_SC03_096/ov_SC03_096_jr_8017BEBC.c index 9db4499198..39d147289e 100644 --- a/src/ov_SC03_096/ov_SC03_096_jr_8017BEBC.c +++ b/src/ov_SC03_096/ov_SC03_096_jr_8017BEBC.c @@ -76,7 +76,6 @@ extern s32 func_80146128(void); extern void func_80146360(void); extern void func_801463A0(); extern void func_8014607C(void); -extern s32 *D_80126B78; extern u8 D_80078EC1; extern s32 D_80078EC8; extern s32 D_80126B9C; @@ -360,7 +359,6 @@ extern s32 func_801498E0(s32 *a0); extern s32 func_8012E5CC(s32 a0, s32 a1, s32 a2); extern void func_80147364(u16 a0, s32 a1); extern s32 func_800CCF28(s32 a0); -extern u8 D_80126B5C; extern s32 func_80149954(s32 s0); extern s32 func_80149A64(s32 *a0); extern void func_8015DAC4(s32 *a0); @@ -3401,7 +3399,38 @@ INCLUDE_ASM("asm/ov_SC03_096/nonmatchings/ov_SC03_096_jr_8017BEBC", func_8017E52 INCLUDE_ASM("asm/ov_SC03_096/nonmatchings/ov_SC03_096_jr_8017BEBC", func_8017E55C); -INCLUDE_ASM("asm/ov_SC03_096/nonmatchings/ov_SC03_096_jr_8017BEBC", func_8017E5E0); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_8017E5E0(s32 a0) { + + extern u8 D_80190804[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_80190804); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -3470,9 +3499,70 @@ void func_8017E7F4(s32 a0) { void func_8017E8D0(void) { } -INCLUDE_ASM("asm/ov_SC03_096/nonmatchings/ov_SC03_096_jr_8017BEBC", func_8017E8D8); -INCLUDE_ASM("asm/ov_SC03_096/nonmatchings/ov_SC03_096_jr_8017BEBC", func_8017E990); +/* func_8017E8D8 — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_8017E8D8(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32 a0, s32 a1); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_8017E990(s32 a0) { + + extern u8 D_801908CC[]; + extern u8 D_80180DE0[]; + extern u16 D_80190900[]; + extern u16 D_80190902[]; + extern u16 D_80190904[]; + extern s16 D_80190906[]; + if (func_8012C354(a0, (s32)D_801908CC) != 0) { + func_8012A828(a0, (s32)D_80180DE0); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_80190900[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_80190902[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_80190904[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_80190906[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_096/nonmatchings/ov_SC03_096_jr_8017BEBC", func_8017EA54); @@ -3517,7 +3607,29 @@ void func_8017EB24(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_096/nonmatchings/ov_SC03_096_jr_8017BEBC", func_8017EC08); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_8017EC08(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); @@ -3675,7 +3787,33 @@ void func_8018028C(s32 arg0) { INCLUDE_ASM("asm/ov_SC03_096/nonmatchings/ov_SC03_096_jr_8017BEBC", func_801802AC); -INCLUDE_ASM("asm/ov_SC03_096/nonmatchings/ov_SC03_096_jr_8017BEBC", func_80180350); + +extern s32 func_8012B6D4(s16 *a0, s16 *a1); + +// @class: branch-polarity +// @stuck: none — MATCH (32 ins), iteration 2. §3-T4: gcc-2.7.2 lays this out as +// "branch TO the then-arm, fall through to the else", so the source condition is +// `d < 0x800` (the bnez sense read off the target opcode), NOT Ghidra's inverted +// arm order. The wrong polarity also cost one instruction (match_one printed +// LENGTH-DRIFT/-1): with the arms swapped, the `sll $v0,$s0,16` of the s16 param +// lands in the branch delay slot and is SHARED by both arms; the correct polarity +// puts `addiu $v1,$zero,0x1000` there and each arm gets its own sll/sra. +// a1 is an ANSI s16 param (sign-extended at each use, once per arm) — not K&R §43. +s32 func_80180350(s32 a0, s16 a1) { + + extern u8 D_80126B5C; + extern s32 *D_80126B78; + s32 d; + + d = (func_8012B6D4((s16 *)&D_80126B5C, (s16 *)(a0 + 4)) - + *(s16 *)((s32)D_80126B78 + 0x12)) & 0xFFF; + if (d < 0x800) { + return d < a1; + } else { + return (0x1000 - d) < a1; + } +} + INCLUDE_ASM("asm/ov_SC03_096/nonmatchings/ov_SC03_096_jr_8017BEBC", func_801803D0); diff --git a/src/ov_SC03_097/ov_SC03_097_jr_80135D20.c b/src/ov_SC03_097/ov_SC03_097_jr_80135D20.c index ac22ccd56a..b569283f4a 100644 --- a/src/ov_SC03_097/ov_SC03_097_jr_80135D20.c +++ b/src/ov_SC03_097/ov_SC03_097_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80186448[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80186448[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80186448[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80186448[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80186448[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_097/ov_SC03_097_jr_80154C24.c b/src/ov_SC03_097/ov_SC03_097_jr_80154C24.c index d32759db5a..71b8d1a594 100644 --- a/src/ov_SC03_097/ov_SC03_097_jr_80154C24.c +++ b/src/ov_SC03_097/ov_SC03_097_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801881D0)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801881D0[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801881D0[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_097/ov_SC03_097_jr_8017AE2C.c b/src/ov_SC03_097/ov_SC03_097_jr_8017AE2C.c index 6aa88cf6d1..5ec1e29019 100644 --- a/src/ov_SC03_097/ov_SC03_097_jr_8017AE2C.c +++ b/src/ov_SC03_097/ov_SC03_097_jr_8017AE2C.c @@ -3370,7 +3370,15 @@ void func_8017CD10(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017AE2C", func_8017CD4C); +extern void func_80147324(s32 arg0); +void func_8017CD4C(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3399,7 +3407,20 @@ INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017AE2C", func_8017CDF INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017AE2C", func_8017CE7C); -INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017AE2C", func_8017CFE4); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017CFE4(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D030(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017AE2C", func_8017D030); @@ -3411,7 +3432,13 @@ void func_8017D33C(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017AE2C", func_8017D378); +extern void func_80147324(s32 arg0); +void func_8017D378(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D3B8 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3513,7 +3540,25 @@ void func_8017D4B4(void *a0) } -INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017AE2C", func_8017D588); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017D588(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D030)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_80189A10[])(void); @@ -3525,7 +3570,22 @@ void func_8017D5DC(void *a0) { INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017AE2C", func_8017D618); -INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017AE2C", func_8017D6CC); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017D728(void *a0); +void func_8017D6CC(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017D728(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017AE2C", func_8017D728); diff --git a/src/ov_SC03_097/ov_SC03_097_jr_8017D898.c b/src/ov_SC03_097/ov_SC03_097_jr_8017D898.c index 5b15c32e32..6452779636 100644 --- a/src/ov_SC03_097/ov_SC03_097_jr_8017D898.c +++ b/src/ov_SC03_097/ov_SC03_097_jr_8017D898.c @@ -76,7 +76,6 @@ extern s32 func_80146128(void); extern void func_80146360(void); extern void func_801463A0(); extern void func_8014607C(void); -extern s32 *D_80126B78; extern u8 D_80078EC1; extern s32 D_80078EC8; extern s32 D_80126B9C; @@ -360,7 +359,6 @@ extern s32 func_801498E0(s32 *a0); extern s32 func_8012E5CC(s32 a0, s32 a1, s32 a2); extern void func_80147364(u16 a0, s32 a1); extern s32 func_800CCF28(s32 a0); -extern u8 D_80126B5C; extern s32 func_80149954(s32 s0); extern s32 func_80149A64(s32 *a0); extern void func_8015DAC4(s32 *a0); @@ -3183,7 +3181,24 @@ INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017D898", func_8017E77 INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017D898", func_8017E7B8); -INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017D898", func_8017E804); + +extern int func_8017F6D4(int param_1); + +void func_8017E804(void) +{ + + extern u8 D_8018A11C[]; + extern u8 D_8018A1D0[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018A11C; + D_801274CC = D_8018A1D0; + func_8017F6D4(2); +} + extern void (*D_80189B2C[])(void); @@ -3876,7 +3891,38 @@ INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017D898", func_8018388 INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017D898", func_801838B8); -INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017D898", func_8018393C); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_8018393C(s32 a0) { + + extern u8 D_8019C8EC[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_8019C8EC); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -3945,9 +3991,70 @@ void func_80183B50(s32 a0) { void func_80183C2C(void) { } -INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017D898", func_80183C34); -INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017D898", func_80183CEC); +/* func_80183C34 — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_80183C34(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32, void*); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_80183CEC(s32 a0) { + + extern u8 D_8019C9B4[]; + extern u8 D_801861C0[]; + extern u16 D_8019C9E8[]; + extern u16 D_8019C9EA[]; + extern u16 D_8019C9EC[]; + extern s16 D_8019C9EE[]; + if (func_8012C354(a0, (s32)D_8019C9B4) != 0) { + ((void (*)(s32, s32))func_8012A828)(a0, (s32)D_801861C0); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_8019C9E8[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_8019C9EA[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_8019C9EC[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_8019C9EE[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017D898", func_80183DB0); @@ -3992,7 +4099,29 @@ void func_80183E80(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017D898", func_80183F64); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_80183F64(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); @@ -4089,7 +4218,33 @@ void func_80184E6C(s32 arg0) { INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017D898", func_80184E8C); -INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017D898", func_80184F30); + +extern s32 func_8012B6D4(s16 *a0, s16 *a1); + +// @class: branch-polarity +// @stuck: none — MATCH (32 ins), iteration 2. §3-T4: gcc-2.7.2 lays this out as +// "branch TO the then-arm, fall through to the else", so the source condition is +// `d < 0x800` (the bnez sense read off the target opcode), NOT Ghidra's inverted +// arm order. The wrong polarity also cost one instruction (match_one printed +// LENGTH-DRIFT/-1): with the arms swapped, the `sll $v0,$s0,16` of the s16 param +// lands in the branch delay slot and is SHARED by both arms; the correct polarity +// puts `addiu $v1,$zero,0x1000` there and each arm gets its own sll/sra. +// a1 is an ANSI s16 param (sign-extended at each use, once per arm) — not K&R §43. +s32 func_80184F30(s32 a0, s16 a1) { + + extern u8 D_80126B5C; + extern s32 *D_80126B78; + s32 d; + + d = (func_8012B6D4((s16 *)&D_80126B5C, (s16 *)(a0 + 4)) - + *(s16 *)((s32)D_80126B78 + 0x12)) & 0xFFF; + if (d < 0x800) { + return d < a1; + } else { + return (0x1000 - d) < a1; + } +} + INCLUDE_ASM("asm/ov_SC03_097/nonmatchings/ov_SC03_097_jr_8017D898", func_80184FB0); diff --git a/src/ov_SC03_098/ov_SC03_098_jr_80135D20.c b/src/ov_SC03_098/ov_SC03_098_jr_80135D20.c index c4c8f17e68..c16b7325e0 100644 --- a/src/ov_SC03_098/ov_SC03_098_jr_80135D20.c +++ b/src/ov_SC03_098/ov_SC03_098_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801858D4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801858D4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801858D4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801858D4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801858D4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_098/ov_SC03_098_jr_80154C24.c b/src/ov_SC03_098/ov_SC03_098_jr_80154C24.c index 22b738b790..09eb577562 100644 --- a/src/ov_SC03_098/ov_SC03_098_jr_80154C24.c +++ b/src/ov_SC03_098/ov_SC03_098_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018765C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018765C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018765C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_098/ov_SC03_098_jr_8017AE2C.c b/src/ov_SC03_098/ov_SC03_098_jr_8017AE2C.c index 7d8dcfc4ff..a41888957d 100644 --- a/src/ov_SC03_098/ov_SC03_098_jr_8017AE2C.c +++ b/src/ov_SC03_098/ov_SC03_098_jr_8017AE2C.c @@ -3370,7 +3370,15 @@ void func_8017CD10(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017AE2C", func_8017CD4C); +extern void func_80147324(s32 arg0); +void func_8017CD4C(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3399,7 +3407,20 @@ INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017AE2C", func_8017CDF INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017AE2C", func_8017CE7C); -INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017AE2C", func_8017CFE4); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017CFE4(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D030(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017AE2C", func_8017D030); @@ -3411,7 +3432,13 @@ void func_8017D33C(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017AE2C", func_8017D378); +extern void func_80147324(s32 arg0); +void func_8017D378(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D3B8 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3513,7 +3540,25 @@ void func_8017D4B4(void *a0) } -INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017AE2C", func_8017D588); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017D588(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D030)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_80188E9C[])(void); @@ -3525,7 +3570,22 @@ void func_8017D5DC(void *a0) { INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017AE2C", func_8017D618); -INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017AE2C", func_8017D6CC); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017D728(void *a0); +void func_8017D6CC(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017D728(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017AE2C", func_8017D728); diff --git a/src/ov_SC03_098/ov_SC03_098_jr_8017D898.c b/src/ov_SC03_098/ov_SC03_098_jr_8017D898.c index b6f4488a13..8eef5bf2d3 100644 --- a/src/ov_SC03_098/ov_SC03_098_jr_8017D898.c +++ b/src/ov_SC03_098/ov_SC03_098_jr_8017D898.c @@ -3183,7 +3183,24 @@ void func_8017D898(s32 arg0) INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017D898", func_8017E778); -INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017D898", func_8017E7B8); + +extern int func_8017EEF8(int param_1); + +void func_8017E7B8(void) +{ + + extern u8 D_80189340[]; + extern u8 D_801894BC[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_80189340; + D_801274CC = D_801894BC; + func_8017EEF8(1); +} + extern void (*D_80188F44[])(void); @@ -3374,9 +3391,81 @@ INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017D898", func_8017F1A INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017D898", func_8017F2A0); -INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017D898", func_8017F334); -INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017D898", func_8017F3EC); +extern s32 func_8004787C(s32 a0); +extern s32 func_80047948(s32 a0); + +// @class: none — MATCH (46 ins), iteration 1. rtu_match MATCH too. +// @stuck: none. +// Derivation was pure OPCODE-WIDTH reading (no cookbook section needed beyond +// §3-T4 for the two branch senses): +// * 0x108 `lh`/`sh` -> s16 counter. +// * 0x106,0xFE `lhu`+`addu`+`sh` -> u16 += u16 (a signed s16 pair would have +// loaded `lh`). The `sll 16/sra 16` immediately after is NOT part of the +// add — it is the `(s16)` cast of the just-stored u16 being handed to +// func_8004787C, which CSE serves out of the store's register instead of +// re-loading. Writing the arg as `*(s16 *)(a0 + 0x106)` after the store +// reproduces it exactly; the SECOND call re-loads with `lh` on its own +// because $v0/$a0 died across the first jal. +// * 0x104 `lh` -> s16 multiplicand; mult/mflo/`sra 12` == plain int `>> 12`. +// * 0x8C,0x8A `lhu` -> u16 bases; 0xE,0xA `sh`. +// * §3-T4 both branches: `beqz` at the top => source condition is `!= 0` with +// an early return; `bnez` at the bottom => source condition is `== 0`. +// The shared `sh $v0,0x108($s0)` tail is gcc's own cross-jump merge of the +// `- 1` arm and the `= 0xF` arm — do NOT hand-write it as a merged tail. +void func_8017F334(s32 a0) { + if (*(s16 *)(a0 + 0x108) != 0) { + *(s16 *)(a0 + 0x108) = *(s16 *)(a0 + 0x108) - 1; + return; + } + *(u16 *)(a0 + 0x106) = *(u16 *)(a0 + 0x106) + *(u16 *)(a0 + 0xFE); + *(s16 *)(a0 + 0xE) = *(u16 *)(a0 + 0x8C) + + ((func_8004787C(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + *(s16 *)(a0 + 0xA) = *(u16 *)(a0 + 0x8A) + + ((func_80047948(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + if ((*(u16 *)(a0 + 0x106) & 0x7FF) == 0) { + *(s16 *)(a0 + 0x108) = 0xF; + } +} + + + +extern s32 func_8004787C(s32 a0); +extern s32 func_80047948(s32 a0); + +// @class: none — MATCH (46 ins), iteration 1. rtu_match MATCH too. +// @stuck: none. +// Derivation was pure OPCODE-WIDTH reading (no cookbook section needed beyond +// §3-T4 for the two branch senses): +// * 0x108 `lh`/`sh` -> s16 counter. +// * 0x106,0xFE `lhu`+`addu`+`sh` -> u16 += u16 (a signed s16 pair would have +// loaded `lh`). The `sll 16/sra 16` immediately after is NOT part of the +// add — it is the `(s16)` cast of the just-stored u16 being handed to +// func_8004787C, which CSE serves out of the store's register instead of +// re-loading. Writing the arg as `*(s16 *)(a0 + 0x106)` after the store +// reproduces it exactly; the SECOND call re-loads with `lh` on its own +// because $v0/$a0 died across the first jal. +// * 0x104 `lh` -> s16 multiplicand; mult/mflo/`sra 12` == plain int `>> 12`. +// * 0x88,0x8A `lhu` -> u16 bases; 0x6,0xA `sh`. +// * §3-T4 both branches: `beqz` at the top => source condition is `!= 0` with +// an early return; `bnez` at the bottom => source condition is `== 0`. +// The shared `sh $v0,0x108($s0)` tail is gcc's own cross-jump merge of the +// `- 1` arm and the `= 0xF` arm — do NOT hand-write it as a merged tail. +void func_8017F3EC(s32 a0) { + if (*(s16 *)(a0 + 0x108) != 0) { + *(s16 *)(a0 + 0x108) = *(s16 *)(a0 + 0x108) - 1; + return; + } + *(u16 *)(a0 + 0x106) = *(u16 *)(a0 + 0x106) + *(u16 *)(a0 + 0xFE); + *(s16 *)(a0 + 0x6) = *(u16 *)(a0 + 0x88) + + ((func_8004787C(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + *(s16 *)(a0 + 0xA) = *(u16 *)(a0 + 0x8A) + + ((func_80047948(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + if ((*(u16 *)(a0 + 0x106) & 0x7FF) == 0) { + *(s16 *)(a0 + 0x108) = 0xF; + } +} + INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017D898", func_8017F4A4); @@ -3462,7 +3551,38 @@ INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017D898", func_801805B INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017D898", func_801805E0); -INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017D898", func_80180664); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_80180664(s32 a0) { + + extern u8 D_8019C074[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_8019C074); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -3531,9 +3651,70 @@ void func_80180878(s32 a0) { void func_80180954(void) { } -INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017D898", func_8018095C); -INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017D898", func_80180A14); +/* func_8018095C — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); ((void (*)(void *))func_8012C218)((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void); + +void func_8018095C(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + ((void (*)(void *))func_8012C218)(temp); + } + } + func_8002A04C(arg0); + ((void (*)(void *))func_8012C218)((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32 a0, s32 a1); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_80180A14(s32 a0) { + + extern u8 D_8019C13C[]; + extern u8 D_8018564C[]; + extern u16 D_8019C170[]; + extern u16 D_8019C172[]; + extern u16 D_8019C174[]; + extern s16 D_8019C176[]; + if (func_8012C354(a0, (s32)D_8019C13C) != 0) { + func_8012A828(a0, (s32)D_8018564C); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_8019C170[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_8019C172[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_8019C174[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_8019C176[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017D898", func_80180AD8); @@ -3578,7 +3759,29 @@ void func_80180BA8(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_098/nonmatchings/ov_SC03_098_jr_8017D898", func_80180C8C); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_80180C8C(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); diff --git a/src/ov_SC03_099/ov_SC03_099_jr_80135D20.c b/src/ov_SC03_099/ov_SC03_099_jr_80135D20.c index a0b2c61ee9..a763875e14 100644 --- a/src/ov_SC03_099/ov_SC03_099_jr_80135D20.c +++ b/src/ov_SC03_099/ov_SC03_099_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801839D4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801839D4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801839D4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801839D4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801839D4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_099/ov_SC03_099_jr_80154C24.c b/src/ov_SC03_099/ov_SC03_099_jr_80154C24.c index 89ce2cc39b..f8af5c79b3 100644 --- a/src/ov_SC03_099/ov_SC03_099_jr_80154C24.c +++ b/src/ov_SC03_099/ov_SC03_099_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018575C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018575C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018575C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_099/ov_SC03_099_jr_8017BEBC.c b/src/ov_SC03_099/ov_SC03_099_jr_8017BEBC.c index 82b7d6c93f..07e7f62036 100644 --- a/src/ov_SC03_099/ov_SC03_099_jr_8017BEBC.c +++ b/src/ov_SC03_099/ov_SC03_099_jr_8017BEBC.c @@ -3173,7 +3173,24 @@ void func_8017BEBC(s32 arg0) INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017CD9C); -INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017CDDC); + +extern int func_8017D4FC(int param_1); + +void func_8017CDDC(void) +{ + + extern u8 D_801871E8[]; + extern u8 D_80187328[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_801871E8; + D_801274CC = D_80187328; + func_8017D4FC(1); +} + extern void (*D_80186EAC[])(void); @@ -3419,7 +3436,38 @@ INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017E81 INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017E844); -INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017E8C8); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_8017E8C8(s32 a0) { + + extern u8 D_8019889C[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_8019889C); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -3488,9 +3536,70 @@ void func_8017EADC(s32 a0) { void func_8017EBB8(void) { } -INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017EBC0); -INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017EC78); +/* func_8017EBC0 — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_8017EBC0(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32*, s32); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_8017EC78(s32 a0) { + + extern u8 D_80198964[]; + extern u8 D_8018374C[]; + extern u16 D_80198998[]; + extern u16 D_8019899A[]; + extern u16 D_8019899C[]; + extern s16 D_8019899E[]; + if (func_8012C354(a0, (s32)D_80198964) != 0) { + ((void (*)(s32, s32))func_8012A828)(a0, (s32)D_8018374C); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_80198998[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_8019899A[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_8019899C[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_8019899E[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017ED3C); @@ -3535,7 +3644,29 @@ void func_8017EE0C(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017EEF0); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_8017EEF0(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); @@ -3594,11 +3725,97 @@ INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017F2E INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017F3EC); -INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017F480); -INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017F538); +extern s32 func_8004787C(s32 a0); +extern s32 func_80047948(s32 a0); + +// @class: none — MATCH (46 ins), iteration 1. rtu_match MATCH too. +// @stuck: none. +// Derivation was pure OPCODE-WIDTH reading (no cookbook section needed beyond +// §3-T4 for the two branch senses): +// * 0x108 `lh`/`sh` -> s16 counter. +// * 0x106,0xFE `lhu`+`addu`+`sh` -> u16 += u16 (a signed s16 pair would have +// loaded `lh`). The `sll 16/sra 16` immediately after is NOT part of the +// add — it is the `(s16)` cast of the just-stored u16 being handed to +// func_8004787C, which CSE serves out of the store's register instead of +// re-loading. Writing the arg as `*(s16 *)(a0 + 0x106)` after the store +// reproduces it exactly; the SECOND call re-loads with `lh` on its own +// because $v0/$a0 died across the first jal. +// * 0x104 `lh` -> s16 multiplicand; mult/mflo/`sra 12` == plain int `>> 12`. +// * 0x8C,0x8A `lhu` -> u16 bases; 0xE,0xA `sh`. +// * §3-T4 both branches: `beqz` at the top => source condition is `!= 0` with +// an early return; `bnez` at the bottom => source condition is `== 0`. +// The shared `sh $v0,0x108($s0)` tail is gcc's own cross-jump merge of the +// `- 1` arm and the `= 0xF` arm — do NOT hand-write it as a merged tail. +void func_8017F480(s32 a0) { + if (*(s16 *)(a0 + 0x108) != 0) { + *(s16 *)(a0 + 0x108) = *(s16 *)(a0 + 0x108) - 1; + return; + } + *(u16 *)(a0 + 0x106) = *(u16 *)(a0 + 0x106) + *(u16 *)(a0 + 0xFE); + *(s16 *)(a0 + 0xE) = *(u16 *)(a0 + 0x8C) + + ((func_8004787C(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + *(s16 *)(a0 + 0xA) = *(u16 *)(a0 + 0x8A) + + ((func_80047948(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + if ((*(u16 *)(a0 + 0x106) & 0x7FF) == 0) { + *(s16 *)(a0 + 0x108) = 0xF; + } +} + + + +extern s32 func_8004787C(s32 a0); +extern s32 func_80047948(s32 a0); + +// @class: none — MATCH (46 ins), iteration 1. rtu_match MATCH too. +// @stuck: none. +// Derivation was pure OPCODE-WIDTH reading (no cookbook section needed beyond +// §3-T4 for the two branch senses): +// * 0x108 `lh`/`sh` -> s16 counter. +// * 0x106,0xFE `lhu`+`addu`+`sh` -> u16 += u16 (a signed s16 pair would have +// loaded `lh`). The `sll 16/sra 16` immediately after is NOT part of the +// add — it is the `(s16)` cast of the just-stored u16 being handed to +// func_8004787C, which CSE serves out of the store's register instead of +// re-loading. Writing the arg as `*(s16 *)(a0 + 0x106)` after the store +// reproduces it exactly; the SECOND call re-loads with `lh` on its own +// because $v0/$a0 died across the first jal. +// * 0x104 `lh` -> s16 multiplicand; mult/mflo/`sra 12` == plain int `>> 12`. +// * 0x88,0x8A `lhu` -> u16 bases; 0x6,0xA `sh`. +// * §3-T4 both branches: `beqz` at the top => source condition is `!= 0` with +// an early return; `bnez` at the bottom => source condition is `== 0`. +// The shared `sh $v0,0x108($s0)` tail is gcc's own cross-jump merge of the +// `- 1` arm and the `= 0xF` arm — do NOT hand-write it as a merged tail. +void func_8017F538(s32 a0) { + if (*(s16 *)(a0 + 0x108) != 0) { + *(s16 *)(a0 + 0x108) = *(s16 *)(a0 + 0x108) - 1; + return; + } + *(u16 *)(a0 + 0x106) = *(u16 *)(a0 + 0x106) + *(u16 *)(a0 + 0xFE); + *(s16 *)(a0 + 0x6) = *(u16 *)(a0 + 0x88) + + ((func_8004787C(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + *(s16 *)(a0 + 0xA) = *(u16 *)(a0 + 0x8A) + + ((func_80047948(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + if ((*(u16 *)(a0 + 0x106) & 0x7FF) == 0) { + *(s16 *)(a0 + 0x108) = 0xF; + } +} + + + +extern void func_801802C4(void *a0); + +void func_8017F5F0(void *a0) { + + extern void (*D_8019CA78[])(void); + D_8019CA78[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)((s32)a0 + 0x0) != 0) { + *(s32 *)((s32)a0 + 0xE8) = *(s32 *)((s32)a0 + 0xE8) + 1; + if ((*(s32 *)((s32)a0 + 0xE8) & 0xF) == 0) { + func_801802C4(a0); + } + } +} -INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017F5F0); INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017F66C); @@ -3615,7 +3832,36 @@ INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017FDA INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8017FEB8); -INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_80180054); + +extern s32 func_8012BEE8(s32 a0); +extern s32 func_8012E778(s32 a0, s32 a1); +extern void func_8012E88C(s32 a0); +extern void func_8012A828(s32 *a0, s32 a1); + +void func_80180054(void *arg0) { + + extern s32 D_8019EF68; + if (func_8012BEE8((s32)arg0)) { + if (!func_8012E778((s32)arg0, 0xA000C8)) { + { + s32 t; + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + *(s16 *)((char *)arg0 + 0x2) = (t == 0) ? 1 : 3; + } + *(s16 *)((char *)arg0 + 0x5C) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78) + 0x2); + *(s16 *)((char *)arg0 + 0x76) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78)); + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1A) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1C) = 0x1000; + *(u16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x2C) &= 0x10; + func_8012E88C((s32)arg0); + func_8012A828(arg0, &D_8019EF68); + } + } +} + INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_80180110); @@ -3778,11 +4024,153 @@ INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_8018287 INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_801828E8); -INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_80182998); -INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_80182A50); -INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_80182B10); +extern s32 func_8012E778(int param_1, int param_2); +extern s32 func_8012C51C(int a0, int a1); + +void func_80182998(int param_1, int param_2) +{ + + extern u16 D_800AF7BC; + extern u16 D_800AF7BE; + extern u8 D_801BF2E8[]; + s32 i; + + i = 0; + if (func_8012E778(param_1, ((s32)(D_800AF7BE >> 1) << 16) | (D_800AF7BC >> 1)) != 0) { + do { + if (D_801BF2E8[i] == 0) { + D_801BF2E8[i] = 1; + *(s32 *)(param_2 + 0x10) = i | 0x80000000; + *(u16 *)(param_2 + 8) = *(u16 *)(param_1 + 0x70); + func_8012C51C(param_2, param_1); + return; + } + i++; + } while (i < 5); + } +} + + + +extern s32 func_8012C194(void); +extern void func_8001CD50(s32 a0, s32 a1); +extern void func_800233CC(void *, unsigned short); +extern void func_80182DDC(s32 a0); + +void func_80182A50(void *a0) +{ + + extern u32 D_801BF1A8; + s32 iVar2; + u32 *puVar3; + + *(s16 *)((s32)a0 + 0xFC) = 0x7000; + *(s16 *)((s32)a0 + 0x100) = 0; + *(s16 *)((s32)a0 + 0xFE) = 0; + *(s16 *)((s32)a0 + 0x104) = 0; + *(s16 *)((s32)a0 + 0x106) = 0; + puVar3 = (u32 *)((u8 *)&D_801BF1A8 + (*(s16 *)((s32)a0 + 0xDC) * 0x40)); + iVar2 = func_8012C194(); + *(s32 *)((s32)a0 + 0x20) = iVar2; + if (iVar2 != 0) { + func_8001CD50(iVar2, (s32)puVar3); + *(s16 *)(iVar2 + 0x10) = 0x400; + *(u32 *)(iVar2 + 4) = *(u32 *)(iVar2 + 4) | 0x60000000; + func_800233CC(puVar3, 0x40); + puVar3[0] = 0x808080; + puVar3[1] = 0x808080; + func_80182DDC((s32)a0); + *(s16 *)((s32)a0 + 2) = 3; + } +} + + + +/* func_80182B10 — per-frame entity tick: decay the sound-handle envelope at + * +0x20, ramp the s16 pair at +0xFE/+0x106 up to a 0x6000 ceiling, then ramp + * the pair at +0xFC/+0x104 down; when the +0xFC accumulator goes negative the + * entity releases its D_801BF2E8 slot and hands off to func_8012C218, + * otherwise it continues in func_80182BDC. + * + * §71 sibling-first: func_8018A090 (same TU, 0xC0 bytes earlier) is the + * initialiser for exactly these fields (+0xFC/+0xFE/+0x100/+0x104/+0x106, the + * +0x20 handle and the +0xDC slot index) and pins the widths/casts used here. + * D_801BF2E8[] is the 5-entry slot table func_80189FD8 (same TU) claims from. + * + * Levers (all three were needed; each is byte-verified by removal): + * 1. §3-T4 branch polarity — the 0x6000 guard is written `>= 0x6000` with the + * CLAMP as the then-arm, which is what puts `slti/bnez` + the `j` over the + * ramp arm in the target order. Writing it `< 0x6000` gives `beqz` and the + * arms swapped. + * 2. Zero-byte `__asm__ __volatile__("" : : : "memory")` at the head of the + * ramp arm (§34 toolkit). Without it cse.c relates the guard's + * `lh 0xFE` to the ramp's `lhu 0xFE` — same MEM, sign- vs zero-extend — + * and rewrites the second as `move`+`andi 0xffff`. That also lands both + * arms' final store in $v0, which lets the post-reload jump pass CROSS-JUMP + * the two `sh 0xFE` tails (§5a) and eats the `j .L8018A1C4`. The clobber + * invalidates the MEM in the hash table so the real second load survives, + * the arms end in different registers, and the cross-jump cannot fire. + * 3. The +0x104 store is SUNK to immediately after the subtract, before the + * +0xFC accumulate. Both tail quantities are otherwise born in the same + * block, and local-alloc's QTY_CMP_PRI (n_refs*log2(n_refs)/live_length) + * then ranks the accumulator ABOVE the delta, handing it $v0 and swapping + * the whole block's register pair. Storing the delta early kills its live + * range at insn 3, which flips the priority back so the delta takes $v0. + * Purely a scheduling/priority dial — the emitted order is unchanged + * because reorg pulls `sh 0x104` back into the `bgez` delay slot. + * Also note the two tail blocks are BLOCK-SCOPED: sharing one function-scope + * pair across the 0xFE and 0xFC ramps makes them global allocnos (§76), which + * costs $a1 for the deltas and an extra 8 bytes of frame (0x20 vs 0x18). + */ + +extern void func_8012C218(void *a0); +extern void func_80182BDC(void *a0); + +void func_80182B10(void *a0) +{ + + extern u8 D_801BF2E8[]; + s32 p; + s32 v; + + p = *(s32 *)((s32)a0 + 0x20); + if (p != 0) { + v = *(u16 *)(p + 0x1A) - 0x100; + *(s16 *)(p + 0x1A) = v; + *(s16 *)(p + 0x18) = v; + if (*(s16 *)(p + 0x1A) < 0) { + *(s16 *)(p + 0x1A) = 0; + *(s16 *)(p + 0x18) = 0; + } + } + if (*(s16 *)((s32)a0 + 0xFE) >= 0x6000) { + *(s16 *)((s32)a0 + 0xFE) = 0x6000; + } else { + s32 dv, sv; + __asm__ __volatile__("" : : : "memory"); + dv = *(u16 *)((s32)a0 + 0x106) + 0x400; + sv = *(u16 *)((s32)a0 + 0xFE) + dv; + *(s16 *)((s32)a0 + 0x106) = dv; + *(s16 *)((s32)a0 + 0xFE) = sv; + } + { + s32 d = *(u16 *)((s32)a0 + 0x104) - 0x80; + s16 s; + + *(s16 *)((s32)a0 + 0x104) = d; + s = *(u16 *)((s32)a0 + 0xFC) + d; + *(s16 *)((s32)a0 + 0xFC) = s; + if (s < 0) { + D_801BF2E8[*(s16 *)((s32)a0 + 0xDC)] = 0; + func_8012C218(a0); + } else { + func_80182BDC(a0); + } + } +} + INCLUDE_ASM("asm/ov_SC03_099/nonmatchings/ov_SC03_099_jr_8017BEBC", func_80182BDC); diff --git a/src/ov_SC03_100/ov_SC03_100_jr_80135D20.c b/src/ov_SC03_100/ov_SC03_100_jr_80135D20.c index 7a12766b6d..711251f7c9 100644 --- a/src/ov_SC03_100/ov_SC03_100_jr_80135D20.c +++ b/src/ov_SC03_100/ov_SC03_100_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80184EA0[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80184EA0[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80184EA0[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80184EA0[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80184EA0[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_100/ov_SC03_100_jr_80154C24.c b/src/ov_SC03_100/ov_SC03_100_jr_80154C24.c index f1e2fe7d62..08dfa5ae78 100644 --- a/src/ov_SC03_100/ov_SC03_100_jr_80154C24.c +++ b/src/ov_SC03_100/ov_SC03_100_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80186C28)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80186C28[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80186C28[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_100/ov_SC03_100_jr_8017AE2C.c b/src/ov_SC03_100/ov_SC03_100_jr_8017AE2C.c index d90f81d1bd..252512e9dc 100644 --- a/src/ov_SC03_100/ov_SC03_100_jr_8017AE2C.c +++ b/src/ov_SC03_100/ov_SC03_100_jr_8017AE2C.c @@ -3370,7 +3370,15 @@ void func_8017CD10(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017AE2C", func_8017CD4C); +extern void func_80147324(s32 arg0); +void func_8017CD4C(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3399,7 +3407,20 @@ INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017AE2C", func_8017CDF INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017AE2C", func_8017CE7C); -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017AE2C", func_8017CFE4); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017CFE4(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D030(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017AE2C", func_8017D030); @@ -3411,7 +3432,13 @@ void func_8017D33C(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017AE2C", func_8017D378); +extern void func_80147324(s32 arg0); +void func_8017D378(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D3B8 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3513,7 +3540,25 @@ void func_8017D4B4(void *a0) } -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017AE2C", func_8017D588); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017D588(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D030)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_80188468[])(void); @@ -3525,7 +3570,22 @@ void func_8017D5DC(void *a0) { INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017AE2C", func_8017D618); -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017AE2C", func_8017D6CC); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017D728(void *a0); +void func_8017D6CC(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017D728(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017AE2C", func_8017D728); diff --git a/src/ov_SC03_100/ov_SC03_100_jr_8017D898.c b/src/ov_SC03_100/ov_SC03_100_jr_8017D898.c index 7cf27d6bd8..7a7f343a7e 100644 --- a/src/ov_SC03_100/ov_SC03_100_jr_8017D898.c +++ b/src/ov_SC03_100/ov_SC03_100_jr_8017D898.c @@ -3181,7 +3181,24 @@ void func_8017D898(s32 arg0) INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_8017E778); -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_8017E7B8); + +extern int func_8017EF28(int param_1); + +void func_8017E7B8(void) +{ + + extern u8 D_80188994[]; + extern u8 D_80188B88[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_80188994; + D_801274CC = D_80188B88; + func_8017EF28(1); +} + extern void (*D_80188510[])(void); @@ -3426,7 +3443,38 @@ INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_8018024 INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_80180270); -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_801802F4); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_801802F4(s32 a0) { + + extern u8 D_801A0368[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_801A0368); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -3495,9 +3543,70 @@ void func_80180508(s32 a0) { void func_801805E4(void) { } -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_801805EC); -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_801806A4); +/* func_801805EC — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_801805EC(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32, void*); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_801806A4(s32 a0) { + + extern u8 D_801A0430[]; + extern u8 D_80184C18[]; + extern u16 D_801A0464[]; + extern u16 D_801A0466[]; + extern u16 D_801A0468[]; + extern s16 D_801A046A[]; + if (func_8012C354(a0, (s32)D_801A0430) != 0) { + ((void (*)(s32, s32))func_8012A828)(a0, (s32)D_80184C18); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_801A0464[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_801A0466[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_801A0468[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_801A046A[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_80180768); @@ -3542,7 +3651,29 @@ void func_80180838(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_8018091C); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_8018091C(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); @@ -3601,9 +3732,81 @@ INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_80180D1 INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_80180E18); -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_80180EAC); -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_80180F64); +extern s32 func_8004787C(s32 a0); +extern s32 func_80047948(s32 a0); + +// @class: none — MATCH (46 ins), iteration 1. rtu_match MATCH too. +// @stuck: none. +// Derivation was pure OPCODE-WIDTH reading (no cookbook section needed beyond +// §3-T4 for the two branch senses): +// * 0x108 `lh`/`sh` -> s16 counter. +// * 0x106,0xFE `lhu`+`addu`+`sh` -> u16 += u16 (a signed s16 pair would have +// loaded `lh`). The `sll 16/sra 16` immediately after is NOT part of the +// add — it is the `(s16)` cast of the just-stored u16 being handed to +// func_8004787C, which CSE serves out of the store's register instead of +// re-loading. Writing the arg as `*(s16 *)(a0 + 0x106)` after the store +// reproduces it exactly; the SECOND call re-loads with `lh` on its own +// because $v0/$a0 died across the first jal. +// * 0x104 `lh` -> s16 multiplicand; mult/mflo/`sra 12` == plain int `>> 12`. +// * 0x8C,0x8A `lhu` -> u16 bases; 0xE,0xA `sh`. +// * §3-T4 both branches: `beqz` at the top => source condition is `!= 0` with +// an early return; `bnez` at the bottom => source condition is `== 0`. +// The shared `sh $v0,0x108($s0)` tail is gcc's own cross-jump merge of the +// `- 1` arm and the `= 0xF` arm — do NOT hand-write it as a merged tail. +void func_80180EAC(s32 a0) { + if (*(s16 *)(a0 + 0x108) != 0) { + *(s16 *)(a0 + 0x108) = *(s16 *)(a0 + 0x108) - 1; + return; + } + *(u16 *)(a0 + 0x106) = *(u16 *)(a0 + 0x106) + *(u16 *)(a0 + 0xFE); + *(s16 *)(a0 + 0xE) = *(u16 *)(a0 + 0x8C) + + ((func_8004787C(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + *(s16 *)(a0 + 0xA) = *(u16 *)(a0 + 0x8A) + + ((func_80047948(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + if ((*(u16 *)(a0 + 0x106) & 0x7FF) == 0) { + *(s16 *)(a0 + 0x108) = 0xF; + } +} + + + +extern s32 func_8004787C(s32 a0); +extern s32 func_80047948(s32 a0); + +// @class: none — MATCH (46 ins), iteration 1. rtu_match MATCH too. +// @stuck: none. +// Derivation was pure OPCODE-WIDTH reading (no cookbook section needed beyond +// §3-T4 for the two branch senses): +// * 0x108 `lh`/`sh` -> s16 counter. +// * 0x106,0xFE `lhu`+`addu`+`sh` -> u16 += u16 (a signed s16 pair would have +// loaded `lh`). The `sll 16/sra 16` immediately after is NOT part of the +// add — it is the `(s16)` cast of the just-stored u16 being handed to +// func_8004787C, which CSE serves out of the store's register instead of +// re-loading. Writing the arg as `*(s16 *)(a0 + 0x106)` after the store +// reproduces it exactly; the SECOND call re-loads with `lh` on its own +// because $v0/$a0 died across the first jal. +// * 0x104 `lh` -> s16 multiplicand; mult/mflo/`sra 12` == plain int `>> 12`. +// * 0x88,0x8A `lhu` -> u16 bases; 0x6,0xA `sh`. +// * §3-T4 both branches: `beqz` at the top => source condition is `!= 0` with +// an early return; `bnez` at the bottom => source condition is `== 0`. +// The shared `sh $v0,0x108($s0)` tail is gcc's own cross-jump merge of the +// `- 1` arm and the `= 0xF` arm — do NOT hand-write it as a merged tail. +void func_80180F64(s32 a0) { + if (*(s16 *)(a0 + 0x108) != 0) { + *(s16 *)(a0 + 0x108) = *(s16 *)(a0 + 0x108) - 1; + return; + } + *(u16 *)(a0 + 0x106) = *(u16 *)(a0 + 0x106) + *(u16 *)(a0 + 0xFE); + *(s16 *)(a0 + 0x6) = *(u16 *)(a0 + 0x88) + + ((func_8004787C(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + *(s16 *)(a0 + 0xA) = *(u16 *)(a0 + 0x8A) + + ((func_80047948(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + if ((*(u16 *)(a0 + 0x106) & 0x7FF) == 0) { + *(s16 *)(a0 + 0x108) = 0xF; + } +} + INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_8018101C); @@ -3736,11 +3939,153 @@ INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_8018355 INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_801835D4); -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_80183684); -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_8018373C); -INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_801837FC); +extern s32 func_8012E778(int param_1, int param_2); +extern s32 func_8012C51C(int a0, int a1); + +void func_80183684(int param_1, int param_2) +{ + + extern u16 D_800AF7BC; + extern u16 D_800AF7BE; + extern u8 D_801C87F0[]; + s32 i; + + i = 0; + if (func_8012E778(param_1, ((s32)(D_800AF7BE >> 1) << 16) | (D_800AF7BC >> 1)) != 0) { + do { + if (D_801C87F0[i] == 0) { + D_801C87F0[i] = 1; + *(s32 *)(param_2 + 0x10) = i | 0x80000000; + *(u16 *)(param_2 + 8) = *(u16 *)(param_1 + 0x70); + func_8012C51C(param_2, param_1); + return; + } + i++; + } while (i < 5); + } +} + + + +extern s32 func_8012C194(void); +extern void func_8001CD50(s32 a0, s32 a1); +extern void func_800233CC(void *, unsigned short); +extern void func_80183AC8(s32 a0); + +void func_8018373C(void *a0) +{ + + extern u32 D_801C86B0; + s32 iVar2; + u32 *puVar3; + + *(s16 *)((s32)a0 + 0xFC) = 0x7000; + *(s16 *)((s32)a0 + 0x100) = 0; + *(s16 *)((s32)a0 + 0xFE) = 0; + *(s16 *)((s32)a0 + 0x104) = 0; + *(s16 *)((s32)a0 + 0x106) = 0; + puVar3 = (u32 *)((u8 *)&D_801C86B0 + (*(s16 *)((s32)a0 + 0xDC) * 0x40)); + iVar2 = func_8012C194(); + *(s32 *)((s32)a0 + 0x20) = iVar2; + if (iVar2 != 0) { + func_8001CD50(iVar2, (s32)puVar3); + *(s16 *)(iVar2 + 0x10) = 0x400; + *(u32 *)(iVar2 + 4) = *(u32 *)(iVar2 + 4) | 0x60000000; + func_800233CC(puVar3, 0x40); + puVar3[0] = 0x808080; + puVar3[1] = 0x808080; + func_80183AC8((s32)a0); + *(s16 *)((s32)a0 + 2) = 3; + } +} + + + +/* func_801837FC — per-frame entity tick: decay the sound-handle envelope at + * +0x20, ramp the s16 pair at +0xFE/+0x106 up to a 0x6000 ceiling, then ramp + * the pair at +0xFC/+0x104 down; when the +0xFC accumulator goes negative the + * entity releases its D_801C87F0 slot and hands off to func_8012C218, + * otherwise it continues in func_801838C8. + * + * §71 sibling-first: func_8018A090 (same TU, 0xC0 bytes earlier) is the + * initialiser for exactly these fields (+0xFC/+0xFE/+0x100/+0x104/+0x106, the + * +0x20 handle and the +0xDC slot index) and pins the widths/casts used here. + * D_801C87F0[] is the 5-entry slot table func_80189FD8 (same TU) claims from. + * + * Levers (all three were needed; each is byte-verified by removal): + * 1. §3-T4 branch polarity — the 0x6000 guard is written `>= 0x6000` with the + * CLAMP as the then-arm, which is what puts `slti/bnez` + the `j` over the + * ramp arm in the target order. Writing it `< 0x6000` gives `beqz` and the + * arms swapped. + * 2. Zero-byte `__asm__ __volatile__("" : : : "memory")` at the head of the + * ramp arm (§34 toolkit). Without it cse.c relates the guard's + * `lh 0xFE` to the ramp's `lhu 0xFE` — same MEM, sign- vs zero-extend — + * and rewrites the second as `move`+`andi 0xffff`. That also lands both + * arms' final store in $v0, which lets the post-reload jump pass CROSS-JUMP + * the two `sh 0xFE` tails (§5a) and eats the `j .L8018A1C4`. The clobber + * invalidates the MEM in the hash table so the real second load survives, + * the arms end in different registers, and the cross-jump cannot fire. + * 3. The +0x104 store is SUNK to immediately after the subtract, before the + * +0xFC accumulate. Both tail quantities are otherwise born in the same + * block, and local-alloc's QTY_CMP_PRI (n_refs*log2(n_refs)/live_length) + * then ranks the accumulator ABOVE the delta, handing it $v0 and swapping + * the whole block's register pair. Storing the delta early kills its live + * range at insn 3, which flips the priority back so the delta takes $v0. + * Purely a scheduling/priority dial — the emitted order is unchanged + * because reorg pulls `sh 0x104` back into the `bgez` delay slot. + * Also note the two tail blocks are BLOCK-SCOPED: sharing one function-scope + * pair across the 0xFE and 0xFC ramps makes them global allocnos (§76), which + * costs $a1 for the deltas and an extra 8 bytes of frame (0x20 vs 0x18). + */ + +extern void func_8012C218(void *a0); +extern void func_801838C8(void *a0); + +void func_801837FC(void *a0) +{ + + extern u8 D_801C87F0[]; + s32 p; + s32 v; + + p = *(s32 *)((s32)a0 + 0x20); + if (p != 0) { + v = *(u16 *)(p + 0x1A) - 0x100; + *(s16 *)(p + 0x1A) = v; + *(s16 *)(p + 0x18) = v; + if (*(s16 *)(p + 0x1A) < 0) { + *(s16 *)(p + 0x1A) = 0; + *(s16 *)(p + 0x18) = 0; + } + } + if (*(s16 *)((s32)a0 + 0xFE) >= 0x6000) { + *(s16 *)((s32)a0 + 0xFE) = 0x6000; + } else { + s32 dv, sv; + __asm__ __volatile__("" : : : "memory"); + dv = *(u16 *)((s32)a0 + 0x106) + 0x400; + sv = *(u16 *)((s32)a0 + 0xFE) + dv; + *(s16 *)((s32)a0 + 0x106) = dv; + *(s16 *)((s32)a0 + 0xFE) = sv; + } + { + s32 d = *(u16 *)((s32)a0 + 0x104) - 0x80; + s16 s; + + *(s16 *)((s32)a0 + 0x104) = d; + s = *(u16 *)((s32)a0 + 0xFC) + d; + *(s16 *)((s32)a0 + 0xFC) = s; + if (s < 0) { + D_801C87F0[*(s16 *)((s32)a0 + 0xDC)] = 0; + func_8012C218(a0); + } else { + func_801838C8(a0); + } + } +} + INCLUDE_ASM("asm/ov_SC03_100/nonmatchings/ov_SC03_100_jr_8017D898", func_801838C8); diff --git a/src/ov_SC03_101/ov_SC03_101_jr_80135D20.c b/src/ov_SC03_101/ov_SC03_101_jr_80135D20.c index 90535912d6..516e0d787a 100644 --- a/src/ov_SC03_101/ov_SC03_101_jr_80135D20.c +++ b/src/ov_SC03_101/ov_SC03_101_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80183E7C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80183E7C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80183E7C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80183E7C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80183E7C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_101/ov_SC03_101_jr_80154C24.c b/src/ov_SC03_101/ov_SC03_101_jr_80154C24.c index bbd120da72..9121ca1ef4 100644 --- a/src/ov_SC03_101/ov_SC03_101_jr_80154C24.c +++ b/src/ov_SC03_101/ov_SC03_101_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80185C04)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80185C04[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80185C04[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_101/ov_SC03_101_jr_8017CA80.c b/src/ov_SC03_101/ov_SC03_101_jr_8017CA80.c index 60c10d3026..552bd64d68 100644 --- a/src/ov_SC03_101/ov_SC03_101_jr_8017CA80.c +++ b/src/ov_SC03_101/ov_SC03_101_jr_8017CA80.c @@ -3499,7 +3499,38 @@ INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_8017F62 INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_8017F654); -INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_8017F6D8); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_8017F6D8(s32 a0) { + + extern u8 D_80196804[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_80196804); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -3568,9 +3599,70 @@ void func_8017F8EC(s32 a0) { void func_8017F9C8(void) { } -INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_8017F9D0); -INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_8017FA88); +/* func_8017F9D0 — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_8017F9D0(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32 a0, s32 a1); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_8017FA88(s32 a0) { + + extern u8 D_801968CC[]; + extern u8 D_80183BF4[]; + extern u16 D_80196900[]; + extern u16 D_80196902[]; + extern u16 D_80196904[]; + extern s16 D_80196906[]; + if (func_8012C354(a0, (s32)D_801968CC) != 0) { + func_8012A828(a0, (s32)D_80183BF4); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_80196900[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_80196902[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_80196904[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_80196906[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_8017FB4C); @@ -3615,7 +3707,29 @@ void func_8017FC1C(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_8017FD00); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_8017FD00(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); @@ -3674,9 +3788,81 @@ INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_801800F INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_801801FC); -INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_80180290); -INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_80180348); +extern s32 func_8004787C(s32 a0); +extern s32 func_80047948(s32 a0); + +// @class: none — MATCH (46 ins), iteration 1. rtu_match MATCH too. +// @stuck: none. +// Derivation was pure OPCODE-WIDTH reading (no cookbook section needed beyond +// §3-T4 for the two branch senses): +// * 0x108 `lh`/`sh` -> s16 counter. +// * 0x106,0xFE `lhu`+`addu`+`sh` -> u16 += u16 (a signed s16 pair would have +// loaded `lh`). The `sll 16/sra 16` immediately after is NOT part of the +// add — it is the `(s16)` cast of the just-stored u16 being handed to +// func_8004787C, which CSE serves out of the store's register instead of +// re-loading. Writing the arg as `*(s16 *)(a0 + 0x106)` after the store +// reproduces it exactly; the SECOND call re-loads with `lh` on its own +// because $v0/$a0 died across the first jal. +// * 0x104 `lh` -> s16 multiplicand; mult/mflo/`sra 12` == plain int `>> 12`. +// * 0x8C,0x8A `lhu` -> u16 bases; 0xE,0xA `sh`. +// * §3-T4 both branches: `beqz` at the top => source condition is `!= 0` with +// an early return; `bnez` at the bottom => source condition is `== 0`. +// The shared `sh $v0,0x108($s0)` tail is gcc's own cross-jump merge of the +// `- 1` arm and the `= 0xF` arm — do NOT hand-write it as a merged tail. +void func_80180290(s32 a0) { + if (*(s16 *)(a0 + 0x108) != 0) { + *(s16 *)(a0 + 0x108) = *(s16 *)(a0 + 0x108) - 1; + return; + } + *(u16 *)(a0 + 0x106) = *(u16 *)(a0 + 0x106) + *(u16 *)(a0 + 0xFE); + *(s16 *)(a0 + 0xE) = *(u16 *)(a0 + 0x8C) + + ((func_8004787C(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + *(s16 *)(a0 + 0xA) = *(u16 *)(a0 + 0x8A) + + ((func_80047948(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + if ((*(u16 *)(a0 + 0x106) & 0x7FF) == 0) { + *(s16 *)(a0 + 0x108) = 0xF; + } +} + + + +extern s32 func_8004787C(s32 a0); +extern s32 func_80047948(s32 a0); + +// @class: none — MATCH (46 ins), iteration 1. rtu_match MATCH too. +// @stuck: none. +// Derivation was pure OPCODE-WIDTH reading (no cookbook section needed beyond +// §3-T4 for the two branch senses): +// * 0x108 `lh`/`sh` -> s16 counter. +// * 0x106,0xFE `lhu`+`addu`+`sh` -> u16 += u16 (a signed s16 pair would have +// loaded `lh`). The `sll 16/sra 16` immediately after is NOT part of the +// add — it is the `(s16)` cast of the just-stored u16 being handed to +// func_8004787C, which CSE serves out of the store's register instead of +// re-loading. Writing the arg as `*(s16 *)(a0 + 0x106)` after the store +// reproduces it exactly; the SECOND call re-loads with `lh` on its own +// because $v0/$a0 died across the first jal. +// * 0x104 `lh` -> s16 multiplicand; mult/mflo/`sra 12` == plain int `>> 12`. +// * 0x88,0x8A `lhu` -> u16 bases; 0x6,0xA `sh`. +// * §3-T4 both branches: `beqz` at the top => source condition is `!= 0` with +// an early return; `bnez` at the bottom => source condition is `== 0`. +// The shared `sh $v0,0x108($s0)` tail is gcc's own cross-jump merge of the +// `- 1` arm and the `= 0xF` arm — do NOT hand-write it as a merged tail. +void func_80180348(s32 a0) { + if (*(s16 *)(a0 + 0x108) != 0) { + *(s16 *)(a0 + 0x108) = *(s16 *)(a0 + 0x108) - 1; + return; + } + *(u16 *)(a0 + 0x106) = *(u16 *)(a0 + 0x106) + *(u16 *)(a0 + 0xFE); + *(s16 *)(a0 + 0x6) = *(u16 *)(a0 + 0x88) + + ((func_8004787C(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + *(s16 *)(a0 + 0xA) = *(u16 *)(a0 + 0x8A) + + ((func_80047948(*(s16 *)(a0 + 0x106)) * *(s16 *)(a0 + 0x104)) >> 12); + if ((*(u16 *)(a0 + 0x106) & 0x7FF) == 0) { + *(s16 *)(a0 + 0x108) = 0xF; + } +} + INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_80180400); @@ -3894,11 +4080,153 @@ INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_80182D1 INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_80182D90); -INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_80182E40); -INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_80182EF8); -INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_80182FB8); +extern s32 func_8012E778(int param_1, int param_2); +extern s32 func_8012C51C(int a0, int a1); + +void func_80182E40(int param_1, int param_2) +{ + + extern u16 D_800AF7BC; + extern u16 D_800AF7BE; + extern u8 D_8019E0B0[]; + s32 i; + + i = 0; + if (func_8012E778(param_1, ((s32)(D_800AF7BE >> 1) << 16) | (D_800AF7BC >> 1)) != 0) { + do { + if (D_8019E0B0[i] == 0) { + D_8019E0B0[i] = 1; + *(s32 *)(param_2 + 0x10) = i | 0x80000000; + *(u16 *)(param_2 + 8) = *(u16 *)(param_1 + 0x70); + func_8012C51C(param_2, param_1); + return; + } + i++; + } while (i < 5); + } +} + + + +extern s32 func_8012C194(void); +extern void func_8001CD50(s32 a0, s32 a1); +extern void func_800233CC(void *, unsigned short); +extern void func_80183284(s32 a0); + +void func_80182EF8(void *a0) +{ + + extern u32 D_8019DF70; + s32 iVar2; + u32 *puVar3; + + *(s16 *)((s32)a0 + 0xFC) = 0x7000; + *(s16 *)((s32)a0 + 0x100) = 0; + *(s16 *)((s32)a0 + 0xFE) = 0; + *(s16 *)((s32)a0 + 0x104) = 0; + *(s16 *)((s32)a0 + 0x106) = 0; + puVar3 = (u32 *)((u8 *)&D_8019DF70 + (*(s16 *)((s32)a0 + 0xDC) * 0x40)); + iVar2 = func_8012C194(); + *(s32 *)((s32)a0 + 0x20) = iVar2; + if (iVar2 != 0) { + func_8001CD50(iVar2, (s32)puVar3); + *(s16 *)(iVar2 + 0x10) = 0x400; + *(u32 *)(iVar2 + 4) = *(u32 *)(iVar2 + 4) | 0x60000000; + func_800233CC(puVar3, 0x40); + puVar3[0] = 0x808080; + puVar3[1] = 0x808080; + func_80183284((s32)a0); + *(s16 *)((s32)a0 + 2) = 3; + } +} + + + +/* func_80182FB8 — per-frame entity tick: decay the sound-handle envelope at + * +0x20, ramp the s16 pair at +0xFE/+0x106 up to a 0x6000 ceiling, then ramp + * the pair at +0xFC/+0x104 down; when the +0xFC accumulator goes negative the + * entity releases its D_8019E0B0 slot and hands off to func_8012C218, + * otherwise it continues in func_80183084. + * + * §71 sibling-first: func_8018A090 (same TU, 0xC0 bytes earlier) is the + * initialiser for exactly these fields (+0xFC/+0xFE/+0x100/+0x104/+0x106, the + * +0x20 handle and the +0xDC slot index) and pins the widths/casts used here. + * D_8019E0B0[] is the 5-entry slot table func_80189FD8 (same TU) claims from. + * + * Levers (all three were needed; each is byte-verified by removal): + * 1. §3-T4 branch polarity — the 0x6000 guard is written `>= 0x6000` with the + * CLAMP as the then-arm, which is what puts `slti/bnez` + the `j` over the + * ramp arm in the target order. Writing it `< 0x6000` gives `beqz` and the + * arms swapped. + * 2. Zero-byte `__asm__ __volatile__("" : : : "memory")` at the head of the + * ramp arm (§34 toolkit). Without it cse.c relates the guard's + * `lh 0xFE` to the ramp's `lhu 0xFE` — same MEM, sign- vs zero-extend — + * and rewrites the second as `move`+`andi 0xffff`. That also lands both + * arms' final store in $v0, which lets the post-reload jump pass CROSS-JUMP + * the two `sh 0xFE` tails (§5a) and eats the `j .L8018A1C4`. The clobber + * invalidates the MEM in the hash table so the real second load survives, + * the arms end in different registers, and the cross-jump cannot fire. + * 3. The +0x104 store is SUNK to immediately after the subtract, before the + * +0xFC accumulate. Both tail quantities are otherwise born in the same + * block, and local-alloc's QTY_CMP_PRI (n_refs*log2(n_refs)/live_length) + * then ranks the accumulator ABOVE the delta, handing it $v0 and swapping + * the whole block's register pair. Storing the delta early kills its live + * range at insn 3, which flips the priority back so the delta takes $v0. + * Purely a scheduling/priority dial — the emitted order is unchanged + * because reorg pulls `sh 0x104` back into the `bgez` delay slot. + * Also note the two tail blocks are BLOCK-SCOPED: sharing one function-scope + * pair across the 0xFE and 0xFC ramps makes them global allocnos (§76), which + * costs $a1 for the deltas and an extra 8 bytes of frame (0x20 vs 0x18). + */ + +extern void func_8012C218(void *a0); +extern void func_80183084(void *a0); + +void func_80182FB8(void *a0) +{ + + extern u8 D_8019E0B0[]; + s32 p; + s32 v; + + p = *(s32 *)((s32)a0 + 0x20); + if (p != 0) { + v = *(u16 *)(p + 0x1A) - 0x100; + *(s16 *)(p + 0x1A) = v; + *(s16 *)(p + 0x18) = v; + if (*(s16 *)(p + 0x1A) < 0) { + *(s16 *)(p + 0x1A) = 0; + *(s16 *)(p + 0x18) = 0; + } + } + if (*(s16 *)((s32)a0 + 0xFE) >= 0x6000) { + *(s16 *)((s32)a0 + 0xFE) = 0x6000; + } else { + s32 dv, sv; + __asm__ __volatile__("" : : : "memory"); + dv = *(u16 *)((s32)a0 + 0x106) + 0x400; + sv = *(u16 *)((s32)a0 + 0xFE) + dv; + *(s16 *)((s32)a0 + 0x106) = dv; + *(s16 *)((s32)a0 + 0xFE) = sv; + } + { + s32 d = *(u16 *)((s32)a0 + 0x104) - 0x80; + s16 s; + + *(s16 *)((s32)a0 + 0x104) = d; + s = *(u16 *)((s32)a0 + 0xFC) + d; + *(s16 *)((s32)a0 + 0xFC) = s; + if (s < 0) { + D_8019E0B0[*(s16 *)((s32)a0 + 0xDC)] = 0; + func_8012C218(a0); + } else { + func_80183084(a0); + } + } +} + INCLUDE_ASM("asm/ov_SC03_101/nonmatchings/ov_SC03_101_jr_8017CA80", func_80183084); diff --git a/src/ov_SC03_102/ov_SC03_102_jr_80135D20.c b/src/ov_SC03_102/ov_SC03_102_jr_80135D20.c index ad457641c3..126de5fe47 100644 --- a/src/ov_SC03_102/ov_SC03_102_jr_80135D20.c +++ b/src/ov_SC03_102/ov_SC03_102_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80186734[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80186734[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80186734[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80186734[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80186734[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_102/ov_SC03_102_jr_80154C24.c b/src/ov_SC03_102/ov_SC03_102_jr_80154C24.c index 0dc1439b8f..2adba6128b 100644 --- a/src/ov_SC03_102/ov_SC03_102_jr_80154C24.c +++ b/src/ov_SC03_102/ov_SC03_102_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801884BC)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801884BC[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801884BC[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_102/ov_SC03_102_jr_8017BEBC.c b/src/ov_SC03_102/ov_SC03_102_jr_8017BEBC.c index b8c9962388..b8d0e25b6b 100644 --- a/src/ov_SC03_102/ov_SC03_102_jr_8017BEBC.c +++ b/src/ov_SC03_102/ov_SC03_102_jr_8017BEBC.c @@ -4167,7 +4167,38 @@ INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_8017BEBC", func_8018281 INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_8017BEBC", func_80182840); -INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_8017BEBC", func_801828C4); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_801828C4(s32 a0) { + + extern u8 D_80197810[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_80197810); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -4236,9 +4267,70 @@ void func_80182AD8(s32 a0) { void func_80182BB4(void) { } -INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_8017BEBC", func_80182BBC); -INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_8017BEBC", func_80182C74); +/* func_80182BBC — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_80182BBC(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32 a0, s32 a1); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_80182C74(s32 a0) { + + extern u8 D_801978D8[]; + extern u8 D_801864AC[]; + extern u16 D_8019790C[]; + extern u16 D_8019790E[]; + extern u16 D_80197910[]; + extern s16 D_80197912[]; + if (func_8012C354(a0, (s32)D_801978D8) != 0) { + func_8012A828(a0, (s32)D_801864AC); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_8019790C[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_8019790E[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_80197910[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_80197912[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_8017BEBC", func_80182D38); @@ -4283,7 +4375,29 @@ void func_80182E08(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_8017BEBC", func_80182EEC); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_80182EEC(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); @@ -4462,11 +4576,153 @@ INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_8017BEBC", func_80185AB INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_8017BEBC", func_80185B34); -INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_8017BEBC", func_80185BE4); -INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_8017BEBC", func_80185C9C); -INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_8017BEBC", func_80185D5C); +extern s32 func_8012E778(int param_1, int param_2); +extern s32 func_8012C51C(int a0, int a1); + +void func_80185BE4(int param_1, int param_2) +{ + + extern u16 D_800AF7BC; + extern u16 D_800AF7BE; + extern u8 D_801B9AB0[]; + s32 i; + + i = 0; + if (func_8012E778(param_1, ((s32)(D_800AF7BE >> 1) << 16) | (D_800AF7BC >> 1)) != 0) { + do { + if (D_801B9AB0[i] == 0) { + D_801B9AB0[i] = 1; + *(s32 *)(param_2 + 0x10) = i | 0x80000000; + *(u16 *)(param_2 + 8) = *(u16 *)(param_1 + 0x70); + func_8012C51C(param_2, param_1); + return; + } + i++; + } while (i < 5); + } +} + + + +extern s32 func_8012C194(void); +extern void func_8001CD50(s32 a0, s32 a1); +extern void func_800233CC(void *, unsigned short); +extern void func_80186028(s32 a0); + +void func_80185C9C(void *a0) +{ + + extern u32 D_801B9970; + s32 iVar2; + u32 *puVar3; + + *(s16 *)((s32)a0 + 0xFC) = 0x7000; + *(s16 *)((s32)a0 + 0x100) = 0; + *(s16 *)((s32)a0 + 0xFE) = 0; + *(s16 *)((s32)a0 + 0x104) = 0; + *(s16 *)((s32)a0 + 0x106) = 0; + puVar3 = (u32 *)((u8 *)&D_801B9970 + (*(s16 *)((s32)a0 + 0xDC) * 0x40)); + iVar2 = func_8012C194(); + *(s32 *)((s32)a0 + 0x20) = iVar2; + if (iVar2 != 0) { + func_8001CD50(iVar2, (s32)puVar3); + *(s16 *)(iVar2 + 0x10) = 0x400; + *(u32 *)(iVar2 + 4) = *(u32 *)(iVar2 + 4) | 0x60000000; + func_800233CC(puVar3, 0x40); + puVar3[0] = 0x808080; + puVar3[1] = 0x808080; + func_80186028((s32)a0); + *(s16 *)((s32)a0 + 2) = 3; + } +} + + + +/* func_80185D5C — per-frame entity tick: decay the sound-handle envelope at + * +0x20, ramp the s16 pair at +0xFE/+0x106 up to a 0x6000 ceiling, then ramp + * the pair at +0xFC/+0x104 down; when the +0xFC accumulator goes negative the + * entity releases its D_801B9AB0 slot and hands off to func_8012C218, + * otherwise it continues in func_80185E28. + * + * §71 sibling-first: func_8018A090 (same TU, 0xC0 bytes earlier) is the + * initialiser for exactly these fields (+0xFC/+0xFE/+0x100/+0x104/+0x106, the + * +0x20 handle and the +0xDC slot index) and pins the widths/casts used here. + * D_801B9AB0[] is the 5-entry slot table func_80189FD8 (same TU) claims from. + * + * Levers (all three were needed; each is byte-verified by removal): + * 1. §3-T4 branch polarity — the 0x6000 guard is written `>= 0x6000` with the + * CLAMP as the then-arm, which is what puts `slti/bnez` + the `j` over the + * ramp arm in the target order. Writing it `< 0x6000` gives `beqz` and the + * arms swapped. + * 2. Zero-byte `__asm__ __volatile__("" : : : "memory")` at the head of the + * ramp arm (§34 toolkit). Without it cse.c relates the guard's + * `lh 0xFE` to the ramp's `lhu 0xFE` — same MEM, sign- vs zero-extend — + * and rewrites the second as `move`+`andi 0xffff`. That also lands both + * arms' final store in $v0, which lets the post-reload jump pass CROSS-JUMP + * the two `sh 0xFE` tails (§5a) and eats the `j .L8018A1C4`. The clobber + * invalidates the MEM in the hash table so the real second load survives, + * the arms end in different registers, and the cross-jump cannot fire. + * 3. The +0x104 store is SUNK to immediately after the subtract, before the + * +0xFC accumulate. Both tail quantities are otherwise born in the same + * block, and local-alloc's QTY_CMP_PRI (n_refs*log2(n_refs)/live_length) + * then ranks the accumulator ABOVE the delta, handing it $v0 and swapping + * the whole block's register pair. Storing the delta early kills its live + * range at insn 3, which flips the priority back so the delta takes $v0. + * Purely a scheduling/priority dial — the emitted order is unchanged + * because reorg pulls `sh 0x104` back into the `bgez` delay slot. + * Also note the two tail blocks are BLOCK-SCOPED: sharing one function-scope + * pair across the 0xFE and 0xFC ramps makes them global allocnos (§76), which + * costs $a1 for the deltas and an extra 8 bytes of frame (0x20 vs 0x18). + */ + +extern void func_8012C218(void *a0); +extern void func_80185E28(void *a0); + +void func_80185D5C(void *a0) +{ + + extern u8 D_801B9AB0[]; + s32 p; + s32 v; + + p = *(s32 *)((s32)a0 + 0x20); + if (p != 0) { + v = *(u16 *)(p + 0x1A) - 0x100; + *(s16 *)(p + 0x1A) = v; + *(s16 *)(p + 0x18) = v; + if (*(s16 *)(p + 0x1A) < 0) { + *(s16 *)(p + 0x1A) = 0; + *(s16 *)(p + 0x18) = 0; + } + } + if (*(s16 *)((s32)a0 + 0xFE) >= 0x6000) { + *(s16 *)((s32)a0 + 0xFE) = 0x6000; + } else { + s32 dv, sv; + __asm__ __volatile__("" : : : "memory"); + dv = *(u16 *)((s32)a0 + 0x106) + 0x400; + sv = *(u16 *)((s32)a0 + 0xFE) + dv; + *(s16 *)((s32)a0 + 0x106) = dv; + *(s16 *)((s32)a0 + 0xFE) = sv; + } + { + s32 d = *(u16 *)((s32)a0 + 0x104) - 0x80; + s16 s; + + *(s16 *)((s32)a0 + 0x104) = d; + s = *(u16 *)((s32)a0 + 0xFC) + d; + *(s16 *)((s32)a0 + 0xFC) = s; + if (s < 0) { + D_801B9AB0[*(s16 *)((s32)a0 + 0xDC)] = 0; + func_8012C218(a0); + } else { + func_80185E28(a0); + } + } +} + INCLUDE_ASM("asm/ov_SC03_102/nonmatchings/ov_SC03_102_jr_8017BEBC", func_80185E28); diff --git a/src/ov_SC03_103/ov_SC03_103_jr_80135D20.c b/src/ov_SC03_103/ov_SC03_103_jr_80135D20.c index 8aba995d86..041901b6bd 100644 --- a/src/ov_SC03_103/ov_SC03_103_jr_80135D20.c +++ b/src/ov_SC03_103/ov_SC03_103_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801846E4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801846E4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801846E4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801846E4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801846E4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_103/ov_SC03_103_jr_80154C24.c b/src/ov_SC03_103/ov_SC03_103_jr_80154C24.c index 19cd6d1c4a..07cd2127d2 100644 --- a/src/ov_SC03_103/ov_SC03_103_jr_80154C24.c +++ b/src/ov_SC03_103/ov_SC03_103_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018646C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018646C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018646C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_103/ov_SC03_103_jr_8017C294.c b/src/ov_SC03_103/ov_SC03_103_jr_8017C294.c index 8fe9061d26..881c3cfd07 100644 --- a/src/ov_SC03_103/ov_SC03_103_jr_8017C294.c +++ b/src/ov_SC03_103/ov_SC03_103_jr_8017C294.c @@ -3185,7 +3185,24 @@ INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_8017D17 INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_8017DDD8); -INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_8017DE18); + +extern int func_8017E6D0(int param_1); + +void func_8017DE18(void) +{ + + extern u8 D_8018826C[]; + extern u8 D_801884C4[]; + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern u8 *D_801274C8; + extern void *D_801274CC; + D_801274C8 = D_8018826C; + D_801274CC = D_801884C4; + func_8017E6D0(1); +} + INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_8017DE58); @@ -3465,7 +3482,38 @@ INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_8017FA8 INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_8017FAB0); -INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_8017FB34); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_8017FB34(s32 a0) { + + extern u8 D_801A0308[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_801A0308); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -3534,9 +3582,70 @@ void func_8017FD48(s32 a0) { void func_8017FE24(void) { } -INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_8017FE2C); -INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_8017FEE4); +/* func_8017FE2C — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_8017FE2C(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32 a0, s32 a1); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_8017FEE4(s32 a0) { + + extern u8 D_801A03D0[]; + extern u8 D_8018445C[]; + extern u16 D_801A0404[]; + extern u16 D_801A0406[]; + extern u16 D_801A0408[]; + extern s16 D_801A040A[]; + if (func_8012C354(a0, (s32)D_801A03D0) != 0) { + func_8012A828(a0, (s32)D_8018445C); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_801A0404[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_801A0406[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_801A0408[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_801A040A[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_8017FFA8); @@ -3582,7 +3691,29 @@ void func_80180078(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_8018015C); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_8018015C(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); @@ -3609,7 +3740,21 @@ void func_80180228(s32 a0) { } -INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_80180300); + +extern void func_80180FD4(void *a0); + +void func_80180300(void *a0) { + + extern void (*D_801A23F4[])(void); + D_801A23F4[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)((s32)a0 + 0x0) != 0) { + *(s32 *)((s32)a0 + 0xE8) = *(s32 *)((s32)a0 + 0xE8) + 1; + if ((*(s32 *)((s32)a0 + 0xE8) & 0xF) == 0) { + func_80180FD4(a0); + } + } +} + INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_8018037C); @@ -3625,11 +3770,48 @@ INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_80180AB INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_80180BC8); -INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_80180D64); + +extern s32 func_8012BEE8(s32 a0); +extern s32 func_8012E778(s32 a0, s32 a1); +extern void func_8012E88C(s32 a0); +extern void func_8012A828(s32, s32); + +void func_80180D64(void *arg0) { + + extern s32 D_801A48E4; + if (func_8012BEE8((s32)arg0)) { + if (!func_8012E778((s32)arg0, 0xA000C8)) { + { + s32 t; + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + *(s16 *)((char *)arg0 + 0x2) = (t == 0) ? 1 : 3; + } + *(s16 *)((char *)arg0 + 0x5C) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78) + 0x2); + *(s16 *)((char *)arg0 + 0x76) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78)); + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1A) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1C) = 0x1000; + *(u16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x2C) &= 0x10; + func_8012E88C((s32)arg0); + ((void (*)(s32 *, s32))func_8012A828)(arg0, &D_801A48E4); + } + } +} + INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_80180E20); -INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_80180EAC); + +extern void func_8012A828(s32, s32); + extern s32 D_801A48E4; + void func_80180EAC(void *arg0) { + *(s16 *)((char *)arg0 + 0x2) = 1; + *(s16 *)((char *)arg0 + 0x5c) = *(u16 *)(*(s32 *)((char *)arg0 + 0x78) + 0x2); + ((void (*)(s32 *, s32))func_8012A828)(arg0, &D_801A48E4); + } + extern s32 func_8012D5E4(s32 a0, s32 a1, s32 a2, s32 a3); @@ -3781,11 +3963,153 @@ INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_8018358 INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_801835F8); -INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_801836A8); -INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_80183760); -INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_80183820); +extern s32 func_8012E778(int param_1, int param_2); +extern s32 func_8012C51C(int a0, int a1); + +void func_801836A8(int param_1, int param_2) +{ + + extern u16 D_800AF7BC; + extern u16 D_800AF7BE; + extern u8 D_801C4C60[]; + s32 i; + + i = 0; + if (func_8012E778(param_1, ((s32)(D_800AF7BE >> 1) << 16) | (D_800AF7BC >> 1)) != 0) { + do { + if (D_801C4C60[i] == 0) { + D_801C4C60[i] = 1; + *(s32 *)(param_2 + 0x10) = i | 0x80000000; + *(u16 *)(param_2 + 8) = *(u16 *)(param_1 + 0x70); + func_8012C51C(param_2, param_1); + return; + } + i++; + } while (i < 5); + } +} + + + +extern s32 func_8012C194(void); +extern void func_8001CD50(s32 a0, s32 a1); +extern void func_800233CC(void *, unsigned short); +extern void func_80183AEC(s32 a0); + +void func_80183760(void *a0) +{ + + extern u32 D_801C4B20; + s32 iVar2; + u32 *puVar3; + + *(s16 *)((s32)a0 + 0xFC) = 0x7000; + *(s16 *)((s32)a0 + 0x100) = 0; + *(s16 *)((s32)a0 + 0xFE) = 0; + *(s16 *)((s32)a0 + 0x104) = 0; + *(s16 *)((s32)a0 + 0x106) = 0; + puVar3 = (u32 *)((u8 *)&D_801C4B20 + (*(s16 *)((s32)a0 + 0xDC) * 0x40)); + iVar2 = func_8012C194(); + *(s32 *)((s32)a0 + 0x20) = iVar2; + if (iVar2 != 0) { + func_8001CD50(iVar2, (s32)puVar3); + *(s16 *)(iVar2 + 0x10) = 0x400; + *(u32 *)(iVar2 + 4) = *(u32 *)(iVar2 + 4) | 0x60000000; + func_800233CC(puVar3, 0x40); + puVar3[0] = 0x808080; + puVar3[1] = 0x808080; + func_80183AEC((s32)a0); + *(s16 *)((s32)a0 + 2) = 3; + } +} + + + +/* func_80183820 — per-frame entity tick: decay the sound-handle envelope at + * +0x20, ramp the s16 pair at +0xFE/+0x106 up to a 0x6000 ceiling, then ramp + * the pair at +0xFC/+0x104 down; when the +0xFC accumulator goes negative the + * entity releases its D_801C4C60 slot and hands off to func_8012C218, + * otherwise it continues in func_801838EC. + * + * §71 sibling-first: func_8018A090 (same TU, 0xC0 bytes earlier) is the + * initialiser for exactly these fields (+0xFC/+0xFE/+0x100/+0x104/+0x106, the + * +0x20 handle and the +0xDC slot index) and pins the widths/casts used here. + * D_801C4C60[] is the 5-entry slot table func_80189FD8 (same TU) claims from. + * + * Levers (all three were needed; each is byte-verified by removal): + * 1. §3-T4 branch polarity — the 0x6000 guard is written `>= 0x6000` with the + * CLAMP as the then-arm, which is what puts `slti/bnez` + the `j` over the + * ramp arm in the target order. Writing it `< 0x6000` gives `beqz` and the + * arms swapped. + * 2. Zero-byte `__asm__ __volatile__("" : : : "memory")` at the head of the + * ramp arm (§34 toolkit). Without it cse.c relates the guard's + * `lh 0xFE` to the ramp's `lhu 0xFE` — same MEM, sign- vs zero-extend — + * and rewrites the second as `move`+`andi 0xffff`. That also lands both + * arms' final store in $v0, which lets the post-reload jump pass CROSS-JUMP + * the two `sh 0xFE` tails (§5a) and eats the `j .L8018A1C4`. The clobber + * invalidates the MEM in the hash table so the real second load survives, + * the arms end in different registers, and the cross-jump cannot fire. + * 3. The +0x104 store is SUNK to immediately after the subtract, before the + * +0xFC accumulate. Both tail quantities are otherwise born in the same + * block, and local-alloc's QTY_CMP_PRI (n_refs*log2(n_refs)/live_length) + * then ranks the accumulator ABOVE the delta, handing it $v0 and swapping + * the whole block's register pair. Storing the delta early kills its live + * range at insn 3, which flips the priority back so the delta takes $v0. + * Purely a scheduling/priority dial — the emitted order is unchanged + * because reorg pulls `sh 0x104` back into the `bgez` delay slot. + * Also note the two tail blocks are BLOCK-SCOPED: sharing one function-scope + * pair across the 0xFE and 0xFC ramps makes them global allocnos (§76), which + * costs $a1 for the deltas and an extra 8 bytes of frame (0x20 vs 0x18). + */ + +extern void func_8012C218(void *a0); +extern void func_801838EC(void *a0); + +void func_80183820(void *a0) +{ + + extern u8 D_801C4C60[]; + s32 p; + s32 v; + + p = *(s32 *)((s32)a0 + 0x20); + if (p != 0) { + v = *(u16 *)(p + 0x1A) - 0x100; + *(s16 *)(p + 0x1A) = v; + *(s16 *)(p + 0x18) = v; + if (*(s16 *)(p + 0x1A) < 0) { + *(s16 *)(p + 0x1A) = 0; + *(s16 *)(p + 0x18) = 0; + } + } + if (*(s16 *)((s32)a0 + 0xFE) >= 0x6000) { + *(s16 *)((s32)a0 + 0xFE) = 0x6000; + } else { + s32 dv, sv; + __asm__ __volatile__("" : : : "memory"); + dv = *(u16 *)((s32)a0 + 0x106) + 0x400; + sv = *(u16 *)((s32)a0 + 0xFE) + dv; + *(s16 *)((s32)a0 + 0x106) = dv; + *(s16 *)((s32)a0 + 0xFE) = sv; + } + { + s32 d = *(u16 *)((s32)a0 + 0x104) - 0x80; + s16 s; + + *(s16 *)((s32)a0 + 0x104) = d; + s = *(u16 *)((s32)a0 + 0xFC) + d; + *(s16 *)((s32)a0 + 0xFC) = s; + if (s < 0) { + D_801C4C60[*(s16 *)((s32)a0 + 0xDC)] = 0; + func_8012C218(a0); + } else { + func_801838EC(a0); + } + } +} + INCLUDE_ASM("asm/ov_SC03_103/nonmatchings/ov_SC03_103_jr_8017C294", func_801838EC); diff --git a/src/ov_SC03_104/ov_SC03_104_jr_80135D20.c b/src/ov_SC03_104/ov_SC03_104_jr_80135D20.c index 8a98b660b4..9570ac92da 100644 --- a/src/ov_SC03_104/ov_SC03_104_jr_80135D20.c +++ b/src/ov_SC03_104/ov_SC03_104_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_104/nonmatchings/ov_SC03_104_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018B274[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018B274[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018B274[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018B274[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018B274[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_104/ov_SC03_104_jr_80154C24.c b/src/ov_SC03_104/ov_SC03_104_jr_80154C24.c index f1af5f480e..6cb5a13c7a 100644 --- a/src/ov_SC03_104/ov_SC03_104_jr_80154C24.c +++ b/src/ov_SC03_104/ov_SC03_104_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_104/nonmatchings/ov_SC03_104_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018CFFC)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018CFFC[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018CFFC[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_104/ov_SC03_104_jr_8017CA80.c b/src/ov_SC03_104/ov_SC03_104_jr_8017CA80.c index ab4e9d6af5..29c23fe72b 100644 --- a/src/ov_SC03_104/ov_SC03_104_jr_8017CA80.c +++ b/src/ov_SC03_104/ov_SC03_104_jr_8017CA80.c @@ -4131,7 +4131,21 @@ INCLUDE_ASM("asm/ov_SC03_104/nonmatchings/ov_SC03_104_jr_8017CA80", func_80181B1 void func_80181B58(void) { } -INCLUDE_ASM("asm/ov_SC03_104/nonmatchings/ov_SC03_104_jr_8017CA80", func_80181B60); + +extern void func_8018282C(void *a0); + +void func_80181B60(void *a0) { + + extern void (*D_80199E4C[])(void); + D_80199E4C[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)((s32)a0 + 0x0) != 0) { + *(s32 *)((s32)a0 + 0xE4) = *(s32 *)((s32)a0 + 0xE4) + 1; + if ((*(s32 *)((s32)a0 + 0xE4) & 0xF) == 0) { + func_8018282C(a0); + } + } +} + INCLUDE_ASM("asm/ov_SC03_104/nonmatchings/ov_SC03_104_jr_8017CA80", func_80181BDC); @@ -4535,7 +4549,38 @@ INCLUDE_ASM("asm/ov_SC03_104/nonmatchings/ov_SC03_104_jr_8017CA80", func_8018722 INCLUDE_ASM("asm/ov_SC03_104/nonmatchings/ov_SC03_104_jr_8017CA80", func_80187254); -INCLUDE_ASM("asm/ov_SC03_104/nonmatchings/ov_SC03_104_jr_8017CA80", func_801872D8); + +extern s32 func_8012BCCC(s32 a0); +extern s32 func_8012B864(s32 a0); +extern s32 func_8012B608(s32 a0, s32 a1, s32 a2); +extern void func_8012B1B4(s32 a0, s32 a1); +extern void func_8012CBCC(s32 a0); +extern void func_8012E688(void*, s32, s32); + +void func_801872D8(s32 a0) { + + extern u8 D_8019D550[]; + extern s16 D_80126CB6; + s32 r; + + if (func_8012BCCC(a0) > 0x63FFF) { + *(u16 *)(a0 + 0x2) = 5; + } else { + r = func_8012B608(*(s16 *)(*(s32 *)(a0 + 0x20) + 0x12), + func_8012B864(a0), 0x10); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) + r; + func_8012B1B4(a0, (s32)D_8019D550); + *(s32 *)(a0 + 0x14) = + *(s32 *)(a0 + 0x14) + + ((D_80126CB6 - *(s16 *)(a0 + 0xA)) << 8); + if (((s32 (*)(s32))func_8012CBCC)(a0)) { + *(s16 *)(a0 + 0x16) = -0x18; + ((void (*)(s32, s32, s32))func_8012E688)(a0, 0xBA2, 0); + } + } +} + extern void func_8012E688(void *a0, s32 a1, s32 a2); @@ -4604,9 +4649,70 @@ void func_801874EC(s32 a0) { void func_801875C8(void) { } -INCLUDE_ASM("asm/ov_SC03_104/nonmatchings/ov_SC03_104_jr_8017CA80", func_801875D0); -INCLUDE_ASM("asm/ov_SC03_104/nonmatchings/ov_SC03_104_jr_8017CA80", func_80187688); +/* func_801875D0 — per-frame entity tick: + * - decrement the timer at 0x1C if non-zero + * - fade the two u16 colour/alpha words at +0x18 / +0x1A of the display record + * hanging off 0x20 by 0x100 each + * - once the second one drops to <= 0x80, tear the entity down + * + * §71 sibling-first: DEFINE_func_801319E0() (engine_core.h L17451) is the same + * `func_8002A04C(arg0); func_8012C218((void *)arg0);` teardown tail with arg0 + * living in $s0 across the calls — signature and casts copied from it. + */ + +extern void func_8002A04C(s32 a0); +extern void func_8012C218(void *a0); + +void func_801875D0(s32 arg0) { + if (*(s32 *)(arg0 + 0x1C) != 0) { + *(s32 *)(arg0 + 0x1C) -= 1; + } + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x18) -= 0x100; + *(u16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) -= 0x100; + if (*(s16 *)(*(s32 *)(arg0 + 0x20) + 0x1A) < 0x81) { + if (*(s16 *)(arg0 + 0x70) == 1) { + /* LOAD-BEARING: hoisting the argument load into its own local + * emits `lw $a0,0xCC($s0)` ABOVE the guard branch and leaves the + * beqz delay slot a nop. Inlining it at the call site instead + * gives beqz/nop/lw -> 3 mismatches (class DELAY-SLOT). A/B-tested. */ + void *temp = *(void **)(arg0 + 0xCC); + if (arg0 != 0) { + func_8012C218(temp); + } + } + func_8002A04C(arg0); + func_8012C218((void *)arg0); + } +} + + + +extern s32 func_8012C354(s32 a0, s32 a1); +extern void func_8012A828(s32, void*); +extern s32 func_8012C588(s32 a0, s32 a1); + + +void func_80187688(s32 a0) { + + extern u8 D_8019D618[]; + extern u8 D_8018AFEC[]; + extern u16 D_8019D64C[]; + extern u16 D_8019D64E[]; + extern u16 D_8019D650[]; + extern s16 D_8019D652[]; + if (func_8012C354(a0, (s32)D_8019D618) != 0) { + ((void (*)(s32, s32))func_8012A828)(a0, (s32)D_8018AFEC); + *(s16 *)(a0 + 0x2) = 1; + *(u8 *)(a0 + 0x75) = 0; + *(u16 *)(a0 + 0x12) = D_8019D64C[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x16) = D_8019D64E[*(s16 *)(a0 + 0xFC) * 4]; + *(u16 *)(a0 + 0x1A) = D_8019D650[*(s16 *)(a0 + 0xFC) * 4]; + *(s32 *)(a0 + 0x1C) = D_8019D652[*(s16 *)(a0 + 0xFC) * 4]; + func_8012C588(0x1C4, a0); + } +} + INCLUDE_ASM("asm/ov_SC03_104/nonmatchings/ov_SC03_104_jr_8017CA80", func_8018774C); @@ -4651,7 +4757,29 @@ void func_8018781C(s32 param_1) } -INCLUDE_ASM("asm/ov_SC03_104/nonmatchings/ov_SC03_104_jr_8017CA80", func_80187900); + +extern s32 rand(void); +extern s32 func_8004787C(s32 a0); + +void func_80187900(s32 a0) { + s32 t; + + if (*(s32 *)(a0 + 0x1C) == 0) { + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) &= 0x7FFFFFFF; + *(s16 *)(a0 + 0xFE) += 0x40; + if (*(s16 *)(a0 + 0xFE) >= 0x800) { + *(s16 *)(a0 + 0xFE) = 0; + *(s32 *)(a0 + 0x1C) = rand() & 0x1F; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x4) |= 0x80000000; + } + t = (*(s16 *)(a0 + 0x70) * func_8004787C(*(s16 *)(a0 + 0xFE))) >> 12; + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)(a0 + 0x20) + 0x1A) = t + 0x800; + } else { + *(s32 *)(a0 + 0x1C) -= 1; + } +} + extern s32 rand(void); diff --git a/src/ov_SC03_105/ov_SC03_105_jr_80135D20.c b/src/ov_SC03_105/ov_SC03_105_jr_80135D20.c index f197402b5b..72a7d42434 100644 --- a/src/ov_SC03_105/ov_SC03_105_jr_80135D20.c +++ b/src/ov_SC03_105/ov_SC03_105_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018A8FC[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018A8FC[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018A8FC[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018A8FC[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018A8FC[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_105/ov_SC03_105_jr_80154C24.c b/src/ov_SC03_105/ov_SC03_105_jr_80154C24.c index 9a7d7512fa..7faf066d3b 100644 --- a/src/ov_SC03_105/ov_SC03_105_jr_80154C24.c +++ b/src/ov_SC03_105/ov_SC03_105_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018C684)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018C684[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018C684[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_105/ov_SC03_105_jr_8017C8D0.c b/src/ov_SC03_105/ov_SC03_105_jr_8017C8D0.c index 3e1c269329..a51dc00f18 100644 --- a/src/ov_SC03_105/ov_SC03_105_jr_8017C8D0.c +++ b/src/ov_SC03_105/ov_SC03_105_jr_8017C8D0.c @@ -52,7 +52,6 @@ extern s32 func_80165A50(s32); extern void func_80029514(s32); extern u8 D_800AF630[]; extern u8 D_80078EC0; -extern s32 D_80126B58; extern s32 func_80028FBC(void); extern s32 func_80029000(void); extern s32 func_80028D9C(void); @@ -3656,7 +3655,17 @@ INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_8018676 INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_801867D0); -INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_80186AE8); + +extern s32 func_80178B18(s32, s32); + +void func_80186AE8(void *arg0) { + + extern M2C_UNK D_8018EFBC; + ((void (*)(void *, void *))func_80178B18)(arg0, &D_8018EFBC); + *(s16 *)((s32)arg0 + 0x2) = 0x7; + *(s16 *)((s32)arg0 + 0x34) = 0; +} + INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_80186B24); @@ -3750,7 +3759,48 @@ INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_8018807 INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_80188114); -INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_8018842C); + +// @stuck: none — MATCH (42 ins), iteration 1, rtu_match clean. +// Saturating add of a 3-byte RGB triple by a signed delta. +// Idioms: (1) `s8` by-value param => entry `sll/sra 24` for the sign test only; +// combine folds the extension back out of `~a1`/`-a1`/`a0[i]+a1` because every +// consumer is 8-bit (andi 0xFF / sb), so $a1 is used RAW after the test. +// (2) branch sense read off the target `sltu` operand ORDER (§3-T4): positive arm +// `sltu lim,p[i]` => store when `p[i] <= lim`; negative arm `sltu p[i],lim` +// => store when `p[i] >= lim`. +// (3) the third `if` written out in BOTH arms; jump.c cross-jumps the identical +// tails into the shared `j .L8018C344` (§5a) — do not hoist it after the if/else. +void func_8018842C(u8 *a0, s8 a1) { + u8 lim; + + if (a1 == 0) { + return; + } + if (a1 > 0) { + lim = ~a1; + if (a0[0] <= lim) { + a0[0] = a0[0] + a1; + } + if (a0[1] <= lim) { + a0[1] = a0[1] + a1; + } + if (a0[2] <= lim) { + a0[2] = a0[2] + a1; + } + } else { + lim = -a1; + if (a0[0] >= lim) { + a0[0] = a0[0] + a1; + } + if (a0[1] >= lim) { + a0[1] = a0[1] + a1; + } + if (a0[2] >= lim) { + a0[2] = a0[2] + a1; + } + } +} + extern void (*D_8018F1A4[])(void); @@ -3957,7 +4007,20 @@ INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_8018969 INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_801896EC); -INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_80189718); + +extern s32 func_8014C050(s32 a0, s32 a1); + +void func_80189718(void) { + + extern s32 D_80126B58; + s32 t; + + t = func_8014C050((s32)&D_80126B58, 0x28); + if (t != 0) { + *(u16 *)(t + 2) += 1; + } +} + extern void (*D_801B68D0[])(void); @@ -3992,11 +4055,153 @@ INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_80189C8 INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_80189CFC); -INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_80189DAC); -INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_80189E64); -INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_80189F24); +extern s32 func_8012E778(int param_1, int param_2); +extern s32 func_8012C51C(int a0, int a1); + +void func_80189DAC(int param_1, int param_2) +{ + + extern u16 D_800AF7BC; + extern u16 D_800AF7BE; + extern u8 D_801BCBA0[]; + s32 i; + + i = 0; + if (func_8012E778(param_1, ((s32)(D_800AF7BE >> 1) << 16) | (D_800AF7BC >> 1)) != 0) { + do { + if (D_801BCBA0[i] == 0) { + D_801BCBA0[i] = 1; + *(s32 *)(param_2 + 0x10) = i | 0x80000000; + *(u16 *)(param_2 + 8) = *(u16 *)(param_1 + 0x70); + func_8012C51C(param_2, param_1); + return; + } + i++; + } while (i < 5); + } +} + + + +extern s32 func_8012C194(void); +extern void func_8001CD50(s32 a0, s32 a1); +extern void func_800233CC(void *, unsigned short); +extern void func_8018A1F0(s32 a0); + +void func_80189E64(void *a0) +{ + + extern u32 D_801BCA60; + s32 iVar2; + u32 *puVar3; + + *(s16 *)((s32)a0 + 0xFC) = 0x7000; + *(s16 *)((s32)a0 + 0x100) = 0; + *(s16 *)((s32)a0 + 0xFE) = 0; + *(s16 *)((s32)a0 + 0x104) = 0; + *(s16 *)((s32)a0 + 0x106) = 0; + puVar3 = (u32 *)((u8 *)&D_801BCA60 + (*(s16 *)((s32)a0 + 0xDC) * 0x40)); + iVar2 = func_8012C194(); + *(s32 *)((s32)a0 + 0x20) = iVar2; + if (iVar2 != 0) { + func_8001CD50(iVar2, (s32)puVar3); + *(s16 *)(iVar2 + 0x10) = 0x400; + *(u32 *)(iVar2 + 4) = *(u32 *)(iVar2 + 4) | 0x60000000; + func_800233CC(puVar3, 0x40); + puVar3[0] = 0x808080; + puVar3[1] = 0x808080; + func_8018A1F0((s32)a0); + *(s16 *)((s32)a0 + 2) = 3; + } +} + + + +/* func_80189F24 — per-frame entity tick: decay the sound-handle envelope at + * +0x20, ramp the s16 pair at +0xFE/+0x106 up to a 0x6000 ceiling, then ramp + * the pair at +0xFC/+0x104 down; when the +0xFC accumulator goes negative the + * entity releases its D_801BCBA0 slot and hands off to func_8012C218, + * otherwise it continues in func_80189FF0. + * + * §71 sibling-first: func_8018A090 (same TU, 0xC0 bytes earlier) is the + * initialiser for exactly these fields (+0xFC/+0xFE/+0x100/+0x104/+0x106, the + * +0x20 handle and the +0xDC slot index) and pins the widths/casts used here. + * D_801BCBA0[] is the 5-entry slot table func_80189FD8 (same TU) claims from. + * + * Levers (all three were needed; each is byte-verified by removal): + * 1. §3-T4 branch polarity — the 0x6000 guard is written `>= 0x6000` with the + * CLAMP as the then-arm, which is what puts `slti/bnez` + the `j` over the + * ramp arm in the target order. Writing it `< 0x6000` gives `beqz` and the + * arms swapped. + * 2. Zero-byte `__asm__ __volatile__("" : : : "memory")` at the head of the + * ramp arm (§34 toolkit). Without it cse.c relates the guard's + * `lh 0xFE` to the ramp's `lhu 0xFE` — same MEM, sign- vs zero-extend — + * and rewrites the second as `move`+`andi 0xffff`. That also lands both + * arms' final store in $v0, which lets the post-reload jump pass CROSS-JUMP + * the two `sh 0xFE` tails (§5a) and eats the `j .L8018A1C4`. The clobber + * invalidates the MEM in the hash table so the real second load survives, + * the arms end in different registers, and the cross-jump cannot fire. + * 3. The +0x104 store is SUNK to immediately after the subtract, before the + * +0xFC accumulate. Both tail quantities are otherwise born in the same + * block, and local-alloc's QTY_CMP_PRI (n_refs*log2(n_refs)/live_length) + * then ranks the accumulator ABOVE the delta, handing it $v0 and swapping + * the whole block's register pair. Storing the delta early kills its live + * range at insn 3, which flips the priority back so the delta takes $v0. + * Purely a scheduling/priority dial — the emitted order is unchanged + * because reorg pulls `sh 0x104` back into the `bgez` delay slot. + * Also note the two tail blocks are BLOCK-SCOPED: sharing one function-scope + * pair across the 0xFE and 0xFC ramps makes them global allocnos (§76), which + * costs $a1 for the deltas and an extra 8 bytes of frame (0x20 vs 0x18). + */ + +extern void func_8012C218(void *a0); +extern void func_80189FF0(void *a0); + +void func_80189F24(void *a0) +{ + + extern u8 D_801BCBA0[]; + s32 p; + s32 v; + + p = *(s32 *)((s32)a0 + 0x20); + if (p != 0) { + v = *(u16 *)(p + 0x1A) - 0x100; + *(s16 *)(p + 0x1A) = v; + *(s16 *)(p + 0x18) = v; + if (*(s16 *)(p + 0x1A) < 0) { + *(s16 *)(p + 0x1A) = 0; + *(s16 *)(p + 0x18) = 0; + } + } + if (*(s16 *)((s32)a0 + 0xFE) >= 0x6000) { + *(s16 *)((s32)a0 + 0xFE) = 0x6000; + } else { + s32 dv, sv; + __asm__ __volatile__("" : : : "memory"); + dv = *(u16 *)((s32)a0 + 0x106) + 0x400; + sv = *(u16 *)((s32)a0 + 0xFE) + dv; + *(s16 *)((s32)a0 + 0x106) = dv; + *(s16 *)((s32)a0 + 0xFE) = sv; + } + { + s32 d = *(u16 *)((s32)a0 + 0x104) - 0x80; + s16 s; + + *(s16 *)((s32)a0 + 0x104) = d; + s = *(u16 *)((s32)a0 + 0xFC) + d; + *(s16 *)((s32)a0 + 0xFC) = s; + if (s < 0) { + D_801BCBA0[*(s16 *)((s32)a0 + 0xDC)] = 0; + func_8012C218(a0); + } else { + func_80189FF0(a0); + } + } +} + INCLUDE_ASM("asm/ov_SC03_105/nonmatchings/ov_SC03_105_jr_8017C8D0", func_80189FF0); diff --git a/src/ov_SC03_108/ov_SC03_108_jr_80135D20.c b/src/ov_SC03_108/ov_SC03_108_jr_80135D20.c index c250894f44..687cee61bb 100644 --- a/src/ov_SC03_108/ov_SC03_108_jr_80135D20.c +++ b/src/ov_SC03_108/ov_SC03_108_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_108/nonmatchings/ov_SC03_108_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80181254[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80181254[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80181254[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80181254[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80181254[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_108/ov_SC03_108_jr_80154C24.c b/src/ov_SC03_108/ov_SC03_108_jr_80154C24.c index 5925a0e70f..11b96e49d8 100644 --- a/src/ov_SC03_108/ov_SC03_108_jr_80154C24.c +++ b/src/ov_SC03_108/ov_SC03_108_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_108/nonmatchings/ov_SC03_108_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80182FDC)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80182FDC[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80182FDC[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_109/ov_SC03_109_jr_80135D20.c b/src/ov_SC03_109/ov_SC03_109_jr_80135D20.c index ec4a57c01f..07f808c12d 100644 --- a/src/ov_SC03_109/ov_SC03_109_jr_80135D20.c +++ b/src/ov_SC03_109/ov_SC03_109_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_109/nonmatchings/ov_SC03_109_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017E900[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017E900[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017E900[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017E900[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017E900[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_109/ov_SC03_109_jr_80154C24.c b/src/ov_SC03_109/ov_SC03_109_jr_80154C24.c index 9e983b31a8..2cb9826e3a 100644 --- a/src/ov_SC03_109/ov_SC03_109_jr_80154C24.c +++ b/src/ov_SC03_109/ov_SC03_109_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_109/nonmatchings/ov_SC03_109_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80180688)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80180688[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80180688[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_110/ov_SC03_110_jr_80135D20.c b/src/ov_SC03_110/ov_SC03_110_jr_80135D20.c index e63d4b3dfd..1a51342590 100644 --- a/src/ov_SC03_110/ov_SC03_110_jr_80135D20.c +++ b/src/ov_SC03_110/ov_SC03_110_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80182320[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80182320[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80182320[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80182320[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80182320[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_110/ov_SC03_110_jr_80154C24.c b/src/ov_SC03_110/ov_SC03_110_jr_80154C24.c index 287f300205..4f1d216d7a 100644 --- a/src/ov_SC03_110/ov_SC03_110_jr_80154C24.c +++ b/src/ov_SC03_110/ov_SC03_110_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801840A8)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801840A8[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801840A8[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_110/ov_SC03_110_jr_8017AE2C.c b/src/ov_SC03_110/ov_SC03_110_jr_8017AE2C.c index d9153ce538..e7eed316f3 100644 --- a/src/ov_SC03_110/ov_SC03_110_jr_8017AE2C.c +++ b/src/ov_SC03_110/ov_SC03_110_jr_8017AE2C.c @@ -3370,7 +3370,15 @@ void func_8017CD10(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017AE2C", func_8017CD4C); +extern void func_80147324(s32 arg0); +void func_8017CD4C(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3399,7 +3407,20 @@ INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017AE2C", func_8017CDF INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017AE2C", func_8017CE7C); -INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017AE2C", func_8017CFE4); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017CFE4(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D030(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017AE2C", func_8017D030); @@ -3411,7 +3432,13 @@ void func_8017D33C(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017AE2C", func_8017D378); +extern void func_80147324(s32 arg0); +void func_8017D378(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D3B8 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3513,7 +3540,25 @@ void func_8017D4B4(void *a0) } -INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017AE2C", func_8017D588); +extern void func_8017D030(int); +extern void func_80146C3C(void); +void func_8017D588(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D030)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_801858E8[])(void); @@ -3525,7 +3570,22 @@ void func_8017D5DC(void *a0) { INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017AE2C", func_8017D618); -INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017AE2C", func_8017D6CC); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017D728(void *a0); +void func_8017D6CC(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017D728(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017AE2C", func_8017D728); diff --git a/src/ov_SC03_110/ov_SC03_110_jr_8017D898.c b/src/ov_SC03_110/ov_SC03_110_jr_8017D898.c index 65c0fa8c18..ecb2dcb82d 100644 --- a/src/ov_SC03_110/ov_SC03_110_jr_8017D898.c +++ b/src/ov_SC03_110/ov_SC03_110_jr_8017D898.c @@ -3423,9 +3423,54 @@ INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017D898", func_80180E1 INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017D898", func_80180F08); -INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017D898", func_80180FE0); -INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017D898", func_8018105C); +extern void func_80181CB4(void *a0); + +void func_80180FE0(void *a0) { + + extern void (*D_8019C7D0[])(void); + D_8019C7D0[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)((s32)a0 + 0x0) != 0) { + *(s32 *)((s32)a0 + 0xE8) = *(s32 *)((s32)a0 + 0xE8) + 1; + if ((*(s32 *)((s32)a0 + 0xE8) & 0xF) == 0) { + func_80181CB4(a0); + } + } +} + + + +extern s32 rand(void); +extern s32 func_8012C354(s32 *a0, s32 a1); +extern void func_8012A828(s32 *a0, s32 a1); +extern void func_80143994(s32 *a0, s32 a1); + + +void func_8018105C(void *arg0) { + + extern s32 D_8019C764; + extern s32 D_8019C7A8; + extern s32 D_8019ECC0; + s32 t; + + if (func_8012C354(arg0, &D_8019C764)) { + *(u8 *)((char *)arg0 + 0xC0) = 1; + *(s32 *)((char *)arg0 + 0xB4) = -1; + *(s32 **)((char *)arg0 + 0xBC) = &D_8019C7A8; + *(u32 *)((char *)arg0 + 0xC4) |= 1; + *(s32 *)((char *)arg0 + 0xE4) = -((rand() % 8 + 0xC) << 16); + func_8012A828(arg0, &D_8019ECC0); + func_80143994(arg0, 0x1000); + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + if (t != 0) { + t = 3; + } else { + t = 1; + } + *(s16 *)((char *)arg0 + 0x2) = t; + } +} + INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017D898", func_8018111C); @@ -3439,11 +3484,48 @@ INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017D898", func_8018179 INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017D898", func_801818A8); -INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017D898", func_80181A44); + +extern s32 func_8012BEE8(s32 a0); +extern s32 func_8012E778(s32 a0, s32 a1); +extern void func_8012E88C(s32 a0); +extern void func_8012A828(s32 *a0, s32 a1); + +void func_80181A44(void *arg0) { + + extern s32 D_8019ECC0; + if (func_8012BEE8((s32)arg0)) { + if (!func_8012E778((s32)arg0, 0xA000C8)) { + { + s32 t; + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + *(s16 *)((char *)arg0 + 0x2) = (t == 0) ? 1 : 3; + } + *(s16 *)((char *)arg0 + 0x5C) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78) + 0x2); + *(s16 *)((char *)arg0 + 0x76) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78)); + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1A) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1C) = 0x1000; + *(u16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x2C) &= 0x10; + func_8012E88C((s32)arg0); + func_8012A828(arg0, &D_8019ECC0); + } + } +} + INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017D898", func_80181B00); -INCLUDE_ASM("asm/ov_SC03_110/nonmatchings/ov_SC03_110_jr_8017D898", func_80181B8C); + +extern void func_8012A828(s32 *a0, s32 a1); + extern s32 D_8019ECC0; + void func_80181B8C(void *arg0) { + *(s16 *)((char *)arg0 + 0x2) = 1; + *(s16 *)((char *)arg0 + 0x5c) = *(u16 *)(*(s32 *)((char *)arg0 + 0x78) + 0x2); + func_8012A828(arg0, &D_8019ECC0); + } + extern s32 func_8012D5E4(s32 a0, s32 a1, s32 a2, s32 a3); diff --git a/src/ov_SC03_111/ov_SC03_111_jr_80135D20.c b/src/ov_SC03_111/ov_SC03_111_jr_80135D20.c index 2e6af1291a..71bdd2b582 100644 --- a/src/ov_SC03_111/ov_SC03_111_jr_80135D20.c +++ b/src/ov_SC03_111/ov_SC03_111_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_111/nonmatchings/ov_SC03_111_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80184ED4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80184ED4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80184ED4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80184ED4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80184ED4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_111/ov_SC03_111_jr_80154C24.c b/src/ov_SC03_111/ov_SC03_111_jr_80154C24.c index 40555c64ff..ae08b60b6e 100644 --- a/src/ov_SC03_111/ov_SC03_111_jr_80154C24.c +++ b/src/ov_SC03_111/ov_SC03_111_jr_80154C24.c @@ -1659,7 +1659,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_111/nonmatchings/ov_SC03_111_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80186C5C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80186C5C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80186C5C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_111/ov_SC03_111_jr_8017AE2C.c b/src/ov_SC03_111/ov_SC03_111_jr_8017AE2C.c index 540e1331af..3841cdfee6 100644 --- a/src/ov_SC03_111/ov_SC03_111_jr_8017AE2C.c +++ b/src/ov_SC03_111/ov_SC03_111_jr_8017AE2C.c @@ -3557,7 +3557,15 @@ void func_8017E0D0(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_111/nonmatchings/ov_SC03_111_jr_8017AE2C", func_8017E10C); +extern void func_80147324(s32 arg0); +void func_8017E10C(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3586,7 +3594,20 @@ INCLUDE_ASM("asm/ov_SC03_111/nonmatchings/ov_SC03_111_jr_8017AE2C", func_8017E1B INCLUDE_ASM("asm/ov_SC03_111/nonmatchings/ov_SC03_111_jr_8017AE2C", func_8017E23C); -INCLUDE_ASM("asm/ov_SC03_111/nonmatchings/ov_SC03_111_jr_8017AE2C", func_8017E3A4); +extern void func_8017E3F0(int); +extern void func_80146C3C(void); +void func_8017E3A4(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017E3F0(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC03_111/nonmatchings/ov_SC03_111_jr_8017AE2C", func_8017E3F0); @@ -3598,7 +3619,13 @@ void func_8017E6FC(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_111/nonmatchings/ov_SC03_111_jr_8017AE2C", func_8017E738); +extern void func_80147324(s32 arg0); +void func_8017E738(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017E778 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3700,7 +3727,25 @@ void func_8017E874(void *a0) } -INCLUDE_ASM("asm/ov_SC03_111/nonmatchings/ov_SC03_111_jr_8017AE2C", func_8017E948); +extern void func_8017E3F0(int); +extern void func_80146C3C(void); +void func_8017E948(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017E3F0)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_801887BC[])(void); @@ -3712,7 +3757,22 @@ void func_8017E99C(void *a0) { INCLUDE_ASM("asm/ov_SC03_111/nonmatchings/ov_SC03_111_jr_8017AE2C", func_8017E9D8); -INCLUDE_ASM("asm/ov_SC03_111/nonmatchings/ov_SC03_111_jr_8017AE2C", func_8017EA8C); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017EAE8(void *a0); +void func_8017EA8C(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017EAE8(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC03_111/nonmatchings/ov_SC03_111_jr_8017AE2C", func_8017EAE8); diff --git a/src/ov_SC03_111/ov_SC03_111_jr_8017EC58.c b/src/ov_SC03_111/ov_SC03_111_jr_8017EC58.c index d4799d5cdc..225a03d1a4 100644 --- a/src/ov_SC03_111/ov_SC03_111_jr_8017EC58.c +++ b/src/ov_SC03_111/ov_SC03_111_jr_8017EC58.c @@ -3498,7 +3498,15 @@ extern void func_8012E688(s32 arg0, s32 arg1, s32 arg2); } -INCLUDE_ASM("asm/ov_SC03_111/nonmatchings/ov_SC03_111_jr_8017EC58", func_801835F0); + + +extern void func_8012E688(s32 arg0, s32 arg1, s32 arg2); + extern void func_8002AC00(s32 arg0); + void func_801835F0(void *arg0) { + func_8012E688((s32)arg0, 0x8C7, 0); + func_8002AC00(0x10); + } + void func_8018361C(void) { } diff --git a/src/ov_SC03_112/ov_SC03_112_jr_80135D20.c b/src/ov_SC03_112/ov_SC03_112_jr_80135D20.c index 8f3337c311..b88b42322a 100644 --- a/src/ov_SC03_112/ov_SC03_112_jr_80135D20.c +++ b/src/ov_SC03_112/ov_SC03_112_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80185CDC[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80185CDC[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80185CDC[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80185CDC[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80185CDC[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_112/ov_SC03_112_jr_80154C24.c b/src/ov_SC03_112/ov_SC03_112_jr_80154C24.c index e2f757ef0f..ea6afb847d 100644 --- a/src/ov_SC03_112/ov_SC03_112_jr_80154C24.c +++ b/src/ov_SC03_112/ov_SC03_112_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80187A64)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80187A64[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80187A64[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_112/ov_SC03_112_jr_8017C294.c b/src/ov_SC03_112/ov_SC03_112_jr_8017C294.c index 77d6323f8f..937861ef8e 100644 --- a/src/ov_SC03_112/ov_SC03_112_jr_8017C294.c +++ b/src/ov_SC03_112/ov_SC03_112_jr_8017C294.c @@ -384,7 +384,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3481,7 +3480,58 @@ extern void func_8012A828(s32 *a0, s32 a1); } -INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_8017FB7C); + +extern s32 func_8012BCCC(s32 a0); +extern void func_8001C924(s32 a0, void *a1); +extern void func_8012A828(s32*, s32); +extern s32 func_8012B8E4(s32 a0, s32 a1); +extern s32 func_8012BEE8(s32 a0); + +// @class: straight-derive +// @stuck: none — MATCH (52 ins) on iteration 1, confirmed by rtu_match. +// +// Two things that could have been mis-read off the target asm: +// +// 1. RELOAD_CSE DELETES A REDUNDANT ARG MOVE — do not read "no arg setup" as +// "zero-arg call". `jal func_8012BCCC` at 0x80184C7C has a bare `nop` delay +// slot and NO `addu $a0,$s0,$zero` before it, which looks like `f()`. It is +// `f(a0)`: the incoming param is still live in $a0 in that fall-through +// block, so gcc-2.7.2's reload_cse_regs (reload1.c) deletes the redundant +// `move $a0,$s0`. The SAME move survives at .L80184CD0 (0x80184CD0) because +// reload_cse's value tracking resets at a CODE_LABEL. So: an arg move that +// is present on the labelled arm and absent on the fall-through arm is ONE +// source-level call shape, not two. +// +// 2. `lui $v1,1 / slt $v1,$v1,$v0` is `ret <= 0x10000`, not `ret < 0x10001`. +// gcc lowers `a <= C` to `!(C < a)` and puts the CONSTANT in the first slt +// operand; writing `< 0x10001` would have materialised 0x10001 instead. +// +// Statement order in the then-arm is the Ghidra order (0x1C store, then the +// 0x34 increment): memrefs_conflict_p disambiguates `+0x1C`/4 from `+0x34`/2 +// off the same base, so sched2 legally hoists the `lhu 0x34` above the `sw` +// to cover its load delay — which is exactly the target's interleave. +void func_8017FB7C(s32 a0) { + + extern u8 D_801A4B68; + extern u8 D_801A7C94[]; + s32 v; + + if (*(u16 *)(a0 + 0x34) == 0) { + if (func_8012BCCC(a0) <= 0x10000) { + func_8001C924(*(s32 *)(a0 + 0x20), (void *)&D_801A4B68); + ((void (*)(s32, void *))func_8012A828)(a0, (void *)&(*(u8 *)D_801A7C94)); + *(s32 *)(a0 + 0x1C) = 0x1E; + *(u16 *)(a0 + 0x34) += 1; + } + } else { + v = func_8012B8E4(a0, 0xA); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) += v; + if (func_8012BEE8(a0) != 0 || v == 0) { + *(s16 *)(a0 + 0x2) = 5; + } + } +} + INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_8017FC4C); @@ -3505,7 +3555,48 @@ INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_8017FF7 INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_8017FFB8); -INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_801800E0); + +/* func_801800E0 — entity state-kick #0xB. + * Sets the state word at 0x02 to 0xB, hands the entity to the script runner + * func_8012A828 with table D_801A7C94, clears bit 3 of the flag word at 0xDC, + * then picks the timer at 0x1C: a fixed 30 when bit 6 was set (also clearing + * bit 6), otherwise rand() % 16 + 15. Finally, if func_8012BD3C(e,0x400,0x8000) + * returns 0, bit 3 at 0xDC is set again. + * + * §71 sibling-first: func_80184D28 (same TU, same D_801A7C94 script table) is + * the same `sh 0x2 / jal func_8012A828 / jal rand / sw 0x1C` skeleton and pins + * the widths: `sh` at 0x02, `sw` at 0x1C/0xDC, and the s16 store scheduled into + * the jal delay slot. + */ + +extern void func_8012A828(s32*, s32); +extern s32 func_8012BD3C(s32 a0, s32 a1, s32 a2); +extern s32 rand(void); + +void func_801800E0(void *a0) { + + extern u8 D_801A7C94[]; + s32 flags; + s32 cleared; + s32 timer; + + *(s16 *)((s32)a0 + 0x2) = 0xB; + ((void (*)(s32, void *))func_8012A828)((s32)a0, D_801A7C94); + flags = *(s32 *)((s32)a0 + 0xDC); + cleared = flags & ~8; + *(s32 *)((s32)a0 + 0xDC) = cleared; + if (flags & 0x40) { + *(s32 *)((s32)a0 + 0xDC) = cleared & ~0x40; + timer = 30; + } else { + timer = rand() % 16 + 15; + } + *(s32 *)((s32)a0 + 0x1C) = timer; + if (func_8012BD3C((s32)a0, 0x400, 0x8000) == 0) { + *(s32 *)((s32)a0 + 0xDC) |= 8; + } +} + INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_80180198); @@ -3588,13 +3679,130 @@ void func_8018062C(s32 *a0) { } -INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_8018063C); + +// @class: regalloc (WIDTH/li!=addu -> MATCH) +// @stuck: none — MATCH (58 ins), match_one + rtu_match. PIN-FREE (no register __asm__). +// Three levers, in the order they mattered: +// +// 1) The join block indexes every field off $a0, not $s0: the target COPIES the entity into $a0 +// at the TOP of the join block (`addu $a0,$s0,$zero`) and reads 0x5C/0x5E/0x60/0x62/0x20 off +// that copy. A naive `e = param_1;` at the join is deleted — cse.c's make_regs_eqv keeps the +// PARAMETER as qty_first_reg, so canon_reg rewrites every use of `e` back to param_1 and the +// copy dies. Writing the copy at the end of the ARMS instead is worse (2 mismatches worse): +// gcc hoists it above the inner `if` into the beqz delay slot and the arms then read off $a0. +// +// 2) THE LEVER: make the copy's variable ALSO the 0x20 pointer of the /4 arm. make_regs_eqv only +// lets the new pseudo take over the quantity when its live range escapes the cse basic block +// AND outlives the param's last use. Reusing `a` in the /4 arm (which sits *after* the join in +// the insn stream, and whose last mention `sh $v0,0x18($a0)` comes after param_1's last mention +// `lh $v0,0x100($s0)`) satisfies both clauses at once, so `a` becomes canonical, the copy +// survives, and the block addresses off it. The same reuse is what puts `lw $a0,0x20($s0)` / +// `lh $v1,0x18($a0)` in the /4 arm in the target's register order — two separate locals there +// give the mirrored $v1/$a0 pair (6 extra mismatches; verified). The reuse must be paired with +// the join-top copy: `a` shared but copied in the arm instead makes it a plain global allocno, +// global.c hands it a callee-saved reg and the function grows an $s1 save/restore (60 ins). +// A `register s32 a __asm__("$4")` pin also reaches 0 here (canon_reg bails on hard regs), but +// the pin is unnecessary and would trip the §42e/§86 pin guard on the ×6 family remap. +// +// 3) Tail statement order is 0x5C, 0x60, 0x62, 0x5E — the 0x5E store must be LAST. sched2 works +// the ready list LIFO, so a 0x5E written third floats to the front of the block as +// `li $v0,1 / sh $v0,0x5E` and steals $v0 from the 0x5C load-modify-store (9 mismatches). +// Written last it sinks past `lhu $v0,0x12($v1)`, reuses the now-dead $v1 for its constant and +// lands where the target has it. (All 24 orderings byte-swept: only 5C-60-62-5E and +// 60-5C-62-5E reach 0.) +// +// Widths: 0x100 is read at TWO widths on purpose — `u16` in the flag arm (target `lhu`) and `s16` +// in the /4 arm (target `lh`); combine folds the extend into the load, so the cast at the use site +// picks the opcode. Ditto `|= 1` on the s16 0x5C field giving `lhu`. §3-T4: both `beqz`es mean +// the NON-zero arm falls through, i.e. `func_8012BEE8(..) != 0` and `flags & 0x80` are the +// fall-through arms (Ghidra's seed for this address was a different function entirely). + +extern s32 func_8012BEE8(s32 a0); +extern void func_80131E00(); + +void func_8018063C(s32 param_1) { + s32 a; + s32 p; + s32 q; + s32 x; + s32 t; + u16 h; + + if (func_8012BEE8(param_1) != 0) { + if (*(s32 *)(param_1 + 0xDC) & 0x80) { + p = *(s32 *)(param_1 + 0x20); + *(s16 *)(p + 0x1C) = 0x1000; + *(s16 *)(p + 0x18) = 0x1000; + *(s32 *)(param_1 + 0xDC) &= ~0x80; + } else { + p = *(s32 *)(param_1 + 0x20); + h = *(u16 *)(param_1 + 0x100); + *(s16 *)(p + 0x1C) = h; + *(s16 *)(p + 0x18) = h; + } + a = param_1; + *(s16 *)(a + 0x5C) |= 1; + *(s16 *)(a + 0x60) = 0; + q = *(s32 *)(a + 0x20); + *(s16 *)(a + 0x62) = *(u16 *)(q + 0x12) + 0x800; + *(s16 *)(a + 0x5E) = 1; + ((void (*)(s32, s32))func_80131E00)(a, 1); + } else { + a = *(s32 *)(param_1 + 0x20); + x = *(s16 *)(a + 0x18); + t = x + (*(s16 *)(param_1 + 0x100) - x) / 4; + *(s16 *)(a + 0x1C) = t; + *(s16 *)(a + 0x18) = t; + } +} + INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_80180724); INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_80180780); -INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_80180808); +// the beqz delay slot), so it is the FIRST statement, above the if; (3) both `*(s32*)(p+0x20)` +// reads in arm A are written as separate expressions — the intervening `sh` to 0x10 blocks CSE, +// which is why the target reloads 0x20 twice; (4) the tail compare is `iVar1 <= 0x8FFF`, NOT +// Ghidra's `< 0x9000`: 0x9000 does not fit the signed 16-bit `slti` immediate, so gcc +// materialises the bound with `ori $v1,$zero,0x8FFF` and emits the operand-reversed +// `slt $v1,$v1,$v0` + `bnez` over the 0x51F assignment (write the constant as 0x8FFF). +extern void func_8012A828(s32*, s32); +extern void func_8001C924(s32 a0, void *a1); +extern s32 func_8012BCCC(s32 a0); +extern void func_8002D4C8(s32 a0, s32 a1); + + +void func_80180808(s32 param_1) { + + extern u8 D_801A825C; + extern u8 D_801A6518; + extern u8 D_801A817C; + s32 iVar1; + s32 uVar2; + + *(s16 *)(param_1 + 0x5C) = 0; + if (*(s32 *)(param_1 + 0xDC) & 2) { + *(s32 *)(param_1 + 0x1C) = 0x2D; + ((void (*)(s32, void *))func_8012A828)(param_1, &D_801A825C); + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x10) = 0; + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = + (*(u16 *)(param_1 + 0x62) + 0x800) & 0xFFF; + *(s16 *)(param_1 + 0x52) = 0; + } else { + *(s32 *)(param_1 + 0x1C) = 0x37; + func_8001C924(*(s32 *)(param_1 + 0x20), &D_801A6518); + ((void (*)(s32, void *))func_8012A828)(param_1, &D_801A817C); + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = *(u16 *)(param_1 + 0x62); + } + iVar1 = func_8012BCCC(param_1); + uVar2 = 0x520; + if (iVar1 <= 0x8FFF) { + uVar2 = 0x51F; + } + func_8002D4C8(uVar2, 0); +} + INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_801808D8); @@ -3742,7 +3950,15 @@ extern void func_8012E688(s32 arg0, s32 arg1, s32 arg2); } -INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_80184504); + + +extern void func_8012E688(s32 arg0, s32 arg1, s32 arg2); + extern void func_8002AC00(s32 arg0); + void func_80184504(void *arg0) { + func_8012E688((s32)arg0, 0x8C7, 0); + func_8002AC00(0x10); + } + void func_80184530(void) { } @@ -3827,7 +4043,31 @@ INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_8018514 INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_801853D0); -INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_80185564); + +/* func_80185564 — "is another entity of type 0x35C sharing my 0x64 owner?" + * + * Walks the 0x60-entry entity table at D_801202A0 (stride 0x10C) with an int + * counter (the target keeps the count in $a2 and `slti ...,0x60`, so it is a + * counted loop, NOT the D_80126720 pointer-bound idiom the sibling walkers + * use). Returns 1 for the first entry whose u16 kind == 0x35C, whose word at + * 0x64 equals the caller's word at 0x64, and which is not the caller itself. + */ +s32 func_80185564(s32 arg0) { + extern u8 D_801202A0[]; + u8 *p; + s32 i; + + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == 0x35C && *(s32 *)(arg0 + 0x64) == *(s32 *)(p + 0x64) && + arg0 != (s32)p) { + return 1; + } + p += 0x10C; + } + return 0; +} + extern void func_8012EC04(s32 param_1, s32 param_2, s32 *param_3); @@ -3849,7 +4089,24 @@ void func_801855BC(s32 arg0) { } -INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_80185638); + +/* func_80185638 — guard-then-free tail (cookbook §71 sibling shape: + * src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c func_80144458 tail, and + * src/ov_SC03_099/ov_SC03_099_jr_80140608.c:2432 func_80016714(x, 0x38)). */ + +extern void func_80016714(void *a0, s32 a1); +extern void func_8012C218(void *a0); + +void func_80185638(void *arg0) { + void *temp_a0; + + temp_a0 = *(void **)((char *)arg0 + 0xCC); + if (temp_a0 != NULL) { + func_80016714(temp_a0, 0x38); + } + func_8012C218(arg0); +} + INCLUDE_ASM("asm/ov_SC03_112/nonmatchings/ov_SC03_112_jr_8017C294", func_8018567C); diff --git a/src/ov_SC03_113/ov_SC03_113_jr_80135D20.c b/src/ov_SC03_113/ov_SC03_113_jr_80135D20.c index e85af337b4..7e98a1292f 100644 --- a/src/ov_SC03_113/ov_SC03_113_jr_80135D20.c +++ b/src/ov_SC03_113/ov_SC03_113_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_113/nonmatchings/ov_SC03_113_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018338C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018338C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018338C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018338C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018338C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_113/ov_SC03_113_jr_80154C24.c b/src/ov_SC03_113/ov_SC03_113_jr_80154C24.c index c837b49d78..d791cf4f1d 100644 --- a/src/ov_SC03_113/ov_SC03_113_jr_80154C24.c +++ b/src/ov_SC03_113/ov_SC03_113_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_113/nonmatchings/ov_SC03_113_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80185114)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80185114[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80185114[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_113/ov_SC03_113_jr_8017C294.c b/src/ov_SC03_113/ov_SC03_113_jr_8017C294.c index 6d9265d230..60893f764f 100644 --- a/src/ov_SC03_113/ov_SC03_113_jr_8017C294.c +++ b/src/ov_SC03_113/ov_SC03_113_jr_8017C294.c @@ -3393,9 +3393,54 @@ s32 func_8017FB90(void) { INCLUDE_ASM("asm/ov_SC03_113/nonmatchings/ov_SC03_113_jr_8017C294", func_8017FB98); -INCLUDE_ASM("asm/ov_SC03_113/nonmatchings/ov_SC03_113_jr_8017C294", func_8017FC3C); -INCLUDE_ASM("asm/ov_SC03_113/nonmatchings/ov_SC03_113_jr_8017C294", func_8017FCB8); +extern void func_80180910(void *a0); + +void func_8017FC3C(void *a0) { + + extern void (*D_8019CB9C[])(void); + D_8019CB9C[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)((s32)a0 + 0x0) != 0) { + *(s32 *)((s32)a0 + 0xE8) = *(s32 *)((s32)a0 + 0xE8) + 1; + if ((*(s32 *)((s32)a0 + 0xE8) & 0xF) == 0) { + func_80180910(a0); + } + } +} + + + +extern s32 rand(void); +extern s32 func_8012C354(s32 *a0, s32 a1); +extern void func_8012A828(s32 *a0, s32 a1); +extern void func_80143994(s32 *a0, s32 a1); + + +void func_8017FCB8(void *arg0) { + + extern s32 D_8019CB30; + extern s32 D_8019CB74; + extern s32 D_8019F08C; + s32 t; + + if (func_8012C354(arg0, &D_8019CB30)) { + *(u8 *)((char *)arg0 + 0xC0) = 1; + *(s32 *)((char *)arg0 + 0xB4) = -1; + *(s32 **)((char *)arg0 + 0xBC) = &D_8019CB74; + *(u32 *)((char *)arg0 + 0xC4) |= 1; + *(s32 *)((char *)arg0 + 0xE4) = -((rand() % 8 + 0xC) << 16); + func_8012A828(arg0, &D_8019F08C); + func_80143994(arg0, 0x1000); + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + if (t != 0) { + t = 3; + } else { + t = 1; + } + *(s16 *)((char *)arg0 + 0x2) = t; + } +} + INCLUDE_ASM("asm/ov_SC03_113/nonmatchings/ov_SC03_113_jr_8017C294", func_8017FD78); @@ -3410,11 +3455,48 @@ INCLUDE_ASM("asm/ov_SC03_113/nonmatchings/ov_SC03_113_jr_8017C294", func_801803F INCLUDE_ASM("asm/ov_SC03_113/nonmatchings/ov_SC03_113_jr_8017C294", func_80180504); -INCLUDE_ASM("asm/ov_SC03_113/nonmatchings/ov_SC03_113_jr_8017C294", func_801806A0); + +extern s32 func_8012BEE8(s32 a0); +extern s32 func_8012E778(s32 a0, s32 a1); +extern void func_8012E88C(s32 a0); +extern void func_8012A828(s32 *a0, s32 a1); + +void func_801806A0(void *arg0) { + + extern s32 D_8019F08C; + if (func_8012BEE8((s32)arg0)) { + if (!func_8012E778((s32)arg0, 0xA000C8)) { + { + s32 t; + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + *(s16 *)((char *)arg0 + 0x2) = (t == 0) ? 1 : 3; + } + *(s16 *)((char *)arg0 + 0x5C) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78) + 0x2); + *(s16 *)((char *)arg0 + 0x76) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78)); + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1A) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1C) = 0x1000; + *(u16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x2C) &= 0x10; + func_8012E88C((s32)arg0); + func_8012A828(arg0, &D_8019F08C); + } + } +} + INCLUDE_ASM("asm/ov_SC03_113/nonmatchings/ov_SC03_113_jr_8017C294", func_8018075C); -INCLUDE_ASM("asm/ov_SC03_113/nonmatchings/ov_SC03_113_jr_8017C294", func_801807E8); + +extern void func_8012A828(s32 *a0, s32 a1); + extern s32 D_8019F08C; + void func_801807E8(void *arg0) { + *(s16 *)((char *)arg0 + 0x2) = 1; + *(s16 *)((char *)arg0 + 0x5c) = *(u16 *)(*(s32 *)((char *)arg0 + 0x78) + 0x2); + func_8012A828(arg0, &D_8019F08C); + } + extern s32 func_8012D5E4(s32 a0, s32 a1, s32 a2, s32 a3); diff --git a/src/ov_SC03_114/ov_SC03_114_jr_80135D20.c b/src/ov_SC03_114/ov_SC03_114_jr_80135D20.c index 1578c25195..f9340f876f 100644 --- a/src/ov_SC03_114/ov_SC03_114_jr_80135D20.c +++ b/src/ov_SC03_114/ov_SC03_114_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_114/nonmatchings/ov_SC03_114_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017EFF4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017EFF4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017EFF4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017EFF4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017EFF4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_114/ov_SC03_114_jr_80154C24.c b/src/ov_SC03_114/ov_SC03_114_jr_80154C24.c index 3deaba06e4..7421083f11 100644 --- a/src/ov_SC03_114/ov_SC03_114_jr_80154C24.c +++ b/src/ov_SC03_114/ov_SC03_114_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_114/nonmatchings/ov_SC03_114_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80180D7C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80180D7C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80180D7C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_115/ov_SC03_115_jr_80135D20.c b/src/ov_SC03_115/ov_SC03_115_jr_80135D20.c index b80c0c6284..f5189c0db3 100644 --- a/src/ov_SC03_115/ov_SC03_115_jr_80135D20.c +++ b/src/ov_SC03_115/ov_SC03_115_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80180A60[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80180A60[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80180A60[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80180A60[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80180A60[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_115/ov_SC03_115_jr_80154C24.c b/src/ov_SC03_115/ov_SC03_115_jr_80154C24.c index ea4c9fbf99..9bb493588f 100644 --- a/src/ov_SC03_115/ov_SC03_115_jr_80154C24.c +++ b/src/ov_SC03_115/ov_SC03_115_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801827E8)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801827E8[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801827E8[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_115/ov_SC03_115_jr_8017BEBC.c b/src/ov_SC03_115/ov_SC03_115_jr_8017BEBC.c index fd07108663..32fcad5825 100644 --- a/src/ov_SC03_115/ov_SC03_115_jr_8017BEBC.c +++ b/src/ov_SC03_115/ov_SC03_115_jr_8017BEBC.c @@ -384,7 +384,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3451,7 +3450,58 @@ extern void func_8012A828(s32 *a0, s32 a1); } -INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017DB74); + +extern s32 func_8012BCCC(s32 a0); +extern void func_8001C924(s32 a0, void *a1); +extern void func_8012A828(s32*, s32); +extern s32 func_8012B8E4(s32 a0, s32 a1); +extern s32 func_8012BEE8(s32 a0); + +// @class: straight-derive +// @stuck: none — MATCH (52 ins) on iteration 1, confirmed by rtu_match. +// +// Two things that could have been mis-read off the target asm: +// +// 1. RELOAD_CSE DELETES A REDUNDANT ARG MOVE — do not read "no arg setup" as +// "zero-arg call". `jal func_8012BCCC` at 0x80184C7C has a bare `nop` delay +// slot and NO `addu $a0,$s0,$zero` before it, which looks like `f()`. It is +// `f(a0)`: the incoming param is still live in $a0 in that fall-through +// block, so gcc-2.7.2's reload_cse_regs (reload1.c) deletes the redundant +// `move $a0,$s0`. The SAME move survives at .L80184CD0 (0x80184CD0) because +// reload_cse's value tracking resets at a CODE_LABEL. So: an arg move that +// is present on the labelled arm and absent on the fall-through arm is ONE +// source-level call shape, not two. +// +// 2. `lui $v1,1 / slt $v1,$v1,$v0` is `ret <= 0x10000`, not `ret < 0x10001`. +// gcc lowers `a <= C` to `!(C < a)` and puts the CONSTANT in the first slt +// operand; writing `< 0x10001` would have materialised 0x10001 instead. +// +// Statement order in the then-arm is the Ghidra order (0x1C store, then the +// 0x34 increment): memrefs_conflict_p disambiguates `+0x1C`/4 from `+0x34`/2 +// off the same base, so sched2 legally hoists the `lhu 0x34` above the `sw` +// to cover its load delay — which is exactly the target's interleave. +void func_8017DB74(s32 a0) { + + extern u8 D_8018C7D8; + extern u8 D_8018F904[]; + s32 v; + + if (*(u16 *)(a0 + 0x34) == 0) { + if (func_8012BCCC(a0) <= 0x10000) { + func_8001C924(*(s32 *)(a0 + 0x20), (void *)&D_8018C7D8); + ((void (*)(s32, void *))func_8012A828)(a0, (void *)&(*(u8 *)D_8018F904)); + *(s32 *)(a0 + 0x1C) = 0x1E; + *(u16 *)(a0 + 0x34) += 1; + } + } else { + v = func_8012B8E4(a0, 0xA); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) += v; + if (func_8012BEE8(a0) != 0 || v == 0) { + *(s16 *)(a0 + 0x2) = 5; + } + } +} + INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017DC44); @@ -3473,7 +3523,48 @@ INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017DF6 INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017DFB0); -INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017E0D8); + +/* func_8017E0D8 — entity state-kick #0xB. + * Sets the state word at 0x02 to 0xB, hands the entity to the script runner + * func_8012A828 with table D_8018F904, clears bit 3 of the flag word at 0xDC, + * then picks the timer at 0x1C: a fixed 30 when bit 6 was set (also clearing + * bit 6), otherwise rand() % 16 + 15. Finally, if func_8012BD3C(e,0x400,0x8000) + * returns 0, bit 3 at 0xDC is set again. + * + * §71 sibling-first: func_80184D28 (same TU, same D_8018F904 script table) is + * the same `sh 0x2 / jal func_8012A828 / jal rand / sw 0x1C` skeleton and pins + * the widths: `sh` at 0x02, `sw` at 0x1C/0xDC, and the s16 store scheduled into + * the jal delay slot. + */ + +extern void func_8012A828(s32*, s32); +extern s32 func_8012BD3C(s32 a0, s32 a1, s32 a2); +extern s32 rand(void); + +void func_8017E0D8(void *a0) { + + extern u8 D_8018F904[]; + s32 flags; + s32 cleared; + s32 timer; + + *(s16 *)((s32)a0 + 0x2) = 0xB; + ((void (*)(s32, void *))func_8012A828)((s32)a0, D_8018F904); + flags = *(s32 *)((s32)a0 + 0xDC); + cleared = flags & ~8; + *(s32 *)((s32)a0 + 0xDC) = cleared; + if (flags & 0x40) { + *(s32 *)((s32)a0 + 0xDC) = cleared & ~0x40; + timer = 30; + } else { + timer = rand() % 16 + 15; + } + *(s32 *)((s32)a0 + 0x1C) = timer; + if (func_8012BD3C((s32)a0, 0x400, 0x8000) == 0) { + *(s32 *)((s32)a0 + 0xDC) |= 8; + } +} + INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017E190); @@ -3556,13 +3647,130 @@ void func_8017E624(s32 *a0) { } -INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017E634); + +// @class: regalloc (WIDTH/li!=addu -> MATCH) +// @stuck: none — MATCH (58 ins), match_one + rtu_match. PIN-FREE (no register __asm__). +// Three levers, in the order they mattered: +// +// 1) The join block indexes every field off $a0, not $s0: the target COPIES the entity into $a0 +// at the TOP of the join block (`addu $a0,$s0,$zero`) and reads 0x5C/0x5E/0x60/0x62/0x20 off +// that copy. A naive `e = param_1;` at the join is deleted — cse.c's make_regs_eqv keeps the +// PARAMETER as qty_first_reg, so canon_reg rewrites every use of `e` back to param_1 and the +// copy dies. Writing the copy at the end of the ARMS instead is worse (2 mismatches worse): +// gcc hoists it above the inner `if` into the beqz delay slot and the arms then read off $a0. +// +// 2) THE LEVER: make the copy's variable ALSO the 0x20 pointer of the /4 arm. make_regs_eqv only +// lets the new pseudo take over the quantity when its live range escapes the cse basic block +// AND outlives the param's last use. Reusing `a` in the /4 arm (which sits *after* the join in +// the insn stream, and whose last mention `sh $v0,0x18($a0)` comes after param_1's last mention +// `lh $v0,0x100($s0)`) satisfies both clauses at once, so `a` becomes canonical, the copy +// survives, and the block addresses off it. The same reuse is what puts `lw $a0,0x20($s0)` / +// `lh $v1,0x18($a0)` in the /4 arm in the target's register order — two separate locals there +// give the mirrored $v1/$a0 pair (6 extra mismatches; verified). The reuse must be paired with +// the join-top copy: `a` shared but copied in the arm instead makes it a plain global allocno, +// global.c hands it a callee-saved reg and the function grows an $s1 save/restore (60 ins). +// A `register s32 a __asm__("$4")` pin also reaches 0 here (canon_reg bails on hard regs), but +// the pin is unnecessary and would trip the §42e/§86 pin guard on the ×6 family remap. +// +// 3) Tail statement order is 0x5C, 0x60, 0x62, 0x5E — the 0x5E store must be LAST. sched2 works +// the ready list LIFO, so a 0x5E written third floats to the front of the block as +// `li $v0,1 / sh $v0,0x5E` and steals $v0 from the 0x5C load-modify-store (9 mismatches). +// Written last it sinks past `lhu $v0,0x12($v1)`, reuses the now-dead $v1 for its constant and +// lands where the target has it. (All 24 orderings byte-swept: only 5C-60-62-5E and +// 60-5C-62-5E reach 0.) +// +// Widths: 0x100 is read at TWO widths on purpose — `u16` in the flag arm (target `lhu`) and `s16` +// in the /4 arm (target `lh`); combine folds the extend into the load, so the cast at the use site +// picks the opcode. Ditto `|= 1` on the s16 0x5C field giving `lhu`. §3-T4: both `beqz`es mean +// the NON-zero arm falls through, i.e. `func_8012BEE8(..) != 0` and `flags & 0x80` are the +// fall-through arms (Ghidra's seed for this address was a different function entirely). + +extern s32 func_8012BEE8(s32 a0); +extern void func_80131E00(); + +void func_8017E634(s32 param_1) { + s32 a; + s32 p; + s32 q; + s32 x; + s32 t; + u16 h; + + if (func_8012BEE8(param_1) != 0) { + if (*(s32 *)(param_1 + 0xDC) & 0x80) { + p = *(s32 *)(param_1 + 0x20); + *(s16 *)(p + 0x1C) = 0x1000; + *(s16 *)(p + 0x18) = 0x1000; + *(s32 *)(param_1 + 0xDC) &= ~0x80; + } else { + p = *(s32 *)(param_1 + 0x20); + h = *(u16 *)(param_1 + 0x100); + *(s16 *)(p + 0x1C) = h; + *(s16 *)(p + 0x18) = h; + } + a = param_1; + *(s16 *)(a + 0x5C) |= 1; + *(s16 *)(a + 0x60) = 0; + q = *(s32 *)(a + 0x20); + *(s16 *)(a + 0x62) = *(u16 *)(q + 0x12) + 0x800; + *(s16 *)(a + 0x5E) = 1; + ((void (*)(s32, s32))func_80131E00)(a, 1); + } else { + a = *(s32 *)(param_1 + 0x20); + x = *(s16 *)(a + 0x18); + t = x + (*(s16 *)(param_1 + 0x100) - x) / 4; + *(s16 *)(a + 0x1C) = t; + *(s16 *)(a + 0x18) = t; + } +} + INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017E71C); INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017E778); -INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017E800); +// the beqz delay slot), so it is the FIRST statement, above the if; (3) both `*(s32*)(p+0x20)` +// reads in arm A are written as separate expressions — the intervening `sh` to 0x10 blocks CSE, +// which is why the target reloads 0x20 twice; (4) the tail compare is `iVar1 <= 0x8FFF`, NOT +// Ghidra's `< 0x9000`: 0x9000 does not fit the signed 16-bit `slti` immediate, so gcc +// materialises the bound with `ori $v1,$zero,0x8FFF` and emits the operand-reversed +// `slt $v1,$v1,$v0` + `bnez` over the 0x51F assignment (write the constant as 0x8FFF). +extern void func_8012A828(s32*, s32); +extern void func_8001C924(s32 a0, void *a1); +extern s32 func_8012BCCC(s32 a0); +extern void func_8002D4C8(s32 a0, s32 a1); + + +void func_8017E800(s32 param_1) { + + extern u8 D_8018FECC; + extern u8 D_8018E188; + extern u8 D_8018FDEC; + s32 iVar1; + s32 uVar2; + + *(s16 *)(param_1 + 0x5C) = 0; + if (*(s32 *)(param_1 + 0xDC) & 2) { + *(s32 *)(param_1 + 0x1C) = 0x2D; + ((void (*)(s32, void *))func_8012A828)(param_1, &D_8018FECC); + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x10) = 0; + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = + (*(u16 *)(param_1 + 0x62) + 0x800) & 0xFFF; + *(s16 *)(param_1 + 0x52) = 0; + } else { + *(s32 *)(param_1 + 0x1C) = 0x37; + func_8001C924(*(s32 *)(param_1 + 0x20), &D_8018E188); + ((void (*)(s32, void *))func_8012A828)(param_1, &D_8018FDEC); + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = *(u16 *)(param_1 + 0x62); + } + iVar1 = func_8012BCCC(param_1); + uVar2 = 0x520; + if (iVar1 <= 0x8FFF) { + uVar2 = 0x51F; + } + func_8002D4C8(uVar2, 0); +} + INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017E8D0); @@ -3591,9 +3799,54 @@ INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017EE7 INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017EFB8); -INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017F04C); -INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017F0C8); +extern void func_8017FD20(void *a0); + +void func_8017F04C(void *a0) { + + extern void (*D_8018FF58[])(void); + D_8018FF58[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)((s32)a0 + 0x0) != 0) { + *(s32 *)((s32)a0 + 0xE8) = *(s32 *)((s32)a0 + 0xE8) + 1; + if ((*(s32 *)((s32)a0 + 0xE8) & 0xF) == 0) { + func_8017FD20(a0); + } + } +} + + + +extern s32 rand(void); +extern s32 func_8012C354(s32 *a0, s32 a1); +extern void func_8012A828(s32 *a0, s32 a1); +extern void func_80143994(s32 *a0, s32 a1); + + +void func_8017F0C8(void *arg0) { + + extern s32 D_8018FEEC; + extern s32 D_8018FF30; + extern s32 D_80192448; + s32 t; + + if (func_8012C354(arg0, &D_8018FEEC)) { + *(u8 *)((char *)arg0 + 0xC0) = 1; + *(s32 *)((char *)arg0 + 0xB4) = -1; + *(s32 **)((char *)arg0 + 0xBC) = &D_8018FF30; + *(u32 *)((char *)arg0 + 0xC4) |= 1; + *(s32 *)((char *)arg0 + 0xE4) = -((rand() % 8 + 0xC) << 16); + func_8012A828(arg0, &D_80192448); + func_80143994(arg0, 0x1000); + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + if (t != 0) { + t = 3; + } else { + t = 1; + } + *(s16 *)((char *)arg0 + 0x2) = t; + } +} + INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017F188); @@ -3607,7 +3860,36 @@ INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017F80 INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017F914); -INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017FAB0); + +extern s32 func_8012BEE8(s32 a0); +extern s32 func_8012E778(s32 a0, s32 a1); +extern void func_8012E88C(s32 a0); +extern void func_8012A828(s32 *a0, s32 a1); + +void func_8017FAB0(void *arg0) { + + extern s32 D_80192448; + if (func_8012BEE8((s32)arg0)) { + if (!func_8012E778((s32)arg0, 0xA000C8)) { + { + s32 t; + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + *(s16 *)((char *)arg0 + 0x2) = (t == 0) ? 1 : 3; + } + *(s16 *)((char *)arg0 + 0x5C) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78) + 0x2); + *(s16 *)((char *)arg0 + 0x76) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78)); + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1A) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1C) = 0x1000; + *(u16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x2C) &= 0x10; + func_8012E88C((s32)arg0); + func_8012A828(arg0, &D_80192448); + } + } +} + INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017FB6C); @@ -3653,7 +3935,31 @@ INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_8017FEC INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_80180154); -INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_801802E8); + +/* func_801802E8 — "is another entity of type 0x35C sharing my 0x64 owner?" + * + * Walks the 0x60-entry entity table at D_801202A0 (stride 0x10C) with an int + * counter (the target keeps the count in $a2 and `slti ...,0x60`, so it is a + * counted loop, NOT the D_80126720 pointer-bound idiom the sibling walkers + * use). Returns 1 for the first entry whose u16 kind == 0x35C, whose word at + * 0x64 equals the caller's word at 0x64, and which is not the caller itself. + */ +s32 func_801802E8(s32 arg0) { + extern u8 D_801202A0[]; + u8 *p; + s32 i; + + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == 0x35C && *(s32 *)(arg0 + 0x64) == *(s32 *)(p + 0x64) && + arg0 != (s32)p) { + return 1; + } + p += 0x10C; + } + return 0; +} + extern void func_8012EC04(s32 param_1, s32 param_2, s32 *param_3); @@ -3675,7 +3981,24 @@ void func_80180340(s32 arg0) { } -INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_801803BC); + +/* func_801803BC — guard-then-free tail (cookbook §71 sibling shape: + * src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c func_80144458 tail, and + * src/ov_SC03_099/ov_SC03_099_jr_80140608.c:2432 func_80016714(x, 0x38)). */ + +extern void func_80016714(void *a0, s32 a1); +extern void func_8012C218(void *a0); + +void func_801803BC(void *arg0) { + void *temp_a0; + + temp_a0 = *(void **)((char *)arg0 + 0xCC); + if (temp_a0 != NULL) { + func_80016714(temp_a0, 0x38); + } + func_8012C218(arg0); +} + INCLUDE_ASM("asm/ov_SC03_115/nonmatchings/ov_SC03_115_jr_8017BEBC", func_80180400); diff --git a/src/ov_SC03_116/ov_SC03_116_jr_80135D20.c b/src/ov_SC03_116/ov_SC03_116_jr_80135D20.c index 0f6cc177d2..0627774181 100644 --- a/src/ov_SC03_116/ov_SC03_116_jr_80135D20.c +++ b/src/ov_SC03_116/ov_SC03_116_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_116/nonmatchings/ov_SC03_116_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80182E64[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80182E64[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80182E64[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80182E64[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80182E64[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_116/ov_SC03_116_jr_80154C24.c b/src/ov_SC03_116/ov_SC03_116_jr_80154C24.c index 1f457a47bc..dcd7419d2b 100644 --- a/src/ov_SC03_116/ov_SC03_116_jr_80154C24.c +++ b/src/ov_SC03_116/ov_SC03_116_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_116/nonmatchings/ov_SC03_116_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80184BEC)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80184BEC[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80184BEC[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_117/ov_SC03_117_jr_80135D20.c b/src/ov_SC03_117/ov_SC03_117_jr_80135D20.c index be3b717716..c3e5f35e74 100644 --- a/src/ov_SC03_117/ov_SC03_117_jr_80135D20.c +++ b/src/ov_SC03_117/ov_SC03_117_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80184E70[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80184E70[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80184E70[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80184E70[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80184E70[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_117/ov_SC03_117_jr_80154C24.c b/src/ov_SC03_117/ov_SC03_117_jr_80154C24.c index d7f28a29f9..790fd0f57e 100644 --- a/src/ov_SC03_117/ov_SC03_117_jr_80154C24.c +++ b/src/ov_SC03_117/ov_SC03_117_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80186BF8)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80186BF8[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80186BF8[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_117/ov_SC03_117_jr_8017BEBC.c b/src/ov_SC03_117/ov_SC03_117_jr_8017BEBC.c index eebc55da62..be6d988fbe 100644 --- a/src/ov_SC03_117/ov_SC03_117_jr_8017BEBC.c +++ b/src/ov_SC03_117/ov_SC03_117_jr_8017BEBC.c @@ -1550,7 +1550,6 @@ extern void func_80164744(s32 param_1); extern void func_8001C810(s32 a0, s32 a1); extern void func_80164A74(s32 *a0); extern void func_80164930(s32 a); -extern u16 D_800DF2E0; extern s32 D_80187488; extern s16 D_801874BC; extern s16 D_801874BA; @@ -3170,7 +3169,17 @@ void func_8017CD9C(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_8017BEBC", func_8017CDD8); +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern s32 func_80171990(u8 *a0); +void func_8017CDD8(s32 a0) { + + extern u8 D_801882A8; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_801882A8); + func_80171990((u8 *)a0); +} + INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_8017BEBC", func_8017CE18); @@ -3240,7 +3249,33 @@ INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_8017BEBC", func_8017D2A INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_8017BEBC", func_8017D300); -INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_8017BEBC", func_8017D364); +extern void func_8014659C(void); +extern void func_8001C810(s32 a0, s32 a1); +extern void func_80146CA0(void *a0); +extern void func_80162CCC(void); +void func_8017D364(int param_1) { + + extern u16 D_800DF2E0; + extern s32 D_80188368; + extern s32 D_801883C4[]; + s32 iVar1; + iVar1 = ((s32 (*)(void))func_8014659C)(); + *(s32 *)(param_1 + 0x20) = iVar1; + if (iVar1 != 0) { + ((void (*)(s32, void *))func_8001C810)(iVar1, &D_800DF2E0); + *(s32 **)(iVar1 + 0x80) = &D_80188368; + *(u32 *)(iVar1 + 4) = *(u32 *)(iVar1 + 4) | 0x50000000; + *(u16 *)(iVar1 + 0x2c) = *(u16 *)(iVar1 + 0x2c) | 0xb0; + *(s32 *)(param_1 + 0x58) = (s32)&D_801883C4[*(s32 *)(param_1 + 0x50) * 2]; + *(u16 *)(iVar1 + 0x1c) = 0; + *(u16 *)(iVar1 + 0x1a) = 0; + *(u16 *)(iVar1 + 0x18) = 0; + ((void (*)(s32))func_80146CA0)(param_1); + } else { + ((void (*)(s32))func_80162CCC)(param_1); + } +} + /* func_8017D414 — per-frame spin + clamp handler (ov_SC03_014, reach x8). @@ -3885,9 +3920,54 @@ extern void func_8013373C(s32 arg0); INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_8017BEBC", func_80180C98); -INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_8017BEBC", func_80180CF0); -INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_8017BEBC", func_80180D6C); +extern void func_801819C4(void *a0); + +void func_80180CF0(void *a0) { + + extern void (*D_801C0F9C[])(void); + D_801C0F9C[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)((s32)a0 + 0x0) != 0) { + *(s32 *)((s32)a0 + 0xE8) = *(s32 *)((s32)a0 + 0xE8) + 1; + if ((*(s32 *)((s32)a0 + 0xE8) & 0xF) == 0) { + func_801819C4(a0); + } + } +} + + + +extern s32 rand(void); +extern s32 func_8012C354(s32 *a0, s32 a1); +extern void func_8012A828(s32, s32); +extern void func_80143994(s32 *a0, s32 a1); + + +void func_80180D6C(void *arg0) { + + extern s32 D_801C0F30; + extern s32 D_801C0F74; + extern s32 D_801C348C; + s32 t; + + if (func_8012C354(arg0, &D_801C0F30)) { + *(u8 *)((char *)arg0 + 0xC0) = 1; + *(s32 *)((char *)arg0 + 0xB4) = -1; + *(s32 **)((char *)arg0 + 0xBC) = &D_801C0F74; + *(u32 *)((char *)arg0 + 0xC4) |= 1; + *(s32 *)((char *)arg0 + 0xE4) = -((rand() % 8 + 0xC) << 16); + ((void (*)(s32 *, s32))func_8012A828)(arg0, &D_801C348C); + func_80143994(arg0, 0x1000); + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + if (t != 0) { + t = 3; + } else { + t = 1; + } + *(s16 *)((char *)arg0 + 0x2) = t; + } +} + INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_8017BEBC", func_80180E2C); @@ -3901,7 +3981,36 @@ INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_8017BEBC", func_801814A INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_8017BEBC", func_801815B8); -INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_8017BEBC", func_80181754); + +extern s32 func_8012BEE8(s32 a0); +extern s32 func_8012E778(s32 a0, s32 a1); +extern void func_8012E88C(s32 a0); +extern void func_8012A828(s32, s32); + +void func_80181754(void *arg0) { + + extern s32 D_801C348C; + if (func_8012BEE8((s32)arg0)) { + if (!func_8012E778((s32)arg0, 0xA000C8)) { + { + s32 t; + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + *(s16 *)((char *)arg0 + 0x2) = (t == 0) ? 1 : 3; + } + *(s16 *)((char *)arg0 + 0x5C) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78) + 0x2); + *(s16 *)((char *)arg0 + 0x76) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78)); + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1A) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1C) = 0x1000; + *(u16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x2C) &= 0x10; + func_8012E88C((s32)arg0); + ((void (*)(s32 *, s32))func_8012A828)(arg0, &D_801C348C); + } + } +} + INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_8017BEBC", func_80181810); @@ -3971,7 +4080,15 @@ extern void func_8012E688(s32 arg0, s32 arg1, s32 arg2); } -INCLUDE_ASM("asm/ov_SC03_117/nonmatchings/ov_SC03_117_jr_8017BEBC", func_8018358C); + + +extern void func_8012E688(s32 arg0, s32 arg1, s32 arg2); + extern void func_8002AC00(s32 arg0); + void func_8018358C(void *arg0) { + func_8012E688((s32)arg0, 0x8C7, 0); + func_8002AC00(0x10); + } + void func_801835B8(void) { } diff --git a/src/ov_SC03_118/ov_SC03_118_jr_80135D20.c b/src/ov_SC03_118/ov_SC03_118_jr_80135D20.c index 1905eb9a04..2b5423e19b 100644 --- a/src/ov_SC03_118/ov_SC03_118_jr_80135D20.c +++ b/src/ov_SC03_118/ov_SC03_118_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_118/nonmatchings/ov_SC03_118_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80189F1C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80189F1C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80189F1C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80189F1C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80189F1C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_118/ov_SC03_118_jr_80154C24.c b/src/ov_SC03_118/ov_SC03_118_jr_80154C24.c index a9abd5254e..3be1a00102 100644 --- a/src/ov_SC03_118/ov_SC03_118_jr_80154C24.c +++ b/src/ov_SC03_118/ov_SC03_118_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_118/nonmatchings/ov_SC03_118_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018BCA4)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018BCA4[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018BCA4[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_118/ov_SC03_118_jr_8017AE2C.c b/src/ov_SC03_118/ov_SC03_118_jr_8017AE2C.c index 198eaede3c..ecc6fe10ed 100644 --- a/src/ov_SC03_118/ov_SC03_118_jr_8017AE2C.c +++ b/src/ov_SC03_118/ov_SC03_118_jr_8017AE2C.c @@ -1547,7 +1547,6 @@ extern void func_80164744(s32 param_1); extern void func_8001C810(s32 a0, s32 a1); extern void func_80164A74(s32 *a0); extern void func_80164930(s32 a); -extern u16 D_800DF2E0; extern s32 D_8018C534; extern s16 D_8018C568; extern s16 D_8018C566; @@ -3741,7 +3740,17 @@ void func_8017F344(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_118/nonmatchings/ov_SC03_118_jr_8017AE2C", func_8017F380); +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern s32 func_80171990(u8 *a0); +void func_8017F380(s32 a0) { + + extern u8 D_8018D96C; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_8018D96C); + func_80171990((u8 *)a0); +} + INCLUDE_ASM("asm/ov_SC03_118/nonmatchings/ov_SC03_118_jr_8017AE2C", func_8017F3C0); @@ -3805,7 +3814,33 @@ INCLUDE_ASM("asm/ov_SC03_118/nonmatchings/ov_SC03_118_jr_8017AE2C", func_8017F84 INCLUDE_ASM("asm/ov_SC03_118/nonmatchings/ov_SC03_118_jr_8017AE2C", func_8017F8A8); -INCLUDE_ASM("asm/ov_SC03_118/nonmatchings/ov_SC03_118_jr_8017AE2C", func_8017F90C); +extern void func_8014659C(void); +extern void func_8001C810(s32 a0, s32 a1); +extern void func_80146CA0(void *a0); +extern void func_80162CCC(void); +void func_8017F90C(int param_1) { + + extern u16 D_800DF2E0; + extern s32 D_8018DA2C; + extern s32 D_8018DA88[]; + s32 iVar1; + iVar1 = ((s32 (*)(void))func_8014659C)(); + *(s32 *)(param_1 + 0x20) = iVar1; + if (iVar1 != 0) { + ((void (*)(s32, void *))func_8001C810)(iVar1, &D_800DF2E0); + *(s32 **)(iVar1 + 0x80) = &D_8018DA2C; + *(u32 *)(iVar1 + 4) = *(u32 *)(iVar1 + 4) | 0x50000000; + *(u16 *)(iVar1 + 0x2c) = *(u16 *)(iVar1 + 0x2c) | 0xb0; + *(s32 *)(param_1 + 0x58) = (s32)&D_8018DA88[*(s32 *)(param_1 + 0x50) * 2]; + *(u16 *)(iVar1 + 0x1c) = 0; + *(u16 *)(iVar1 + 0x1a) = 0; + *(u16 *)(iVar1 + 0x18) = 0; + ((void (*)(s32))func_80146CA0)(param_1); + } else { + ((void (*)(s32))func_80162CCC)(param_1); + } +} + /* func_8017F9BC — per-frame spin + clamp handler (ov_SC03_014, reach x8). diff --git a/src/ov_SC03_118/ov_SC03_118_jr_8017FB84.c b/src/ov_SC03_118/ov_SC03_118_jr_8017FB84.c index ba21b7d8ac..9465115814 100644 --- a/src/ov_SC03_118/ov_SC03_118_jr_8017FB84.c +++ b/src/ov_SC03_118/ov_SC03_118_jr_8017FB84.c @@ -3908,7 +3908,15 @@ extern void func_8012E688(s32 *a0, s32 a1, s32 a2); } -INCLUDE_ASM("asm/ov_SC03_118/nonmatchings/ov_SC03_118_jr_8017FB84", func_80187CD8); + + +extern void func_8012E688(s32*, s32, s32); + extern void func_8002AC00(s32 arg0); + void func_80187CD8(void *arg0) { + ((void (*)(s32, s32, s32))func_8012E688)((s32)arg0, 0x8C7, 0); + func_8002AC00(0x10); + } + DEFINE_func_80187D04() /* dedup: shared engine-core @0x80187D04 (src/shared) */ diff --git a/src/ov_SC03_119/ov_SC03_119_jr_80135D20.c b/src/ov_SC03_119/ov_SC03_119_jr_80135D20.c index ed89ecd3cf..2b5423e19b 100644 --- a/src/ov_SC03_119/ov_SC03_119_jr_80135D20.c +++ b/src/ov_SC03_119/ov_SC03_119_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_119/nonmatchings/ov_SC03_119_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80189F1C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80189F1C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80189F1C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80189F1C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80189F1C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_119/ov_SC03_119_jr_80154C24.c b/src/ov_SC03_119/ov_SC03_119_jr_80154C24.c index 75a1f3f3de..3be1a00102 100644 --- a/src/ov_SC03_119/ov_SC03_119_jr_80154C24.c +++ b/src/ov_SC03_119/ov_SC03_119_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_119/nonmatchings/ov_SC03_119_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018BCA4)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018BCA4[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018BCA4[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_119/ov_SC03_119_jr_8017AE2C.c b/src/ov_SC03_119/ov_SC03_119_jr_8017AE2C.c index 842a424565..e80d8c4b5f 100644 --- a/src/ov_SC03_119/ov_SC03_119_jr_8017AE2C.c +++ b/src/ov_SC03_119/ov_SC03_119_jr_8017AE2C.c @@ -1547,7 +1547,6 @@ extern void func_80164744(s32 param_1); extern void func_8001C810(s32 a0, s32 a1); extern void func_80164A74(s32 *a0); extern void func_80164930(s32 a); -extern u16 D_800DF2E0; extern s32 D_8018C534; extern s16 D_8018C568; extern s16 D_8018C566; @@ -3735,7 +3734,17 @@ void func_8017F344(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_119/nonmatchings/ov_SC03_119_jr_8017AE2C", func_8017F380); +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern s32 func_80171990(u8 *a0); +void func_8017F380(s32 a0) { + + extern u8 D_8018D96C; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_8018D96C); + func_80171990((u8 *)a0); +} + INCLUDE_ASM("asm/ov_SC03_119/nonmatchings/ov_SC03_119_jr_8017AE2C", func_8017F3C0); @@ -3798,7 +3807,33 @@ INCLUDE_ASM("asm/ov_SC03_119/nonmatchings/ov_SC03_119_jr_8017AE2C", func_8017F84 INCLUDE_ASM("asm/ov_SC03_119/nonmatchings/ov_SC03_119_jr_8017AE2C", func_8017F8A8); -INCLUDE_ASM("asm/ov_SC03_119/nonmatchings/ov_SC03_119_jr_8017AE2C", func_8017F90C); +extern void func_8014659C(void); +extern void func_8001C810(s32 a0, s32 a1); +extern void func_80146CA0(void *a0); +extern void func_80162CCC(void); +void func_8017F90C(int param_1) { + + extern u16 D_800DF2E0; + extern s32 D_8018DA2C; + extern s32 D_8018DA88[]; + s32 iVar1; + iVar1 = ((s32 (*)(void))func_8014659C)(); + *(s32 *)(param_1 + 0x20) = iVar1; + if (iVar1 != 0) { + ((void (*)(s32, void *))func_8001C810)(iVar1, &D_800DF2E0); + *(s32 **)(iVar1 + 0x80) = &D_8018DA2C; + *(u32 *)(iVar1 + 4) = *(u32 *)(iVar1 + 4) | 0x50000000; + *(u16 *)(iVar1 + 0x2c) = *(u16 *)(iVar1 + 0x2c) | 0xb0; + *(s32 *)(param_1 + 0x58) = (s32)&D_8018DA88[*(s32 *)(param_1 + 0x50) * 2]; + *(u16 *)(iVar1 + 0x1c) = 0; + *(u16 *)(iVar1 + 0x1a) = 0; + *(u16 *)(iVar1 + 0x18) = 0; + ((void (*)(s32))func_80146CA0)(param_1); + } else { + ((void (*)(s32))func_80162CCC)(param_1); + } +} + /* func_8017F9BC — per-frame spin + clamp handler (ov_SC03_014, reach x8). diff --git a/src/ov_SC03_119/ov_SC03_119_jr_8017FB84.c b/src/ov_SC03_119/ov_SC03_119_jr_8017FB84.c index 93890ef7d4..22b0a0e610 100644 --- a/src/ov_SC03_119/ov_SC03_119_jr_8017FB84.c +++ b/src/ov_SC03_119/ov_SC03_119_jr_8017FB84.c @@ -3876,7 +3876,14 @@ INCLUDE_ASM("asm/ov_SC03_119/nonmatchings/ov_SC03_119_jr_8017FB84", func_80187AE INCLUDE_ASM("asm/ov_SC03_119/nonmatchings/ov_SC03_119_jr_8017FB84", func_80187B80); -INCLUDE_ASM("asm/ov_SC03_119/nonmatchings/ov_SC03_119_jr_8017FB84", func_80187CA8); + +extern void func_8012E688(s32 arg0, s32 arg1, s32 arg2); + void func_80187CA8(void *a0) { + if (*(s16 *)((s32)a0 + 0x76) > 0) { + func_8012E688((s32)a0, 0x8C6, 0); + } + } + extern void func_8012E688(s32 arg0, s32 arg1, s32 arg2); extern void func_8002AC00(s32 arg0); diff --git a/src/ov_SC03_121/ov_SC03_121_jr_80135D20.c b/src/ov_SC03_121/ov_SC03_121_jr_80135D20.c index ca9bb68686..327f68bcd2 100644 --- a/src/ov_SC03_121/ov_SC03_121_jr_80135D20.c +++ b/src/ov_SC03_121/ov_SC03_121_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_121/nonmatchings/ov_SC03_121_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80182738[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80182738[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80182738[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80182738[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80182738[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_121/ov_SC03_121_jr_80154C24.c b/src/ov_SC03_121/ov_SC03_121_jr_80154C24.c index f040d94742..47457946a6 100644 --- a/src/ov_SC03_121/ov_SC03_121_jr_80154C24.c +++ b/src/ov_SC03_121/ov_SC03_121_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_121/nonmatchings/ov_SC03_121_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801844C0)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801844C0[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801844C0[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_121/ov_SC03_121_jr_8017BEBC.c b/src/ov_SC03_121/ov_SC03_121_jr_8017BEBC.c index 798d5be108..e1dbf1ae7f 100644 --- a/src/ov_SC03_121/ov_SC03_121_jr_8017BEBC.c +++ b/src/ov_SC03_121/ov_SC03_121_jr_8017BEBC.c @@ -3169,7 +3169,17 @@ void func_8017BEBC(s32 arg0) } -INCLUDE_ASM("asm/ov_SC03_121/nonmatchings/ov_SC03_121_jr_8017BEBC", func_8017CD9C); + +extern void func_80019064(void *a0); + +void func_8017CD9C(void *a0) { + + extern u8 D_80185B70; + extern void (*D_80185B98[])(void *); + func_80019064(&D_80185B70); + D_80185B98[*(u16 *)((s32)a0 + 0x2)](a0); +} + extern void func_8014E934(s32 a0); extern void func_8014CC28(s32 a0); @@ -3191,7 +3201,17 @@ INCLUDE_ASM("asm/ov_SC03_121/nonmatchings/ov_SC03_121_jr_8017BEBC", func_8017CEA INCLUDE_ASM("asm/ov_SC03_121/nonmatchings/ov_SC03_121_jr_8017BEBC", func_8017D024); -INCLUDE_ASM("asm/ov_SC03_121/nonmatchings/ov_SC03_121_jr_8017BEBC", func_8017D064); + +extern void func_80019064(void *a0); + +void func_8017D064(void *a0) { + + extern u8 D_80185BA4; + extern void (*D_80185BCC[])(void *); + func_80019064(&D_80185BA4); + D_80185BCC[*(u16 *)((s32)a0 + 0x2)](a0); +} + extern void func_8014E934(s32 a0); extern void func_8014CC28(s32 a0); diff --git a/src/ov_SC03_124/ov_SC03_124_jr_80135D20.c b/src/ov_SC03_124/ov_SC03_124_jr_80135D20.c index a58f663c26..410b61c02f 100644 --- a/src/ov_SC03_124/ov_SC03_124_jr_80135D20.c +++ b/src/ov_SC03_124/ov_SC03_124_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_124/nonmatchings/ov_SC03_124_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018B164[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018B164[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018B164[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018B164[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018B164[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_124/ov_SC03_124_jr_80154C24.c b/src/ov_SC03_124/ov_SC03_124_jr_80154C24.c index e575608f00..1d0a815d51 100644 --- a/src/ov_SC03_124/ov_SC03_124_jr_80154C24.c +++ b/src/ov_SC03_124/ov_SC03_124_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_124/nonmatchings/ov_SC03_124_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018CEEC)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018CEEC[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018CEEC[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_124/ov_SC03_124_jr_8017AE2C.c b/src/ov_SC03_124/ov_SC03_124_jr_8017AE2C.c index da10c2e7b8..dc1e5283da 100644 --- a/src/ov_SC03_124/ov_SC03_124_jr_8017AE2C.c +++ b/src/ov_SC03_124/ov_SC03_124_jr_8017AE2C.c @@ -5302,7 +5302,21 @@ INCLUDE_ASM("asm/ov_SC03_124/nonmatchings/ov_SC03_124_jr_8017AE2C", func_80184FC INCLUDE_ASM("asm/ov_SC03_124/nonmatchings/ov_SC03_124_jr_8017AE2C", func_8018502C); -INCLUDE_ASM("asm/ov_SC03_124/nonmatchings/ov_SC03_124_jr_8017AE2C", func_801850A0); +void func_801850A0(s32 a0) { + + extern s16 D_801BBED0[]; + extern s32 D_801BBE90[][2]; + *(s16 *)(a0 + 0x2) = 3; + *(s16 *)(a0 + 0x34) = 0; + *(s16 *)(a0 + 0xFE) = 0; + *(s16 *)(a0 + 0x100) = 0; + *(s16 *)(a0 + 0x102) = 2; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x24) = D_801BBE90[D_801BBED0[*(s16 *)(a0 + 0x70)]][0]; + *(s16 *)(a0 + 0x84) = 0; + *(s16 *)(a0 + 0x5C) = 0x800; + *(s32 *)(a0 + 0xB0) = 0; +} + INCLUDE_ASM("asm/ov_SC03_124/nonmatchings/ov_SC03_124_jr_8017AE2C", func_80185100); diff --git a/src/ov_SC03_125/ov_SC03_125_jr_80135D20.c b/src/ov_SC03_125/ov_SC03_125_jr_80135D20.c index 6ac0fe6879..02268d8214 100644 --- a/src/ov_SC03_125/ov_SC03_125_jr_80135D20.c +++ b/src/ov_SC03_125/ov_SC03_125_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_125/nonmatchings/ov_SC03_125_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80184334[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80184334[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80184334[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80184334[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80184334[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_125/ov_SC03_125_jr_80154C24.c b/src/ov_SC03_125/ov_SC03_125_jr_80154C24.c index 278ba6ebe5..7af025364d 100644 --- a/src/ov_SC03_125/ov_SC03_125_jr_80154C24.c +++ b/src/ov_SC03_125/ov_SC03_125_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_125/nonmatchings/ov_SC03_125_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801860BC)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801860BC[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801860BC[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC03_125/ov_SC03_125_jr_8017D604.c b/src/ov_SC03_125/ov_SC03_125_jr_8017D604.c index da9c2f86bd..2f149a4f01 100644 --- a/src/ov_SC03_125/ov_SC03_125_jr_8017D604.c +++ b/src/ov_SC03_125/ov_SC03_125_jr_8017D604.c @@ -1674,7 +1674,6 @@ extern void func_8016634C(void *a0); extern void func_801663A4(void *a0); extern void (*D_80186C68[])(void); extern void func_801663FC(void *a0); -extern u8 D_800D387C[]; extern u8 D_800D3888[]; extern s32 func_800D21C4(s32 a0, void *a1, s32 a2); extern void func_800D1FC8(s32 a0, s32 a1); @@ -3419,7 +3418,23 @@ INCLUDE_ASM("asm/ov_SC03_125/nonmatchings/ov_SC03_125_jr_8017D604", func_8017F62 INCLUDE_ASM("asm/ov_SC03_125/nonmatchings/ov_SC03_125_jr_8017D604", func_8017F68C); -INCLUDE_ASM("asm/ov_SC03_125/nonmatchings/ov_SC03_125_jr_8017D604", func_8017F700); + +/* func_8017F700 — guarded dispatch: ask func_801819DC(9, 0x12); if it answers + * NON-zero, run func_8017F2F4 on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_801819DC(s32 arg0, s32 arg1); +extern void func_8017F2F4(void *arg0); + +void func_8017F700(void *arg0) { + if (func_801819DC(9, 0x12) != 0) { + func_8017F2F4(arg0); + } +} + /* func_8017F740 — guarded dispatch: ask func_801819DC(9, 0x12); if it answers @@ -3494,7 +3509,27 @@ void func_8018038C(void *a0) { } -INCLUDE_ASM("asm/ov_SC03_125/nonmatchings/ov_SC03_125_jr_8017D604", func_801803C8); + +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); + +void func_801803C8(s32 arg0) { + + extern u8 D_800D387C[]; + s32 iVar1; + + iVar1 = *(s32 *)(arg0 + 0x20); + ((void (*)(s32, s32, s32, s32))func_8001CC3C)(iVar1, (s32)&D_800D387C, 0x270, 0x120); + *(u8 *)(iVar1 + 0x27) = 0x9C; + *(u16 *)(iVar1 + 0x1A) = 0x7000; + *(u16 *)(iVar1 + 0x18) = 0x7000; + *(u8 *)(iVar1 + 0x26) = 0x90; + *(u8 *)(iVar1 + 0x25) = 0x90; + *(u8 *)(iVar1 + 0x24) = 0x90; + *(u32 *)(iVar1 + 4) = *(u32 *)(iVar1 + 4) | 0x50000000; + *(s16 *)(arg0 + 0x2C) = 0x20; + *(s16 *)(arg0 + 0x2) += 1; +} + INCLUDE_ASM("asm/ov_SC03_125/nonmatchings/ov_SC03_125_jr_8017D604", func_80180458); @@ -3842,7 +3877,21 @@ INCLUDE_ASM("asm/ov_SC03_125/nonmatchings/ov_SC03_125_jr_8017D604", func_801826C INCLUDE_ASM("asm/ov_SC03_125/nonmatchings/ov_SC03_125_jr_8017D604", func_80182734); -INCLUDE_ASM("asm/ov_SC03_125/nonmatchings/ov_SC03_125_jr_8017D604", func_801827A8); +void func_801827A8(s32 a0) { + + extern s16 D_801A67D8[]; + extern s32 D_801A6798[][2]; + *(s16 *)(a0 + 0x2) = 3; + *(s16 *)(a0 + 0x34) = 0; + *(s16 *)(a0 + 0xFE) = 0; + *(s16 *)(a0 + 0x100) = 0; + *(s16 *)(a0 + 0x102) = 2; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x24) = D_801A6798[D_801A67D8[*(s16 *)(a0 + 0x70)]][0]; + *(s16 *)(a0 + 0x84) = 0; + *(s16 *)(a0 + 0x5C) = 0x800; + *(s32 *)(a0 + 0xB0) = 0; +} + INCLUDE_ASM("asm/ov_SC03_125/nonmatchings/ov_SC03_125_jr_8017D604", func_80182808); diff --git a/src/ov_SC03_126/ov_SC03_126_jr_80135D20.c b/src/ov_SC03_126/ov_SC03_126_jr_80135D20.c index fb9ff7e2ab..31e962a90f 100644 --- a/src/ov_SC03_126/ov_SC03_126_jr_80135D20.c +++ b/src/ov_SC03_126/ov_SC03_126_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_126/nonmatchings/ov_SC03_126_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017F82C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017F82C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017F82C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017F82C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017F82C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC03_126/ov_SC03_126_jr_80154C24.c b/src/ov_SC03_126/ov_SC03_126_jr_80154C24.c index 91ce321110..6d8ef76d83 100644 --- a/src/ov_SC03_126/ov_SC03_126_jr_80154C24.c +++ b/src/ov_SC03_126/ov_SC03_126_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC03_126/nonmatchings/ov_SC03_126_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801815B4)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801815B4[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801815B4[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_000/ov_SC04_000_jr_80135D20.c b/src/ov_SC04_000/ov_SC04_000_jr_80135D20.c index 67a1523d88..dea5dc42cf 100644 --- a/src/ov_SC04_000/ov_SC04_000_jr_80135D20.c +++ b/src/ov_SC04_000/ov_SC04_000_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80183838[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80183838[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80183838[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80183838[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80183838[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_000/ov_SC04_000_jr_80154C24.c b/src/ov_SC04_000/ov_SC04_000_jr_80154C24.c index 03180466c4..3289be83ee 100644 --- a/src/ov_SC04_000/ov_SC04_000_jr_80154C24.c +++ b/src/ov_SC04_000/ov_SC04_000_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801855C0)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801855C0[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801855C0[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_000/ov_SC04_000_jr_8017BEBC.c b/src/ov_SC04_000/ov_SC04_000_jr_8017BEBC.c index fcaf413026..a2ab8d0408 100644 --- a/src/ov_SC04_000/ov_SC04_000_jr_8017BEBC.c +++ b/src/ov_SC04_000/ov_SC04_000_jr_8017BEBC.c @@ -384,7 +384,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3216,7 +3215,15 @@ void func_8017DBF0(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8017DC2C); +extern void func_80147324(s32 arg0); +void func_8017DC2C(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3245,7 +3252,20 @@ INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8017DCD INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8017DD5C); -INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8017DEC4); +extern void func_8017DF10(int); +extern void func_80146C3C(void); +void func_8017DEC4(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017DF10(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8017DF10); @@ -3257,7 +3277,13 @@ void func_8017E21C(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8017E258); +extern void func_80147324(s32 arg0); +void func_8017E258(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017E298 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3359,7 +3385,25 @@ void func_8017E394(void *a0) } -INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8017E468); +extern void func_8017DF10(int); +extern void func_80146C3C(void); +void func_8017E468(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017DF10)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_80186E00[])(void); @@ -3371,7 +3415,22 @@ void func_8017E4BC(void *a0) { INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8017E4F8); -INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8017E5AC); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017E608(void *a0); +void func_8017E5AC(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017E608(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8017E608); @@ -3595,7 +3654,51 @@ void func_8017F4A4(s32 *a0) { INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8017F4D8); -INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8017F628); + +extern void func_80149350(s32 arg0); +extern void func_8012F214(s32 a0, s32 a1, s32 a2); +extern s32 func_8012E544(s32 a0); +extern u8 *func_801290DC(s32 a0, u8 *a1); + +void func_8017F628(void *a0) { + + extern u8 D_801202A0[]; + extern u8 D_801870F8[]; + s32 t; + u8 *r; + u8 *p; + s32 i; + s32 o; + s16 out[4]; + + t = *(s16 *)((s32)a0 + 0x70); + r = &D_801870F8[t * 8]; + switch (t) { + case 0: + ((void (*)(void *, void *, void *))func_80149350)(&D_80126B58, r, out); + func_801290DC(0x56, (u8 *)out); + break; + case 1: + o = func_8012E544(0x245); + if (o == 0) { + return; + } + ((void (*)(void *, void *, void *))func_8012F214)((void *)o, r, out); + func_801290DC(0x56, (u8 *)out); + break; + default: + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == *(s16 *)(r + 6)) { + ((void (*)(void *, void *, void *))func_8012F214)(p, r, out); + func_801290DC(0x56, (u8 *)out); + } + p += 0x10C; + } + break; + } +} + extern void (*D_8018712C[])(void); @@ -3605,7 +3708,43 @@ void func_8017F714(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8017F750); + +/* func_8017F750 — state entry: init the sub-object at +4/+0x10, bind the + * primitive at +0x20 to the command list D_80187120 (0x270 / 0x100), paint + * its RGB (0x40,0x40,0x40) + code 0x9C, OR 0xD0000000 into its tag word, + * clear the counter at +0x2C, then seed three random fields and bump the + * state word at +2. + */ + +extern void func_800159E4(s32 a0, s32 a1); +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); +extern void func_80146E90(s32 *a0, s32 a1); +extern int rand(void); + +void func_8017F750(int param_1) +{ + extern unsigned char D_80187120[]; + int p; + int r1; + int r2; + + p = *(int *)(param_1 + 0x20); + ((void (*)(int, int))func_800159E4)(param_1 + 4, param_1 + 0x10); + ((void (*)(int, int, int, int))func_8001CC3C)(p, (int)D_80187120, 0x270, 0x100); + *(unsigned char *)(p + 0x27) = 0x9c; + *(unsigned char *)(p + 0x26) = 0x40; + *(unsigned char *)(p + 0x25) = 0x40; + *(unsigned char *)(p + 0x24) = 0x40; + *(unsigned int *)(p + 4) = *(unsigned int *)(p + 4) | 0xd0000000; + *(int *)(param_1 + 0x2c) = 0; + *(unsigned short *)(param_1 + 0x30) = (rand() & 3) + 1; + r1 = rand(); + r2 = rand(); + *(unsigned short *)(p + 0x12) = (r1 & 3) * 0x400 + (r2 & 0xf) * 0x44; + ((void (*)(int, int))func_80146E90)(param_1, rand() & 0xf); + *(unsigned short *)(param_1 + 2) = *(unsigned short *)(param_1 + 2) + 1; +} + INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8017F834); @@ -3845,7 +3984,31 @@ INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_80181D5 INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_80181FE4); -INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_80182178); + +/* func_80182178 — "is another entity of type 0x35C sharing my 0x64 owner?" + * + * Walks the 0x60-entry entity table at D_801202A0 (stride 0x10C) with an int + * counter (the target keeps the count in $a2 and `slti ...,0x60`, so it is a + * counted loop, NOT the D_80126720 pointer-bound idiom the sibling walkers + * use). Returns 1 for the first entry whose u16 kind == 0x35C, whose word at + * 0x64 equals the caller's word at 0x64, and which is not the caller itself. + */ +s32 func_80182178(s32 arg0) { + extern u8 D_801202A0[]; + u8 *p; + s32 i; + + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == 0x35C && *(s32 *)(arg0 + 0x64) == *(s32 *)(p + 0x64) && + arg0 != (s32)p) { + return 1; + } + p += 0x10C; + } + return 0; +} + extern void func_8012EC04(s32 param_1, s32 param_2, s32 *param_3); @@ -3867,7 +4030,24 @@ void func_801821D0(s32 arg0) { } -INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_8018224C); + +/* func_8018224C — guard-then-free tail (cookbook §71 sibling shape: + * src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c func_80144458 tail, and + * src/ov_SC03_099/ov_SC03_099_jr_80140608.c:2432 func_80016714(x, 0x38)). */ + +extern void func_80016714(void *a0, s32 a1); +extern void func_8012C218(void *a0); + +void func_8018224C(void *arg0) { + void *temp_a0; + + temp_a0 = *(void **)((char *)arg0 + 0xCC); + if (temp_a0 != NULL) { + func_80016714(temp_a0, 0x38); + } + func_8012C218(arg0); +} + INCLUDE_ASM("asm/ov_SC04_000/nonmatchings/ov_SC04_000_jr_8017BEBC", func_80182290); diff --git a/src/ov_SC04_002/ov_SC04_002_jr_80135D20.c b/src/ov_SC04_002/ov_SC04_002_jr_80135D20.c index c67afc46e5..cb0cd05539 100644 --- a/src/ov_SC04_002/ov_SC04_002_jr_80135D20.c +++ b/src/ov_SC04_002/ov_SC04_002_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801889A4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801889A4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801889A4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801889A4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801889A4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_002/ov_SC04_002_jr_80154C24.c b/src/ov_SC04_002/ov_SC04_002_jr_80154C24.c index bb20a272cb..d46fb8848b 100644 --- a/src/ov_SC04_002/ov_SC04_002_jr_80154C24.c +++ b/src/ov_SC04_002/ov_SC04_002_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018A72C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018A72C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018A72C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_002/ov_SC04_002_jr_8017BEBC.c b/src/ov_SC04_002/ov_SC04_002_jr_8017BEBC.c index d9dda2afbf..1385f18093 100644 --- a/src/ov_SC04_002/ov_SC04_002_jr_8017BEBC.c +++ b/src/ov_SC04_002/ov_SC04_002_jr_8017BEBC.c @@ -52,7 +52,6 @@ extern s32 func_80165A50(s32); extern void func_80029514(s32); extern u8 D_800AF630[]; extern u8 D_80078EC0; -extern s32 D_80126B58; extern s32 func_80028FBC(void); extern s32 func_80029000(void); extern s32 func_80028D9C(void); @@ -383,7 +382,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3169,7 +3167,17 @@ void func_8017BEBC(s32 arg0) } -INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8017CD9C); + +extern void func_80019064(void *a0); + +void func_8017CD9C(void *a0) { + + extern u8 D_8018BE1C; + extern void (*D_8018BE74[])(void *); + func_80019064(&D_8018BE1C); + D_8018BE74[*(u16 *)((s32)a0 + 0x2)](a0); +} + extern void func_8014E934(s32 a0); extern void func_8014CC28(s32 a0); @@ -3243,7 +3251,15 @@ void func_8017DF0C(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8017DF48); +extern void func_80147324(s32 arg0); +void func_8017DF48(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3272,7 +3288,20 @@ INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8017DFF INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8017E078); -INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8017E1E0); +extern void func_8017E22C(int); +extern void func_80146C3C(void); +void func_8017E1E0(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017E22C(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8017E22C); @@ -3284,7 +3313,13 @@ void func_8017E538(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8017E574); +extern void func_80147324(s32 arg0); +void func_8017E574(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017E5B4 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3386,7 +3421,25 @@ void func_8017E6B0(void *a0) } -INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8017E784); +extern void func_8017E22C(int); +extern void func_80146C3C(void); +void func_8017E784(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017E22C)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_8018C010[])(void); @@ -3398,11 +3451,36 @@ void func_8017E7D8(void *a0) { INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8017E814); -INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8017E8C8); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017E924(void *a0); +void func_8017E8C8(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017E924(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8017E924); -INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8017EA94); + +extern void func_80019064(void *a0); + +void func_8017EA94(void *a0) { + + extern u8 D_8018C018; + extern void (*D_8018C03C[])(void *); + func_80019064(&D_8018C018); + D_8018C03C[*(u16 *)((s32)a0 + 0x2)](a0); +} + extern void func_8014E934(s32 a0); extern void func_8014CC28(s32 a0); @@ -3676,7 +3754,52 @@ void func_801802F8(s32 *a0) { INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8018032C); -INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8018047C); + +extern void func_80149350(s32 arg0); +extern void func_8012F214(s32 a0, s32 a1, s32 a2); +extern s32 func_8012E544(s32 a0); +extern u8 *func_801290DC(s32 a0, u8 *a1); + +void func_8018047C(void *a0) { + + extern s32 D_80126B58; + extern u8 D_801202A0[]; + extern u8 D_8018C578[]; + s32 t; + u8 *r; + u8 *p; + s32 i; + s32 o; + s16 out[4]; + + t = *(s16 *)((s32)a0 + 0x70); + r = &D_8018C578[t * 8]; + switch (t) { + case 0: + ((void (*)(void *, void *, void *))func_80149350)(&D_80126B58, r, out); + func_801290DC(0x56, (u8 *)out); + break; + case 1: + o = func_8012E544(0x245); + if (o == 0) { + return; + } + ((void (*)(void *, void *, void *))func_8012F214)((void *)o, r, out); + func_801290DC(0x56, (u8 *)out); + break; + default: + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == *(s16 *)(r + 6)) { + ((void (*)(void *, void *, void *))func_8012F214)(p, r, out); + func_801290DC(0x56, (u8 *)out); + } + p += 0x10C; + } + break; + } +} + extern void (*D_8018C5AC[])(void); @@ -3686,13 +3809,59 @@ void func_80180568(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_801805A4); + +/* func_801805A4 — state entry: init the sub-object at +4/+0x10, bind the + * primitive at +0x20 to the command list D_8018C5A0 (0x270 / 0x100), paint + * its RGB (0x40,0x40,0x40) + code 0x9C, OR 0xD0000000 into its tag word, + * clear the counter at +0x2C, then seed three random fields and bump the + * state word at +2. + */ + +extern void func_800159E4(s32 a0, s32 a1); +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); +extern void func_80146E90(s32 *a0, s32 a1); +extern int rand(void); + +void func_801805A4(int param_1) +{ + extern unsigned char D_8018C5A0[]; + int p; + int r1; + int r2; + + p = *(int *)(param_1 + 0x20); + ((void (*)(int, int))func_800159E4)(param_1 + 4, param_1 + 0x10); + ((void (*)(int, int, int, int))func_8001CC3C)(p, (int)D_8018C5A0, 0x270, 0x100); + *(unsigned char *)(p + 0x27) = 0x9c; + *(unsigned char *)(p + 0x26) = 0x40; + *(unsigned char *)(p + 0x25) = 0x40; + *(unsigned char *)(p + 0x24) = 0x40; + *(unsigned int *)(p + 4) = *(unsigned int *)(p + 4) | 0xd0000000; + *(int *)(param_1 + 0x2c) = 0; + *(unsigned short *)(param_1 + 0x30) = (rand() & 3) + 1; + r1 = rand(); + r2 = rand(); + *(unsigned short *)(p + 0x12) = (r1 & 3) * 0x400 + (r2 & 0xf) * 0x44; + ((void (*)(int, int))func_80146E90)(param_1, rand() & 0xf); + *(unsigned short *)(param_1 + 2) = *(unsigned short *)(param_1 + 2) + 1; +} + INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_80180688); INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_801806F4); -INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_801807E0); + +extern void func_80019064(void *a0); + +void func_801807E0(void *a0) { + + extern u8 D_80198CEC; + extern void (*D_80198D14[])(void *); + func_80019064(&D_80198CEC); + D_80198D14[*(u16 *)((s32)a0 + 0x2)](a0); +} + INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_80180838); @@ -4808,7 +4977,31 @@ INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_80187E0 INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_80188098); -INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_8018822C); + +/* func_8018822C — "is another entity of type 0x35C sharing my 0x64 owner?" + * + * Walks the 0x60-entry entity table at D_801202A0 (stride 0x10C) with an int + * counter (the target keeps the count in $a2 and `slti ...,0x60`, so it is a + * counted loop, NOT the D_80126720 pointer-bound idiom the sibling walkers + * use). Returns 1 for the first entry whose u16 kind == 0x35C, whose word at + * 0x64 equals the caller's word at 0x64, and which is not the caller itself. + */ +s32 func_8018822C(s32 arg0) { + extern u8 D_801202A0[]; + u8 *p; + s32 i; + + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == 0x35C && *(s32 *)(arg0 + 0x64) == *(s32 *)(p + 0x64) && + arg0 != (s32)p) { + return 1; + } + p += 0x10C; + } + return 0; +} + extern void func_8012EC04(s32 param_1, s32 param_2, s32 *param_3); @@ -4830,7 +5023,24 @@ void func_80188284(s32 arg0) { } -INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_80188300); + +/* func_80188300 — guard-then-free tail (cookbook §71 sibling shape: + * src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c func_80144458 tail, and + * src/ov_SC03_099/ov_SC03_099_jr_80140608.c:2432 func_80016714(x, 0x38)). */ + +extern void func_80016714(void *a0, s32 a1); +extern void func_8012C218(void *a0); + +void func_80188300(void *arg0) { + void *temp_a0; + + temp_a0 = *(void **)((char *)arg0 + 0xCC); + if (temp_a0 != NULL) { + func_80016714(temp_a0, 0x38); + } + func_8012C218(arg0); +} + INCLUDE_ASM("asm/ov_SC04_002/nonmatchings/ov_SC04_002_jr_8017BEBC", func_80188344); diff --git a/src/ov_SC04_003/ov_SC04_003_jr_80135D20.c b/src/ov_SC04_003/ov_SC04_003_jr_80135D20.c index 95c294b531..4cf486cccf 100644 --- a/src/ov_SC04_003/ov_SC04_003_jr_80135D20.c +++ b/src/ov_SC04_003/ov_SC04_003_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_003/nonmatchings/ov_SC04_003_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80182740[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80182740[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80182740[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80182740[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80182740[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_003/ov_SC04_003_jr_80154C24.c b/src/ov_SC04_003/ov_SC04_003_jr_80154C24.c index b62c7fe14f..c8d89a3513 100644 --- a/src/ov_SC04_003/ov_SC04_003_jr_80154C24.c +++ b/src/ov_SC04_003/ov_SC04_003_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_003/nonmatchings/ov_SC04_003_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801844C8)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801844C8[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801844C8[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_003/ov_SC04_003_jr_8017BEBC.c b/src/ov_SC04_003/ov_SC04_003_jr_8017BEBC.c index 988ae17283..216645a484 100644 --- a/src/ov_SC04_003/ov_SC04_003_jr_8017BEBC.c +++ b/src/ov_SC04_003/ov_SC04_003_jr_8017BEBC.c @@ -383,7 +383,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3373,7 +3372,51 @@ void func_8017D738(s32 *a0) { INCLUDE_ASM("asm/ov_SC04_003/nonmatchings/ov_SC04_003_jr_8017BEBC", func_8017D76C); -INCLUDE_ASM("asm/ov_SC04_003/nonmatchings/ov_SC04_003_jr_8017BEBC", func_8017D8BC); + +extern void func_80149350(s32 arg0); +extern void func_8012F214(s32 a0, s32 a1, s32 a2); +extern s32 func_8012E544(s32 a0); +extern u8 *func_801290DC(s32 a0, u8 *a1); + +void func_8017D8BC(void *a0) { + + extern u8 D_801202A0[]; + extern u8 D_80185CD4[]; + s32 t; + u8 *r; + u8 *p; + s32 i; + s32 o; + s16 out[4]; + + t = *(s16 *)((s32)a0 + 0x70); + r = &D_80185CD4[t * 8]; + switch (t) { + case 0: + ((void (*)(void *, void *, void *))func_80149350)(&D_80126B58, r, out); + func_801290DC(0x56, (u8 *)out); + break; + case 1: + o = func_8012E544(0x245); + if (o == 0) { + return; + } + ((void (*)(void *, void *, void *))func_8012F214)((void *)o, r, out); + func_801290DC(0x56, (u8 *)out); + break; + default: + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == *(s16 *)(r + 6)) { + ((void (*)(void *, void *, void *))func_8012F214)(p, r, out); + func_801290DC(0x56, (u8 *)out); + } + p += 0x10C; + } + break; + } +} + extern void (*D_80185D08[])(void); @@ -3383,7 +3426,43 @@ void func_8017D9A8(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_003/nonmatchings/ov_SC04_003_jr_8017BEBC", func_8017D9E4); + +/* func_8017D9E4 — state entry: init the sub-object at +4/+0x10, bind the + * primitive at +0x20 to the command list D_80185CFC (0x270 / 0x100), paint + * its RGB (0x40,0x40,0x40) + code 0x9C, OR 0xD0000000 into its tag word, + * clear the counter at +0x2C, then seed three random fields and bump the + * state word at +2. + */ + +extern void func_800159E4(s32 a0, s32 a1); +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); +extern void func_80146E90(s32 *a0, s32 a1); +extern int rand(void); + +void func_8017D9E4(int param_1) +{ + extern unsigned char D_80185CFC[]; + int p; + int r1; + int r2; + + p = *(int *)(param_1 + 0x20); + ((void (*)(int, int))func_800159E4)(param_1 + 4, param_1 + 0x10); + ((void (*)(int, int, int, int))func_8001CC3C)(p, (int)D_80185CFC, 0x270, 0x100); + *(unsigned char *)(p + 0x27) = 0x9c; + *(unsigned char *)(p + 0x26) = 0x40; + *(unsigned char *)(p + 0x25) = 0x40; + *(unsigned char *)(p + 0x24) = 0x40; + *(unsigned int *)(p + 4) = *(unsigned int *)(p + 4) | 0xd0000000; + *(int *)(param_1 + 0x2c) = 0; + *(unsigned short *)(param_1 + 0x30) = (rand() & 3) + 1; + r1 = rand(); + r2 = rand(); + *(unsigned short *)(p + 0x12) = (r1 & 3) * 0x400 + (r2 & 0xf) * 0x44; + ((void (*)(int, int))func_80146E90)(param_1, rand() & 0xf); + *(unsigned short *)(param_1 + 2) = *(unsigned short *)(param_1 + 2) + 1; +} + INCLUDE_ASM("asm/ov_SC04_003/nonmatchings/ov_SC04_003_jr_8017BEBC", func_8017DAC8); diff --git a/src/ov_SC04_004/ov_SC04_004_jr_80135D20.c b/src/ov_SC04_004/ov_SC04_004_jr_80135D20.c index 7cc6942a7f..0ed5fe0ecf 100644 --- a/src/ov_SC04_004/ov_SC04_004_jr_80135D20.c +++ b/src/ov_SC04_004/ov_SC04_004_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80184C74[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80184C74[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80184C74[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80184C74[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80184C74[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_004/ov_SC04_004_jr_80154C24.c b/src/ov_SC04_004/ov_SC04_004_jr_80154C24.c index 6dfb08fa8a..efb0cd8ac2 100644 --- a/src/ov_SC04_004/ov_SC04_004_jr_80154C24.c +++ b/src/ov_SC04_004/ov_SC04_004_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801869FC)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801869FC[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801869FC[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_004/ov_SC04_004_jr_8017AE2C.c b/src/ov_SC04_004/ov_SC04_004_jr_8017AE2C.c index e61506490b..1064df10b5 100644 --- a/src/ov_SC04_004/ov_SC04_004_jr_8017AE2C.c +++ b/src/ov_SC04_004/ov_SC04_004_jr_8017AE2C.c @@ -50,7 +50,6 @@ extern s32 func_80165A50(s32); extern void func_80029514(s32); extern u8 D_800AF630[]; extern u8 D_80078EC0; -extern s32 D_80126B58; extern s32 func_80028FBC(void); extern s32 func_80029000(void); extern s32 func_80028D9C(void); @@ -381,7 +380,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3828,7 +3826,15 @@ void func_8017DBF0(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_8017DC2C); +extern void func_80147324(s32 arg0); +void func_8017DC2C(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3857,7 +3863,20 @@ INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_8017DCD INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_8017DD5C); -INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_8017DEC4); +extern void func_8017DF10(int); +extern void func_80146C3C(void); +void func_8017DEC4(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017DF10(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_8017DF10); @@ -3869,7 +3888,13 @@ void func_8017E21C(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_8017E258); +extern void func_80147324(s32 arg0); +void func_8017E258(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017E298 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3971,7 +3996,25 @@ void func_8017E394(void *a0) } -INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_8017E468); +extern void func_8017DF10(int); +extern void func_80146C3C(void); +void func_8017E468(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017DF10)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_8018823C[])(void); @@ -3983,7 +4026,22 @@ void func_8017E4BC(void *a0) { INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_8017E4F8); -INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_8017E5AC); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017E608(void *a0); +void func_8017E5AC(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017E608(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_8017E608); @@ -4145,7 +4203,17 @@ s32 func_8017EF4C(void) { } -INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_8017EF54); + +extern void func_80019064(void *a0); + +void func_8017EF54(void *a0) { + + extern u8 D_80188354; + extern void (*D_80188378[])(void *); + func_80019064(&D_80188354); + D_80188378[*(u16 *)((s32)a0 + 0x2)](a0); +} + extern void func_8014E934(s32 a0); extern void func_8014CC28(s32 a0); @@ -4233,7 +4301,52 @@ extern void func_8012BF4C(s32 *a0, s16 a1); INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_8017FCF8); -INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_8017FE48); + +extern void func_80149350(s32 arg0); +extern void func_8012F214(s32 a0, s32 a1, s32 a2); +extern s32 func_8012E544(s32 a0); +extern u8 *func_801290DC(s32 a0, u8 *a1); + +void func_8017FE48(void *a0) { + + extern s32 D_80126B58; + extern u8 D_801202A0[]; + extern u8 D_80188700[]; + s32 t; + u8 *r; + u8 *p; + s32 i; + s32 o; + s16 out[4]; + + t = *(s16 *)((s32)a0 + 0x70); + r = &D_80188700[t * 8]; + switch (t) { + case 0: + ((void (*)(void *, void *, void *))func_80149350)(&D_80126B58, r, out); + func_801290DC(0x56, (u8 *)out); + break; + case 1: + o = func_8012E544(0x245); + if (o == 0) { + return; + } + ((void (*)(void *, void *, void *))func_8012F214)((void *)o, r, out); + func_801290DC(0x56, (u8 *)out); + break; + default: + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == *(s16 *)(r + 6)) { + ((void (*)(void *, void *, void *))func_8012F214)(p, r, out); + func_801290DC(0x56, (u8 *)out); + } + p += 0x10C; + } + break; + } +} + extern void (*D_80188734[])(void); @@ -4243,7 +4356,43 @@ void func_8017FF34(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_8017FF70); + +/* func_8017FF70 — state entry: init the sub-object at +4/+0x10, bind the + * primitive at +0x20 to the command list D_80188728 (0x270 / 0x100), paint + * its RGB (0x40,0x40,0x40) + code 0x9C, OR 0xD0000000 into its tag word, + * clear the counter at +0x2C, then seed three random fields and bump the + * state word at +2. + */ + +extern void func_800159E4(s32 a0, s32 a1); +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); +extern void func_80146E90(s32 *a0, s32 a1); +extern int rand(void); + +void func_8017FF70(int param_1) +{ + extern unsigned char D_80188728[]; + int p; + int r1; + int r2; + + p = *(int *)(param_1 + 0x20); + ((void (*)(int, int))func_800159E4)(param_1 + 4, param_1 + 0x10); + ((void (*)(int, int, int, int))func_8001CC3C)(p, (int)D_80188728, 0x270, 0x100); + *(unsigned char *)(p + 0x27) = 0x9c; + *(unsigned char *)(p + 0x26) = 0x40; + *(unsigned char *)(p + 0x25) = 0x40; + *(unsigned char *)(p + 0x24) = 0x40; + *(unsigned int *)(p + 4) = *(unsigned int *)(p + 4) | 0xd0000000; + *(int *)(param_1 + 0x2c) = 0; + *(unsigned short *)(param_1 + 0x30) = (rand() & 3) + 1; + r1 = rand(); + r2 = rand(); + *(unsigned short *)(p + 0x12) = (r1 & 3) * 0x400 + (r2 & 0xf) * 0x44; + ((void (*)(int, int))func_80146E90)(param_1, rand() & 0xf); + *(unsigned short *)(param_1 + 2) = *(unsigned short *)(param_1 + 2) + 1; +} + INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_80180054); @@ -4861,7 +5010,31 @@ INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_801840D INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_80184368); -INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_801844FC); + +/* func_801844FC — "is another entity of type 0x35C sharing my 0x64 owner?" + * + * Walks the 0x60-entry entity table at D_801202A0 (stride 0x10C) with an int + * counter (the target keeps the count in $a2 and `slti ...,0x60`, so it is a + * counted loop, NOT the D_80126720 pointer-bound idiom the sibling walkers + * use). Returns 1 for the first entry whose u16 kind == 0x35C, whose word at + * 0x64 equals the caller's word at 0x64, and which is not the caller itself. + */ +s32 func_801844FC(s32 arg0) { + extern u8 D_801202A0[]; + u8 *p; + s32 i; + + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == 0x35C && *(s32 *)(arg0 + 0x64) == *(s32 *)(p + 0x64) && + arg0 != (s32)p) { + return 1; + } + p += 0x10C; + } + return 0; +} + extern void func_8012EC04(s32 param_1, s32 param_2, s32 *param_3); @@ -4883,7 +5056,24 @@ void func_80184554(s32 arg0) { } -INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_801845D0); + +/* func_801845D0 — guard-then-free tail (cookbook §71 sibling shape: + * src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c func_80144458 tail, and + * src/ov_SC03_099/ov_SC03_099_jr_80140608.c:2432 func_80016714(x, 0x38)). */ + +extern void func_80016714(void *a0, s32 a1); +extern void func_8012C218(void *a0); + +void func_801845D0(void *arg0) { + void *temp_a0; + + temp_a0 = *(void **)((char *)arg0 + 0xCC); + if (temp_a0 != NULL) { + func_80016714(temp_a0, 0x38); + } + func_8012C218(arg0); +} + INCLUDE_ASM("asm/ov_SC04_004/nonmatchings/ov_SC04_004_jr_8017AE2C", func_80184614); diff --git a/src/ov_SC04_005/ov_SC04_005_jr_80135D20.c b/src/ov_SC04_005/ov_SC04_005_jr_80135D20.c index 82c5252535..a3b47ec3ce 100644 --- a/src/ov_SC04_005/ov_SC04_005_jr_80135D20.c +++ b/src/ov_SC04_005/ov_SC04_005_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801880A8[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801880A8[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801880A8[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801880A8[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801880A8[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_005/ov_SC04_005_jr_80154C24.c b/src/ov_SC04_005/ov_SC04_005_jr_80154C24.c index 8d0ac23269..62b86e0ded 100644 --- a/src/ov_SC04_005/ov_SC04_005_jr_80154C24.c +++ b/src/ov_SC04_005/ov_SC04_005_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80189E30)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80189E30[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80189E30[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_005/ov_SC04_005_jr_8017BEBC.c b/src/ov_SC04_005/ov_SC04_005_jr_8017BEBC.c index 0b50af2d9c..e918f74b2d 100644 --- a/src/ov_SC04_005/ov_SC04_005_jr_8017BEBC.c +++ b/src/ov_SC04_005/ov_SC04_005_jr_8017BEBC.c @@ -384,7 +384,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3170,7 +3169,17 @@ void func_8017BEBC(s32 arg0) } -INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017CD9C); + +extern void func_80019064(void *a0); + +void func_8017CD9C(void *a0) { + + extern u8 D_8018B520; + extern void (*D_8018B578[])(void *); + func_80019064(&D_8018B520); + D_8018B578[*(u16 *)((s32)a0 + 0x2)](a0); +} + extern void func_8014E934(s32 a0); extern void func_8014CC28(s32 a0); @@ -3244,7 +3253,15 @@ void func_8017DF0C(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017DF48); +extern void func_80147324(s32 arg0); +void func_8017DF48(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3273,7 +3290,20 @@ INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017DFF INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017E078); -INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017E1E0); +extern void func_8017E22C(int); +extern void func_80146C3C(void); +void func_8017E1E0(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017E22C(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017E22C); @@ -3285,7 +3315,13 @@ void func_8017E538(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017E574); +extern void func_80147324(s32 arg0); +void func_8017E574(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017E5B4 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3387,7 +3423,25 @@ void func_8017E6B0(void *a0) } -INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017E784); +extern void func_8017E22C(int); +extern void func_80146C3C(void); +void func_8017E784(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017E22C)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_8018B714[])(void); @@ -3399,7 +3453,22 @@ void func_8017E7D8(void *a0) { INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017E814); -INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017E8C8); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017E924(void *a0); +void func_8017E8C8(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017E924(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017E924); @@ -3634,7 +3703,51 @@ void func_8017F710(s32 *a0) { INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017F744); -INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017F894); + +extern void func_80149350(s32 arg0); +extern void func_8012F214(s32 a0, s32 a1, s32 a2); +extern s32 func_8012E544(s32 a0); +extern u8 *func_801290DC(s32 a0, u8 *a1); + +void func_8017F894(void *a0) { + + extern u8 D_801202A0[]; + extern u8 D_8018B938[]; + s32 t; + u8 *r; + u8 *p; + s32 i; + s32 o; + s16 out[4]; + + t = *(s16 *)((s32)a0 + 0x70); + r = &D_8018B938[t * 8]; + switch (t) { + case 0: + ((void (*)(void *, void *, void *))func_80149350)(&D_80126B58, r, out); + func_801290DC(0x56, (u8 *)out); + break; + case 1: + o = func_8012E544(0x245); + if (o == 0) { + return; + } + ((void (*)(void *, void *, void *))func_8012F214)((void *)o, r, out); + func_801290DC(0x56, (u8 *)out); + break; + default: + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == *(s16 *)(r + 6)) { + ((void (*)(void *, void *, void *))func_8012F214)(p, r, out); + func_801290DC(0x56, (u8 *)out); + } + p += 0x10C; + } + break; + } +} + extern void (*D_8018B96C[])(void); @@ -3644,13 +3757,59 @@ void func_8017F980(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017F9BC); + +/* func_8017F9BC — state entry: init the sub-object at +4/+0x10, bind the + * primitive at +0x20 to the command list D_8018B960 (0x270 / 0x100), paint + * its RGB (0x40,0x40,0x40) + code 0x9C, OR 0xD0000000 into its tag word, + * clear the counter at +0x2C, then seed three random fields and bump the + * state word at +2. + */ + +extern void func_800159E4(s32 a0, s32 a1); +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); +extern void func_80146E90(s32 *a0, s32 a1); +extern int rand(void); + +void func_8017F9BC(int param_1) +{ + extern unsigned char D_8018B960[]; + int p; + int r1; + int r2; + + p = *(int *)(param_1 + 0x20); + ((void (*)(int, int))func_800159E4)(param_1 + 4, param_1 + 0x10); + ((void (*)(int, int, int, int))func_8001CC3C)(p, (int)D_8018B960, 0x270, 0x100); + *(unsigned char *)(p + 0x27) = 0x9c; + *(unsigned char *)(p + 0x26) = 0x40; + *(unsigned char *)(p + 0x25) = 0x40; + *(unsigned char *)(p + 0x24) = 0x40; + *(unsigned int *)(p + 4) = *(unsigned int *)(p + 4) | 0xd0000000; + *(int *)(param_1 + 0x2c) = 0; + *(unsigned short *)(param_1 + 0x30) = (rand() & 3) + 1; + r1 = rand(); + r2 = rand(); + *(unsigned short *)(p + 0x12) = (r1 & 3) * 0x400 + (r2 & 0xf) * 0x44; + ((void (*)(int, int))func_80146E90)(param_1, rand() & 0xf); + *(unsigned short *)(param_1 + 2) = *(unsigned short *)(param_1 + 2) + 1; +} + INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017FAA0); INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017FB0C); -INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017FBF8); + +extern void func_80019064(void *a0); + +void func_8017FBF8(void *a0) { + + extern u8 D_80199980; + extern void (*D_801999A8[])(void *); + func_80019064(&D_80199980); + D_801999A8[*(u16 *)((s32)a0 + 0x2)](a0); +} + INCLUDE_ASM("asm/ov_SC04_005/nonmatchings/ov_SC04_005_jr_8017BEBC", func_8017FC50); diff --git a/src/ov_SC04_006/ov_SC04_006_jr_80135D20.c b/src/ov_SC04_006/ov_SC04_006_jr_80135D20.c index a797aae294..77d6a00a8b 100644 --- a/src/ov_SC04_006/ov_SC04_006_jr_80135D20.c +++ b/src/ov_SC04_006/ov_SC04_006_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_006/nonmatchings/ov_SC04_006_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80180188[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80180188[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80180188[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80180188[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80180188[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_006/ov_SC04_006_jr_80154C24.c b/src/ov_SC04_006/ov_SC04_006_jr_80154C24.c index f197fc982b..22b2b50492 100644 --- a/src/ov_SC04_006/ov_SC04_006_jr_80154C24.c +++ b/src/ov_SC04_006/ov_SC04_006_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_006/nonmatchings/ov_SC04_006_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80181F10)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80181F10[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80181F10[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_006/ov_SC04_006_jr_8017BEBC.c b/src/ov_SC04_006/ov_SC04_006_jr_8017BEBC.c index 2b997b254a..bff2adecd1 100644 --- a/src/ov_SC04_006/ov_SC04_006_jr_8017BEBC.c +++ b/src/ov_SC04_006/ov_SC04_006_jr_8017BEBC.c @@ -384,7 +384,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3304,7 +3303,51 @@ void func_8017D67C(s32 *a0) { INCLUDE_ASM("asm/ov_SC04_006/nonmatchings/ov_SC04_006_jr_8017BEBC", func_8017D6B0); -INCLUDE_ASM("asm/ov_SC04_006/nonmatchings/ov_SC04_006_jr_8017BEBC", func_8017D800); + +extern void func_80149350(s32 arg0); +extern void func_8012F214(s32 a0, s32 a1, s32 a2); +extern s32 func_8012E544(s32 a0); +extern u8 *func_801290DC(s32 a0, u8 *a1); + +void func_8017D800(void *a0) { + + extern u8 D_801202A0[]; + extern u8 D_80183710[]; + s32 t; + u8 *r; + u8 *p; + s32 i; + s32 o; + s16 out[4]; + + t = *(s16 *)((s32)a0 + 0x70); + r = &D_80183710[t * 8]; + switch (t) { + case 0: + ((void (*)(void *, void *, void *))func_80149350)(&D_80126B58, r, out); + func_801290DC(0x56, (u8 *)out); + break; + case 1: + o = func_8012E544(0x245); + if (o == 0) { + return; + } + ((void (*)(void *, void *, void *))func_8012F214)((void *)o, r, out); + func_801290DC(0x56, (u8 *)out); + break; + default: + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == *(s16 *)(r + 6)) { + ((void (*)(void *, void *, void *))func_8012F214)(p, r, out); + func_801290DC(0x56, (u8 *)out); + } + p += 0x10C; + } + break; + } +} + extern void (*D_80183744[])(void); @@ -3314,7 +3357,43 @@ void func_8017D8EC(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_006/nonmatchings/ov_SC04_006_jr_8017BEBC", func_8017D928); + +/* func_8017D928 — state entry: init the sub-object at +4/+0x10, bind the + * primitive at +0x20 to the command list D_80183738 (0x270 / 0x100), paint + * its RGB (0x40,0x40,0x40) + code 0x9C, OR 0xD0000000 into its tag word, + * clear the counter at +0x2C, then seed three random fields and bump the + * state word at +2. + */ + +extern void func_800159E4(s32 a0, s32 a1); +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); +extern void func_80146E90(s32 *a0, s32 a1); +extern int rand(void); + +void func_8017D928(int param_1) +{ + extern unsigned char D_80183738[]; + int p; + int r1; + int r2; + + p = *(int *)(param_1 + 0x20); + ((void (*)(int, int))func_800159E4)(param_1 + 4, param_1 + 0x10); + ((void (*)(int, int, int, int))func_8001CC3C)(p, (int)D_80183738, 0x270, 0x100); + *(unsigned char *)(p + 0x27) = 0x9c; + *(unsigned char *)(p + 0x26) = 0x40; + *(unsigned char *)(p + 0x25) = 0x40; + *(unsigned char *)(p + 0x24) = 0x40; + *(unsigned int *)(p + 4) = *(unsigned int *)(p + 4) | 0xd0000000; + *(int *)(param_1 + 0x2c) = 0; + *(unsigned short *)(param_1 + 0x30) = (rand() & 3) + 1; + r1 = rand(); + r2 = rand(); + *(unsigned short *)(p + 0x12) = (r1 & 3) * 0x400 + (r2 & 0xf) * 0x44; + ((void (*)(int, int))func_80146E90)(param_1, rand() & 0xf); + *(unsigned short *)(param_1 + 2) = *(unsigned short *)(param_1 + 2) + 1; +} + INCLUDE_ASM("asm/ov_SC04_006/nonmatchings/ov_SC04_006_jr_8017BEBC", func_8017DA0C); @@ -3624,7 +3703,31 @@ INCLUDE_ASM("asm/ov_SC04_006/nonmatchings/ov_SC04_006_jr_8017BEBC", func_8017F5E INCLUDE_ASM("asm/ov_SC04_006/nonmatchings/ov_SC04_006_jr_8017BEBC", func_8017F87C); -INCLUDE_ASM("asm/ov_SC04_006/nonmatchings/ov_SC04_006_jr_8017BEBC", func_8017FA10); + +/* func_8017FA10 — "is another entity of type 0x35C sharing my 0x64 owner?" + * + * Walks the 0x60-entry entity table at D_801202A0 (stride 0x10C) with an int + * counter (the target keeps the count in $a2 and `slti ...,0x60`, so it is a + * counted loop, NOT the D_80126720 pointer-bound idiom the sibling walkers + * use). Returns 1 for the first entry whose u16 kind == 0x35C, whose word at + * 0x64 equals the caller's word at 0x64, and which is not the caller itself. + */ +s32 func_8017FA10(s32 arg0) { + extern u8 D_801202A0[]; + u8 *p; + s32 i; + + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == 0x35C && *(s32 *)(arg0 + 0x64) == *(s32 *)(p + 0x64) && + arg0 != (s32)p) { + return 1; + } + p += 0x10C; + } + return 0; +} + extern void func_8012EC04(s32 param_1, s32 param_2, s32 *param_3); @@ -3646,7 +3749,24 @@ void func_8017FA68(s32 arg0) { } -INCLUDE_ASM("asm/ov_SC04_006/nonmatchings/ov_SC04_006_jr_8017BEBC", func_8017FAE4); + +/* func_8017FAE4 — guard-then-free tail (cookbook §71 sibling shape: + * src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c func_80144458 tail, and + * src/ov_SC03_099/ov_SC03_099_jr_80140608.c:2432 func_80016714(x, 0x38)). */ + +extern void func_80016714(void *a0, s32 a1); +extern void func_8012C218(void *a0); + +void func_8017FAE4(void *arg0) { + void *temp_a0; + + temp_a0 = *(void **)((char *)arg0 + 0xCC); + if (temp_a0 != NULL) { + func_80016714(temp_a0, 0x38); + } + func_8012C218(arg0); +} + INCLUDE_ASM("asm/ov_SC04_006/nonmatchings/ov_SC04_006_jr_8017BEBC", func_8017FB28); diff --git a/src/ov_SC04_007/ov_SC04_007_jr_80135D20.c b/src/ov_SC04_007/ov_SC04_007_jr_80135D20.c index 3e780a29a1..7374c2160b 100644 --- a/src/ov_SC04_007/ov_SC04_007_jr_80135D20.c +++ b/src/ov_SC04_007/ov_SC04_007_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80186140[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80186140[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80186140[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80186140[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80186140[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_007/ov_SC04_007_jr_80154C24.c b/src/ov_SC04_007/ov_SC04_007_jr_80154C24.c index 2cd195707e..ad4665ff28 100644 --- a/src/ov_SC04_007/ov_SC04_007_jr_80154C24.c +++ b/src/ov_SC04_007/ov_SC04_007_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80187EC8)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80187EC8[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80187EC8[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_007/ov_SC04_007_jr_8017BEBC.c b/src/ov_SC04_007/ov_SC04_007_jr_8017BEBC.c index fac90e1585..24d1194418 100644 --- a/src/ov_SC04_007/ov_SC04_007_jr_8017BEBC.c +++ b/src/ov_SC04_007/ov_SC04_007_jr_8017BEBC.c @@ -384,7 +384,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3218,7 +3217,15 @@ void func_8017DBF0(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_8017DC2C); +extern void func_80147324(s32 arg0); +void func_8017DC2C(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3247,7 +3254,20 @@ INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_8017DCD INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_8017DD5C); -INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_8017DEC4); +extern void func_8017DF10(int); +extern void func_80146C3C(void); +void func_8017DEC4(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017DF10(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_8017DF10); @@ -3259,7 +3279,13 @@ void func_8017E21C(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_8017E258); +extern void func_80147324(s32 arg0); +void func_8017E258(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017E298 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3361,7 +3387,25 @@ void func_8017E394(void *a0) } -INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_8017E468); +extern void func_8017DF10(int); +extern void func_80146C3C(void); +void func_8017E468(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017DF10)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_80189708[])(void); @@ -3373,7 +3417,22 @@ void func_8017E4BC(void *a0) { INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_8017E4F8); -INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_8017E5AC); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017E608(void *a0); +void func_8017E5AC(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017E608(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_8017E608); @@ -3581,7 +3640,51 @@ void func_8017F14C(s32 *a0) { INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_8017F180); -INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_8017F2D0); + +extern void func_80149350(s32 arg0); +extern void func_8012F214(s32 a0, s32 a1, s32 a2); +extern s32 func_8012E544(s32 a0); +extern u8 *func_801290DC(s32 a0, u8 *a1); + +void func_8017F2D0(void *a0) { + + extern u8 D_801202A0[]; + extern u8 D_80189868[]; + s32 t; + u8 *r; + u8 *p; + s32 i; + s32 o; + s16 out[4]; + + t = *(s16 *)((s32)a0 + 0x70); + r = &D_80189868[t * 8]; + switch (t) { + case 0: + ((void (*)(void *, void *, void *))func_80149350)(&D_80126B58, r, out); + func_801290DC(0x56, (u8 *)out); + break; + case 1: + o = func_8012E544(0x245); + if (o == 0) { + return; + } + ((void (*)(void *, void *, void *))func_8012F214)((void *)o, r, out); + func_801290DC(0x56, (u8 *)out); + break; + default: + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == *(s16 *)(r + 6)) { + ((void (*)(void *, void *, void *))func_8012F214)(p, r, out); + func_801290DC(0x56, (u8 *)out); + } + p += 0x10C; + } + break; + } +} + extern void (*D_8018989C[])(void); @@ -3591,7 +3694,43 @@ void func_8017F3BC(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_8017F3F8); + +/* func_8017F3F8 — state entry: init the sub-object at +4/+0x10, bind the + * primitive at +0x20 to the command list D_80189890 (0x270 / 0x100), paint + * its RGB (0x40,0x40,0x40) + code 0x9C, OR 0xD0000000 into its tag word, + * clear the counter at +0x2C, then seed three random fields and bump the + * state word at +2. + */ + +extern void func_800159E4(s32 a0, s32 a1); +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); +extern void func_80146E90(s32 *a0, s32 a1); +extern int rand(void); + +void func_8017F3F8(int param_1) +{ + extern unsigned char D_80189890[]; + int p; + int r1; + int r2; + + p = *(int *)(param_1 + 0x20); + ((void (*)(int, int))func_800159E4)(param_1 + 4, param_1 + 0x10); + ((void (*)(int, int, int, int))func_8001CC3C)(p, (int)D_80189890, 0x270, 0x100); + *(unsigned char *)(p + 0x27) = 0x9c; + *(unsigned char *)(p + 0x26) = 0x40; + *(unsigned char *)(p + 0x25) = 0x40; + *(unsigned char *)(p + 0x24) = 0x40; + *(unsigned int *)(p + 4) = *(unsigned int *)(p + 4) | 0xd0000000; + *(int *)(param_1 + 0x2c) = 0; + *(unsigned short *)(param_1 + 0x30) = (rand() & 3) + 1; + r1 = rand(); + r2 = rand(); + *(unsigned short *)(p + 0x12) = (r1 & 3) * 0x400 + (r2 & 0xf) * 0x44; + ((void (*)(int, int))func_80146E90)(param_1, rand() & 0xf); + *(unsigned short *)(param_1 + 2) = *(unsigned short *)(param_1 + 2) + 1; +} + INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_8017F4DC); @@ -4023,7 +4162,17 @@ void func_80184E50(void *a0) { INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_80184EC0); -INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_80184FB8); + +extern void func_80019064(void *a0); + +void func_80184FB8(void *a0) { + + extern u8 D_801B2660; + extern void (*D_801B2688[])(void *); + func_80019064(&D_801B2660); + D_801B2688[*(u16 *)((s32)a0 + 0x2)](a0); +} + INCLUDE_ASM("asm/ov_SC04_007/nonmatchings/ov_SC04_007_jr_8017BEBC", func_80185010); diff --git a/src/ov_SC04_008/ov_SC04_008_jr_80135D20.c b/src/ov_SC04_008/ov_SC04_008_jr_80135D20.c index ee636e2b4a..fbf17965d3 100644 --- a/src/ov_SC04_008/ov_SC04_008_jr_80135D20.c +++ b/src/ov_SC04_008/ov_SC04_008_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_008/nonmatchings/ov_SC04_008_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017F078[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017F078[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017F078[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017F078[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017F078[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_008/ov_SC04_008_jr_80154C24.c b/src/ov_SC04_008/ov_SC04_008_jr_80154C24.c index d17af7294d..76dc0d8b72 100644 --- a/src/ov_SC04_008/ov_SC04_008_jr_80154C24.c +++ b/src/ov_SC04_008/ov_SC04_008_jr_80154C24.c @@ -1696,7 +1696,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_008/nonmatchings/ov_SC04_008_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80180E00)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80180E00[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80180E00[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_008/ov_SC04_008_jr_8017AE2C.c b/src/ov_SC04_008/ov_SC04_008_jr_8017AE2C.c index 460800bea7..99d4e44206 100644 --- a/src/ov_SC04_008/ov_SC04_008_jr_8017AE2C.c +++ b/src/ov_SC04_008/ov_SC04_008_jr_8017AE2C.c @@ -50,7 +50,6 @@ extern s32 func_80165A50(s32); extern void func_80029514(s32); extern u8 D_800AF630[]; extern u8 D_80078EC0; -extern s32 D_80126B58; extern s32 func_80028FBC(void); extern s32 func_80029000(void); extern s32 func_80028D9C(void); @@ -382,7 +381,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -4022,7 +4020,52 @@ void func_8017DEAC(s32 *a0) { INCLUDE_ASM("asm/ov_SC04_008/nonmatchings/ov_SC04_008_jr_8017AE2C", func_8017DEE0); -INCLUDE_ASM("asm/ov_SC04_008/nonmatchings/ov_SC04_008_jr_8017AE2C", func_8017E030); + +extern void func_80149350(s32 arg0); +extern void func_8012F214(s32 a0, s32 a1, s32 a2); +extern s32 func_8012E544(s32 a0); +extern u8 *func_801290DC(s32 a0, u8 *a1); + +void func_8017E030(void *a0) { + + extern s32 D_80126B58; + extern u8 D_801202A0[]; + extern u8 D_80182578[]; + s32 t; + u8 *r; + u8 *p; + s32 i; + s32 o; + s16 out[4]; + + t = *(s16 *)((s32)a0 + 0x70); + r = &D_80182578[t * 8]; + switch (t) { + case 0: + ((void (*)(void *, void *, void *))func_80149350)(&D_80126B58, r, out); + func_801290DC(0x56, (u8 *)out); + break; + case 1: + o = func_8012E544(0x245); + if (o == 0) { + return; + } + ((void (*)(void *, void *, void *))func_8012F214)((void *)o, r, out); + func_801290DC(0x56, (u8 *)out); + break; + default: + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == *(s16 *)(r + 6)) { + ((void (*)(void *, void *, void *))func_8012F214)(p, r, out); + func_801290DC(0x56, (u8 *)out); + } + p += 0x10C; + } + break; + } +} + extern void (*D_801825AC[])(void); @@ -4032,7 +4075,43 @@ void func_8017E11C(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_008/nonmatchings/ov_SC04_008_jr_8017AE2C", func_8017E158); + +/* func_8017E158 — state entry: init the sub-object at +4/+0x10, bind the + * primitive at +0x20 to the command list D_801825A0 (0x270 / 0x100), paint + * its RGB (0x40,0x40,0x40) + code 0x9C, OR 0xD0000000 into its tag word, + * clear the counter at +0x2C, then seed three random fields and bump the + * state word at +2. + */ + +extern void func_800159E4(s32 a0, s32 a1); +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); +extern void func_80146E90(s32 *a0, s32 a1); +extern int rand(void); + +void func_8017E158(int param_1) +{ + extern unsigned char D_801825A0[]; + int p; + int r1; + int r2; + + p = *(int *)(param_1 + 0x20); + ((void (*)(int, int))func_800159E4)(param_1 + 4, param_1 + 0x10); + ((void (*)(int, int, int, int))func_8001CC3C)(p, (int)D_801825A0, 0x270, 0x100); + *(unsigned char *)(p + 0x27) = 0x9c; + *(unsigned char *)(p + 0x26) = 0x40; + *(unsigned char *)(p + 0x25) = 0x40; + *(unsigned char *)(p + 0x24) = 0x40; + *(unsigned int *)(p + 4) = *(unsigned int *)(p + 4) | 0xd0000000; + *(int *)(param_1 + 0x2c) = 0; + *(unsigned short *)(param_1 + 0x30) = (rand() & 3) + 1; + r1 = rand(); + r2 = rand(); + *(unsigned short *)(p + 0x12) = (r1 & 3) * 0x400 + (r2 & 0xf) * 0x44; + ((void (*)(int, int))func_80146E90)(param_1, rand() & 0xf); + *(unsigned short *)(param_1 + 2) = *(unsigned short *)(param_1 + 2) + 1; +} + INCLUDE_ASM("asm/ov_SC04_008/nonmatchings/ov_SC04_008_jr_8017AE2C", func_8017E23C); diff --git a/src/ov_SC04_009/ov_SC04_009_jr_80135D20.c b/src/ov_SC04_009/ov_SC04_009_jr_80135D20.c index a4d4908088..2ae63685ff 100644 --- a/src/ov_SC04_009/ov_SC04_009_jr_80135D20.c +++ b/src/ov_SC04_009/ov_SC04_009_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_009/nonmatchings/ov_SC04_009_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017F0A4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017F0A4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017F0A4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017F0A4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017F0A4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_009/ov_SC04_009_jr_80154C24.c b/src/ov_SC04_009/ov_SC04_009_jr_80154C24.c index 716fdf36eb..4fb520e1bf 100644 --- a/src/ov_SC04_009/ov_SC04_009_jr_80154C24.c +++ b/src/ov_SC04_009/ov_SC04_009_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_009/nonmatchings/ov_SC04_009_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80180E2C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80180E2C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80180E2C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_009/ov_SC04_009_jr_8017BEBC.c b/src/ov_SC04_009/ov_SC04_009_jr_8017BEBC.c index 8cbd793f83..3ad749e3bc 100644 --- a/src/ov_SC04_009/ov_SC04_009_jr_8017BEBC.c +++ b/src/ov_SC04_009/ov_SC04_009_jr_8017BEBC.c @@ -384,7 +384,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3398,7 +3397,51 @@ extern void func_8012BF4C(s32 *a0, s16 a1); INCLUDE_ASM("asm/ov_SC04_009/nonmatchings/ov_SC04_009_jr_8017BEBC", func_8017D984); -INCLUDE_ASM("asm/ov_SC04_009/nonmatchings/ov_SC04_009_jr_8017BEBC", func_8017DAD4); + +extern void func_80149350(s32 arg0); +extern void func_8012F214(s32 a0, s32 a1, s32 a2); +extern s32 func_8012E544(s32 a0); +extern u8 *func_801290DC(s32 a0, u8 *a1); + +void func_8017DAD4(void *a0) { + + extern u8 D_801202A0[]; + extern u8 D_8018279C[]; + s32 t; + u8 *r; + u8 *p; + s32 i; + s32 o; + s16 out[4]; + + t = *(s16 *)((s32)a0 + 0x70); + r = &D_8018279C[t * 8]; + switch (t) { + case 0: + ((void (*)(void *, void *, void *))func_80149350)(&D_80126B58, r, out); + func_801290DC(0x56, (u8 *)out); + break; + case 1: + o = func_8012E544(0x245); + if (o == 0) { + return; + } + ((void (*)(void *, void *, void *))func_8012F214)((void *)o, r, out); + func_801290DC(0x56, (u8 *)out); + break; + default: + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == *(s16 *)(r + 6)) { + ((void (*)(void *, void *, void *))func_8012F214)(p, r, out); + func_801290DC(0x56, (u8 *)out); + } + p += 0x10C; + } + break; + } +} + extern void (*D_801827D0[])(void); @@ -3408,7 +3451,43 @@ void func_8017DBC0(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_009/nonmatchings/ov_SC04_009_jr_8017BEBC", func_8017DBFC); + +/* func_8017DBFC — state entry: init the sub-object at +4/+0x10, bind the + * primitive at +0x20 to the command list D_801827C4 (0x270 / 0x100), paint + * its RGB (0x40,0x40,0x40) + code 0x9C, OR 0xD0000000 into its tag word, + * clear the counter at +0x2C, then seed three random fields and bump the + * state word at +2. + */ + +extern void func_800159E4(s32 a0, s32 a1); +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); +extern void func_80146E90(s32 *a0, s32 a1); +extern int rand(void); + +void func_8017DBFC(int param_1) +{ + extern unsigned char D_801827C4[]; + int p; + int r1; + int r2; + + p = *(int *)(param_1 + 0x20); + ((void (*)(int, int))func_800159E4)(param_1 + 4, param_1 + 0x10); + ((void (*)(int, int, int, int))func_8001CC3C)(p, (int)D_801827C4, 0x270, 0x100); + *(unsigned char *)(p + 0x27) = 0x9c; + *(unsigned char *)(p + 0x26) = 0x40; + *(unsigned char *)(p + 0x25) = 0x40; + *(unsigned char *)(p + 0x24) = 0x40; + *(unsigned int *)(p + 4) = *(unsigned int *)(p + 4) | 0xd0000000; + *(int *)(param_1 + 0x2c) = 0; + *(unsigned short *)(param_1 + 0x30) = (rand() & 3) + 1; + r1 = rand(); + r2 = rand(); + *(unsigned short *)(p + 0x12) = (r1 & 3) * 0x400 + (r2 & 0xf) * 0x44; + ((void (*)(int, int))func_80146E90)(param_1, rand() & 0xf); + *(unsigned short *)(param_1 + 2) = *(unsigned short *)(param_1 + 2) + 1; +} + INCLUDE_ASM("asm/ov_SC04_009/nonmatchings/ov_SC04_009_jr_8017BEBC", func_8017DCE0); diff --git a/src/ov_SC04_010/ov_SC04_010_jr_80135D20.c b/src/ov_SC04_010/ov_SC04_010_jr_80135D20.c index 699738b09e..434d72c38d 100644 --- a/src/ov_SC04_010/ov_SC04_010_jr_80135D20.c +++ b/src/ov_SC04_010/ov_SC04_010_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_010/nonmatchings/ov_SC04_010_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017E750[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017E750[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017E750[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017E750[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017E750[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_010/ov_SC04_010_jr_80154C24.c b/src/ov_SC04_010/ov_SC04_010_jr_80154C24.c index ac7bfe7662..e14ec69e8d 100644 --- a/src/ov_SC04_010/ov_SC04_010_jr_80154C24.c +++ b/src/ov_SC04_010/ov_SC04_010_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_010/nonmatchings/ov_SC04_010_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801804D8)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801804D8[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801804D8[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_010/ov_SC04_010_jr_8017BEBC.c b/src/ov_SC04_010/ov_SC04_010_jr_8017BEBC.c index bd7b4e40f4..b0be433e19 100644 --- a/src/ov_SC04_010/ov_SC04_010_jr_8017BEBC.c +++ b/src/ov_SC04_010/ov_SC04_010_jr_8017BEBC.c @@ -52,7 +52,6 @@ extern s32 func_80165A50(s32); extern void func_80029514(s32); extern u8 D_800AF630[]; extern u8 D_80078EC0; -extern s32 D_80126B58; extern s32 func_80028FBC(void); extern s32 func_80029000(void); extern s32 func_80028D9C(void); @@ -384,7 +383,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3380,7 +3378,52 @@ extern void func_8012BF4C(s32 a0, s32 a1); INCLUDE_ASM("asm/ov_SC04_010/nonmatchings/ov_SC04_010_jr_8017BEBC", func_8017DC9C); -INCLUDE_ASM("asm/ov_SC04_010/nonmatchings/ov_SC04_010_jr_8017BEBC", func_8017DDEC); + +extern void func_80149350(s32 arg0); +extern void func_8012F214(s32 a0, s32 a1, s32 a2); +extern s32 func_8012E544(s32 a0); +extern u8 *func_801290DC(s32 a0, u8 *a1); + +void func_8017DDEC(void *a0) { + + extern s32 D_80126B58; + extern u8 D_801202A0[]; + extern u8 D_80181D7C[]; + s32 t; + u8 *r; + u8 *p; + s32 i; + s32 o; + s16 out[4]; + + t = *(s16 *)((s32)a0 + 0x70); + r = &D_80181D7C[t * 8]; + switch (t) { + case 0: + ((void (*)(void *, void *, void *))func_80149350)(&D_80126B58, r, out); + func_801290DC(0x56, (u8 *)out); + break; + case 1: + o = func_8012E544(0x245); + if (o == 0) { + return; + } + ((void (*)(void *, void *, void *))func_8012F214)((void *)o, r, out); + func_801290DC(0x56, (u8 *)out); + break; + default: + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == *(s16 *)(r + 6)) { + ((void (*)(void *, void *, void *))func_8012F214)(p, r, out); + func_801290DC(0x56, (u8 *)out); + } + p += 0x10C; + } + break; + } +} + extern void (*D_80181DB0[])(void); @@ -3390,7 +3433,43 @@ void func_8017DED8(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_010/nonmatchings/ov_SC04_010_jr_8017BEBC", func_8017DF14); + +/* func_8017DF14 — state entry: init the sub-object at +4/+0x10, bind the + * primitive at +0x20 to the command list D_80181DA4 (0x270 / 0x100), paint + * its RGB (0x40,0x40,0x40) + code 0x9C, OR 0xD0000000 into its tag word, + * clear the counter at +0x2C, then seed three random fields and bump the + * state word at +2. + */ + +extern void func_800159E4(s32 a0, s32 a1); +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); +extern void func_80146E90(s32 *a0, s32 a1); +extern int rand(void); + +void func_8017DF14(int param_1) +{ + extern unsigned char D_80181DA4[]; + int p; + int r1; + int r2; + + p = *(int *)(param_1 + 0x20); + ((void (*)(int, int))func_800159E4)(param_1 + 4, param_1 + 0x10); + ((void (*)(int, int, int, int))func_8001CC3C)(p, (int)D_80181DA4, 0x270, 0x100); + *(unsigned char *)(p + 0x27) = 0x9c; + *(unsigned char *)(p + 0x26) = 0x40; + *(unsigned char *)(p + 0x25) = 0x40; + *(unsigned char *)(p + 0x24) = 0x40; + *(unsigned int *)(p + 4) = *(unsigned int *)(p + 4) | 0xd0000000; + *(int *)(param_1 + 0x2c) = 0; + *(unsigned short *)(param_1 + 0x30) = (rand() & 3) + 1; + r1 = rand(); + r2 = rand(); + *(unsigned short *)(p + 0x12) = (r1 & 3) * 0x400 + (r2 & 0xf) * 0x44; + ((void (*)(int, int))func_80146E90)(param_1, rand() & 0xf); + *(unsigned short *)(param_1 + 2) = *(unsigned short *)(param_1 + 2) + 1; +} + INCLUDE_ASM("asm/ov_SC04_010/nonmatchings/ov_SC04_010_jr_8017BEBC", func_8017DFF8); diff --git a/src/ov_SC04_011/ov_SC04_011_jr_80135D20.c b/src/ov_SC04_011/ov_SC04_011_jr_80135D20.c index ea91e6d333..d622b5d13b 100644 --- a/src/ov_SC04_011/ov_SC04_011_jr_80135D20.c +++ b/src/ov_SC04_011/ov_SC04_011_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801909E0[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801909E0[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801909E0[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801909E0[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801909E0[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_011/ov_SC04_011_jr_80154C24.c b/src/ov_SC04_011/ov_SC04_011_jr_80154C24.c index 540947e868..8245a6ca79 100644 --- a/src/ov_SC04_011/ov_SC04_011_jr_80154C24.c +++ b/src/ov_SC04_011/ov_SC04_011_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80192768)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80192768[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80192768[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_011/ov_SC04_011_jr_8017D494.c b/src/ov_SC04_011/ov_SC04_011_jr_8017D494.c index fda7d04ebe..81a32b6163 100644 --- a/src/ov_SC04_011/ov_SC04_011_jr_8017D494.c +++ b/src/ov_SC04_011/ov_SC04_011_jr_8017D494.c @@ -52,7 +52,6 @@ extern s32 func_80165A50(s32); extern void func_80029514(s32); extern u8 D_800AF630[]; extern u8 D_80078EC0; -extern s32 D_80126B58; extern s32 func_80028FBC(void); extern s32 func_80029000(void); extern s32 func_80028D9C(void); @@ -384,7 +383,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3195,7 +3193,17 @@ INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8017E55 INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8017E6EC); -INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8017E9A4); + +extern void func_80019064(void *a0); + +void func_8017E9A4(void *a0) { + + extern u8 D_80193EF8; + extern void (*D_80193F1C[])(void *); + func_80019064(&D_80193EF8); + D_80193F1C[*(u16 *)((s32)a0 + 0x2)](a0); +} + extern void func_8014E934(s32 a0); extern void func_8014CC28(s32 a0); @@ -3217,7 +3225,17 @@ INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8017EB1 INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8017EBE8); -INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8017EC38); + +extern void func_80019064(void *a0); + +void func_8017EC38(void *a0) { + + extern u8 D_80193F28; + extern void (*D_80193F4C[])(void *); + func_80019064(&D_80193F28); + D_80193F4C[*(u16 *)((s32)a0 + 0x2)](a0); +} + extern void func_8014E934(s32 a0); extern void func_8014CC28(s32 a0); @@ -3855,12 +3873,15 @@ INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_80185B0 #include "common.h" -extern s32 D_801EFC48; -extern s32 D_801EFC4C[]; extern s32 func_8004787C(s32 a0); void func_80185B5C(u16 id) { + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern s32 D_801EFC48; + extern s32 D_801EFC4C[]; s32 obj; s32 q; @@ -3876,7 +3897,26 @@ void func_80185B5C(u16 id) INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_80185C04); -INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_80185C5C); + +extern s32 func_8004787C(s32 a0); + +void func_80185C5C(u16 id) +{ + + extern s32 D_801EFC48; + extern s32 D_801EFC4C[]; + s32 obj; + s32 q; + + obj = D_801EFC4C[*(u8 *)(id * 8 + *(s32 *)(D_801EFC48 + 0xCC) + 6)]; + if (obj != 0) { + *(u16 *)(obj + 0xF6) = *(u16 *)(obj + 0xF6) + *(u16 *)(obj + 0xFA); + q = func_8004787C(*(s16 *)(obj + 0xF6)) / 22; + *(s16 *)(obj + 0xF4) = q; + *(s16 *)(obj + 0xE8) = *(u16 *)(obj + 0xF8) + q; + } +} + INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_80185D04); @@ -4279,7 +4319,17 @@ void func_8018B024(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8018B060); + +extern s32 func_8012C658(s32 arg0, s32 arg1, s32 arg2); + +void func_8018B060(s32 arg0) { + s32 i; + + for (i = 0; i < 6; i++) { + func_8012C658(0x2dd, i, arg0); + } +} + INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8018B0B0); @@ -4458,7 +4508,52 @@ extern void func_8012BF4C(s32 *a0, s32 a1); INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8018D0A0); -INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8018D1F0); + +extern void func_80149350(s32 arg0); +extern void func_8012F214(s32 a0, s32 a1, s32 a2); +extern s32 func_8012E544(s32 a0); +extern u8 *func_801290DC(s32 a0, u8 *a1); + +void func_8018D1F0(void *a0) { + + extern s32 D_80126B58; + extern u8 D_801202A0[]; + extern u8 D_80194CEC[]; + s32 t; + u8 *r; + u8 *p; + s32 i; + s32 o; + s16 out[4]; + + t = *(s16 *)((s32)a0 + 0x70); + r = &D_80194CEC[t * 8]; + switch (t) { + case 0: + ((void (*)(void *, void *, void *))func_80149350)(&D_80126B58, r, out); + func_801290DC(0x56, (u8 *)out); + break; + case 1: + o = func_8012E544(0x245); + if (o == 0) { + return; + } + ((void (*)(void *, void *, void *))func_8012F214)((void *)o, r, out); + func_801290DC(0x56, (u8 *)out); + break; + default: + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == *(s16 *)(r + 6)) { + ((void (*)(void *, void *, void *))func_8012F214)(p, r, out); + func_801290DC(0x56, (u8 *)out); + } + p += 0x10C; + } + break; + } +} + extern void (*D_80194D20[])(void); @@ -4468,7 +4563,43 @@ void func_8018D2DC(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8018D318); + +/* func_8018D318 — state entry: init the sub-object at +4/+0x10, bind the + * primitive at +0x20 to the command list D_80194D14 (0x270 / 0x100), paint + * its RGB (0x40,0x40,0x40) + code 0x9C, OR 0xD0000000 into its tag word, + * clear the counter at +0x2C, then seed three random fields and bump the + * state word at +2. + */ + +extern void func_800159E4(s32 a0, s32 a1); +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); +extern void func_80146E90(s32 *a0, s32 a1); +extern int rand(void); + +void func_8018D318(int param_1) +{ + extern unsigned char D_80194D14[]; + int p; + int r1; + int r2; + + p = *(int *)(param_1 + 0x20); + ((void (*)(int, int))func_800159E4)(param_1 + 4, param_1 + 0x10); + ((void (*)(int, int, int, int))func_8001CC3C)(p, (int)D_80194D14, 0x270, 0x100); + *(unsigned char *)(p + 0x27) = 0x9c; + *(unsigned char *)(p + 0x26) = 0x40; + *(unsigned char *)(p + 0x25) = 0x40; + *(unsigned char *)(p + 0x24) = 0x40; + *(unsigned int *)(p + 4) = *(unsigned int *)(p + 4) | 0xd0000000; + *(int *)(param_1 + 0x2c) = 0; + *(unsigned short *)(param_1 + 0x30) = (rand() & 3) + 1; + r1 = rand(); + r2 = rand(); + *(unsigned short *)(p + 0x12) = (r1 & 3) * 0x400 + (r2 & 0xf) * 0x44; + ((void (*)(int, int))func_80146E90)(param_1, rand() & 0xf); + *(unsigned short *)(param_1 + 2) = *(unsigned short *)(param_1 + 2) + 1; +} + INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8018D3FC); @@ -4682,7 +4813,27 @@ extern void func_80146C3C(void); } -INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8018FC00); + +extern void func_80017254(void *a0); +extern void func_800176F0(void *a0); + +void func_8018FC00(void) { + + extern u8 D_801EBD40[]; + extern u8 D_801EBD68[]; + u8 *p; + s32 i; + + func_80017254(D_801EBD40); + i = 0; + p = D_801EBD68; + do { + func_800176F0(p); + i++; + p += 0x34; + } while (i < 4); +} + extern s32 func_80146994(s32 a0, s32 a1, s32 a2, s32 a3); void func_8018FC58(void *a0) { @@ -4690,7 +4841,20 @@ extern s32 func_80146994(s32 a0, s32 a1, s32 a2, s32 a3); } -INCLUDE_ASM("asm/ov_SC04_011/nonmatchings/ov_SC04_011_jr_8017D494", func_8018FC84); + +extern s32 func_8014C050(s32 a0, s32 a1); + +void func_8018FC84(void) { + + extern s32 D_80126B58; + s32 t; + + t = func_8014C050((s32)&D_80126B58, 0x28); + if (t != 0) { + *(u16 *)(t + 2) += 1; + } +} + extern void (*D_801EBE74[])(void); diff --git a/src/ov_SC04_012/ov_SC04_012_jr_80135D20.c b/src/ov_SC04_012/ov_SC04_012_jr_80135D20.c index 995bf5ce75..10b42c4fa6 100644 --- a/src/ov_SC04_012/ov_SC04_012_jr_80135D20.c +++ b/src/ov_SC04_012/ov_SC04_012_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_012/nonmatchings/ov_SC04_012_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017EBB4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017EBB4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017EBB4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017EBB4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017EBB4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_012/ov_SC04_012_jr_80154C24.c b/src/ov_SC04_012/ov_SC04_012_jr_80154C24.c index 98a898a9b9..ed7149b4f1 100644 --- a/src/ov_SC04_012/ov_SC04_012_jr_80154C24.c +++ b/src/ov_SC04_012/ov_SC04_012_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_012/nonmatchings/ov_SC04_012_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018093C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018093C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018093C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_012/ov_SC04_012_jr_8017AE2C.c b/src/ov_SC04_012/ov_SC04_012_jr_8017AE2C.c index 0eb72d9c02..c48e657ba3 100644 --- a/src/ov_SC04_012/ov_SC04_012_jr_8017AE2C.c +++ b/src/ov_SC04_012/ov_SC04_012_jr_8017AE2C.c @@ -50,7 +50,6 @@ extern s32 func_80165A50(s32); extern void func_80029514(s32); extern u8 D_800AF630[]; extern u8 D_80078EC0; -extern s32 D_80126B58; extern s32 func_80028FBC(void); extern s32 func_80029000(void); extern s32 func_80028D9C(void); @@ -382,7 +381,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -4051,7 +4049,52 @@ extern void func_8012BF4C(s32 *a0, s16 a1); INCLUDE_ASM("asm/ov_SC04_012/nonmatchings/ov_SC04_012_jr_8017AE2C", func_8017E100); -INCLUDE_ASM("asm/ov_SC04_012/nonmatchings/ov_SC04_012_jr_8017AE2C", func_8017E250); + +extern void func_80149350(s32 arg0); +extern void func_8012F214(s32 a0, s32 a1, s32 a2); +extern s32 func_8012E544(s32 a0); +extern u8 *func_801290DC(s32 a0, u8 *a1); + +void func_8017E250(void *a0) { + + extern s32 D_80126B58; + extern u8 D_801202A0[]; + extern u8 D_801822CC[]; + s32 t; + u8 *r; + u8 *p; + s32 i; + s32 o; + s16 out[4]; + + t = *(s16 *)((s32)a0 + 0x70); + r = &D_801822CC[t * 8]; + switch (t) { + case 0: + ((void (*)(void *, void *, void *))func_80149350)(&D_80126B58, r, out); + func_801290DC(0x56, (u8 *)out); + break; + case 1: + o = func_8012E544(0x245); + if (o == 0) { + return; + } + ((void (*)(void *, void *, void *))func_8012F214)((void *)o, r, out); + func_801290DC(0x56, (u8 *)out); + break; + default: + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == *(s16 *)(r + 6)) { + ((void (*)(void *, void *, void *))func_8012F214)(p, r, out); + func_801290DC(0x56, (u8 *)out); + } + p += 0x10C; + } + break; + } +} + extern void (*D_80182300[])(void); @@ -4061,7 +4104,43 @@ void func_8017E33C(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_012/nonmatchings/ov_SC04_012_jr_8017AE2C", func_8017E378); + +/* func_8017E378 — state entry: init the sub-object at +4/+0x10, bind the + * primitive at +0x20 to the command list D_801822F4 (0x270 / 0x100), paint + * its RGB (0x40,0x40,0x40) + code 0x9C, OR 0xD0000000 into its tag word, + * clear the counter at +0x2C, then seed three random fields and bump the + * state word at +2. + */ + +extern void func_800159E4(s32 a0, s32 a1); +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); +extern void func_80146E90(s32 *a0, s32 a1); +extern int rand(void); + +void func_8017E378(int param_1) +{ + extern unsigned char D_801822F4[]; + int p; + int r1; + int r2; + + p = *(int *)(param_1 + 0x20); + ((void (*)(int, int))func_800159E4)(param_1 + 4, param_1 + 0x10); + ((void (*)(int, int, int, int))func_8001CC3C)(p, (int)D_801822F4, 0x270, 0x100); + *(unsigned char *)(p + 0x27) = 0x9c; + *(unsigned char *)(p + 0x26) = 0x40; + *(unsigned char *)(p + 0x25) = 0x40; + *(unsigned char *)(p + 0x24) = 0x40; + *(unsigned int *)(p + 4) = *(unsigned int *)(p + 4) | 0xd0000000; + *(int *)(param_1 + 0x2c) = 0; + *(unsigned short *)(param_1 + 0x30) = (rand() & 3) + 1; + r1 = rand(); + r2 = rand(); + *(unsigned short *)(p + 0x12) = (r1 & 3) * 0x400 + (r2 & 0xf) * 0x44; + ((void (*)(int, int))func_80146E90)(param_1, rand() & 0xf); + *(unsigned short *)(param_1 + 2) = *(unsigned short *)(param_1 + 2) + 1; +} + INCLUDE_ASM("asm/ov_SC04_012/nonmatchings/ov_SC04_012_jr_8017AE2C", func_8017E45C); diff --git a/src/ov_SC04_015/ov_SC04_015_jr_80135D20.c b/src/ov_SC04_015/ov_SC04_015_jr_80135D20.c index 4d0738a439..adddc9f2aa 100644 --- a/src/ov_SC04_015/ov_SC04_015_jr_80135D20.c +++ b/src/ov_SC04_015/ov_SC04_015_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_015/nonmatchings/ov_SC04_015_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80184AEC[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80184AEC[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80184AEC[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80184AEC[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80184AEC[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_015/ov_SC04_015_jr_80154C24.c b/src/ov_SC04_015/ov_SC04_015_jr_80154C24.c index 6e5302ce41..10235fa714 100644 --- a/src/ov_SC04_015/ov_SC04_015_jr_80154C24.c +++ b/src/ov_SC04_015/ov_SC04_015_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_015/nonmatchings/ov_SC04_015_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80186874)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80186874[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80186874[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_015/ov_SC04_015_jr_8017AE2C.c b/src/ov_SC04_015/ov_SC04_015_jr_8017AE2C.c index 176a973670..0867bfe059 100644 --- a/src/ov_SC04_015/ov_SC04_015_jr_8017AE2C.c +++ b/src/ov_SC04_015/ov_SC04_015_jr_8017AE2C.c @@ -4710,7 +4710,21 @@ INCLUDE_ASM("asm/ov_SC04_015/nonmatchings/ov_SC04_015_jr_8017AE2C", func_80181C0 INCLUDE_ASM("asm/ov_SC04_015/nonmatchings/ov_SC04_015_jr_8017AE2C", func_80181C70); -INCLUDE_ASM("asm/ov_SC04_015/nonmatchings/ov_SC04_015_jr_8017AE2C", func_80181CE4); +void func_80181CE4(s32 a0) { + + extern s16 D_801B29BC[]; + extern s32 D_801B297C[][2]; + *(s16 *)(a0 + 0x2) = 3; + *(s16 *)(a0 + 0x34) = 0; + *(s16 *)(a0 + 0xFE) = 0; + *(s16 *)(a0 + 0x100) = 0; + *(s16 *)(a0 + 0x102) = 2; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x24) = D_801B297C[D_801B29BC[*(s16 *)(a0 + 0x70)]][0]; + *(s16 *)(a0 + 0x84) = 0; + *(s16 *)(a0 + 0x5C) = 0x800; + *(s32 *)(a0 + 0xB0) = 0; +} + INCLUDE_ASM("asm/ov_SC04_015/nonmatchings/ov_SC04_015_jr_8017AE2C", func_80181D44); diff --git a/src/ov_SC04_016/ov_SC04_016_jr_80135D20.c b/src/ov_SC04_016/ov_SC04_016_jr_80135D20.c index b496ac6704..3e38053f38 100644 --- a/src/ov_SC04_016/ov_SC04_016_jr_80135D20.c +++ b/src/ov_SC04_016/ov_SC04_016_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_016/nonmatchings/ov_SC04_016_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801805B0[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801805B0[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801805B0[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801805B0[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801805B0[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_016/ov_SC04_016_jr_80154C24.c b/src/ov_SC04_016/ov_SC04_016_jr_80154C24.c index 0250686288..b4e86b7ddf 100644 --- a/src/ov_SC04_016/ov_SC04_016_jr_80154C24.c +++ b/src/ov_SC04_016/ov_SC04_016_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_016/nonmatchings/ov_SC04_016_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80182338)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80182338[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80182338[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_018/ov_SC04_018_jr_80135D20.c b/src/ov_SC04_018/ov_SC04_018_jr_80135D20.c index ed277d396e..60b8b645e8 100644 --- a/src/ov_SC04_018/ov_SC04_018_jr_80135D20.c +++ b/src/ov_SC04_018/ov_SC04_018_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018D7C8[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018D7C8[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018D7C8[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018D7C8[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018D7C8[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_018/ov_SC04_018_jr_80154C24.c b/src/ov_SC04_018/ov_SC04_018_jr_80154C24.c index 23aafd8d6d..951ae8e575 100644 --- a/src/ov_SC04_018/ov_SC04_018_jr_80154C24.c +++ b/src/ov_SC04_018/ov_SC04_018_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018F550)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018F550[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018F550[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_018/ov_SC04_018_jr_8017AE2C.c b/src/ov_SC04_018/ov_SC04_018_jr_8017AE2C.c index 68b353badb..5f05993547 100644 --- a/src/ov_SC04_018/ov_SC04_018_jr_8017AE2C.c +++ b/src/ov_SC04_018/ov_SC04_018_jr_8017AE2C.c @@ -4964,7 +4964,23 @@ INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_801819C INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_80181A28); -INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_80181A68); + +/* func_80181A68 — guarded dispatch: ask func_80184BAC(9, 0x12); if it answers + * NON-zero, run func_801815DC on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_80184BAC(s32 arg0, s32 arg1); +extern void func_801815DC(void *arg0); + +void func_80181A68(void *arg0) { + if (func_80184BAC(9, 0x12) != 0) { + func_801815DC(arg0); + } +} + INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_80181AA8); @@ -5151,13 +5167,60 @@ s32 func_801825BC(void *a0) INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_801826AC); -INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_8018276C); + +extern s32 func_80185BE0(s32 a0); +extern s32 func_80184FA4(s32 a0); +extern void func_80184ED4(s32, s32, s32, s32); +extern void func_80181FE4(void *a0); + +void func_8018276C(void *a0) +{ + + extern u8 D_801B66D8[]; + if (*(u16 *)((s32)a0 + 0x34) == 0) { + if (func_80185BE0(3) == 0) { + return; + } + if (func_80184FA4((s32)a0) == 0) { + return; + } + ((void (*)(void *, void *, s32, s32))func_80184ED4)(a0, D_801B66D8, 0, 0x40); + *(s16 *)((s32)a0 + 0x34) = 1; + return; + } + + *(s32 *)(*(s32 *)((s32)a0 + 0xCC) + 0xB0) = 2; + if (func_80184FA4((s32)a0) != 0) { + func_80181FE4(a0); + } +} + INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_80182800); INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_801828B0); -INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_80182920); + +extern s32 func_80184FA4(s32 a0); +extern void func_80184ED4(s32 a0, s32 a1, s32 a2, s32 a3); +extern s32 func_80185BE0(s32 a0); +extern void func_801821A8(short*); + +void func_80182920(void *arg0) { + + extern u8 D_801B66CC[]; + if (*(u16 *)((char *)arg0 + 0x34) == 0) { + if (((s32 (*)(void))func_80184FA4)() != 0) { + func_80184ED4((s32)arg0, (s32)&D_801B66CC[0], 1, 0x40); + *(s16 *)((char *)arg0 + 0x34) = 1; + } + } else if (func_80185BE0(3) != 0) { + if (func_80184FA4((s32)arg0) != 0) { + ((void (*)(void *))func_801821A8)(arg0); + } + } +} + INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_801829AC); @@ -5214,7 +5277,23 @@ extern s32 func_80029178(s32 arg); } -INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_80182E00); + +/* func_80182E00 — guarded dispatch: ask func_80184BAC(7, 0xe); if it answers + * NON-zero, run func_80182B58 on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_80184BAC(s32 arg0, s32 arg1); +extern void func_80182B58(void *arg0); + +void func_80182E00(void *arg0) { + if (func_80184BAC(7, 0xe) != 0) { + func_80182B58(arg0); + } +} + INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_80182E40); @@ -5328,7 +5407,32 @@ INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_8018389 INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_801838E0); -INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_80183938); + +/* func_80183938 — state-entry init (family exemplar, reach x11). + * Sets the actor's state id (halfword @ +0x2) then runs the fixed + * five-call entry chain. Sibling style copied from func_80180164 + * in the same TU (cookbook §71). */ + +extern void func_8012E8E0(s32, s32); +extern void func_8012E88C(s32); +extern void func_8012A828(s32 *a0, s32 a1); /* fleet-canonical sig (TU L3775) */ +extern void func_80184C90(s32); +extern void func_80184ED4(s32, s32, s32, s32); + + +void func_80183938(void *arg0) { + + extern short D_80192150; + extern short D_801B9C50; + extern short D_801B67C8; + *(short *)((char *)arg0 + 0x2) = 2; + func_8012E8E0((s32)arg0, (s32)&D_80192150); + func_8012E88C((s32)arg0); + func_8012A828((s32 *)arg0, (s32)&D_801B9C50); + func_80184C90((s32)arg0); + func_80184ED4((s32)arg0, (s32)&D_801B67C8, 0, 0x60); +} + INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_801839A8); @@ -5364,7 +5468,23 @@ extern s32 func_80029178(s32 arg); } -INCLUDE_ASM("asm/ov_SC04_018/nonmatchings/ov_SC04_018_jr_8017AE2C", func_80183B4C); + +/* func_80183B4C — guarded dispatch: ask func_80184BAC(9, 0x11); if it answers + * NON-zero, run func_80183938 on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_80184BAC(s32 arg0, s32 arg1); +extern void func_80183938(void *arg0); + +void func_80183B4C(void *arg0) { + if (func_80184BAC(9, 0x11) != 0) { + func_80183938(arg0); + } +} + extern s32 func_80184FA4(s32 a0); extern s32 func_801839A8(void *a0); diff --git a/src/ov_SC04_019/ov_SC04_019_jr_80135D20.c b/src/ov_SC04_019/ov_SC04_019_jr_80135D20.c index 8460399eee..60b8b645e8 100644 --- a/src/ov_SC04_019/ov_SC04_019_jr_80135D20.c +++ b/src/ov_SC04_019/ov_SC04_019_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018D7C8[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018D7C8[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018D7C8[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018D7C8[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018D7C8[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_019/ov_SC04_019_jr_80154C24.c b/src/ov_SC04_019/ov_SC04_019_jr_80154C24.c index cafd0c29da..951ae8e575 100644 --- a/src/ov_SC04_019/ov_SC04_019_jr_80154C24.c +++ b/src/ov_SC04_019/ov_SC04_019_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018F550)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018F550[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018F550[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_019/ov_SC04_019_jr_8017AE2C.c b/src/ov_SC04_019/ov_SC04_019_jr_8017AE2C.c index 4ba621bec0..79d39efd49 100644 --- a/src/ov_SC04_019/ov_SC04_019_jr_8017AE2C.c +++ b/src/ov_SC04_019/ov_SC04_019_jr_8017AE2C.c @@ -4643,7 +4643,32 @@ INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_801801E INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80180284); -INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_8018034C); + +/* func_8018034C — state-entry init (family exemplar, reach x11). + * Sets the actor's state id (halfword @ +0x2) then runs the fixed + * five-call entry chain. Sibling style copied from func_80180164 + * in the same TU (cookbook §71). */ + +extern void func_8012E8E0(s32, s32); +extern void func_8012E88C(s32); +extern void func_8012A828(s32 *a0, s32 a1); /* fleet-canonical sig (TU L3775) */ +extern void func_80184C90(s32); +extern void func_80184ED4(s32, s32, s32, s32); + + +void func_8018034C(void *arg0) { + + extern short D_801918F4; + extern short D_801B9DF8; + extern short D_801B65B8; + *(short *)((char *)arg0 + 0x2) = 2; + func_8012E8E0((s32)arg0, (s32)&D_801918F4); + func_8012E88C((s32)arg0); + func_8012A828((s32 *)arg0, (s32)&D_801B9DF8); + func_80184C90((s32)arg0); + func_80184ED4((s32)arg0, (s32)&D_801B65B8, 0, 0x60); +} + INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_801803BC); @@ -4673,7 +4698,23 @@ extern s32 func_80029178(s32 arg); } -INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80180580); + +/* func_80180580 — guarded dispatch: ask func_80184BAC(9, 0x11); if it answers + * NON-zero, run func_8018034C on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_80184BAC(s32 arg0, s32 arg1); +extern void func_8018034C(void *arg0); + +void func_80180580(void *arg0) { + if (func_80184BAC(9, 0x11) != 0) { + func_8018034C(arg0); + } +} + INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_801805C0); @@ -4795,7 +4836,34 @@ s32 func_80180D38(void *a0) INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80180E28); -INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80180EE8); + +extern s32 func_80185BE0(s32 a0); +extern s32 func_80184FA4(void); +extern void func_80184ED4(s32, s32, s32, s32); +extern void func_801808FC(void *a0); + +void func_80180EE8(void *a0) +{ + + extern u8 D_801B6620[]; + if (*(u16 *)((s32)a0 + 0x34) == 0) { + if (func_80185BE0(6) == 0) { + return; + } + if (((s32 (*)(s32))func_80184FA4)((s32)a0) == 0) { + return; + } + ((void (*)(void *, void *, s32, s32))func_80184ED4)(a0, D_801B6620, 0, 0x40); + *(s16 *)((s32)a0 + 0x34) = 1; + return; + } + + *(s32 *)(*(s32 *)((s32)a0 + 0xCC) + 0xB0) = 2; + if (((s32 (*)(s32))func_80184FA4)((s32)a0) != 0) { + func_801808FC(a0); + } +} + INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80180F7C); @@ -4901,7 +4969,23 @@ INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_801819C INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80181A28); -INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80181A68); + +/* func_80181A68 — guarded dispatch: ask func_80184BAC(9, 0x12); if it answers + * NON-zero, run func_801815DC on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_80184BAC(s32 arg0, s32 arg1); +extern void func_801815DC(void *arg0); + +void func_80181A68(void *arg0) { + if (func_80184BAC(9, 0x12) != 0) { + func_801815DC(arg0); + } +} + INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80181AA8); @@ -4923,7 +5007,27 @@ void func_80181B34(void *arg0) { INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80181B74); -INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80181BEC); + +extern s32 func_80184FA4(void); +extern void func_80184ED4(s32 a0, s32 a1, s32 a2, s32 a3); +extern s32 func_80185BE0(s32 a0); +extern void func_8018170C(void *a0); + +void func_80181BEC(void *arg0) { + + extern u8 D_801B662C[]; + if (*(u16 *)((char *)arg0 + 0x34) == 0) { + if (((s32 (*)(void))func_80184FA4)() != 0) { + func_80184ED4((s32)arg0, (s32)&D_801B662C[0], 1, 0x80); + *(s16 *)((char *)arg0 + 0x34) = 1; + } + } else if (func_80185BE0(3) != 0) { + if (((s32 (*)(s32))func_80184FA4)((s32)arg0) != 0) { + func_8018170C(arg0); + } + } +} + /* func_80181C78 — guarded dispatch: ask func_80184BAC(15, 0x11); if it answers @@ -5068,13 +5172,60 @@ s32 func_801825BC(void *a0) INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_801826AC); -INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_8018276C); + +extern s32 func_80185BE0(s32 a0); +extern s32 func_80184FA4(void); +extern void func_80184ED4(s32, s32, s32, s32); +extern void func_80181FE4(void *a0); + +void func_8018276C(void *a0) +{ + + extern u8 D_801B66D8[]; + if (*(u16 *)((s32)a0 + 0x34) == 0) { + if (func_80185BE0(3) == 0) { + return; + } + if (((s32 (*)(s32))func_80184FA4)((s32)a0) == 0) { + return; + } + ((void (*)(void *, void *, s32, s32))func_80184ED4)(a0, D_801B66D8, 0, 0x40); + *(s16 *)((s32)a0 + 0x34) = 1; + return; + } + + *(s32 *)(*(s32 *)((s32)a0 + 0xCC) + 0xB0) = 2; + if (((s32 (*)(s32))func_80184FA4)((s32)a0) != 0) { + func_80181FE4(a0); + } +} + INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80182800); INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_801828B0); -INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80182920); + +extern s32 func_80184FA4(void); +extern void func_80184ED4(s32 a0, s32 a1, s32 a2, s32 a3); +extern s32 func_80185BE0(s32 a0); +extern void func_801821A8(void *a0); + +void func_80182920(void *arg0) { + + extern u8 D_801B66CC[]; + if (*(u16 *)((char *)arg0 + 0x34) == 0) { + if (((s32 (*)(void))func_80184FA4)() != 0) { + func_80184ED4((s32)arg0, (s32)&D_801B66CC[0], 1, 0x40); + *(s16 *)((char *)arg0 + 0x34) = 1; + } + } else if (func_80185BE0(3) != 0) { + if (((s32 (*)(s32))func_80184FA4)((s32)arg0) != 0) { + func_801821A8(arg0); + } + } +} + INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_801829AC); @@ -5130,7 +5281,23 @@ extern s32 func_80029178(s32 arg); } -INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80182E00); + +/* func_80182E00 — guarded dispatch: ask func_80184BAC(7, 0xe); if it answers + * NON-zero, run func_80182B58 on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_80184BAC(s32 arg0, s32 arg1); +extern void func_80182B58(void *arg0); + +void func_80182E00(void *arg0) { + if (func_80184BAC(7, 0xe) != 0) { + func_80182B58(arg0); + } +} + INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80182E40); @@ -5242,7 +5409,32 @@ INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_8018389 INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_801838E0); -INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80183938); + +/* func_80183938 — state-entry init (family exemplar, reach x11). + * Sets the actor's state id (halfword @ +0x2) then runs the fixed + * five-call entry chain. Sibling style copied from func_80180164 + * in the same TU (cookbook §71). */ + +extern void func_8012E8E0(s32, s32); +extern void func_8012E88C(s32); +extern void func_8012A828(s32 *a0, s32 a1); /* fleet-canonical sig (TU L3775) */ +extern void func_80184C90(s32); +extern void func_80184ED4(s32, s32, s32, s32); + + +void func_80183938(void *arg0) { + + extern short D_80192150; + extern short D_801B9C50; + extern short D_801B67C8; + *(short *)((char *)arg0 + 0x2) = 2; + func_8012E8E0((s32)arg0, (s32)&D_80192150); + func_8012E88C((s32)arg0); + func_8012A828((s32 *)arg0, (s32)&D_801B9C50); + func_80184C90((s32)arg0); + func_80184ED4((s32)arg0, (s32)&D_801B67C8, 0, 0x60); +} + INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_801839A8); @@ -5279,7 +5471,23 @@ extern s32 func_80029178(s32 arg); } -INCLUDE_ASM("asm/ov_SC04_019/nonmatchings/ov_SC04_019_jr_8017AE2C", func_80183B4C); + +/* func_80183B4C — guarded dispatch: ask func_80184BAC(9, 0x11); if it answers + * NON-zero, run func_80183938 on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_80184BAC(s32 arg0, s32 arg1); +extern void func_80183938(void *arg0); + +void func_80183B4C(void *arg0) { + if (func_80184BAC(9, 0x11) != 0) { + func_80183938(arg0); + } +} + extern s32 func_80184FA4(void); extern void func_801839A8(s32 arg0); diff --git a/src/ov_SC04_020/ov_SC04_020_jr_80135D20.c b/src/ov_SC04_020/ov_SC04_020_jr_80135D20.c index 4d1b1a7e18..7a7326e30c 100644 --- a/src/ov_SC04_020/ov_SC04_020_jr_80135D20.c +++ b/src/ov_SC04_020/ov_SC04_020_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_020/nonmatchings/ov_SC04_020_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80183900[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80183900[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80183900[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80183900[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80183900[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_020/ov_SC04_020_jr_80154C24.c b/src/ov_SC04_020/ov_SC04_020_jr_80154C24.c index a5a31c5e91..d0582dc09b 100644 --- a/src/ov_SC04_020/ov_SC04_020_jr_80154C24.c +++ b/src/ov_SC04_020/ov_SC04_020_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_020/nonmatchings/ov_SC04_020_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80185688)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80185688[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80185688[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC04_020/ov_SC04_020_jr_8017D604.c b/src/ov_SC04_020/ov_SC04_020_jr_8017D604.c index 9574e15e77..c58e2bb8c9 100644 --- a/src/ov_SC04_020/ov_SC04_020_jr_8017D604.c +++ b/src/ov_SC04_020/ov_SC04_020_jr_8017D604.c @@ -1674,7 +1674,6 @@ extern void func_8016634C(void *a0); extern void func_801663A4(void *a0); extern void (*D_80186234[])(void); extern void func_801663FC(void *a0); -extern u8 D_800D387C[]; extern u8 D_800D3888[]; extern s32 func_800D21C4(s32 a0, void *a1, s32 a2); extern void func_800D1FC8(s32 a0, s32 a1); @@ -3418,7 +3417,27 @@ void func_8017FC30(void *a0) { } -INCLUDE_ASM("asm/ov_SC04_020/nonmatchings/ov_SC04_020_jr_8017D604", func_8017FC6C); + +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); + +void func_8017FC6C(s32 arg0) { + + extern u8 D_800D387C[]; + s32 iVar1; + + iVar1 = *(s32 *)(arg0 + 0x20); + ((void (*)(s32, s32, s32, s32))func_8001CC3C)(iVar1, (s32)&D_800D387C, 0x270, 0x120); + *(u8 *)(iVar1 + 0x27) = 0x9C; + *(u16 *)(iVar1 + 0x1A) = 0x7000; + *(u16 *)(iVar1 + 0x18) = 0x7000; + *(u8 *)(iVar1 + 0x26) = 0x90; + *(u8 *)(iVar1 + 0x25) = 0x90; + *(u8 *)(iVar1 + 0x24) = 0x90; + *(u32 *)(iVar1 + 4) = *(u32 *)(iVar1 + 4) | 0x50000000; + *(s16 *)(arg0 + 0x2C) = 0x20; + *(s16 *)(arg0 + 0x2) += 1; +} + INCLUDE_ASM("asm/ov_SC04_020/nonmatchings/ov_SC04_020_jr_8017D604", func_8017FCFC); @@ -3490,7 +3509,23 @@ INCLUDE_ASM("asm/ov_SC04_020/nonmatchings/ov_SC04_020_jr_8017D604", func_8018091 INCLUDE_ASM("asm/ov_SC04_020/nonmatchings/ov_SC04_020_jr_8017D604", func_80180978); -INCLUDE_ASM("asm/ov_SC04_020/nonmatchings/ov_SC04_020_jr_8017D604", func_801809EC); + +/* func_801809EC — guarded dispatch: ask func_80181388(9, 0x12); if it answers + * NON-zero, run func_801805E0 on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_80181388(s32 arg0, s32 arg1); +extern void func_801805E0(void *arg0); + +void func_801809EC(void *arg0) { + if (func_80181388(9, 0x12) != 0) { + func_801805E0(arg0); + } +} + /* func_80180A2C — guarded dispatch: ask func_80181388(9, 0x12); if it answers @@ -3789,7 +3824,21 @@ INCLUDE_ASM("asm/ov_SC04_020/nonmatchings/ov_SC04_020_jr_8017D604", func_8018207 INCLUDE_ASM("asm/ov_SC04_020/nonmatchings/ov_SC04_020_jr_8017D604", func_801820E0); -INCLUDE_ASM("asm/ov_SC04_020/nonmatchings/ov_SC04_020_jr_8017D604", func_80182154); +void func_80182154(s32 a0) { + + extern s16 D_801B5EFC[]; + extern s32 D_801B5EBC[][2]; + *(s16 *)(a0 + 0x2) = 3; + *(s16 *)(a0 + 0x34) = 0; + *(s16 *)(a0 + 0xFE) = 0; + *(s16 *)(a0 + 0x100) = 0; + *(s16 *)(a0 + 0x102) = 2; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x24) = D_801B5EBC[D_801B5EFC[*(s16 *)(a0 + 0x70)]][0]; + *(s16 *)(a0 + 0x84) = 0; + *(s16 *)(a0 + 0x5C) = 0x800; + *(s32 *)(a0 + 0xB0) = 0; +} + INCLUDE_ASM("asm/ov_SC04_020/nonmatchings/ov_SC04_020_jr_8017D604", func_801821B4); diff --git a/src/ov_SC04_021/ov_SC04_021_jr_80135D20.c b/src/ov_SC04_021/ov_SC04_021_jr_80135D20.c index 6bf97a248d..31e962a90f 100644 --- a/src/ov_SC04_021/ov_SC04_021_jr_80135D20.c +++ b/src/ov_SC04_021/ov_SC04_021_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_021/nonmatchings/ov_SC04_021_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017F82C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017F82C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017F82C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017F82C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017F82C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC04_021/ov_SC04_021_jr_80154C24.c b/src/ov_SC04_021/ov_SC04_021_jr_80154C24.c index 10412ea9d3..6d8ef76d83 100644 --- a/src/ov_SC04_021/ov_SC04_021_jr_80154C24.c +++ b/src/ov_SC04_021/ov_SC04_021_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC04_021/nonmatchings/ov_SC04_021_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801815B4)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801815B4[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801815B4[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_000/ov_SC05_000_jr_80135D20.c b/src/ov_SC05_000/ov_SC05_000_jr_80135D20.c index ad3eee7624..d039aa243a 100644 --- a/src/ov_SC05_000/ov_SC05_000_jr_80135D20.c +++ b/src/ov_SC05_000/ov_SC05_000_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_000/nonmatchings/ov_SC05_000_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017E840[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017E840[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017E840[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017E840[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017E840[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_000/ov_SC05_000_jr_80154C24.c b/src/ov_SC05_000/ov_SC05_000_jr_80154C24.c index 759d2274f3..13b435634e 100644 --- a/src/ov_SC05_000/ov_SC05_000_jr_80154C24.c +++ b/src/ov_SC05_000/ov_SC05_000_jr_80154C24.c @@ -1672,7 +1672,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_000/nonmatchings/ov_SC05_000_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801805C8)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801805C8[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801805C8[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_001/ov_SC05_001_jr_80135D20.c b/src/ov_SC05_001/ov_SC05_001_jr_80135D20.c index 5fa57de9c5..a45c8620e7 100644 --- a/src/ov_SC05_001/ov_SC05_001_jr_80135D20.c +++ b/src/ov_SC05_001/ov_SC05_001_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018601C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018601C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018601C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018601C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018601C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_001/ov_SC05_001_jr_80154C24.c b/src/ov_SC05_001/ov_SC05_001_jr_80154C24.c index 23768c7b2d..8874c1ae00 100644 --- a/src/ov_SC05_001/ov_SC05_001_jr_80154C24.c +++ b/src/ov_SC05_001/ov_SC05_001_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80187DA4)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80187DA4[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80187DA4[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_001/ov_SC05_001_jr_8017BEBC.c b/src/ov_SC05_001/ov_SC05_001_jr_8017BEBC.c index 9967f2fb6e..92751640be 100644 --- a/src/ov_SC05_001/ov_SC05_001_jr_8017BEBC.c +++ b/src/ov_SC05_001/ov_SC05_001_jr_8017BEBC.c @@ -384,7 +384,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3180,7 +3179,15 @@ void func_8017CDD8(void *a0) { } -INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_8017CE14); +extern void func_80147324(s32 arg0); +void func_8017CE14(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3209,7 +3216,20 @@ INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_8017CEC INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_8017CF44); -INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_8017D0AC); +extern void func_8017D0F8(int); +extern void func_80146C3C(void); +void func_8017D0AC(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D0F8(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_8017D0F8); @@ -3221,7 +3241,13 @@ void func_8017D404(void *a0) { } -INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_8017D440); +extern void func_80147324(s32 arg0); +void func_8017D440(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D480 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3323,7 +3349,25 @@ void func_8017D57C(void *a0) } -INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_8017D650); +extern void func_8017D0F8(int); +extern void func_80146C3C(void); +void func_8017D650(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D0F8)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_801894A8[])(void); @@ -3335,7 +3379,22 @@ void func_8017D6A4(void *a0) { INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_8017D6E0); -INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_8017D794); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017D7F0(void *a0); +void func_8017D794(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017D7F0(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_8017D7F0); @@ -3810,7 +3869,58 @@ extern void func_8012A828(s32 *a0, s32 a1); } -INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_801818A4); + +extern s32 func_8012BCCC(s32 a0); +extern void func_8001C924(s32 a0, void *a1); +extern void func_8012A828(s32*, s32); +extern s32 func_8012B8E4(s32 a0, s32 a1); +extern s32 func_8012BEE8(s32 a0); + +// @class: straight-derive +// @stuck: none — MATCH (52 ins) on iteration 1, confirmed by rtu_match. +// +// Two things that could have been mis-read off the target asm: +// +// 1. RELOAD_CSE DELETES A REDUNDANT ARG MOVE — do not read "no arg setup" as +// "zero-arg call". `jal func_8012BCCC` at 0x80184C7C has a bare `nop` delay +// slot and NO `addu $a0,$s0,$zero` before it, which looks like `f()`. It is +// `f(a0)`: the incoming param is still live in $a0 in that fall-through +// block, so gcc-2.7.2's reload_cse_regs (reload1.c) deletes the redundant +// `move $a0,$s0`. The SAME move survives at .L80184CD0 (0x80184CD0) because +// reload_cse's value tracking resets at a CODE_LABEL. So: an arg move that +// is present on the labelled arm and absent on the fall-through arm is ONE +// source-level call shape, not two. +// +// 2. `lui $v1,1 / slt $v1,$v1,$v0` is `ret <= 0x10000`, not `ret < 0x10001`. +// gcc lowers `a <= C` to `!(C < a)` and puts the CONSTANT in the first slt +// operand; writing `< 0x10001` would have materialised 0x10001 instead. +// +// Statement order in the then-arm is the Ghidra order (0x1C store, then the +// 0x34 increment): memrefs_conflict_p disambiguates `+0x1C`/4 from `+0x34`/2 +// off the same base, so sched2 legally hoists the `lhu 0x34` above the `sw` +// to cover its load delay — which is exactly the target's interleave. +void func_801818A4(s32 a0) { + + extern u8 D_801AABD0; + extern u8 D_801ADCFC[]; + s32 v; + + if (*(u16 *)(a0 + 0x34) == 0) { + if (func_8012BCCC(a0) <= 0x10000) { + func_8001C924(*(s32 *)(a0 + 0x20), (void *)&D_801AABD0); + ((void (*)(s32, void *))func_8012A828)(a0, (void *)&(*(u8 *)D_801ADCFC)); + *(s32 *)(a0 + 0x1C) = 0x1E; + *(u16 *)(a0 + 0x34) += 1; + } + } else { + v = func_8012B8E4(a0, 0xA); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) += v; + if (func_8012BEE8(a0) != 0 || v == 0) { + *(s16 *)(a0 + 0x2) = 5; + } + } +} + INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_80181974); @@ -3833,7 +3943,48 @@ INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_80181C9 INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_80181CE0); -INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_80181E08); + +/* func_80181E08 — entity state-kick #0xB. + * Sets the state word at 0x02 to 0xB, hands the entity to the script runner + * func_8012A828 with table D_801ADCFC, clears bit 3 of the flag word at 0xDC, + * then picks the timer at 0x1C: a fixed 30 when bit 6 was set (also clearing + * bit 6), otherwise rand() % 16 + 15. Finally, if func_8012BD3C(e,0x400,0x8000) + * returns 0, bit 3 at 0xDC is set again. + * + * §71 sibling-first: func_80184D28 (same TU, same D_801ADCFC script table) is + * the same `sh 0x2 / jal func_8012A828 / jal rand / sw 0x1C` skeleton and pins + * the widths: `sh` at 0x02, `sw` at 0x1C/0xDC, and the s16 store scheduled into + * the jal delay slot. + */ + +extern void func_8012A828(s32*, s32); +extern s32 func_8012BD3C(s32 a0, s32 a1, s32 a2); +extern s32 rand(void); + +void func_80181E08(void *a0) { + + extern u8 D_801ADCFC[]; + s32 flags; + s32 cleared; + s32 timer; + + *(s16 *)((s32)a0 + 0x2) = 0xB; + ((void (*)(s32, void *))func_8012A828)((s32)a0, D_801ADCFC); + flags = *(s32 *)((s32)a0 + 0xDC); + cleared = flags & ~8; + *(s32 *)((s32)a0 + 0xDC) = cleared; + if (flags & 0x40) { + *(s32 *)((s32)a0 + 0xDC) = cleared & ~0x40; + timer = 30; + } else { + timer = rand() % 16 + 15; + } + *(s32 *)((s32)a0 + 0x1C) = timer; + if (func_8012BD3C((s32)a0, 0x400, 0x8000) == 0) { + *(s32 *)((s32)a0 + 0xDC) |= 8; + } +} + INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_80181EC0); @@ -3915,13 +4066,130 @@ void func_80182354(s32 *a0) { } -INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_80182364); + +// @class: regalloc (WIDTH/li!=addu -> MATCH) +// @stuck: none — MATCH (58 ins), match_one + rtu_match. PIN-FREE (no register __asm__). +// Three levers, in the order they mattered: +// +// 1) The join block indexes every field off $a0, not $s0: the target COPIES the entity into $a0 +// at the TOP of the join block (`addu $a0,$s0,$zero`) and reads 0x5C/0x5E/0x60/0x62/0x20 off +// that copy. A naive `e = param_1;` at the join is deleted — cse.c's make_regs_eqv keeps the +// PARAMETER as qty_first_reg, so canon_reg rewrites every use of `e` back to param_1 and the +// copy dies. Writing the copy at the end of the ARMS instead is worse (2 mismatches worse): +// gcc hoists it above the inner `if` into the beqz delay slot and the arms then read off $a0. +// +// 2) THE LEVER: make the copy's variable ALSO the 0x20 pointer of the /4 arm. make_regs_eqv only +// lets the new pseudo take over the quantity when its live range escapes the cse basic block +// AND outlives the param's last use. Reusing `a` in the /4 arm (which sits *after* the join in +// the insn stream, and whose last mention `sh $v0,0x18($a0)` comes after param_1's last mention +// `lh $v0,0x100($s0)`) satisfies both clauses at once, so `a` becomes canonical, the copy +// survives, and the block addresses off it. The same reuse is what puts `lw $a0,0x20($s0)` / +// `lh $v1,0x18($a0)` in the /4 arm in the target's register order — two separate locals there +// give the mirrored $v1/$a0 pair (6 extra mismatches; verified). The reuse must be paired with +// the join-top copy: `a` shared but copied in the arm instead makes it a plain global allocno, +// global.c hands it a callee-saved reg and the function grows an $s1 save/restore (60 ins). +// A `register s32 a __asm__("$4")` pin also reaches 0 here (canon_reg bails on hard regs), but +// the pin is unnecessary and would trip the §42e/§86 pin guard on the ×6 family remap. +// +// 3) Tail statement order is 0x5C, 0x60, 0x62, 0x5E — the 0x5E store must be LAST. sched2 works +// the ready list LIFO, so a 0x5E written third floats to the front of the block as +// `li $v0,1 / sh $v0,0x5E` and steals $v0 from the 0x5C load-modify-store (9 mismatches). +// Written last it sinks past `lhu $v0,0x12($v1)`, reuses the now-dead $v1 for its constant and +// lands where the target has it. (All 24 orderings byte-swept: only 5C-60-62-5E and +// 60-5C-62-5E reach 0.) +// +// Widths: 0x100 is read at TWO widths on purpose — `u16` in the flag arm (target `lhu`) and `s16` +// in the /4 arm (target `lh`); combine folds the extend into the load, so the cast at the use site +// picks the opcode. Ditto `|= 1` on the s16 0x5C field giving `lhu`. §3-T4: both `beqz`es mean +// the NON-zero arm falls through, i.e. `func_8012BEE8(..) != 0` and `flags & 0x80` are the +// fall-through arms (Ghidra's seed for this address was a different function entirely). + +extern s32 func_8012BEE8(s32 a0); +extern void func_80131E00(); + +void func_80182364(s32 param_1) { + s32 a; + s32 p; + s32 q; + s32 x; + s32 t; + u16 h; + + if (func_8012BEE8(param_1) != 0) { + if (*(s32 *)(param_1 + 0xDC) & 0x80) { + p = *(s32 *)(param_1 + 0x20); + *(s16 *)(p + 0x1C) = 0x1000; + *(s16 *)(p + 0x18) = 0x1000; + *(s32 *)(param_1 + 0xDC) &= ~0x80; + } else { + p = *(s32 *)(param_1 + 0x20); + h = *(u16 *)(param_1 + 0x100); + *(s16 *)(p + 0x1C) = h; + *(s16 *)(p + 0x18) = h; + } + a = param_1; + *(s16 *)(a + 0x5C) |= 1; + *(s16 *)(a + 0x60) = 0; + q = *(s32 *)(a + 0x20); + *(s16 *)(a + 0x62) = *(u16 *)(q + 0x12) + 0x800; + *(s16 *)(a + 0x5E) = 1; + ((void (*)(s32, s32))func_80131E00)(a, 1); + } else { + a = *(s32 *)(param_1 + 0x20); + x = *(s16 *)(a + 0x18); + t = x + (*(s16 *)(param_1 + 0x100) - x) / 4; + *(s16 *)(a + 0x1C) = t; + *(s16 *)(a + 0x18) = t; + } +} + INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_8018244C); INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_801824A8); -INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_80182530); +// the beqz delay slot), so it is the FIRST statement, above the if; (3) both `*(s32*)(p+0x20)` +// reads in arm A are written as separate expressions — the intervening `sh` to 0x10 blocks CSE, +// which is why the target reloads 0x20 twice; (4) the tail compare is `iVar1 <= 0x8FFF`, NOT +// Ghidra's `< 0x9000`: 0x9000 does not fit the signed 16-bit `slti` immediate, so gcc +// materialises the bound with `ori $v1,$zero,0x8FFF` and emits the operand-reversed +// `slt $v1,$v1,$v0` + `bnez` over the 0x51F assignment (write the constant as 0x8FFF). +extern void func_8012A828(s32*, s32); +extern void func_8001C924(s32 a0, void *a1); +extern s32 func_8012BCCC(s32 a0); +extern void func_8002D4C8(s32 a0, s32 a1); + + +void func_80182530(s32 param_1) { + + extern u8 D_801AE2C4; + extern u8 D_801AC580; + extern u8 D_801AE1E4; + s32 iVar1; + s32 uVar2; + + *(s16 *)(param_1 + 0x5C) = 0; + if (*(s32 *)(param_1 + 0xDC) & 2) { + *(s32 *)(param_1 + 0x1C) = 0x2D; + ((void (*)(s32, void *))func_8012A828)(param_1, &D_801AE2C4); + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x10) = 0; + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = + (*(u16 *)(param_1 + 0x62) + 0x800) & 0xFFF; + *(s16 *)(param_1 + 0x52) = 0; + } else { + *(s32 *)(param_1 + 0x1C) = 0x37; + func_8001C924(*(s32 *)(param_1 + 0x20), &D_801AC580); + ((void (*)(s32, void *))func_8012A828)(param_1, &D_801AE1E4); + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = *(u16 *)(param_1 + 0x62); + } + iVar1 = func_8012BCCC(param_1); + uVar2 = 0x520; + if (iVar1 <= 0x8FFF) { + uVar2 = 0x51F; + } + func_8002D4C8(uVar2, 0); +} + INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_80182600); @@ -4062,7 +4330,31 @@ INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_80184CA INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_80184F30); -INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_801850C4); + +/* func_801850C4 — "is another entity of type 0x35C sharing my 0x64 owner?" + * + * Walks the 0x60-entry entity table at D_801202A0 (stride 0x10C) with an int + * counter (the target keeps the count in $a2 and `slti ...,0x60`, so it is a + * counted loop, NOT the D_80126720 pointer-bound idiom the sibling walkers + * use). Returns 1 for the first entry whose u16 kind == 0x35C, whose word at + * 0x64 equals the caller's word at 0x64, and which is not the caller itself. + */ +s32 func_801850C4(s32 arg0) { + extern u8 D_801202A0[]; + u8 *p; + s32 i; + + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == 0x35C && *(s32 *)(arg0 + 0x64) == *(s32 *)(p + 0x64) && + arg0 != (s32)p) { + return 1; + } + p += 0x10C; + } + return 0; +} + extern void func_8012EC04(s32 param_1, s32 param_2, s32 *param_3); @@ -4084,7 +4376,24 @@ void func_8018511C(s32 arg0) { } -INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_80185198); + +/* func_80185198 — guard-then-free tail (cookbook §71 sibling shape: + * src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c func_80144458 tail, and + * src/ov_SC03_099/ov_SC03_099_jr_80140608.c:2432 func_80016714(x, 0x38)). */ + +extern void func_80016714(void *a0, s32 a1); +extern void func_8012C218(void *a0); + +void func_80185198(void *arg0) { + void *temp_a0; + + temp_a0 = *(void **)((char *)arg0 + 0xCC); + if (temp_a0 != NULL) { + func_80016714(temp_a0, 0x38); + } + func_8012C218(arg0); +} + INCLUDE_ASM("asm/ov_SC05_001/nonmatchings/ov_SC05_001_jr_8017BEBC", func_801851DC); diff --git a/src/ov_SC05_002/ov_SC05_002_jr_80135D20.c b/src/ov_SC05_002/ov_SC05_002_jr_80135D20.c index 57981f51df..69ff8a0ad2 100644 --- a/src/ov_SC05_002/ov_SC05_002_jr_80135D20.c +++ b/src/ov_SC05_002/ov_SC05_002_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_002/nonmatchings/ov_SC05_002_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801807DC[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801807DC[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801807DC[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801807DC[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801807DC[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_002/ov_SC05_002_jr_80154C24.c b/src/ov_SC05_002/ov_SC05_002_jr_80154C24.c index ff37cbee8c..45cddb6395 100644 --- a/src/ov_SC05_002/ov_SC05_002_jr_80154C24.c +++ b/src/ov_SC05_002/ov_SC05_002_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_002/nonmatchings/ov_SC05_002_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80182564)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80182564[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80182564[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_002/ov_SC05_002_jr_8017BEBC.c b/src/ov_SC05_002/ov_SC05_002_jr_8017BEBC.c index 86e8cc3d5d..72e0a6521a 100644 --- a/src/ov_SC05_002/ov_SC05_002_jr_8017BEBC.c +++ b/src/ov_SC05_002/ov_SC05_002_jr_8017BEBC.c @@ -3483,9 +3483,54 @@ s32 func_8017E414(void) { INCLUDE_ASM("asm/ov_SC05_002/nonmatchings/ov_SC05_002_jr_8017BEBC", func_8017E41C); -INCLUDE_ASM("asm/ov_SC05_002/nonmatchings/ov_SC05_002_jr_8017BEBC", func_8017E4C0); -INCLUDE_ASM("asm/ov_SC05_002/nonmatchings/ov_SC05_002_jr_8017BEBC", func_8017E53C); +extern void func_8017F194(void *a0); + +void func_8017E4C0(void *a0) { + + extern void (*D_80199FD4[])(void); + D_80199FD4[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)((s32)a0 + 0x0) != 0) { + *(s32 *)((s32)a0 + 0xE8) = *(s32 *)((s32)a0 + 0xE8) + 1; + if ((*(s32 *)((s32)a0 + 0xE8) & 0xF) == 0) { + func_8017F194(a0); + } + } +} + + + +extern s32 rand(void); +extern s32 func_8012C354(s32 *a0, s32 a1); +extern void func_8012A828(s32 *a0, s32 a1); +extern void func_80143994(s32 *a0, s32 a1); + + +void func_8017E53C(void *arg0) { + + extern s32 D_80199F68; + extern s32 D_80199FAC; + extern s32 D_8019C4C4; + s32 t; + + if (func_8012C354(arg0, &D_80199F68)) { + *(u8 *)((char *)arg0 + 0xC0) = 1; + *(s32 *)((char *)arg0 + 0xB4) = -1; + *(s32 **)((char *)arg0 + 0xBC) = &D_80199FAC; + *(u32 *)((char *)arg0 + 0xC4) |= 1; + *(s32 *)((char *)arg0 + 0xE4) = -((rand() % 8 + 0xC) << 16); + func_8012A828(arg0, &D_8019C4C4); + func_80143994(arg0, 0x1000); + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + if (t != 0) { + t = 3; + } else { + t = 1; + } + *(s16 *)((char *)arg0 + 0x2) = t; + } +} + INCLUDE_ASM("asm/ov_SC05_002/nonmatchings/ov_SC05_002_jr_8017BEBC", func_8017E5FC); @@ -3499,7 +3544,36 @@ INCLUDE_ASM("asm/ov_SC05_002/nonmatchings/ov_SC05_002_jr_8017BEBC", func_8017EC7 INCLUDE_ASM("asm/ov_SC05_002/nonmatchings/ov_SC05_002_jr_8017BEBC", func_8017ED88); -INCLUDE_ASM("asm/ov_SC05_002/nonmatchings/ov_SC05_002_jr_8017BEBC", func_8017EF24); + +extern s32 func_8012BEE8(s32 a0); +extern s32 func_8012E778(s32 a0, s32 a1); +extern void func_8012E88C(s32 a0); +extern void func_8012A828(s32 *a0, s32 a1); + +void func_8017EF24(void *arg0) { + + extern s32 D_8019C4C4; + if (func_8012BEE8((s32)arg0)) { + if (!func_8012E778((s32)arg0, 0xA000C8)) { + { + s32 t; + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + *(s16 *)((char *)arg0 + 0x2) = (t == 0) ? 1 : 3; + } + *(s16 *)((char *)arg0 + 0x5C) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78) + 0x2); + *(s16 *)((char *)arg0 + 0x76) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78)); + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1A) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1C) = 0x1000; + *(u16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x2C) &= 0x10; + func_8012E88C((s32)arg0); + func_8012A828(arg0, &D_8019C4C4); + } + } +} + INCLUDE_ASM("asm/ov_SC05_002/nonmatchings/ov_SC05_002_jr_8017BEBC", func_8017EFE0); diff --git a/src/ov_SC05_003/ov_SC05_003_jr_80135D20.c b/src/ov_SC05_003/ov_SC05_003_jr_80135D20.c index 4827a2bf39..f1a5778877 100644 --- a/src/ov_SC05_003/ov_SC05_003_jr_80135D20.c +++ b/src/ov_SC05_003/ov_SC05_003_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_003/nonmatchings/ov_SC05_003_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80182B14[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80182B14[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80182B14[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80182B14[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80182B14[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_003/ov_SC05_003_jr_80154C24.c b/src/ov_SC05_003/ov_SC05_003_jr_80154C24.c index 2f57490d59..bbc9c4e03a 100644 --- a/src/ov_SC05_003/ov_SC05_003_jr_80154C24.c +++ b/src/ov_SC05_003/ov_SC05_003_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_003/nonmatchings/ov_SC05_003_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018489C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018489C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018489C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_003/ov_SC05_003_jr_8017BEBC.c b/src/ov_SC05_003/ov_SC05_003_jr_8017BEBC.c index 7c7778abe5..024f9036fd 100644 --- a/src/ov_SC05_003/ov_SC05_003_jr_8017BEBC.c +++ b/src/ov_SC05_003/ov_SC05_003_jr_8017BEBC.c @@ -384,7 +384,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3570,7 +3569,34 @@ void func_8017EF04(void) { INCLUDE_ASM("asm/ov_SC05_003/nonmatchings/ov_SC05_003_jr_8017BEBC", func_8017EF0C); -INCLUDE_ASM("asm/ov_SC05_003/nonmatchings/ov_SC05_003_jr_8017BEBC", func_8017EF88); + +/* func_8017EF88 — light/colour ramp-up on the entity's attached prim block. + * + * If the s16 flag at 0xFE is set, bump the three u16 colour words at + * 0x18/0x1A/0x1C of the block pointed to by the word at 0x20 by 0x40 each, + * then clamp all three to 0x1800 once the first one reaches it. + * + * Widths pinned off the target: `lh` at 0xFE and at 0x18 (the signed compare), + * `lhu` for the three read-modify-writes, `sh` for every store. The pointer at + * 0x20 is re-loaded before each RMW (the `sh` stores may alias it), which is + * exactly what writing the deref inline gives. + */ +void func_8017EF88(int param_1) { + int v1; + + if (*(short *)(param_1 + 0xfe) != 0) { + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x18) += 0x40; + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x1a) += 0x40; + *(unsigned short *)(*(int *)(param_1 + 0x20) + 0x1c) += 0x40; + v1 = *(int *)(param_1 + 0x20); + if (*(short *)(v1 + 0x18) >= 0x1800) { + *(short *)(v1 + 0x1c) = 0x1800; + *(short *)(v1 + 0x1a) = 0x1800; + *(short *)(v1 + 0x18) = 0x1800; + } + } +} + INCLUDE_ASM("asm/ov_SC05_003/nonmatchings/ov_SC05_003_jr_8017BEBC", func_8017F010); @@ -3680,7 +3706,18 @@ INCLUDE_ASM("asm/ov_SC05_003/nonmatchings/ov_SC05_003_jr_8017BEBC", func_8018143 INCLUDE_ASM("asm/ov_SC05_003/nonmatchings/ov_SC05_003_jr_8017BEBC", func_801814D8); -INCLUDE_ASM("asm/ov_SC05_003/nonmatchings/ov_SC05_003_jr_8017BEBC", func_80181540); + +extern void func_80181720(void *a0); + +void func_80181540(void *a0) { + + extern void (*D_801A47A8[])(void); + D_801A47A8[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)a0 != 0) { + func_80181720(a0); + } +} + INCLUDE_ASM("asm/ov_SC05_003/nonmatchings/ov_SC05_003_jr_8017BEBC", func_801815A0); @@ -3733,7 +3770,31 @@ INCLUDE_ASM("asm/ov_SC05_003/nonmatchings/ov_SC05_003_jr_8017BEBC", func_80181F7 INCLUDE_ASM("asm/ov_SC05_003/nonmatchings/ov_SC05_003_jr_8017BEBC", func_80182208); -INCLUDE_ASM("asm/ov_SC05_003/nonmatchings/ov_SC05_003_jr_8017BEBC", func_8018239C); + +/* func_8018239C — "is another entity of type 0x35C sharing my 0x64 owner?" + * + * Walks the 0x60-entry entity table at D_801202A0 (stride 0x10C) with an int + * counter (the target keeps the count in $a2 and `slti ...,0x60`, so it is a + * counted loop, NOT the D_80126720 pointer-bound idiom the sibling walkers + * use). Returns 1 for the first entry whose u16 kind == 0x35C, whose word at + * 0x64 equals the caller's word at 0x64, and which is not the caller itself. + */ +s32 func_8018239C(s32 arg0) { + extern u8 D_801202A0[]; + u8 *p; + s32 i; + + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == 0x35C && *(s32 *)(arg0 + 0x64) == *(s32 *)(p + 0x64) && + arg0 != (s32)p) { + return 1; + } + p += 0x10C; + } + return 0; +} + extern void func_8012EC04(s32 param_1, s32 param_2, s32 *param_3); @@ -3755,7 +3816,24 @@ void func_801823F4(s32 arg0) { } -INCLUDE_ASM("asm/ov_SC05_003/nonmatchings/ov_SC05_003_jr_8017BEBC", func_80182470); + +/* func_80182470 — guard-then-free tail (cookbook §71 sibling shape: + * src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c func_80144458 tail, and + * src/ov_SC03_099/ov_SC03_099_jr_80140608.c:2432 func_80016714(x, 0x38)). */ + +extern void func_80016714(void *a0, s32 a1); +extern void func_8012C218(void *a0); + +void func_80182470(void *arg0) { + void *temp_a0; + + temp_a0 = *(void **)((char *)arg0 + 0xCC); + if (temp_a0 != NULL) { + func_80016714(temp_a0, 0x38); + } + func_8012C218(arg0); +} + INCLUDE_ASM("asm/ov_SC05_003/nonmatchings/ov_SC05_003_jr_8017BEBC", func_801824B4); diff --git a/src/ov_SC05_004/ov_SC05_004_jr_80135D20.c b/src/ov_SC05_004/ov_SC05_004_jr_80135D20.c index bbc88dd2ab..51512b2eaf 100644 --- a/src/ov_SC05_004/ov_SC05_004_jr_80135D20.c +++ b/src/ov_SC05_004/ov_SC05_004_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_004/nonmatchings/ov_SC05_004_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80181C20[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80181C20[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80181C20[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80181C20[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80181C20[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_004/ov_SC05_004_jr_80154C24.c b/src/ov_SC05_004/ov_SC05_004_jr_80154C24.c index 1a1b1ac160..c4294ac3bf 100644 --- a/src/ov_SC05_004/ov_SC05_004_jr_80154C24.c +++ b/src/ov_SC05_004/ov_SC05_004_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_004/nonmatchings/ov_SC05_004_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801839A8)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801839A8[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801839A8[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_004/ov_SC05_004_jr_8017BEBC.c b/src/ov_SC05_004/ov_SC05_004_jr_8017BEBC.c index d56f17a033..ccf718c883 100644 --- a/src/ov_SC05_004/ov_SC05_004_jr_8017BEBC.c +++ b/src/ov_SC05_004/ov_SC05_004_jr_8017BEBC.c @@ -3504,7 +3504,15 @@ extern void func_8012E688(s32 arg0, s32 arg1, s32 arg2); } -INCLUDE_ASM("asm/ov_SC05_004/nonmatchings/ov_SC05_004_jr_8017BEBC", func_80180B1C); + + +extern void func_8012E688(s32 arg0, s32 arg1, s32 arg2); + extern void func_8002AC00(s32 arg0); + void func_80180B1C(void *arg0) { + func_8012E688((s32)arg0, 0x8C7, 0); + func_8002AC00(0x10); + } + void func_80180B48(void) { } diff --git a/src/ov_SC05_005/ov_SC05_005_jr_80135D20.c b/src/ov_SC05_005/ov_SC05_005_jr_80135D20.c index 1b5c853654..6f3386ca29 100644 --- a/src/ov_SC05_005/ov_SC05_005_jr_80135D20.c +++ b/src/ov_SC05_005/ov_SC05_005_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_005/nonmatchings/ov_SC05_005_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801829F4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801829F4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801829F4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801829F4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801829F4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_005/ov_SC05_005_jr_80154C24.c b/src/ov_SC05_005/ov_SC05_005_jr_80154C24.c index edfdd77e91..b20cf7ab26 100644 --- a/src/ov_SC05_005/ov_SC05_005_jr_80154C24.c +++ b/src/ov_SC05_005/ov_SC05_005_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_005/nonmatchings/ov_SC05_005_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018477C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018477C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018477C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_005/ov_SC05_005_jr_8017D898.c b/src/ov_SC05_005/ov_SC05_005_jr_8017D898.c index cea4850dff..c42bf466ad 100644 --- a/src/ov_SC05_005/ov_SC05_005_jr_8017D898.c +++ b/src/ov_SC05_005/ov_SC05_005_jr_8017D898.c @@ -3545,7 +3545,18 @@ INCLUDE_ASM("asm/ov_SC05_005/nonmatchings/ov_SC05_005_jr_8017D898", func_8018154 INCLUDE_ASM("asm/ov_SC05_005/nonmatchings/ov_SC05_005_jr_8017D898", func_801815E0); -INCLUDE_ASM("asm/ov_SC05_005/nonmatchings/ov_SC05_005_jr_8017D898", func_80181648); + +extern void func_80181828(void *a0); + +void func_80181648(void *a0) { + + extern void (*D_801A62CC[])(void); + D_801A62CC[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)a0 != 0) { + func_80181828(a0); + } +} + INCLUDE_ASM("asm/ov_SC05_005/nonmatchings/ov_SC05_005_jr_8017D898", func_801816A8); diff --git a/src/ov_SC05_006/ov_SC05_006_jr_80135D20.c b/src/ov_SC05_006/ov_SC05_006_jr_80135D20.c index f87ea5667f..b0649d7984 100644 --- a/src/ov_SC05_006/ov_SC05_006_jr_80135D20.c +++ b/src/ov_SC05_006/ov_SC05_006_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_006/nonmatchings/ov_SC05_006_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017FA14[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017FA14[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017FA14[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017FA14[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017FA14[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_006/ov_SC05_006_jr_80154C24.c b/src/ov_SC05_006/ov_SC05_006_jr_80154C24.c index c14f6f0478..1c43a0aba8 100644 --- a/src/ov_SC05_006/ov_SC05_006_jr_80154C24.c +++ b/src/ov_SC05_006/ov_SC05_006_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_006/nonmatchings/ov_SC05_006_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018179C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018179C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018179C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_006/ov_SC05_006_jr_8017BEBC.c b/src/ov_SC05_006/ov_SC05_006_jr_8017BEBC.c index 4f98262727..afd392103b 100644 --- a/src/ov_SC05_006/ov_SC05_006_jr_8017BEBC.c +++ b/src/ov_SC05_006/ov_SC05_006_jr_8017BEBC.c @@ -3180,7 +3180,15 @@ void func_8017CDD8(void *a0) { } -INCLUDE_ASM("asm/ov_SC05_006/nonmatchings/ov_SC05_006_jr_8017BEBC", func_8017CE14); +extern void func_80147324(s32 arg0); +void func_8017CE14(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -3209,7 +3217,20 @@ INCLUDE_ASM("asm/ov_SC05_006/nonmatchings/ov_SC05_006_jr_8017BEBC", func_8017CEC INCLUDE_ASM("asm/ov_SC05_006/nonmatchings/ov_SC05_006_jr_8017BEBC", func_8017CF44); -INCLUDE_ASM("asm/ov_SC05_006/nonmatchings/ov_SC05_006_jr_8017BEBC", func_8017D0AC); +extern void func_8017D0F8(int); +extern void func_80146C3C(void); +void func_8017D0AC(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_8017D0F8(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC05_006/nonmatchings/ov_SC05_006_jr_8017BEBC", func_8017D0F8); @@ -3221,7 +3242,13 @@ void func_8017D404(void *a0) { } -INCLUDE_ASM("asm/ov_SC05_006/nonmatchings/ov_SC05_006_jr_8017BEBC", func_8017D440); +extern void func_80147324(s32 arg0); +void func_8017D440(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_8017D480 — a state-tick: bump the frame counter at 0x1C; while it is @@ -3323,7 +3350,25 @@ void func_8017D57C(void *a0) } -INCLUDE_ASM("asm/ov_SC05_006/nonmatchings/ov_SC05_006_jr_8017BEBC", func_8017D650); +extern void func_8017D0F8(int); +extern void func_80146C3C(void); +void func_8017D650(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_8017D0F8)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_80182EA0[])(void); @@ -3335,7 +3380,22 @@ void func_8017D6A4(void *a0) { INCLUDE_ASM("asm/ov_SC05_006/nonmatchings/ov_SC05_006_jr_8017BEBC", func_8017D6E0); -INCLUDE_ASM("asm/ov_SC05_006/nonmatchings/ov_SC05_006_jr_8017BEBC", func_8017D794); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_8017D7F0(void *a0); +void func_8017D794(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_8017D7F0(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC05_006/nonmatchings/ov_SC05_006_jr_8017BEBC", func_8017D7F0); diff --git a/src/ov_SC05_007/ov_SC05_007_jr_80135D20.c b/src/ov_SC05_007/ov_SC05_007_jr_80135D20.c index 9942eafee0..1c99d4bd22 100644 --- a/src/ov_SC05_007/ov_SC05_007_jr_80135D20.c +++ b/src/ov_SC05_007/ov_SC05_007_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80181010[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80181010[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80181010[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80181010[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80181010[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_007/ov_SC05_007_jr_80154C24.c b/src/ov_SC05_007/ov_SC05_007_jr_80154C24.c index 76a50c43dc..8a3e810191 100644 --- a/src/ov_SC05_007/ov_SC05_007_jr_80154C24.c +++ b/src/ov_SC05_007/ov_SC05_007_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80182D98)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80182D98[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80182D98[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_007/ov_SC05_007_jr_8017BEBC.c b/src/ov_SC05_007/ov_SC05_007_jr_8017BEBC.c index 0b506ea916..f213b2051c 100644 --- a/src/ov_SC05_007/ov_SC05_007_jr_8017BEBC.c +++ b/src/ov_SC05_007/ov_SC05_007_jr_8017BEBC.c @@ -383,7 +383,6 @@ extern s32 func_80149D10(s32 a0); extern s32 func_80149E94(s32 a0); extern s32 func_80149DD8(s32 a0); extern s32 func_80149D9C(s32 a0); -extern u8 D_801202A0[]; extern s32 func_80149F2C(s32 a0, s32 a1); extern s32 func_80149E94(s32 arg0); extern void func_80149FA8(void); @@ -3459,7 +3458,58 @@ extern void func_8012A828(s32 *a0, s32 a1); } -INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017E124); + +extern s32 func_8012BCCC(s32 a0); +extern void func_8001C924(s32 a0, void *a1); +extern void func_8012A828(s32*, s32); +extern s32 func_8012B8E4(s32 a0, s32 a1); +extern s32 func_8012BEE8(s32 a0); + +// @class: straight-derive +// @stuck: none — MATCH (52 ins) on iteration 1, confirmed by rtu_match. +// +// Two things that could have been mis-read off the target asm: +// +// 1. RELOAD_CSE DELETES A REDUNDANT ARG MOVE — do not read "no arg setup" as +// "zero-arg call". `jal func_8012BCCC` at 0x80184C7C has a bare `nop` delay +// slot and NO `addu $a0,$s0,$zero` before it, which looks like `f()`. It is +// `f(a0)`: the incoming param is still live in $a0 in that fall-through +// block, so gcc-2.7.2's reload_cse_regs (reload1.c) deletes the redundant +// `move $a0,$s0`. The SAME move survives at .L80184CD0 (0x80184CD0) because +// reload_cse's value tracking resets at a CODE_LABEL. So: an arg move that +// is present on the labelled arm and absent on the fall-through arm is ONE +// source-level call shape, not two. +// +// 2. `lui $v1,1 / slt $v1,$v1,$v0` is `ret <= 0x10000`, not `ret < 0x10001`. +// gcc lowers `a <= C` to `!(C < a)` and puts the CONSTANT in the first slt +// operand; writing `< 0x10001` would have materialised 0x10001 instead. +// +// Statement order in the then-arm is the Ghidra order (0x1C store, then the +// 0x34 increment): memrefs_conflict_p disambiguates `+0x1C`/4 from `+0x34`/2 +// off the same base, so sched2 legally hoists the `lhu 0x34` above the `sw` +// to cover its load delay — which is exactly the target's interleave. +void func_8017E124(s32 a0) { + + extern u8 D_80194554; + extern u8 D_80197680[]; + s32 v; + + if (*(u16 *)(a0 + 0x34) == 0) { + if (func_8012BCCC(a0) <= 0x10000) { + func_8001C924(*(s32 *)(a0 + 0x20), (void *)&D_80194554); + ((void (*)(s32, void *))func_8012A828)(a0, (void *)&(*(u8 *)D_80197680)); + *(s32 *)(a0 + 0x1C) = 0x1E; + *(u16 *)(a0 + 0x34) += 1; + } + } else { + v = func_8012B8E4(a0, 0xA); + *(u16 *)(*(s32 *)(a0 + 0x20) + 0x12) += v; + if (func_8012BEE8(a0) != 0 || v == 0) { + *(s16 *)(a0 + 0x2) = 5; + } + } +} + INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017E1F4); @@ -3481,7 +3531,48 @@ INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017E51 INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017E560); -INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017E688); + +/* func_8017E688 — entity state-kick #0xB. + * Sets the state word at 0x02 to 0xB, hands the entity to the script runner + * func_8012A828 with table D_80197680, clears bit 3 of the flag word at 0xDC, + * then picks the timer at 0x1C: a fixed 30 when bit 6 was set (also clearing + * bit 6), otherwise rand() % 16 + 15. Finally, if func_8012BD3C(e,0x400,0x8000) + * returns 0, bit 3 at 0xDC is set again. + * + * §71 sibling-first: func_80184D28 (same TU, same D_80197680 script table) is + * the same `sh 0x2 / jal func_8012A828 / jal rand / sw 0x1C` skeleton and pins + * the widths: `sh` at 0x02, `sw` at 0x1C/0xDC, and the s16 store scheduled into + * the jal delay slot. + */ + +extern void func_8012A828(s32*, s32); +extern s32 func_8012BD3C(s32 a0, s32 a1, s32 a2); +extern s32 rand(void); + +void func_8017E688(void *a0) { + + extern u8 D_80197680[]; + s32 flags; + s32 cleared; + s32 timer; + + *(s16 *)((s32)a0 + 0x2) = 0xB; + ((void (*)(s32, void *))func_8012A828)((s32)a0, D_80197680); + flags = *(s32 *)((s32)a0 + 0xDC); + cleared = flags & ~8; + *(s32 *)((s32)a0 + 0xDC) = cleared; + if (flags & 0x40) { + *(s32 *)((s32)a0 + 0xDC) = cleared & ~0x40; + timer = 30; + } else { + timer = rand() % 16 + 15; + } + *(s32 *)((s32)a0 + 0x1C) = timer; + if (func_8012BD3C((s32)a0, 0x400, 0x8000) == 0) { + *(s32 *)((s32)a0 + 0xDC) |= 8; + } +} + INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017E740); @@ -3564,13 +3655,130 @@ void func_8017EBD4(s32 *a0) { } -INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017EBE4); + +// @class: regalloc (WIDTH/li!=addu -> MATCH) +// @stuck: none — MATCH (58 ins), match_one + rtu_match. PIN-FREE (no register __asm__). +// Three levers, in the order they mattered: +// +// 1) The join block indexes every field off $a0, not $s0: the target COPIES the entity into $a0 +// at the TOP of the join block (`addu $a0,$s0,$zero`) and reads 0x5C/0x5E/0x60/0x62/0x20 off +// that copy. A naive `e = param_1;` at the join is deleted — cse.c's make_regs_eqv keeps the +// PARAMETER as qty_first_reg, so canon_reg rewrites every use of `e` back to param_1 and the +// copy dies. Writing the copy at the end of the ARMS instead is worse (2 mismatches worse): +// gcc hoists it above the inner `if` into the beqz delay slot and the arms then read off $a0. +// +// 2) THE LEVER: make the copy's variable ALSO the 0x20 pointer of the /4 arm. make_regs_eqv only +// lets the new pseudo take over the quantity when its live range escapes the cse basic block +// AND outlives the param's last use. Reusing `a` in the /4 arm (which sits *after* the join in +// the insn stream, and whose last mention `sh $v0,0x18($a0)` comes after param_1's last mention +// `lh $v0,0x100($s0)`) satisfies both clauses at once, so `a` becomes canonical, the copy +// survives, and the block addresses off it. The same reuse is what puts `lw $a0,0x20($s0)` / +// `lh $v1,0x18($a0)` in the /4 arm in the target's register order — two separate locals there +// give the mirrored $v1/$a0 pair (6 extra mismatches; verified). The reuse must be paired with +// the join-top copy: `a` shared but copied in the arm instead makes it a plain global allocno, +// global.c hands it a callee-saved reg and the function grows an $s1 save/restore (60 ins). +// A `register s32 a __asm__("$4")` pin also reaches 0 here (canon_reg bails on hard regs), but +// the pin is unnecessary and would trip the §42e/§86 pin guard on the ×6 family remap. +// +// 3) Tail statement order is 0x5C, 0x60, 0x62, 0x5E — the 0x5E store must be LAST. sched2 works +// the ready list LIFO, so a 0x5E written third floats to the front of the block as +// `li $v0,1 / sh $v0,0x5E` and steals $v0 from the 0x5C load-modify-store (9 mismatches). +// Written last it sinks past `lhu $v0,0x12($v1)`, reuses the now-dead $v1 for its constant and +// lands where the target has it. (All 24 orderings byte-swept: only 5C-60-62-5E and +// 60-5C-62-5E reach 0.) +// +// Widths: 0x100 is read at TWO widths on purpose — `u16` in the flag arm (target `lhu`) and `s16` +// in the /4 arm (target `lh`); combine folds the extend into the load, so the cast at the use site +// picks the opcode. Ditto `|= 1` on the s16 0x5C field giving `lhu`. §3-T4: both `beqz`es mean +// the NON-zero arm falls through, i.e. `func_8012BEE8(..) != 0` and `flags & 0x80` are the +// fall-through arms (Ghidra's seed for this address was a different function entirely). + +extern s32 func_8012BEE8(s32 a0); +extern void func_80131E00(); + +void func_8017EBE4(s32 param_1) { + s32 a; + s32 p; + s32 q; + s32 x; + s32 t; + u16 h; + + if (func_8012BEE8(param_1) != 0) { + if (*(s32 *)(param_1 + 0xDC) & 0x80) { + p = *(s32 *)(param_1 + 0x20); + *(s16 *)(p + 0x1C) = 0x1000; + *(s16 *)(p + 0x18) = 0x1000; + *(s32 *)(param_1 + 0xDC) &= ~0x80; + } else { + p = *(s32 *)(param_1 + 0x20); + h = *(u16 *)(param_1 + 0x100); + *(s16 *)(p + 0x1C) = h; + *(s16 *)(p + 0x18) = h; + } + a = param_1; + *(s16 *)(a + 0x5C) |= 1; + *(s16 *)(a + 0x60) = 0; + q = *(s32 *)(a + 0x20); + *(s16 *)(a + 0x62) = *(u16 *)(q + 0x12) + 0x800; + *(s16 *)(a + 0x5E) = 1; + ((void (*)(s32, s32))func_80131E00)(a, 1); + } else { + a = *(s32 *)(param_1 + 0x20); + x = *(s16 *)(a + 0x18); + t = x + (*(s16 *)(param_1 + 0x100) - x) / 4; + *(s16 *)(a + 0x1C) = t; + *(s16 *)(a + 0x18) = t; + } +} + INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017ECCC); INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017ED28); -INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017EDB0); +// the beqz delay slot), so it is the FIRST statement, above the if; (3) both `*(s32*)(p+0x20)` +// reads in arm A are written as separate expressions — the intervening `sh` to 0x10 blocks CSE, +// which is why the target reloads 0x20 twice; (4) the tail compare is `iVar1 <= 0x8FFF`, NOT +// Ghidra's `< 0x9000`: 0x9000 does not fit the signed 16-bit `slti` immediate, so gcc +// materialises the bound with `ori $v1,$zero,0x8FFF` and emits the operand-reversed +// `slt $v1,$v1,$v0` + `bnez` over the 0x51F assignment (write the constant as 0x8FFF). +extern void func_8012A828(s32*, s32); +extern void func_8001C924(s32 a0, void *a1); +extern s32 func_8012BCCC(s32 a0); +extern void func_8002D4C8(s32 a0, s32 a1); + + +void func_8017EDB0(s32 param_1) { + + extern u8 D_80197C48; + extern u8 D_80195F04; + extern u8 D_80197B68; + s32 iVar1; + s32 uVar2; + + *(s16 *)(param_1 + 0x5C) = 0; + if (*(s32 *)(param_1 + 0xDC) & 2) { + *(s32 *)(param_1 + 0x1C) = 0x2D; + ((void (*)(s32, void *))func_8012A828)(param_1, &D_80197C48); + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x10) = 0; + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = + (*(u16 *)(param_1 + 0x62) + 0x800) & 0xFFF; + *(s16 *)(param_1 + 0x52) = 0; + } else { + *(s32 *)(param_1 + 0x1C) = 0x37; + func_8001C924(*(s32 *)(param_1 + 0x20), &D_80195F04); + ((void (*)(s32, void *))func_8012A828)(param_1, &D_80197B68); + *(s16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = *(u16 *)(param_1 + 0x62); + } + iVar1 = func_8012BCCC(param_1); + uVar2 = 0x520; + if (iVar1 <= 0x8FFF) { + uVar2 = 0x51F; + } + func_8002D4C8(uVar2, 0); +} + INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017EE80); @@ -3599,9 +3807,54 @@ INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017F42 INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017F568); -INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017F5FC); -INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017F678); +extern void func_801802D0(void *a0); + +void func_8017F5FC(void *a0) { + + extern void (*D_80197CD4[])(void); + D_80197CD4[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)((s32)a0 + 0x0) != 0) { + *(s32 *)((s32)a0 + 0xE8) = *(s32 *)((s32)a0 + 0xE8) + 1; + if ((*(s32 *)((s32)a0 + 0xE8) & 0xF) == 0) { + func_801802D0(a0); + } + } +} + + + +extern s32 rand(void); +extern s32 func_8012C354(s32 *a0, s32 a1); +extern void func_8012A828(s32 *a0, s32 a1); +extern void func_80143994(s32 *a0, s32 a1); + + +void func_8017F678(void *arg0) { + + extern s32 D_80197C68; + extern s32 D_80197CAC; + extern s32 D_8019A1C4; + s32 t; + + if (func_8012C354(arg0, &D_80197C68)) { + *(u8 *)((char *)arg0 + 0xC0) = 1; + *(s32 *)((char *)arg0 + 0xB4) = -1; + *(s32 **)((char *)arg0 + 0xBC) = &D_80197CAC; + *(u32 *)((char *)arg0 + 0xC4) |= 1; + *(s32 *)((char *)arg0 + 0xE4) = -((rand() % 8 + 0xC) << 16); + func_8012A828(arg0, &D_8019A1C4); + func_80143994(arg0, 0x1000); + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + if (t != 0) { + t = 3; + } else { + t = 1; + } + *(s16 *)((char *)arg0 + 0x2) = t; + } +} + INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017F738); @@ -3616,7 +3869,36 @@ INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017FDB INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8017FEC4); -INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_80180060); + +extern s32 func_8012BEE8(s32 a0); +extern s32 func_8012E778(s32 a0, s32 a1); +extern void func_8012E88C(s32 a0); +extern void func_8012A828(s32 *a0, s32 a1); + +void func_80180060(void *arg0) { + + extern s32 D_8019A1C4; + if (func_8012BEE8((s32)arg0)) { + if (!func_8012E778((s32)arg0, 0xA000C8)) { + { + s32 t; + t = *(u16 *)((char *)arg0 + 0x70) & 0x10; + *(s16 *)((char *)arg0 + 0x2) = (t == 0) ? 1 : 3; + } + *(s16 *)((char *)arg0 + 0x5C) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78) + 0x2); + *(s16 *)((char *)arg0 + 0x76) = + *(u16 *)(*(s32 *)((char *)arg0 + 0x78)); + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x18) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1A) = + *(s16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x1C) = 0x1000; + *(u16 *)(*(s32 *)((char *)arg0 + 0x20) + 0x2C) &= 0x10; + func_8012E88C((s32)arg0); + func_8012A828(arg0, &D_8019A1C4); + } + } +} + INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8018011C); @@ -3661,7 +3943,31 @@ INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8018047 INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_80180704); -INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_80180898); + +/* func_80180898 — "is another entity of type 0x35C sharing my 0x64 owner?" + * + * Walks the 0x60-entry entity table at D_801202A0 (stride 0x10C) with an int + * counter (the target keeps the count in $a2 and `slti ...,0x60`, so it is a + * counted loop, NOT the D_80126720 pointer-bound idiom the sibling walkers + * use). Returns 1 for the first entry whose u16 kind == 0x35C, whose word at + * 0x64 equals the caller's word at 0x64, and which is not the caller itself. + */ +s32 func_80180898(s32 arg0) { + extern u8 D_801202A0[]; + u8 *p; + s32 i; + + p = D_801202A0; + for (i = 0; i < 0x60; i++) { + if (*(u16 *)p == 0x35C && *(s32 *)(arg0 + 0x64) == *(s32 *)(p + 0x64) && + arg0 != (s32)p) { + return 1; + } + p += 0x10C; + } + return 0; +} + extern void func_8012EC04(s32 param_1, s32 param_2, s32 *param_3); @@ -3683,7 +3989,24 @@ void func_801808F0(s32 arg0) { } -INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_8018096C); + +/* func_8018096C — guard-then-free tail (cookbook §71 sibling shape: + * src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c func_80144458 tail, and + * src/ov_SC03_099/ov_SC03_099_jr_80140608.c:2432 func_80016714(x, 0x38)). */ + +extern void func_80016714(void *a0, s32 a1); +extern void func_8012C218(void *a0); + +void func_8018096C(void *arg0) { + void *temp_a0; + + temp_a0 = *(void **)((char *)arg0 + 0xCC); + if (temp_a0 != NULL) { + func_80016714(temp_a0, 0x38); + } + func_8012C218(arg0); +} + INCLUDE_ASM("asm/ov_SC05_007/nonmatchings/ov_SC05_007_jr_8017BEBC", func_801809B0); diff --git a/src/ov_SC05_008/ov_SC05_008_jr_80135D20.c b/src/ov_SC05_008/ov_SC05_008_jr_80135D20.c index 7123306cd7..79b0793903 100644 --- a/src/ov_SC05_008/ov_SC05_008_jr_80135D20.c +++ b/src/ov_SC05_008/ov_SC05_008_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_008/nonmatchings/ov_SC05_008_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80182F68[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80182F68[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80182F68[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80182F68[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80182F68[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_008/ov_SC05_008_jr_80154C24.c b/src/ov_SC05_008/ov_SC05_008_jr_80154C24.c index 5efcc39ee3..fffbc923c3 100644 --- a/src/ov_SC05_008/ov_SC05_008_jr_80154C24.c +++ b/src/ov_SC05_008/ov_SC05_008_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_008/nonmatchings/ov_SC05_008_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80184CF0)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80184CF0[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80184CF0[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_009/ov_SC05_009_jr_80135D20.c b/src/ov_SC05_009/ov_SC05_009_jr_80135D20.c index 70152cc5d9..2219d72954 100644 --- a/src/ov_SC05_009/ov_SC05_009_jr_80135D20.c +++ b/src/ov_SC05_009/ov_SC05_009_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_009/nonmatchings/ov_SC05_009_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017F078[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017F078[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017F078[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017F078[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017F078[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_009/ov_SC05_009_jr_80154C24.c b/src/ov_SC05_009/ov_SC05_009_jr_80154C24.c index a63bce1b30..1691933890 100644 --- a/src/ov_SC05_009/ov_SC05_009_jr_80154C24.c +++ b/src/ov_SC05_009/ov_SC05_009_jr_80154C24.c @@ -1696,7 +1696,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_009/nonmatchings/ov_SC05_009_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80180E00)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80180E00[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80180E00[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_010/ov_SC05_010_jr_80135D20.c b/src/ov_SC05_010/ov_SC05_010_jr_80135D20.c index 7c952e1bff..9607cf8f13 100644 --- a/src/ov_SC05_010/ov_SC05_010_jr_80135D20.c +++ b/src/ov_SC05_010/ov_SC05_010_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_010/nonmatchings/ov_SC05_010_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80188F54[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80188F54[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80188F54[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80188F54[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80188F54[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_010/ov_SC05_010_jr_80154C24.c b/src/ov_SC05_010/ov_SC05_010_jr_80154C24.c index 54aeb85649..fe7b64fc07 100644 --- a/src/ov_SC05_010/ov_SC05_010_jr_80154C24.c +++ b/src/ov_SC05_010/ov_SC05_010_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_010/nonmatchings/ov_SC05_010_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018ACDC)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018ACDC[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018ACDC[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_010/ov_SC05_010_jr_8017C8D0.c b/src/ov_SC05_010/ov_SC05_010_jr_8017C8D0.c index 6ce7fe1f08..e5323c094b 100644 --- a/src/ov_SC05_010/ov_SC05_010_jr_8017C8D0.c +++ b/src/ov_SC05_010/ov_SC05_010_jr_8017C8D0.c @@ -1549,7 +1549,6 @@ extern void func_80164744(s32 param_1); extern void func_8001C810(s32 a0, s32 a1); extern void func_80164A74(s32 *a0); extern void func_80164930(s32 a); -extern u16 D_800DF2E0; extern s32 D_8018B56C; extern s16 D_8018B5A0; extern s16 D_8018B59E; @@ -3180,7 +3179,17 @@ void func_8017D7B0(void *a0) { } -INCLUDE_ASM("asm/ov_SC05_010/nonmatchings/ov_SC05_010_jr_8017C8D0", func_8017D7EC); +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern s32 func_80171990(u8 *a0); +void func_8017D7EC(s32 a0) { + + extern u8 D_8018C3E8; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_8018C3E8); + func_80171990((u8 *)a0); +} + INCLUDE_ASM("asm/ov_SC05_010/nonmatchings/ov_SC05_010_jr_8017C8D0", func_8017D82C); @@ -3244,7 +3253,33 @@ INCLUDE_ASM("asm/ov_SC05_010/nonmatchings/ov_SC05_010_jr_8017C8D0", func_8017DCB INCLUDE_ASM("asm/ov_SC05_010/nonmatchings/ov_SC05_010_jr_8017C8D0", func_8017DD14); -INCLUDE_ASM("asm/ov_SC05_010/nonmatchings/ov_SC05_010_jr_8017C8D0", func_8017DD78); +extern void func_8014659C(void); +extern void func_8001C810(s32 a0, s32 a1); +extern void func_80146CA0(void *a0); +extern void func_80162CCC(void); +void func_8017DD78(int param_1) { + + extern u16 D_800DF2E0; + extern s32 D_8018C4A8; + extern s32 D_8018C504[]; + s32 iVar1; + iVar1 = ((s32 (*)(void))func_8014659C)(); + *(s32 *)(param_1 + 0x20) = iVar1; + if (iVar1 != 0) { + ((void (*)(s32, void *))func_8001C810)(iVar1, &D_800DF2E0); + *(s32 **)(iVar1 + 0x80) = &D_8018C4A8; + *(u32 *)(iVar1 + 4) = *(u32 *)(iVar1 + 4) | 0x50000000; + *(u16 *)(iVar1 + 0x2c) = *(u16 *)(iVar1 + 0x2c) | 0xb0; + *(s32 *)(param_1 + 0x58) = (s32)&D_8018C504[*(s32 *)(param_1 + 0x50) * 2]; + *(u16 *)(iVar1 + 0x1c) = 0; + *(u16 *)(iVar1 + 0x1a) = 0; + *(u16 *)(iVar1 + 0x18) = 0; + ((void (*)(s32))func_80146CA0)(param_1); + } else { + ((void (*)(s32))func_80162CCC)(param_1); + } +} + /* func_8017DE28 — per-frame spin + clamp handler (ov_SC03_014, reach x8). diff --git a/src/ov_SC05_010/ov_SC05_010_jr_80181CDC.c b/src/ov_SC05_010/ov_SC05_010_jr_80181CDC.c index 504ed67cdc..5308a84a4d 100644 --- a/src/ov_SC05_010/ov_SC05_010_jr_80181CDC.c +++ b/src/ov_SC05_010/ov_SC05_010_jr_80181CDC.c @@ -45,7 +45,6 @@ extern s32 func_80165A50(s32); extern void func_80029514(s32); extern u8 D_800AF630[]; extern u8 D_80078EC0; -extern s32 D_80126B58; extern s32 func_80028FBC(void); extern s32 func_80029000(void); extern s32 func_80028D9C(void); @@ -3101,7 +3100,48 @@ INCLUDE_ASM("asm/ov_SC05_010/nonmatchings/ov_SC05_010_jr_80181CDC", func_80183D5 INCLUDE_ASM("asm/ov_SC05_010/nonmatchings/ov_SC05_010_jr_80181CDC", func_80184084); -INCLUDE_ASM("asm/ov_SC05_010/nonmatchings/ov_SC05_010_jr_80181CDC", func_80184100); + +// @stuck: none — MATCH (42 ins), iteration 1, rtu_match clean. +// Saturating add of a 3-byte RGB triple by a signed delta. +// Idioms: (1) `s8` by-value param => entry `sll/sra 24` for the sign test only; +// combine folds the extension back out of `~a1`/`-a1`/`a0[i]+a1` because every +// consumer is 8-bit (andi 0xFF / sb), so $a1 is used RAW after the test. +// (2) branch sense read off the target `sltu` operand ORDER (§3-T4): positive arm +// `sltu lim,p[i]` => store when `p[i] <= lim`; negative arm `sltu p[i],lim` +// => store when `p[i] >= lim`. +// (3) the third `if` written out in BOTH arms; jump.c cross-jumps the identical +// tails into the shared `j .L8018C344` (§5a) — do not hoist it after the if/else. +void func_80184100(u8 *a0, s8 a1) { + u8 lim; + + if (a1 == 0) { + return; + } + if (a1 > 0) { + lim = ~a1; + if (a0[0] <= lim) { + a0[0] = a0[0] + a1; + } + if (a0[1] <= lim) { + a0[1] = a0[1] + a1; + } + if (a0[2] <= lim) { + a0[2] = a0[2] + a1; + } + } else { + lim = -a1; + if (a0[0] >= lim) { + a0[0] = a0[0] + a1; + } + if (a0[1] >= lim) { + a0[1] = a0[1] + a1; + } + if (a0[2] >= lim) { + a0[2] = a0[2] + a1; + } + } +} + extern void (*D_80192DE0[])(void); @@ -3501,11 +3541,44 @@ extern void func_80146C3C(void); } -INCLUDE_ASM("asm/ov_SC05_010/nonmatchings/ov_SC05_010_jr_80181CDC", func_80187B28); + +extern void func_80017254(void *a0); +extern void func_800176F0(void *a0); + +void func_80187B28(void) { + + extern u8 D_801C3BF8[]; + extern u8 D_801C3C20[]; + u8 *p; + s32 i; + + func_80017254(D_801C3BF8); + i = 0; + p = D_801C3C20; + do { + func_800176F0(p); + i++; + p += 0x34; + } while (i < 4); +} + INCLUDE_ASM("asm/ov_SC05_010/nonmatchings/ov_SC05_010_jr_80181CDC", func_80187B80); -INCLUDE_ASM("asm/ov_SC05_010/nonmatchings/ov_SC05_010_jr_80181CDC", func_80187BAC); + +extern s32 func_8014C050(s32 a0, s32 a1); + +void func_80187BAC(void) { + + extern s32 D_80126B58; + s32 t; + + t = func_8014C050((s32)&D_80126B58, 0x28); + if (t != 0) { + *(u16 *)(t + 2) += 1; + } +} + extern void (*D_801C3CFC[])(void); diff --git a/src/ov_SC05_011/ov_SC05_011_jr_80135D20.c b/src/ov_SC05_011/ov_SC05_011_jr_80135D20.c index f191ecc810..f0f7eb69a7 100644 --- a/src/ov_SC05_011/ov_SC05_011_jr_80135D20.c +++ b/src/ov_SC05_011/ov_SC05_011_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_011/nonmatchings/ov_SC05_011_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017E2CC[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017E2CC[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017E2CC[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017E2CC[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017E2CC[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_011/ov_SC05_011_jr_80154C24.c b/src/ov_SC05_011/ov_SC05_011_jr_80154C24.c index 21cbb7fa04..73bb1d4b1f 100644 --- a/src/ov_SC05_011/ov_SC05_011_jr_80154C24.c +++ b/src/ov_SC05_011/ov_SC05_011_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_011/nonmatchings/ov_SC05_011_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80180054)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80180054[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80180054[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_017/ov_SC05_017_jr_80135D20.c b/src/ov_SC05_017/ov_SC05_017_jr_80135D20.c index d80a3ca497..a9a1e4a468 100644 --- a/src/ov_SC05_017/ov_SC05_017_jr_80135D20.c +++ b/src/ov_SC05_017/ov_SC05_017_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018D78C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018D78C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018D78C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018D78C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018D78C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_017/ov_SC05_017_jr_80154C24.c b/src/ov_SC05_017/ov_SC05_017_jr_80154C24.c index 6f6d492864..dda8cefdbc 100644 --- a/src/ov_SC05_017/ov_SC05_017_jr_80154C24.c +++ b/src/ov_SC05_017/ov_SC05_017_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018F514)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018F514[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018F514[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_017/ov_SC05_017_jr_8017AE2C.c b/src/ov_SC05_017/ov_SC05_017_jr_8017AE2C.c index e79427a996..a860aa88a2 100644 --- a/src/ov_SC05_017/ov_SC05_017_jr_8017AE2C.c +++ b/src/ov_SC05_017/ov_SC05_017_jr_8017AE2C.c @@ -4234,7 +4234,32 @@ INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_8017E6D INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_8017E778); -INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_8017E7EC); + +/* func_8017E7EC — state-entry init (family exemplar, reach x11). + * Sets the actor's state id (halfword @ +0x2) then runs the fixed + * five-call entry chain. Sibling style copied from func_80180164 + * in the same TU (cookbook §71). */ + +extern void func_8012E8E0(s32, s32); +extern void func_8012E88C(s32); +extern void func_8012A828(s32, s32); +extern void func_80184990(s32); +extern void func_80184BD4(s32, s32, s32, s32); + + +void func_8017E7EC(void *arg0) { + + extern short D_80191160; + extern short D_801B9DB4; + extern short D_801B6354; + *(short *)((char *)arg0 + 0x2) = 2; + func_8012E8E0((s32)arg0, (s32)&D_80191160); + func_8012E88C((s32)arg0); + ((void (*)(s32 *, s32))func_8012A828)((s32 *)arg0, (s32)&D_801B9DB4); + func_80184990((s32)arg0); + func_80184BD4((s32)arg0, (s32)&D_801B6354, 0, 0x60); +} + INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_8017E85C); @@ -4444,7 +4469,34 @@ s32 func_8017FB10(void *a0) INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_8017FC00); -INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_8017FCA0); + +extern s32 func_801858E0(s32 a0); +extern s32 func_80184CA4(s32 a0); +extern void func_80184BD4(s32, s32, s32, s32); +extern void func_8017F73C(void *a0); + +void func_8017FCA0(void *a0) +{ + + extern u8 D_801B63BC[]; + if (*(u16 *)((s32)a0 + 0x34) == 0) { + if (func_801858E0(6) == 0) { + return; + } + if (func_80184CA4((s32)a0) == 0) { + return; + } + ((void (*)(void *, void *, s32, s32))func_80184BD4)(a0, D_801B63BC, 0, 0x40); + *(s16 *)((s32)a0 + 0x34) = 1; + return; + } + + *(s32 *)(*(s32 *)((s32)a0 + 0xCC) + 0xB0) = 2; + if (func_80184CA4((s32)a0) != 0) { + func_8017F73C(a0); + } +} + INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_8017FD34); @@ -4538,7 +4590,27 @@ void func_80180748(void *arg0) { INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80180788); -INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80180808); + +extern s32 func_80184CA4(s32 a0); +extern void func_80184BD4(s32 a0, s32 a1, s32 a2, s32 a3); +extern s32 func_801858E0(s32 a0); +extern void func_80180188(void *a0); + +void func_80180808(void *arg0) { + + extern u8 D_801B63C8[]; + if (*(u16 *)((char *)arg0 + 0x34) == 0) { + if (((s32 (*)(void))func_80184CA4)() != 0) { + func_80184BD4((s32)arg0, (s32)&D_801B63C8[0], 1, 0x80); + *(s16 *)((char *)arg0 + 0x34) = 1; + } + } else if (func_801858E0(3) != 0) { + if (func_80184CA4((s32)arg0) != 0) { + func_80180188(arg0); + } + } +} + /* func_80180894 — guarded dispatch: ask func_801848AC(15, 0x11); if it answers @@ -4683,13 +4755,60 @@ s32 func_80180FB4(void *a0) INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_801810A4); -INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80181144); + +extern s32 func_801858E0(s32 a0); +extern s32 func_80184CA4(s32 a0); +extern void func_80184BD4(s32, s32, s32, s32); +extern void func_80180A94(void *a0); + +void func_80181144(void *a0) +{ + + extern u8 D_801B6474[]; + if (*(u16 *)((s32)a0 + 0x34) == 0) { + if (func_801858E0(3) == 0) { + return; + } + if (func_80184CA4((s32)a0) == 0) { + return; + } + ((void (*)(void *, void *, s32, s32))func_80184BD4)(a0, D_801B6474, 0, 0x40); + *(s16 *)((s32)a0 + 0x34) = 1; + return; + } + + *(s32 *)(*(s32 *)((s32)a0 + 0xCC) + 0xB0) = 2; + if (func_80184CA4((s32)a0) != 0) { + func_80180A94(a0); + } +} + INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_801811D8); INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80181268); -INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_801812D8); + +extern s32 func_80184CA4(s32 a0); +extern void func_80184BD4(s32 a0, s32 a1, s32 a2, s32 a3); +extern s32 func_801858E0(s32 a0); +extern void func_80180C30(short*); + +void func_801812D8(void *arg0) { + + extern u8 D_801B6468[]; + if (*(u16 *)((char *)arg0 + 0x34) == 0) { + if (((s32 (*)(void))func_80184CA4)() != 0) { + func_80184BD4((s32)arg0, (s32)&D_801B6468[0], 1, 0x40); + *(s16 *)((char *)arg0 + 0x34) = 1; + } + } else if (func_801858E0(3) != 0) { + if (func_80184CA4((s32)arg0) != 0) { + ((void (*)(void *))func_80180C30)(arg0); + } + } +} + INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80181364); @@ -4736,7 +4855,23 @@ extern s32 func_80029178(s32 arg); } -INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80181718); + +/* func_80181718 — guarded dispatch: ask func_801848AC(7, 0xe); if it answers + * NON-zero, run func_801814F0 on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_801848AC(s32 arg0, s32 arg1); +extern void func_801814F0(void *arg0); + +void func_80181718(void *arg0) { + if (func_801848AC(7, 0xe) != 0) { + func_801814F0(arg0); + } +} + INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80181758); @@ -4811,7 +4946,32 @@ INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80181D5 INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80181E0C); -INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80181E90); + +/* func_80181E90 — state-entry init (family exemplar, reach x11). + * Sets the actor's state id (halfword @ +0x2) then runs the fixed + * five-call entry chain. Sibling style copied from func_80180164 + * in the same TU (cookbook §71). */ + +extern void func_8012E8E0(s32, s32); +extern void func_8012E88C(s32); +extern void func_8012A828(s32, s32); +extern void func_80184990(s32); +extern void func_80184BD4(s32, s32, s32, s32); + + +void func_80181E90(void *arg0) { + + extern short D_80191AB8; + extern short D_801B9C0C; + extern short D_801B6564; + *(short *)((char *)arg0 + 0x2) = 2; + func_8012E8E0((s32)arg0, (s32)&D_80191AB8); + func_8012E88C((s32)arg0); + ((void (*)(s32 *, s32))func_8012A828)((s32 *)arg0, (s32)&D_801B9C0C); + func_80184990((s32)arg0); + func_80184BD4((s32)arg0, (s32)&D_801B6564, 0, 0x60); +} + INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80181F00); @@ -4856,7 +5016,23 @@ extern s32 func_80029178(s32 arg); INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80182318); -INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_801823D0); + +/* func_801823D0 — guarded dispatch: ask func_801848AC(9, 0x11); if it answers + * NON-zero, run func_80181E90 on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_801848AC(s32 arg0, s32 arg1); +extern void func_80181E90(void *arg0); + +void func_801823D0(void *arg0) { + if (func_801848AC(9, 0x11) != 0) { + func_80181E90(arg0); + } +} + extern s32 func_80184CA4(s32 a0); extern s32 func_80181F00(void *a0); @@ -5163,7 +5339,23 @@ extern void func_80178CBC(s32 arg0, s32 arg1); INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_8018424C); -INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80184284); + +/* func_80184284 — guarded dispatch: ask func_801848AC(8, 0x14); if it answers + * NON-zero, run func_801841B8 on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern s32 func_801848AC(s32 arg0, s32 arg1); +extern void func_801841B8(short*); + +void func_80184284(void *arg0) { + if (func_801848AC(8, 0x14) != 0) { + ((void (*)(void *))func_801841B8)(arg0); + } +} + INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_801842C4); @@ -5414,7 +5606,21 @@ INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_8018559 INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80185604); -INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_80185678); +void func_80185678(s32 a0) { + + extern s16 D_801B8744[]; + extern s32 D_801B8704[][2]; + *(s16 *)(a0 + 0x2) = 3; + *(s16 *)(a0 + 0x34) = 0; + *(s16 *)(a0 + 0xFE) = 0; + *(s16 *)(a0 + 0x100) = 0; + *(s16 *)(a0 + 0x102) = 2; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x24) = D_801B8704[D_801B8744[*(s16 *)(a0 + 0x70)]][0]; + *(s16 *)(a0 + 0x84) = 0; + *(s16 *)(a0 + 0x5C) = 0x800; + *(s32 *)(a0 + 0xB0) = 0; +} + INCLUDE_ASM("asm/ov_SC05_017/nonmatchings/ov_SC05_017_jr_8017AE2C", func_801856D8); diff --git a/src/ov_SC05_018/ov_SC05_018_jr_80135D20.c b/src/ov_SC05_018/ov_SC05_018_jr_80135D20.c index 7d751bfb82..d17ee23fdd 100644 --- a/src/ov_SC05_018/ov_SC05_018_jr_80135D20.c +++ b/src/ov_SC05_018/ov_SC05_018_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_018/nonmatchings/ov_SC05_018_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80186EE8[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80186EE8[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80186EE8[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80186EE8[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80186EE8[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_018/ov_SC05_018_jr_80154C24.c b/src/ov_SC05_018/ov_SC05_018_jr_80154C24.c index 302b499442..e42b196bc3 100644 --- a/src/ov_SC05_018/ov_SC05_018_jr_80154C24.c +++ b/src/ov_SC05_018/ov_SC05_018_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_018/nonmatchings/ov_SC05_018_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80188C70)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80188C70[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80188C70[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC05_018/ov_SC05_018_jr_8017D604.c b/src/ov_SC05_018/ov_SC05_018_jr_8017D604.c index 74c933197a..418a827547 100644 --- a/src/ov_SC05_018/ov_SC05_018_jr_8017D604.c +++ b/src/ov_SC05_018/ov_SC05_018_jr_8017D604.c @@ -1674,7 +1674,6 @@ extern void func_8016634C(void *a0); extern void func_801663A4(void *a0); extern void (*D_8018981C[])(void); extern void func_801663FC(void *a0); -extern u8 D_800D387C[]; extern u8 D_800D3888[]; extern s32 func_800D21C4(s32 a0, void *a1, s32 a2); extern void func_800D1FC8(s32 a0, s32 a1); @@ -3782,7 +3781,27 @@ void func_80182E38(void *a0) { } -INCLUDE_ASM("asm/ov_SC05_018/nonmatchings/ov_SC05_018_jr_8017D604", func_80182E74); + +extern s32 func_8001CC3C(s32 a0, s32 a1, s32 a2, s32 a3); + +void func_80182E74(s32 arg0) { + + extern u8 D_800D387C[]; + s32 iVar1; + + iVar1 = *(s32 *)(arg0 + 0x20); + ((void (*)(s32, s32, s32, s32))func_8001CC3C)(iVar1, (s32)&D_800D387C, 0x270, 0x120); + *(u8 *)(iVar1 + 0x27) = 0x9C; + *(u16 *)(iVar1 + 0x1A) = 0x7000; + *(u16 *)(iVar1 + 0x18) = 0x7000; + *(u8 *)(iVar1 + 0x26) = 0x90; + *(u8 *)(iVar1 + 0x25) = 0x90; + *(u8 *)(iVar1 + 0x24) = 0x90; + *(u32 *)(iVar1 + 4) = *(u32 *)(iVar1 + 4) | 0x50000000; + *(s16 *)(arg0 + 0x2C) = 0x20; + *(s16 *)(arg0 + 0x2) += 1; +} + INCLUDE_ASM("asm/ov_SC05_018/nonmatchings/ov_SC05_018_jr_8017D604", func_80182F04); @@ -3889,7 +3908,23 @@ INCLUDE_ASM("asm/ov_SC05_018/nonmatchings/ov_SC05_018_jr_8017D604", func_80183EC INCLUDE_ASM("asm/ov_SC05_018/nonmatchings/ov_SC05_018_jr_8017D604", func_80183F28); -INCLUDE_ASM("asm/ov_SC05_018/nonmatchings/ov_SC05_018_jr_8017D604", func_80183F9C); + +/* func_80183F9C — guarded dispatch: ask ((s32 (*)(s32, s32))func_80184590)(9, 0x12); if it answers + * NON-zero, run func_80183B90 on the incoming entity. The entity pointer is + * live across the jal, so it lands in $s0 and comes back out as $a0. + * §71 sibling: func_80181B34 in this same TU is the identical shape. + * §3-T4: target branch is `beqz $v0, ret` => the C condition is `!= 0` + * (the sibling's is `bnez` => `== 0`; polarity is read off the opcode). */ + +extern void func_80184590(s32, s32); +extern void func_80183B90(void *arg0); + +void func_80183F9C(void *arg0) { + if (((s32 (*)(s32, s32))func_80184590)(9, 0x12) != 0) { + func_80183B90(arg0); + } +} + /* func_80183FDC — guarded dispatch: ask ((s32 (*)(s32, s32))func_80184590)(9, 0x12); if it answers @@ -4153,7 +4188,21 @@ INCLUDE_ASM("asm/ov_SC05_018/nonmatchings/ov_SC05_018_jr_8017D604", func_8018528 INCLUDE_ASM("asm/ov_SC05_018/nonmatchings/ov_SC05_018_jr_8017D604", func_801852E8); -INCLUDE_ASM("asm/ov_SC05_018/nonmatchings/ov_SC05_018_jr_8017D604", func_8018535C); +void func_8018535C(s32 a0) { + + extern s16 D_801E0294[]; + extern s32 D_801E0254[][2]; + *(s16 *)(a0 + 0x2) = 3; + *(s16 *)(a0 + 0x34) = 0; + *(s16 *)(a0 + 0xFE) = 0; + *(s16 *)(a0 + 0x100) = 0; + *(s16 *)(a0 + 0x102) = 2; + *(s32 *)(*(s32 *)(a0 + 0x20) + 0x24) = D_801E0254[D_801E0294[*(s16 *)(a0 + 0x70)]][0]; + *(s16 *)(a0 + 0x84) = 0; + *(s16 *)(a0 + 0x5C) = 0x800; + *(s32 *)(a0 + 0xB0) = 0; +} + INCLUDE_ASM("asm/ov_SC05_018/nonmatchings/ov_SC05_018_jr_8017D604", func_801853BC); diff --git a/src/ov_SC05_019/ov_SC05_019_jr_80135D20.c b/src/ov_SC05_019/ov_SC05_019_jr_80135D20.c index a8e719fab2..31e962a90f 100644 --- a/src/ov_SC05_019/ov_SC05_019_jr_80135D20.c +++ b/src/ov_SC05_019/ov_SC05_019_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_019/nonmatchings/ov_SC05_019_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017F82C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017F82C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017F82C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017F82C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017F82C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC05_019/ov_SC05_019_jr_80154C24.c b/src/ov_SC05_019/ov_SC05_019_jr_80154C24.c index db1d47ccb6..6d8ef76d83 100644 --- a/src/ov_SC05_019/ov_SC05_019_jr_80154C24.c +++ b/src/ov_SC05_019/ov_SC05_019_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC05_019/nonmatchings/ov_SC05_019_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801815B4)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801815B4[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801815B4[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_000/ov_SC06_000_jr_80135D20.c b/src/ov_SC06_000/ov_SC06_000_jr_80135D20.c index 8170191e06..940b081424 100644 --- a/src/ov_SC06_000/ov_SC06_000_jr_80135D20.c +++ b/src/ov_SC06_000/ov_SC06_000_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018883C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018883C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018883C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018883C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018883C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_000/ov_SC06_000_jr_80154C24.c b/src/ov_SC06_000/ov_SC06_000_jr_80154C24.c index 48b7e86c55..037cac8de3 100644 --- a/src/ov_SC06_000/ov_SC06_000_jr_80154C24.c +++ b/src/ov_SC06_000/ov_SC06_000_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018A5C4)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018A5C4[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018A5C4[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_000/ov_SC06_000_jr_8017AE2C.c b/src/ov_SC06_000/ov_SC06_000_jr_8017AE2C.c index d03b573666..b4e6f5ce76 100644 --- a/src/ov_SC06_000/ov_SC06_000_jr_8017AE2C.c +++ b/src/ov_SC06_000/ov_SC06_000_jr_8017AE2C.c @@ -4200,7 +4200,15 @@ void func_8017FEC8(void *a0) { } -INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_8017AE2C", func_8017FF04); +extern void func_80147324(s32 arg0); +void func_8017FF04(void *a0) +{ + if (*(s32 *)((s32)a0 + 0x30) == 0) { + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + } + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + // @class: plumbing @@ -4230,7 +4238,20 @@ INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_8017AE2C", func_8017FFB INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_8017AE2C", func_80180034); -INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_8017AE2C", func_8018019C); +extern void func_801801E8(int); +extern void func_80146C3C(void); +void func_8018019C(int param_1) +{ + unsigned short uVar1; + uVar1 = *(unsigned short *)(param_1 + 0x12) - 0x100; + *(unsigned short *)(param_1 + 0x12) = uVar1; + if ((short)uVar1 > 0) { + func_801801E8(param_1); + } else { + ((void (*)(int))func_80146C3C)(param_1); + } +} + INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_8017AE2C", func_801801E8); @@ -4242,7 +4263,13 @@ void func_801804F4(void *a0) { } -INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_8017AE2C", func_80180530); +extern void func_80147324(s32 arg0); +void func_80180530(void *a0) +{ + func_80147324(*(u16 *)((s32)a0 + 0x2E)); + *(u16 *)((s32)a0 + 0x2) = *(u16 *)((s32)a0 + 0x2) + 1; +} + /* func_80180570 — a state-tick: bump the frame counter at 0x1C; while it is @@ -4344,7 +4371,25 @@ void func_8018066C(void *a0) } -INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_8017AE2C", func_80180740); +extern void func_801801E8(int); +extern void func_80146C3C(void); +void func_80180740(void *a0) +{ + void *obj; + s16 v; + v = *(u16 *)((s32)a0 + 0x12) - 0x100; + obj = *(void **)((s32)a0 + 0x34); + *(s16 *)((s32)a0 + 0x12) = v; + if (v > 0) { + ((void (*)(void *))func_801801E8)(a0); + } else { + *(s16 *)((s32)obj + 0x64) = 0x1000; + *(s16 *)((s32)obj + 0x62) = 0x1000; + *(s16 *)((s32)obj + 0x60) = 0x1000; + func_80146C3C(); + } +} + extern void (*D_8018BFE8[])(void); @@ -4356,7 +4401,22 @@ void func_80180794(void *a0) { INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_8017AE2C", func_801807D0); -INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_8017AE2C", func_80180884); +extern void func_800D22E4(s32 a0); +extern void func_80146C3C(void); +extern void func_801808E0(void *a0); +void func_80180884(void *a0) +{ + s32 t; + t = *(s32 *)((s32)a0 + 0x1C); + *(s32 *)((s32)a0 + 0x1C) = t + 1; + if (t < 0xA) { + ((void (*)(void))func_800D22E4)(); + func_801808E0(a0); + } else { + ((void (*)(void *))func_80146C3C)(a0); + } +} + INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_8017AE2C", func_801808E0); @@ -4770,7 +4830,17 @@ extern void func_80181774(void); INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_8017AE2C", func_80182B10); -INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_8017AE2C", func_80182B68); + +extern s32 func_8012C658(s32 arg0, s32 arg1, s32 arg2); + +void func_80182B68(s32 arg0) { + s32 i; + + for (i = 0; i < 3; i++) { + func_8012C658(0x26b, i, arg0); + } +} + INCLUDE_ASM("asm/ov_SC06_000/nonmatchings/ov_SC06_000_jr_8017AE2C", func_80182BB8); diff --git a/src/ov_SC06_006/ov_SC06_006_jr_80135D20.c b/src/ov_SC06_006/ov_SC06_006_jr_80135D20.c index 4ff82a1439..008136e924 100644 --- a/src/ov_SC06_006/ov_SC06_006_jr_80135D20.c +++ b/src/ov_SC06_006/ov_SC06_006_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_006/nonmatchings/ov_SC06_006_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80182360[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80182360[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80182360[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80182360[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80182360[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_006/ov_SC06_006_jr_80154C24.c b/src/ov_SC06_006/ov_SC06_006_jr_80154C24.c index 8326f2208b..367bdbfd4c 100644 --- a/src/ov_SC06_006/ov_SC06_006_jr_80154C24.c +++ b/src/ov_SC06_006/ov_SC06_006_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_006/nonmatchings/ov_SC06_006_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801840E8)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801840E8[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801840E8[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_006/ov_SC06_006_jr_8017BEBC.c b/src/ov_SC06_006/ov_SC06_006_jr_8017BEBC.c index feba48e952..92fe66f3ed 100644 --- a/src/ov_SC06_006/ov_SC06_006_jr_8017BEBC.c +++ b/src/ov_SC06_006/ov_SC06_006_jr_8017BEBC.c @@ -52,7 +52,6 @@ extern s32 func_80165A50(s32); extern void func_80029514(s32); extern u8 D_800AF630[]; extern u8 D_80078EC0; -extern s32 D_80126B58; extern s32 func_80028FBC(void); extern s32 func_80029000(void); extern s32 func_80028D9C(void); @@ -3681,11 +3680,44 @@ extern void func_80146C3C(void); } -INCLUDE_ASM("asm/ov_SC06_006/nonmatchings/ov_SC06_006_jr_8017BEBC", func_80181414); + +extern void func_80017254(void *a0); +extern void func_800176F0(void *a0); + +void func_80181414(void) { + + extern u8 D_801F5438[]; + extern u8 D_801F5460[]; + u8 *p; + s32 i; + + func_80017254(D_801F5438); + i = 0; + p = D_801F5460; + do { + func_800176F0(p); + i++; + p += 0x34; + } while (i < 4); +} + INCLUDE_ASM("asm/ov_SC06_006/nonmatchings/ov_SC06_006_jr_8017BEBC", func_8018146C); -INCLUDE_ASM("asm/ov_SC06_006/nonmatchings/ov_SC06_006_jr_8017BEBC", func_80181498); + +extern s32 func_8014C050(s32 a0, s32 a1); + +void func_80181498(void) { + + extern s32 D_80126B58; + s32 t; + + t = func_8014C050((s32)&D_80126B58, 0x28); + if (t != 0) { + *(u16 *)(t + 2) += 1; + } +} + INCLUDE_ASM("asm/ov_SC06_006/nonmatchings/ov_SC06_006_jr_8017BEBC", func_801814DC); diff --git a/src/ov_SC06_008/ov_SC06_008_jr_80135D20.c b/src/ov_SC06_008/ov_SC06_008_jr_80135D20.c index 6bc1f7f55c..157764f198 100644 --- a/src/ov_SC06_008/ov_SC06_008_jr_80135D20.c +++ b/src/ov_SC06_008/ov_SC06_008_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_008/nonmatchings/ov_SC06_008_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80185DC8[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80185DC8[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80185DC8[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80185DC8[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80185DC8[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_008/ov_SC06_008_jr_80154C24.c b/src/ov_SC06_008/ov_SC06_008_jr_80154C24.c index 94fef7f066..9b03778e9d 100644 --- a/src/ov_SC06_008/ov_SC06_008_jr_80154C24.c +++ b/src/ov_SC06_008/ov_SC06_008_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_008/nonmatchings/ov_SC06_008_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80187B50)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80187B50[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80187B50[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_008/ov_SC06_008_jr_8017C294.c b/src/ov_SC06_008/ov_SC06_008_jr_8017C294.c index 2b3f022153..9c997ae21d 100644 --- a/src/ov_SC06_008/ov_SC06_008_jr_8017C294.c +++ b/src/ov_SC06_008/ov_SC06_008_jr_8017C294.c @@ -4409,7 +4409,17 @@ extern void func_8012B370(int a0); INCLUDE_ASM("asm/ov_SC06_008/nonmatchings/ov_SC06_008_jr_8017C294", func_80183BF4); -INCLUDE_ASM("asm/ov_SC06_008/nonmatchings/ov_SC06_008_jr_8017C294", func_80183D10); + +extern void func_80019064(void *a0); + +void func_80183D10(void *a0) { + + extern u8 D_801A693C; + extern void (*D_801A6964[])(void *); + func_80019064(&D_801A693C); + D_801A6964[*(u16 *)((s32)a0 + 0x2)](a0); +} + INCLUDE_ASM("asm/ov_SC06_008/nonmatchings/ov_SC06_008_jr_8017C294", func_80183D68); @@ -4743,7 +4753,17 @@ void func_8018451C(int a, s16 *b, SVECTOR_8017E6D8 *c, SVECTOR_8017E6D8 *d, -INCLUDE_ASM("asm/ov_SC06_008/nonmatchings/ov_SC06_008_jr_8017C294", func_80184898); + +extern void func_80019064(void *a0); + +void func_80184898(void *a0) { + + extern u8 D_801A69DC; + extern void (*D_801A6A04[])(void *); + func_80019064(&D_801A69DC); + D_801A6A04[*(u16 *)((s32)a0 + 0x2)](a0); +} + INCLUDE_ASM("asm/ov_SC06_008/nonmatchings/ov_SC06_008_jr_8017C294", func_801848F0); diff --git a/src/ov_SC06_010/ov_SC06_010_jr_80135D20.c b/src/ov_SC06_010/ov_SC06_010_jr_80135D20.c index a31d6f8c00..681b8a4929 100644 --- a/src/ov_SC06_010/ov_SC06_010_jr_80135D20.c +++ b/src/ov_SC06_010/ov_SC06_010_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_010/nonmatchings/ov_SC06_010_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80186FA4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80186FA4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80186FA4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80186FA4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80186FA4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_010/ov_SC06_010_jr_80154C24.c b/src/ov_SC06_010/ov_SC06_010_jr_80154C24.c index 631d11d595..511353dec6 100644 --- a/src/ov_SC06_010/ov_SC06_010_jr_80154C24.c +++ b/src/ov_SC06_010/ov_SC06_010_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_010/nonmatchings/ov_SC06_010_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80188D2C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80188D2C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80188D2C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_010/ov_SC06_010_jr_8017A4AC.c b/src/ov_SC06_010/ov_SC06_010_jr_8017A4AC.c index f8cd27b6bd..65d4352e37 100644 --- a/src/ov_SC06_010/ov_SC06_010_jr_8017A4AC.c +++ b/src/ov_SC06_010/ov_SC06_010_jr_8017A4AC.c @@ -3983,7 +3983,17 @@ void func_8017CAD4(s32 *ctx, s32 *model, s32 mtxsrc) } -INCLUDE_ASM("asm/ov_SC06_010/nonmatchings/ov_SC06_010_jr_8017A4AC", func_8017D6A0); + +extern void func_80019064(void *a0); + +void func_8017D6A0(void *a0) { + + extern u8 D_8018A3DC; + extern void (*D_8018A404[])(void *); + func_80019064(&D_8018A3DC); + D_8018A404[*(u16 *)((s32)a0 + 0x2)](a0); +} + INCLUDE_ASM("asm/ov_SC06_010/nonmatchings/ov_SC06_010_jr_8017A4AC", func_8017D6F8); @@ -4480,7 +4490,18 @@ INCLUDE_ASM("asm/ov_SC06_010/nonmatchings/ov_SC06_010_jr_8017A4AC", func_8018017 INCLUDE_ASM("asm/ov_SC06_010/nonmatchings/ov_SC06_010_jr_8017A4AC", func_801802E0); -INCLUDE_ASM("asm/ov_SC06_010/nonmatchings/ov_SC06_010_jr_8017A4AC", func_80180450); + +extern void func_8017F278(void *a0); + +void func_80180450(void *a0) { + + extern void (*D_8018B10C[])(void); + D_8018B10C[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)a0 != 0) { + func_8017F278(a0); + } +} + INCLUDE_ASM("asm/ov_SC06_010/nonmatchings/ov_SC06_010_jr_8017A4AC", func_801804B0); diff --git a/src/ov_SC06_011/ov_SC06_011_jr_80135D20.c b/src/ov_SC06_011/ov_SC06_011_jr_80135D20.c index 895cc3a662..bab896adab 100644 --- a/src/ov_SC06_011/ov_SC06_011_jr_80135D20.c +++ b/src/ov_SC06_011/ov_SC06_011_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_011/nonmatchings/ov_SC06_011_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80180A04[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80180A04[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80180A04[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80180A04[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80180A04[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_011/ov_SC06_011_jr_80154C24.c b/src/ov_SC06_011/ov_SC06_011_jr_80154C24.c index d7ab3c1bee..5ba7813ea3 100644 --- a/src/ov_SC06_011/ov_SC06_011_jr_80154C24.c +++ b/src/ov_SC06_011/ov_SC06_011_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_011/nonmatchings/ov_SC06_011_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018278C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018278C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018278C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_013/ov_SC06_013_jr_80135D20.c b/src/ov_SC06_013/ov_SC06_013_jr_80135D20.c index d94deb5ae9..bb824f5d15 100644 --- a/src/ov_SC06_013/ov_SC06_013_jr_80135D20.c +++ b/src/ov_SC06_013/ov_SC06_013_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_013/nonmatchings/ov_SC06_013_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017F180[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017F180[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017F180[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017F180[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017F180[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_013/ov_SC06_013_jr_80154C24.c b/src/ov_SC06_013/ov_SC06_013_jr_80154C24.c index 8cb346ff7b..d1b1ebcf93 100644 --- a/src/ov_SC06_013/ov_SC06_013_jr_80154C24.c +++ b/src/ov_SC06_013/ov_SC06_013_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_013/nonmatchings/ov_SC06_013_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80180F08)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80180F08[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80180F08[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_014/ov_SC06_014_jr_80135D20.c b/src/ov_SC06_014/ov_SC06_014_jr_80135D20.c index b8d177f606..b3027c14f6 100644 --- a/src/ov_SC06_014/ov_SC06_014_jr_80135D20.c +++ b/src/ov_SC06_014/ov_SC06_014_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_014/nonmatchings/ov_SC06_014_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801804E4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801804E4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801804E4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801804E4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801804E4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_014/ov_SC06_014_jr_80154C24.c b/src/ov_SC06_014/ov_SC06_014_jr_80154C24.c index 959ccdc448..3e6c3eb962 100644 --- a/src/ov_SC06_014/ov_SC06_014_jr_80154C24.c +++ b/src/ov_SC06_014/ov_SC06_014_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_014/nonmatchings/ov_SC06_014_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018226C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018226C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018226C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_014/ov_SC06_014_jr_8017BEBC.c b/src/ov_SC06_014/ov_SC06_014_jr_8017BEBC.c index 3326279d60..a00727f466 100644 --- a/src/ov_SC06_014/ov_SC06_014_jr_8017BEBC.c +++ b/src/ov_SC06_014/ov_SC06_014_jr_8017BEBC.c @@ -3539,7 +3539,21 @@ INCLUDE_ASM("asm/ov_SC06_014/nonmatchings/ov_SC06_014_jr_8017BEBC", func_8017E03 INCLUDE_ASM("asm/ov_SC06_014/nonmatchings/ov_SC06_014_jr_8017BEBC", func_8017E164); -INCLUDE_ASM("asm/ov_SC06_014/nonmatchings/ov_SC06_014_jr_8017BEBC", func_8017E220); + +extern void func_8017E9C0(void *a0); + +void func_8017E220(void *a0) { + + extern void (*D_80183DB4[])(void); + D_80183DB4[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)((s32)a0 + 0x0) != 0) { + *(s32 *)((s32)a0 + 0xE8) = *(s32 *)((s32)a0 + 0xE8) + 1; + if ((*(s32 *)((s32)a0 + 0xE8) & 0xF) == 0) { + func_8017E9C0(a0); + } + } +} + INCLUDE_ASM("asm/ov_SC06_014/nonmatchings/ov_SC06_014_jr_8017BEBC", func_8017E29C); @@ -3555,7 +3569,15 @@ INCLUDE_ASM("asm/ov_SC06_014/nonmatchings/ov_SC06_014_jr_8017BEBC", func_8017E77 INCLUDE_ASM("asm/ov_SC06_014/nonmatchings/ov_SC06_014_jr_8017BEBC", func_8017E80C); -INCLUDE_ASM("asm/ov_SC06_014/nonmatchings/ov_SC06_014_jr_8017BEBC", func_8017E874); + +extern void func_8012A828(s32 *a0, s32 a1); + extern s32 D_8019E93C; + void func_8017E874(void *arg0) { + *(s16 *)((char *)arg0 + 0x2) = 1; + *(s16 *)((char *)arg0 + 0x5c) = *(u16 *)(*(s32 *)((char *)arg0 + 0x78) + 0x2); + func_8012A828(arg0, &D_8019E93C); + } + extern s32 func_8012D5E4(s32 a0, s32 a1, s32 a2, s32 a3); diff --git a/src/ov_SC06_015/ov_SC06_015_jr_80135D20.c b/src/ov_SC06_015/ov_SC06_015_jr_80135D20.c index bc527e85fc..fc595ebc0a 100644 --- a/src/ov_SC06_015/ov_SC06_015_jr_80135D20.c +++ b/src/ov_SC06_015/ov_SC06_015_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_015/nonmatchings/ov_SC06_015_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017F03C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017F03C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017F03C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017F03C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017F03C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_015/ov_SC06_015_jr_80154C24.c b/src/ov_SC06_015/ov_SC06_015_jr_80154C24.c index 6d6cabe43a..6951249378 100644 --- a/src/ov_SC06_015/ov_SC06_015_jr_80154C24.c +++ b/src/ov_SC06_015/ov_SC06_015_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_015/nonmatchings/ov_SC06_015_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80180DC4)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80180DC4[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80180DC4[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_016/ov_SC06_016_jr_80135D20.c b/src/ov_SC06_016/ov_SC06_016_jr_80135D20.c index 22e8767d17..472ea5d6a6 100644 --- a/src/ov_SC06_016/ov_SC06_016_jr_80135D20.c +++ b/src/ov_SC06_016/ov_SC06_016_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_016/nonmatchings/ov_SC06_016_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018544C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018544C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018544C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018544C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018544C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_016/ov_SC06_016_jr_80154C24.c b/src/ov_SC06_016/ov_SC06_016_jr_80154C24.c index 2c280cf249..ebdc76102e 100644 --- a/src/ov_SC06_016/ov_SC06_016_jr_80154C24.c +++ b/src/ov_SC06_016/ov_SC06_016_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_016/nonmatchings/ov_SC06_016_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801871D4)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801871D4[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801871D4[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_016/ov_SC06_016_jr_8017C8D0.c b/src/ov_SC06_016/ov_SC06_016_jr_8017C8D0.c index ff2969bb75..b0c5811682 100644 --- a/src/ov_SC06_016/ov_SC06_016_jr_8017C8D0.c +++ b/src/ov_SC06_016/ov_SC06_016_jr_8017C8D0.c @@ -76,7 +76,6 @@ extern s32 func_80146128(void); extern void func_80146360(void); extern void func_801463A0(); extern void func_8014607C(void); -extern s32 *D_80126B78; extern u8 D_80078EC1; extern s32 D_80078EC8; extern s32 D_80126B9C; @@ -598,7 +597,7 @@ extern s32 func_8014E284(s32 a0, s16 *a1, s16 *a2); extern s32 func_8014E048(s32 a0, u16 *a1, u16 *a2); /* u16*: def lhu semantics (T5b reconcile; ptr param type codegen-neutral for the caller) */ extern s32 func_80135A4C(s32 a0, s32 a1, s32 *a2, s32 a3); extern s32 func_80133784(s32 a0, void *a1, s32 a2); -extern u8 D_801152A8[]; /* canonical TU type (engine_core) — read via *(u16*) cast */ +/* canonical TU type (engine_core) — read via *(u16*) cast */ extern s16 D_801152AC; extern s32 func_8014E048(s32 param_1, u16 * param_2, u16 * param_3); extern void func_8014E48C(s32 a0); @@ -634,7 +633,6 @@ extern s32 func_8014F468(void); extern int func_8014F74C(); extern int func_8014F6F4(void); extern u8 D_800D3918[]; -extern u8 D_801152A8[]; extern s32 D_801152BC; extern int func_8014F74C(s32 arg0); extern s32 func_8014FA70(s32 a0); @@ -3357,7 +3355,18 @@ s32 func_8017DEAC(s32 arg0) return ret; } -INCLUDE_ASM("asm/ov_SC06_016/nonmatchings/ov_SC06_016_jr_8017C8D0", func_8017DEC4); + +extern void func_8012DFD4(void *a0); + +void func_8017DEC4(void *a0) { + + extern void (*D_801889F4[])(void); + D_801889F4[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)a0 != 0) { + func_8012DFD4(a0); + } +} + INCLUDE_ASM("asm/ov_SC06_016/nonmatchings/ov_SC06_016_jr_8017C8D0", func_8017DF24); @@ -3447,7 +3456,28 @@ void func_8017F578(void *a0) { INCLUDE_ASM("asm/ov_SC06_016/nonmatchings/ov_SC06_016_jr_8017C8D0", func_8017F5B4); -INCLUDE_ASM("asm/ov_SC06_016/nonmatchings/ov_SC06_016_jr_8017C8D0", func_8017F5FC); + +extern void func_8004914C(void *a0); +extern void func_800491AC(void *a0); +extern void RotTransSV(void *a0, void *a1, void *a2); + +void func_8017F5FC(s32 param_1) +{ + s16 v[4]; + u16 out[4]; + s32 p = *(s32 *)(param_1 + 0x34); + + v[0] = 0; + v[1] = -0x40; + v[2] = -0x28; + func_8004914C((void *)(*(s32 *)(p + 0x20) + 0x34)); + func_800491AC((void *)(*(s32 *)(p + 0x20) + 0x34)); + RotTransSV(v, v, out); + *(s16 *)(param_1 + 6) = v[0]; + *(s16 *)(param_1 + 0xA) = v[1]; + *(s16 *)(param_1 + 0xE) = v[2]; +} + void func_8017F68C(void) { } @@ -3497,7 +3527,17 @@ INCLUDE_ASM("asm/ov_SC06_016/nonmatchings/ov_SC06_016_jr_8017C8D0", func_80180E2 INCLUDE_ASM("asm/ov_SC06_016/nonmatchings/ov_SC06_016_jr_8017C8D0", func_80180F68); -INCLUDE_ASM("asm/ov_SC06_016/nonmatchings/ov_SC06_016_jr_8017C8D0", func_80181018); + +extern s32 func_8012C658(s32 arg0, s32 arg1, s32 arg2); + +void func_80181018(s32 arg0) { + s32 i; + + for (i = 0; i < 8; i++) { + func_8012C658(0x303, i, arg0); + } +} + extern void (*D_801890E4[])(void); diff --git a/src/ov_SC06_018/ov_SC06_018_jr_80135D20.c b/src/ov_SC06_018/ov_SC06_018_jr_80135D20.c index e44821d74a..34ac8ae1ee 100644 --- a/src/ov_SC06_018/ov_SC06_018_jr_80135D20.c +++ b/src/ov_SC06_018/ov_SC06_018_jr_80135D20.c @@ -1582,7 +1582,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_018/nonmatchings/ov_SC06_018_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80193B88[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80193B88[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80193B88[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80193B88[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80193B88[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_018/ov_SC06_018_jr_80154C24.c b/src/ov_SC06_018/ov_SC06_018_jr_80154C24.c index 0bb7a3145d..337f04d1ed 100644 --- a/src/ov_SC06_018/ov_SC06_018_jr_80154C24.c +++ b/src/ov_SC06_018/ov_SC06_018_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_018/nonmatchings/ov_SC06_018_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80195910)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80195910[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80195910[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_018/ov_SC06_018_jr_8017C24C.c b/src/ov_SC06_018/ov_SC06_018_jr_8017C24C.c index 0f6bc61757..17393bb320 100644 --- a/src/ov_SC06_018/ov_SC06_018_jr_8017C24C.c +++ b/src/ov_SC06_018/ov_SC06_018_jr_8017C24C.c @@ -76,7 +76,6 @@ extern s32 func_80146128(void); extern void func_80146360(void); extern void func_801463A0(); extern void func_8014607C(void); -extern s32 *D_80126B78; extern u8 D_80078EC1; extern s32 D_80078EC8; extern s32 D_80126B9C; @@ -360,7 +359,6 @@ extern s32 func_801498E0(s32 *a0); extern s32 func_8012E5CC(s32 a0, s32 a1, s32 a2); extern void func_80147364(u16 a0, s32 a1); extern s32 func_800CCF28(s32 a0); -extern u8 D_80126B5C; extern s32 func_80149954(s32 s0); extern s32 func_80149A64(s32 *a0); extern void func_8015DAC4(s32 *a0); @@ -3338,7 +3336,18 @@ s32 func_8017DC58(void) { } -INCLUDE_ASM("asm/ov_SC06_018/nonmatchings/ov_SC06_018_jr_8017C24C", func_8017DC60); + +extern void func_8012DFD4(void *a0); + +void func_8017DC60(void *a0) { + + extern void (*D_80197108[])(void); + D_80197108[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)a0 != 0) { + func_8012DFD4(a0); + } +} + INCLUDE_ASM("asm/ov_SC06_018/nonmatchings/ov_SC06_018_jr_8017C24C", func_8017DCC0); @@ -3350,7 +3359,17 @@ INCLUDE_ASM("asm/ov_SC06_018/nonmatchings/ov_SC06_018_jr_8017C24C", func_8017DE6 DEFINE_func_8017DEA4() /* dedup: shared engine-core @0x8017DEA4 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_018/nonmatchings/ov_SC06_018_jr_8017C24C", func_8017DEAC); + +extern void func_80019064(void *a0); + +void func_8017DEAC(void *a0) { + + extern u8 D_80197118; + extern void (*D_80197140[])(void *); + func_80019064(&D_80197118); + D_80197140[*(u16 *)((s32)a0 + 0x2)](a0); +} + INCLUDE_ASM("asm/ov_SC06_018/nonmatchings/ov_SC06_018_jr_8017C24C", func_8017DF04); @@ -4875,7 +4894,7 @@ typedef struct { } StructB58; extern s32 D_80126B58; -extern s32 *D_80126B78; /* holds a pointer value */ +/* holds a pointer value */ extern u16 D_800B99DA; extern u8 D_801B5184; @@ -4893,6 +4912,10 @@ extern void func_8018931C(s32, void*, s32, s32, s32, s32); extern s32 func_80013478(s32 a0, s32 a1); void func_8018598C(s32 param_1) { + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern s32 *D_80126B78; u8 auStack_38[8]; s16 sp20[3]; u8 auStack_28[8]; diff --git a/src/ov_SC06_020/ov_SC06_020_jr_80135D20.c b/src/ov_SC06_020/ov_SC06_020_jr_80135D20.c index b5205116af..e16d943cbe 100644 --- a/src/ov_SC06_020/ov_SC06_020_jr_80135D20.c +++ b/src/ov_SC06_020/ov_SC06_020_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_020/nonmatchings/ov_SC06_020_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80185610[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80185610[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80185610[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80185610[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80185610[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_020/ov_SC06_020_jr_80154C24.c b/src/ov_SC06_020/ov_SC06_020_jr_80154C24.c index 4074176bd9..8403dd96aa 100644 --- a/src/ov_SC06_020/ov_SC06_020_jr_80154C24.c +++ b/src/ov_SC06_020/ov_SC06_020_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_020/nonmatchings/ov_SC06_020_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80187398)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80187398[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80187398[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_020/ov_SC06_020_jr_8017C24C.c b/src/ov_SC06_020/ov_SC06_020_jr_8017C24C.c index fb42457585..7bdfbc6979 100644 --- a/src/ov_SC06_020/ov_SC06_020_jr_8017C24C.c +++ b/src/ov_SC06_020/ov_SC06_020_jr_8017C24C.c @@ -76,7 +76,6 @@ extern s32 func_80146128(void); extern void func_80146360(void); extern void func_801463A0(); extern void func_8014607C(void); -extern s32 *D_80126B78; extern u8 D_80078EC1; extern s32 D_80078EC8; extern s32 D_8011F730; @@ -359,7 +358,6 @@ extern s32 func_801498E0(s32 *a0); extern s32 func_8012E5CC(s32 a0, s32 a1, s32 a2); extern void func_80147364(u16 a0, s32 a1); extern s32 func_800CCF28(s32 a0); -extern u8 D_80126B5C; extern s32 func_80149954(s32 s0); extern s32 func_80149A64(s32 *a0); extern void func_8015DAC4(s32 *a0); @@ -1674,8 +1672,6 @@ extern void func_8016634C(void *a0); extern void func_801663A4(void *a0); extern void (*D_80187F44[])(void); extern void func_801663FC(void *a0); -extern u8 D_800D387C[]; -extern u8 D_800D3888[]; extern s32 func_800D21C4(s32 a0, void *a1, s32 a2); extern void func_800D1FC8(s32 a0, s32 a1); extern void func_80128EA8(s32 a0, s32 a1, s32 a2); @@ -3441,7 +3437,46 @@ INCLUDE_ASM("asm/ov_SC06_020/nonmatchings/ov_SC06_020_jr_8017C24C", func_8017EDE INCLUDE_ASM("asm/ov_SC06_020/nonmatchings/ov_SC06_020_jr_8017C24C", func_8017F264); -INCLUDE_ASM("asm/ov_SC06_020/nonmatchings/ov_SC06_020_jr_8017C24C", func_8017F3D8); + +/* func_8017F3D8 — randomised state entry (state word 0x19): + * set the state at 0x02, push command list D_801B5FD0, seed the timer at + * 0x1C with rand()%64 + 0x80, nudge the value at 0xE8 by a random 0..1023 + * in a random direction, then park 18000 at 0x48. + * + * §71 sibling-first: func_80183CDC / func_8018598C (same TU, MATCHed) are the + * same `if ((rand() & 1) != 0) v = base + off; else v = base - off;` idiom. + */ + +extern s32 rand(void); +extern void func_8012A828(s32 a0, void *a1); + +void func_8017F3D8(s32 param_1) { + + extern u8 D_801B5FD0[]; + s32 r; + s32 off; + s32 base; + s32 nv; + + *(s16 *)(param_1 + 2) = 0x19; + func_8012A828(param_1, D_801B5FD0); + + r = rand(); + *(s32 *)(param_1 + 0x1C) = r % 0x40 + 0x80; + + r = rand(); + off = r % 0x400; + base = *(s32 *)(param_1 + 0xE8); + if ((rand() & 1) != 0) { + nv = base + off; + } else { + nv = base - off; + } + *(s32 *)(param_1 + 0xE8) = nv; + + *(s32 *)(param_1 + 0x48) = 18000; +} + @@ -3821,7 +3856,33 @@ INCLUDE_ASM("asm/ov_SC06_020/nonmatchings/ov_SC06_020_jr_8017C24C", func_801827F INCLUDE_ASM("asm/ov_SC06_020/nonmatchings/ov_SC06_020_jr_8017C24C", func_80182820); -INCLUDE_ASM("asm/ov_SC06_020/nonmatchings/ov_SC06_020_jr_8017C24C", func_80182C70); + +extern void func_80049CAC(s32, s32); +extern void func_800484EC(s32, s32, s32); +extern void func_8012B260(u8 *a0); + +void func_80182C70(s32 p) { + s32 g10[4]; /* sp+0x10 */ + u16 g20[4]; /* sp+0x20 */ + s32 buf28[8]; /* sp+0x28 */ + u16 v; + + g10[2] = 0xFFF00000; + g10[1] = 0; + g10[0] = 0; + g20[0] = 0x10; + v = *(u16 *)(*(s32 *)(*(s32 *)(p + 0x64) + 0x20) + 0x12) + + *(u16 *)(p + 0xFC); + g20[1] = v; + *(u16 *)(p + 0xFE) = v; + g20[2] = 0; + ((void (*)(void *, void *))func_80049CAC)(g20, buf28); + ((void (*)(void *, void *, s32))func_800484EC)(buf28, g10, p + 0x10); + *(u16 *)(p + 2) = 8; + *(s32 *)(p + 0x1C) = 0x40; + ((void (*)(s32))func_8012B260)(p); +} + INCLUDE_ASM("asm/ov_SC06_020/nonmatchings/ov_SC06_020_jr_8017C24C", func_80182D0C); @@ -3853,7 +3914,27 @@ void func_80183624(void *a0) { INCLUDE_ASM("asm/ov_SC06_020/nonmatchings/ov_SC06_020_jr_8017C24C", func_80183660); -INCLUDE_ASM("asm/ov_SC06_020/nonmatchings/ov_SC06_020_jr_8017C24C", func_80183AC4); + +extern s32 func_8012CBF4(s32 a0); +extern s32 func_8012BEE8(s32 a0); +extern void func_8012C218(void *a0); /* TU-canonical (ov_SC06_018_jr_8017C24C L5455) */ +extern void func_80017274(s32 a0, s32 a1); + +void func_80183AC4(s32 param_1) { + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x10) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x10) + *(u16 *)(param_1 + 0xFE); + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x12) + *(u16 *)(param_1 + 0x100); + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x14) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x14) + *(u16 *)(param_1 + 0x102); + + if (func_8012CBF4(param_1) != 0 || func_8012BEE8(param_1) != 0) { + func_8012C218((void *)param_1); + } else { + func_80017274(param_1 + 0xDC, *(s32 *)(param_1 + 0x20) + 0x34); + } +} + extern void (*D_8019EDD0[])(void); @@ -3879,9 +3960,72 @@ void func_8018413C(void *a0) { } -INCLUDE_ASM("asm/ov_SC06_020/nonmatchings/ov_SC06_020_jr_8017C24C", func_80184178); -INCLUDE_ASM("asm/ov_SC06_020/nonmatchings/ov_SC06_020_jr_8017C24C", func_80184228); +extern void func_80128EA8(s32 a0, s32 a1, s32 a2); + +void func_80184178(s32 param_1) { + + extern u8 D_800D387C[]; + extern u8 D_800D3888[]; + s32 t; + + *(u32 *)(*(s32 *)(param_1 + 0x20) + 0x20) = (u32)&D_800D387C; + + *(u32 *)(*(s32 *)(param_1 + 0x20) + 4) |= 0x50000000; + + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x27) = 0x9c; + + t = *(s32 *)(param_1 + 0x20); + *(u16 *)(t + 0x1a) = 0x2000; + *(u16 *)(t + 0x18) = 0x2000; + + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x24) = 0xff; + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x25) = 0; + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x26) = 0; + + func_80128EA8(*(s32 *)(param_1 + 0x20), param_1 + 0x24, (s32)&D_800D3888); + + *(u16 *)(param_1 + 2) = *(u16 *)(param_1 + 2) + 1; +} + + + +extern void func_8012931C(s32 a0); +extern s32 func_80128ED8(void *a0, void *a1); +extern void func_801292C8(s32 a0); + +void func_80184228(s32 param_1) { + s32 q; + u8 a; + u8 b; + u16 h; + + q = *(s32 *)(param_1 + 0x20); + + a = *(u8 *)(q + 0x24) - 0x20; + *(u8 *)(q + 0x24) = a; + if (a < 0x80) { + *(u8 *)(q + 0x24) = 0x80; + } + + b = *(u8 *)(q + 0x25) + 0x20; + *(u8 *)(q + 0x25) = b; + if (b > 0x80) { + *(u8 *)(q + 0x25) = 0x80; + } + + h = *(u16 *)(q + 0x1A) + 0x400; + *(u8 *)(q + 0x26) = *(u8 *)(q + 0x25); + *(u16 *)(q + 0x1A) = h; + *(u16 *)(q + 0x18) = h; + + func_8012931C(param_1); + + if (func_80128ED8((void *)q, (void *)(param_1 + 0x24)) != 0) { + func_801292C8(param_1); + } +} + extern s32 D_801BA878; diff --git a/src/ov_SC06_022/ov_SC06_022_jr_80135D20.c b/src/ov_SC06_022/ov_SC06_022_jr_80135D20.c index 62f19ffa34..4a1e873961 100644 --- a/src/ov_SC06_022/ov_SC06_022_jr_80135D20.c +++ b/src/ov_SC06_022/ov_SC06_022_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018D8CC[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018D8CC[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018D8CC[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018D8CC[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018D8CC[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_022/ov_SC06_022_jr_80154C24.c b/src/ov_SC06_022/ov_SC06_022_jr_80154C24.c index 388a9477c0..1bc59f5a8d 100644 --- a/src/ov_SC06_022/ov_SC06_022_jr_80154C24.c +++ b/src/ov_SC06_022/ov_SC06_022_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018F654)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018F654[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018F654[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_022/ov_SC06_022_jr_8017BEBC.c b/src/ov_SC06_022/ov_SC06_022_jr_8017BEBC.c index f0a3c1aaea..93a80675a8 100644 --- a/src/ov_SC06_022/ov_SC06_022_jr_8017BEBC.c +++ b/src/ov_SC06_022/ov_SC06_022_jr_8017BEBC.c @@ -76,7 +76,6 @@ extern s32 func_80146128(void); extern void func_80146360(void); extern void func_801463A0(); extern void func_8014607C(void); -extern s32 *D_80126B78; extern u8 D_80078EC1; extern s32 D_80078EC8; extern s32 D_8011F730; @@ -359,7 +358,6 @@ extern s32 func_801498E0(s32 *a0); extern s32 func_8012E5CC(s32 a0, s32 a1, s32 a2); extern void func_80147364(u16 a0, s32 a1); extern s32 func_800CCF28(s32 a0); -extern u8 D_80126B5C; extern s32 func_80149954(s32 s0); extern s32 func_80149A64(s32 *a0); extern void func_8015DAC4(s32 *a0); @@ -1674,8 +1672,6 @@ extern void func_8016634C(void *a0); extern void func_801663A4(void *a0); extern void (*D_80190200[])(void); extern void func_801663FC(void *a0); -extern u8 D_800D387C[]; -extern u8 D_800D3888[]; extern s32 func_800D21C4(s32 a0, void *a1, s32 a2); extern void func_800D1FC8(s32 a0, s32 a1); extern void func_80128EA8(s32 a0, s32 a1, s32 a2); @@ -3385,7 +3381,24 @@ INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_8017E10 void func_8017E2A8(void) { } -INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_8017E2B0); + +/* func_8017E2B0 — guard-then-free tail (cookbook §71 sibling shape: + * src/ov_SC02_011/ov_SC02_011_jr_8017AE2C.c func_80144458 tail, and + * src/ov_SC03_099/ov_SC03_099_jr_80140608.c:2432 func_80016714(x, 0x84)). */ + +extern void func_80016714(void *a0, s32 a1); +extern void func_8012C218(void *a0); + +void func_8017E2B0(void *arg0) { + void *temp_a0; + + temp_a0 = *(void **)((char *)arg0 + 0xCC); + if (temp_a0 != NULL) { + func_80016714(temp_a0, 0x84); + } + func_8012C218(arg0); +} + extern void (*D_80190F7C[])(void); @@ -3482,7 +3495,18 @@ s32 func_8017F590(void) { } -INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_8017F598); + +extern void func_8012DFD4(void *a0); + +void func_8017F598(void *a0) { + + extern void (*D_801910F0[])(void); + D_801910F0[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)a0 != 0) { + func_8012DFD4(a0); + } +} + INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_8017F5F8); @@ -3633,7 +3657,17 @@ void func_801813C8(int param_1) } -INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_80181418); + +extern s32 func_8012C658(s32 arg0, s32 arg1, s32 arg2); + +void func_80181418(s32 arg0) { + s32 i; + + for (i = 0; i < 20; i++) { + func_8012C658(0x311, i, arg0); + } +} + INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_80181468); @@ -3773,7 +3807,46 @@ INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_80182D0 INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_80183188); -INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_801832FC); + +/* func_801832FC — randomised state entry (state word 0x19): + * set the state at 0x02, push command list D_801D46F8, seed the timer at + * 0x1C with rand()%64 + 0x80, nudge the value at 0xE8 by a random 0..1023 + * in a random direction, then park 18000 at 0x48. + * + * §71 sibling-first: func_80183CDC / func_8018598C (same TU, MATCHed) are the + * same `if ((rand() & 1) != 0) v = base + off; else v = base - off;` idiom. + */ + +extern s32 rand(void); +extern void func_8012A828(s32 a0, void *a1); + +void func_801832FC(s32 param_1) { + + extern u8 D_801D46F8[]; + s32 r; + s32 off; + s32 base; + s32 nv; + + *(s16 *)(param_1 + 2) = 0x19; + func_8012A828(param_1, D_801D46F8); + + r = rand(); + *(s32 *)(param_1 + 0x1C) = r % 0x40 + 0x80; + + r = rand(); + off = r % 0x400; + base = *(s32 *)(param_1 + 0xE8); + if ((rand() & 1) != 0) { + nv = base + off; + } else { + nv = base - off; + } + *(s32 *)(param_1 + 0xE8) = nv; + + *(s32 *)(param_1 + 0x48) = 18000; +} + @@ -4153,7 +4226,33 @@ INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_8018672 INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_80186744); -INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_80186B94); + +extern void func_80049CAC(s32, s32); +extern void func_800484EC(s32, s32, s32); +extern void func_8012B260(u8 *a0); + +void func_80186B94(s32 p) { + s32 g10[4]; /* sp+0x10 */ + u16 g20[4]; /* sp+0x20 */ + s32 buf28[8]; /* sp+0x28 */ + u16 v; + + g10[2] = 0xFFF00000; + g10[1] = 0; + g10[0] = 0; + g20[0] = 0x10; + v = *(u16 *)(*(s32 *)(*(s32 *)(p + 0x64) + 0x20) + 0x12) + + *(u16 *)(p + 0xFC); + g20[1] = v; + *(u16 *)(p + 0xFE) = v; + g20[2] = 0; + ((void (*)(void *, void *))func_80049CAC)(g20, buf28); + ((void (*)(void *, void *, s32))func_800484EC)(buf28, g10, p + 0x10); + *(u16 *)(p + 2) = 8; + *(s32 *)(p + 0x1C) = 0x40; + ((void (*)(s32))func_8012B260)(p); +} + INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_80186C30); @@ -4185,7 +4284,27 @@ void func_80187548(void *a0) { INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_80187584); -INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_801879E8); + +extern s32 func_8012CBF4(s32 a0); +extern s32 func_8012BEE8(s32 a0); +extern void func_8012C218(void *a0); /* TU-canonical (ov_SC06_018_jr_8017C24C L5455) */ +extern void func_80017274(s32 a0, s32 a1); + +void func_801879E8(s32 param_1) { + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x10) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x10) + *(u16 *)(param_1 + 0xFE); + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x12) + *(u16 *)(param_1 + 0x100); + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x14) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x14) + *(u16 *)(param_1 + 0x102); + + if (func_8012CBF4(param_1) != 0 || func_8012BEE8(param_1) != 0) { + func_8012C218((void *)param_1); + } else { + func_80017274(param_1 + 0xDC, *(s32 *)(param_1 + 0x20) + 0x34); + } +} + extern void (*D_801BD4F8[])(void); @@ -4211,9 +4330,72 @@ void func_80188060(void *a0) { } -INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_8018809C); -INCLUDE_ASM("asm/ov_SC06_022/nonmatchings/ov_SC06_022_jr_8017BEBC", func_8018814C); +extern void func_80128EA8(s32 a0, s32 a1, s32 a2); + +void func_8018809C(s32 param_1) { + + extern u8 D_800D387C[]; + extern u8 D_800D3888[]; + s32 t; + + *(u32 *)(*(s32 *)(param_1 + 0x20) + 0x20) = (u32)&D_800D387C; + + *(u32 *)(*(s32 *)(param_1 + 0x20) + 4) |= 0x50000000; + + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x27) = 0x9c; + + t = *(s32 *)(param_1 + 0x20); + *(u16 *)(t + 0x1a) = 0x2000; + *(u16 *)(t + 0x18) = 0x2000; + + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x24) = 0xff; + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x25) = 0; + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x26) = 0; + + func_80128EA8(*(s32 *)(param_1 + 0x20), param_1 + 0x24, (s32)&D_800D3888); + + *(u16 *)(param_1 + 2) = *(u16 *)(param_1 + 2) + 1; +} + + + +extern void func_8012931C(s32 a0); +extern s32 func_80128ED8(void *a0, void *a1); +extern void func_801292C8(s32 a0); + +void func_8018814C(s32 param_1) { + s32 q; + u8 a; + u8 b; + u16 h; + + q = *(s32 *)(param_1 + 0x20); + + a = *(u8 *)(q + 0x24) - 0x20; + *(u8 *)(q + 0x24) = a; + if (a < 0x80) { + *(u8 *)(q + 0x24) = 0x80; + } + + b = *(u8 *)(q + 0x25) + 0x20; + *(u8 *)(q + 0x25) = b; + if (b > 0x80) { + *(u8 *)(q + 0x25) = 0x80; + } + + h = *(u16 *)(q + 0x1A) + 0x400; + *(u8 *)(q + 0x26) = *(u8 *)(q + 0x25); + *(u16 *)(q + 0x1A) = h; + *(u16 *)(q + 0x18) = h; + + func_8012931C(param_1); + + if (func_80128ED8((void *)q, (void *)(param_1 + 0x24)) != 0) { + func_801292C8(param_1); + } +} + extern s32 D_801E20F8; diff --git a/src/ov_SC06_024/ov_SC06_024_jr_80135D20.c b/src/ov_SC06_024/ov_SC06_024_jr_80135D20.c index a8ad0d4cf6..584be056e7 100644 --- a/src/ov_SC06_024/ov_SC06_024_jr_80135D20.c +++ b/src/ov_SC06_024/ov_SC06_024_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018FDA4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018FDA4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018FDA4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018FDA4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018FDA4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_024/ov_SC06_024_jr_80154C24.c b/src/ov_SC06_024/ov_SC06_024_jr_80154C24.c index c118b1f9ac..6b50ccf65b 100644 --- a/src/ov_SC06_024/ov_SC06_024_jr_80154C24.c +++ b/src/ov_SC06_024/ov_SC06_024_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80191B2C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80191B2C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80191B2C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_024/ov_SC06_024_jr_8017BEBC.c b/src/ov_SC06_024/ov_SC06_024_jr_8017BEBC.c index 11c6770af5..9fe34da8fd 100644 --- a/src/ov_SC06_024/ov_SC06_024_jr_8017BEBC.c +++ b/src/ov_SC06_024/ov_SC06_024_jr_8017BEBC.c @@ -357,7 +357,6 @@ extern s32 func_801498E0(s32 *a0); extern s32 func_8012E5CC(s32 a0, s32 a1, s32 a2); extern void func_80147364(u16 a0, s32 a1); extern s32 func_800CCF28(s32 a0); -extern u8 D_80126B5C; extern s32 func_80149954(s32 s0); extern s32 func_80149A64(s32 *a0); extern void func_8015DAC4(s32 *a0); @@ -1670,8 +1669,6 @@ extern void func_8016634C(void *a0); extern void func_801663A4(void *a0); extern void (*D_801926D8[])(void); extern void func_801663FC(void *a0); -extern u8 D_800D387C[]; -extern u8 D_800D3888[]; extern s32 func_800D21C4(s32 a0, void *a1, s32 a2); extern void func_800D1FC8(s32 a0, s32 a1); extern void func_80128EA8(s32 a0, s32 a1, s32 a2); @@ -3454,7 +3451,18 @@ INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_8018072 INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_80180894); -INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_8018090C); + +extern void func_8012DFD4(void *a0); + +void func_8018090C(void *a0) { + + extern void (*D_80193764[])(void); + D_80193764[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)a0 != 0) { + func_8012DFD4(a0); + } +} + extern void (*D_801937B4[])(void); @@ -3523,7 +3531,17 @@ INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_80180FF INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_80181068); -INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_801811AC); + +extern void func_80019064(void *a0); + +void func_801811AC(void *a0) { + + extern u8 D_801937E0; + extern void (*D_80193808[])(void *); + func_80019064(&D_801937E0); + D_80193808[*(u16 *)((s32)a0 + 0x2)](a0); +} + INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_80181204); @@ -3998,7 +4016,17 @@ void func_801838A0(int param_1) } -INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_801838F0); + +extern s32 func_8012C658(s32 arg0, s32 arg1, s32 arg2); + +void func_801838F0(s32 arg0) { + s32 i; + + for (i = 0; i < 20; i++) { + func_8012C658(0x311, i, arg0); + } +} + INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_80183940); @@ -4214,7 +4242,46 @@ INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_801851E INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_80185660); -INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_801857D4); + +/* func_801857D4 — randomised state entry (state word 0x19): + * set the state at 0x02, push command list D_801D383C, seed the timer at + * 0x1C with rand()%64 + 0x80, nudge the value at 0xE8 by a random 0..1023 + * in a random direction, then park 18000 at 0x48. + * + * §71 sibling-first: func_80183CDC / func_8018598C (same TU, MATCHed) are the + * same `if ((rand() & 1) != 0) v = base + off; else v = base - off;` idiom. + */ + +extern s32 rand(void); +extern void func_8012A828(s32 a0, void *a1); + +void func_801857D4(s32 param_1) { + + extern u8 D_801D383C[]; + s32 r; + s32 off; + s32 base; + s32 nv; + + *(s16 *)(param_1 + 2) = 0x19; + func_8012A828(param_1, D_801D383C); + + r = rand(); + *(s32 *)(param_1 + 0x1C) = r % 0x40 + 0x80; + + r = rand(); + off = r % 0x400; + base = *(s32 *)(param_1 + 0xE8); + if ((rand() & 1) != 0) { + nv = base + off; + } else { + nv = base - off; + } + *(s32 *)(param_1 + 0xE8) = nv; + + *(s32 *)(param_1 + 0x48) = 18000; +} + @@ -4508,7 +4575,33 @@ INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_80188BF INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_80188C1C); -INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_8018906C); + +extern void func_80049CAC(s32, s32); +extern void func_800484EC(s32, s32, s32); +extern void func_8012B260(u8 *a0); + +void func_8018906C(s32 p) { + s32 g10[4]; /* sp+0x10 */ + u16 g20[4]; /* sp+0x20 */ + s32 buf28[8]; /* sp+0x28 */ + u16 v; + + g10[2] = 0xFFF00000; + g10[1] = 0; + g10[0] = 0; + g20[0] = 0x10; + v = *(u16 *)(*(s32 *)(*(s32 *)(p + 0x64) + 0x20) + 0x12) + + *(u16 *)(p + 0xFC); + g20[1] = v; + *(u16 *)(p + 0xFE) = v; + g20[2] = 0; + ((void (*)(void *, void *))func_80049CAC)(g20, buf28); + ((void (*)(void *, void *, s32))func_800484EC)(buf28, g10, p + 0x10); + *(u16 *)(p + 2) = 8; + *(s32 *)(p + 0x1C) = 0x40; + ((void (*)(s32))func_8012B260)(p); +} + INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_80189108); @@ -4540,7 +4633,27 @@ void func_80189A20(void *a0) { INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_80189A5C); -INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_80189EC0); + +extern s32 func_8012CBF4(s32 a0); +extern s32 func_8012BEE8(s32 a0); +extern void func_8012C218(s32); +extern void func_80017274(s32 a0, s32 a1); + +void func_80189EC0(s32 param_1) { + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x10) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x10) + *(u16 *)(param_1 + 0xFE); + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x12) + *(u16 *)(param_1 + 0x100); + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x14) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x14) + *(u16 *)(param_1 + 0x102); + + if (func_8012CBF4(param_1) != 0 || func_8012BEE8(param_1) != 0) { + ((void (*)(void *))func_8012C218)((void *)param_1); + } else { + func_80017274(param_1 + 0xDC, *(s32 *)(param_1 + 0x20) + 0x34); + } +} + extern void (*D_801BC63C[])(void); @@ -4566,9 +4679,72 @@ void func_8018A538(void *a0) { } -INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_8018A574); -INCLUDE_ASM("asm/ov_SC06_024/nonmatchings/ov_SC06_024_jr_8017BEBC", func_8018A624); +extern void func_80128EA8(s32 a0, s32 a1, s32 a2); + +void func_8018A574(s32 param_1) { + + extern u8 D_800D387C[]; + extern u8 D_800D3888[]; + s32 t; + + *(u32 *)(*(s32 *)(param_1 + 0x20) + 0x20) = (u32)&D_800D387C; + + *(u32 *)(*(s32 *)(param_1 + 0x20) + 4) |= 0x50000000; + + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x27) = 0x9c; + + t = *(s32 *)(param_1 + 0x20); + *(u16 *)(t + 0x1a) = 0x2000; + *(u16 *)(t + 0x18) = 0x2000; + + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x24) = 0xff; + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x25) = 0; + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x26) = 0; + + func_80128EA8(*(s32 *)(param_1 + 0x20), param_1 + 0x24, (s32)&D_800D3888); + + *(u16 *)(param_1 + 2) = *(u16 *)(param_1 + 2) + 1; +} + + + +extern void func_8012931C(s32 a0); +extern s32 func_80128ED8(void *a0, void *a1); +extern void func_801292C8(u8*); + +void func_8018A624(s32 param_1) { + s32 q; + u8 a; + u8 b; + u16 h; + + q = *(s32 *)(param_1 + 0x20); + + a = *(u8 *)(q + 0x24) - 0x20; + *(u8 *)(q + 0x24) = a; + if (a < 0x80) { + *(u8 *)(q + 0x24) = 0x80; + } + + b = *(u8 *)(q + 0x25) + 0x20; + *(u8 *)(q + 0x25) = b; + if (b > 0x80) { + *(u8 *)(q + 0x25) = 0x80; + } + + h = *(u16 *)(q + 0x1A) + 0x400; + *(u8 *)(q + 0x26) = *(u8 *)(q + 0x25); + *(u16 *)(q + 0x1A) = h; + *(u16 *)(q + 0x18) = h; + + func_8012931C(param_1); + + if (func_80128ED8((void *)q, (void *)(param_1 + 0x24)) != 0) { + ((void (*)(s32))func_801292C8)(param_1); + } +} + extern s32 func_8012C588(s32 a0, s32 a1); diff --git a/src/ov_SC06_025/ov_SC06_025_jr_80135D20.c b/src/ov_SC06_025/ov_SC06_025_jr_80135D20.c index ab279fd5de..124520ddb8 100644 --- a/src/ov_SC06_025/ov_SC06_025_jr_80135D20.c +++ b/src/ov_SC06_025/ov_SC06_025_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_025/nonmatchings/ov_SC06_025_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80185248[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80185248[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80185248[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80185248[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80185248[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_025/ov_SC06_025_jr_80154C24.c b/src/ov_SC06_025/ov_SC06_025_jr_80154C24.c index b4f1ebf62d..d8fbfdae29 100644 --- a/src/ov_SC06_025/ov_SC06_025_jr_80154C24.c +++ b/src/ov_SC06_025/ov_SC06_025_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_025/nonmatchings/ov_SC06_025_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80186FD0)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80186FD0[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80186FD0[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_025/ov_SC06_025_jr_8017BEBC.c b/src/ov_SC06_025/ov_SC06_025_jr_8017BEBC.c index c958e44559..b164602cce 100644 --- a/src/ov_SC06_025/ov_SC06_025_jr_8017BEBC.c +++ b/src/ov_SC06_025/ov_SC06_025_jr_8017BEBC.c @@ -3455,7 +3455,18 @@ INCLUDE_ASM("asm/ov_SC06_025/nonmatchings/ov_SC06_025_jr_8017BEBC", func_8017E18 INCLUDE_ASM("asm/ov_SC06_025/nonmatchings/ov_SC06_025_jr_8017BEBC", func_8017E230); -INCLUDE_ASM("asm/ov_SC06_025/nonmatchings/ov_SC06_025_jr_8017BEBC", func_8017E290); + +extern void func_8012DFD4(void *a0); + +void func_8017E290(void *a0) { + + extern void (*D_8018884C[])(void); + D_8018884C[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)a0 != 0) { + func_8012DFD4(a0); + } +} + INCLUDE_ASM("asm/ov_SC06_025/nonmatchings/ov_SC06_025_jr_8017BEBC", func_8017E2F0); @@ -3572,7 +3583,18 @@ void func_80181260(void *a0) { } -INCLUDE_ASM("asm/ov_SC06_025/nonmatchings/ov_SC06_025_jr_8017BEBC", func_8018129C); + +extern void func_8012DFD4(void *a0); + +void func_8018129C(void *a0) { + + extern void (*D_8018939C[])(void); + D_8018939C[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)a0 != 0) { + func_8012DFD4(a0); + } +} + INCLUDE_ASM("asm/ov_SC06_025/nonmatchings/ov_SC06_025_jr_8017BEBC", func_801812FC); @@ -3776,7 +3798,17 @@ INCLUDE_ASM("asm/ov_SC06_025/nonmatchings/ov_SC06_025_jr_8017BEBC", func_801835B INCLUDE_ASM("asm/ov_SC06_025/nonmatchings/ov_SC06_025_jr_8017BEBC", func_80183604); -INCLUDE_ASM("asm/ov_SC06_025/nonmatchings/ov_SC06_025_jr_8017BEBC", func_801836CC); + +extern void func_80019064(void *a0); + +void func_801836CC(void *a0) { + + extern u8 D_801AD9E4; + extern void (*D_801ADA0C[])(void *); + func_80019064(&D_801AD9E4); + D_801ADA0C[*(u16 *)((s32)a0 + 0x2)](a0); +} + INCLUDE_ASM("asm/ov_SC06_025/nonmatchings/ov_SC06_025_jr_8017BEBC", func_80183724); diff --git a/src/ov_SC06_027/ov_SC06_027_jr_80135D20.c b/src/ov_SC06_027/ov_SC06_027_jr_80135D20.c index bdb2893fbd..b97043d74c 100644 --- a/src/ov_SC06_027/ov_SC06_027_jr_80135D20.c +++ b/src/ov_SC06_027/ov_SC06_027_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_027/nonmatchings/ov_SC06_027_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017E588[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017E588[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017E588[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017E588[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017E588[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_027/ov_SC06_027_jr_80154C24.c b/src/ov_SC06_027/ov_SC06_027_jr_80154C24.c index dd3918e92d..07bdcfefd8 100644 --- a/src/ov_SC06_027/ov_SC06_027_jr_80154C24.c +++ b/src/ov_SC06_027/ov_SC06_027_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_027/nonmatchings/ov_SC06_027_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80180310)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80180310[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80180310[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_029/ov_SC06_029_jr_80135D20.c b/src/ov_SC06_029/ov_SC06_029_jr_80135D20.c index c34ab76160..48c1ab94fb 100644 --- a/src/ov_SC06_029/ov_SC06_029_jr_80135D20.c +++ b/src/ov_SC06_029/ov_SC06_029_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_029/nonmatchings/ov_SC06_029_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018CB1C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018CB1C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018CB1C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018CB1C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018CB1C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_029/ov_SC06_029_jr_80154C24.c b/src/ov_SC06_029/ov_SC06_029_jr_80154C24.c index d9830504b8..5a2eb1f05d 100644 --- a/src/ov_SC06_029/ov_SC06_029_jr_80154C24.c +++ b/src/ov_SC06_029/ov_SC06_029_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_029/nonmatchings/ov_SC06_029_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018E8A4)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018E8A4[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018E8A4[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_029/ov_SC06_029_jr_8017C954.c b/src/ov_SC06_029/ov_SC06_029_jr_8017C954.c index 3138461bf9..2f3abb5439 100644 --- a/src/ov_SC06_029/ov_SC06_029_jr_8017C954.c +++ b/src/ov_SC06_029/ov_SC06_029_jr_8017C954.c @@ -45,7 +45,6 @@ extern s32 func_80165A50(s32); extern void func_80029514(s32); extern u8 D_800AF630[]; extern u8 D_80078EC0; -extern s32 D_80126B58; extern s32 func_80028FBC(void); extern s32 func_80029000(void); extern s32 func_80028D9C(void); @@ -3514,11 +3513,14 @@ INCLUDE_ASM("asm/ov_SC06_029/nonmatchings/ov_SC06_029_jr_8017C954", func_8017E58 INCLUDE_ASM("asm/ov_SC06_029/nonmatchings/ov_SC06_029_jr_8017C954", func_8017E610); -extern s32 D_80126B58; extern s16 D_80126B30; extern void func_8017303C(void *); extern s32 func_80174650(s32); void func_8017E640(void) { + /* [T51] scoped in from file scope: a file-scope decl of these symbols constrains every + LATER function in this TU, which blocks a byte-true decl of a different type. + Declaration-only move (cookbook §103); the whole-binary byte-gate is the arbiter. */ + extern s32 D_80126B58; extern u8 D_801900B4[]; func_8017303C((void *)D_801900B4); @@ -4397,13 +4399,43 @@ extern void func_80146C3C(void); } -INCLUDE_ASM("asm/ov_SC06_029/nonmatchings/ov_SC06_029_jr_8017C954", func_8018B188); + +extern void func_80017254(void *a0); +extern void func_800176F0(void *a0); + +void func_8018B188(void) { + + extern u8 D_801D7190[]; + extern u8 D_801D71B8[]; + u8 *p; + s32 i; + + func_80017254(D_801D7190); + i = 0; + p = D_801D71B8; + do { + func_800176F0(p); + i++; + p += 0x34; + } while (i < 4); +} + INCLUDE_ASM("asm/ov_SC06_029/nonmatchings/ov_SC06_029_jr_8017C954", func_8018B1E0); INCLUDE_ASM("asm/ov_SC06_029/nonmatchings/ov_SC06_029_jr_8017C954", func_8018B20C); -INCLUDE_ASM("asm/ov_SC06_029/nonmatchings/ov_SC06_029_jr_8017C954", func_8018B250); + +extern void func_80019064(void *a0); + +void func_8018B250(void *a0) { + + extern u8 D_801D7294; + extern void (*D_801D72BC[])(void *); + func_80019064(&D_801D7294); + D_801D72BC[*(u16 *)((s32)a0 + 0x2)](a0); +} + INCLUDE_ASM("asm/ov_SC06_029/nonmatchings/ov_SC06_029_jr_8017C954", func_8018B2A8); diff --git a/src/ov_SC06_030/ov_SC06_030_jr_80135D20.c b/src/ov_SC06_030/ov_SC06_030_jr_80135D20.c index e47c4fb73b..59ee0d0f9d 100644 --- a/src/ov_SC06_030/ov_SC06_030_jr_80135D20.c +++ b/src/ov_SC06_030/ov_SC06_030_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_030/nonmatchings/ov_SC06_030_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018240C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018240C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018240C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018240C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018240C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_030/ov_SC06_030_jr_80154C24.c b/src/ov_SC06_030/ov_SC06_030_jr_80154C24.c index ff93e0b493..62a15987f2 100644 --- a/src/ov_SC06_030/ov_SC06_030_jr_80154C24.c +++ b/src/ov_SC06_030/ov_SC06_030_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_030/nonmatchings/ov_SC06_030_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80184194)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80184194[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80184194[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_032/ov_SC06_032_jr_80135D20.c b/src/ov_SC06_032/ov_SC06_032_jr_80135D20.c index e0c7bcb6df..96e9eb3027 100644 --- a/src/ov_SC06_032/ov_SC06_032_jr_80135D20.c +++ b/src/ov_SC06_032/ov_SC06_032_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801938D8[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801938D8[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801938D8[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801938D8[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801938D8[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_032/ov_SC06_032_jr_80154C24.c b/src/ov_SC06_032/ov_SC06_032_jr_80154C24.c index e03b799e91..9bba6a7d69 100644 --- a/src/ov_SC06_032/ov_SC06_032_jr_80154C24.c +++ b/src/ov_SC06_032/ov_SC06_032_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80195660)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80195660[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80195660[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_032/ov_SC06_032_jr_8017C24C.c b/src/ov_SC06_032/ov_SC06_032_jr_8017C24C.c index 702b465ede..9b7ae8629f 100644 --- a/src/ov_SC06_032/ov_SC06_032_jr_8017C24C.c +++ b/src/ov_SC06_032/ov_SC06_032_jr_8017C24C.c @@ -357,7 +357,6 @@ extern s32 func_801498E0(s32 *a0); extern s32 func_8012E5CC(s32 a0, s32 a1, s32 a2); extern void func_80147364(u16 a0, s32 a1); extern s32 func_800CCF28(s32 a0); -extern u8 D_80126B5C; extern s32 func_80149954(s32 s0); extern s32 func_80149A64(s32 *a0); extern void func_8015DAC4(s32 *a0); @@ -1671,8 +1670,6 @@ extern void func_8016634C(void *a0); extern void func_801663A4(void *a0); extern void (*D_8019620C[])(void); extern void func_801663FC(void *a0); -extern u8 D_800D387C[]; -extern u8 D_800D3888[]; extern s32 func_800D21C4(s32 a0, void *a1, s32 a2); extern void func_800D1FC8(s32 a0, s32 a1); extern void func_80128EA8(s32 a0, s32 a1, s32 a2); @@ -3325,7 +3322,17 @@ s32 func_8017DBF4(void) { } -INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_8017C24C", func_8017DBFC); + +extern void func_80019064(void *a0); + +void func_8017DBFC(void *a0) { + + extern u8 D_80196DE8; + extern void (*D_80196E10[])(void *); + func_80019064(&D_80196DE8); + D_80196E10[*(u16 *)((s32)a0 + 0x2)](a0); +} + INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_8017C24C", func_8017DC54); @@ -3773,7 +3780,46 @@ INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_8017C24C", func_8017FA1 INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_8017C24C", func_8017FE98); -INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_8017C24C", func_8018000C); + +/* func_8018000C — randomised state entry (state word 0x19): + * set the state at 0x02, push command list D_801BDC30, seed the timer at + * 0x1C with rand()%64 + 0x80, nudge the value at 0xE8 by a random 0..1023 + * in a random direction, then park 18000 at 0x48. + * + * §71 sibling-first: func_80183CDC / func_8018598C (same TU, MATCHed) are the + * same `if ((rand() & 1) != 0) v = base + off; else v = base - off;` idiom. + */ + +extern s32 rand(void); +extern void func_8012A828(s32 a0, void *a1); + +void func_8018000C(s32 param_1) { + + extern u8 D_801BDC30[]; + s32 r; + s32 off; + s32 base; + s32 nv; + + *(s16 *)(param_1 + 2) = 0x19; + func_8012A828(param_1, D_801BDC30); + + r = rand(); + *(s32 *)(param_1 + 0x1C) = r % 0x40 + 0x80; + + r = rand(); + off = r % 0x400; + base = *(s32 *)(param_1 + 0xE8); + if ((rand() & 1) != 0) { + nv = base + off; + } else { + nv = base - off; + } + *(s32 *)(param_1 + 0xE8) = nv; + + *(s32 *)(param_1 + 0x48) = 18000; +} + @@ -4148,7 +4194,33 @@ INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_8017C24C", func_8018343 INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_8017C24C", func_80183454); -INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_8017C24C", func_801838A4); + +extern void func_80049CAC(s32, s32); +extern void func_800484EC(s32, s32, s32); +extern void func_8012B260(u8 *a0); + +void func_801838A4(s32 p) { + s32 g10[4]; /* sp+0x10 */ + u16 g20[4]; /* sp+0x20 */ + s32 buf28[8]; /* sp+0x28 */ + u16 v; + + g10[2] = 0xFFF00000; + g10[1] = 0; + g10[0] = 0; + g20[0] = 0x10; + v = *(u16 *)(*(s32 *)(*(s32 *)(p + 0x64) + 0x20) + 0x12) + + *(u16 *)(p + 0xFC); + g20[1] = v; + *(u16 *)(p + 0xFE) = v; + g20[2] = 0; + ((void (*)(void *, void *))func_80049CAC)(g20, buf28); + ((void (*)(void *, void *, s32))func_800484EC)(buf28, g10, p + 0x10); + *(u16 *)(p + 2) = 8; + *(s32 *)(p + 0x1C) = 0x40; + ((void (*)(s32))func_8012B260)(p); +} + INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_8017C24C", func_80183940); @@ -4180,7 +4252,27 @@ void func_80184258(void *a0) { INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_8017C24C", func_80184294); -INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_8017C24C", func_801846F8); + +extern s32 func_8012CBF4(s32 a0); +extern s32 func_8012BEE8(s32 a0); +extern void func_8012C218(void *a0); /* TU-canonical (ov_SC06_018_jr_8017C24C L5455) */ +extern void func_80017274(s32 a0, s32 a1); + +void func_801846F8(s32 param_1) { + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x10) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x10) + *(u16 *)(param_1 + 0xFE); + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x12) + *(u16 *)(param_1 + 0x100); + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x14) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x14) + *(u16 *)(param_1 + 0x102); + + if (func_8012CBF4(param_1) != 0 || func_8012BEE8(param_1) != 0) { + func_8012C218((void *)param_1); + } else { + func_80017274(param_1 + 0xDC, *(s32 *)(param_1 + 0x20) + 0x34); + } +} + extern void (*D_801A6A30[])(void); @@ -4206,9 +4298,72 @@ void func_80184D70(void *a0) { } -INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_8017C24C", func_80184DAC); -INCLUDE_ASM("asm/ov_SC06_032/nonmatchings/ov_SC06_032_jr_8017C24C", func_80184E5C); +extern void func_80128EA8(s32 a0, s32 a1, s32 a2); + +void func_80184DAC(s32 param_1) { + + extern u8 D_800D387C[]; + extern u8 D_800D3888[]; + s32 t; + + *(u32 *)(*(s32 *)(param_1 + 0x20) + 0x20) = (u32)&D_800D387C; + + *(u32 *)(*(s32 *)(param_1 + 0x20) + 4) |= 0x50000000; + + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x27) = 0x9c; + + t = *(s32 *)(param_1 + 0x20); + *(u16 *)(t + 0x1a) = 0x2000; + *(u16 *)(t + 0x18) = 0x2000; + + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x24) = 0xff; + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x25) = 0; + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x26) = 0; + + func_80128EA8(*(s32 *)(param_1 + 0x20), param_1 + 0x24, (s32)&D_800D3888); + + *(u16 *)(param_1 + 2) = *(u16 *)(param_1 + 2) + 1; +} + + + +extern void func_8012931C(s32 a0); +extern s32 func_80128ED8(void *a0, void *a1); +extern void func_801292C8(s32 a0); + +void func_80184E5C(s32 param_1) { + s32 q; + u8 a; + u8 b; + u16 h; + + q = *(s32 *)(param_1 + 0x20); + + a = *(u8 *)(q + 0x24) - 0x20; + *(u8 *)(q + 0x24) = a; + if (a < 0x80) { + *(u8 *)(q + 0x24) = 0x80; + } + + b = *(u8 *)(q + 0x25) + 0x20; + *(u8 *)(q + 0x25) = b; + if (b > 0x80) { + *(u8 *)(q + 0x25) = 0x80; + } + + h = *(u16 *)(q + 0x1A) + 0x400; + *(u8 *)(q + 0x26) = *(u8 *)(q + 0x25); + *(u16 *)(q + 0x1A) = h; + *(u16 *)(q + 0x18) = h; + + func_8012931C(param_1); + + if (func_80128ED8((void *)q, (void *)(param_1 + 0x24)) != 0) { + func_801292C8(param_1); + } +} + extern s32 D_801D0B78; extern s32 func_8012C588(s32 a0, s32 a1); diff --git a/src/ov_SC06_033/ov_SC06_033_jr_80135D20.c b/src/ov_SC06_033/ov_SC06_033_jr_80135D20.c index b58c56ab48..16333b295a 100644 --- a/src/ov_SC06_033/ov_SC06_033_jr_80135D20.c +++ b/src/ov_SC06_033/ov_SC06_033_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80191DE8[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80191DE8[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80191DE8[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80191DE8[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80191DE8[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC06_033/ov_SC06_033_jr_80154C24.c b/src/ov_SC06_033/ov_SC06_033_jr_80154C24.c index 2b00db70bd..8489fe0816 100644 --- a/src/ov_SC06_033/ov_SC06_033_jr_80154C24.c +++ b/src/ov_SC06_033/ov_SC06_033_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80193B70)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80193B70[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80193B70[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC06_033/ov_SC06_033_jr_8017C24C.c b/src/ov_SC06_033/ov_SC06_033_jr_8017C24C.c index 7410d3b1e3..bcfa4e2555 100644 --- a/src/ov_SC06_033/ov_SC06_033_jr_8017C24C.c +++ b/src/ov_SC06_033/ov_SC06_033_jr_8017C24C.c @@ -357,7 +357,6 @@ extern s32 func_801498E0(s32 *a0); extern s32 func_8012E5CC(s32 a0, s32 a1, s32 a2); extern void func_80147364(u16 a0, s32 a1); extern s32 func_800CCF28(s32 a0); -extern u8 D_80126B5C; extern s32 func_80149954(s32 s0); extern s32 func_80149A64(s32 *a0); extern void func_8015DAC4(s32 *a0); @@ -1671,8 +1670,6 @@ extern void func_8016634C(void *a0); extern void func_801663A4(void *a0); extern void (*D_8019471C[])(void); extern void func_801663FC(void *a0); -extern u8 D_800D387C[]; -extern u8 D_800D3888[]; extern s32 func_800D21C4(s32 a0, void *a1, s32 a2); extern void func_800D1FC8(s32 a0, s32 a1); extern void func_80128EA8(s32 a0, s32 a1, s32 a2); @@ -3370,7 +3367,18 @@ INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_8017E22 INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_8017E3EC); -INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_8017E594); + +extern void func_8012DFD4(void *a0); + +void func_8017E594(void *a0) { + + extern void (*D_80195388[])(void); + D_80195388[*(u16 *)((s32)a0 + 0x2)](); + if (*(u16 *)a0 != 0) { + func_8012DFD4(a0); + } +} + s32 func_8017E5F4(s32 *a0) { s16 v = *(u16 *)((s32)a0 + 0xA) + 4; @@ -3386,7 +3394,17 @@ void func_8017E694(void) { INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_8017E69C); -INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_8017E784); + +extern void func_80019064(void *a0); + +void func_8017E784(void *a0) { + + extern u8 D_8019539C; + extern void (*D_801953C4[])(void *); + func_80019064(&D_8019539C); + D_801953C4[*(u16 *)((s32)a0 + 0x2)](a0); +} + INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_8017E7DC); @@ -4363,7 +4381,46 @@ INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_801836F INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_80183B7C); -INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_80183CF0); + +/* func_80183CF0 — randomised state entry (state word 0x19): + * set the state at 0x02, push command list D_801C6FC4, seed the timer at + * 0x1C with rand()%64 + 0x80, nudge the value at 0xE8 by a random 0..1023 + * in a random direction, then park 18000 at 0x48. + * + * §71 sibling-first: func_80183CDC / func_8018598C (same TU, MATCHed) are the + * same `if ((rand() & 1) != 0) v = base + off; else v = base - off;` idiom. + */ + +extern s32 rand(void); +extern void func_8012A828(s32 a0, void *a1); + +void func_80183CF0(s32 param_1) { + + extern u8 D_801C6FC4[]; + s32 r; + s32 off; + s32 base; + s32 nv; + + *(s16 *)(param_1 + 2) = 0x19; + func_8012A828(param_1, D_801C6FC4); + + r = rand(); + *(s32 *)(param_1 + 0x1C) = r % 0x40 + 0x80; + + r = rand(); + off = r % 0x400; + base = *(s32 *)(param_1 + 0xE8); + if ((rand() & 1) != 0) { + nv = base + off; + } else { + nv = base - off; + } + *(s32 *)(param_1 + 0xE8) = nv; + + *(s32 *)(param_1 + 0x48) = 18000; +} + @@ -4737,7 +4794,33 @@ INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_8018711 INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_80187138); -INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_80187588); + +extern void func_80049CAC(s32, s32); +extern void func_800484EC(s32, s32, s32); +extern void func_8012B260(u8 *a0); + +void func_80187588(s32 p) { + s32 g10[4]; /* sp+0x10 */ + u16 g20[4]; /* sp+0x20 */ + s32 buf28[8]; /* sp+0x28 */ + u16 v; + + g10[2] = 0xFFF00000; + g10[1] = 0; + g10[0] = 0; + g20[0] = 0x10; + v = *(u16 *)(*(s32 *)(*(s32 *)(p + 0x64) + 0x20) + 0x12) + + *(u16 *)(p + 0xFC); + g20[1] = v; + *(u16 *)(p + 0xFE) = v; + g20[2] = 0; + ((void (*)(void *, void *))func_80049CAC)(g20, buf28); + ((void (*)(void *, void *, s32))func_800484EC)(buf28, g10, p + 0x10); + *(u16 *)(p + 2) = 8; + *(s32 *)(p + 0x1C) = 0x40; + ((void (*)(s32))func_8012B260)(p); +} + INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_80187624); @@ -4768,7 +4851,27 @@ void func_80187F3C(void *a0) { INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_80187F78); -INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_801883DC); + +extern s32 func_8012CBF4(s32 a0); +extern s32 func_8012BEE8(s32 a0); +extern void func_8012C218(void *a0); /* TU-canonical (ov_SC06_018_jr_8017C24C L5455) */ +extern void func_80017274(s32 a0, s32 a1); + +void func_801883DC(s32 param_1) { + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x10) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x10) + *(u16 *)(param_1 + 0xFE); + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x12) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x12) + *(u16 *)(param_1 + 0x100); + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x14) = + *(u16 *)(*(s32 *)(param_1 + 0x20) + 0x14) + *(u16 *)(param_1 + 0x102); + + if (func_8012CBF4(param_1) != 0 || func_8012BEE8(param_1) != 0) { + func_8012C218((void *)param_1); + } else { + func_80017274(param_1 + 0xDC, *(s32 *)(param_1 + 0x20) + 0x34); + } +} + extern void (*D_801AFDC4[])(void); @@ -4792,9 +4895,72 @@ void func_80188A54(void *a0) { } -INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_80188A90); -INCLUDE_ASM("asm/ov_SC06_033/nonmatchings/ov_SC06_033_jr_8017C24C", func_80188B40); +extern void func_80128EA8(s32 a0, s32 a1, s32 a2); + +void func_80188A90(s32 param_1) { + + extern u8 D_800D387C[]; + extern u8 D_800D3888[]; + s32 t; + + *(u32 *)(*(s32 *)(param_1 + 0x20) + 0x20) = (u32)&D_800D387C; + + *(u32 *)(*(s32 *)(param_1 + 0x20) + 4) |= 0x50000000; + + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x27) = 0x9c; + + t = *(s32 *)(param_1 + 0x20); + *(u16 *)(t + 0x1a) = 0x2000; + *(u16 *)(t + 0x18) = 0x2000; + + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x24) = 0xff; + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x25) = 0; + *(u8 *)(*(s32 *)(param_1 + 0x20) + 0x26) = 0; + + func_80128EA8(*(s32 *)(param_1 + 0x20), param_1 + 0x24, (s32)&D_800D3888); + + *(u16 *)(param_1 + 2) = *(u16 *)(param_1 + 2) + 1; +} + + + +extern void func_8012931C(s32 a0); +extern s32 func_80128ED8(void *a0, void *a1); +extern void func_801292C8(s32 a0); + +void func_80188B40(s32 param_1) { + s32 q; + u8 a; + u8 b; + u16 h; + + q = *(s32 *)(param_1 + 0x20); + + a = *(u8 *)(q + 0x24) - 0x20; + *(u8 *)(q + 0x24) = a; + if (a < 0x80) { + *(u8 *)(q + 0x24) = 0x80; + } + + b = *(u8 *)(q + 0x25) + 0x20; + *(u8 *)(q + 0x25) = b; + if (b > 0x80) { + *(u8 *)(q + 0x25) = 0x80; + } + + h = *(u16 *)(q + 0x1A) + 0x400; + *(u8 *)(q + 0x26) = *(u8 *)(q + 0x25); + *(u16 *)(q + 0x1A) = h; + *(u16 *)(q + 0x18) = h; + + func_8012931C(param_1); + + if (func_80128ED8((void *)q, (void *)(param_1 + 0x24)) != 0) { + func_801292C8(param_1); + } +} + extern s32 D_801D0C38; diff --git a/src/ov_SC07_000/ov_SC07_000_jr_80135D20.c b/src/ov_SC07_000/ov_SC07_000_jr_80135D20.c index ee1fe285a2..7d0c6aa6d6 100644 --- a/src/ov_SC07_000/ov_SC07_000_jr_80135D20.c +++ b/src/ov_SC07_000/ov_SC07_000_jr_80135D20.c @@ -1426,7 +1426,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_000/nonmatchings/ov_SC07_000_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80182C30[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80182C30[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80182C30[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80182C30[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80182C30[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC07_000/ov_SC07_000_jr_80154C24.c b/src/ov_SC07_000/ov_SC07_000_jr_80154C24.c index 36a5589985..20d932bc53 100644 --- a/src/ov_SC07_000/ov_SC07_000_jr_80154C24.c +++ b/src/ov_SC07_000/ov_SC07_000_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_000/nonmatchings/ov_SC07_000_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801849B8)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801849B8[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801849B8[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC07_000/ov_SC07_000_jr_8017BEBC.c b/src/ov_SC07_000/ov_SC07_000_jr_8017BEBC.c index 164468c2dc..98bbbc7a4e 100644 --- a/src/ov_SC07_000/ov_SC07_000_jr_8017BEBC.c +++ b/src/ov_SC07_000/ov_SC07_000_jr_8017BEBC.c @@ -3573,7 +3573,17 @@ INCLUDE_ASM("asm/ov_SC07_000/nonmatchings/ov_SC07_000_jr_8017BEBC", func_801802E INCLUDE_ASM("asm/ov_SC07_000/nonmatchings/ov_SC07_000_jr_8017BEBC", func_801803F0); -INCLUDE_ASM("asm/ov_SC07_000/nonmatchings/ov_SC07_000_jr_8017BEBC", func_80180440); + +extern s32 func_8012C658(s32 arg0, s32 arg1, s32 arg2); + +void func_80180440(s32 arg0) { + s32 i; + + for (i = 0; i < 30; i++) { + func_8012C658(0x3a5, i, arg0); + } +} + INCLUDE_ASM("asm/ov_SC07_000/nonmatchings/ov_SC07_000_jr_8017BEBC", func_80180490); diff --git a/src/ov_SC07_001/ov_SC07_001_jr_80135D20.c b/src/ov_SC07_001/ov_SC07_001_jr_80135D20.c index 52fa90194c..660a1bdd64 100644 --- a/src/ov_SC07_001/ov_SC07_001_jr_80135D20.c +++ b/src/ov_SC07_001/ov_SC07_001_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_001/nonmatchings/ov_SC07_001_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80181AE0[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80181AE0[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80181AE0[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80181AE0[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80181AE0[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC07_001/ov_SC07_001_jr_80154C24.c b/src/ov_SC07_001/ov_SC07_001_jr_80154C24.c index 179cc8dd66..5c441bda26 100644 --- a/src/ov_SC07_001/ov_SC07_001_jr_80154C24.c +++ b/src/ov_SC07_001/ov_SC07_001_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_001/nonmatchings/ov_SC07_001_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80183868)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80183868[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80183868[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC07_002/ov_SC07_002_jr_80135D20.c b/src/ov_SC07_002/ov_SC07_002_jr_80135D20.c index 3a1b9d42ad..2696748754 100644 --- a/src/ov_SC07_002/ov_SC07_002_jr_80135D20.c +++ b/src/ov_SC07_002/ov_SC07_002_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_002/nonmatchings/ov_SC07_002_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80186D9C[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80186D9C[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80186D9C[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80186D9C[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80186D9C[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC07_002/ov_SC07_002_jr_80154C24.c b/src/ov_SC07_002/ov_SC07_002_jr_80154C24.c index 170e369141..2e8056317c 100644 --- a/src/ov_SC07_002/ov_SC07_002_jr_80154C24.c +++ b/src/ov_SC07_002/ov_SC07_002_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_002/nonmatchings/ov_SC07_002_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_80188B24)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_80188B24[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_80188B24[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC07_002/ov_SC07_002_jr_8017C8D0.c b/src/ov_SC07_002/ov_SC07_002_jr_8017C8D0.c index 27f77e7ddc..53a453f931 100644 --- a/src/ov_SC07_002/ov_SC07_002_jr_8017C8D0.c +++ b/src/ov_SC07_002/ov_SC07_002_jr_8017C8D0.c @@ -52,7 +52,6 @@ extern s32 func_80165A50(s32); extern void func_80029514(s32); extern u8 D_800AF630[]; extern u8 D_80078EC0; -extern s32 D_80126B58; extern s32 func_80028FBC(void); extern s32 func_80029000(void); extern s32 func_80028D9C(void); @@ -4009,7 +4008,20 @@ INCLUDE_ASM("asm/ov_SC07_002/nonmatchings/ov_SC07_002_jr_8017C8D0", func_801866D INCLUDE_ASM("asm/ov_SC07_002/nonmatchings/ov_SC07_002_jr_8017C8D0", func_8018672C); -INCLUDE_ASM("asm/ov_SC07_002/nonmatchings/ov_SC07_002_jr_8017C8D0", func_80186758); + +extern s32 func_8014C050(s32 a0, s32 a1); + +void func_80186758(void) { + + extern s32 D_80126B58; + s32 t; + + t = func_8014C050((s32)&D_80126B58, 0x28); + if (t != 0) { + *(u16 *)(t + 2) += 1; + } +} + diff --git a/src/ov_SC07_006/ov_SC07_006.c b/src/ov_SC07_006/ov_SC07_006.c index 725c801d7e..f0089380bf 100644 --- a/src/ov_SC07_006/ov_SC07_006.c +++ b/src/ov_SC07_006/ov_SC07_006.c @@ -2170,7 +2170,36 @@ s32 *func_8012F40C(s32 *param_1, s32 param_2) { } -INCLUDE_ASM("asm/ov_SC07_006/nonmatchings/ov_SC07_006", func_8012F49C); +extern void func_8004914C(); +extern void func_800491AC(); +extern void RotTransSV(s32 a0, s32 a1, void *a2); +extern s32 RotTransPers(s32, s32*, s32*, s32*); +s32 *func_8012F49C(s32 *param_1, s32 param_2, s32 param_3) { + s16 sv[4]; + s32 out[2]; + s32 sxy, p, flag; + s32 m; + void *pv; + m = *(s32 *)(param_2 + 0x20) + 0x34; + ((void (*)(s32))func_8004914C)(m); + ((void (*)(s32))func_800491AC)(m); + pv = (void *)sv; + ((void (*)(s32, void *, s32 *))RotTransSV)(param_3, pv, &out[0]); + sxy = 0; + /* $a0-pinned scopes force the &D_800AF648 constant to be rematerialized + (lui/addiu) before each call instead of CSE-hoisting it. */ + { register void *r4 __asm__("$4"); r4 = &D_800AF648; func_8004914C(r4); } + { register void *r4 __asm__("$4"); r4 = &D_800AF648; func_800491AC(r4); } + ((s32 (*)(void *, s32 *, s32 *, s32 *))RotTransPers)(pv, &sxy, &p, &flag); + if (flag < 0) { + out[0] = sxy = 0; + } else { + out[0] = sxy; + } + *param_1 = out[0]; + return param_1; +} + DEFINE_func_8012F568() /* dedup: shared engine-core @0x8012f568 (src/shared) */ diff --git a/src/ov_SC07_006/ov_SC07_006_jr_80131340.c b/src/ov_SC07_006/ov_SC07_006_jr_80131340.c index c95c7a2f91..f79c7aba94 100644 --- a/src/ov_SC07_006/ov_SC07_006_jr_80131340.c +++ b/src/ov_SC07_006/ov_SC07_006_jr_80131340.c @@ -1089,7 +1089,37 @@ void func_80131FDC(void *a0) { } -INCLUDE_ASM("asm/ov_SC07_006/nonmatchings/ov_SC07_006_jr_80131340", func_80132018); + +extern void func_8012C1B8(void); +extern void func_8012CAE4(void *a0); +extern void func_8001C214(int, int); + +/* §37 asm-label aliases: D_8018A934 is declared in this TU as `void (*[])(void)` + * (func_80131EEC's dispatch table) — a conflicting type. The 20-byte-stride view + * below is this function's own. D_8018A938 == D_8018A934 + 4 is a SEPARATE + * per-overlay symbol and is referenced BY NAME, never as base+literal (§84). */ + +void func_80132018(int param_1) +{ + + extern int tbl_D_80187044[][5] __asm__("D_8018A934"); + extern int tbl_D_80187048[][5] __asm__("D_8018A938"); + int v0; + + v0 = ((int (*)(void))func_8012C1B8)(); + *(int *)(param_1 + 0x20) = v0; + if (v0 == 0) { + ((void (*)(int))func_8012CAE4)(param_1); + } else { + func_8001C214(v0, 0); + *(short *)(param_1 + 0x5c) = 0x80; + *(unsigned short *)(param_1 + 2) += 1; + *(int *)(param_1 + 0x58) = (int)&tbl_D_80187048[*(unsigned short *)(param_1 + 0x70) & 0xfff]; + *(int *)(param_1 + 0xdc) = tbl_D_80187044[*(unsigned short *)(param_1 + 0x70) & 0xfff][0]; + *(short *)(param_1 + 0xfc) = (*(unsigned short *)(param_1 + 0x70) >> 12) << 9; + } +} + void func_801320D0(void) { } diff --git a/src/ov_SC07_006/ov_SC07_006_jr_80135D20.c b/src/ov_SC07_006/ov_SC07_006_jr_80135D20.c index 1ba92bf171..a37b969918 100644 --- a/src/ov_SC07_006/ov_SC07_006_jr_80135D20.c +++ b/src/ov_SC07_006/ov_SC07_006_jr_80135D20.c @@ -1414,7 +1414,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377b4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_006/nonmatchings/ov_SC07_006_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8018A9C0[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8018A9C0[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8018A9C0[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8018A9C0[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8018A9C0[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379d8 (src/shared) */ diff --git a/src/ov_SC07_006/ov_SC07_006_jr_80154C24.c b/src/ov_SC07_006/ov_SC07_006_jr_80154C24.c index b06992f7e2..19ed3316c7 100644 --- a/src/ov_SC07_006/ov_SC07_006_jr_80154C24.c +++ b/src/ov_SC07_006/ov_SC07_006_jr_80154C24.c @@ -2652,7 +2652,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157bc8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157ccc (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_006/nonmatchings/ov_SC07_006_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018C748)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018C748[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018C748[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157d74 (src/shared) */ diff --git a/src/ov_SC07_007/ov_SC07_007_jr_80131340.c b/src/ov_SC07_007/ov_SC07_007_jr_80131340.c index 4e154e28fb..1044215096 100644 --- a/src/ov_SC07_007/ov_SC07_007_jr_80131340.c +++ b/src/ov_SC07_007/ov_SC07_007_jr_80131340.c @@ -1089,7 +1089,37 @@ void func_80131FDC(void *a0) { } -INCLUDE_ASM("asm/ov_SC07_007/nonmatchings/ov_SC07_007_jr_80131340", func_80132018); + +extern void func_8012C1B8(void); +extern void func_8012CAE4(void *a0); +extern void func_8001C214(int, int); + +/* §37 asm-label aliases: D_80183458 is declared in this TU as `void (*[])(void)` + * (func_80131EEC's dispatch table) — a conflicting type. The 20-byte-stride view + * below is this function's own. D_8018345C == D_80183458 + 4 is a SEPARATE + * per-overlay symbol and is referenced BY NAME, never as base+literal (§84). */ + +void func_80132018(int param_1) +{ + + extern int tbl_D_80187044[][5] __asm__("D_80183458"); + extern int tbl_D_80187048[][5] __asm__("D_8018345C"); + int v0; + + v0 = ((int (*)(void))func_8012C1B8)(); + *(int *)(param_1 + 0x20) = v0; + if (v0 == 0) { + ((void (*)(int))func_8012CAE4)(param_1); + } else { + func_8001C214(v0, 0); + *(short *)(param_1 + 0x5c) = 0x80; + *(unsigned short *)(param_1 + 2) += 1; + *(int *)(param_1 + 0x58) = (int)&tbl_D_80187048[*(unsigned short *)(param_1 + 0x70) & 0xfff]; + *(int *)(param_1 + 0xdc) = tbl_D_80187044[*(unsigned short *)(param_1 + 0x70) & 0xfff][0]; + *(short *)(param_1 + 0xfc) = (*(unsigned short *)(param_1 + 0x70) >> 12) << 9; + } +} + void func_801320D0(void) { } diff --git a/src/ov_SC07_007/ov_SC07_007_jr_80135D20.c b/src/ov_SC07_007/ov_SC07_007_jr_80135D20.c index bab851df7f..3e37fbd491 100644 --- a/src/ov_SC07_007/ov_SC07_007_jr_80135D20.c +++ b/src/ov_SC07_007/ov_SC07_007_jr_80135D20.c @@ -1364,7 +1364,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377b4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_007/nonmatchings/ov_SC07_007_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_801834E4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_801834E4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_801834E4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_801834E4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_801834E4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379d8 (src/shared) */ diff --git a/src/ov_SC07_007/ov_SC07_007_jr_80154C24.c b/src/ov_SC07_007/ov_SC07_007_jr_80154C24.c index 91e964497e..2142b14ead 100644 --- a/src/ov_SC07_007/ov_SC07_007_jr_80154C24.c +++ b/src/ov_SC07_007/ov_SC07_007_jr_80154C24.c @@ -2624,7 +2624,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157bc8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157ccc (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_007/nonmatchings/ov_SC07_007_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8018526C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8018526C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8018526C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157d74 (src/shared) */ diff --git a/src/ov_SC07_007/ov_SC07_007_jr_8017BEBC.c b/src/ov_SC07_007/ov_SC07_007_jr_8017BEBC.c index 1acb44719b..b3e889a9df 100644 --- a/src/ov_SC07_007/ov_SC07_007_jr_8017BEBC.c +++ b/src/ov_SC07_007/ov_SC07_007_jr_8017BEBC.c @@ -4455,21 +4455,101 @@ void func_80182C3C(u8 *a0) { INCLUDE_ASM("asm/ov_SC07_007/nonmatchings/ov_SC07_007_jr_8017BEBC", func_80182C78); -INCLUDE_ASM("asm/ov_SC07_007/nonmatchings/ov_SC07_007_jr_8017BEBC", func_80182CBC); +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern void func_80171928(void*); +void func_80182CBC(s32 a0) { -INCLUDE_ASM("asm/ov_SC07_007/nonmatchings/ov_SC07_007_jr_8017BEBC", func_80182CFC); + extern u8 D_801A3198; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_801A3198); + ((s32 (*)(u8 *))func_80171928)((u8 *)a0); +} -INCLUDE_ASM("asm/ov_SC07_007/nonmatchings/ov_SC07_007_jr_8017BEBC", func_80182D3C); -INCLUDE_ASM("asm/ov_SC07_007/nonmatchings/ov_SC07_007_jr_8017BEBC", func_80182D7C); +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern void func_80171928(void*); +void func_80182CFC(s32 a0) { -INCLUDE_ASM("asm/ov_SC07_007/nonmatchings/ov_SC07_007_jr_8017BEBC", func_80182DBC); + extern u8 D_801A31B8; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_801A31B8); + ((s32 (*)(u8 *))func_80171928)((u8 *)a0); +} -INCLUDE_ASM("asm/ov_SC07_007/nonmatchings/ov_SC07_007_jr_8017BEBC", func_80182DFC); -INCLUDE_ASM("asm/ov_SC07_007/nonmatchings/ov_SC07_007_jr_8017BEBC", func_80182E3C); +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern void func_80171928(void*); +void func_80182D3C(s32 a0) { + + extern u8 D_801A3228; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_801A3228); + ((s32 (*)(u8 *))func_80171928)((u8 *)a0); +} + + +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern void func_80171928(void*); +void func_80182D7C(s32 a0) { + + extern u8 D_801A325C; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_801A325C); + ((s32 (*)(u8 *))func_80171928)((u8 *)a0); +} + + +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern void func_80171928(void*); +void func_80182DBC(s32 a0) { + + extern u8 D_801A3300; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_801A3300); + ((s32 (*)(u8 *))func_80171928)((u8 *)a0); +} + + +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern void func_80171928(void*); +void func_80182DFC(s32 a0) { + + extern u8 D_801A333C; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_801A333C); + ((s32 (*)(u8 *))func_80171928)((u8 *)a0); +} + + +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern void func_80171928(void*); +void func_80182E3C(s32 a0) { + + extern u8 D_801A3394; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_801A3394); + ((s32 (*)(u8 *))func_80171928)((u8 *)a0); +} + + +extern void func_8014706C(void *a0); +extern void func_80154274(s32 *a0, s32 a1); +extern void func_80171928(void*); +void func_80182E7C(s32 a0) { + + extern u8 D_801A3424; + func_8014706C((void *)a0); + func_80154274((s32 *)a0, (s32)&D_801A3424); + ((s32 (*)(u8 *))func_80171928)((u8 *)a0); +} -INCLUDE_ASM("asm/ov_SC07_007/nonmatchings/ov_SC07_007_jr_8017BEBC", func_80182E7C); extern s32 func_8016EFA8(s32); void func_80182EBC(void) { diff --git a/src/ov_SC07_008/ov_SC07_008_jr_80135D20.c b/src/ov_SC07_008/ov_SC07_008_jr_80135D20.c index 9157bc8d91..e986635165 100644 --- a/src/ov_SC07_008/ov_SC07_008_jr_80135D20.c +++ b/src/ov_SC07_008/ov_SC07_008_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_008/nonmatchings/ov_SC07_008_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017D8B4[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017D8B4[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017D8B4[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017D8B4[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017D8B4[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC07_008/ov_SC07_008_jr_80154C24.c b/src/ov_SC07_008/ov_SC07_008_jr_80154C24.c index 7d54d00959..ad4bdd7832 100644 --- a/src/ov_SC07_008/ov_SC07_008_jr_80154C24.c +++ b/src/ov_SC07_008/ov_SC07_008_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_008/nonmatchings/ov_SC07_008_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_8017F63C)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_8017F63C[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_8017F63C[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC07_009/ov_SC07_009_jr_80135D20.c b/src/ov_SC07_009/ov_SC07_009_jr_80135D20.c index 6203022f00..3d29d187c5 100644 --- a/src/ov_SC07_009/ov_SC07_009_jr_80135D20.c +++ b/src/ov_SC07_009/ov_SC07_009_jr_80135D20.c @@ -1424,7 +1424,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377B4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_009/nonmatchings/ov_SC07_009_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017E358[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017E358[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017E358[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017E358[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017E358[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379D8 (src/shared) */ diff --git a/src/ov_SC07_009/ov_SC07_009_jr_80154C24.c b/src/ov_SC07_009/ov_SC07_009_jr_80154C24.c index 94193d05d0..be99c23251 100644 --- a/src/ov_SC07_009/ov_SC07_009_jr_80154C24.c +++ b/src/ov_SC07_009/ov_SC07_009_jr_80154C24.c @@ -1674,7 +1674,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157BC8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157CCC (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_009/nonmatchings/ov_SC07_009_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801800E0)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801800E0[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801800E0[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157D74 (src/shared) */ diff --git a/src/ov_SC07_010/ov_SC07_010_jr_80131340.c b/src/ov_SC07_010/ov_SC07_010_jr_80131340.c index 1a8c3d4d95..469d2fe662 100644 --- a/src/ov_SC07_010/ov_SC07_010_jr_80131340.c +++ b/src/ov_SC07_010/ov_SC07_010_jr_80131340.c @@ -1094,7 +1094,37 @@ void func_80131FDC(void *a0) { } -INCLUDE_ASM("asm/ov_SC07_010/nonmatchings/ov_SC07_010_jr_80131340", func_80132018); + +extern void func_8012C1B8(void); +extern void func_8012CAE4(void *a0); +extern void func_8001C214(int, int); + +/* §37 asm-label aliases: D_801824E8 is declared in this TU as `void (*[])(void)` + * (func_80131EEC's dispatch table) — a conflicting type. The 20-byte-stride view + * below is this function's own. D_801824EC == D_801824E8 + 4 is a SEPARATE + * per-overlay symbol and is referenced BY NAME, never as base+literal (§84). */ + +void func_80132018(int param_1) +{ + + extern int tbl_D_80187044[][5] __asm__("D_801824E8"); + extern int tbl_D_80187048[][5] __asm__("D_801824EC"); + int v0; + + v0 = ((int (*)(void))func_8012C1B8)(); + *(int *)(param_1 + 0x20) = v0; + if (v0 == 0) { + ((void (*)(int))func_8012CAE4)(param_1); + } else { + func_8001C214(v0, 0); + *(short *)(param_1 + 0x5c) = 0x80; + *(unsigned short *)(param_1 + 2) += 1; + *(int *)(param_1 + 0x58) = (int)&tbl_D_80187048[*(unsigned short *)(param_1 + 0x70) & 0xfff]; + *(int *)(param_1 + 0xdc) = tbl_D_80187044[*(unsigned short *)(param_1 + 0x70) & 0xfff][0]; + *(short *)(param_1 + 0xfc) = (*(unsigned short *)(param_1 + 0x70) >> 12) << 9; + } +} + void func_801320D0(void) { } diff --git a/src/ov_SC07_010/ov_SC07_010_jr_80135D20.c b/src/ov_SC07_010/ov_SC07_010_jr_80135D20.c index 6704dddf51..d03acb6896 100644 --- a/src/ov_SC07_010/ov_SC07_010_jr_80135D20.c +++ b/src/ov_SC07_010/ov_SC07_010_jr_80135D20.c @@ -1369,7 +1369,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377b4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_010/nonmatchings/ov_SC07_010_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_80182574[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_80182574[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_80182574[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_80182574[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_80182574[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379d8 (src/shared) */ diff --git a/src/ov_SC07_010/ov_SC07_010_jr_80154C24.c b/src/ov_SC07_010/ov_SC07_010_jr_80154C24.c index f781588a3a..2ac0e8f956 100644 --- a/src/ov_SC07_010/ov_SC07_010_jr_80154C24.c +++ b/src/ov_SC07_010/ov_SC07_010_jr_80154C24.c @@ -2045,7 +2045,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157bc8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157ccc (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_010/nonmatchings/ov_SC07_010_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801842FC)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801842FC[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801842FC[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157d74 (src/shared) */ diff --git a/src/ov_SC07_011/ov_SC07_011_jr_80131340.c b/src/ov_SC07_011/ov_SC07_011_jr_80131340.c index 25b5ce7d30..a5322dda02 100644 --- a/src/ov_SC07_011/ov_SC07_011_jr_80131340.c +++ b/src/ov_SC07_011/ov_SC07_011_jr_80131340.c @@ -1089,7 +1089,37 @@ void func_80131FDC(void *a0) { } -INCLUDE_ASM("asm/ov_SC07_011/nonmatchings/ov_SC07_011_jr_80131340", func_80132018); + +extern void func_8012C1B8(void); +extern void func_8012CAE4(void *a0); +extern void func_8001C214(int, int); + +/* §37 asm-label aliases: D_8017EBA8 is declared in this TU as `void (*[])(void)` + * (func_80131EEC's dispatch table) — a conflicting type. The 20-byte-stride view + * below is this function's own. D_8017EBAC == D_8017EBA8 + 4 is a SEPARATE + * per-overlay symbol and is referenced BY NAME, never as base+literal (§84). */ + +void func_80132018(int param_1) +{ + + extern int tbl_D_80187044[][5] __asm__("D_8017EBA8"); + extern int tbl_D_80187048[][5] __asm__("D_8017EBAC"); + int v0; + + v0 = ((int (*)(void))func_8012C1B8)(); + *(int *)(param_1 + 0x20) = v0; + if (v0 == 0) { + ((void (*)(int))func_8012CAE4)(param_1); + } else { + func_8001C214(v0, 0); + *(short *)(param_1 + 0x5c) = 0x80; + *(unsigned short *)(param_1 + 2) += 1; + *(int *)(param_1 + 0x58) = (int)&tbl_D_80187048[*(unsigned short *)(param_1 + 0x70) & 0xfff]; + *(int *)(param_1 + 0xdc) = tbl_D_80187044[*(unsigned short *)(param_1 + 0x70) & 0xfff][0]; + *(short *)(param_1 + 0xfc) = (*(unsigned short *)(param_1 + 0x70) >> 12) << 9; + } +} + void func_801320D0(void) { } diff --git a/src/ov_SC07_011/ov_SC07_011_jr_80135D20.c b/src/ov_SC07_011/ov_SC07_011_jr_80135D20.c index d1bc45aeb1..fabd29ec7d 100644 --- a/src/ov_SC07_011/ov_SC07_011_jr_80135D20.c +++ b/src/ov_SC07_011/ov_SC07_011_jr_80135D20.c @@ -1364,7 +1364,40 @@ DEFINE_func_801377B4() /* dedup: shared engine-core @0x801377b4 (src/shared) */ DEFINE_func_80137840() /* dedup: shared engine-core @0x80137840 (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_011/nonmatchings/ov_SC07_011_jr_80135D20", func_801378F0); + +extern void func_80016714(void *a0, s32 a1); +extern void func_8013A860(void); + +void func_801378F0(void) { + + extern u8 D_80127520[]; + extern u8 aD801269F0[] __asm__("D_801269F0"); /* §37 alias: TU canon is `extern int D_801269F0` */ + extern u8 D_80126A28[]; + extern u8 D_8017EC34[]; + s32 i; + s32 si; + s32 di; + u8 *p; + + func_80016714(D_80127520, 0xBFC); + i = 0; + si = 0; + p = aD801269F0; + di = 0; + do { + func_80016714(p, 0x4C); + *(u16 *)&D_80126A28[di] = *(u16 *)&D_8017EC34[si]; + *(u16 *)&D_80126A28[di + 2] = *(u16 *)&D_8017EC34[si + 2]; + *(u16 *)&D_80126A28[di + 4] = *(u16 *)&D_8017EC34[si + 4]; + *(u16 *)&D_80126A28[di + 6] = *(u16 *)&D_8017EC34[si + 6]; + p += 0x4C; + i += 1; + si += 8; + di += 0x4C; + } while (i < 3); + func_8013A860(); +} + DEFINE_func_801379D8() /* dedup: shared engine-core @0x801379d8 (src/shared) */ diff --git a/src/ov_SC07_011/ov_SC07_011_jr_80154C24.c b/src/ov_SC07_011/ov_SC07_011_jr_80154C24.c index 4a4ee3feb1..dd9e5809d6 100644 --- a/src/ov_SC07_011/ov_SC07_011_jr_80154C24.c +++ b/src/ov_SC07_011/ov_SC07_011_jr_80154C24.c @@ -2625,7 +2625,50 @@ DEFINE_func_80157BC8() /* dedup: shared engine-core @0x80157bc8 (src/shared) */ DEFINE_func_80157CCC() /* dedup: shared engine-core @0x80157ccc (src/shared) */ -INCLUDE_ASM("asm/ov_SC07_011/nonmatchings/ov_SC07_011_jr_80154C24", func_80157D20); + +/* func_80157D20 — 21-ins plumbing shim (×138 overlays). + * + * §71 sibling-first: the immediate neighbour func_801578C0 in this very TU + * (src/ov_SC01_077/ov_SC01_077_jr_80154C24.c L1592) already matches with + * `((void (*)(void))func_80156648)();` — the zero-argument call form. The + * target likewise sets up NO argument registers before `jal func_80156648` + * ($a0/$a1 still carry this function's own incoming args), so the call is + * argument-less here too. + * + * The `lhu %lo(D_801809BC)($at)` with `sll $s0,$s0,1` => a plain u16 array + * indexed by the second parameter, NOT hoisted into a pointer (§20: a pointer + * var would keep one address register live across the call; the target rebuilds + * the %hi/%lo pair inline after the call returns). + * + * §73 PARAMS axis / §42 lever 6 — the fleet canon for this symbol is + * `extern void func_80157D20(void);` (this TU's carried decl layer, L399, and + * every sibling overlay's). A 2-param definition hard-errors with + * `conflicting types` in the real TU (rtu_match, byte-verified), and the canon + * cannot be widened from a draft (that is an R22 fleet edit). So keep the + * `(void)` signature and capture $a0/$a1 with register pins copied into NORMAL + * pseudos — the copies are live across `jal func_80156648`, so they get the + * callee-saved homes the target uses ($s1 = a0, $s0 = a1). A direct + * `register` use would leave the values in call-clobbered $a0/$a1. + */ + +extern void func_80156648(s32 *a0); +extern void func_80147078(s32 *a0, s16 a1); +extern void func_80157D74(u16 *a0); + +void func_80157D20(void) +{ + + extern u16 D_801809BC[]; + register void *a0v __asm__("$4"); + register s32 a1v __asm__("$5"); + void *param_1 = a0v; + s32 param_2 = a1v; + + ((void (*)(void))func_80156648)(); + ((void (*)(void *, s32))func_80147078)(param_1, D_801809BC[param_2]); + ((void (*)(void *))func_80157D74)(param_1); +} + DEFINE_func_80157D74() /* dedup: shared engine-core @0x80157d74 (src/shared) */ diff --git a/src/ov_SC07_011/ov_SC07_011_jr_8017BEBC.c b/src/ov_SC07_011/ov_SC07_011_jr_8017BEBC.c index 01fb55720f..f24135d77f 100644 --- a/src/ov_SC07_011/ov_SC07_011_jr_8017BEBC.c +++ b/src/ov_SC07_011/ov_SC07_011_jr_8017BEBC.c @@ -227,7 +227,6 @@ extern void func_8012AD80(s32 a0); extern void func_8012ADE4(u8 *a0); extern s32 *D_80126B78; extern s32 *D_80126B90; -extern s32 D_80126B58; extern s32 func_80135888(s32 a0, s32 a1, s32 a2, s32 a3); extern s32 func_80013478(s32 a0, s32 a1); extern s32 func_8012AE00(s32 a0); @@ -4155,9 +4154,42 @@ void func_8017E54C(void) { } -INCLUDE_ASM("asm/ov_SC07_011/nonmatchings/ov_SC07_011_jr_8017BEBC", func_8017E56C); + +extern void func_80017254(void *a0); +extern void func_800176F0(void *a0); + +void func_8017E56C(void) { + + extern u8 D_8018BB50[]; + extern u8 D_8018BB78[]; + u8 *p; + s32 i; + + func_80017254(D_8018BB50); + i = 0; + p = D_8018BB78; + do { + func_800176F0(p); + i++; + p += 0x34; + } while (i < 4); +} + INCLUDE_ASM("asm/ov_SC07_011/nonmatchings/ov_SC07_011_jr_8017BEBC", func_8017E5C4); -INCLUDE_ASM("asm/ov_SC07_011/nonmatchings/ov_SC07_011_jr_8017BEBC", func_8017E5F0); + +extern s32 func_8014C050(s32 a0, s32 a1); + +void func_8017E5F0(void) { + + extern s32 D_80126B58; + s32 t; + + t = func_8014C050((s32)&D_80126B58, 0x28); + if (t != 0) { + *(u16 *)(t + 2) += 1; + } +} +