big progress on JUtility

This commit is contained in:
SwareJonge
2025-06-17 05:01:41 +02:00
parent f61c92a59f
commit 22e1bfab3a
28 changed files with 3103 additions and 48 deletions
@@ -0,0 +1,45 @@
#include <dolphin/gx.h>
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JUtility/JUTGraphFifo.h"
bool JUTGraphFifo::sInitiated;
JUTGraphFifo *JUTGraphFifo::sCurrentFifo;
GXBool JUTGraphFifo::mGpStatus[5];
JUTGraphFifo::JUTGraphFifo(u32 size)
{
mSize = ALIGN_NEXT(size, 32);
if (sInitiated)
{
mFifo = (GXFifoObj *)JKRAllocFromSysHeap(mSize + sizeof(GXFifoObj), 32);
mBase = mFifo + 1;
GXInitFifoBase(mFifo, mBase, mSize);
GXInitFifoPtrs(mFifo, mBase, mBase);
}
else
{
/** TODO: Figure out what has sizeof 0xA0. */
mBase = JKRAllocFromSysHeap(mSize + 0xA0, 32);
mBase = (void *)ALIGN_NEXT((u32)mBase, 32);
mFifo = GXInit(mBase, mSize);
sInitiated = true;
sCurrentFifo = this;
}
}
JUTGraphFifo::~JUTGraphFifo()
{
sCurrentFifo->save();
while (isGPActive())
{
;
}
if (sCurrentFifo == this)
{
sCurrentFifo = nullptr;
}
JKRFreeToSysHeap(mBase);
}