From da3235087350fa3f9566bbd00dc9e902be43ed41 Mon Sep 17 00:00:00 2001 From: Drew T <50529377+Druthulu@users.noreply.github.com> Date: Mon, 31 Aug 2026 22:18:35 -0600 Subject: [PATCH] =?UTF-8?q?feat(decomp):=20main=20in-tree=20gate=20?= =?UTF-8?q?=E2=80=94=201=20fn(s)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit main func_80013B64 --- src/800.c | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) diff --git a/src/800.c b/src/800.c index 8477d9092..6a9da0e15 100644 --- a/src/800.c +++ b/src/800.c @@ -1385,7 +1385,110 @@ void func_800139C8(s16 param_1, void *param_2, void *param_3) ApplyMatrixSV(ip, param_2, param_3); } -INCLUDE_ASM("asm/nonmatchings/800", func_80013B64); +extern void func_80013F3C(); +extern s32 func_8004787C(s32 angle); +extern s32 func_80047948(s32 angle); +extern void func_8001282C(); +extern void func_800484EC(); + +void func_80013B64(s32 param_1, s32 param_2, s32 param_3) +{ + s16 ident[16]; + s16 rot[16]; + s32 sin_val; + s32 cos_val; + register s32 v1 __asm__("$3"); + register s16 *v0p __asm__("$2"); + s16 *m0p; + + func_80013F3C(ident); + sin_val = func_8004787C((s16)param_1); + cos_val = func_80047948((s16)param_1); + + v1 = -sin_val; + __asm__ __volatile__(""); + rot[0] = (s16)cos_val; + rot[4] = (s16)cos_val; + rot[8] = 0x1000; + __asm__ __volatile__(""); + v0p = rot; + rot[3] = (s16)sin_val; + m0p = ident; + rot[1] = (s16)v1; + rot[2] = 0; + rot[5] = 0; + rot[6] = 0; + rot[7] = 0; + + __asm__ __volatile__ ( + "lw $12, 0(%1);" + "lw $13, 4(%1);" + "ctc2 $12, $0;" + "ctc2 $13, $1;" + "lw $12, 8(%1);" + "lw $13, 12(%1);" + "lw $14, 16(%1);" + "ctc2 $12, $2;" + "ctc2 $13, $3;" + "ctc2 $14, $4;" + "lhu $12, 0(%0);" + "lhu $13, 6(%0);" + "lhu $14, 12(%0);" + "mtc2 $12, $9;" + "mtc2 $13, $10;" + "mtc2 $14, $11;" + "nop;" + "nop;" + "mvmva 1, 0, 3, 3, 0;" + "mfc2 $12, $9;" + "mfc2 $13, $10;" + "mfc2 $14, $11;" + "sh $12, 0(%1);" + "sh $13, 6(%1);" + "sh $14, 12(%1);" + "addiu $2, $sp, 50;" + "lhu $12, 0($2);" + "lhu $13, 6($2);" + "lhu $14, 12($2);" + "mtc2 $12, $9;" + "mtc2 $13, $10;" + "mtc2 $14, $11;" + "nop;" + "nop;" + "mvmva 1, 0, 3, 3, 0;" + "addiu $2, $sp, 18;" + "mfc2 $12, $9;" + "mfc2 $13, $10;" + "mfc2 $14, $11;" + "sh $12, 0($2);" + "sh $13, 6($2);" + "sh $14, 12($2);" + "addiu $2, $sp, 52;" + "lhu $12, 0($2);" + "lhu $13, 6($2);" + "lhu $14, 12($2);" + "mtc2 $12, $9;" + "mtc2 $13, $10;" + "mtc2 $14, $11;" + "nop;" + "nop;" + "mvmva 1, 0, 3, 3, 0;" + "addiu $2, $sp, 20;" + "mfc2 $12, $9;" + "mfc2 $13, $10;" + "mfc2 $14, $11;" + "sh $12, 0($2);" + "sh $13, 6($2);" + "sh $14, 12($2)" + : + : "r"(v0p), "r"(m0p) + : "$12", "$13", "$14", "$2" + ); + + func_8001282C(m0p); + func_800484EC(m0p, param_2, param_3); +} + #define gte_SetRotMatrixX(r0) __asm__ __volatile__ ( \ "lw $12, 0(%0);" \