mirror of
https://gitlab.com/dk64_decomp/dk64.git
synced 2024-11-23 07:01:58 +00:00
alheap
This commit is contained in:
parent
9c6147d50a
commit
b3e2e11e27
@ -327,7 +327,7 @@ segments:
|
||||
- [0x2133A90, c, code_133A90]
|
||||
- [0x2135D30, c, code_135D30]
|
||||
- [0x2136820, c, code_136820]
|
||||
- [0x2137120, c, audio/code_137120]
|
||||
- [0x2137120, c, audio/heap]
|
||||
- [0x21371D0, c, audio/code_1371D0]
|
||||
- [0x2137630, c, audio/code_137630]
|
||||
- [0x2137C10, c, audio/csplayer]
|
||||
|
@ -1,31 +0,0 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct global_asm_struct_2 {
|
||||
u32 unk0;
|
||||
u32 unk4;
|
||||
u32 unk8;
|
||||
u32 unkC;
|
||||
} GlobalASMStruct2;
|
||||
|
||||
void func_global_asm_80732420(GlobalASMStruct2 *arg0, u32 arg1, u32 arg2) {
|
||||
arg0->unk0 = arg1;
|
||||
arg0->unk8 = arg2;
|
||||
arg0->unk4 = arg0->unk0;
|
||||
arg0->unkC = 0;
|
||||
}
|
||||
|
||||
s32 func_global_asm_80732444(s32 arg0, s32 arg1, GlobalASMStruct2 *arg2, s32 arg3, s32 arg4) {
|
||||
s32 sp4;
|
||||
s32 sp0;
|
||||
|
||||
sp0 = 0;
|
||||
sp4 = ((arg3 * arg4) + 0xF) & ~0xF;
|
||||
if (!((arg2->unk4 + sp4) > (arg2->unk0 + arg2->unk8))) {
|
||||
sp0 = arg2->unk4;
|
||||
arg2->unk4 += sp4;
|
||||
} else {
|
||||
|
||||
}
|
||||
return sp0;
|
||||
}
|
59
src/global_asm/audio/heap.c
Normal file
59
src/global_asm/audio/heap.c
Normal file
@ -0,0 +1,59 @@
|
||||
#include <ultra64.h>
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct global_asm_struct_2 {
|
||||
u32 unk0;
|
||||
u32 unk4;
|
||||
u32 unk8;
|
||||
u32 unkC;
|
||||
} GlobalASMStruct2;
|
||||
|
||||
void func_global_asm_80732420(ALHeap *hp, u8 *base, s32 len) {
|
||||
// ALHeapInit
|
||||
hp->base = base;
|
||||
hp->len = len;
|
||||
hp->cur = hp->base;
|
||||
hp->count = 0;
|
||||
}
|
||||
|
||||
void *func_global_asm_80732444(u8 *file, s32 line, ALHeap *hp, s32 num, s32 size) {
|
||||
// alHeapDBAlloc
|
||||
|
||||
s32 bytes;
|
||||
u8 *ptr = 0;
|
||||
|
||||
bytes = (num*size + AL_CACHE_ALIGN) & ~AL_CACHE_ALIGN;
|
||||
|
||||
#ifdef _DEBUG
|
||||
hp->count++;
|
||||
bytes += sizeof(HeapInfo);
|
||||
#endif
|
||||
|
||||
if ((hp->cur + bytes) <= (hp->base + hp->len)) {
|
||||
|
||||
ptr = hp->cur;
|
||||
hp->cur += bytes;
|
||||
|
||||
#ifdef _DEBUG
|
||||
((HeapInfo *)ptr)->magic = AL_HEAP_MAGIC;
|
||||
((HeapInfo *)ptr)->size = bytes;
|
||||
((HeapInfo *)ptr)->count = hp->count;
|
||||
if (file) {
|
||||
((HeapInfo *)ptr)->file = file;
|
||||
((HeapInfo *)ptr)->line = line;
|
||||
} else {
|
||||
((HeapInfo *)ptr)->file = (u8 *) "unknown";
|
||||
((HeapInfo *)ptr)->line = 0;
|
||||
}
|
||||
|
||||
ptr += sizeof(HeapInfo);
|
||||
#endif
|
||||
|
||||
} else {
|
||||
#ifdef _DEBUG
|
||||
__osError(ERR_ALHEAPNOFREE, 1, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
Loading…
Reference in New Issue
Block a user