From 86918184da840c64f80caa91c473704d3e04b550 Mon Sep 17 00:00:00 2001 From: Drew T <50529377+Druthulu@users.noreply.github.com> Date: Mon, 31 Aug 2026 18:47:29 -0600 Subject: [PATCH] =?UTF-8?q?feat(decomp):=20main=20in-tree=20gate=20?= =?UTF-8?q?=E2=80=94=200=20fn(s)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/800.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/src/800.c b/src/800.c index 5bd0f039c..1e73d1a50 100644 --- a/src/800.c +++ b/src/800.c @@ -22802,7 +22802,60 @@ void func_8003A0D0(s32 *arg0) { (*arg0)++; } -INCLUDE_ASM("asm/nonmatchings/800", func_8003A0E4); + + + + + + + +extern u16 D_8006AB30[]; +extern u16 D_8006ABD8[]; +extern u8 D_800C6DD0[]; + +void func_8003A0E4(void *arg0, s16 arg1) { + u8 *src; + u8 *t2; + u8 *t1; + u8 *a2; + u8 *a1; + s32 i; + s32 pan; + u32 vol; + u32 tmp; + u32 prod; + + t2 = (u8 *)arg0 + (arg1 * 26 + 26); + t1 = t2 + 9; + src = *(u8 **)arg0; + *(u32 *)arg0 = (u32)src + 1; + *(s16 *)(t2 + 2) = src[0] & 0x7F; + for (i = 0; i < 16; i++) { + if (*t1++ != 0) { + a2 = D_800C6DD0 + i * 0x60; + vol = *(s16 *)(a2 + 4) << 8; + pan = *(s16 *)(t2 + 2); + if (pan >= 65) { + vol += (u32)((pan - 64) * a2[0x59] * 4); + } else if (pan < 64) { + vol -= (u32)((64 - pan) * a2[0x58] * 4); + } + tmp = *(s32 *)(a2 + 0x54) - 0x3C00; + vol -= tmp; + a1 = a2 + 0x10; + if (vol >= 0x5301) { + *(s16 *)(a2 + 0x24) = 0x3FFF; + } else { + prod = D_8006AB30[vol >> 8]; + prod *= D_8006ABD8[(vol & 0xFE) / 2]; + *(s16 *)(a2 + 0x24) = prod >> 15; + } + *(u32 *)(a1 + 4) |= 0x10; + a2[0x5D] = 1; + } + } +} + typedef struct {