mirror of
https://github.com/n64decomp/perfect_dark.git
synced 2024-11-27 08:00:27 +00:00
Decompile alHeapInit and alHeapDBAlloc
This commit is contained in:
parent
ced6be2cd6
commit
4488a219de
24
Makefile
24
Makefile
@ -79,6 +79,11 @@ $(B_DIR)/lib/ultra/io/pfsgetstatus.o: LOOPUNROLL :=
|
||||
$(B_DIR)/lib/ultra/libc/ll.o: MIPSISET := -mips3 -o32
|
||||
$(B_DIR)/lib/ultra/libc/llcvt.o: MIPSISET := -mips3 -32
|
||||
|
||||
# Note: Files that use -O3 must be compiled without the ASM processor, otherwise
|
||||
# it introduces a race condition when using make -j because they create a
|
||||
# temporary include-stdin.u file during compilation.
|
||||
# For these files, see their explicit targets towards the end of this file.
|
||||
$(B_DIR)/lib/ultra/audio/heap.o: OPT_LVL := -g
|
||||
$(B_DIR)/lib/ultra/gu/align.o: OPT_LVL := -O3
|
||||
$(B_DIR)/lib/ultra/gu/frustum.o: OPT_LVL := -O3
|
||||
$(B_DIR)/lib/ultra/gu/ortho.o: OPT_LVL := -O3
|
||||
@ -481,8 +486,8 @@ $(B_DIR)/assets/animations/list.o: $(A_DIR)/animations/list.c
|
||||
|
||||
$(B_DIR)/lib/ultra/libc/llcvt.o: src/lib/ultra/libc/llcvt.c
|
||||
@mkdir -p $(dir $@)
|
||||
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@
|
||||
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
|
||||
/usr/bin/env python3 tools/asmpreproc/asm-processor.py $(OPT_LVL) $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@
|
||||
/usr/bin/env python3 tools/asmpreproc/asm-processor.py $(OPT_LVL) $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
|
||||
tools/patchmips3 $@ || rm $@
|
||||
|
||||
$(B_DIR)/lib/ultra/libc/ll.o: src/lib/ultra/libc/ll.c
|
||||
@ -490,9 +495,10 @@ $(B_DIR)/lib/ultra/libc/ll.o: src/lib/ultra/libc/ll.c
|
||||
$(IDOCC) -c $(CFLAGS) $< -o $@
|
||||
tools/patchmips3 $@ || rm $@
|
||||
|
||||
# Files that use -O3 must be compiled without the ASM processor, otherwise it
|
||||
# introduces a race condition when using make -j because they create a temporary
|
||||
# include-stdin.u file during compilation.
|
||||
$(B_DIR)/lib/ultra/gu/align.o: src/lib/ultra/gu/align.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(IDOCC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
$(B_DIR)/lib/ultra/gu/frustum.o: src/lib/ultra/gu/frustum.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(IDOCC) -c $(CFLAGS) $< -o $@
|
||||
@ -507,13 +513,13 @@ $(B_DIR)/lib/ultra/gu/scale.o: src/lib/ultra/gu/scale.c
|
||||
|
||||
$(B_DIR)/lib/%.o: src/lib/%.c
|
||||
@mkdir -p $(dir $@)
|
||||
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@
|
||||
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
|
||||
/usr/bin/env python3 tools/asmpreproc/asm-processor.py $(OPT_LVL) $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@
|
||||
/usr/bin/env python3 tools/asmpreproc/asm-processor.py $(OPT_LVL) $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
|
||||
|
||||
$(B_DIR)/game/%.o: src/game/%.c
|
||||
@mkdir -p $(dir $@)
|
||||
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@
|
||||
/usr/bin/env python3 tools/asmpreproc/asm-processor.py -O2 $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
|
||||
/usr/bin/env python3 tools/asmpreproc/asm-processor.py $(OPT_LVL) $< | $(IDOCC) -c $(CFLAGS) tools/asmpreproc/include-stdin.c -o $@
|
||||
/usr/bin/env python3 tools/asmpreproc/asm-processor.py $(OPT_LVL) $< --post-process $@ --assembler "$(TOOLCHAIN)-as -march=vr4300 -mabi=32" --asm-prelude tools/asmpreproc/prelude.s
|
||||
|
||||
$(B_DIR)/%.o: src/%.c
|
||||
@mkdir -p $(dir $@)
|
||||
|
@ -60,7 +60,7 @@
|
||||
build/ROMID/lib/lib_2f490.o (section); \
|
||||
build/ROMID/lib/lib_2f8a0.o (section); \
|
||||
build/ROMID/lib/lib_2fa00.o (section); \
|
||||
build/ROMID/lib/lib_2faf0.o (section); \
|
||||
build/ROMID/lib/ultra/audio/heap.o (section); \
|
||||
build/ROMID/lib/lib_2fba0.o (section); \
|
||||
build/ROMID/lib/lib_2fc60.o (section); \
|
||||
build/ROMID/lib/lib_30ce0.o (section); \
|
||||
|
@ -58,7 +58,7 @@
|
||||
build/ROMID/lib/lib_2f490.o (section); \
|
||||
build/ROMID/lib/lib_2f8a0.o (section); \
|
||||
build/ROMID/lib/lib_2fa00.o (section); \
|
||||
build/ROMID/lib/lib_2faf0.o (section); \
|
||||
build/ROMID/lib/ultra/audio/heap.o (section); \
|
||||
build/ROMID/lib/lib_2fba0.o (section); \
|
||||
build/ROMID/lib/lib_2fc60.o (section); \
|
||||
build/ROMID/lib/lib_30ce0.o (section); \
|
||||
|
@ -58,7 +58,7 @@
|
||||
build/ROMID/lib/lib_2f490.o (section); \
|
||||
build/ROMID/lib/lib_2f8a0.o (section); \
|
||||
build/ROMID/lib/lib_2fa00.o (section); \
|
||||
build/ROMID/lib/lib_2faf0.o (section); \
|
||||
build/ROMID/lib/ultra/audio/heap.o (section); \
|
||||
build/ROMID/lib/lib_2fba0.o (section); \
|
||||
build/ROMID/lib/lib_2fc60.o (section); \
|
||||
build/ROMID/lib/lib_30ce0.o (section); \
|
||||
|
@ -1,7 +0,0 @@
|
||||
#ifndef _IN_LIB_LIB_2FAF0_H
|
||||
#define _IN_LIB_LIB_2FAF0_H
|
||||
#include <ultra64.h>
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
#endif
|
@ -4,7 +4,6 @@
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/lib_09660.h"
|
||||
#include "lib/lib_2faf0.h"
|
||||
#include "lib/lib_2fba0.h"
|
||||
#include "lib/lib_2fc60.h"
|
||||
#include "lib/lib_30ce0.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "lib/lib_09660.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/lib_159b0.h"
|
||||
#include "lib/lib_2faf0.h"
|
||||
#include "lib/lib_30ce0.h"
|
||||
#include "lib/lib_4b170.h"
|
||||
#include "data.h"
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "lib/lib_09660.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/lib_159b0.h"
|
||||
#include "lib/lib_2faf0.h"
|
||||
#include "lib/lib_30ce0.h"
|
||||
#include "lib/lib_4b170.h"
|
||||
#include "data.h"
|
||||
|
@ -1,57 +0,0 @@
|
||||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel alHeapInit
|
||||
/* 2faf0: ac850000 */ sw $a1,0x0($a0)
|
||||
/* 2faf4: ac860008 */ sw $a2,0x8($a0)
|
||||
/* 2faf8: 8c8e0000 */ lw $t6,0x0($a0)
|
||||
/* 2fafc: ac8e0004 */ sw $t6,0x4($a0)
|
||||
/* 2fb00: ac80000c */ sw $zero,0xc($a0)
|
||||
/* 2fb04: 03e00008 */ jr $ra
|
||||
/* 2fb08: 00000000 */ nop
|
||||
/* 2fb0c: 03e00008 */ jr $ra
|
||||
/* 2fb10: 00000000 */ nop
|
||||
);
|
||||
|
||||
GLOBAL_ASM(
|
||||
glabel alHeapDBAlloc
|
||||
/* 2fb14: 27bdfff8 */ addiu $sp,$sp,-8
|
||||
/* 2fb18: afa40008 */ sw $a0,0x8($sp)
|
||||
/* 2fb1c: afa5000c */ sw $a1,0xc($sp)
|
||||
/* 2fb20: afa00000 */ sw $zero,0x0($sp)
|
||||
/* 2fb24: 8fae0018 */ lw $t6,0x18($sp)
|
||||
/* 2fb28: 2401fff0 */ addiu $at,$zero,-16
|
||||
/* 2fb2c: 00ee0019 */ multu $a3,$t6
|
||||
/* 2fb30: 00007812 */ mflo $t7
|
||||
/* 2fb34: 25f8000f */ addiu $t8,$t7,0xf
|
||||
/* 2fb38: 0301c824 */ and $t9,$t8,$at
|
||||
/* 2fb3c: afb90004 */ sw $t9,0x4($sp)
|
||||
/* 2fb40: 8cc80004 */ lw $t0,0x4($a2)
|
||||
/* 2fb44: 8fa90004 */ lw $t1,0x4($sp)
|
||||
/* 2fb48: 8ccb0000 */ lw $t3,0x0($a2)
|
||||
/* 2fb4c: 8ccc0008 */ lw $t4,0x8($a2)
|
||||
/* 2fb50: 01095021 */ addu $t2,$t0,$t1
|
||||
/* 2fb54: 016c6821 */ addu $t5,$t3,$t4
|
||||
/* 2fb58: 01aa082b */ sltu $at,$t5,$t2
|
||||
/* 2fb5c: 14200008 */ bnez $at,.L0002fb80
|
||||
/* 2fb60: 00000000 */ nop
|
||||
/* 2fb64: 8cce0004 */ lw $t6,0x4($a2)
|
||||
/* 2fb68: afae0000 */ sw $t6,0x0($sp)
|
||||
/* 2fb6c: 8ccf0004 */ lw $t7,0x4($a2)
|
||||
/* 2fb70: 8fb80004 */ lw $t8,0x4($sp)
|
||||
/* 2fb74: 01f8c821 */ addu $t9,$t7,$t8
|
||||
/* 2fb78: 10000001 */ b .L0002fb80
|
||||
/* 2fb7c: acd90004 */ sw $t9,0x4($a2)
|
||||
.L0002fb80:
|
||||
/* 2fb80: 10000003 */ b .L0002fb90
|
||||
/* 2fb84: 8fa20000 */ lw $v0,0x0($sp)
|
||||
/* 2fb88: 10000001 */ b .L0002fb90
|
||||
/* 2fb8c: 00000000 */ nop
|
||||
.L0002fb90:
|
||||
/* 2fb90: 03e00008 */ jr $ra
|
||||
/* 2fb94: 27bd0008 */ addiu $sp,$sp,0x8
|
||||
);
|
@ -1,7 +1,6 @@
|
||||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/lib_2faf0.h"
|
||||
#include "lib/lib_30ce0.h"
|
||||
#include "lib/lib_39fe0.h"
|
||||
#include "lib/lib_3a100.h"
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/lib_2faf0.h"
|
||||
#include "lib/lib_2fc60.h"
|
||||
#include "lib/lib_30ce0.h"
|
||||
#include "lib/lib_317f0.h"
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/lib_2faf0.h"
|
||||
#include "lib/lib_2fc60.h"
|
||||
#include "lib/lib_30ce0.h"
|
||||
#include "lib/lib_317f0.h"
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/snd.h"
|
||||
#include "lib/lib_2faf0.h"
|
||||
#include "lib/lib_2fc60.h"
|
||||
#include "lib/lib_30ce0.h"
|
||||
#include "lib/lib_317f0.h"
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "lib/lib_2faf0.h"
|
||||
#include "lib/lib_37b00.h"
|
||||
#include "lib/lib_3e730.h"
|
||||
#include "lib/lib_43dd0.h"
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "constants.h"
|
||||
#include "game/atan2f.h"
|
||||
#include "bss.h"
|
||||
#include "lib/lib_2faf0.h"
|
||||
#include "lib/lib_3a100.h"
|
||||
#include "lib/lib_446d0.h"
|
||||
#include "data.h"
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "lib/snd.h"
|
||||
#include "lib/memory.h"
|
||||
#include "lib/rng.h"
|
||||
#include "lib/lib_2faf0.h"
|
||||
#include "lib/lib_2fc60.h"
|
||||
#include "lib/lib_317f0.h"
|
||||
#include "lib/lib_37650.h"
|
||||
|
30
src/lib/ultra/audio/heap.c
Normal file
30
src/lib/ultra/audio/heap.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <ultra64.h>
|
||||
#include "constants.h"
|
||||
#include "bss.h"
|
||||
#include "data.h"
|
||||
#include "types.h"
|
||||
|
||||
void alHeapInit(ALHeap *hp, u8 *base, s32 len)
|
||||
{
|
||||
hp->base = base;
|
||||
hp->len = len;
|
||||
hp->cur = hp->base;
|
||||
hp->count = 0;
|
||||
}
|
||||
|
||||
void *alHeapDBAlloc(u8 *file, s32 line, ALHeap *hp, s32 num, s32 size)
|
||||
{
|
||||
s32 bytes;
|
||||
u8 *ptr = 0;
|
||||
|
||||
bytes = (num * size + 0xf) & ~0xf;
|
||||
|
||||
if (hp->cur + bytes <= hp->base + hp->len) {
|
||||
ptr = hp->cur;
|
||||
hp->cur += bytes;
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
Loading…
Reference in New Issue
Block a user