JUtility / JSupport / misc cleanup

This commit is contained in:
TakaRikka
2023-02-26 22:18:40 -08:00
parent 090dcee012
commit eae9455a7d
27 changed files with 442 additions and 457 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ public:
u32 getGraphMemory() const { return mGraphMemoryPtr; } u32 getGraphMemory() const { return mGraphMemoryPtr; }
u32 getGraphMemSize() const { return mGraphMemorySize; } u32 getGraphMemSize() const { return mGraphMemorySize; }
private: //private:
/* 0x00 */ // vtable /* 0x00 */ // vtable
/* 0x04 */ // JKRThread /* 0x04 */ // JKRThread
/* 0x7C */ u32 mAudioMemoryPtr; /* 0x7C */ u32 mAudioMemoryPtr;
+10 -4
View File
@@ -38,12 +38,18 @@ extern TAtanTable atanTable_;
extern TAsinAcosTable asinAcosTable_; extern TAsinAcosTable asinAcosTable_;
}; // namespace JMath }; // namespace JMath
inline f32 JMASSin(s16 s) { inline f32 JMASCosShort(s16 v) {
return JMath::sincosTable_.sinShort(s); return JMath::sincosTable_.cosShort(v);
}
inline f32 JMASinShort(s16 v) {
return JMath::sincosTable_.sinShort(v);
} }
inline f32 JMASCos(s16 s) { inline f32 JMASCos(s16 v) {
return JMath::sincosTable_.cosShort(s); return JMASCosShort(v);
}
inline f32 JMASSin(s16 v) {
return JMASinShort(v);
} }
#endif /* JMATRIGONOMETRIC_H */ #endif /* JMATRIGONOMETRIC_H */
+7 -8
View File
@@ -23,14 +23,13 @@
#define JUT_PANIC(...) #define JUT_PANIC(...)
#endif #endif
// TODO: make it a namespace namespace JUTAssertion {
struct JUTAssertion { /* 802E495C */ void create();
/* 802E495C */ static void create(); /* 802E4960 */ u32 flush_subroutine();
/* 802E4960 */ static u32 flush_subroutine(); /* 802E499C */ void flushMessage();
/* 802E499C */ static void flushMessage(); /* 802E4A54 */ void flushMessage_dbPrint();
/* 802E4A54 */ static void flushMessage_dbPrint(); /* 802E4C34 */ void setVisible(bool);
/* 802E4C34 */ static void setVisible(bool); /* 802E4C3C */ void setMessageCount(int);
/* 802E4C3C */ static void setMessageCount(int);
}; };
extern bool sAssertVisible; extern bool sAssertVisible;
+3 -3
View File
@@ -8,8 +8,8 @@
class JUTCacheFont : public JUTResFont { class JUTCacheFont : public JUTResFont {
public: public:
struct TGlyphCacheInfo { struct TGlyphCacheInfo {
/* 0x0 */ TGlyphCacheInfo* field_0x0; /* 0x0 */ TGlyphCacheInfo* mPrev;
/* 0x4 */ TGlyphCacheInfo** field_0x4; /* 0x4 */ TGlyphCacheInfo* mNext;
}; };
struct TCachePage { struct TCachePage {
@@ -64,7 +64,7 @@ private:
/* 0x84 */ void* field_0x84; /* 0x84 */ void* field_0x84;
/* 0x88 */ u32 mMaxSheetSize; /* 0x88 */ u32 mMaxSheetSize;
/* 0x8C */ EPagingType mPagingType; /* 0x8C */ EPagingType mPagingType;
/* 0x90 */ void** mCacheBuffer; /* 0x90 */ void* mCacheBuffer;
/* 0x94 */ int field_0x94; /* 0x94 */ int field_0x94;
/* 0x98 */ u32 mCachePage; /* 0x98 */ u32 mCachePage;
/* 0x9C */ TGlyphCacheInfo* field_0x9c; /* 0x9C */ TGlyphCacheInfo* field_0x9c;
+1
View File
@@ -148,5 +148,6 @@ extern "C" JUTConsole* JUTGetWarningConsole();
extern "C" void JUTReportConsole_f_va(const char*, va_list); extern "C" void JUTReportConsole_f_va(const char*, va_list);
extern "C" void JUTReportConsole_f(const char*, ...); extern "C" void JUTReportConsole_f(const char*, ...);
extern "C" void JUTWarningConsole(const char* message); extern "C" void JUTWarningConsole(const char* message);
extern "C" void JUTReportConsole(const char* message);
#endif /* JUTCONSOLE_H */ #endif /* JUTCONSOLE_H */
+1
View File
@@ -55,6 +55,7 @@ struct ResFONT {
/* 0x08 */ u32 filesize; /* 0x08 */ u32 filesize;
/* 0x0C */ u32 numBlocks; /* 0x0C */ u32 numBlocks;
/* 0x10 */ u8 padding[0x10]; /* 0x10 */ u8 padding[0x10];
/* 0x20 */ u8 data[];
}; };
class JUTFont { class JUTFont {
+8 -4
View File
@@ -3,9 +3,13 @@
#include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JUtility/JUTFont.h" #include "JSystem/JUtility/JUTFont.h"
#include "dolphin/types.h"
typedef bool (*IsLeadByte)(int); typedef bool (*IsLeadByte_func)(int);
struct BlockHeader {
u32 magic;
u32 size;
};
class JUTResFont : public JUTFont { class JUTResFont : public JUTFont {
public: public:
@@ -43,7 +47,7 @@ public:
initialize_state(); initialize_state();
} }
static void* const saoAboutEncoding_[3]; static IsLeadByte_func const saoAboutEncoding_[3];
// some types uncertain, may need to be fixed // some types uncertain, may need to be fixed
/* 0x1C */ int mWidth; /* 0x1C */ int mWidth;
@@ -61,7 +65,7 @@ public:
/* 0x64 */ u16 mMap1BlockNum; /* 0x64 */ u16 mMap1BlockNum;
/* 0x66 */ u16 field_0x66; /* 0x66 */ u16 field_0x66;
/* 0x68 */ u16 mMaxCode; /* 0x68 */ u16 mMaxCode;
/* 0x6C */ IsLeadByte* mIsLeadByte; /* 0x6C */ IsLeadByte_func* mIsLeadByte;
}; };
#endif /* JUTRESFONT_H */ #endif /* JUTRESFONT_H */
+46 -15
View File
@@ -4,8 +4,8 @@
// //
#include "JSystem/JMath/JMath.h" #include "JSystem/JMath/JMath.h"
#include "JSystem/JMath/JMATrigonometric.h"
#include "dol2asm.h" #include "dol2asm.h"
#include "dolphin/types.h"
// //
// Forward References: // Forward References:
@@ -29,6 +29,21 @@ extern "C" u8 sincosTable___5JMath[65536];
/* 80339878-80339938 3341B8 00C0+00 0/0 11/11 2/2 .text JMAEulerToQuat__FsssP10Quaternion /* 80339878-80339938 3341B8 00C0+00 0/0 11/11 2/2 .text JMAEulerToQuat__FsssP10Quaternion
*/ */
#ifdef NONMATCHING
void JMAEulerToQuat(s16 x, s16 y, s16 z, Quaternion* quat) {
f32 cosX = JMASCos(x / 2);
f32 cosY = JMASCos(y / 2);
f32 cosZ = JMASCos(z / 2);
f32 sinX = JMASSin(x / 2);
f32 sinY = JMASSin(y / 2);
f32 sinZ = JMASSin(z / 2);
quat->w = cosX * (cosY * cosZ) + sinX * (sinY * sinZ);
quat->x = sinX * (cosY * cosZ) - cosX * (sinY * sinZ);
quat->y = cosZ * (cosX * sinY) + sinZ * (sinX * cosY);
quat->z = sinZ * (cosX * cosY) - cosZ * (sinX * sinY);
}
#else
#pragma push #pragma push
#pragma optimization_level 0 #pragma optimization_level 0
#pragma optimizewithasm off #pragma optimizewithasm off
@@ -37,24 +52,40 @@ asm void JMAEulerToQuat(s16 param_0, s16 param_1, s16 param_2, Quaternion* param
#include "asm/JSystem/JMath/JMath/JMAEulerToQuat__FsssP10Quaternion.s" #include "asm/JSystem/JMath/JMath/JMAEulerToQuat__FsssP10Quaternion.s"
} }
#pragma pop #pragma pop
#endif
/* ############################################################################################## */
/* 804564C8-804564D0 004AC8 0008+00 1/1 0/0 0/0 .sdata2 @376 */
SECTION_SDATA2 static u8 lit_376[8] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
/* 80339938-80339A30 334278 00F8+00 0/0 5/5 0/0 .text /* 80339938-80339A30 334278 00F8+00 0/0 5/5 0/0 .text
* JMAQuatLerp__FPC10QuaternionPC10QuaternionfP10Quaternion */ * JMAQuatLerp__FPC10QuaternionPC10QuaternionfP10Quaternion */
#pragma push void JMAQuatLerp(register const Quaternion* p, register const Quaternion* q, f32 t,
#pragma optimization_level 0 Quaternion* dst) {
#pragma optimizewithasm off register f32 pxy, pzw, qxy, qzw;
asm void JMAQuatLerp(Quaternion const* param_0, Quaternion const* param_1, f32 param_2, register f32 dp;
Quaternion* param_3) { __asm // compute dot product
nofralloc {
#include "asm/JSystem/JMath/JMath/JMAQuatLerp__FPC10QuaternionPC10QuaternionfP10Quaternion.s" psq_l pxy, 0(p), 0, 0
psq_l qxy, 0(q), 0, 0
ps_mul dp, pxy, qxy
psq_l pzw, 8(p), 0, 0
psq_l qzw, 8(q), 0, 0
ps_madd dp, pzw, qzw, dp
ps_sum0 dp, dp, dp, dp
}
if (dp < 0.0) {
dst->x = -t * (p->x + q->x) + p->x;
dst->y = -t * (p->y + q->y) + p->y;
dst->z = -t * (p->z + q->z) + p->z;
dst->w = -t * (p->w + q->w) + p->w;
}
else {
dst->x = -t * (p->x - q->x) + p->x;
dst->y = -t * (p->y - q->y) + p->y;
dst->z = -t * (p->z - q->z) + p->z;
dst->w = -t * (p->w - q->w) + p->w;
}
} }
#pragma pop
/* 80339A30-80339A5C 334370 002C+00 0/0 1/1 0/0 .text JMAFastVECNormalize__FPC3VecP3Vec /* 80339A30-80339A5C 334370 002C+00 0/0 1/1 0/0 .text JMAFastVECNormalize__FPC3VecP3Vec
*/ */
-6
View File
@@ -4,12 +4,6 @@
// //
#include "JSystem/JMath/random.h" #include "JSystem/JMath/random.h"
#include "dol2asm.h"
#include "dolphin/types.h"
//
// Declarations:
//
/* 80339AE4-80339AEC -00001 0008+00 0/0 0/0 0/0 .text __ct__Q25JMath13TRandom_fast_FUl */ /* 80339AE4-80339AEC -00001 0008+00 0/0 0/0 0/0 .text __ct__Q25JMath13TRandom_fast_FUl */
JMath::TRandom_fast_::TRandom_fast_(u32 param_0) { JMath::TRandom_fast_::TRandom_fast_(u32 param_0) {
+6 -8
View File
@@ -4,12 +4,6 @@
// //
#include "JSystem/JSupport/JSUFileStream.h" #include "JSystem/JSupport/JSUFileStream.h"
#include "dol2asm.h"
#include "dolphin/types.h"
//
// Declarations:
//
/* 802DC638-802DC67C 2D6F78 0044+00 0/0 1/1 0/0 .text __ct__18JSUFileInputStreamFP7JKRFile */ /* 802DC638-802DC67C 2D6F78 0044+00 0/0 1/1 0/0 .text __ct__18JSUFileInputStreamFP7JKRFile */
JSUFileInputStream::JSUFileInputStream(JKRFile* pFile) { JSUFileInputStream::JSUFileInputStream(JKRFile* pFile) {
@@ -22,11 +16,10 @@ JSUFileInputStream::JSUFileInputStream(JKRFile* pFile) {
u32 JSUFileInputStream::readData(void* pBuffer, s32 length) { u32 JSUFileInputStream::readData(void* pBuffer, s32 length) {
s32 lenRead = 0; s32 lenRead = 0;
if (mFile->isAvailable()) { if (mFile->isAvailable()) {
// TODO: the function probably returns u32
// there are probably more functions that return u32 instead of s32
if (mPosition + length > (u32)mFile->getFileSize()) { if (mPosition + length > (u32)mFile->getFileSize()) {
length = mFile->getFileSize() - mPosition; length = mFile->getFileSize() - mPosition;
} }
if (length > 0) { if (length > 0) {
lenRead = mFile->readData(pBuffer, length, mPosition); lenRead = mFile->readData(pBuffer, length, mPosition);
if (lenRead < 0) { if (lenRead < 0) {
@@ -36,6 +29,7 @@ u32 JSUFileInputStream::readData(void* pBuffer, s32 length) {
} }
} }
} }
return lenRead; return lenRead;
} }
@@ -43,6 +37,7 @@ u32 JSUFileInputStream::readData(void* pBuffer, s32 length) {
* seekPos__18JSUFileInputStreamFl17JSUStreamSeekFrom */ * seekPos__18JSUFileInputStreamFl17JSUStreamSeekFrom */
s32 JSUFileInputStream::seekPos(s32 pos, JSUStreamSeekFrom seekFrom) { s32 JSUFileInputStream::seekPos(s32 pos, JSUStreamSeekFrom seekFrom) {
s32 oldPos = mPosition; s32 oldPos = mPosition;
switch (seekFrom) { switch (seekFrom) {
case JSUStreamSeekFrom_SET: case JSUStreamSeekFrom_SET:
mPosition = pos; mPosition = pos;
@@ -54,12 +49,15 @@ s32 JSUFileInputStream::seekPos(s32 pos, JSUStreamSeekFrom seekFrom) {
mPosition += pos; mPosition += pos;
break; break;
} }
if (mPosition < 0) { if (mPosition < 0) {
mPosition = 0; mPosition = 0;
} }
if (mPosition > mFile->getFileSize()) { if (mPosition > mFile->getFileSize()) {
mPosition = mFile->getFileSize(); mPosition = mFile->getFileSize();
} }
return mPosition - oldPos; return mPosition - oldPos;
} }
+14 -44
View File
@@ -5,37 +5,19 @@
#include "JSystem/JSupport/JSUInputStream.h" #include "JSystem/JSupport/JSUInputStream.h"
#include "JSystem/JSupport/JSURandomInputStream.h" #include "JSystem/JSupport/JSURandomInputStream.h"
#include "dol2asm.h"
#include "global.h"
//
// Types:
//
// //
// Forward References: // Forward References:
// //
extern "C" void __dt__14JSUInputStreamFv();
extern "C" void read__14JSUInputStreamFPvl();
extern "C" void skip__14JSUInputStreamFl();
extern "C" void align__20JSURandomInputStreamFl();
extern "C" void skip__20JSURandomInputStreamFl(); extern "C" void skip__20JSURandomInputStreamFl();
extern "C" void peek__20JSURandomInputStreamFPvl();
extern "C" void seek__20JSURandomInputStreamFl17JSUStreamSeekFrom();
// //
// External References: // External References:
// //
extern "C" void __dt__20JSURandomInputStreamFv(); extern "C" void __dt__20JSURandomInputStreamFv();
extern "C" void __dl__FPv();
extern "C" void getAvailable__20JSURandomInputStreamCFv(); extern "C" void getAvailable__20JSURandomInputStreamCFv();
extern "C" void _savegpr_28();
extern "C" void _savegpr_29();
extern "C" void _restgpr_28();
extern "C" void _restgpr_29();
extern "C" extern void* __vt__10JSUIosBase[3];
// //
// Declarations: // Declarations:
@@ -43,7 +25,7 @@ extern "C" extern void* __vt__10JSUIosBase[3];
/* ############################################################################################## */ /* ############################################################################################## */
/* 803CC4B0-803CC4D4 0295D0 0024+00 0/0 7/7 0/0 .data __vt__20JSURandomInputStream */ /* 803CC4B0-803CC4D4 0295D0 0024+00 0/0 7/7 0/0 .data __vt__20JSURandomInputStream */
SECTION_DATA extern void* __vt__20JSURandomInputStream[9] = { extern void* __vt__20JSURandomInputStream[9] = {
(void*)NULL /* RTTI */, (void*)NULL /* RTTI */,
(void*)NULL, (void*)NULL,
(void*)__dt__20JSURandomInputStreamFv, (void*)__dt__20JSURandomInputStreamFv,
@@ -55,26 +37,14 @@ SECTION_DATA extern void* __vt__20JSURandomInputStream[9] = {
(void*)NULL, (void*)NULL,
}; };
/* 803CC4D4-803CC4F0 0295F4 0018+04 1/1 4/4 0/0 .data __vt__14JSUInputStream */
SECTION_DATA extern void* __vt__14JSUInputStream[6 + 1 /* padding */] = {
(void*)NULL /* RTTI */,
(void*)NULL,
(void*)__dt__14JSUInputStreamFv,
(void*)NULL,
(void*)skip__14JSUInputStreamFl,
(void*)NULL,
/* padding */
NULL,
};
/* 802DC23C-802DC298 2D6B7C 005C+00 1/0 6/6 0/0 .text __dt__14JSUInputStreamFv */ /* 802DC23C-802DC298 2D6B7C 005C+00 1/0 6/6 0/0 .text __dt__14JSUInputStreamFv */
JSUInputStream::~JSUInputStream() {} JSUInputStream::~JSUInputStream() {}
/* 802DC298-802DC2F0 2D6BD8 0058+00 1/1 20/20 0/0 .text read__14JSUInputStreamFPvl */ /* 802DC298-802DC2F0 2D6BD8 0058+00 1/1 20/20 0/0 .text read__14JSUInputStreamFPvl */
s32 JSUInputStream::read(void* buffer, s32 numBytes) { s32 JSUInputStream::read(void* buffer, s32 numBytes) {
s32 bytesRead = this->readData(buffer, numBytes); s32 bytesRead = readData(buffer, numBytes);
if (bytesRead != numBytes) { if (bytesRead != numBytes) {
this->setState(IOS_STATE_1); setState(IOS_STATE_1);
} }
return bytesRead; return bytesRead;
} }
@@ -84,7 +54,7 @@ s32 JSUInputStream::skip(s32 count) {
s32 skipCount = 0; s32 skipCount = 0;
u8 buffer[1]; u8 buffer[1];
while (count > skipCount) { while (count > skipCount) {
if (this->readData(&buffer, 1) != 1) { if (readData(&buffer, 1) != 1) {
setState(IOS_STATE_1); setState(IOS_STATE_1);
break; break;
} }
@@ -95,15 +65,15 @@ s32 JSUInputStream::skip(s32 count) {
/* 802DC370-802DC3FC 2D6CB0 008C+00 0/0 1/1 0/0 .text align__20JSURandomInputStreamFl */ /* 802DC370-802DC3FC 2D6CB0 008C+00 0/0 1/1 0/0 .text align__20JSURandomInputStreamFl */
s32 JSURandomInputStream::align(s32 alignment) { s32 JSURandomInputStream::align(s32 alignment) {
s32 currentPos = this->getPosition(); s32 currentPos = getPosition();
s32 offset = (alignment + currentPos); s32 offset = (alignment + currentPos);
offset -= 1; offset -= 1;
offset &= ~(alignment - 1); offset &= ~(alignment - 1);
s32 alignmentOffset = offset - currentPos; s32 alignmentOffset = offset - currentPos;
if (alignmentOffset != 0) { if (alignmentOffset != 0) {
s32 seekLen = this->seekPos(offset, JSUStreamSeekFrom_SET); s32 seekLen = seekPos(offset, JSUStreamSeekFrom_SET);
if (seekLen != alignmentOffset) { if (seekLen != alignmentOffset) {
this->setState(IOS_STATE_1); setState(IOS_STATE_1);
} }
} }
return alignmentOffset; return alignmentOffset;
@@ -111,19 +81,19 @@ s32 JSURandomInputStream::align(s32 alignment) {
/* 802DC3FC-802DC458 2D6D3C 005C+00 1/0 2/0 0/0 .text skip__20JSURandomInputStreamFl */ /* 802DC3FC-802DC458 2D6D3C 005C+00 1/0 2/0 0/0 .text skip__20JSURandomInputStreamFl */
s32 JSURandomInputStream::skip(s32 param_0) { s32 JSURandomInputStream::skip(s32 param_0) {
s32 val = this->seekPos(param_0, JSUStreamSeekFrom_CUR); s32 val = seekPos(param_0, JSUStreamSeekFrom_CUR);
if (val != param_0) { if (val != param_0) {
this->setState(IOS_STATE_1); setState(IOS_STATE_1);
} }
return val; return val;
} }
/* 802DC458-802DC4DC 2D6D98 0084+00 0/0 8/8 0/0 .text peek__20JSURandomInputStreamFPvl */ /* 802DC458-802DC4DC 2D6D98 0084+00 0/0 8/8 0/0 .text peek__20JSURandomInputStreamFPvl */
s32 JSURandomInputStream::peek(void* buffer, s32 numBytes) { s32 JSURandomInputStream::peek(void* buffer, s32 numBytes) {
s32 oldPos = this->getPosition(); s32 oldPos = getPosition();
s32 bytesRead = this->read(buffer, numBytes); s32 bytesRead = read(buffer, numBytes);
if (bytesRead != 0) { if (bytesRead != 0) {
this->seekPos(oldPos, JSUStreamSeekFrom_SET); seekPos(oldPos, JSUStreamSeekFrom_SET);
} }
return bytesRead; return bytesRead;
} }
@@ -131,7 +101,7 @@ s32 JSURandomInputStream::peek(void* buffer, s32 numBytes) {
/* 802DC4DC-802DC520 2D6E1C 0044+00 0/0 16/16 0/0 .text /* 802DC4DC-802DC520 2D6E1C 0044+00 0/0 16/16 0/0 .text
* seek__20JSURandomInputStreamFl17JSUStreamSeekFrom */ * seek__20JSURandomInputStreamFl17JSUStreamSeekFrom */
s32 JSURandomInputStream::seek(s32 param_0, JSUStreamSeekFrom param_1) { s32 JSURandomInputStream::seek(s32 param_0, JSUStreamSeekFrom param_1) {
s32 seekResult = this->seekPos(param_0, param_1); s32 seekResult = seekPos(param_0, param_1);
this->clrState(IOS_STATE_1); clrState(IOS_STATE_1);
return seekResult; return seekResult;
} }
+41 -43
View File
@@ -4,32 +4,30 @@
// //
#include "JSystem/JSupport/JSUList.h" #include "JSystem/JSupport/JSUList.h"
#include "dol2asm.h"
#include "dolphin/types.h"
JSUPtrLink::JSUPtrLink(void* object) { JSUPtrLink::JSUPtrLink(void* object) {
this->mList = NULL; mList = NULL;
this->mObject = object; mObject = object;
this->mPrev = NULL; mPrev = NULL;
this->mNext = NULL; mNext = NULL;
} }
JSUPtrLink::~JSUPtrLink() { JSUPtrLink::~JSUPtrLink() {
if (this->mList != NULL) { if (mList != NULL) {
this->mList->remove(this); mList->remove(this);
} }
} }
JSUPtrList::JSUPtrList(bool init) { JSUPtrList::JSUPtrList(bool init) {
if (init) { if (init) {
this->initiate(); initiate();
} }
} }
JSUPtrList::~JSUPtrList() { JSUPtrList::~JSUPtrList() {
JSUPtrLink* node = this->mHead; JSUPtrLink* node = mHead;
s32 removed = 0; s32 removed = 0;
while (this->mLength > removed) { while (mLength > removed) {
node->mList = NULL; node->mList = NULL;
node = node->getNext(); node = node->getNext();
removed += 1; removed += 1;
@@ -37,18 +35,18 @@ JSUPtrList::~JSUPtrList() {
} }
void JSUPtrList::initiate() { void JSUPtrList::initiate() {
this->mHead = NULL; mHead = NULL;
this->mTail = NULL; mTail = NULL;
this->mLength = 0; mLength = 0;
} }
void JSUPtrList::setFirst(JSUPtrLink* first) { void JSUPtrList::setFirst(JSUPtrLink* first) {
first->mList = this; first->mList = this;
first->mPrev = NULL; first->mPrev = NULL;
first->mNext = NULL; first->mNext = NULL;
this->mTail = first; mTail = first;
this->mHead = first; mHead = first;
this->mLength = 1; mLength = 1;
} }
bool JSUPtrList::append(JSUPtrLink* ptr) { bool JSUPtrList::append(JSUPtrLink* ptr) {
@@ -59,15 +57,15 @@ bool JSUPtrList::append(JSUPtrLink* ptr) {
} }
if (result) { if (result) {
if (this->mLength == 0) { if (mLength == 0) {
this->setFirst(ptr); setFirst(ptr);
} else { } else {
ptr->mList = this; ptr->mList = this;
ptr->mPrev = this->mTail; ptr->mPrev = mTail;
ptr->mNext = NULL; ptr->mNext = NULL;
this->mTail->mNext = ptr; mTail->mNext = ptr;
this->mTail = ptr; mTail = ptr;
this->mLength++; mLength++;
} }
} }
@@ -82,15 +80,15 @@ bool JSUPtrList::prepend(JSUPtrLink* ptr) {
} }
if (result) { if (result) {
if (this->mLength == 0) { if (mLength == 0) {
this->setFirst(ptr); setFirst(ptr);
} else { } else {
ptr->mList = this; ptr->mList = this;
ptr->mPrev = NULL; ptr->mPrev = NULL;
ptr->mNext = this->mHead; ptr->mNext = mHead;
this->mHead->mPrev = ptr; mHead->mPrev = ptr;
this->mHead = ptr; mHead = ptr;
this->mLength++; mLength++;
} }
} }
@@ -98,10 +96,10 @@ bool JSUPtrList::prepend(JSUPtrLink* ptr) {
} }
bool JSUPtrList::insert(JSUPtrLink* before, JSUPtrLink* ptr) { bool JSUPtrList::insert(JSUPtrLink* before, JSUPtrLink* ptr) {
if (before == this->mHead) { if (before == mHead) {
return this->prepend(ptr); return prepend(ptr);
} else if (before == NULL) { } else if (before == NULL) {
return this->append(ptr); return append(ptr);
} }
if (before->mList != this) { if (before->mList != this) {
@@ -120,7 +118,7 @@ bool JSUPtrList::insert(JSUPtrLink* before, JSUPtrLink* ptr) {
ptr->mNext = before; ptr->mNext = before;
prev->mNext = ptr; prev->mNext = ptr;
before->mPrev = ptr; before->mPrev = ptr;
this->mLength++; mLength++;
} }
return result; return result;
@@ -129,33 +127,33 @@ bool JSUPtrList::insert(JSUPtrLink* before, JSUPtrLink* ptr) {
bool JSUPtrList::remove(JSUPtrLink* ptr) { bool JSUPtrList::remove(JSUPtrLink* ptr) {
bool is_parent = (ptr->mList == this); bool is_parent = (ptr->mList == this);
if (is_parent) { if (is_parent) {
if (this->mLength == 1) { if (mLength == 1) {
this->mHead = NULL; mHead = NULL;
this->mTail = NULL; mTail = NULL;
} else if (ptr == this->mHead) { } else if (ptr == mHead) {
ptr->mNext->mPrev = NULL; ptr->mNext->mPrev = NULL;
this->mHead = ptr->mNext; mHead = ptr->mNext;
} else if (ptr == this->mTail) { } else if (ptr == mTail) {
ptr->mPrev->mNext = NULL; ptr->mPrev->mNext = NULL;
this->mTail = ptr->mPrev; mTail = ptr->mPrev;
} else { } else {
ptr->mPrev->mNext = ptr->mNext; ptr->mPrev->mNext = ptr->mNext;
ptr->mNext->mPrev = ptr->mPrev; ptr->mNext->mPrev = ptr->mPrev;
} }
ptr->mList = NULL; ptr->mList = NULL;
this->mLength--; mLength--;
} }
return is_parent; return is_parent;
} }
JSUPtrLink* JSUPtrList::getNthLink(u32 index) const { JSUPtrLink* JSUPtrList::getNthLink(u32 index) const {
if (index >= this->mLength) { if (index >= mLength) {
return NULL; return NULL;
} }
JSUPtrLink* node = this->mHead; JSUPtrLink* node = mHead;
for (u32 i = 0; i < index; i++) { for (u32 i = 0; i < index; i++) {
node = node->getNext(); node = node->getNext();
} }
+6 -6
View File
@@ -5,12 +5,6 @@
#include "JSystem/JSupport/JSUMemoryStream.h" #include "JSystem/JSupport/JSUMemoryStream.h"
#include "MSL_C/MSL_Common/Src/string.h" #include "MSL_C/MSL_Common/Src/string.h"
#include "dol2asm.h"
#include "dolphin/types.h"
//
// Declarations:
//
/* 802DC520-802DC534 2D6E60 0014+00 0/0 3/3 0/0 .text setBuffer__20JSUMemoryInputStreamFPCvl */ /* 802DC520-802DC534 2D6E60 0014+00 0/0 3/3 0/0 .text setBuffer__20JSUMemoryInputStreamFPCvl */
void JSUMemoryInputStream::setBuffer(void const* pBuffer, s32 length) { void JSUMemoryInputStream::setBuffer(void const* pBuffer, s32 length) {
@@ -24,10 +18,12 @@ u32 JSUMemoryInputStream::readData(void* pData, s32 length) {
if (mPosition + length > mLength) { if (mPosition + length > mLength) {
length = mLength - mPosition; length = mLength - mPosition;
} }
if (length > 0) { if (length > 0) {
memcpy(pData, (void*)((s32)mBuffer + mPosition), length); memcpy(pData, (void*)((s32)mBuffer + mPosition), length);
mPosition += length; mPosition += length;
} }
return length; return length;
} }
@@ -35,6 +31,7 @@ u32 JSUMemoryInputStream::readData(void* pData, s32 length) {
* seekPos__20JSUMemoryInputStreamFl17JSUStreamSeekFrom */ * seekPos__20JSUMemoryInputStreamFl17JSUStreamSeekFrom */
s32 JSUMemoryInputStream::seekPos(s32 pos, JSUStreamSeekFrom seekFrom) { s32 JSUMemoryInputStream::seekPos(s32 pos, JSUStreamSeekFrom seekFrom) {
s32 oldPos = mPosition; s32 oldPos = mPosition;
switch (seekFrom) { switch (seekFrom) {
case JSUStreamSeekFrom_SET: case JSUStreamSeekFrom_SET:
mPosition = pos; mPosition = pos;
@@ -46,12 +43,15 @@ s32 JSUMemoryInputStream::seekPos(s32 pos, JSUStreamSeekFrom seekFrom) {
mPosition += pos; mPosition += pos;
break; break;
} }
if (mPosition < 0) { if (mPosition < 0) {
mPosition = 0; mPosition = 0;
} }
if (mPosition > mLength) { if (mPosition > mLength) {
mPosition = mLength; mPosition = mLength;
} }
return mPosition - oldPos; return mPosition - oldPos;
} }
+20 -23
View File
@@ -6,27 +6,30 @@
#include "JSystem/JUtility/JUTAssert.h" #include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JUtility/JUTDbPrint.h" #include "JSystem/JUtility/JUTDbPrint.h"
#include "JSystem/JUtility/JUTDirectPrint.h" #include "JSystem/JUtility/JUTDirectPrint.h"
#include "dol2asm.h"
#include "dolphin/types.h"
#include "dolphin/vi/vi.h" #include "dolphin/vi/vi.h"
// namespace JUTAssertion {
// Declarations:
//
/* 802E495C-802E4960 2DF29C 0004+00 0/0 1/1 0/0 .text create__12JUTAssertionFv */ /* 802E495C-802E4960 2DF29C 0004+00 0/0 1/1 0/0 .text create__12JUTAssertionFv */
void JUTAssertion::create() { void create() {}
/* empty function */
}
/* ############################################################################################## */ namespace {
/* 80451530-80451538 000A30 0004+04 2/2 0/0 0/0 .sbss /* 80451530-80451538 000A30 0004+04 2/2 0/0 0/0 .sbss
* sMessageLife__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ */ * sMessageLife__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ */
static u32 sMessageLife; static u32 sMessageLife;
/* 80434870-804348B0 061590 0040+00 2/2 0/0 0/0 .bss
* sMessageFileLine__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ */
static char sMessageFileLine[64];
/* 804348B0-804349B0 0615D0 0100+00 2/2 0/0 0/0 .bss
* sMessageString__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ */
static char sMessageString[256];
}; // namespace
/* 802E4960-802E499C 2DF2A0 003C+00 2/2 0/0 0/0 .text flush_subroutine__12JUTAssertionFv /* 802E4960-802E499C 2DF2A0 003C+00 2/2 0/0 0/0 .text flush_subroutine__12JUTAssertionFv
*/ */
u32 JUTAssertion::flush_subroutine() { u32 flush_subroutine() {
if (sMessageLife == 0) { if (sMessageLife == 0) {
return 0; return 0;
} }
@@ -38,20 +41,12 @@ u32 JUTAssertion::flush_subroutine() {
if (sMessageLife >= 5) { if (sMessageLife >= 5) {
return sMessageLife; return sMessageLife;
} }
return 0; return 0;
} }
/* ############################################################################################## */
/* 80434870-804348B0 061590 0040+00 2/2 0/0 0/0 .bss
* sMessageFileLine__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ */
static char sMessageFileLine[64];
/* 804348B0-804349B0 0615D0 0100+00 2/2 0/0 0/0 .bss
* sMessageString__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ */
static char sMessageString[256];
/* 802E499C-802E4A54 2DF2DC 00B8+00 0/0 1/1 0/0 .text flushMessage__12JUTAssertionFv */ /* 802E499C-802E4A54 2DF2DC 00B8+00 0/0 1/1 0/0 .text flushMessage__12JUTAssertionFv */
void JUTAssertion::flushMessage() { void flushMessage() {
if (flush_subroutine() && sAssertVisible == true) { if (flush_subroutine() && sAssertVisible == true) {
JUTDirectPrint* manager = JUTDirectPrint::getManager(); JUTDirectPrint* manager = JUTDirectPrint::getManager();
JUtility::TColor color = manager->getCharColor(); JUtility::TColor color = manager->getCharColor();
@@ -63,7 +58,7 @@ void JUTAssertion::flushMessage() {
} }
/* 802E4A54-802E4C34 2DF394 01E0+00 0/0 1/1 0/0 .text flushMessage_dbPrint__12JUTAssertionFv */ /* 802E4A54-802E4C34 2DF394 01E0+00 0/0 1/1 0/0 .text flushMessage_dbPrint__12JUTAssertionFv */
void JUTAssertion::flushMessage_dbPrint() { void flushMessage_dbPrint() {
if (flush_subroutine() && sAssertVisible == true && JUTDbPrint::getManager() != NULL) { if (flush_subroutine() && sAssertVisible == true && JUTDbPrint::getManager() != NULL) {
JUTFont* font = JUTDbPrint::getManager()->getFont(); JUTFont* font = JUTDbPrint::getManager()->getFont();
if (font != NULL) { if (font != NULL) {
@@ -77,12 +72,14 @@ void JUTAssertion::flushMessage_dbPrint() {
} }
/* 802E4C34-802E4C3C 2DF574 0008+00 0/0 2/2 0/0 .text setVisible__12JUTAssertionFb */ /* 802E4C34-802E4C3C 2DF574 0008+00 0/0 2/2 0/0 .text setVisible__12JUTAssertionFb */
void JUTAssertion::setVisible(bool visible) { void setVisible(bool visible) {
sAssertVisible = visible; sAssertVisible = visible;
} }
/* 802E4C3C-802E4C54 2DF57C 0018+00 0/0 2/2 0/0 .text setMessageCount__12JUTAssertionFi /* 802E4C3C-802E4C54 2DF57C 0018+00 0/0 2/2 0/0 .text setMessageCount__12JUTAssertionFi
*/ */
void JUTAssertion::setMessageCount(int msg_count) { void setMessageCount(int msg_count) {
sMessageLife = msg_count <= 0 ? 0 : msg_count; sMessageLife = msg_count <= 0 ? 0 : msg_count;
} }
}; // namespace JUTAssertion
+87 -42
View File
@@ -4,16 +4,8 @@
// //
#include "JSystem/JUtility/JUTCacheFont.h" #include "JSystem/JUtility/JUTCacheFont.h"
#include "JSystem/JUtility/JUTException.h"
#include "dol2asm.h" #include "dol2asm.h"
#include "dolphin/types.h"
//
// Types:
//
struct JUTException {
/* 802E21FC */ void panic_f(char const*, int, char const*, ...);
};
// //
// Forward References: // Forward References:
@@ -164,8 +156,8 @@ struct BlockHeader {
}; };
int JUTCacheFont::getMemorySize(ResFONT const* p_font, u16* o_widCount, u32* o_widSize, int JUTCacheFont::getMemorySize(ResFONT const* p_font, u16* o_widCount, u32* o_widSize,
u16* o_glyCount, u32* o_glySize, u16* o_mapCount, u32* o_mapSize, u16* o_glyCount, u32* o_glySize, u16* o_mapCount, u32* o_mapSize,
u32* o_glyTexSize) { u32* o_glyTexSize) {
if (p_font == NULL) { if (p_font == NULL) {
return 0; return 0;
} }
@@ -235,7 +227,7 @@ int JUTCacheFont::getMemorySize(ResFONT const* p_font, u16* o_widCount, u32* o_w
if (o_glyTexSize != NULL) { if (o_glyTexSize != NULL) {
*o_glyTexSize = maxGlyTexSize; *o_glyTexSize = maxGlyTexSize;
} }
return 1; return 1;
} }
#else #else
@@ -243,8 +235,8 @@ int JUTCacheFont::getMemorySize(ResFONT const* p_font, u16* o_widCount, u32* o_w
#pragma optimization_level 0 #pragma optimization_level 0
#pragma optimizewithasm off #pragma optimizewithasm off
asm int JUTCacheFont::getMemorySize(ResFONT const* param_0, u16* param_1, u32* param_2, asm int JUTCacheFont::getMemorySize(ResFONT const* param_0, u16* param_1, u32* param_2,
u16* param_3, u32* param_4, u16* param_5, u32* param_6, u16* param_3, u32* param_4, u16* param_5, u32* param_6,
u32* param_7) { u32* param_7) {
nofralloc nofralloc
#include "asm/JSystem/JUtility/JUTCacheFont/getMemorySize__12JUTCacheFontFPC7ResFONTPUsPUlPUsPUlPUsPUlPUl.s" #include "asm/JSystem/JUtility/JUTCacheFont/getMemorySize__12JUTCacheFontFPC7ResFONTPUsPUlPUsPUlPUsPUlPUl.s"
} }
@@ -253,8 +245,7 @@ asm int JUTCacheFont::getMemorySize(ResFONT const* param_0, u16* param_1, u32* p
/* 802DD4EC-802DD54C 2D7E2C 0060+00 1/1 0/0 0/0 .text /* 802DD4EC-802DD54C 2D7E2C 0060+00 1/1 0/0 0/0 .text
* initiate__12JUTCacheFontFPC7ResFONTPvUlP7JKRHeap */ * initiate__12JUTCacheFontFPC7ResFONTPvUlP7JKRHeap */
int JUTCacheFont::initiate(ResFONT const* p_fontRes, void* param_1, u32 param_2, int JUTCacheFont::initiate(ResFONT const* p_fontRes, void* param_1, u32 param_2, JKRHeap* p_heap) {
JKRHeap* p_heap) {
if (!internal_initiate(p_fontRes, param_1, param_2, p_heap)) { if (!internal_initiate(p_fontRes, param_1, param_2, p_heap)) {
deleteMemBlocks_CacheFont(); deleteMemBlocks_CacheFont();
deleteMemBlocks_ResFont(); deleteMemBlocks_ResFont();
@@ -269,20 +260,21 @@ int JUTCacheFont::initiate(ResFONT const* p_fontRes, void* param_1, u32 param_2,
/* 802DD54C-802DD650 2D7E8C 0104+00 1/1 0/0 0/0 .text /* 802DD54C-802DD650 2D7E8C 0104+00 1/1 0/0 0/0 .text
* internal_initiate__12JUTCacheFontFPC7ResFONTPvUlP7JKRHeap */ * internal_initiate__12JUTCacheFontFPC7ResFONTPvUlP7JKRHeap */
bool JUTCacheFont::internal_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) { JKRHeap* param_3) {
deleteMemBlocks_CacheFont(); deleteMemBlocks_CacheFont();
initialize_state(); initialize_state();
deleteMemBlocks_ResFont(); deleteMemBlocks_ResFont();
JUTResFont::initialize_state(); JUTResFont::initialize_state();
JUTFont::initialize_state(); JUTFont::initialize_state();
if (p_fontRes == NULL) { if (p_fontRes == NULL) {
return false; return false;
} }
mResFont = p_fontRes; mResFont = p_fontRes;
mValid = true; mValid = true;
getMemorySize(p_fontRes, &mWid1BlockNum, &mTotalWidSize, &mGly1BlockNum, &mTotalGlySize, &mMap1BlockNum, &mTotalMapSize, &mMaxSheetSize); getMemorySize(p_fontRes, &mWid1BlockNum, &mTotalWidSize, &mGly1BlockNum, &mTotalGlySize,
&mMap1BlockNum, &mTotalMapSize, &mMaxSheetSize);
if (!allocArea(param_1, param_2, param_3)) { if (!allocArea(param_1, param_2, param_3)) {
return false; return false;
@@ -295,14 +287,60 @@ bool JUTCacheFont::internal_initiate(ResFONT const* p_fontRes, void* param_1, u3
} }
/* 802DD650-802DD804 2D7F90 01B4+00 1/1 0/0 0/0 .text allocArea__12JUTCacheFontFPvUlP7JKRHeap */ /* 802DD650-802DD804 2D7F90 01B4+00 1/1 0/0 0/0 .text allocArea__12JUTCacheFontFPvUlP7JKRHeap */
#pragma push bool JUTCacheFont::allocArea(void* param_0, u32 param_1, JKRHeap* heap) {
#pragma optimization_level 0 mInf1Ptr = (ResFONT::INF1*)new (heap, 0) ResFONT();
#pragma optimizewithasm off if (mInf1Ptr == NULL) {
asm bool JUTCacheFont::allocArea(void* param_0, u32 param_1, JKRHeap* param_2) { return false;
nofralloc }
#include "asm/JSystem/JUtility/JUTCacheFont/allocArea__12JUTCacheFontFPvUlP7JKRHeap.s"
if (mTotalWidSize != 0) {
field_0x7c = new (heap, 0) u8[mTotalWidSize];
if (field_0x7c == NULL) {
return false;
}
}
if (mGly1BlockNum != 0) {
field_0x80 = new (heap, 0) ResFONT::GLY1[mGly1BlockNum];
if (field_0x80 == NULL) {
return false;
}
field_0xac = JKRAram::getManager()->mAramHeap->alloc(
mTotalGlySize - (mGly1BlockNum * sizeof(ResFONT::GLY1)), JKRAramHeap::HEAD);
if (field_0xac == NULL) {
return false;
}
}
if (mTotalMapSize != 0) {
field_0x84 = new (heap, 0) u8[mTotalMapSize];
if (field_0x84 == NULL) {
return false;
}
}
field_0x94 = mMaxSheetSize + 0x40;
mCachePage = param_1 / field_0x94;
u32 v1 = field_0x94 * mCachePage;
if (mCachePage == 0) {
return false;
}
if (param_0 != NULL) {
mCacheBuffer = param_0;
field_0xb0 = 0;
} else {
mCacheBuffer = new (heap, 0x20) u8[v1];
if (mCacheBuffer == NULL) {
return false;
}
field_0xb0 = 1;
}
invalidiateAllCache();
return true;
} }
#pragma pop
/* 802DD804-802DD8EC 2D8144 00E8+00 1/1 0/0 0/0 .text allocArray__12JUTCacheFontFP7JKRHeap */ /* 802DD804-802DD8EC 2D8144 00E8+00 1/1 0/0 0/0 .text allocArray__12JUTCacheFontFP7JKRHeap */
#pragma push #pragma push
@@ -399,25 +437,34 @@ asm void JUTCacheFont::invalidiateAllCache() {
/* 802DDF68-802DDFAC 2D88A8 0044+00 2/2 0/0 0/0 .text /* 802DDF68-802DDFAC 2D88A8 0044+00 2/2 0/0 0/0 .text
* unlink__12JUTCacheFontFPQ212JUTCacheFont15TGlyphCacheInfo */ * unlink__12JUTCacheFontFPQ212JUTCacheFont15TGlyphCacheInfo */
#pragma push void JUTCacheFont::unlink(JUTCacheFont::TGlyphCacheInfo* cacheInfo) {
#pragma optimization_level 0 if (cacheInfo->mPrev == NULL) {
#pragma optimizewithasm off field_0x9c = cacheInfo->mNext;
asm void JUTCacheFont::unlink(JUTCacheFont::TGlyphCacheInfo* param_0) { } else {
nofralloc cacheInfo->mPrev->mNext = cacheInfo->mNext;
#include "asm/JSystem/JUtility/JUTCacheFont/unlink__12JUTCacheFontFPQ212JUTCacheFont15TGlyphCacheInfo.s" }
if (cacheInfo->mNext == NULL) {
field_0xa0 = cacheInfo->mPrev;
} else {
cacheInfo->mNext->mPrev = cacheInfo->mPrev;
}
} }
#pragma pop
/* 802DDFAC-802DDFD8 2D88EC 002C+00 2/2 0/0 0/0 .text /* 802DDFAC-802DDFD8 2D88EC 002C+00 2/2 0/0 0/0 .text
* prepend__12JUTCacheFontFPQ212JUTCacheFont15TGlyphCacheInfo */ * prepend__12JUTCacheFontFPQ212JUTCacheFont15TGlyphCacheInfo */
#pragma push void JUTCacheFont::prepend(JUTCacheFont::TGlyphCacheInfo* cacheInfo) {
#pragma optimization_level 0 TGlyphCacheInfo* oldHead = field_0x9c;
#pragma optimizewithasm off field_0x9c = cacheInfo;
asm void JUTCacheFont::prepend(JUTCacheFont::TGlyphCacheInfo* param_0) { cacheInfo->mPrev = NULL;
nofralloc cacheInfo->mNext = oldHead;
#include "asm/JSystem/JUtility/JUTCacheFont/prepend__12JUTCacheFontFPQ212JUTCacheFont15TGlyphCacheInfo.s"
if (oldHead == NULL) {
field_0xa0 = cacheInfo;
} else {
oldHead->mPrev = cacheInfo;
}
} }
#pragma pop
/* 802DDFD8-802DDFE0 2D8918 0008+00 1/0 1/0 0/0 .text getResFont__10JUTResFontCFv */ /* 802DDFD8-802DDFE0 2D8918 0008+00 1/0 1/0 0/0 .text getResFont__10JUTResFontCFv */
#pragma push #pragma push
@@ -488,5 +535,3 @@ asm s32 JUTResFont::getHeight() const {
#include "asm/JSystem/JUtility/JUTCacheFont/getHeight__10JUTResFontCFv.s" #include "asm/JSystem/JUtility/JUTCacheFont/getHeight__10JUTResFontCFv.s"
} }
#pragma pop #pragma pop
/* 8039D2F0-8039D2F0 029950 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
+5 -2
View File
@@ -10,7 +10,6 @@
#include "JSystem/JUtility/JUTVideo.h" #include "JSystem/JUtility/JUTVideo.h"
#include "MSL_C/MSL_Common/Src/printf.h" #include "MSL_C/MSL_Common/Src/printf.h"
#include "dol2asm.h" #include "dol2asm.h"
#include "dolphin/types.h"
// //
// Forward References: // Forward References:
@@ -315,10 +314,12 @@ void JUTConsole::scroll(int scrollAmnt) {
} }
} }
} }
field_0x30 += scrollAmnt; field_0x30 += scrollAmnt;
if (field_0x30 < 0) { if (field_0x30 < 0) {
field_0x30 += mMaxLines; field_0x30 += mMaxLines;
} }
if (field_0x30 >= mMaxLines) { if (field_0x30 >= mMaxLines) {
field_0x30 -= mMaxLines; field_0x30 -= mMaxLines;
} }
@@ -346,6 +347,7 @@ JUTConsoleManager* JUTConsoleManager::createManager(JKRHeap* pHeap) {
if (pHeap == NULL) { if (pHeap == NULL) {
pHeap = JKRHeap::sCurrentHeap; pHeap = JKRHeap::sCurrentHeap;
} }
JUTConsoleManager* manager = new (pHeap, 0) JUTConsoleManager(); JUTConsoleManager* manager = new (pHeap, 0) JUTConsoleManager();
sManager = manager; sManager = manager;
return manager; return manager;
@@ -457,7 +459,8 @@ extern "C" void JUTReportConsole_f_va(const char* fmt, va_list args) {
if (JUTGetReportConsole() == NULL) { if (JUTGetReportConsole() == NULL) {
vsnprintf(buf, sizeof(buf), fmt, args); vsnprintf(buf, sizeof(buf), fmt, args);
} else if (JUTGetReportConsole()->getOutput() & } else if (JUTGetReportConsole()->getOutput() &
(JUTConsole::OUTPUT_CONSOLE | JUTConsole::OUTPUT_OSREPORT)) { (JUTConsole::OUTPUT_CONSOLE | JUTConsole::OUTPUT_OSREPORT))
{
vsnprintf(buf, sizeof(buf), fmt, args); vsnprintf(buf, sizeof(buf), fmt, args);
JUTGetReportConsole()->print(buf); JUTGetReportConsole()->print(buf);
} }
+6 -2
View File
@@ -8,8 +8,6 @@
#include "JSystem/JUtility/JUTVideo.h" #include "JSystem/JUtility/JUTVideo.h"
#include "MSL_C/MSL_Common/Src/printf.h" #include "MSL_C/MSL_Common/Src/printf.h"
#include "MSL_C/MSL_Common/Src/string.h" #include "MSL_C/MSL_Common/Src/string.h"
#include "dol2asm.h"
#include "dolphin/types.h"
/* 802E0148-802E0190 2DAA88 0048+00 1/1 0/0 0/0 .text __ct__10JUTDbPrintFP7JUTFontP7JKRHeap */ /* 802E0148-802E0190 2DAA88 0048+00 1/1 0/0 0/0 .text __ct__10JUTDbPrintFP7JUTFontP7JKRHeap */
JUTDbPrint::JUTDbPrint(JUTFont* pFont, JKRHeap* pHeap) { JUTDbPrint::JUTDbPrint(JUTFont* pFont, JKRHeap* pHeap) {
@@ -32,6 +30,7 @@ JUTDbPrint* JUTDbPrint::start(JUTFont* pFont, JKRHeap* pHeap) {
} }
sDebugPrint = new JUTDbPrint(pFont, pHeap); sDebugPrint = new JUTDbPrint(pFont, pHeap);
} }
return sDebugPrint; return sDebugPrint;
} }
@@ -81,6 +80,7 @@ void JUTDbPrint::flush(int param_0, int param_1, int param_2, int param_3) {
if (mVisible) { if (mVisible) {
this->drawString(cur->unk_0x04, cur->unk_0x06, cur->unk_0x0A, (u8*)cur->unk_0x0C); this->drawString(cur->unk_0x04, cur->unk_0x06, cur->unk_0x0A, (u8*)cur->unk_0x0C);
} }
if (--cur->unk_0x08 <= 0) { if (--cur->unk_0x08 <= 0) {
unk_print* next = cur->mNext; unk_print* next = cur->mNext;
JKRFreeToHeap(mHeap, cur); JKRFreeToHeap(mHeap, cur);
@@ -105,9 +105,11 @@ void JUTDbPrint::drawString(int param_0, int param_1, int param_2, u8 const* par
void JUTReport(int param_0, int param_1, char const* fmt, ...) { void JUTReport(int param_0, int param_1, char const* fmt, ...) {
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
char buf[0x100]; char buf[0x100];
int ret = vsnprintf(buf, 0x100, fmt, args); int ret = vsnprintf(buf, 0x100, fmt, args);
va_end(args); va_end(args);
if (ret < 0) { if (ret < 0) {
return; return;
} }
@@ -118,9 +120,11 @@ void JUTReport(int param_0, int param_1, char const* fmt, ...) {
void JUTReport(int param_0, int param_1, int param_2, char const* fmt, ...) { void JUTReport(int param_0, int param_1, int param_2, char const* fmt, ...) {
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
char buf[0x100]; char buf[0x100];
int ret = vsnprintf(buf, 0x100, fmt, args); int ret = vsnprintf(buf, 0x100, fmt, args);
va_end(args); va_end(args);
if (ret < 0) { if (ret < 0) {
return; return;
} }
-1
View File
@@ -8,7 +8,6 @@
#include "Runtime.PPCEABI.H/__va_arg.h" #include "Runtime.PPCEABI.H/__va_arg.h"
#include "dol2asm.h" #include "dol2asm.h"
#include "dolphin/os/OSCache.h" #include "dolphin/os/OSCache.h"
#include "dolphin/types.h"
#include "global.h" #include "global.h"
// //
+6 -7
View File
@@ -5,13 +5,12 @@
#include "JSystem/JUtility/JUTException.h" #include "JSystem/JUtility/JUTException.h"
#include "JSystem/JUtility/JUTConsole.h" #include "JSystem/JUtility/JUTConsole.h"
#include "JSystem/JUtility/JUTDirectPrint.h"
#include "JSystem/JUtility/JUTDirectFile.h" #include "JSystem/JUtility/JUTDirectFile.h"
#include "JSystem/JUtility/JUTDirectPrint.h"
#include "MSL_C/MSL_Common/Src/float.h" #include "MSL_C/MSL_Common/Src/float.h"
#include "MSL_C/MSL_Common/Src/printf.h" #include "MSL_C/MSL_Common/Src/printf.h"
#include "Runtime.PPCEABI.H/__va_arg.h" #include "Runtime.PPCEABI.H/__va_arg.h"
#include "dol2asm.h" #include "dol2asm.h"
#include "dolphin/types.h"
// //
// Forward References: // Forward References:
@@ -110,7 +109,7 @@ OSErrorHandler JUTException::sPostUserCallback;
/* 802E1D5C-802E1E40 2DC69C 00E4+00 1/1 0/0 0/0 .text __ct__12JUTExceptionFP14JUTDirectPrint */ /* 802E1D5C-802E1E40 2DC69C 00E4+00 1/1 0/0 0/0 .text __ct__12JUTExceptionFP14JUTDirectPrint */
JUTException::JUTException(JUTDirectPrint* directPrint) JUTException::JUTException(JUTDirectPrint* directPrint)
: JKRThread(0x1C00 /* 0x4000 in DEBUG */, 0x10, 0), mDirectPrint(directPrint) { : JKRThread(0x1C00, 0x10, 0), mDirectPrint(directPrint) {
OSSetErrorHandler(EXCEPTION_DSI, errorHandler); OSSetErrorHandler(EXCEPTION_DSI, errorHandler);
OSSetErrorHandler(EXCEPTION_ISI, errorHandler); OSSetErrorHandler(EXCEPTION_ISI, errorHandler);
OSSetErrorHandler(EXCEPTION_PROGRAM, errorHandler); OSSetErrorHandler(EXCEPTION_PROGRAM, errorHandler);
@@ -945,13 +944,15 @@ bool JUTException::queryMapAddress(char* mapPath, u32 address, s32 section_id, u
strcpy(buffer, mapPath); strcpy(buffer, mapPath);
strcat(buffer, ".map"); strcat(buffer, ".map");
if (queryMapAddress_single(buffer, address, section_id, out_addr, out_size, out_line, if (queryMapAddress_single(buffer, address, section_id, out_addr, out_size, out_line,
line_length, print, begin_with_newline) == true) { line_length, print, begin_with_newline) == true)
{
return true; return true;
} }
} else if (sMapFileList.getFirst() != sMapFileList.getEnd()) { } else if (sMapFileList.getFirst() != sMapFileList.getEnd()) {
if (queryMapAddress_single(sMapFileList.getFirst()->getObject()->mPath, address, -1, if (queryMapAddress_single(sMapFileList.getFirst()->getObject()->mPath, address, -1,
out_addr, out_size, out_line, line_length, print, out_addr, out_size, out_line, line_length, print,
begin_with_newline) == true) { begin_with_newline) == true)
{
return true; return true;
} }
} }
@@ -1147,5 +1148,3 @@ JUTException::~JUTException() {}
*/ */
/* 804508F8-80450900 000378 0008+00 0/0 3/3 0/0 .sdata None */ /* 804508F8-80450900 000378 0008+00 0/0 3/3 0/0 .sdata None */
SECTION_SDATA extern bool sAssertVisible = true; SECTION_SDATA extern bool sAssertVisible = true;
/* 8039D490-8039D490 029AF0 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
@@ -5,7 +5,6 @@
#include "JSystem/JUtility/JUTFontData_Ascfont_fix12.h" #include "JSystem/JUtility/JUTFontData_Ascfont_fix12.h"
#include "dol2asm.h" #include "dol2asm.h"
#include "dolphin/types.h"
// //
// Forward References: // Forward References:

Some files were not shown because too many files have changed in this diff Show More