diff options
| author | Derek Hensley <hensley.derek58@gmail.com> | 2024-04-06 10:23:06 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-06 10:23:06 -0700 |
| commit | e3ce14c932b80e5ed4c7680cb9dd9f638d739541 (patch) | |
| tree | 0bca0376b6b8000c83bcaa6b50da17927bcec84c /src/code/gfxalloc.c | |
| parent | 47d43f2fa1b0a35b02a1186fb94e5bd227c92219 (diff) | |
Misc Clean (#1602)
* thiefbird
* eff_ss_dead
* PreRender_AntiAliasFilterPixel tmp -> invCvg
* Skin_InitAnimatedLimb
* gfxalloc
* loadfragment
* loadfragment strings
Diffstat (limited to 'src/code/gfxalloc.c')
| -rw-r--r-- | src/code/gfxalloc.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/code/gfxalloc.c b/src/code/gfxalloc.c new file mode 100644 index 000000000..07070e964 --- /dev/null +++ b/src/code/gfxalloc.c @@ -0,0 +1,29 @@ +#include "global.h" + +Gfx* Gfx_Open(Gfx* gfx) { + return &gfx[1]; +} + +Gfx* Gfx_Close(Gfx* gfx, Gfx* dst) { + gSPBranchList(gfx, dst); + return dst; +} + +/** + * Allocates a structure of `size` into the display list buffer`gfx`, + * returning a pointer to the start of the buffer. + * Since the alloc may not itself be display list commands, a BranchList + * command is used to step over this region. + */ +void* Gfx_Alloc(Gfx** gfxP, size_t size) { + u8* start; + Gfx* gfx; + + size = ALIGN8(size); + start = (u8*)&(*gfxP)[1]; + gfx = (Gfx*)(start + size); + gSPBranchList(*gfxP, gfx); + + *gfxP = gfx; + return start; +} |
