Files
tp/include/JSystem/JUtility/JUTProcBar.h
T

122 lines
3.3 KiB
C++
Raw Normal View History

2021-03-28 22:49:05 +02:00
#ifndef JUTPROCBAR_H
#define JUTPROCBAR_H
2022-01-09 17:33:14 -08:00
#include "JSystem/JUtility/TColor.h"
#include <dolphin/os.h>
2021-03-28 22:49:05 +02:00
2023-05-12 12:10:14 -07:00
class JKRHeap;
2024-04-12 00:10:30 -06:00
/**
* @ingroup jsystem-jutility
*
*/
2022-01-09 17:33:14 -08:00
class JUTProcBar {
public:
class CTime {
public:
2023-09-21 04:56:39 -07:00
/* 802E7340 */ CTime() { clear(); }
void clear() {
mCost = 0;
field_0x8 = 0;
field_0xc = 0;
}
2022-01-09 17:33:14 -08:00
void start(u8 param_0, u8 param_1, u8 param_2) {
2023-07-21 05:39:25 +03:00
mR = param_0;
mG = param_1;
mB = param_2;
2022-01-09 17:33:14 -08:00
mTick = OSGetTick();
}
void end() {
2023-07-21 05:39:25 +03:00
mCost = ((OSGetTick() - mTick) * 8) / ((*(u32*)0x800000F8 / 4) / 125000);
if (mCost == 0) {
mCost = 1;
2022-01-09 17:33:14 -08:00
}
}
2023-07-21 05:39:25 +03:00
void accumePeek() {
if (++field_0xc >= 0x10 || mCost >= field_0x8) {
field_0x8 = mCost;
field_0xc = 0;
}
}
int calcBarSize(int p1, int p2) { return mCost * p1 / p2; }
2022-01-09 17:33:14 -08:00
/* 0x00 */ u32 mTick;
2023-07-21 05:39:25 +03:00
/* 0x04 */ u32 mCost;
2022-01-09 17:33:14 -08:00
/* 0x08 */ u32 field_0x8;
/* 0x0C */ u32 field_0xc;
2023-07-21 05:39:25 +03:00
/* 0x10 */ u8 mR;
/* 0x11 */ u8 mG;
/* 0x12 */ u8 mB;
2022-01-09 17:33:14 -08:00
};
class CParamSet {
public:
/* 0x00 */ int mBarWidth;
/* 0x04 */ int mPosX;
/* 0x08 */ int mPosY;
/* 0x0C */ int mWidth;
/* 0x10 */ int mUserPosition;
2023-09-21 04:56:39 -07:00
void setBarWidth(int width) { mBarWidth = width; }
void setPosition(int x, int y) {
mPosX = x;
mPosY = y;
}
void setWidth(int width) { mWidth = width; }
void setUserPosition(int userPos) { mUserPosition = userPos; }
2022-01-09 17:33:14 -08:00
};
/* 802E5888 */ JUTProcBar();
/* 802E599C */ ~JUTProcBar();
2022-07-11 12:43:46 -07:00
/* 802E59E0 */ static JUTProcBar* create();
2022-01-09 17:33:14 -08:00
/* 802E5A28 */ static void destroy();
/* 802E5A60 */ static void clear();
/* 802E5B30 */ void bar_subroutine(int, int, int, int, int, int, int, JUtility::TColor,
JUtility::TColor);
/* 802E5CC4 */ void adjustMeterLength(u32, f32*, f32, f32, int*);
/* 802E5E08 */ void draw();
/* 802E5E3C */ void drawProcessBar();
/* 802E6FA0 */ void drawHeapBar();
void cpuStart() { mCpu.start(255, 129, 30); }
void cpuEnd() { mCpu.end(); }
void gpWaitStart() { mGpWait.start(255, 129, 30); }
void gpWaitEnd() { mGpWait.end(); }
void gpStart() { mGp.start(255, 129, 30); }
void gpEnd() { mGp.end(); }
void wholeLoopStart() { mWholeLoop.start(255, 129, 30); }
void wholeLoopEnd() { mWholeLoop.end(); }
void idleStart() { mIdle.start(255, 129, 30); }
void idleEnd() { mIdle.end(); }
void setCostFrame(int frame) { mCostFrame = frame; }
2022-01-25 12:24:14 -08:00
void setVisible(bool visible) { mVisible = visible; }
void setVisibleHeapBar(bool visible) { mHeapBarVisible = visible; }
2022-01-09 17:33:14 -08:00
static JUTProcBar* getManager() { return sManager; }
static JUTProcBar* sManager;
private:
/* 0x000 */ CTime mIdle;
/* 0x014 */ CTime mGp;
/* 0x028 */ CTime mCpu;
/* 0x03C */ CTime mGpWait;
/* 0x050 */ CTime mWholeLoop;
2023-07-21 05:39:25 +03:00
/* 0x064 */ CTime mUsers[8];
2022-01-09 17:33:14 -08:00
/* 0x104 */ int mCostFrame;
/* 0x108 */ int field_0x108;
/* 0x10C */ bool mVisible;
/* 0x110 */ int field_0x110;
2023-07-21 05:39:25 +03:00
/* 0x114 */ CParamSet mParams;
2022-01-09 17:33:14 -08:00
/* 0x128 */ int field_0x128;
/* 0x12C */ JKRHeap* mWatchHeap;
/* 0x130 */ bool mHeapBarVisible;
};
2021-03-28 22:49:05 +02:00
#endif /* JUTPROCBAR_H */