diff options
| author | Jcw87 <Jcw87@users.noreply.github.com> | 2026-01-05 04:07:04 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-05 04:07:04 -0800 |
| commit | 5b987084eac71e044ace3ebe21f62d5410b23e62 (patch) | |
| tree | 5e11e8c9054c7cfde2220fc08f96ea4d6781e83b /include/JSystem | |
| parent | e15ba03caac09f55e3055cbd2bf6d214e9d94372 (diff) | |
JUtility debug (#3020)
Diffstat (limited to 'include/JSystem')
| -rw-r--r-- | include/JSystem/JGadget/linklist.h | 5 | ||||
| -rw-r--r-- | include/JSystem/JKernel/JKRHeap.h | 4 | ||||
| -rw-r--r-- | include/JSystem/JSupport/JSUInputStream.h | 4 | ||||
| -rw-r--r-- | include/JSystem/JSupport/JSUList.h | 2 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTAssert.h | 3 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTCacheFont.h | 3 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTConsole.h | 9 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTDbPrint.h | 4 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTDirectFile.h | 2 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTException.h | 2 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTFont.h | 8 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTGamePad.h | 24 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTGraphFifo.h | 5 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTPalette.h | 14 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTProcBar.h | 1 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTTexture.h | 10 | ||||
| -rw-r--r-- | include/JSystem/JUtility/JUTXfb.h | 12 |
17 files changed, 76 insertions, 36 deletions
diff --git a/include/JSystem/JGadget/linklist.h b/include/JSystem/JGadget/linklist.h index 8d0f7c43b1..4728f4197e 100644 --- a/include/JSystem/JGadget/linklist.h +++ b/include/JSystem/JGadget/linklist.h @@ -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); } diff --git a/include/JSystem/JKernel/JKRHeap.h b/include/JSystem/JKernel/JKRHeap.h index e0162fc595..77a4acd8e3 100644 --- a/include/JSystem/JKernel/JKRHeap.h +++ b/include/JSystem/JKernel/JKRHeap.h @@ -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) { diff --git a/include/JSystem/JSupport/JSUInputStream.h b/include/JSystem/JSupport/JSUInputStream.h index 2763e7f5aa..52c80575ee 100644 --- a/include/JSystem/JSupport/JSUInputStream.h +++ b/include/JSystem/JSupport/JSUInputStream.h @@ -89,6 +89,10 @@ public: return *this; } + s32 read(u8& val) { + return read(&val, sizeof(u8)); + } + s32 read(u32& param_0) { return read(¶m_0, 4); } diff --git a/include/JSystem/JSupport/JSUList.h b/include/JSystem/JSupport/JSUList.h index 682dd52e42..20e36c1525 100644 --- a/include/JSystem/JSupport/JSUList.h +++ b/include/JSystem/JSupport/JSUList.h @@ -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); } diff --git a/include/JSystem/JUtility/JUTAssert.h b/include/JSystem/JUtility/JUTAssert.h index 66af11774b..7ccc07eaa2 100644 --- a/include/JSystem/JUtility/JUTAssert.h +++ b/include/JSystem/JUtility/JUTAssert.h @@ -78,7 +78,4 @@ namespace JUTAssertion { } }; - -extern bool sAssertVisible; - #endif /* JUTASSERT_H */ diff --git a/include/JSystem/JUtility/JUTCacheFont.h b/include/JSystem/JUtility/JUTCacheFont.h index 4eafcaa255..8698901afb 100644 --- a/include/JSystem/JUtility/JUTCacheFont.h +++ b/include/JSystem/JUtility/JUTCacheFont.h @@ -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; diff --git a/include/JSystem/JUtility/JUTConsole.h b/include/JSystem/JUtility/JUTConsole.h index 7b852eb0a0..e1708adab9 100644 --- a/include/JSystem/JUtility/JUTConsole.h +++ b/include/JSystem/JUtility/JUTConsole.h @@ -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 { diff --git a/include/JSystem/JUtility/JUTDbPrint.h b/include/JSystem/JUtility/JUTDbPrint.h index 4d5c0749fa..14714df16e 100644 --- a/include/JSystem/JUtility/JUTDbPrint.h +++ b/include/JSystem/JUtility/JUTDbPrint.h @@ -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; } diff --git a/include/JSystem/JUtility/JUTDirectFile.h b/include/JSystem/JUtility/JUTDirectFile.h index e2249f1fcb..71a0c1f21c 100644 --- a/include/JSystem/JUtility/JUTDirectFile.h +++ b/include/JSystem/JUtility/JUTDirectFile.h @@ -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; diff --git a/include/JSystem/JUtility/JUTException.h b/include/JSystem/JUtility/JUTException.h index 29849460e9..4830ed4f74 100644 --- a/include/JSystem/JUtility/JUTException.h +++ b/include/JSystem/JUtility/JUTException.h @@ -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; diff --git a/include/JSystem/JUtility/JUTFont.h b/include/JSystem/JUtility/JUTFont.h index 193a3ac3fd..12cf8f6772 100644 --- a/include/JSystem/JUtility/JUTFont.h +++ b/include/JSystem/JUtility/JUTFont.h @@ -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); diff --git a/include/JSystem/JUtility/JUTGamePad.h b/include/JSystem/JUtility/JUTGamePad.h index 5d9fb62c96..af8da7aa33 100644 --- a/include/JSystem/JUtility/JUTGamePad.h +++ b/include/JSystem/JUtility/JUTGamePad.h @@ -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 bool isEnabled(u32 mask) { return mEnabled & mask; } + static void stopMotor(int port) { stopMotor(port, false); } + static void stopMotorHard(int port) { stopMotor(port, true); } + + 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 */ diff --git a/include/JSystem/JUtility/JUTGraphFifo.h b/include/JSystem/JUtility/JUTGraphFifo.h index 512e5713ab..9af2d8a0bc 100644 --- a/include/JSystem/JUtility/JUTGraphFifo.h +++ b/include/JSystem/JUtility/JUTGraphFifo.h @@ -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; } diff --git a/include/JSystem/JUtility/JUTPalette.h b/include/JSystem/JUtility/JUTPalette.h index 714d069397..0053913630 100644 --- a/include/JSystem/JUtility/JUTPalette.h +++ b/include/JSystem/JUtility/JUTPalette.h @@ -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; diff --git a/include/JSystem/JUtility/JUTProcBar.h b/include/JSystem/JUtility/JUTProcBar.h index 447f31ce9c..e299caf005 100644 --- a/include/JSystem/JUtility/JUTProcBar.h +++ b/include/JSystem/JUtility/JUTProcBar.h @@ -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; diff --git a/include/JSystem/JUtility/JUTTexture.h b/include/JSystem/JUtility/JUTTexture.h index d83be32158..8294cb994a 100644 --- a/include/JSystem/JUtility/JUTTexture.h +++ b/include/JSystem/JUtility/JUTTexture.h @@ -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) { diff --git a/include/JSystem/JUtility/JUTXfb.h b/include/JSystem/JUtility/JUTXfb.h index 3ef30186eb..3c5966dbe4 100644 --- a/include/JSystem/JUtility/JUTXfb.h +++ b/include/JSystem/JUtility/JUTXfb.h @@ -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 { |
