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
+1 -1
View File
@@ -21544,7 +21544,7 @@ sReleasePoint__Q210JUTGamePad6CStick = .sdata:0x804508E4; // type:object size:0x
sResetPattern__Q210JUTGamePad13C3ButtonReset = .sdata:0x804508E8; // type:object size:0x4 scope:global align:4 data:4byte
sResetMaskPattern__Q210JUTGamePad13C3ButtonReset = .sdata:0x804508EC; // type:object size:0x4 scope:global align:4 data:4byte
sMessageBuffer__12JUTException = .sdata:0x804508F0; // type:object size:0x4 scope:global align:4
sAssertVisible = .sdata:0x804508F8; // type:object size:0x1 scope:global align:1 data:byte
mVisible__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ = .sdata:0x804508F8; // type:object size:0x1 scope:global align:1 data:byte
oneFrameRate = .sdata:0x80450900; // type:object size:0x4 scope:local align:4 data:float
oneFrameRateUser = .sdata:0x80450904; // type:object size:0x4 scope:local align:4 data:float
cm2hw$552 = .sdata:0x80450908; // type:object size:0x4 scope:local align:4
+1 -1
View File
@@ -21573,7 +21573,7 @@ sReleasePoint__Q210JUTGamePad6CStick = .sdata:0x8044AA24; // type:object size:0x
sResetPattern__Q210JUTGamePad13C3ButtonReset = .sdata:0x8044AA28; // type:object size:0x4 scope:global align:4 data:4byte
sResetMaskPattern__Q210JUTGamePad13C3ButtonReset = .sdata:0x8044AA2C; // type:object size:0x4 scope:global align:4 data:4byte
sMessageBuffer__12JUTException = .sdata:0x8044AA30; // type:object size:0x4 scope:global align:4
sAssertVisible = .sdata:0x8044AA38; // type:object size:0x1 scope:global align:1 data:byte
mVisible__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ = .sdata:0x8044AA38; // type:object size:0x1 scope:global align:1 data:byte
oneFrameRate = .sdata:0x8044AA40; // type:object size:0x4 scope:local align:4 data:float
oneFrameRateUser = .sdata:0x8044AA44; // type:object size:0x4 scope:local align:4 data:float
cm2hw$552 = .sdata:0x8044AA48; // type:object size:0x4 scope:local align:4
+1 -1
View File
@@ -21585,7 +21585,7 @@ sReleasePoint__Q210JUTGamePad6CStick = .sdata:0x804528A4; // type:object size:0x
sResetPattern__Q210JUTGamePad13C3ButtonReset = .sdata:0x804528A8; // type:object size:0x4 scope:global align:4 data:4byte
sResetMaskPattern__Q210JUTGamePad13C3ButtonReset = .sdata:0x804528AC; // type:object size:0x4 scope:global align:4 data:4byte
sMessageBuffer__12JUTException = .sdata:0x804528B0; // type:object size:0x4 scope:global align:4
sAssertVisible = .sdata:0x804528B8; // type:object size:0x1 data:byte
mVisible__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ = .sdata:0x804528B8; // type:object size:0x1 data:byte
oneFrameRate = .sdata:0x804528C0; // type:object size:0x4 scope:local align:4 data:float
oneFrameRateUser = .sdata:0x804528C4; // type:object size:0x4 scope:local align:4 data:float
cm2hw$552 = .sdata:0x804528C8; // type:object size:0x4 scope:local align:4
+4 -4
View File
@@ -63396,7 +63396,7 @@ __RTTI__12JUTException = .sdata:0x8074AE18; // type:object size:0x8 scope:global
@6861 = .sdata:0x8074AE20; // type:object size:0x3 scope:local data:string hash:0x0C9EC66C
sDisplayTime__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ = .sdata:0x8074AE28; // type:object size:0x4 scope:global data:4byte hash:0x14776654 dhash:0xB02A20B5
sDevice__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ = .sdata:0x8074AE2C; // type:object size:0x4 scope:global data:4byte hash:0xAB641663 dhash:0xDE80A722
lbl_8074AE30 = .sdata:0x8074AE30; // type:object size:0x1 data:byte hash:0xF164C2F5 dhash:0x13B63B34
mVisible__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ = .sdata:0x8074AE30; // type:object size:0x1 data:byte hash:0xF164C2F5 dhash:0x13B63B34
@21133 = .sdata:0x8074AE34; // type:object size:0x3 scope:local data:string hash:0xA0B9E9B7
@21184 = .sdata:0x8074AE38; // type:object size:0x4 scope:local data:string hash:0xA0B9EADB
@21235 = .sdata:0x8074AE3C; // type:object size:0x2 scope:local data:string hash:0xA0B9E5F2
@@ -64883,7 +64883,7 @@ lbl_8074CF80 = .sbss:0x8074CF80; // type:object size:0x1 data:byte hash:0x0135BA
sCurrentFifo__12JUTGraphFifo = .sbss:0x8074CF84; // type:object size:0x4 scope:global data:4byte hash:0x3E10453B dhash:0xADA054F8
mGpStatus__12JUTGraphFifo = .sbss:0x8074CF88; // type:object size:0x5 scope:global hash:0xE45701E9 dhash:0x776AE8CA
sDebugPrint__10JUTDbPrint = .sbss:0x8074CF90; // type:object size:0x4 scope:global data:4byte hash:0x80711BCB dhash:0x255411CA
lbl_8074CF98 = .sbss:0x8074CF98; // type:object size:0x1 data:byte hash:0x7D0B2177 dhash:0x111A89B6
mListInitialized__10JUTGamePad = .sbss:0x8074CF98; // type:object size:0x1 data:byte hash:0x7D0B2177 dhash:0x111A89B6
mPadAssign__10JUTGamePad = .sbss:0x8074CF9C; // type:object size:0x4 scope:global hash:0x7962D9AD dhash:0x16A8416C
sSuppressPadReset__10JUTGamePad = .sbss:0x8074CFA0; // type:object size:0x4 scope:global data:4byte hash:0x5E8C9776 dhash:0x876EE0B7
lbl_8074CFA4 = .sbss:0x8074CFA4; // type:object size:0x1 data:byte hash:0x79F03151 dhash:0x8212CF50
@@ -64894,7 +64894,7 @@ mEnabled__Q210JUTGamePad7CRumble = .sbss:0x8074CFB4; // type:object size:0x4 sco
sCallback__Q210JUTGamePad13C3ButtonReset = .sbss:0x8074CFB8; // type:object size:0x4 scope:global data:4byte hash:0xF1111C3C dhash:0x5261607C
sCallbackArg__Q210JUTGamePad13C3ButtonReset = .sbss:0x8074CFBC; // type:object size:0x4 scope:global data:4byte hash:0xCC5C4708 dhash:0x77A84D68
sThreshold__Q210JUTGamePad13C3ButtonReset = .sbss:0x8074CFC0; // type:object size:0x8 scope:global data:4byte hash:0xFCCCB7E2 dhash:0xE2BF2EC2
lbl_8074CFC8 = .sbss:0x8074CFC8; // type:object size:0x1 data:byte hash:0xBD6B48CC dhash:0x498A7ECC
sResetSwitchPushing__Q210JUTGamePad13C3ButtonReset = .sbss:0x8074CFC8; // type:object size:0x1 data:byte hash:0xBD6B48CC dhash:0x498A7ECC
sResetOccurred__Q210JUTGamePad13C3ButtonReset = .sbss:0x8074CFC9; // type:object size:0x1 data:byte hash:0x878FC37B dhash:0xB3FB803B
sResetOccurredPort__Q210JUTGamePad13C3ButtonReset = .sbss:0x8074CFCC; // type:object size:0x4 scope:global data:4byte hash:0xEAB52F22 dhash:0x4A01E002
sErrorManager__12JUTException = .sbss:0x8074CFD0; // type:object size:0x4 scope:global data:4byte hash:0x6DF35642 dhash:0x528F3581
@@ -64909,7 +64909,7 @@ fpscr__12JUTException = .sbss:0x8074CFF0; // type:object size:0x4 scope:global d
sDirectPrint__14JUTDirectPrint = .sbss:0x8074CFF8; // type:object size:0x4 scope:global data:4byte hash:0xAD5B2218 dhash:0x2B49FC9D
sMessageLife__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ = .sbss:0x8074D000; // type:object size:0x4 scope:global data:4byte hash:0xB70B9CD6 dhash:0x14F45BF7
sMessageOwner__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ = .sbss:0x8074D004; // type:object size:0x4 scope:global data:4byte hash:0xBFF3EE31 dhash:0xB3683D70
lbl_8074D008 = .sbss:0x8074D008; // type:object size:0x1 data:byte hash:0xFA6CFDB7 dhash:0xEDED67B6
mSynchro__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ = .sbss:0x8074D008; // type:object size:0x1 data:byte hash:0xFA6CFDB7 dhash:0xEDED67B6
sManager__8JUTVideo = .sbss:0x8074D010; // type:object size:0x4 scope:global data:4byte hash:0x55839787 dhash:0x9B46867F
sVideoLastTick__8JUTVideo = .sbss:0x8074D014; // type:object size:0x4 scope:global data:4byte hash:0xFF55AB9A dhash:0xA259C402
sVideoInterval__8JUTVideo = .sbss:0x8074D018; // type:object size:0x4 scope:global data:4byte hash:0xEBE85CBA dhash:0x5C483962
+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 {
+32 -28
View File
@@ -7,8 +7,6 @@
#include <stdio>
#include <dolphin/vi.h>
bool sAssertVisible = true;
namespace JUTAssertion {
void create() {}
@@ -36,15 +34,15 @@ u32 flush_subroutine() {
sMessageLife--;
}
if (sMessageLife >= 5) {
return sMessageLife;
if (sMessageLife < 5) {
return 0;
}
return 0;
return sMessageLife;
}
void flushMessage() {
if (flush_subroutine() && sAssertVisible == true) {
if (flush_subroutine() && mVisible == true) {
JUTDirectPrint* manager = JUTDirectPrint::getManager();
JUtility::TColor color = manager->getCharColor();
manager->setCharColor(JUtility::TColor(255, 200, 200, 255));
@@ -55,7 +53,7 @@ void flushMessage() {
}
void flushMessage_dbPrint() {
if (flush_subroutine() && sAssertVisible == true && JUTDbPrint::getManager() != NULL) {
if (flush_subroutine() && mVisible == true && JUTDbPrint::getManager() != NULL) {
JUTFont* font = JUTDbPrint::getManager()->getFont();
if (font != NULL) {
u8 tmp = ((VIGetRetraceCount() & 0x3C) << 2) | 0xF;
@@ -75,6 +73,7 @@ void setConfirmMessage(u32 param_1, char* file, int line, bool param_4, const ch
if (param_4 == 1) {
return;
}
int r30 = 0;
u32 r28 = sMessageLife;
if (r28 == 0 && (param_1 & 1) != 0) {
sMessageLife = sDisplayTime;
@@ -96,29 +95,30 @@ void showAssert_f_va(u32 device, const char* file, int line, const char* msg, va
OSReport("%s\n", sMessageString);
}
if ((device & 1) && JUTDirectPrint::getManager()) {
JUtility::TColor old_color(JUTDirectPrint::getManager()->getCharColor());
JUTDirectPrint::getManager()->setCharColor(JUtility::TColor(255, 255, 255, 255));
JUTDirectPrint::getManager()->erase(10, 16, 306, 24);
if ((device & 1)) {
JUTDirectPrint* directPrint = JUTDirectPrint::getManager();
if (directPrint) {
JUtility::TColor old_color(directPrint->getCharColor());
directPrint->setCharColor(JUtility::TColor(255, 255, 255, 255));
directPrint->erase(10, 16, 306, 24);
snprintf(sMessageFileLine, 63, "Failed assertion: %s:%d", file, line);
JUTDirectPrint::getManager()->drawString(16, 16, sMessageFileLine);
JUTDirectPrint::getManager()->drawString(16, 24, sMessageString);
snprintf(sMessageFileLine, 63, "Failed assertion: %s:%d", file, line);
directPrint->drawString(16, 16, sMessageFileLine);
directPrint->drawString(16, 24, sMessageString);
JUTDirectPrint::getManager()->setCharColor(old_color);
VISetNextFrameBuffer(JUTDirectPrint::getManager()->getFrameBuffer());
VIFlush();
OSEnableInterrupts();
directPrint->setCharColor(old_color);
VISetNextFrameBuffer(directPrint->getFrameBuffer());
VIFlush();
OSEnableInterrupts();
u32 retrace_count = VIGetRetraceCount();
u32 new_count;
do {
new_count = VIGetRetraceCount();
} while (retrace_count == new_count);
u32 retrace_count = VIGetRetraceCount();
do {
} while (retrace_count == VIGetRetraceCount());
// busy loop for 2 seconds
OSTime var1 = OSGetTime();
while (OSTicksToMilliseconds(OSGetTime() - var1) < 2000) {
// busy loop for 2 seconds
OSTime var1 = OSGetTime();
while (OSTicksToMilliseconds(OSGetTime() - var1) < 2000) {
}
}
}
}
@@ -191,11 +191,15 @@ void setLogMessage_f(u32 device, char* file, int line, const char* msg, ...) {
}
void setVisible(bool visible) {
sAssertVisible = visible;
mVisible = visible;
}
void setMessageCount(int msg_count) {
sMessageLife = msg_count <= 0 ? 0 : msg_count;
if (msg_count <= 0) {
sMessageLife = 0;
} else {
sMessageLife = msg_count;
}
}
}; // namespace JUTAssertion
+51 -61
View File
@@ -16,12 +16,9 @@ JUTCacheFont::JUTCacheFont(ResFONT const* p_fontRes, u32 cacheSize, JKRHeap* p_h
}
JUTCacheFont::~JUTCacheFont() {
if (isValid()) {
deleteMemBlocks_CacheFont();
initialize_state();
deleteMemBlocks_ResFont();
JUTResFont::initialize_state();
if (mValid) {
delete_and_initialize();
JUTResFont::delete_and_initialize();
JUTFont::initialize_state();
}
@@ -32,7 +29,7 @@ void JUTCacheFont::deleteMemBlocks_CacheFont() {
delete[] mCacheBuffer;
}
delete field_0xac;
JKRFreeToAram(field_0xac);
delete mInf1Ptr;
delete mMemBlocks;
delete field_0x7c;
@@ -149,10 +146,8 @@ int JUTCacheFont::initiate(ResFONT const* p_fontRes, void* param_1, u32 param_2,
bool JUTCacheFont::internal_initiate(ResFONT const* p_fontRes, void* param_1, u32 param_2,
JKRHeap* param_3) {
deleteMemBlocks_CacheFont();
initialize_state();
deleteMemBlocks_ResFont();
JUTResFont::initialize_state();
delete_and_initialize();
JUTResFont::delete_and_initialize();
JUTFont::initialize_state();
if (p_fontRes == NULL) {
@@ -174,7 +169,7 @@ bool JUTCacheFont::internal_initiate(ResFONT const* p_fontRes, void* param_1, u3
return true;
}
bool JUTCacheFont::allocArea(void* param_0, u32 param_1, JKRHeap* heap) {
bool JUTCacheFont::allocArea(void* cacheBuffer, u32 param_1, JKRHeap* heap) {
mInf1Ptr = (ResFONT::INF1*)new (heap, 0) ResFONT();
if (mInf1Ptr == NULL) {
return false;
@@ -193,8 +188,7 @@ bool JUTCacheFont::allocArea(void* param_0, u32 param_1, JKRHeap* heap) {
return false;
}
field_0xac = JKRAram::getManager()->mAramHeap->alloc(
mTotalGlySize - (mGly1BlockNum * sizeof(ResFONT::GLY1)), JKRAramHeap::HEAD);
field_0xac = JKRAllocFromAram(mTotalGlySize - (mGly1BlockNum * sizeof(ResFONT::GLY1)), JKRAramHeap::HEAD);
if (field_0xac == NULL) {
return false;
}
@@ -214,8 +208,9 @@ bool JUTCacheFont::allocArea(void* param_0, u32 param_1, JKRHeap* heap) {
return false;
}
if (param_0 != NULL) {
mCacheBuffer = param_0;
if (cacheBuffer != NULL) {
JUT_ASSERT(352, ( (u32)cacheBuffer & 0x1f ) == 0);
mCacheBuffer = cacheBuffer;
field_0xb0 = 0;
} else {
mCacheBuffer = new (heap, 0x20) u8[v1];
@@ -237,18 +232,18 @@ bool JUTCacheFont::allocArray(JKRHeap* param_0) {
void** blocks = mMemBlocks;
if (mWid1BlockNum) {
mpWidthBlocks = (ResFONT::WID1**)blocks;
mpWidthBlocks = new (blocks) ResFONT::WID1*[mWid1BlockNum];
blocks = blocks + mWid1BlockNum;
}
if (mGly1BlockNum) {
mpGlyphBlocks = (ResFONT::GLY1**)blocks;
mpGlyphBlocks = new (blocks) ResFONT::GLY1*[mGly1BlockNum];
blocks = blocks + mGly1BlockNum;
for (int i = 0; i < mGly1BlockNum; i++) {
mpGlyphBlocks[i] = (ResFONT::GLY1*)((u8*)mCacheBuffer + (field_0x94 * i));
}
}
}
if (mMap1BlockNum) {
mpMapBlocks = (ResFONT::MAP1**)blocks;
mpMapBlocks = new (blocks) ResFONT::MAP1*[mMap1BlockNum];
}
return true;
}
@@ -265,16 +260,19 @@ void JUTCacheFont::setBlock() {
const int* pData = (int*)mResFont->data;
for (int i = 0; i < mResFont->numBlocks; i++) {
u32 u;
switch (*pData) {
case 'INF1':
memcpy(mInf1Ptr, pData, 0x20);
mIsLeadByte = &JUTResFont::saoAboutEncoding_[mInf1Ptr->fontType];
u = mInf1Ptr->fontType;
JUT_ASSERT(448, u < suAboutEncoding_);
mIsLeadByte = &JUTResFont::saoAboutEncoding_[u];
break;
case 'WID1':
memcpy(pWidth, pData, pData[1]);
mpWidthBlocks[widthNum] = (ResFONT::WID1*)pWidth;
pWidth += pData[1];
widthNum++;
pWidth += pData[1];
break;
case 'GLY1':
memcpy(piVar5, pData, 0x20);
@@ -292,7 +290,7 @@ void JUTCacheFont::setBlock() {
mpGlyphBlocks[gylphNum] = piVar5;
gylphNum++;
piVar5++;
aramAddress = pData[1] + aramAddress - 0x20;
aramAddress += pData[1] - 0x20;
break;
case 'MAP1':
memcpy(pMap, pData, pData[1]);
@@ -313,27 +311,27 @@ void JUTCacheFont::setBlock() {
}
JUTCacheFont::TGlyphCacheInfo* JUTCacheFont::determineBlankPage() {
TGlyphCacheInfo* pVar1 = field_0xa4;
if (pVar1 != NULL) {
TGlyphCacheInfo* pVar1;
if (field_0xa4 != NULL) {
pVar1 = field_0xa4;
field_0xa4 = pVar1->mNext;
TGlyphCacheInfo* pVar2 = pVar1->mNext;
if (pVar2 == NULL) {
if (pVar1->mNext == NULL) {
field_0xa8 = 0;
} else {
pVar2->mPrev = NULL;
pVar1->mNext->mPrev = NULL;
}
return pVar1;
}
TGlyphCacheInfo* puVar1 = field_0xa0;
while (puVar1 != NULL) {
TGlyphCacheInfo* prev = puVar1->mPrev;
if (puVar1->field_0x1e == 0) {
unlink(puVar1);
pVar1 = field_0xa0;
while (pVar1 != NULL) {
TGlyphCacheInfo* prev = pVar1->mPrev;
if (pVar1->field_0x1e == 0) {
unlink(pVar1);
field_0xb4++;
return puVar1;
return pVar1;
}
puVar1 = prev;
pVar1 = prev;
}
return NULL;
@@ -342,19 +340,20 @@ JUTCacheFont::TGlyphCacheInfo* JUTCacheFont::determineBlankPage() {
void JUTCacheFont::getGlyphFromAram(JUTCacheFont::TGlyphCacheInfo* param_0,
JUTCacheFont::TCachePage* pCachePage, int* param_2, int* param_3) {
TGlyphCacheInfo* pGylphCacheInfo = pCachePage;
int* r30 = param_2;
memcpy(pGylphCacheInfo, param_0, sizeof(TGlyphCacheInfo));
prepend(pGylphCacheInfo);
int iVar3 = pGylphCacheInfo->field_0x16 * pGylphCacheInfo->field_0x18;
int iVar2 = *param_2 / iVar3;
int iVar2 = *r30 / iVar3;
pGylphCacheInfo->field_0x8 += iVar2 * iVar3;
u16 local_30 = pGylphCacheInfo->field_0x8 + iVar3 - 1;
pGylphCacheInfo->field_0xa = pGylphCacheInfo->field_0xa < local_30 ? pGylphCacheInfo->field_0xa : local_30;
*param_3 = iVar2;
*param_2 -= iVar2 * iVar3;
u8* addr =
*r30 -= iVar2 * iVar3;
u8* result =
JKRAramToMainRam((u32)param_0->mPrev + pGylphCacheInfo->field_0x10 * iVar2, pCachePage->mImage,
pGylphCacheInfo->field_0x10, EXPAND_SWITCH_UNKNOWN0, 0, NULL, 0xffffffff, NULL);
JUT_ASSERT(624, addr != NULL);
JUT_ASSERT(624, result);
GXInitTexObj(&pCachePage->mTexObj, pCachePage->mImage, pGylphCacheInfo->mWidth, pGylphCacheInfo->mHeight,
(GXTexFmt)pGylphCacheInfo->mTexFormat, GX_CLAMP, GX_CLAMP, GX_FALSE);
GXInitTexObjLOD(&pCachePage->mTexObj, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, GX_FALSE, GX_FALSE,
@@ -376,21 +375,23 @@ void JUTCacheFont::loadImage(int param_0, _GXTexMapID texMapId) {
JUTCacheFont::TCachePage* JUTCacheFont::loadCache_char_subroutine(int* param_0, bool param_1) {
TCachePage* rv = NULL;
int* r29 = param_0;
for (TCachePage* pCachePage = (TCachePage*)field_0x9c; pCachePage != NULL;
pCachePage = (TCachePage*)pCachePage->mNext)
{
if (pCachePage->field_0x8 <= *param_0 && *param_0 <= pCachePage->field_0xa) {
if (pCachePage->field_0x8 <= *r29 && *r29 <= pCachePage->field_0xa) {
rv = pCachePage;
*param_0 -= pCachePage->field_0x8;
*r29 -= pCachePage->field_0x8;
break;
}
}
if (rv == NULL) {
rv = NULL;
int i = 0;
for (; i < mGly1BlockNum; i++) {
if (mpGlyphBlocks[i]->startCode <= *param_0 && *param_0 <= mpGlyphBlocks[i]->endCode) {
*param_0 -= mpGlyphBlocks[i]->startCode;
if (mpGlyphBlocks[i]->startCode <= *r29 && *r29 <= mpGlyphBlocks[i]->endCode) {
*r29 -= mpGlyphBlocks[i]->startCode;
break;
}
}
@@ -400,7 +401,7 @@ JUTCacheFont::TCachePage* JUTCacheFont::loadCache_char_subroutine(int* param_0,
return NULL;
}
int texPageIdx;
getGlyphFromAram((JUTCacheFont::TGlyphCacheInfo*)mpGlyphBlocks[i], pBlankPage, param_0,
getGlyphFromAram((JUTCacheFont::TGlyphCacheInfo*)mpGlyphBlocks[i], pBlankPage, r29,
&texPageIdx);
mTexPageIdx = texPageIdx;
field_0x66 = i;
@@ -416,24 +417,13 @@ JUTCacheFont::TCachePage* JUTCacheFont::loadCache_char_subroutine(int* param_0,
}
void JUTCacheFont::invalidiateAllCache() {
int* piVar3 = (int*)mCacheBuffer;
for (int uVar2 = 0; uVar2 < mCachePage; uVar2++) {
int iVar1;
if (uVar2 == 0) {
iVar1 = 0;
} else {
iVar1 = (intptr_t)piVar3 - field_0x94;
}
*piVar3 = iVar1;
if (uVar2 == mCachePage - 1) {
iVar1 = 0;
} else {
iVar1 = (intptr_t)piVar3 + field_0x94;
}
piVar3[1] = iVar1;
piVar3 = (int*)((intptr_t)piVar3 + field_0x94);
int* cacheBuffer = (int*)mCacheBuffer;
for (int i = 0; i < mCachePage; i++) {
*cacheBuffer = i == 0 ? 0 : (intptr_t)cacheBuffer - field_0x94;
cacheBuffer[1] = i == mCachePage - 1 ? 0 : (intptr_t)cacheBuffer + field_0x94;
cacheBuffer = (int*)((intptr_t)cacheBuffer + field_0x94);
}
field_0xa8 = (intptr_t)piVar3 - field_0x94;
field_0xa8 = (intptr_t)cacheBuffer - field_0x94;
field_0xa4 = (TGlyphCacheInfo*)mCacheBuffer;
field_0x9c = NULL;
field_0xa0 = NULL;
+40 -35
View File
@@ -61,8 +61,8 @@ JUTConsole::JUTConsole(unsigned int param_0, unsigned int maxLines, bool param_2
field_0x6b = false;
mOutput = 1;
field_0x5c.set(0, 0, 0, 100);
field_0x60.set(0, 0, 0, 230);
field_0x5c = JUtility::TColor(0, 0, 0, 100);
field_0x60 = JUtility::TColor(0, 0, 0, 230);
field_0x64 = 8;
}
@@ -72,11 +72,13 @@ JUTConsole::~JUTConsole() {
}
size_t JUTConsole::getObjectSizeFromBufferSize(unsigned int param_0, unsigned int maxLines) {
return (param_0 + 2) * maxLines + sizeof(JUTConsole);
size_t result = (param_0 + 2) * maxLines + sizeof(JUTConsole);
return result;
}
size_t JUTConsole::getLineFromObjectSize(u32 bufferSize, unsigned int param_1) {
return (bufferSize - sizeof(JUTConsole)) / (param_1 + 2);
size_t result = (bufferSize - sizeof(JUTConsole)) / (param_1 + 2);
return result;
}
void JUTConsole::clear() {
@@ -104,12 +106,12 @@ void JUTConsole::doDraw(JUTConsole::EConsoleType consoleType) const {
font_yOffset = 2.0f + mFontSizeY;
if (consoleType != CONSOLE_TYPE_2) {
if (JUTVideo::getManager() == NULL) {
if (JUTGetVideoManager() == NULL) {
J2DOrthoGraph ortho(0.0f, 0.0f, 640.0f, 480.0f, -1.0f, 1.0f);
ortho.setPort();
} else {
J2DOrthoGraph ortho(0.0f, 0.0f, JUTVideo::getManager()->getFbWidth(),
JUTVideo::getManager()->getEfbHeight(), -1.0f, 1.0f);
J2DOrthoGraph ortho(0.0f, 0.0f, JUTGetVideoManager()->getFbWidth(),
JUTGetVideoManager()->getEfbHeight(), -1.0f, 1.0f);
ortho.setPort();
}
@@ -250,7 +252,7 @@ extern "C" void JUTConsole_print_f_va_(JUTConsole* console, const char* fmt, va_
JUT_ASSERT(563, console!=NULL);
char buf[1024];
vsnprintf(buf, sizeof(buf), fmt, args);
int len = vsnprintf(buf, sizeof(buf), fmt, args);
console->print(buf);
}
@@ -262,13 +264,13 @@ void JUTConsole::dumpToTerminal(unsigned int param_0) {
int r29 = field_0x34;
if (param_0 != -1) {
r29 = field_0x38;
for (int i = 0; i != param_0; i++) {
for (; param_0; param_0--) {
int r25 = prevIndex(r29);
if (getLineAttr(r25) == 0) {
break;
}
r29 = r25;
if (r25 == field_0x34) {
if (r29 == field_0x34) {
break;
}
}
@@ -277,7 +279,7 @@ void JUTConsole::dumpToTerminal(unsigned int param_0) {
int r27 = 0;
OS_REPORT("\n:::dump of console[%x]--------------------------------\n", this);
do {
while (true) {
u8* r28 = getLinePtr(r29);
u8 r24 = r28[-1];
if (r24 == 0) {
@@ -290,7 +292,10 @@ void JUTConsole::dumpToTerminal(unsigned int param_0) {
}
r29 = nextIndex(r29);
r27++;
} while (r29 != field_0x34);
if (r29 == field_0x34) {
break;
}
};
OS_REPORT(":::dump of console[%x] END----------------------------\n", this);
}
@@ -301,16 +306,13 @@ void JUTConsole::scroll(int scrollAmnt) {
if (scrollAmnt < -diff) {
scrollAmnt = -diff;
}
} else {
if (scrollAmnt > 0) {
int diff = diffIndex(field_0x34, field_0x38);
if (diff + 1 <= mHeight) {
scrollAmnt = 0;
} else {
diff = diffIndex(field_0x30, field_0x38);
if (scrollAmnt > (int)(diff - mHeight) + 1) {
scrollAmnt = (int)(diff - mHeight) + 1;
}
} else if (scrollAmnt > 0) {
if (diffIndex(field_0x34, field_0x38) + 1 <= mHeight) {
scrollAmnt = 0;
} else {
int r27 = diffIndex(field_0x30, field_0x38) - mHeight + 1;
if (scrollAmnt > r27) {
scrollAmnt = r27;
}
}
}
@@ -326,11 +328,13 @@ void JUTConsole::scroll(int scrollAmnt) {
}
int JUTConsole::getUsedLine() const {
return diffIndex(field_0x34, field_0x38);
int result = diffIndex(field_0x34, field_0x38);
return result;
}
int JUTConsole::getLineOffset() const {
return diffIndex(field_0x34, field_0x30);
int result = diffIndex(field_0x34, field_0x30);
return result;
}
JUTConsoleManager::JUTConsoleManager() {
@@ -345,9 +349,8 @@ JUTConsoleManager* JUTConsoleManager::createManager(JKRHeap* pHeap) {
pHeap = JKRGetCurrentHeap();
}
JUTConsoleManager* manager = new (pHeap, 0) JUTConsoleManager();
sManager = manager;
return manager;
sManager = new (pHeap, 0) JUTConsoleManager();
return sManager;
}
void JUTConsoleManager::appendConsole(JUTConsole* console) {
@@ -362,8 +365,8 @@ void JUTConsoleManager::appendConsole(JUTConsole* console) {
}
void JUTConsoleManager::removeConsole(JUTConsole* console) {
JUT_ASSERT(982, sManager != NULL && console != NULL);
JUT_ASSERT(985, soLink_.Find( console ) != soLink_.end());
JUT_ASSERT(984, sManager != NULL && console != NULL);
JUT_ASSERT(987, soLink_.Find( console ) != soLink_.end());
if (mActiveConsole == console) {
if (soLink_.size() <= 1) {
@@ -402,8 +405,7 @@ void JUTConsoleManager::drawDirect(bool waitRetrace) const {
u32 retrace_count = VIGetRetraceCount();
u32 new_count;
do {
new_count = VIGetRetraceCount();
} while (retrace_count == new_count);
} while (retrace_count == VIGetRetraceCount());
OSRestoreInterrupts(interrupt_status);
}
mDirectConsole->doDraw(JUTConsole::CONSOLE_TYPE_2);
@@ -443,13 +445,15 @@ extern "C" JUTConsole* JUTGetWarningConsole() {
extern "C" void JUTReportConsole_f_va(const char* fmt, va_list args) {
char buf[256];
int len;
if (JUTGetReportConsole() == NULL) {
vsnprintf(buf, sizeof(buf), fmt, args);
len = vsnprintf(buf, sizeof(buf), fmt, args);
OS_REPORT("%s", buf);
} else if (JUTGetReportConsole()->getOutput() &
(JUTConsole::OUTPUT_CONSOLE | JUTConsole::OUTPUT_OSREPORT))
{
vsnprintf(buf, sizeof(buf), fmt, args);
len = vsnprintf(buf, sizeof(buf), fmt, args);
JUTGetReportConsole()->print(buf);
}
}
@@ -472,14 +476,15 @@ void JUTReportConsole(const char* message) {
void JUTWarningConsole_f_va(const char* fmt, va_list args) {
char buf[256];
int len;
if (JUTGetWarningConsole() == NULL) {
vsnprintf(buf, sizeof(buf), fmt, args);
len = vsnprintf(buf, sizeof(buf), fmt, args);
OSReport("%s", buf);
} else if (JUTGetWarningConsole()->getOutput() &
(JUTConsole::OUTPUT_CONSOLE | JUTConsole::OUTPUT_OSREPORT))
{
vsnprintf(buf, sizeof(buf), fmt, args);
len = vsnprintf(buf, sizeof(buf), fmt, args);
JUTGetWarningConsole()->print(buf);
}
}
+6 -8
View File
@@ -9,8 +9,8 @@
JUTDbPrint::JUTDbPrint(JUTFont* pFont, JKRHeap* pHeap) {
mFont = pFont;
mFirst = NULL;
mHeap = pHeap != NULL ? pHeap : JKRHeap::getCurrentHeap();
mColor.set(255, 255, 255, 255);
mHeap = pHeap != NULL ? pHeap : JKRGetCurrentHeap();
mColor = JUtility::TColor(255, 255, 255, 255);
mVisible = true;
}
@@ -19,7 +19,7 @@ JUTDbPrint* JUTDbPrint::sDebugPrint;
JUTDbPrint* JUTDbPrint::start(JUTFont* pFont, JKRHeap* pHeap) {
if (sDebugPrint == NULL) {
if (pHeap == NULL) {
pHeap = JKRHeap::getCurrentHeap();
pHeap = JKRGetCurrentHeap();
}
sDebugPrint = new JUTDbPrint(pFont, pHeap);
}
@@ -35,7 +35,7 @@ JUTFont* JUTDbPrint::changeFont(JUTFont* pFont) {
return old;
}
void JUTDbPrint::enter(int param_0, int param_1, int param_2, char const* param_3, int param_4) {
void JUTDbPrint::enter(int param_0, int param_1, int param_2, const char* param_3, int param_4) {
if (param_4 > 0) {
unk_print* ptr = static_cast<unk_print*>(JKRAllocFromHeap(mHeap, param_4 + 0x10, -4));
if (ptr != NULL) {
@@ -82,10 +82,8 @@ void JUTDbPrint::flush(int param_0, int param_1, int param_2, int param_3) {
}
}
void JUTDbPrint::drawString(int param_0, int param_1, int param_2, u8 const* param_3) {
JUTFont* font = mFont;
font->drawString_size_scale(param_0, param_1, font->getWidth(), font->getHeight(),
(const char*)param_3, param_2, true);
void JUTDbPrint::drawString(int posX, int posY, int len, const u8* str) {
mFont->drawString_size(posX, posY, (const char*)str, len, true);
}
void JUTReport(int param_0, int param_1, char const* fmt, ...) {
+18 -14
View File
@@ -54,27 +54,33 @@ bool JUTDirectFile::fopen(const char* filename) {
return false;
}
int interrupts2 = OSEnableInterrupts();
interrupts = OSEnableInterrupts();
mLength = mFileInfo.length;
OSRestoreInterrupts(interrupts2);
OSRestoreInterrupts(interrupts);
mPos = 0;
mIsOpen = true;
return true;
}
static void dummy(JUTDirectFile* directFile) {
directFile->isOpened();
}
void JUTDirectFile::fclose() {
if (mIsOpen) {
int interrupts = OSEnableInterrupts();
DVDClose(&mFileInfo);
OSRestoreInterrupts(interrupts);
mIsOpen = false;
if (!isOpened()) {
return;
}
int interrupts = OSEnableInterrupts();
DVDClose(&mFileInfo);
OSRestoreInterrupts(interrupts);
mIsOpen = false;
}
int JUTDirectFile::fgets(void* buf, int len) {
// if file isn't open, return error (-1).
if (!mIsOpen) {
if (!isOpened()) {
return -1;
}
@@ -86,6 +92,7 @@ int JUTDirectFile::fgets(void* buf, int len) {
// if desired length to get is 1, return 1.
// (final byte gotten is always 0, so len 1 is pointless).
if (len == 1) {
buf = NULL;
return 1;
}
@@ -99,10 +106,8 @@ int JUTDirectFile::fgets(void* buf, int len) {
return -1;
}
int readMax;
u8* byteBuf = (u8*)buf;
int readCount = 0;
readMax = len - 1; // desired bytes of data to get (last value is then 0).
while (mPos < mLength) {
// if there's nothing left to read, return error.
@@ -113,14 +118,13 @@ int JUTDirectFile::fgets(void* buf, int len) {
// read in each chunk.
u32 currPos = mPos & (JUTDF_BUFSIZE - 1);
u32 chunkSize = (mToRead - currPos);
if (readCount + chunkSize > readMax) {
if (readCount + chunkSize > len - 1) {
chunkSize = len - readCount - 1;
}
BOOL isAtEnd = FALSE;
for (int i = 0; i < chunkSize; i++) {
u8 byte = mSectorStart[currPos];
currPos++;
u8 byte = mSectorStart[currPos++];
*byteBuf++ = byte;
// if we hit the end of a line, stop reading.
@@ -149,7 +153,7 @@ int JUTDirectFile::fgets(void* buf, int len) {
readCount += chunkSize;
// if we're at (or beyond) our desired length, set final byte to 0 and stop reading.
if (readCount >= readMax) {
if (readCount >= len - 1) {
*byteBuf = 0;
break;
}
+20 -34
View File
@@ -81,14 +81,9 @@ u32 JUTDirectPrint::sFontData2[77] = {
0xF8000000, 0x10000000, 0x20000000, 0x40000000, 0xF8000000,
};
static u32 twiceBit[4] = {
0,
3,
12,
15,
};
void JUTDirectPrint::drawChar(int position_x, int position_y, int ch) {
static u32 twiceBit[4] = { 0, 3, 12, 15 };
int codepoint = (100 <= ch) ? ch - 100 : ch;
int col_index = (codepoint % 5) * 6;
int row_index = (codepoint / 5) * 7;
@@ -99,46 +94,39 @@ void JUTDirectPrint::drawChar(int position_x, int position_y, int ch) {
int scale_y = (mFrameBufferHeight < 300) ? 1 : 2;
u16 *pixel = mFrameBuffer + mStride * position_y * scale_y + position_x * scale_x;
for (int y = 0; y < 7; y++)
{
u32 data = *font_data << col_index;
font_data += 1;
for (int y = 0; y < 7; y++) {
u32 data = *font_data++ << col_index;
if (scale_x == 1)
{
if (scale_x == 1) {
data = (data & 0xfc000000) >> 1;
}
else
{
u32 a = twiceBit[(data >> 26) & 3];
u32 b = twiceBit[(data >> 28) & 3] << 4;
u32 c = twiceBit[(data >> 30) & 3] << 8;
data = (a | b | c) << 19;
} else {
data = (twiceBit[(data >> 26) & 3] | twiceBit[(data >> 28) & 3] << 4 | twiceBit[(data >> 30) & 3] << 8) << 19;
}
for (int x = 0; x < scale_x * 6; x += 2)
{
for (int x = 0; x < scale_x * 6; x += 2) {
u16 value;
value = (((data & 0x40000000) ? mCharColor_Y : 0) |
((data & 0x80000000) ? mCharColor_Cb4 : 32) +
((data & 0x40000000) ? mCharColor_Cb2 : 64) +
((data & 0x20000000) ? mCharColor_Cb4 : 32));
pixel[0] = value;
if (scale_y > 1)
*pixel = value;
if (scale_y > 1) {
pixel[mStride] = value;
}
pixel++;
value = (((data & 0x20000000) ? mCharColor_Y : 0) |
((data & 0x40000000) ? mCharColor_Cr4 : 32) +
((data & 0x20000000) ? mCharColor_Cr2 : 64) +
((data & 0x10000000) ? mCharColor_Cr4 : 32));
pixel[1] = value;
if (scale_y > 1)
pixel[1 + mStride] = value;
*pixel = value;
if (scale_y > 1) {
pixel[mStride] = value;
}
pixel++;
pixel += 2;
data <<= 2;
}
pixel += mStride * scale_y - 6 * scale_x;
@@ -172,12 +160,10 @@ void JUTDirectPrint::printSub(u16 position_x, u16 position_y, char const* format
for (; 0 < buffer_length; buffer_length--, ptr++) {
int codepoint = sAsciiTable[*ptr & 0x7f];
if (codepoint == 0xfe) {
position_x = x;
position_y += 7;
position_x = x;
} else if (codepoint == 0xfd) {
s32 current_position = (int)position_x;
s32 tab = (current_position - x + 0x2f) % 0x30;
position_x = current_position + 0x30 - tab;
position_x = position_x + 0x30 - ((position_x - x + 0x2f) % 0x30);
} else {
if (codepoint != 0xff) {
drawChar(position_x, position_y, codepoint);
@@ -217,7 +203,7 @@ void JUTDirectPrint::setCharColor(JUtility::TColor color) {
}
void JUTDirectPrint::setCharColor(u8 r, u8 g, u8 b) {
mCharColor.set(r, g, b, 0xFF);
mCharColor = JUtility::TColor(r, g, b, 0xFF);
int Cb = -0.148 * (int)r - 0.291 * (int)g + 0.439 * (int)b + 128;
int Cr = 0.439 * (int)r - 0.368 * (int)g - 0.071 * (int)b + 128;
+71 -77
View File
@@ -52,7 +52,8 @@ JUTException::JUTException(JUTDirectPrint* directPrint)
sPreUserCallback = NULL;
sPostUserCallback = NULL;
setGamePad(NULL);
mGamePad = NULL;
mGamePadPort = JUTGamePad::EPortInvalid;
this->mPrintWaitTime0 = 10;
this->mPrintWaitTime1 = 10;
@@ -64,8 +65,7 @@ JUTException::JUTException(JUTDirectPrint* directPrint)
JUTException* JUTException::create(JUTDirectPrint* directPrint) {
if (!sErrorManager) {
JKRHeap* systemHeap = JKRGetSystemHeap();
sErrorManager = new (systemHeap, 0) JUTException(directPrint);
sErrorManager = new (JKRGetSystemHeap(), 0) JUTException(directPrint);
sErrorManager->resume();
}
@@ -85,7 +85,9 @@ struct CallbackObject {
};
void* JUTException::run() {
PPCMtmsr(PPCMfmsr() & ~0x0900);
u32 msr = PPCMfmsr();
msr &= ~0x0900;
PPCMtmsr(msr);
OSInitMessageQueue(&sMessageQueue, sMessageBuffer, 1);
OSMessage message;
while (true) {
@@ -161,9 +163,8 @@ void JUTException::panic_f_va(char const* file, int line, char const* format, va
OSPanic((char*)file, line, buffer);
}
OSContext* current_context = OSGetCurrentContext();
static OSContext context;
memcpy(&context, current_context, sizeof(OSContext));
memcpy(&context, OSGetCurrentContext(), sizeof(OSContext));
sErrorManager->mStackPointer = (uintptr_t)OSGetStackPointer();
exCallbackObject.callback = sPreUserCallback;
@@ -181,8 +182,7 @@ void JUTException::panic_f_va(char const* file, int line, char const* format, va
}
OSSendMessage(&sMessageQueue, &exCallbackObject, 1);
OSThread* current_thread = OSGetCurrentThread();
OSSuspendThread(current_thread);
OSSuspendThread(OSGetCurrentThread());
}
void JUTException::panic_f(char const* file, int line, char const* format, ...) {
@@ -249,7 +249,7 @@ bool JUTException::searchPartialModule(u32 address, u32* module_id, u32* section
OSModuleInfo* module = *(OSModuleInfo**)0x800030C8;
while (module) {
OSSectionInfo* section = (OSSectionInfo*)module->sectionInfoOffset;
for (u32 i = 0; i < module->numSections; section = section + 1, i++) {
for (u32 i = 0; i < module->numSections; i++) {
if (section->size) {
u32 addr = ALIGN_PREV(section->offset, 2);
if ((addr <= address) && (address < addr + section->size)) {
@@ -264,6 +264,7 @@ bool JUTException::searchPartialModule(u32 address, u32* module_id, u32* section
return true;
}
}
section++;
}
module = (OSModuleInfo*)module->link.next;
@@ -273,21 +274,21 @@ bool JUTException::searchPartialModule(u32 address, u32* module_id, u32* section
}
static void search_name_part(u8* src, u8* dst, int dst_length) {
u8* r30 = src;
for (u8* p = src; *p; p++) {
if (*p == '\\') {
src = p;
r30 = p;
}
}
if (*src == '\\') {
src++;
if (*r30 == '\\') {
r30++;
}
for (int i = 0; (*src != 0) && (i < dst_length);) {
if (*src == '.')
for (int i = 0; (*r30 != 0) && (i < dst_length); *dst++ = *r30++, i++) {
if (*r30 == '.') {
break;
*dst++ = *src++;
i++;
}
}
*dst = '\0';
@@ -311,8 +312,7 @@ void JUTException::showStack(OSContext* context) {
sConsole->print_f("%08X: %08X %08X\n", stackPointer, stackPointer[0], stackPointer[1]);
showMapInfo_subroutine(stackPointer[1], false);
JUTConsoleManager* manager = JUTConsoleManager::sManager;
manager->drawDirect(true);
JUTConsoleManager::getManager()->drawDirect(true);
waitTime(mPrintWaitTime1);
stackPointer = (u32*)stackPointer[0];
}
@@ -330,7 +330,8 @@ void JUTException::showMainInfo(u16 error, OSContext* context, u32 dsisr, u32 da
}
if (error == __OS_EXCEPTION_FLOATING_POINT_EXCEPTION) {
u32 flags = fpscr & (((fpscr & 0xf8) << 0x16) | 0x1f80700);
u32 flags = fpscr;
flags &= ((flags & 0xf8) << 0x16) | 0x1f80700;
if ((flags & 0x20000000) != 0) {
sConsole->print_f(" FPE: Invalid operation\n");
if ((fpscr & 0x1000000) != 0) {
@@ -407,31 +408,30 @@ bool JUTException::showMapInfo_subroutine(u32 address, bool begin_with_newline)
new_line = "";
}
bool result =
searchPartialModule(address, &module_id, &section_id, &section_offset, &name_offset);
bool result = searchPartialModule(address, &module_id, &section_id, &section_offset, &name_offset);
if (result == true) {
search_name_part((u8*)name_offset, name_part, 32);
sConsole->print_f("%s %s:%x section:%d\n", new_line, name_part, section_offset, section_id);
new_line = "";
begin_with_newline = false;
}
JSUListIterator<JUTException::JUTExMapFile> last = sMapFileList.getEnd();
JSUListIterator<JUTException::JUTExMapFile> first = sMapFileList.getFirst();
if (first != last) {
JSULink<JUTException::JUTExMapFile>* last = sMapFileList.getEnd();
if (sMapFileList.getFirst() != last) {
u32 out_addr;
u32 out_size;
char out_line[256];
bool result2;
if (result == true) {
result =
result2 =
queryMapAddress((char*)name_part, section_offset, section_id, &out_addr, &out_size,
out_line, ARRAY_SIZEU(out_line), true, begin_with_newline);
} else {
result = queryMapAddress(NULL, address, -1, &out_addr, &out_size, out_line,
result2 = queryMapAddress(NULL, address, -1, &out_addr, &out_size, out_line,
ARRAY_SIZEU(out_line), true, begin_with_newline);
}
if (result == true) {
if (result2 == true) {
return true;
}
}
@@ -454,10 +454,11 @@ void JUTException::showGPRMap(OSContext* context) {
found_address_register = true;
sConsole->print_f("R%02d: %08XH", i, address);
if (!showMapInfo_subroutine(address, true)) {
bool result = showMapInfo_subroutine(address, true);
if (!result) {
sConsole->print(" no information\n");
}
JUTConsoleManager::sManager->drawDirect(true);
JUTConsoleManager::getManager()->drawDirect(true);
waitTime(mPrintWaitTime1);
}
}
@@ -476,7 +477,8 @@ void JUTException::showSRR0Map(OSContext* context) {
u32 address = context->srr0;
if (address >= 0x80000000 && address <= 0x83000000 - 1) {
sConsole->print_f("SRR0: %08XH", address);
if (showMapInfo_subroutine(address, true) == false) {
bool result = showMapInfo_subroutine(address, true);
if (result == false) {
sConsole->print(" no information\n");
}
JUTConsoleManager::getManager()->drawDirect(true);
@@ -487,7 +489,8 @@ void JUTException::printDebugInfo(JUTException::EInfoPage page, OSError error, O
u32 param_3, u32 param_4) {
switch (page) {
case EINFO_PAGE_GPR:
return showGPR(context);
showGPR(context);
break;
case EINFO_PAGE_FLOAT:
showFloat(context);
if (sConsole) {
@@ -495,11 +498,14 @@ void JUTException::printDebugInfo(JUTException::EInfoPage page, OSError error, O
}
break;
case EINFO_PAGE_STACK:
return showStack(context);
showStack(context);
break;
case EINFO_PAGE_GPR_MAP:
return showGPRMap(context);
showGPRMap(context);
break;
case EINFO_PAGE_SSR0_MAP:
return showSRR0Map(context);
showSRR0Map(context);
break;
}
}
@@ -510,7 +516,10 @@ bool JUTException::isEnablePad() const {
if (mGamePadPort >= 0)
return true;
return mGamePad;
if (mGamePad) {
return true;
}
return false;
}
bool JUTException::readPad(u32* out_trigger, u32* out_button) {
@@ -528,7 +537,7 @@ bool JUTException::readPad(u32* out_trigger, u32* out_button) {
JUTGamePad gamePad1(JUTGamePad::EPort2);
JUTGamePad gamePad2(JUTGamePad::EPort3);
JUTGamePad gamePad3(JUTGamePad::EPort4);
JUTGamePad::read();
JUTReadGamePad();
c3bcnt[0] =
(gamePad0.isPushing3ButtonReset() ? (c3bcnt[0] != 0 ? c3bcnt[0] : OSGetTime()) : 0);
@@ -568,7 +577,7 @@ bool JUTException::readPad(u32* out_trigger, u32* out_button) {
OSTime resetTime = (gamePadTime != 0) ? (OSGetTime() - gamePadTime) : 0;
gamePad.checkResetCallback(resetTime);
JUTGamePad::read();
JUTReadGamePad();
if (out_trigger) {
*out_trigger = gamePad.getTrigger();
}
@@ -578,7 +587,7 @@ bool JUTException::readPad(u32* out_trigger, u32* out_button) {
result = true;
} else if (mGamePad) {
JUTGamePad::read();
JUTReadGamePad();
if (out_trigger) {
*out_trigger = mGamePad->getTrigger();
}
@@ -594,7 +603,7 @@ bool JUTException::readPad(u32* out_trigger, u32* out_button) {
// clean up
void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u32 dar) {
bool is_pad_enabled = isEnablePad() == 0;
bool is_pad_enabled = isEnablePad() ? false : true;
if (!sErrorManager->mDirectPrint->isActive()) {
return;
}
@@ -619,37 +628,37 @@ void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u3
while (true) {
showMainInfo(error, context, dsisr, dar);
JUTConsoleManager::sManager->drawDirect(true);
JUTConsoleManager::getManager()->drawDirect(true);
waitTime(mPrintWaitTime0);
if ((mPrintFlags & JUT_PRINT_GPR) != 0) {
printDebugInfo(EINFO_PAGE_GPR, error, context, dsisr, dar);
JUTConsoleManager::sManager->drawDirect(true);
JUTConsoleManager::getManager()->drawDirect(true);
waitTime(mPrintWaitTime0);
}
if ((mPrintFlags & JUT_PRINT_SRR0_MAP) != 0) {
printDebugInfo(EINFO_PAGE_SSR0_MAP, error, context, dsisr, dar);
JUTConsoleManager::sManager->drawDirect(true);
JUTConsoleManager::getManager()->drawDirect(true);
waitTime(mPrintWaitTime0);
}
if ((mPrintFlags & JUT_PRINT_GPR_MAP) != 0) {
printDebugInfo(EINFO_PAGE_GPR_MAP, error, context, dsisr, dar);
JUTConsoleManager::sManager->drawDirect(true);
JUTConsoleManager::getManager()->drawDirect(true);
waitTime(mPrintWaitTime0);
}
if ((mPrintFlags & JUT_PRINT_FLOAT) != 0) {
printDebugInfo(EINFO_PAGE_FLOAT, error, context, dsisr, dar);
JUTConsoleManager::sManager->drawDirect(true);
JUTConsoleManager::getManager()->drawDirect(true);
waitTime(mPrintWaitTime0);
}
if ((mPrintFlags & JUT_PRINT_STACK) != 0) {
printDebugInfo(EINFO_PAGE_STACK, error, context, dsisr, dar);
JUTConsoleManager::sManager->drawDirect(true);
JUTConsoleManager::getManager()->drawDirect(true);
waitTime(mPrintWaitTime1);
}
sConsole->print("--------------------------------\n");
JUTConsoleManager::sManager->drawDirect(true);
JUTConsoleManager::getManager()->drawDirect(true);
if (post_callback_executed == 0 && sPostUserCallback) {
BOOL enable = OSEnableInterrupts();
@@ -662,7 +671,8 @@ void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u3
break;
}
sConsole->setOutput(sConsole->getOutput() & 1);
u32 output = sConsole->getOutput();
sConsole->setOutput(output & 1);
}
if (!is_pad_enabled) {
@@ -688,21 +698,15 @@ void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u3
}
if (button == 8) {
JUTConsole* console = sConsole;
up = (down < 3) ? -1 : ((down < 5) ? -2 : ((down < 7) ? -4 : -8));
console->scroll(up);
sConsole->scroll((down < 3) ? -1 : ((down < 5) ? -2 : ((down < 7) ? -4 : -8)));
draw = true;
up = 0;
down++;
up = 0;
} else if (button == 4) {
JUTConsole* console = sConsole;
down = (up < 3) ? 1 : ((up < 5) ? 2 : ((up < 7) ? 4 : 8));
console->scroll(down);
sConsole->scroll((up < 3) ? 1 : ((up < 5) ? 2 : ((up < 7) ? 4 : 8)));
draw = true;
down = 0;
up++;
down = 0;
} else {
down = 0;
up = 0;
@@ -712,7 +716,7 @@ void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u3
u32 start = VIGetRetraceCount();
while (start == VIGetRetraceCount())
;
JUTConsoleManager::sManager->drawDirect(true);
JUTConsoleManager::getManager()->drawDirect(true);
}
waitTime(30);
@@ -721,7 +725,7 @@ void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u3
while (true) {
sConsole->scrollToFirstLine();
JUTConsoleManager::sManager->drawDirect(true);
JUTConsoleManager::getManager()->drawDirect(true);
waitTime(2000);
int line_offset;
@@ -730,23 +734,15 @@ void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u3
next:
for (u32 i = sConsole->getHeight(); i > 0; i--) {
sConsole->scroll(1);
JUTConsoleManager::sManager->drawDirect(true);
JUTConsoleManager::getManager()->drawDirect(true);
height = sConsole->getHeight();
JUTConsole* console = sConsole;
line_offset = console->getLineOffset();
used_line = console->getUsedLine();
if ((used_line - height) + 1U <= line_offset)
if ((sConsole->getUsedLine() - sConsole->getHeight()) + 1U <= sConsole->getLineOffset())
break;
waitTime(20);
}
waitTime(3000);
height = sConsole->getHeight();
JUTConsole* console = sConsole;
line_offset = console->getLineOffset();
used_line = console->getUsedLine();
if ((used_line - height) + 1U <= line_offset) {
if ((sConsole->getUsedLine() - sConsole->getHeight()) + 1U <= sConsole->getLineOffset()) {
continue;
}
goto next;
@@ -810,8 +806,7 @@ void JUTException::appendMapFile(char const* path) {
return;
}
JSUListIterator<JUTExMapFile> iterator;
for (iterator = sMapFileList.getFirst(); iterator != sMapFileList.getEnd(); ++iterator) {
for (JSUListIterator<JUTExMapFile> iterator = sMapFileList.getFirst(); iterator != sMapFileList.getEnd(); iterator++) {
if (strcmp(path, iterator->mPath) == 0) {
return;
}
@@ -833,7 +828,7 @@ bool JUTException::queryMapAddress(char* mapPath, u32 address, s32 section_id, u
{
return true;
}
} else if (sMapFileList.getFirst() != sMapFileList.getEnd()) {
} else if (sMapFileList.getFirst()) {
if (queryMapAddress_single(sMapFileList.getFirst()->getObject()->mPath, address, -1,
out_addr, out_size, out_line, line_length, print,
begin_with_newline) == true)
@@ -979,10 +974,9 @@ void JUTException::createConsole(void* console_buffer, u32 console_buffer_size)
if (lines != 0) {
sConsoleBuffer = console_buffer;
sConsoleBufferSize = console_buffer_size;
sConsole = JUTConsole::create(0x32, console_buffer, console_buffer_size);
sConsole = JUTConsole::create(0x32, sConsoleBuffer, sConsoleBufferSize);
JUTConsoleManager* manager = JUTConsoleManager::sManager;
manager->setDirectConsole(sConsole);
JUTConsoleManager::getManager()->setDirectConsole(sConsole);
sConsole->setFontSize(10.0, 6.0);
sConsole->setPosition(15, 26);
+5 -7
View File
@@ -51,13 +51,11 @@ void JUTFader::control() {
}
void JUTFader::draw() {
if (mColor.a == 0) {
return;
}
J2DOrthoGraph orthograph;
orthograph.setColor(mColor);
orthograph.fillBox(mBox);
if (mColor.a != 0) {
J2DOrthoGraph orthograph;
orthograph.setColor(mColor);
orthograph.fillBox(mBox);
}
}
bool JUTFader::startFadeIn(int param_0) {
+5 -5
View File
@@ -12,9 +12,8 @@ JUTFont::JUTFont() : mColor1(), mColor2(), mColor3(), mColor4() {
}
void JUTFont::initialize_state() {
setCharColor(JUtility::TColor());
mFixed = false;
mFixedWidth = 0;
setCharColor(-1);
setFixedWidth(false, 0);
mValid = false;
}
@@ -36,14 +35,15 @@ f32 JUTFont::drawString_size_scale(f32 a1, f32 a2, f32 a3, f32 a4, const char* s
bool a7) {
f32 temp = a1;
for (; usz > 0; usz--, str++) {
for (; usz > 0; --usz, ++str) {
u32 c = *(u8*)str;
u32 b = c;
if (isLeadByte(b)) {
JUT_ASSERT(114, usz >= 2);
usz--;
str++;
b <<= 8;
b |= *(u8*)str;
usz--;
}
a1 += drawChar_scale(a1, a2, a3, a4, b, a7);
+44 -29
View File
@@ -80,7 +80,7 @@ u32 JUTGamePad::sRumbleSupported;
u32 JUTGamePad::read() {
sRumbleSupported = PADRead(mPadStatus);
switch (sClampMode) {
switch (getClampMode()) {
case EClampStick:
PADClamp(mPadStatus);
break;
@@ -115,7 +115,7 @@ u32 JUTGamePad::read() {
}
}
for (JSUListIterator<JUTGamePad> pad(mPadList.getFirst()); pad != mPadList.getEnd(); pad++) {
for (JSUListIterator<JUTGamePad> pad(mPadList.getFirst()); pad != mPadList.getEnd(); ++pad) {
if (pad->getPadReplay() != NULL && pad->getPadReplay()->isActive()) {
PADStatus status;
pad->getPadReplay()->getStatus(&status);
@@ -162,7 +162,7 @@ void JUTGamePad::assign() {
}
}
bool JUTGamePad::CRumble::mStatus[4];
u8 JUTGamePad::CRumble::mStatus[4];
u32 JUTGamePad::CRumble::mEnabled;
@@ -246,6 +246,7 @@ JSUList<JUTGamePadLongPress> JUTGamePadLongPress::sPatternList(false);
void JUTGamePad::checkResetSwitch() {
if (!JUTGamePad::C3ButtonReset::sResetOccurred) {
int unused;
if (OSGetResetSwitchState()) {
C3ButtonReset::sResetSwitchPushing = true;
} else {
@@ -284,14 +285,7 @@ void JUTGamePad::CButton::clear() {
}
void JUTGamePad::CButton::update(const PADStatus* padStatus, u32 stickStatus) {
u32 buttons;
if (padStatus != NULL) {
buttons = padStatus->button;
} else {
buttons = 0;
}
buttons = stickStatus | buttons;
u32 buttons = stickStatus | (padStatus != NULL ? padStatus->button : 0);
mRepeat = 0;
if (mRepeatDelay != 0 && mRepeatMask != 0) {
@@ -347,7 +341,7 @@ void JUTGamePad::CStick::clear() {
u32 JUTGamePad::CStick::update(s8 x, s8 y, JUTGamePad::EStickMode mode,
JUTGamePad::EWhichStick stick, u32 buttons) {
s32 clamp;
switch (sClampMode) {
switch (getClampMode()) {
case EClampStick:
clamp = stick == EMainStick ? 54 : 42;
break;
@@ -385,8 +379,7 @@ u32 JUTGamePad::CStick::update(s8 x, s8 y, JUTGamePad::EStickMode mode,
}
}
u32 button_shift = stick == EMainStick ? 0x18 : 0x10;
return getButton(buttons >> button_shift);
return getButton(buttons >> (stick == EMainStick ? 0x18 : 0x10));
}
u32 JUTGamePad::CStick::getButton(u32 buttons) {
@@ -436,8 +429,13 @@ void JUTGamePad::CRumble::startMotor(int port) {
}
void JUTGamePad::CRumble::stopMotor(int port, bool hard_stop) {
u8 command;
if (isEnabledPort(port)) {
u8 command = hard_stop ? PAD_MOTOR_STOP_HARD : PAD_MOTOR_STOP;
if (hard_stop) {
command = PAD_MOTOR_STOP_HARD;
} else {
command = PAD_MOTOR_STOP;
}
PADControlMotor(port, command);
mStatus[port] = false;
}
@@ -484,7 +482,7 @@ void JUTGamePad::CRumble::update(s16 port) {
if (status) {
stopMotor(port, hard_stop);
} else if (hard_stop) {
stopMotorHard(port);
stopMotor(port, true);
}
}
}
@@ -518,18 +516,18 @@ void JUTGamePad::CRumble::startPatternedRumble(void* data, JUTGamePad::CRumble::
}
void JUTGamePad::CRumble::stopPatternedRumble(s16 port) {
JUT_ASSERT(1341, 0 <= port && port < 4);
mLength = 0;
stopMotorHard(port);
}
void JUTGamePad::CRumble::stopPatternedRumbleAtThePeriod() {
u32 r31 = mFrame % mFrameCount;
mLength = (mFrame + mFrameCount - 1) % mFrameCount;
}
JUTGamePad* JUTGamePad::getGamePad(int port) {
JSUListIterator<JUTGamePad> pad(mPadList.getFirst());
for (; pad != mPadList.getEnd(); pad++) {
for (JSUListIterator<JUTGamePad> pad(mPadList.getFirst()); pad != mPadList.getEnd(); ++pad) {
if (port == pad->mPortNum) {
return pad.getObject();
}
@@ -539,20 +537,21 @@ JUTGamePad* JUTGamePad::getGamePad(int port) {
}
void JUTGamePad::CRumble::setEnabled(u32 mask) {
mask = (mask & (PAD_CHAN3_BIT | PAD_CHAN2_BIT | PAD_CHAN1_BIT | PAD_CHAN0_BIT));
for (int i = 0; i < 4; i++) {
if ((mEnabled & channel_mask[i]) == 0) {
if (mStatus[i]) {
stopMotor(i, false);
stopMotor(i);
}
JUTGamePad* pad = getGamePad(i);
if (pad != NULL) {
pad->mRumble.stopPatternedRumble(pad->mPortNum);
pad->stopMotorWaveHard();
}
}
}
mEnabled = (mask & (PAD_CHAN3_BIT | PAD_CHAN2_BIT | PAD_CHAN1_BIT | PAD_CHAN0_BIT));
mEnabled = mask;
}
void JUTGamePad::CButton::setRepeat(u32 mask, u32 delay, u32 rate) {
@@ -563,6 +562,13 @@ void JUTGamePad::CButton::setRepeat(u32 mask, u32 delay, u32 rate) {
mRepeatRate = rate;
}
void JUTGamePad::setButtonRepeat(u32 mask, u32 delay, u32 rate) {
mButton.setRepeat(mask, delay, rate);
if (mPortNum >= 0) {
mPadButton[mPortNum].setRepeat(mask, delay, rate);
}
}
bool JUTGamePad::recalibrate(u32 mask) {
for (int i = 0; i < 4; i++) {
if (sSuppressPadReset & channel_mask[i]) {
@@ -570,16 +576,25 @@ bool JUTGamePad::recalibrate(u32 mask) {
}
}
return PADRecalibrate(mask);
BOOL result = PADRecalibrate(mask);
return result;
}
void JUTGamePadLongPress::checkCallback(int port, u32 hold_time) {
if (port >= 0 && hold_time >= mThreshold) {
field_0x11 = true;
field_0x48[port] = true;
if (port < 0) {
return;
}
if (mCallback != NULL) {
mCallback(port, this, field_0x50);
}
JUT_ASSERT(1673, 0 <= port && port < 4);
if (hold_time < mThreshold) {
return;
}
field_0x11 = true;
field_0x48[port] = true;
if (mCallback != NULL) {
mCallback(port, this, field_0x50);
}
}
+3 -2
View File
@@ -11,8 +11,9 @@ JUTGraphFifo* JUTGraphFifo::sCurrentFifo;
JUTGraphFifo::JUTGraphFifo(u32 size) {
mSize = size + 0x1F & ~0x1F;
if (data_804514B8) {
mFifo = (GXFifoObj*)JKRAllocFromSysHeap(mSize + 0x80, 32);
mBase = mFifo + 1;
u32 r29 = sizeof(GXFifoObj);
mFifo = (GXFifoObj*)JKRAllocFromSysHeap(mSize + r29, 32);
mBase = (u8*)mFifo + r29;
GXInitFifoBase(mFifo, mBase, mSize);
GXInitFifoPtrs(mFifo, mBase, mBase);
} else {
+2 -2
View File
@@ -4,7 +4,7 @@
#include "dolphin/gx.h"
#include "dolphin/os.h"
void JUTPalette::storeTLUT(_GXTlut param_0, ResTLUT* tlut) {
void JUTPalette::storeTLUT(GXTlut param_0, ResTLUT* tlut) {
if (tlut == NULL) {
OSPanic("JUTPalette.cpp", 35, "JUTTexture: TLUT is NULL\n");
}
@@ -16,7 +16,7 @@ void JUTPalette::storeTLUT(_GXTlut param_0, ResTLUT* tlut) {
GXInitTlutObj(&mTlutObj, (void*)mColorTable, (GXTlutFmt)mFormat, mNumColors);
}
void JUTPalette::storeTLUT(_GXTlut param_0, _GXTlutFmt param_1, JUTTransparency param_2,
void JUTPalette::storeTLUT(GXTlut param_0, GXTlutFmt param_1, JUTTransparency param_2,
u16 param_3, void* param_4) {
mTlutName = param_0;
mFormat = param_1;
+21 -18
View File
@@ -64,15 +64,16 @@ void JUTProcBar::clear() {
void JUTProcBar::bar_subroutine(int param_0, int param_1, int param_2, int param_3, int param_4,
int param_5, int param_6, JUtility::TColor param_7,
JUtility::TColor param_8) {
int var1 = param_6 * param_3 / param_4;
J2DFillBox(param_0, param_1, param_5 * param_3 / param_4, param_2, param_7);
if (var1 < 0) {
int r29 = param_5 * param_3 / param_4;
int r31 = param_6 * param_3 / param_4;
J2DFillBox(param_0, param_1, r29, param_2, param_7);
if (r31 < 0) {
return;
}
if (var1 < 6) {
J2DFillBox(param_0, param_1, var1, param_2, param_8);
if (r31 < 6) {
J2DFillBox(param_0, param_1, r31, param_2, param_8);
} else {
J2DFillBox(param_0 + var1 - 6, param_1, 6.0f, param_2, param_8);
J2DFillBox(param_0 + r31 - 6, param_1, 6.0f, param_2, param_8);
}
}
@@ -250,18 +251,21 @@ void JUTProcBar::drawProcessBar() {
}
static int addrToXPos(void* param_0, int param_1) {
return param_1 * (((uintptr_t)param_0 - 0x80000000) / (float)JKRHeap::mMemorySize);
int result = param_1 * (((uintptr_t)param_0 - 0x80000000) / (float)JKRHeap::getMemorySize());
return result;
}
static int byteToXLen(int param_0, int param_1) {
return param_1 * (param_0 / (float)JKRHeap::mMemorySize);
int result = param_1 * (param_0 / (float)JKRHeap::getMemorySize());
return result;
}
static void heapBar(JKRHeap* param_0, int param_1, int param_2, int param_3, int param_4,
int param_5) {
int stack52 = param_1 + addrToXPos(param_0->getStartAddr(), param_4);
int var1 = param_1 + addrToXPos(param_0->getEndAddr(), param_4);
int stack36 = byteToXLen(param_0->getTotalFreeSize(), param_4);
s32 freeSize = param_0->getTotalFreeSize();
int stack36 = byteToXLen(freeSize, param_4);
J2DFillBox(stack52, param_2 - param_5 * 2 + param_5 / 2, var1 - stack52, param_5 / 2,
JUtility::TColor(255, 0, 200, 255));
J2DFillBox(stack52, param_2 - param_5 * 2 + param_5 / 2, stack36, param_5 / 2,
@@ -270,8 +274,6 @@ static void heapBar(JKRHeap* param_0, int param_1, int param_2, int param_3, int
void JUTProcBar::drawHeapBar() {
if (mHeapBarVisible) {
int start; // required/workaround for regswaps, end might be a shared variable too, however
// doesn't seem to be needed?
int posX = mParams.mPosX;
int posY = mParams.mPosY;
int barHeight = mParams.mBarWidth * 2;
@@ -284,25 +286,26 @@ void JUTProcBar::drawHeapBar() {
6);
// Draws a pink line that shows the size of the memstart to start of arenalow?
start = posX + addrToXPos(JKRHeap::getCodeStart(), width);
int codeEnd = posX + addrToXPos(JKRHeap::getCodeEnd(), width);
J2DFillBox(start, posY - (height * 2), codeEnd - start, height,
int start = posX + addrToXPos(JKRHeap::getCodeStart(), width);
int end = posX + addrToXPos(JKRHeap::getCodeEnd(), width);
J2DFillBox(start, posY - (height * 2), end - start, height,
JUtility::TColor(255, 50, 150, 255));
// draws a dark blue line that shows how much memory is free?
start = posX + addrToXPos(JKRHeap::getUserRamStart(), width);
int userEnd = posX + addrToXPos(JKRHeap::getUserRamEnd(), width);
J2DFillBox(start, posY - (height * 2), userEnd - start, height,
end = posX + addrToXPos(JKRHeap::getUserRamEnd(), width);
J2DFillBox(start, posY - (height * 2), end - start, height,
JUtility::TColor(0, 50, 150, 255));
// draws a light blue line that shows how much memory is free in the root heap(blends to
// light pink, not sure how this works)
int size = byteToXLen(JKRHeap::getRootHeap()->getTotalFreeSize(), width);
s32 freeSize = JKRHeap::getRootHeap()->getTotalFreeSize();
int size = byteToXLen(freeSize, width);
J2DFillBox(start, posY - (height * 2), size, height / 2,
JUtility::TColor(0, 250, 250, 255));
if (field_0x128 == 0) {
// draws a line of either the watch heap(if available), otherwise draw the current heap
JKRHeap* heap = mWatchHeap ? mWatchHeap : JKRGetCurrentHeap();
JKRHeap* heap = mWatchHeap ? mWatchHeap : JKRHeap::getCurrentHeap();
if (heap != JKRHeap::getSystemHeap()) {
heapBar(heap, posX, posY, barHeight, width, height);
}
+57 -63
View File
@@ -20,8 +20,7 @@ JUTResFont::JUTResFont(const ResFONT* pFont, JKRHeap* pHeap) {
JUTResFont::~JUTResFont() {
if (mValid) {
deleteMemBlocks_ResFont();
initialize_state();
delete_and_initialize();
JUTFont::initialize_state();
}
}
@@ -43,8 +42,7 @@ void JUTResFont::initialize_state() {
bool JUTResFont::initiate(const ResFONT* pFont, JKRHeap* pHeap) {
if (!protected_initiate(pFont, pHeap)) {
deleteMemBlocks_ResFont();
initialize_state();
delete_and_initialize();
JUTFont::initialize_state();
mValid = false;
return false;
@@ -65,25 +63,25 @@ bool JUTResFont::protected_initiate(const ResFONT* pFont, JKRHeap* pHeap) {
countBlock();
mMemBlocks = new (pHeap, 0) void*[mWid1BlockNum + mGly1BlockNum + mMap1BlockNum];
p = mMemBlocks;
if (!mMemBlocks) {
return false;
} else {
if (mWid1BlockNum != 0) {
mpWidthBlocks = (ResFONT::WID1**)p;
p += mWid1BlockNum;
}
if (mGly1BlockNum != 0) {
mpGlyphBlocks = (ResFONT::GLY1**)p;
p += mGly1BlockNum;
}
if (mMap1BlockNum != 0) {
mpMapBlocks = (ResFONT::MAP1**)p;
}
setBlock();
return true;
}
p = mMemBlocks;
if (mWid1BlockNum != 0) {
mpWidthBlocks = new (p) ResFONT::WID1*[mWid1BlockNum];
p += mWid1BlockNum;
}
if (mGly1BlockNum != 0) {
mpGlyphBlocks = new (p) ResFONT::GLY1*[mGly1BlockNum];
p += mGly1BlockNum;
}
if (mMap1BlockNum != 0) {
mpMapBlocks = new (p) ResFONT::MAP1*[mMap1BlockNum];
}
setBlock();
return true;
}
void JUTResFont::countBlock() {
@@ -215,7 +213,6 @@ f32 JUTResFont::drawChar_scale(f32 pos_x, f32 pos_y, f32 scale_x, f32 scale_y, i
bool flag) {
f32 x1;
f32 y1;
f32 scaled_height;
f32 x2;
JUT_ASSERT(378, mValid);
@@ -237,9 +234,7 @@ f32 JUTResFont::drawChar_scale(f32 pos_x, f32 pos_y, f32 scale_x, f32 scale_y, i
}
x2 = x1 + scale_x;
y1 = pos_y - getAscent() * (scale_y / getHeight());
scaled_height = scale_y / getHeight();
f32 descent = getDescent();
f32 y2 = descent * scaled_height + pos_y;
f32 y2 = getDescent() * (scale_y / getHeight()) + pos_y;
s32 u1 = (mWidth * 0x8000) / mpGlyphBlocks[field_0x66]->textureWidth;
s32 v1 = (mHeight * 0x8000) / mpGlyphBlocks[field_0x66]->textureHeight;
@@ -268,6 +263,7 @@ f32 JUTResFont::drawChar_scale(f32 pos_x, f32 pos_y, f32 scale_x, f32 scale_y, i
GXPosition3f32(x1, y2, 0.0f);
GXColor1u32(mColor3);
GXTexCoord2u16(u1, v2);
GXEnd();
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
@@ -290,9 +286,7 @@ void JUTResFont::getWidthEntry(int code, JUTFont::TWidth* i_width) const {
for (int i = 0; i < mWid1BlockNum; i++) {
if (mpWidthBlocks[i]->startCode <= fontCode && fontCode <= mpWidthBlocks[i]->endCode) {
u8* ptr = &mpWidthBlocks[i]->mChunkNum[(fontCode - mpWidthBlocks[i]->startCode) * 2];
i_width->field_0x0 = ptr[0];
i_width->field_0x1 = ptr[1];
*i_width = *(JUTFont::TWidth*)&mpWidthBlocks[i]->mChunkNum[(fontCode - mpWidthBlocks[i]->startCode) * 2];
break;
}
}
@@ -300,9 +294,8 @@ void JUTResFont::getWidthEntry(int code, JUTFont::TWidth* i_width) const {
s32 JUTResFont::getCellWidth() const {
if (mpGlyphBlocks) {
ResFONT::GLY1* glyphBlock = *mpGlyphBlocks;
if (glyphBlock) {
return glyphBlock->cellWidth;
if (mpGlyphBlocks[0]) {
return mpGlyphBlocks[0]->cellWidth;
}
}
@@ -311,9 +304,8 @@ s32 JUTResFont::getCellWidth() const {
s32 JUTResFont::getCellHeight() const {
if (mpGlyphBlocks) {
ResFONT::GLY1* glyphBlock = *mpGlyphBlocks;
if (glyphBlock) {
return glyphBlock->cellHeight;
if (mpGlyphBlocks[0]) {
return mpGlyphBlocks[0]->cellHeight;
}
}
@@ -324,18 +316,18 @@ bool JUTResFont::isLeadByte(int chr) const {
return (*mIsLeadByte)(chr);
}
static const u16 halftofull[95] = {
0x8140, 0x8149, 0x8168, 0x8194, 0x8190, 0x8193, 0x8195, 0x8166, 0x8169, 0x816A, 0x8196, 0x817B,
0x8143, 0x817C, 0x8144, 0x815E, 0x824F, 0x8250, 0x8251, 0x8252, 0x8253, 0x8254, 0x8255, 0x8256,
0x8257, 0x8258, 0x8146, 0x8147, 0x8183, 0x8181, 0x8184, 0x8148, 0x8197, 0x8260, 0x8261, 0x8262,
0x8263, 0x8264, 0x8265, 0x8266, 0x8267, 0x8268, 0x8269, 0x826A, 0x826B, 0x826C, 0x826D, 0x826E,
0x826F, 0x8270, 0x8271, 0x8272, 0x8273, 0x8274, 0x8275, 0x8276, 0x8277, 0x8278, 0x8279, 0x816D,
0x818F, 0x816E, 0x814F, 0x8151, 0x8165, 0x8281, 0x8282, 0x8283, 0x8284, 0x8285, 0x8286, 0x8287,
0x8288, 0x8289, 0x828A, 0x828B, 0x828C, 0x828D, 0x828E, 0x828F, 0x8290, 0x8291, 0x8292, 0x8293,
0x8294, 0x8295, 0x8296, 0x8297, 0x8298, 0x8299, 0x829A, 0x816F, 0x8162, 0x8170, 0x8160,
};
int JUTResFont::getFontCode(int chr) const {
static const u16 halftofull[95] = {
0x8140, 0x8149, 0x8168, 0x8194, 0x8190, 0x8193, 0x8195, 0x8166, 0x8169, 0x816A, 0x8196, 0x817B,
0x8143, 0x817C, 0x8144, 0x815E, 0x824F, 0x8250, 0x8251, 0x8252, 0x8253, 0x8254, 0x8255, 0x8256,
0x8257, 0x8258, 0x8146, 0x8147, 0x8183, 0x8181, 0x8184, 0x8148, 0x8197, 0x8260, 0x8261, 0x8262,
0x8263, 0x8264, 0x8265, 0x8266, 0x8267, 0x8268, 0x8269, 0x826A, 0x826B, 0x826C, 0x826D, 0x826E,
0x826F, 0x8270, 0x8271, 0x8272, 0x8273, 0x8274, 0x8275, 0x8276, 0x8277, 0x8278, 0x8279, 0x816D,
0x818F, 0x816E, 0x814F, 0x8151, 0x8165, 0x8281, 0x8282, 0x8283, 0x8284, 0x8285, 0x8286, 0x8287,
0x8288, 0x8289, 0x828A, 0x828B, 0x828C, 0x828D, 0x828E, 0x828F, 0x8290, 0x8291, 0x8292, 0x8293,
0x8294, 0x8295, 0x8296, 0x8297, 0x8298, 0x8299, 0x829A, 0x816F, 0x8162, 0x8170, 0x8160,
};
int ret = mInf1Ptr->defaultCode;
if ((getFontType() == 2) && (mMaxCode >= 0x8000U) && (chr >= 0x20) && (chr < 0x7FU)) {
chr = halftofull[chr - 32];
@@ -346,7 +338,8 @@ int JUTResFont::getFontCode(int chr) const {
ret = chr - mpMapBlocks[i]->startCode;
break;
} else if (mpMapBlocks[i]->mappingMethod == 2) {
ret = *(&mpMapBlocks[i]->mLeading + (chr - mpMapBlocks[i]->startCode));
u16* leading_temp = &mpMapBlocks[i]->mLeading;
ret = leading_temp[chr - mpMapBlocks[i]->startCode];
break;
} else if (mpMapBlocks[i]->mappingMethod == 3) {
u16* leading_temp = &mpMapBlocks[i]->mLeading;
@@ -394,31 +387,31 @@ void JUTResFont::loadImage(int code, GXTexMapID id){
}
}
if (i == mGly1BlockNum)
return;
if (i != mGly1BlockNum) {
s32 pageNumCells = mpGlyphBlocks[i]->numRows * mpGlyphBlocks[i]->numColumns;
s32 pageIdx = code / pageNumCells;
s32 cellIdxInPage = code - pageIdx * pageNumCells;
s32 cellRow = (cellIdxInPage / mpGlyphBlocks[i]->numRows);
s32 cellCol = (cellIdxInPage - cellRow * mpGlyphBlocks[i]->numRows);
mWidth = cellCol * mpGlyphBlocks[i]->cellWidth;
mHeight = cellRow * mpGlyphBlocks[i]->cellHeight;
s32 pageNumCells = mpGlyphBlocks[i]->numRows * mpGlyphBlocks[i]->numColumns;
s32 pageIdx = code / pageNumCells;
s32 cellIdxInPage = code % pageNumCells;
s32 cellCol = (cellIdxInPage % mpGlyphBlocks[i]->numRows);
s32 cellRow = (cellIdxInPage / mpGlyphBlocks[i]->numRows);
mWidth = cellCol * mpGlyphBlocks[i]->cellWidth;
mHeight = cellRow * mpGlyphBlocks[i]->cellHeight;
if (pageIdx != mTexPageIdx || i != field_0x66)
{
GXInitTexObj(&mTexObj, &mpGlyphBlocks[i]->data[pageIdx * mpGlyphBlocks[i]->textureSize], mpGlyphBlocks[i]->textureWidth,
mpGlyphBlocks[i]->textureHeight, (GXTexFmt)mpGlyphBlocks[i]->textureFormat, GX_CLAMP, GX_CLAMP, 0);
if (pageIdx != mTexPageIdx || i != field_0x66)
{
GXInitTexObj(&mTexObj, &mpGlyphBlocks[i]->data[pageIdx * mpGlyphBlocks[i]->textureSize], mpGlyphBlocks[i]->textureWidth,
mpGlyphBlocks[i]->textureHeight, (GXTexFmt)mpGlyphBlocks[i]->textureFormat, GX_CLAMP, GX_CLAMP, 0);
GXInitTexObjLOD(&mTexObj, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, 0U, 0U, GX_ANISO_1);
mTexPageIdx = pageIdx;
field_0x66 = i;
}
GXInitTexObjLOD(&mTexObj, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, 0U, 0U, GX_ANISO_1);
mTexPageIdx = pageIdx;
field_0x66 = i;
GXLoadTexObj(&mTexObj, id);
}
GXLoadTexObj(&mTexObj, id);
}
int JUTResFont::convertSjis(int inChr, u16* inLead) const {
int r29;
int tmp = JSUHiByte(inChr);
int tmp2 = JSULoByte(inChr) - 0x40;
@@ -432,5 +425,6 @@ int JUTResFont::convertSjis(int inChr, u16* inLead) const {
lead = *inLead;
}
return tmp2 + (tmp - 0x88) * 0xbc + -0x5e + lead;
r29 = tmp2 + (tmp - 0x88) * 0xbc + -0x5e + lead;
return r29;
}
+5 -5
View File
@@ -6,8 +6,8 @@
#include <string>
void* JUTResReference::getResource(JSUInputStream* stream, u32 resType, JKRArchive* archive) {
stream->read(&mType, 1);
stream->read(&mNameLength, 1);
stream->read(mType);
stream->read(mNameLength);
stream->read(&mName, mNameLength);
if (mType == RESTYPE_Unk2 || mType == RESTYPE_Unk3 || mType == RESTYPE_Unk4) {
@@ -39,13 +39,13 @@ void* JUTResReference::getResource(u32 resType, JKRArchive* archive) {
case RESTYPE_Unk1:
break;
case RESTYPE_Unk2:
res = JKRArchive::getGlbResource(resType, mName, archive);
res = JKRGetTypeResource(resType, mName, archive);
break;
case RESTYPE_Unk3:
res = JKRFileLoader::getGlbResource(mName, archive);
res = JKRGetNameResource(mName, archive);
break;
case RESTYPE_Unk4:
res = JKRFileLoader::getGlbResource(mName);
res = JKRGetResource(mName);
break;
}
+19 -22
View File
@@ -14,8 +14,6 @@ JUTTexture::~JUTTexture() {
}
void JUTTexture::storeTIMG(ResTIMG const* param_0, u8 param_1) {
_GXTlut tlut;
if (param_0 && param_1 < 0x10) {
mTexInfo = param_0;
mTexData = (void*)((intptr_t)mTexInfo + mTexInfo->imageOffset);
@@ -37,19 +35,20 @@ void JUTTexture::storeTIMG(ResTIMG const* param_0, u8 param_1) {
if (mTexInfo->numColors == 0) {
initTexObj();
} else {
GXTlut tlut;
if (mTexInfo->numColors > 0x100) {
tlut = (_GXTlut)((param_1 % 4) + GX_BIGTLUT0);
tlut = (GXTlut)((param_1 % 4) + GX_BIGTLUT0);
} else {
tlut = (_GXTlut)param_1;
tlut = (GXTlut)param_1;
}
if (mEmbPalette == NULL || !getEmbPaletteDelFlag()) {
mEmbPalette = new JUTPalette(tlut, (_GXTlutFmt)mTexInfo->colorFormat,
mEmbPalette = new JUTPalette(tlut, (GXTlutFmt)mTexInfo->colorFormat,
(JUTTransparency)mTexInfo->alphaEnabled, mTexInfo->numColors,
(void*)(&mTexInfo->format + mTexInfo->paletteOffset));
mFlags = mFlags & 1 | 2;
setEmbPaletteDelFlag(true);
} else {
mEmbPalette->storeTLUT(tlut, (_GXTlutFmt)mTexInfo->colorFormat,
mEmbPalette->storeTLUT(tlut, (GXTlutFmt)mTexInfo->colorFormat,
(JUTTransparency)mTexInfo->alphaEnabled, mTexInfo->numColors,
(void*)(&mTexInfo->format + mTexInfo->paletteOffset));
}
@@ -59,18 +58,18 @@ void JUTTexture::storeTIMG(ResTIMG const* param_0, u8 param_1) {
}
void JUTTexture::storeTIMG(ResTIMG const* param_0, JUTPalette* param_1) {
_GXTlut type;
GXTlut type;
if (param_1 != NULL) {
type = (_GXTlut)param_1->getTlutName();
type = param_1->getTlutName();
} else {
type = GX_TLUT0;
}
storeTIMG(param_0, param_1, type);
}
void JUTTexture::storeTIMG(ResTIMG const* param_0, JUTPalette* param_1, _GXTlut param_2) {
_GXTlut type;
void JUTTexture::storeTIMG(ResTIMG const* param_0, JUTPalette* param_1, GXTlut param_2) {
GXTlut type;
if (param_0 == NULL) {
return;
@@ -89,13 +88,11 @@ void JUTTexture::storeTIMG(ResTIMG const* param_0, JUTPalette* param_1, _GXTlut
if (param_1 != NULL) {
mTlutName = param_2;
if (param_2 != param_1->getTlutName()) {
u8 format = param_1->getFormat();
u8 transperancy = param_1->getTransparency();
GXTlutFmt format = param_1->getFormat();
JUTTransparency transperancy = param_1->getTransparency();
u16 numColors = param_1->getNumColors();
ResTLUT* colorTable = param_1->getColorTable();
param_1->storeTLUT(param_2, (_GXTlutFmt)format,
(JUTTransparency)transperancy,
numColors, colorTable);
param_1->storeTLUT(param_2, format, transperancy, numColors, colorTable);
}
}
@@ -116,8 +113,7 @@ void JUTTexture::attachPalette(JUTPalette* param_0) {
} else {
field_0x2c = param_0;
}
_GXTlut name = (_GXTlut)field_0x2c->getTlutName();
initTexObj(name);
initTexObj(field_0x2c->getTlutName());
}
}
@@ -128,8 +124,9 @@ void JUTTexture::init() {
if (mEmbPalette != NULL) {
field_0x2c = mEmbPalette;
_GXTlut name = (_GXTlut)field_0x2c->getTlutName();
initTexObj(name);
initTexObj(field_0x2c->getTlutName());
} else {
OS_REPORT("This texture is CI-Format, but EmbPalette is NULL.\n");
}
}
}
@@ -151,7 +148,7 @@ void JUTTexture::initTexObj() {
mTexInfo->doEdgeLOD, (GXAnisotropy)mTexInfo->maxAnisotropy);
}
void JUTTexture::initTexObj(_GXTlut param_0) {
void JUTTexture::initTexObj(GXTlut param_0) {
GXBool mipmapEnabled;
if (mTexInfo->mipmapEnabled != 0) {
mipmapEnabled = 1;
@@ -169,7 +166,7 @@ void JUTTexture::initTexObj(_GXTlut param_0) {
mTexInfo->doEdgeLOD, (GXAnisotropy)mTexInfo->maxAnisotropy);
}
void JUTTexture::load(_GXTexMapID param_0) {
void JUTTexture::load(GXTexMapID param_0) {
if (field_0x2c) {
field_0x2c->load();
}
+10 -12
View File
@@ -78,20 +78,20 @@ void JUTVideo::preRetraceProc(u32 retrace_count) {
static void* frameBuffer = NULL;
if (frameBuffer) {
JUTVideo* videoManager = JUTGetVideoManager();
const GXRenderModeObj* renderMode = videoManager->getRenderMode();
JUTDirectPrint* directPrint = JUTDirectPrint::getManager();
directPrint->changeFrameBuffer(frameBuffer, renderMode->fbWidth, renderMode->efbHeight);
const GXRenderModeObj* renderMode = JUTGetVideoManager()->getRenderMode();
u16 width = renderMode->fbWidth;
u16 height = renderMode->efbHeight;
JUTDirectPrint::getManager()->changeFrameBuffer(frameBuffer, width, height);
}
if (sManager->mSetBlack == 1) {
s32 frame_count = sManager->mSetBlackFrameCount;
if (getManager()->mSetBlack == 1) {
s32 frame_count = getManager()->mSetBlackFrameCount;
if (frame_count > 0) {
frame_count--;
}
sManager->mSetBlackFrameCount = frame_count;
sManager->mSetBlack = frame_count != 0;
getManager()->mSetBlackFrameCount = frame_count;
getManager()->mSetBlack = frame_count ? true : false;
VISetBlack(TRUE);
VIFlush();
return;
@@ -157,8 +157,7 @@ void JUTVideo::drawDoneCallback() {
if (xfb->getSDrawingFlag() == 1) {
xfb->setSDrawingFlag(0);
void* frameBuffer = xfb->getDrawnXfb();
if (frameBuffer) {
if (xfb->getDrawnXfb()) {
VISetNextFrameBuffer(xfb->getDrawnXfb());
VIFlush();
}
@@ -175,8 +174,7 @@ void JUTVideo::postRetraceProc(u32 retrace_count) {
sManager->mPostCallback(retrace_count);
}
OSMessage message = (OSMessage*)VIGetRetraceCount();
OSSendMessage(&sManager->mMessageQueue, message, OS_MESSAGE_NOBLOCK);
OSSendMessage(&sManager->mMessageQueue, (OSMessage)VIGetRetraceCount(), OS_MESSAGE_NOBLOCK);
}
void JUTVideo::setRenderMode(GXRenderModeObj const* pObj) {
+3 -3
View File
@@ -69,11 +69,11 @@ void JUTXfb::initiate(u16 width, u16 height, JKRHeap* pHeap, JUTXfb::EXfbNumber
int size = (u16)((u16)width + 0xf & ~0xf) * height * 2;
mBuffer[0] = ::operator new[](size, pHeap, 0x20);
mBuffer[0] = new (pHeap, 0x20) u8[size];
mXfbAllocated[0] = true;
if (xfbNum >= 2) {
mBuffer[1] = ::operator new[](size, pHeap, 0x20);
mBuffer[1] = new (pHeap, 0x20) u8[size];
mXfbAllocated[1] = true;
} else {
mBuffer[1] = NULL;
@@ -81,7 +81,7 @@ void JUTXfb::initiate(u16 width, u16 height, JKRHeap* pHeap, JUTXfb::EXfbNumber
}
if (xfbNum >= 3) {
mBuffer[2] = ::operator new[](size, pHeap, 0x20);
mBuffer[2] = new (pHeap, 0x20) u8[size];
mXfbAllocated[2] = true;
} else {
mBuffer[2] = NULL;