mirror of https://github.com/zeldaret/mm.git
Docs Cleanup (#1153)
* sysheap * Gorons * Update goron comment * functions.h * Update src/boot_O2/system_heap.c Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * add header * Fix header guards * Update data * Add malloc and free to header --------- Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
parent
1ec875f6dc
commit
fc475a9756
|
|
@ -47,16 +47,16 @@
|
|||
<Texture Name="gGoronDonGeroMaskFrillsTex" OutName="goron_don_gero_mask_frills" Format="rgba16" Width="32" Height="32" Offset="0x6440" />
|
||||
<Texture Name="gGoronDonGeroMaskEyeTex" OutName="goron_don_gero_mask_eye" Format="rgba16" Width="16" Height="16" Offset="0x6C40" />
|
||||
|
||||
<!-- Rolled Up Half -->
|
||||
<!-- Note: Seems broken -->
|
||||
<!-- Scared -->
|
||||
<!-- Unused leftover from OoT -->
|
||||
<DList Name="gGoronEmptyDL" Offset="0x7A60" />
|
||||
<DList Name="gGoronRolledUpHalfDL" Offset="0x7A68" />
|
||||
<Texture Name="gGoronRolledUpHalfTLUT" OutName="goron_rolled_up_half_tlut" Format="rgba16" Width="16" Height="16" Offset="0x7EF0" />
|
||||
<Texture Name="gGoronRolledUpHalfSkinTex" OutName="goron_rolled_up_half_skin" Format="ci8" Width="16" Height="16" Offset="0x80F0" />
|
||||
<Texture Name="gGoronRolledUpHalfBellyButtonTex" OutName="goron_rolled_up_half_belly_button" Format="ci8" Width="8" Height="8" Offset="0x81F0" />
|
||||
<Texture Name="gGoronRolledUpHalfBottomTex" OutName="goron_rolled_up_half_bottom" Format="ci8" Width="8" Height="16" Offset="0x8230" />
|
||||
<Texture Name="gGoronRolledUpHalfRocksTex" OutName="goron_rolled_up_half_rocks" Format="ci8" Width="32" Height="64" Offset="0x82B0" />
|
||||
<Texture Name="gGoronRolledUpHalfHairTex" OutName="goron_rolled_up_half_hair" Format="ci8" Width="16" Height="16" Offset="0x8AB0" />
|
||||
<DList Name="gGoronScaredDL" Offset="0x7A68" />
|
||||
<Texture Name="gGoronScaredTLUT" OutName="goron_scared_tlut" Format="rgba16" Width="16" Height="16" Offset="0x7EF0" />
|
||||
<Texture Name="gGoronScaredSkinTex" OutName="goron_scared_skin" Format="ci8" Width="16" Height="16" Offset="0x80F0" />
|
||||
<Texture Name="gGoronScaredBellyButtonTex" OutName="goron_scared_belly_button" Format="ci8" Width="8" Height="8" Offset="0x81F0" />
|
||||
<Texture Name="gGoronScaredBottomTex" OutName="goron_scared_bottom" Format="ci8" Width="8" Height="16" Offset="0x8230" />
|
||||
<Texture Name="gGoronScaredRocksTex" OutName="goron_scared_rocks" Format="ci8" Width="32" Height="64" Offset="0x82B0" />
|
||||
<Texture Name="gGoronScaredHairTex" OutName="goron_scared_hair" Format="ci8" Width="16" Height="16" Offset="0x8AB0" />
|
||||
|
||||
<!-- Rolled Up -->
|
||||
<DList Name="gGoronEmpty2DL" Offset="0x91A0" />
|
||||
|
|
|
|||
|
|
@ -128,10 +128,6 @@ void MtxConv_L2F(MtxF* mtx, Mtx* mf);
|
|||
|
||||
void __assert(const char* file, u32 lineNum);
|
||||
// void func_800862B4(void);
|
||||
void* SystemArena_MallocMin1(u32 size);
|
||||
void SystemArena_FreeNullCheck(void* ptr);
|
||||
void SystemArena_RunInits(void);
|
||||
void SystemArena_Init(void* start, size_t size);
|
||||
s32 func_80086620(OSMesgQueue* param_1, PadMgr* param_2, OSContStatus* param_3);
|
||||
f32 func_80086760(f32 x);
|
||||
// void func_80086794(void);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef SYSTEM_HEAP_H
|
||||
#define SYSTEM_HEAP_H
|
||||
|
||||
#include "libc/stddef.h"
|
||||
#include "PR/ultratypes.h"
|
||||
|
||||
void* SystemHeap_Malloc(size_t size);
|
||||
void SystemHeap_Free(void* ptr);
|
||||
void SystemHeap_Init(void* start, size_t size);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef SYSTEM_MALLOC
|
||||
#define SYSTEM_MALLOC
|
||||
#ifndef SYSTEM_MALLOC_H
|
||||
#define SYSTEM_MALLOC_H
|
||||
|
||||
#include "PR/ultratypes.h"
|
||||
#include "os_malloc.h"
|
||||
|
|
@ -11,7 +11,7 @@ void SystemArena_Free(void* ptr);
|
|||
void* SystemArena_Calloc(u32 elements, size_t size);
|
||||
void SystemArena_GetSizes(size_t* maxFreeBlock, size_t* bytesFree, size_t* bytesAllocated);
|
||||
u32 SystemArena_CheckArena(void);
|
||||
void SystemArena_InitArena(void* start, size_t size);
|
||||
void SystemArena_Init(void* start, size_t size);
|
||||
void SystemArena_Cleanup(void);
|
||||
u8 SystemArena_IsInitialized(void);
|
||||
|
||||
|
|
|
|||
2
spec
2
spec
|
|
@ -36,7 +36,7 @@ beginseg
|
|||
include "build/data/boot/gfxprint.data.o"
|
||||
include "build/src/boot_O2/mtxuty-cvt.o"
|
||||
include "build/src/boot_O2/assert.o"
|
||||
include "build/src/boot_O2/boot_800862E0.o"
|
||||
include "build/src/boot_O2/system_heap.o"
|
||||
include "build/src/boot_O2/padsetup.o"
|
||||
include "build/src/boot_O2/boot_80086760.o"
|
||||
include "build/asm/boot/fp.text.o"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
/**
|
||||
* @file system_heap.c
|
||||
*
|
||||
* @note:
|
||||
* Only SystemHeap_Init() is used, and is essentially just a wrapper for SystemArena_Init().
|
||||
*
|
||||
*/
|
||||
#include "global.h"
|
||||
#include "system_malloc.h"
|
||||
|
||||
|
|
@ -6,20 +13,20 @@ typedef void (*BlockFunc1)(void*, u32);
|
|||
typedef void (*BlockFunc8)(void*, u32, u32, u32, u32, u32, u32, u32, u32);
|
||||
|
||||
typedef struct InitFunc {
|
||||
uintptr_t nextOffset;
|
||||
void (*func)(void);
|
||||
} InitFunc;
|
||||
/* 0x0 */ uintptr_t nextOffset;
|
||||
/* 0x4 */ void (*func)(void);
|
||||
} InitFunc; // size = 0x8
|
||||
|
||||
void* sInitFuncs = NULL;
|
||||
|
||||
char sNew[] = { 0x00, 0x00, 0x00, 0x00 };
|
||||
char sNew[] = "";
|
||||
|
||||
char D_80097508[] = {
|
||||
UNK_TYPE1 D_80097508[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x00,
|
||||
0xFF, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
void* SystemArena_MallocMin1(size_t size) {
|
||||
void* SystemHeap_Malloc(size_t size) {
|
||||
if (size == 0) {
|
||||
size = 1;
|
||||
}
|
||||
|
|
@ -27,13 +34,13 @@ void* SystemArena_MallocMin1(size_t size) {
|
|||
return __osMalloc(&gSystemArena, size);
|
||||
}
|
||||
|
||||
void SystemArena_FreeNullCheck(void* ptr) {
|
||||
void SystemHeap_Free(void* ptr) {
|
||||
if (ptr != NULL) {
|
||||
__osFree(&gSystemArena, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void SystemArena_RunBlockFunc(void* blk, size_t nBlk, size_t blkSize, BlockFunc blockFunc) {
|
||||
void SystemHeap_RunBlockFunc(void* blk, size_t nBlk, size_t blkSize, BlockFunc blockFunc) {
|
||||
uintptr_t pos = blk;
|
||||
|
||||
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {
|
||||
|
|
@ -41,7 +48,7 @@ void SystemArena_RunBlockFunc(void* blk, size_t nBlk, size_t blkSize, BlockFunc
|
|||
}
|
||||
}
|
||||
|
||||
void SystemArena_RunBlockFunc1(void* blk, size_t nBlk, size_t blkSize, BlockFunc1 blockFunc) {
|
||||
void SystemHeap_RunBlockFunc1(void* blk, size_t nBlk, size_t blkSize, BlockFunc1 blockFunc) {
|
||||
uintptr_t pos = blk;
|
||||
|
||||
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {
|
||||
|
|
@ -49,9 +56,9 @@ void SystemArena_RunBlockFunc1(void* blk, size_t nBlk, size_t blkSize, BlockFunc
|
|||
}
|
||||
}
|
||||
|
||||
void* SystemArena_RunBlockFunc8(void* blk, size_t nBlk, size_t blkSize, BlockFunc8 blockFunc) {
|
||||
void* SystemHeap_RunBlockFunc8(void* blk, size_t nBlk, size_t blkSize, BlockFunc8 blockFunc) {
|
||||
if (blk == NULL) {
|
||||
blk = SystemArena_MallocMin1(nBlk * blkSize);
|
||||
blk = SystemHeap_Malloc(nBlk * blkSize);
|
||||
}
|
||||
|
||||
if (blk != NULL && blockFunc != NULL) {
|
||||
|
|
@ -65,7 +72,7 @@ void* SystemArena_RunBlockFunc8(void* blk, size_t nBlk, size_t blkSize, BlockFun
|
|||
return blk;
|
||||
}
|
||||
|
||||
void SystemArena_RunBlockFunc1Reverse(void* blk, size_t nBlk, size_t blkSize, BlockFunc1 blockFunc, s32 shouldFree) {
|
||||
void SystemHeap_RunBlockFunc1Reverse(void* blk, size_t nBlk, size_t blkSize, BlockFunc1 blockFunc, s32 shouldFree) {
|
||||
uintptr_t pos;
|
||||
uintptr_t start;
|
||||
size_t maskedBlkSize;
|
||||
|
|
@ -86,11 +93,11 @@ void SystemArena_RunBlockFunc1Reverse(void* blk, size_t nBlk, size_t blkSize, Bl
|
|||
}
|
||||
|
||||
if (shouldFree) {
|
||||
SystemArena_FreeNullCheck(blk);
|
||||
SystemHeap_Free(blk);
|
||||
}
|
||||
}
|
||||
|
||||
void SystemArena_RunInits(void) {
|
||||
void SystemHeap_RunInits(void) {
|
||||
InitFunc* initFunc = (InitFunc*)&sInitFuncs;
|
||||
u32 nextOffset = initFunc->nextOffset;
|
||||
InitFunc* prev = NULL;
|
||||
|
|
@ -110,7 +117,7 @@ void SystemArena_RunInits(void) {
|
|||
sInitFuncs = prev;
|
||||
}
|
||||
|
||||
void SystemArena_Init(void* start, size_t size) {
|
||||
SystemArena_InitArena(start, size);
|
||||
SystemArena_RunInits();
|
||||
void SystemHeap_Init(void* start, size_t size) {
|
||||
SystemArena_Init(start, size);
|
||||
SystemHeap_RunInits();
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ u32 SystemArena_CheckArena(void) {
|
|||
return __osCheckArena(&gSystemArena);
|
||||
}
|
||||
|
||||
void SystemArena_InitArena(void* start, size_t size) {
|
||||
void SystemArena_Init(void* start, size_t size) {
|
||||
__osMallocInit(&gSystemArena, start, size);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "buffers.h"
|
||||
#include "stack.h"
|
||||
#include "stackcheck.h"
|
||||
#include "system_heap.h"
|
||||
|
||||
extern OSMesgQueue sSiIntMsgQ;
|
||||
extern OSMesg sSiIntMsgBuf[1];
|
||||
|
|
@ -44,7 +45,7 @@ void Main(void* arg) {
|
|||
sysHeap = gSystemHeap;
|
||||
fb = 0x80780000;
|
||||
startHeapSize = fb - sysHeap;
|
||||
SystemArena_Init(sysHeap, startHeapSize);
|
||||
SystemHeap_Init(sysHeap, startHeapSize);
|
||||
|
||||
Regs_Init();
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@
|
|||
0x80085570 : "gfxprint",
|
||||
0x80086110 : "mtxuty-cvt",
|
||||
0x80086280 : "assert",
|
||||
0x800862E0 : "",
|
||||
0x800862E0 : "system_heap",
|
||||
0x80086620 : "padsetup",
|
||||
0x80086760 : "boot_80086760",
|
||||
0x80086C70 : "fp",
|
||||
|
|
@ -256,7 +256,7 @@
|
|||
0x80096C30 : "loadfragment2",
|
||||
0x80096C40 : "stackcheck",
|
||||
0x80096C50 : "gfxprint",
|
||||
0x80097500 : "boot_800862E0",
|
||||
0x80097500 : "system_heap",
|
||||
0x80097520 : "fp",
|
||||
0x80097530 : "rand",
|
||||
0x80097540 : "osViModeNtscHpf1",
|
||||
|
|
|
|||
|
|
@ -157,14 +157,14 @@
|
|||
0x80086258:("MtxConv_L2F",),
|
||||
0x80086280:("__assert",),
|
||||
0x800862B4:("func_800862B4",),
|
||||
0x800862E0:("SystemArena_MallocMin1",),
|
||||
0x80086310:("SystemArena_FreeNullCheck",),
|
||||
0x8008633C:("SystemArena_RunBlockFunc",),
|
||||
0x800863AC:("SystemArena_RunBlockFunc1",),
|
||||
0x8008641C:("SystemArena_RunBlockFunc8",),
|
||||
0x800864EC:("SystemArena_RunBlockFunc1Reverse",),
|
||||
0x80086588:("SystemArena_RunInits",),
|
||||
0x800865F8:("SystemArena_Init",),
|
||||
0x800862E0:("SystemHeap_Malloc",),
|
||||
0x80086310:("SystemHeap_Free",),
|
||||
0x8008633C:("SystemHeap_RunBlockFunc",),
|
||||
0x800863AC:("SystemHeap_RunBlockFunc1",),
|
||||
0x8008641C:("SystemHeap_RunBlockFunc8",),
|
||||
0x800864EC:("SystemHeap_RunBlockFunc1Reverse",),
|
||||
0x80086588:("SystemHeap_RunInits",),
|
||||
0x800865F8:("SystemHeap_Init",),
|
||||
0x80086620:("PadSetup_Init",),
|
||||
0x80086760:("func_80086760",),
|
||||
0x80086794:("func_80086794",),
|
||||
|
|
@ -206,7 +206,7 @@
|
|||
0x80086E78:("SystemArena_Calloc",),
|
||||
0x80086ECC:("SystemArena_GetSizes",),
|
||||
0x80086F04:("SystemArena_CheckArena",),
|
||||
0x80086F28:("SystemArena_InitArena",),
|
||||
0x80086F28:("SystemArena_Init",),
|
||||
0x80086F58:("SystemArena_Cleanup",),
|
||||
0x80086F7C:("SystemArena_IsInitialized",),
|
||||
0x80086FA0:("Rand_Next",),
|
||||
|
|
|
|||
|
|
@ -154,14 +154,14 @@ asm/non_matchings/boot/mtxuty-cvt/MtxConv_F2L.s,MtxConv_F2L,0x80086110,0x52
|
|||
asm/non_matchings/boot/mtxuty-cvt/MtxConv_L2F.s,MtxConv_L2F,0x80086258,0xA
|
||||
asm/non_matchings/boot/assert/__assert.s,__assert,0x80086280,0xD
|
||||
asm/non_matchings/boot/assert/func_800862B4.s,func_800862B4,0x800862B4,0xB
|
||||
asm/non_matchings/boot/boot_800862E0/SystemArena_MallocMin1.s,SystemArena_MallocMin1,0x800862E0,0xC
|
||||
asm/non_matchings/boot/boot_800862E0/SystemArena_FreeNullCheck.s,SystemArena_FreeNullCheck,0x80086310,0xB
|
||||
asm/non_matchings/boot/boot_800862E0/SystemArena_RunBlockFunc.s,SystemArena_RunBlockFunc,0x8008633C,0x1C
|
||||
asm/non_matchings/boot/boot_800862E0/SystemArena_RunBlockFunc1.s,SystemArena_RunBlockFunc1,0x800863AC,0x1C
|
||||
asm/non_matchings/boot/boot_800862E0/SystemArena_RunBlockFunc8.s,SystemArena_RunBlockFunc8,0x8008641C,0x34
|
||||
asm/non_matchings/boot/boot_800862E0/SystemArena_RunBlockFunc1Reverse.s,SystemArena_RunBlockFunc1Reverse,0x800864EC,0x27
|
||||
asm/non_matchings/boot/boot_800862E0/SystemArena_RunInits.s,SystemArena_RunInits,0x80086588,0x1C
|
||||
asm/non_matchings/boot/boot_800862E0/SystemArena_Init.s,SystemArena_Init,0x800865F8,0xA
|
||||
asm/non_matchings/boot/boot_800862E0/SystemHeap_Malloc.s,SystemHeap_Malloc,0x800862E0,0xC
|
||||
asm/non_matchings/boot/boot_800862E0/SystemArena_Free.s,SystemArena_Free,0x80086310,0xB
|
||||
asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc.s,SystemHeap_RunBlockFunc,0x8008633C,0x1C
|
||||
asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc1.s,SystemHeap_RunBlockFunc1,0x800863AC,0x1C
|
||||
asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc8.s,SystemHeap_RunBlockFunc8,0x8008641C,0x34
|
||||
asm/non_matchings/boot/boot_800862E0/SystemHeap_RunBlockFunc1Reverse.s,SystemHeap_RunBlockFunc1Reverse,0x800864EC,0x27
|
||||
asm/non_matchings/boot/boot_800862E0/SystemHeap_RunInits.s,SystemHeap_RunInits,0x80086588,0x1C
|
||||
asm/non_matchings/boot/boot_800862E0/SystemHeap_Init.s,SystemHeap_Init,0x800865F8,0xA
|
||||
asm/non_matchings/boot/padsetup/PadSetup_Init.s,PadSetup_Init,0x80086620,0x50
|
||||
asm/non_matchings/boot/boot_80086760/func_80086760.s,func_80086760,0x80086760,0xD
|
||||
asm/non_matchings/boot/boot_80086760/func_80086794.s,func_80086794,0x80086794,0x8
|
||||
|
|
@ -203,7 +203,7 @@ asm/non_matchings/boot/system_malloc/SystemArena_Free.s,SystemArena_Free,0x80086
|
|||
asm/non_matchings/boot/system_malloc/SystemArena_Calloc.s,SystemArena_Calloc,0x80086E78,0x15
|
||||
asm/non_matchings/boot/system_malloc/SystemArena_GetSizes.s,SystemArena_GetSizes,0x80086ECC,0xE
|
||||
asm/non_matchings/boot/system_malloc/SystemArena_CheckArena.s,SystemArena_CheckArena,0x80086F04,0x9
|
||||
asm/non_matchings/boot/system_malloc/SystemArena_InitArena.s,SystemArena_InitArena,0x80086F28,0xC
|
||||
asm/non_matchings/boot/system_malloc/SystemArena_Init.s,SystemArena_Init,0x80086F28,0xC
|
||||
asm/non_matchings/boot/system_malloc/SystemArena_Cleanup.s,SystemArena_Cleanup,0x80086F58,0x9
|
||||
asm/non_matchings/boot/system_malloc/SystemArena_IsInitialized.s,SystemArena_IsInitialized,0x80086F7C,0x9
|
||||
asm/non_matchings/boot/rand/Rand_Next.s,Rand_Next,0x80086FA0,0xC
|
||||
|
|
|
|||
|
Loading…
Reference in New Issue