summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2023-03-24 14:38:04 -0300
committerGitHub <noreply@github.com>2023-03-24 14:38:04 -0300
commit147e4fcedca332070ca15dbc1db358ce2d42972c (patch)
tree30577817a17f58de61a3679cb404fa58e922b750 /include
parentf3d2c56d1deed7194c77909ee41ed5b8ef3ef8a2 (diff)
THA docs (#1177)
* THA docs Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * format * namefixer * yada * remove zero pad comment * Update include/z64.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Update include/thga.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * namefixer * bss * namefixer --------- Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
Diffstat (limited to 'include')
-rw-r--r--include/functions.h30
-rw-r--r--include/tha.h28
-rw-r--r--include/thga.h33
-rw-r--r--include/z64.h16
4 files changed, 64 insertions, 43 deletions
diff --git a/include/functions.h b/include/functions.h
index d4ecd9579..1cef380f1 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -2363,35 +2363,7 @@ void PreRender_ApplyFiltersSlowlyDestroy(PreRender* this);
void func_801720C4(PreRender* this);
void func_801720FC(PreRenderParams* params, Gfx** gfxp);
void Prerender_DrawBackground2D(Gfx** gfxp, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, u16 arg8, f32 x, f32 y, f32 xScale, f32 yScale, u32 flags);
-void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, size_t size);
-void THGA_Dt(TwoHeadGfxArena* thga);
-u32 THGA_IsCrash(TwoHeadGfxArena* thga);
-void THGA_Init(TwoHeadGfxArena* thga);
-s32 THGA_GetSize(TwoHeadGfxArena* thga);
-Gfx* THGA_GetHead(TwoHeadGfxArena* thga);
-void THGA_SetHead(TwoHeadGfxArena* thga, Gfx* start);
-Gfx* THGA_GetTail(TwoHeadGfxArena* thga);
-Gfx* THGA_AllocStartArray8(TwoHeadGfxArena* thga, u32 count);
-Gfx* THGA_AllocStart8(TwoHeadGfxArena* thga);
-Gfx* THGA_AllocStart8Wrapper(TwoHeadGfxArena* thga);
-Gfx* THGA_AllocEnd(TwoHeadGfxArena* thga, size_t size);
-Gfx* THGA_AllocEndArray64(TwoHeadGfxArena* thga, u32 count);
-Gfx* THGA_AllocEnd64(TwoHeadGfxArena* thga);
-Gfx* THGA_AllocEndArray16(TwoHeadGfxArena* thga, u32 count);
-Gfx* THGA_AllocEnd16(TwoHeadGfxArena* thga);
-void* THA_GetHead(TwoHeadArena* tha);
-void THA_SetHead(TwoHeadArena* tha, void* start);
-void* THA_GetTail(TwoHeadArena* tha);
-void* THA_AllocStart(TwoHeadArena* tha, size_t size);
-void* THA_AllocStart1(TwoHeadArena* tha);
-void* THA_AllocEnd(TwoHeadArena* tha, size_t size);
-void* THA_AllocEndAlign16(TwoHeadArena* tha, size_t size);
-void* THA_AllocEndAlign(TwoHeadArena* tha, size_t size, u32 mask);
-s32 THA_GetSize(TwoHeadArena* tha);
-u32 THA_IsCrash(TwoHeadArena* tha);
-void THA_Init(TwoHeadArena* tha);
-void THA_Ct(TwoHeadArena* tha, void* ptr, size_t size);
-void THA_Dt(TwoHeadArena* tha);
+
void AudioMgr_StopAllSfxExceptSystem(void);
void func_80172C30(AudioMgr* audioMgr);
void AudioMgr_HandleRetrace(AudioMgr* audioMgr);
diff --git a/include/tha.h b/include/tha.h
new file mode 100644
index 000000000..805d421f9
--- /dev/null
+++ b/include/tha.h
@@ -0,0 +1,28 @@
+#ifndef THA_H
+#define THA_H
+
+#include "ultra64.h"
+#include "libc/stdint.h"
+
+typedef struct TwoHeadArena {
+ /* 0x0 */ size_t size;
+ /* 0x4 */ void* start;
+ /* 0x8 */ void* head;
+ /* 0xC */ void* tail;
+} TwoHeadArena; // size = 0x10
+
+void* THA_GetHead(TwoHeadArena* tha);
+void THA_SetHead(TwoHeadArena* tha, void* newHead);
+void* THA_GetTail(TwoHeadArena* tha);
+void* THA_AllocHead(TwoHeadArena* tha, size_t size);
+void* THA_AllocHeadByte(TwoHeadArena* tha);
+void* THA_AllocTail(TwoHeadArena* tha, size_t size);
+void* THA_AllocTailAlign16(TwoHeadArena* tha, size_t size);
+void* THA_AllocTailAlign(TwoHeadArena* tha, size_t size, uintptr_t mask);
+s32 THA_GetRemaining(TwoHeadArena* tha);
+u32 THA_IsCrash(TwoHeadArena* tha);
+void THA_Reset(TwoHeadArena* tha);
+void THA_Init(TwoHeadArena* tha, void* start, size_t size);
+void THA_Destroy(TwoHeadArena* tha);
+
+#endif
diff --git a/include/thga.h b/include/thga.h
new file mode 100644
index 000000000..351c36407
--- /dev/null
+++ b/include/thga.h
@@ -0,0 +1,33 @@
+#ifndef THGA_H
+#define THGA_H
+
+#include "tha.h"
+
+typedef union TwoHeadGfxArena {
+ struct { // Same as TwoHeadArena, with different types and field names for the head and tail pointers
+ /* 0x0 */ size_t size;
+ /* 0x4 */ void* start;
+ /* 0x8 */ Gfx* p;
+ /* 0xC */ void* d;
+ };
+ /* 0x0 */ TwoHeadArena tha;
+} TwoHeadGfxArena; // size = 0x10
+
+void THGA_Init(TwoHeadGfxArena* thga, void* start, size_t size);
+void THGA_Destroy(TwoHeadGfxArena* thga);
+u32 THGA_IsCrash(TwoHeadGfxArena* thga);
+void THGA_Reset(TwoHeadGfxArena* thga);
+s32 THGA_GetRemaining(TwoHeadGfxArena* thga);
+Gfx* THGA_GetHead(TwoHeadGfxArena* thga);
+void THGA_SetHead(TwoHeadGfxArena* thga, Gfx* newHead);
+void* THGA_GetTail(TwoHeadGfxArena* thga);
+Gfx* THGA_AllocDisplayList(TwoHeadGfxArena* thga, size_t num);
+Gfx* THGA_AllocGfx(TwoHeadGfxArena* thga);
+Gfx* THGA_AllocGfx2(TwoHeadGfxArena* thga);
+void* THGA_AllocTail(TwoHeadGfxArena* thga, size_t size);
+Mtx* THGA_AllocMtxArray(TwoHeadGfxArena* thga, size_t num);
+Mtx* THGA_AllocMtx(TwoHeadGfxArena* thga);
+Vtx* THGA_AllocVtxArray(TwoHeadGfxArena* thga, size_t num);
+Vtx* THGA_AllocVtx(TwoHeadGfxArena* thga);
+
+#endif
diff --git a/include/z64.h b/include/z64.h
index 34be175f4..043219fdb 100644
--- a/include/z64.h
+++ b/include/z64.h
@@ -25,6 +25,8 @@
#include "gfxprint.h"
#include "sys_matrix.h"
+#include "tha.h"
+#include "thga.h"
#include "z64actor.h"
#include "z64animation.h"
#include "z64audio.h"
@@ -116,20 +118,6 @@ typedef struct {
} PolygonType2; // size = 0xC
typedef struct {
- /* 0x0 */ u32 size;
- /* 0x4 */ void* bufp;
- /* 0x8 */ void* head;
- /* 0xC */ void* tail;
-} TwoHeadArena; // size = 0x10
-
-typedef struct {
- /* 0x0 */ u32 size;
- /* 0x4 */ Gfx* bufp;
- /* 0x8 */ Gfx* p;
- /* 0xC */ Gfx* d;
-} TwoHeadGfxArena; // size = 0x10
-
-typedef struct {
/* 0x000 */ Gfx taskStart[9];
/* 0x048 */ Gfx clearZBuffer[8]; // original name: clear_zb_dl
/* 0x088 */ Gfx clearFrameBuffer[5]; // original name: clear_fb_dl