JUtility debug (#3020)

This commit is contained in:
Jcw87
2026-01-05 04:07:04 -08:00
committed by GitHub
parent e15ba03caa
commit 5b987084ea
39 changed files with 494 additions and 467 deletions
+4 -1
View File
@@ -234,7 +234,10 @@ struct TLinkList : TNodeLinkList {
const_iterator begin() const { return const_iterator(const_cast<TLinkList*>(this)->begin()); }
iterator end() { return iterator(TNodeLinkList::end()); }
const_iterator end() const { return const_iterator(const_cast<TLinkList*>(this)->end()); }
T& front() { return *begin(); }
T& front() {
JUT_ASSERT(642, !empty());
return *begin();
}
T& back() { JUT_ASSERT(652, !empty()); return *--end(); }
void pop_front() { erase(TNodeLinkList::begin()); }
void Push_front(T* element) { Insert(begin(), element); }
+4
View File
@@ -210,6 +210,10 @@ inline void* operator new(size_t size, void* ptr) {
}
#endif
inline void* operator new[](size_t size, void* ptr) {
return ptr;
}
void JKRDefaultMemoryErrorRoutine(void* heap, u32 size, int alignment);
inline void* JKRAllocFromHeap(JKRHeap* heap, u32 size, int alignment) {
@@ -89,6 +89,10 @@ public:
return *this;
}
s32 read(u8& val) {
return read(&val, sizeof(u8));
}
s32 read(u32& param_0) {
return read(&param_0, 4);
}
+2
View File
@@ -100,6 +100,8 @@ public:
~JSUList() {}
void initiate() { JSUPtrList::initiate(); }
bool append(JSULink<T>* link) { return this->JSUPtrList::append((JSUPtrLink*)link); }
bool prepend(JSULink<T>* link) { return this->JSUPtrList::prepend((JSUPtrLink*)link); }
-3
View File
@@ -78,7 +78,4 @@ namespace JUTAssertion {
}
};
extern bool sAssertVisible;
#endif /* JUTASSERT_H */
+2 -1
View File
@@ -61,7 +61,8 @@ public:
void setPagingType(EPagingType type) { mPagingType = type; }
static u32 calcCacheSize(u32 param_0, int param_1) { return (ALIGN_NEXT(param_0, 0x20) + 0x40) * param_1; }
GXTexObj* getTexObj(void* buffer) { return &((TCachePage*)buffer)->mTexObj; }
GXTexObj* getTexObj(void* buffer) const { return &((TCachePage*)buffer)->mTexObj; }
void delete_and_initialize() { deleteMemBlocks_CacheFont(); initialize_state(); }
u32 getCachePage() const {
return mCachePage;
+6 -3
View File
@@ -71,15 +71,18 @@ public:
bool isVisible() const { return mVisible; }
void setVisible(bool visible) { mVisible = visible; }
u8 getLineAttr(int param_0) { return mBuf[(field_0x20 + 2) * param_0]; }
u8 getLineAttr(int param_0) const { return mBuf[(field_0x20 + 2) * param_0]; }
void setLineAttr(int param_0, u8 param_1) { mBuf[(field_0x20 + 2) * param_0] = param_1; }
u8* getLinePtr(int param_0) const { return &mBuf[(field_0x20 + 2) * param_0] + 1; }
int diffIndex(int param_0, int param_1) const {
int result;
int diff = param_1 - param_0;
if (diff >= 0) {
return diff;
result = diff;
} else {
result = diff + mMaxLines;
}
return diff += mMaxLines;
return result;
}
int prevIndex(int index) const {
+2 -2
View File
@@ -28,10 +28,10 @@ public:
JUTDbPrint(JUTFont*, JKRHeap*);
static JUTDbPrint* start(JUTFont*, JKRHeap*);
JUTFont* changeFont(JUTFont*);
void enter(int, int, int, char const*, int);
void enter(int, int, int, const char*, int);
void flush(int, int, int, int);
void flush();
void drawString(int, int, int, u8 const*);
void drawString(int, int, int, const u8*);
static JUTDbPrint* getManager() { return sDebugPrint; }
+2
View File
@@ -17,6 +17,8 @@ struct JUTDirectFile {
void fclose();
int fgets(void*, int);
bool isOpened() const { return mIsOpen; }
/* 0x000 */ u8 mBuffer[0x820];
/* 0x820 */ u8* mSectorStart;
/* 0x824 */ u32 mToRead;
+1 -1
View File
@@ -57,7 +57,7 @@ public:
class JUTExMapFile {
public:
JUTExMapFile(char* path) : mLink(this) { mPath = path; }
JUTExMapFile(const char* path) : mLink(this) { mPath = const_cast<char*>(path); }
public:
/* 0x00 */ char* mPath;
+6 -2
View File
@@ -114,8 +114,8 @@ public:
drawString_size(posX, posY, str, strlen(str), visible);
}
void drawString_size(int posX, int posY, const char* str, u32 len, bool visible) {
drawString_size_scale(posX, posY, getWidth(), getHeight(), str, len, visible);
s32 drawString_size(int posX, int posY, const char* str, u32 len, bool visible) {
return drawString_size_scale(posX, posY, getWidth(), getHeight(), str, len, visible);
}
void drawString_scale(f32 posX, f32 posY, f32 width, f32 height, const char* str,
@@ -132,6 +132,10 @@ public:
bool isValid() const { return mValid; }
bool isFixed() const { return mFixed; }
int getFixedWidth() const { return mFixedWidth; }
void setFixedWidth(bool fixed, int width) {
mFixed = fixed;
mFixedWidth = width;
}
int getOffset(int i_no) const {
JUTFont::TWidth width;
getWidthEntry(i_no, &width);
+18 -4
View File
@@ -61,6 +61,7 @@ public:
void checkResetCallback(OSTime holdTime);
void update();
void stopPatternedRumble() { mRumble.stopPatternedRumble(mPortNum); }
void setButtonRepeat(u32, u32, u32);
static void checkResetSwitch();
static void clearForReset();
@@ -72,6 +73,8 @@ public:
PADSetAnalogMode(mode);
}
static int getClampMode() { return sClampMode; }
static void clearResetOccurred() { C3ButtonReset::sResetOccurred = false; }
static void setResetCallback(callbackFn callback, void* arg) {
@@ -111,7 +114,7 @@ public:
void stopMotorWave() { mRumble.stopPatternedRumbleAtThePeriod(); }
void stopMotor() { mRumble.stopMotor(mPortNum, false); }
void stopMotorHard() { mRumble.stopMotorHard(mPortNum); }
void stopMotorHard() { CRumble::stopMotorHard(mPortNum); }
static s8 getPortStatus(EPadPort port) {
JUT_ASSERT(360, 0 <= port && port < 4);
@@ -181,7 +184,7 @@ public:
CRumble(JUTGamePad* pad) { clear(pad); }
static u32 sChannelMask[4];
static bool mStatus[4];
static u8 mStatus[4];
static u32 mEnabled;
enum ERumble {
@@ -201,9 +204,18 @@ public:
void stopPatternedRumbleAtThePeriod();
static void setEnabled(u32 mask);
void stopMotorHard(int port) { stopMotor(port, true); }
static void stopMotor(int port) { stopMotor(port, false); }
static void stopMotorHard(int port) { stopMotor(port, true); }
static bool isEnabled(u32 mask) { return mEnabled & mask; }
static bool isEnabled(u32 mask) {
bool result;
if (mEnabled & mask) {
result = true;
} else {
result = false;
}
return result;
}
static bool isEnabledPort(int port) {
JUT_ASSERT(250, 0 <= port && port < 4);
@@ -274,4 +286,6 @@ struct JUTGamePadLongPress {
/* 0x50 */ s32 field_0x50;
};
inline void JUTReadGamePad() { JUTGamePad::read(); }
#endif /* JUTGAMEPAD_H */
+3 -2
View File
@@ -13,12 +13,13 @@ public:
virtual ~JUTGraphFifo();
void getGpStatus() {
static bool* getGpStatus() {
GXGetGPStatus((GXBool*)&mGpStatus[0], (GXBool*)&mGpStatus[1], (GXBool*)&mGpStatus[2],
(GXBool*)&mGpStatus[3], (GXBool*)&mGpStatus[4]);
return mGpStatus;
}
bool isGPActive() {
static bool isGPActive() {
getGpStatus();
return mGpStatus[2] == false;
}
+7 -7
View File
@@ -21,7 +21,7 @@ struct ResTLUT {
*/
class JUTPalette {
public:
JUTPalette(_GXTlut p1, _GXTlutFmt p2, JUTTransparency p3, u16 p4, void* p5) {
JUTPalette(GXTlut p1, GXTlutFmt p2, JUTTransparency p3, u16 p4, void* p5) {
this->storeTLUT(p1, p2, p3, p4, p5);
}
@@ -29,18 +29,18 @@ public:
storeTLUT(tlutNo, p_tlutRes);
}
void storeTLUT(_GXTlut, ResTLUT*);
void storeTLUT(_GXTlut, _GXTlutFmt, JUTTransparency, u16, void*);
void storeTLUT(GXTlut, ResTLUT*);
void storeTLUT(GXTlut, GXTlutFmt, JUTTransparency, u16, void*);
bool load();
u8 getTlutName() const { return mTlutName; }
u8 getFormat() const { return mFormat; }
u8 getTransparency() const { return mTransparency; }
GXTlut getTlutName() const { return GXTlut(mTlutName); }
GXTlutFmt getFormat() const { return GXTlutFmt(mFormat); }
JUTTransparency getTransparency() const { return JUTTransparency(mTransparency); }
u16 getNumColors() const { return mNumColors; }
ResTLUT* getColorTable() const { return mColorTable; }
private:
/* 0x00 */ _GXTlutObj mTlutObj;
/* 0x00 */ GXTlutObj mTlutObj;
/* 0x0C */ u8 mTlutName;
/* 0x0D */ u8 mFormat;
/* 0x10 */ ResTLUT* mColorTable;
+1
View File
@@ -62,6 +62,7 @@ public:
/* 0x0C */ int mWidth;
/* 0x10 */ int mUserPosition;
CParamSet() {}
void setBarWidth(int width) { mBarWidth = width; }
void setPosition(int x, int y) {
mPosX = x;
+5 -5
View File
@@ -59,14 +59,14 @@ public:
}
~JUTTexture();
void storeTIMG(ResTIMG const*, JUTPalette*, _GXTlut);
void storeTIMG(ResTIMG const*, JUTPalette*, GXTlut);
void storeTIMG(ResTIMG const*, u8);
void storeTIMG(ResTIMG const*, JUTPalette*);
void attachPalette(JUTPalette*);
void init();
void initTexObj(_GXTlut);
void initTexObj(GXTlut);
void initTexObj();
void load(_GXTexMapID);
void load(GXTexMapID);
const ResTIMG* getTexInfo() const { return mTexInfo; }
s32 getFormat() const { return mTexInfo->format; }
@@ -74,8 +74,8 @@ public:
s32 getWidth() const { return mTexInfo->width; }
s32 getHeight() const { return mTexInfo->height; }
void setCaptureFlag(bool flag) { mFlags &= 2 | flag; }
u8 getCaptureFlag() const { return mFlags & 1; }
u8 getEmbPaletteDelFlag() const { return mFlags & 2; }
bool getCaptureFlag() const { return mFlags & 1; }
bool getEmbPaletteDelFlag() const { return mFlags & 2; }
void setEmbPaletteDelFlag(bool flag) { mFlags = (mFlags & 1) | (flag << 1);}
int getTlutName() const { return mTlutName; }
bool operator==(const JUTTexture& other) {
+8 -4
View File
@@ -28,16 +28,20 @@ public:
static void destroyManager();
void initiate(u16, u16, JKRHeap*, JUTXfb::EXfbNumber);
s32 getBufferNum() const { return mBufferNum; }
s32 getBufferNum() { return mBufferNum; }
s16 getDrawnXfbIndex() const { return mDrawnXfbIndex; }
s16 getDrawingXfbIndex() const { return mDrawingXfbIndex; }
s16 getDisplayingXfbIndex() const { return mDisplayingXfbIndex; }
s32 getSDrawingFlag() const { return mSDrawingFlag; }
void* getDrawnXfb() const {
if (mDrawnXfbIndex >= 0)
return mBuffer[mDrawnXfbIndex];
return NULL;
void* result;
if (mDrawnXfbIndex >= 0) {
result = mBuffer[mDrawnXfbIndex];
} else {
result = NULL;
}
return result;
}
void* getDrawingXfb() const {