From bdcb741db3bd2f097c7254afb59179d05314720a Mon Sep 17 00:00:00 2001 From: David Benepe Date: Sat, 10 Jul 2021 15:02:21 -0500 Subject: [PATCH] Decompiled alHeapInit --- asm/non_matchings/unknown_0C8160/alHeapInit.s | 21 ------------------- lib/src/alHeapInit.c | 18 ++++++++++++++++ src/unknown_0C8160.c | 7 ------- 3 files changed, 18 insertions(+), 28 deletions(-) delete mode 100644 asm/non_matchings/unknown_0C8160/alHeapInit.s create mode 100644 lib/src/alHeapInit.c delete mode 100644 src/unknown_0C8160.c diff --git a/asm/non_matchings/unknown_0C8160/alHeapInit.s b/asm/non_matchings/unknown_0C8160/alHeapInit.s deleted file mode 100644 index e015a1df..00000000 --- a/asm/non_matchings/unknown_0C8160/alHeapInit.s +++ /dev/null @@ -1,21 +0,0 @@ -glabel alHeapInit -/* 0C8160 800C7560 24030010 */ li $v1, 16 -/* 0C8164 800C7564 30AE000F */ andi $t6, $a1, 0xf -/* 0C8168 800C7568 006E1023 */ subu $v0, $v1, $t6 -/* 0C816C 800C756C 10620003 */ beq $v1, $v0, .L800C757C -/* 0C8170 800C7570 00A27821 */ addu $t7, $a1, $v0 -/* 0C8174 800C7574 10000002 */ b .L800C7580 -/* 0C8178 800C7578 AC8F0000 */ sw $t7, ($a0) -.L800C757C: -/* 0C817C 800C757C AC850000 */ sw $a1, ($a0) -.L800C7580: -/* 0C8180 800C7580 8C980000 */ lw $t8, ($a0) -/* 0C8184 800C7584 AC860008 */ sw $a2, 8($a0) -/* 0C8188 800C7588 AC80000C */ sw $zero, 0xc($a0) -/* 0C818C 800C758C 03E00008 */ jr $ra -/* 0C8190 800C7590 AC980004 */ sw $t8, 4($a0) - -/* 0C8194 800C7594 00000000 */ nop -/* 0C8198 800C7598 00000000 */ nop -/* 0C819C 800C759C 00000000 */ nop - diff --git a/lib/src/alHeapInit.c b/lib/src/alHeapInit.c new file mode 100644 index 00000000..ac5bd679 --- /dev/null +++ b/lib/src/alHeapInit.c @@ -0,0 +1,18 @@ +/* The comment below is needed for this file to be picked up by generate_ld */ +/* RAM_POS: 0x800C7560 */ + +#include "audio_internal.h" + +void alHeapInit(ALHeap *hp, u8 *base, s32 len) +{ + s32 extraAlign = (AL_CACHE_ALIGN+1) - ((s32) base & AL_CACHE_ALIGN); + + if (extraAlign != AL_CACHE_ALIGN+1) + hp->base = base + extraAlign; + else + hp->base = base; + + hp->len = len; + hp->cur = hp->base; + hp->count = 0; +} diff --git a/src/unknown_0C8160.c b/src/unknown_0C8160.c deleted file mode 100644 index 068f6348..00000000 --- a/src/unknown_0C8160.c +++ /dev/null @@ -1,7 +0,0 @@ -/* The comment below is needed for this file to be picked up by generate_ld */ -/* RAM_POS: 0x800C7560 */ - -#include "types.h" -#include "macros.h" - -GLOBAL_ASM("asm/non_matchings/unknown_0C8160/alHeapInit.s")