MCPcopy Create free account
hub / github.com/doldecomp/mkdd / drawProcessBar

Method drawProcessBar

libs/JSystem/JUtility/JUTProcBar.cpp:123–234  ·  view source on GitHub ↗

MKDD: https://decomp.me/scratch/1Q2Ke TP: https://decomp.me/scratch/YKjcF */

Source from the content-addressed store, hash-verified

121TP: https://decomp.me/scratch/YKjcF
122*/
123void JUTProcBar::drawProcessBar() {
124 if (mVisible)
125 {
126 int frameDuration = 16666; // duration in miliseconds? for how long a frame takes,
127 if (JUTVideo::getManager() && ((JUTVideo::getManager()->getRenderMode()->viTVmode >> 2) & 0x0f) == VI_PAL) // possibly a define
128 frameDuration = 20000; // duration for PAL
129
130 static int cnt = 0;
131 adjustMeterLength(mWholeLoop.mCost, &oneFrameRate, 1.0f, 10.0f, &cnt);
132 int r28 = oneFrameRate * 20.0f;
133 int r27 = mParams.mBarWidth * 8;
134 int r26 = mParams.mBarWidth * 2;
135 int r25 = mParams.mBarWidth * 10;
136 int r24 = (mParams.mWidth - 4 + r28) / r28;
137
138 mIdle.accumePeek();
139 mGp.accumePeek();
140 mCpu.accumePeek();
141
142 u32 totalTime = (mGp.mCost - mGpWait.mCost) - mCpu.mCost; // unsure of types
143 u32 gpuTime = (mGp.mCost - mGpWait.mCost);
144 J2DFillBox(mParams.mPosX, mParams.mPosY, mParams.mWidth, r27, JUtility::TColor(0, 0, 50, 200));
145 J2DDrawFrame(mParams.mPosX, mParams.mPosY, mParams.mWidth, r27, JUtility::TColor(50, 50, 150, 255), 6);
146 if (mCostFrame > r24)
147 J2DFillBox(mParams.mPosX, mParams.mPosY + r27 + 1, mParams.mWidth, 1.0f, JUtility::TColor(250, 0, 0, 200));
148 else
149 J2DFillBox(mParams.mPosX, mParams.mPosY + r27 + 1, mCostFrame * r28 + 2, 1.0f, JUtility::TColor(0, 250, 250, 200));
150
151 int stack92 = mWholeLoop.mCost * r28 / frameDuration;
152 if (stack92 > mParams.mWidth)
153 J2DFillBox(mParams.mPosX, mParams.mPosY, mParams.mWidth, 1.0f, JUtility::TColor(255, 100, 0, 255));
154 else
155 J2DFillBox(mParams.mPosX, mParams.mPosY, stack92, 1.0f, JUtility::TColor(50, 255, 0, 255));
156
157 if (_110 == 0)
158 {
159 int r23 = mParams.mPosY + mParams.mBarWidth;
160 bar_subroutine(mParams.mPosX + 1, r23, r26, r28, frameDuration, mGp.mCost, mGp._08, JUtility::TColor(80, 255, 80, 255), JUtility::TColor(100, 255, 120, 255));
161 r23 += mParams.mBarWidth * 2;
162 bar_subroutine(mParams.mPosX + 1, r23, r26, r28, frameDuration, mCpu.mCost, mCpu._08, JUtility::TColor(255, 80, 80, 255), JUtility::TColor(255, 100, 100, 255));
163 r23 += mParams.mBarWidth * 2;
164 bar_subroutine(mParams.mPosX + 1, r23, r26, r28, frameDuration, mIdle.mCost, mIdle._08, JUtility::TColor(180, 180, 160, 255), JUtility::TColor(200, 200, 200, 255));
165 }
166 else
167 {
168 int r22 = mParams.mPosY + mParams.mBarWidth;
169 int r21 = mParams.mPosX + 1;
170 bar_subroutine(r21, r22, r26, r28, frameDuration, gpuTime, -1, JUtility::TColor(80, 255, 80, 255), JUtility::TColor(80, 255, 80, 255));
171 int thingy1 = gpuTime * r28 / frameDuration + r21;
172 J2DFillBox(thingy1, r22, mGpWait.calcBarSize(r28, frameDuration), r26, JUtility::TColor(0, 255, 0, 255));
173 int r30 = mGp.calcBarSize(r28, frameDuration) + r21;
174 r21 += totalTime * r28 / frameDuration;
175 r22 += mParams.mBarWidth * 2;
176 bar_subroutine(r21, r22, r26, r28, frameDuration, mCpu.mCost, -1, JUtility::TColor(255, 80, 80, 255), JUtility::TColor(255, 80, 80, 255));
177 r22 += mParams.mBarWidth * 2;
178 bar_subroutine(r30, r22, r26, r28, frameDuration, mIdle.mCost, -1, JUtility::TColor(180, 180, 160, 255), JUtility::TColor(180, 180, 160, 255));
179 }
180 for (int i = 1; i < r24; i++)

Callers

nothing calls this directly

Calls 7

J2DFillBoxFunction · 0.85
TColorClass · 0.85
J2DDrawFrameFunction · 0.85
J2DDrawLineFunction · 0.85
getRenderModeMethod · 0.80
accumePeekMethod · 0.80
calcBarSizeMethod · 0.80

Tested by

no test coverage detected