mirror of
https://github.com/zeldaret/ss
synced 2026-06-15 06:20:55 -04:00
33 lines
903 B
C++
33 lines
903 B
C++
#include <egg/core/eggGraphicsFifo.h>
|
|
#include <egg/core/eggHeap.h>
|
|
#include <rvl/GX.h>
|
|
|
|
extern "C" void GXGetGPStatus(GXBool *overhi, GXBool *underlow, GXBool *readIdle, GXBool *cmdIdle, GXBool *brkpt);
|
|
|
|
namespace EGG {
|
|
|
|
GraphicsFifo *GraphicsFifo::sGraphicsFifo;
|
|
u8 GraphicsFifo::sGpStatus[];
|
|
|
|
void GraphicsFifo::create(u32 size, Heap *heap) {
|
|
if (heap == nullptr) {
|
|
heap = Heap::sCurrentHeap;
|
|
}
|
|
sGraphicsFifo = new (heap, 0x04) GraphicsFifo(size, heap);
|
|
}
|
|
|
|
GraphicsFifo::~GraphicsFifo() {
|
|
do {
|
|
GXGetGPStatus(&sGpStatus[0], &sGpStatus[1], &sGpStatus[2], &sGpStatus[3], &sGpStatus[4]);
|
|
} while (sGpStatus[2] == false);
|
|
Heap::free(mBuffBase, nullptr);
|
|
}
|
|
|
|
GraphicsFifo::GraphicsFifo(u32 size, Heap *heap) {
|
|
mBufSize = ROUND_UP(size, 0x20);
|
|
mBuffBase = Heap::alloc(mBufSize, 0x20, heap);
|
|
mGxInitData = GXInit(mBuffBase, mBufSize);
|
|
}
|
|
|
|
} // namespace EGG
|