2020-08-01 05:39:33 +02:00
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
extern s32 D_80268000;
|
|
|
|
extern s32 D_802FB800;
|
|
|
|
extern s32 D_803DA800;
|
|
|
|
|
2020-09-02 18:37:33 +02:00
|
|
|
HeapNode* general_heap_create(void) {
|
2020-08-01 05:39:33 +02:00
|
|
|
return _heap_create(&D_802FB800, 0x54000);
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 general_heap_malloc(s32 size) {
|
|
|
|
return _heap_malloc(&D_802FB800, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 general_heap_malloc_tail(s32 size) {
|
|
|
|
return _heap_malloc_tail(&D_802FB800, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 general_heap_free(s32 size) {
|
|
|
|
return _heap_free(&D_802FB800, size);
|
|
|
|
}
|
|
|
|
|
2020-08-14 02:38:16 +02:00
|
|
|
s32 battle_heap_create(void) {
|
2020-09-02 18:37:33 +02:00
|
|
|
if ((s32)_heap_create(&D_803DA800, 0x25800) == -1) {
|
2020-08-01 05:39:33 +02:00
|
|
|
return -1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
2020-08-14 02:38:16 +02:00
|
|
|
}
|
2020-08-01 05:39:33 +02:00
|
|
|
|
|
|
|
s32 func_8002ACDC(void) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 heap_malloc(s32 size) {
|
2020-09-14 01:03:22 +02:00
|
|
|
if (GAME_STATUS->isBattle == 0) {
|
2020-08-01 05:39:33 +02:00
|
|
|
return general_heap_malloc(size);
|
|
|
|
} else {
|
|
|
|
return _heap_malloc(&D_803DA800, size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 heap_free(s32 size) {
|
2020-09-14 01:03:22 +02:00
|
|
|
if (GAME_STATUS->isBattle != 0) {
|
2020-08-01 05:39:33 +02:00
|
|
|
return _heap_free(&D_803DA800, size);
|
|
|
|
} else {
|
|
|
|
return general_heap_free(size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-02 03:45:06 +02:00
|
|
|
s32 collision_heap_create(void) {
|
2020-09-02 18:37:33 +02:00
|
|
|
if ((s32)_heap_create(&D_80268000, 0x18000) == -1) {
|
2020-09-02 03:45:06 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2020-08-01 05:39:33 +02:00
|
|
|
|
2020-09-02 03:45:06 +02:00
|
|
|
s32 collision_heap_malloc(s32 size) {
|
2020-09-14 01:03:22 +02:00
|
|
|
if (!GAME_STATUS->isBattle) {
|
2020-09-02 03:45:06 +02:00
|
|
|
return _heap_malloc(&D_80268000, size);
|
|
|
|
} else {
|
|
|
|
return _heap_malloc(&D_803DA800, size);
|
|
|
|
}
|
|
|
|
}
|
2020-08-01 05:39:33 +02:00
|
|
|
|
2020-09-02 20:20:29 +02:00
|
|
|
s32 collision_heap_free(void* data) {
|
2020-09-14 01:03:22 +02:00
|
|
|
if (GAME_STATUS->isBattle) {
|
2020-09-06 17:53:48 +02:00
|
|
|
return _heap_free(&D_803DA800, data);
|
2020-09-02 03:45:06 +02:00
|
|
|
} else {
|
2020-09-06 17:53:48 +02:00
|
|
|
return _heap_free(&D_80268000, data);
|
2020-09-02 03:45:06 +02:00
|
|
|
}
|
2020-08-19 03:45:26 +02:00
|
|
|
}
|