summaryrefslogtreecommitdiff
path: root/src/egg/core/eggGraphicsFifo.cpp
diff options
context:
space:
mode:
authorrobojumper <robojumper@gmail.com>2024-05-05 21:03:17 +0200
committerrobojumper <robojumper@gmail.com>2024-05-05 21:11:11 +0200
commit9da8f877e177906d8f51415996d542e41b622fd8 (patch)
tree6333b30c78f0e752da540b177b6150ce661f525c /src/egg/core/eggGraphicsFifo.cpp
parent126c5db9431bef2b6f032bce673d7c3d61e62aa3 (diff)
eggGraphicsFifo matching
Diffstat (limited to 'src/egg/core/eggGraphicsFifo.cpp')
-rw-r--r--src/egg/core/eggGraphicsFifo.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/egg/core/eggGraphicsFifo.cpp b/src/egg/core/eggGraphicsFifo.cpp
new file mode 100644
index 00000000..bb937d13
--- /dev/null
+++ b/src/egg/core/eggGraphicsFifo.cpp
@@ -0,0 +1,35 @@
+#include <rvl/GX.h>
+#include <egg/core/eggGraphicsFifo.h>
+#include <egg/core/eggHeap.h>
+
+
+extern "C" void *GXInit(void *buf, u32 bufSize);
+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