mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-06-11 04:37:57 -04:00
big progress on JUtility
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user