diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2022-01-11 20:25:14 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-11 23:25:14 +0000 |
| commit | c44e26a14356be233402fc98a44681c37ae45761 (patch) | |
| tree | 6254c3534bbaec9e8ae05055c6cbd431a712dd48 /src/code | |
| parent | 133e02a8a744ec7252b71ca5a0e310367dae037d (diff) | |
`__osMalloc.c` OK (#395)
* __osRealloc
* match __osCheckArena
* cleanup
* Import bss, unreferenced strings and cleanup
* format
* Reviews
* Move convert.h to ultra64/
* Make the os_malloc.h header
* potato
* renames and fixes
* format
* small doc pass
}
* format
* minor changes
* Introduce system_malloc.h
* Docs pass
* fix
* format
* stuff
* Apply suggestions from code review
Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>
* review
* format
* remove repeated sentence
* Apply suggestions from code review
Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
* include headers
* review
* Rename __osMallocAddHeap
* remove @brief
* Update src/boot_O2/__osMalloc.c
Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>
Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/game.c | 3 | ||||
| -rw-r--r-- | src/code/gamealloc.c | 1 | ||||
| -rw-r--r-- | src/code/graph.c | 1 | ||||
| -rw-r--r-- | src/code/listalloc.c | 1 | ||||
| -rw-r--r-- | src/code/speed_meter.c | 1 | ||||
| -rw-r--r-- | src/code/sys_cmpdma.c | 1 | ||||
| -rw-r--r-- | src/code/sys_flashrom.c | 1 | ||||
| -rw-r--r-- | src/code/z_DLF.c | 1 | ||||
| -rw-r--r-- | src/code/z_debug.c | 3 | ||||
| -rw-r--r-- | src/code/z_fbdemo.c | 1 | ||||
| -rw-r--r-- | src/code/z_malloc.c | 9 | ||||
| -rw-r--r-- | src/code/z_vismono.c | 1 |
12 files changed, 19 insertions, 5 deletions
diff --git a/src/code/game.c b/src/code/game.c index e431fafda..2713be299 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -1,4 +1,5 @@ #include "global.h" +#include "system_malloc.h" s32 gFramerateDivisor = 1; f32 gFramerateDivisorF = 1.0f; @@ -174,7 +175,7 @@ void GameState_Realloc(GameState* gameState, size_t size) { alloc = &gameState->alloc; THA_Dt(&gameState->heap); GameAlloc_Free(alloc, heapStart); - SystemArena_AnalyzeArena(&systemMaxFree, &bytesFree, &bytesAllocated); + SystemArena_GetSizes(&systemMaxFree, &bytesFree, &bytesAllocated); size = ((systemMaxFree - (sizeof(ArenaNode))) < size) ? (0) : (size); if (size == 0) { size = systemMaxFree - (sizeof(ArenaNode)); diff --git a/src/code/gamealloc.c b/src/code/gamealloc.c index 541f9125b..6067ad91c 100644 --- a/src/code/gamealloc.c +++ b/src/code/gamealloc.c @@ -1,4 +1,5 @@ #include "global.h" +#include "system_malloc.h" void GameAlloc_Log(GameAlloc* this) { GameAllocEntry* iter; diff --git a/src/code/graph.c b/src/code/graph.c index e09cfedc4..8059d1f63 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -1,5 +1,6 @@ #include "prevent_bss_reordering.h" #include "global.h" +#include "system_malloc.h" #include "overlays/gamestates/ovl_daytelop/z_daytelop.h" #include "overlays/gamestates/ovl_file_choose/z_file_choose.h" #include "overlays/gamestates/ovl_opening/z_opening.h" diff --git a/src/code/listalloc.c b/src/code/listalloc.c index da294a109..33f9989ba 100644 --- a/src/code/listalloc.c +++ b/src/code/listalloc.c @@ -1,4 +1,5 @@ #include "global.h" +#include "system_malloc.h" ListAlloc* ListAlloc_Init(ListAlloc* this) { this->prev = NULL; diff --git a/src/code/speed_meter.c b/src/code/speed_meter.c index b8b0299eb..9f04de110 100644 --- a/src/code/speed_meter.c +++ b/src/code/speed_meter.c @@ -1,4 +1,5 @@ #include "global.h" +#include "system_malloc.h" #pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/func_80177390.s") diff --git a/src/code/sys_cmpdma.c b/src/code/sys_cmpdma.c index c670645fc..2533c44f5 100644 --- a/src/code/sys_cmpdma.c +++ b/src/code/sys_cmpdma.c @@ -1,4 +1,5 @@ #include "global.h" +#include "system_malloc.h" #pragma GLOBAL_ASM("asm/non_matchings/code/sys_cmpdma/func_80178750.s") diff --git a/src/code/sys_flashrom.c b/src/code/sys_flashrom.c index 1431e7a66..8b6c2fa5c 100644 --- a/src/code/sys_flashrom.c +++ b/src/code/sys_flashrom.c @@ -1,4 +1,5 @@ #include "global.h" +#include "system_malloc.h" #pragma GLOBAL_ASM("asm/non_matchings/code/sys_flashrom/func_801857C0.s") diff --git a/src/code/z_DLF.c b/src/code/z_DLF.c index 688a5af15..4c57aca01 100644 --- a/src/code/z_DLF.c +++ b/src/code/z_DLF.c @@ -1,4 +1,5 @@ #include "global.h" +#include "system_malloc.h" #pragma GLOBAL_ASM("asm/non_matchings/code/z_DLF/Overlay_LoadGameState.s") diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 924a2ad30..46649a4ce 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -1,11 +1,12 @@ #include "global.h" +#include "system_malloc.h" GameInfo* gGameInfo; void GameInfo_Init(void) { s32 i; - gGameInfo = (GameInfo*)SystemArena_Malloc(sizeof(GameInfo)); + gGameInfo = SystemArena_Malloc(sizeof(GameInfo)); if (1) {} gGameInfo->unk_00 = 0; gGameInfo->unk_01 = 0; diff --git a/src/code/z_fbdemo.c b/src/code/z_fbdemo.c index c2da6f9ce..3d33399e5 100644 --- a/src/code/z_fbdemo.c +++ b/src/code/z_fbdemo.c @@ -1,4 +1,5 @@ #include "global.h" +#include "system_malloc.h" #pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_80163DC0.s") diff --git a/src/code/z_malloc.c b/src/code/z_malloc.c index 8d0bba44a..781f4310e 100644 --- a/src/code/z_malloc.c +++ b/src/code/z_malloc.c @@ -1,4 +1,7 @@ #include "global.h" +#include "os_malloc.h" + +Arena sZeldaArena; void* ZeldaArena_Malloc(size_t size) { void* ptr = __osMalloc(&sZeldaArena, size); @@ -34,11 +37,11 @@ void* ZeldaArena_Calloc(u32 num, size_t size) { } void ZeldaArena_GetSizes(size_t* outMaxFree, size_t* outFree, size_t* outAlloc) { - __osAnalyzeArena(&sZeldaArena, outMaxFree, outFree, outAlloc); + __osGetSizes(&sZeldaArena, outMaxFree, outFree, outAlloc); } -void ZeldaArena_Check() { - __osCheckArena(&sZeldaArena); +s32 ZeldaArena_Check() { + return __osCheckArena(&sZeldaArena); } void ZeldaArena_Init(void* start, size_t size) { diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index 4e02a0af2..6c0d1ef22 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -1,4 +1,5 @@ #include "global.h" +#include "system_malloc.h" #pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_801418B0.s") |
