summaryrefslogtreecommitdiff
path: root/src/JSystem/JUtility/JUTGraphFifo.cpp
blob: a5aabbf53689244c84d54ef8c426b857dd496fab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// Generated by dtk
// Translation Unit: JUTGraphFifo.cpp
//

#include "JSystem/JUtility/JUTGraphFifo.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "dolphin/types.h"

bool JUTGraphFifo::sInitiated;
JUTGraphFifo* JUTGraphFifo::sCurrentFifo;

/* 802C1C04-802C1CE0       .text __ct__12JUTGraphFifoFUl */
JUTGraphFifo::JUTGraphFifo(u32 size) {
    mSize = size + 0x1F & ~0x1F;
    if (sInitiated) {
        mFifo = (GXFifoObj*)JKRAllocFromSysHeap(mSize + 0x80, 32);
        mBase = mFifo + 1;
        GXInitFifoBase(mFifo, mBase, mSize);
        GXInitFifoPtrs(mFifo, mBase, mBase);
    } else {
        mBase = JKRAllocFromSysHeap(mSize + 0xA0, 32);
        mBase = (void*)((int)mBase + 0x1F & ~0x1F);
        mFifo = GXInit(mBase, mSize);
        sInitiated = true;
        sCurrentFifo = this;
    }
}

bool JUTGraphFifo::mGpStatus[5];

/* 802C1CE0-802C1DA4       .text __dt__12JUTGraphFifoFv */
JUTGraphFifo::~JUTGraphFifo() {
    sCurrentFifo->save();

    do {
    } while (isGPActive());

    if (sCurrentFifo == this) {
        sCurrentFifo = NULL;
    }
    JKRFreeToSysHeap(mBase);
}