Finished code_6000.c

This commit is contained in:
Ethan Roseman 2020-09-01 21:45:06 -04:00
parent f3edd49096
commit 90d2ddf2f6
6 changed files with 23 additions and 91 deletions

View File

@ -1,23 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel collision_heap_create
/* 006174 8002AD74 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 006178 8002AD78 AFBF0010 */ sw $ra, 0x10($sp)
/* 00617C 8002AD7C 3C050001 */ lui $a1, 1
/* 006180 8002AD80 3C048027 */ lui $a0, 0x8027
/* 006184 8002AD84 24848000 */ addiu $a0, $a0, -0x8000
/* 006188 8002AD88 0C00A40C */ jal _heap_create
/* 00618C 8002AD8C 34A58000 */ ori $a1, $a1, 0x8000
/* 006190 8002AD90 0040202D */ daddu $a0, $v0, $zero
/* 006194 8002AD94 2402FFFF */ addiu $v0, $zero, -1
/* 006198 8002AD98 0040182D */ daddu $v1, $v0, $zero
/* 00619C 8002AD9C 54830001 */ bnel $a0, $v1, .L8002ADA4
/* 0061A0 8002ADA0 0000102D */ daddu $v0, $zero, $zero
.L8002ADA4:
/* 0061A4 8002ADA4 8FBF0010 */ lw $ra, 0x10($sp)
/* 0061A8 8002ADA8 03E00008 */ jr $ra
/* 0061AC 8002ADAC 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,28 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel collision_heap_free
/* 0061F4 8002ADF4 3C028007 */ lui $v0, 0x8007
/* 0061F8 8002ADF8 8C42419C */ lw $v0, 0x419c($v0)
/* 0061FC 8002ADFC 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 006200 8002AE00 AFBF0010 */ sw $ra, 0x10($sp)
/* 006204 8002AE04 80420070 */ lb $v0, 0x70($v0)
/* 006208 8002AE08 0080282D */ daddu $a1, $a0, $zero
/* 00620C 8002AE0C 3C04803E */ lui $a0, 0x803e
/* 006210 8002AE10 2484A800 */ addiu $a0, $a0, -0x5800
/* 006214 8002AE14 14400003 */ bnez $v0, .L8002AE24
/* 006218 8002AE18 00000000 */ nop
/* 00621C 8002AE1C 3C048027 */ lui $a0, 0x8027
/* 006220 8002AE20 24848000 */ addiu $a0, $a0, -0x8000
.L8002AE24:
/* 006224 8002AE24 0C00A487 */ jal _heap_free
/* 006228 8002AE28 00000000 */ nop
/* 00622C 8002AE2C 8FBF0010 */ lw $ra, 0x10($sp)
/* 006230 8002AE30 03E00008 */ jr $ra
/* 006234 8002AE34 27BD0018 */ addiu $sp, $sp, 0x18
/* 006238 8002AE38 00000000 */ nop
/* 00623C 8002AE3C 00000000 */ nop

View File

@ -1,25 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel collision_heap_malloc
/* 0061B0 8002ADB0 3C028007 */ lui $v0, 0x8007
/* 0061B4 8002ADB4 8C42419C */ lw $v0, 0x419c($v0)
/* 0061B8 8002ADB8 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0061BC 8002ADBC AFBF0010 */ sw $ra, 0x10($sp)
/* 0061C0 8002ADC0 80420070 */ lb $v0, 0x70($v0)
/* 0061C4 8002ADC4 0080282D */ daddu $a1, $a0, $zero
/* 0061C8 8002ADC8 3C048027 */ lui $a0, 0x8027
/* 0061CC 8002ADCC 24848000 */ addiu $a0, $a0, -0x8000
/* 0061D0 8002ADD0 10400003 */ beqz $v0, .L8002ADE0
/* 0061D4 8002ADD4 00000000 */ nop
/* 0061D8 8002ADD8 3C04803E */ lui $a0, 0x803e
/* 0061DC 8002ADDC 2484A800 */ addiu $a0, $a0, -0x5800
.L8002ADE0:
/* 0061E0 8002ADE0 0C00A41B */ jal _heap_malloc
/* 0061E4 8002ADE4 00000000 */ nop
/* 0061E8 8002ADE8 8FBF0010 */ lw $ra, 0x10($sp)
/* 0061EC 8002ADEC 03E00008 */ jr $ra
/* 0061F0 8002ADF0 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -8,6 +8,7 @@
void osCleanupThread(void);
s32 heap_malloc(s32 size);
HeapNode* _heap_create(s32 addr, s32 size);
void clone_model(u16 srcModelID, u16 newModelID);
void update_collider_transform(s16 colliderID);

View File

@ -10,7 +10,7 @@ INCLUDE_ASM("code_42e0_len_1f60", func_80028FE0);
INCLUDE_API_ASM("code_42e0_len_1f60", length2D);
INCLUDE_ASM("code_42e0_len_1f60", _heap_create);
HeapNode* INCLUDE_ASM("code_42e0_len_1f60", _heap_create, s32 addr, s32 size);
INCLUDE_ASM("code_42e0_len_1f60", _heap_malloc);

View File

@ -4,8 +4,6 @@ extern s32 D_80268000;
extern s32 D_802FB800;
extern s32 D_803DA800;
// s32 _heap_free(s32 addr, s32 size);
s32 general_heap_create(void) {
return _heap_create(&D_802FB800, 0x54000);
}
@ -50,16 +48,25 @@ s32 heap_free(s32 size) {
}
}
INCLUDE_ASM("code_6000", collision_heap_create);
INCLUDE_ASM("code_6000", collision_heap_malloc);
#ifdef NON_MATCHING
s32 collision_heap_free(s32 size) {
s32 isBattle = (*gGameStatusPtr)->isBattle;
return _heap_free((isBattle == 0) ? (&D_80268000) : (&D_803DA800), size);
s32 collision_heap_create(void) {
if (_heap_create(&D_80268000, 0x18000) == -1) {
return -1;
}
return 0;
}
s32 collision_heap_malloc(s32 size) {
if (!(*gGameStatusPtr)->isBattle) {
return _heap_malloc(&D_80268000, size);
} else {
return _heap_malloc(&D_803DA800, size);
}
}
s32 collision_heap_free(s32 size) {
if (!(*gGameStatusPtr)->isBattle) {
_heap_free(&D_80268000, size);
} else {
_heap_free(&D_803DA800, size);
}
}
#else
INCLUDE_ASM("code_6000", collision_heap_free);
#endif