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

View File

@ -22,7 +22,7 @@ public:
u32 getGraphMemory() const { return mGraphMemoryPtr; }
u32 getGraphMemSize() const { return mGraphMemorySize; }
private:
//private:
/* 0x00 */ // vtable
/* 0x04 */ // JKRThread
/* 0x7C */ u32 mAudioMemoryPtr;

View File

@ -38,12 +38,18 @@ extern TAtanTable atanTable_;
extern TAsinAcosTable asinAcosTable_;
}; // namespace JMath
inline f32 JMASSin(s16 s) {
return JMath::sincosTable_.sinShort(s);
inline f32 JMASCosShort(s16 v) {
return JMath::sincosTable_.cosShort(v);
}
inline f32 JMASinShort(s16 v) {
return JMath::sincosTable_.sinShort(v);
}
inline f32 JMASCos(s16 s) {
return JMath::sincosTable_.cosShort(s);
inline f32 JMASCos(s16 v) {
return JMASCosShort(v);
}
inline f32 JMASSin(s16 v) {
return JMASinShort(v);
}
#endif /* JMATRIGONOMETRIC_H */

View File

@ -23,14 +23,13 @@
#define JUT_PANIC(...)
#endif
// TODO: make it a namespace
struct JUTAssertion {
/* 802E495C */ static void create();
/* 802E4960 */ static u32 flush_subroutine();
/* 802E499C */ static void flushMessage();
/* 802E4A54 */ static void flushMessage_dbPrint();
/* 802E4C34 */ static void setVisible(bool);
/* 802E4C3C */ static void setMessageCount(int);
namespace JUTAssertion {
/* 802E495C */ void create();
/* 802E4960 */ u32 flush_subroutine();
/* 802E499C */ void flushMessage();
/* 802E4A54 */ void flushMessage_dbPrint();
/* 802E4C34 */ void setVisible(bool);
/* 802E4C3C */ void setMessageCount(int);
};
extern bool sAssertVisible;

View File

@ -8,8 +8,8 @@
class JUTCacheFont : public JUTResFont {
public:
struct TGlyphCacheInfo {
/* 0x0 */ TGlyphCacheInfo* field_0x0;
/* 0x4 */ TGlyphCacheInfo** field_0x4;
/* 0x0 */ TGlyphCacheInfo* mPrev;
/* 0x4 */ TGlyphCacheInfo* mNext;
};
struct TCachePage {
@ -64,7 +64,7 @@ private:
/* 0x84 */ void* field_0x84;
/* 0x88 */ u32 mMaxSheetSize;
/* 0x8C */ EPagingType mPagingType;
/* 0x90 */ void** mCacheBuffer;
/* 0x90 */ void* mCacheBuffer;
/* 0x94 */ int field_0x94;
/* 0x98 */ u32 mCachePage;
/* 0x9C */ TGlyphCacheInfo* field_0x9c;

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(const char*, ...);
extern "C" void JUTWarningConsole(const char* message);
extern "C" void JUTReportConsole(const char* message);
#endif /* JUTCONSOLE_H */

View File

@ -55,6 +55,7 @@ struct ResFONT {
/* 0x08 */ u32 filesize;
/* 0x0C */ u32 numBlocks;
/* 0x10 */ u8 padding[0x10];
/* 0x20 */ u8 data[];
};
class JUTFont {

View File

@ -3,9 +3,13 @@
#include "JSystem/JKernel/JKRHeap.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 {
public:
@ -43,7 +47,7 @@ public:
initialize_state();
}
static void* const saoAboutEncoding_[3];
static IsLeadByte_func const saoAboutEncoding_[3];
// some types uncertain, may need to be fixed
/* 0x1C */ int mWidth;
@ -61,7 +65,7 @@ public:
/* 0x64 */ u16 mMap1BlockNum;
/* 0x66 */ u16 field_0x66;
/* 0x68 */ u16 mMaxCode;
/* 0x6C */ IsLeadByte* mIsLeadByte;
/* 0x6C */ IsLeadByte_func* mIsLeadByte;
};
#endif /* JUTRESFONT_H */

View File

@ -4,8 +4,8 @@
//
#include "JSystem/JMath/JMath.h"
#include "JSystem/JMath/JMATrigonometric.h"
#include "dol2asm.h"
#include "dolphin/types.h"
//
// 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
*/
#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 optimization_level 0
#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"
}
#pragma pop
/* ############################################################################################## */
/* 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,
};
#endif
/* 80339938-80339A30 334278 00F8+00 0/0 5/5 0/0 .text
* JMAQuatLerp__FPC10QuaternionPC10QuaternionfP10Quaternion */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void JMAQuatLerp(Quaternion const* param_0, Quaternion const* param_1, f32 param_2,
Quaternion* param_3) {
nofralloc
#include "asm/JSystem/JMath/JMath/JMAQuatLerp__FPC10QuaternionPC10QuaternionfP10Quaternion.s"
void JMAQuatLerp(register const Quaternion* p, register const Quaternion* q, f32 t,
Quaternion* dst) {
register f32 pxy, pzw, qxy, qzw;
register f32 dp;
__asm // compute dot product
{
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
*/

View File

@ -4,12 +4,6 @@
//
#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 */
JMath::TRandom_fast_::TRandom_fast_(u32 param_0) {

View File

@ -4,12 +4,6 @@
//
#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 */
JSUFileInputStream::JSUFileInputStream(JKRFile* pFile) {
@ -22,11 +16,10 @@ JSUFileInputStream::JSUFileInputStream(JKRFile* pFile) {
u32 JSUFileInputStream::readData(void* pBuffer, s32 length) {
s32 lenRead = 0;
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()) {
length = mFile->getFileSize() - mPosition;
}
if (length > 0) {
lenRead = mFile->readData(pBuffer, length, mPosition);
if (lenRead < 0) {
@ -36,6 +29,7 @@ u32 JSUFileInputStream::readData(void* pBuffer, s32 length) {
}
}
}
return lenRead;
}
@ -43,6 +37,7 @@ u32 JSUFileInputStream::readData(void* pBuffer, s32 length) {
* seekPos__18JSUFileInputStreamFl17JSUStreamSeekFrom */
s32 JSUFileInputStream::seekPos(s32 pos, JSUStreamSeekFrom seekFrom) {
s32 oldPos = mPosition;
switch (seekFrom) {
case JSUStreamSeekFrom_SET:
mPosition = pos;
@ -54,12 +49,15 @@ s32 JSUFileInputStream::seekPos(s32 pos, JSUStreamSeekFrom seekFrom) {
mPosition += pos;
break;
}
if (mPosition < 0) {
mPosition = 0;
}
if (mPosition > mFile->getFileSize()) {
mPosition = mFile->getFileSize();
}
return mPosition - oldPos;
}

View File

@ -5,37 +5,19 @@
#include "JSystem/JSupport/JSUInputStream.h"
#include "JSystem/JSupport/JSURandomInputStream.h"
#include "dol2asm.h"
#include "global.h"
//
// Types:
//
//
// 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 peek__20JSURandomInputStreamFPvl();
extern "C" void seek__20JSURandomInputStreamFl17JSUStreamSeekFrom();
//
// External References:
//
extern "C" void __dt__20JSURandomInputStreamFv();
extern "C" void __dl__FPv();
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:
@ -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 */
SECTION_DATA extern void* __vt__20JSURandomInputStream[9] = {
extern void* __vt__20JSURandomInputStream[9] = {
(void*)NULL /* RTTI */,
(void*)NULL,
(void*)__dt__20JSURandomInputStreamFv,
@ -55,26 +37,14 @@ SECTION_DATA extern void* __vt__20JSURandomInputStream[9] = {
(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 */
JSUInputStream::~JSUInputStream() {}
/* 802DC298-802DC2F0 2D6BD8 0058+00 1/1 20/20 0/0 .text read__14JSUInputStreamFPvl */
s32 JSUInputStream::read(void* buffer, s32 numBytes) {
s32 bytesRead = this->readData(buffer, numBytes);
s32 bytesRead = readData(buffer, numBytes);
if (bytesRead != numBytes) {
this->setState(IOS_STATE_1);
setState(IOS_STATE_1);
}
return bytesRead;
}
@ -84,7 +54,7 @@ s32 JSUInputStream::skip(s32 count) {
s32 skipCount = 0;
u8 buffer[1];
while (count > skipCount) {
if (this->readData(&buffer, 1) != 1) {
if (readData(&buffer, 1) != 1) {
setState(IOS_STATE_1);
break;
}
@ -95,15 +65,15 @@ s32 JSUInputStream::skip(s32 count) {
/* 802DC370-802DC3FC 2D6CB0 008C+00 0/0 1/1 0/0 .text align__20JSURandomInputStreamFl */
s32 JSURandomInputStream::align(s32 alignment) {
s32 currentPos = this->getPosition();
s32 currentPos = getPosition();
s32 offset = (alignment + currentPos);
offset -= 1;
offset &= ~(alignment - 1);
s32 alignmentOffset = offset - currentPos;
if (alignmentOffset != 0) {
s32 seekLen = this->seekPos(offset, JSUStreamSeekFrom_SET);
s32 seekLen = seekPos(offset, JSUStreamSeekFrom_SET);
if (seekLen != alignmentOffset) {
this->setState(IOS_STATE_1);
setState(IOS_STATE_1);
}
}
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 */
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) {
this->setState(IOS_STATE_1);
setState(IOS_STATE_1);
}
return val;
}
/* 802DC458-802DC4DC 2D6D98 0084+00 0/0 8/8 0/0 .text peek__20JSURandomInputStreamFPvl */
s32 JSURandomInputStream::peek(void* buffer, s32 numBytes) {
s32 oldPos = this->getPosition();
s32 bytesRead = this->read(buffer, numBytes);
s32 oldPos = getPosition();
s32 bytesRead = read(buffer, numBytes);
if (bytesRead != 0) {
this->seekPos(oldPos, JSUStreamSeekFrom_SET);
seekPos(oldPos, JSUStreamSeekFrom_SET);
}
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
* seek__20JSURandomInputStreamFl17JSUStreamSeekFrom */
s32 JSURandomInputStream::seek(s32 param_0, JSUStreamSeekFrom param_1) {
s32 seekResult = this->seekPos(param_0, param_1);
this->clrState(IOS_STATE_1);
s32 seekResult = seekPos(param_0, param_1);
clrState(IOS_STATE_1);
return seekResult;
}

View File

@ -4,32 +4,30 @@
//
#include "JSystem/JSupport/JSUList.h"
#include "dol2asm.h"
#include "dolphin/types.h"
JSUPtrLink::JSUPtrLink(void* object) {
this->mList = NULL;
this->mObject = object;
this->mPrev = NULL;
this->mNext = NULL;
mList = NULL;
mObject = object;
mPrev = NULL;
mNext = NULL;
}
JSUPtrLink::~JSUPtrLink() {
if (this->mList != NULL) {
this->mList->remove(this);
if (mList != NULL) {
mList->remove(this);
}
}
JSUPtrList::JSUPtrList(bool init) {
if (init) {
this->initiate();
initiate();
}
}
JSUPtrList::~JSUPtrList() {
JSUPtrLink* node = this->mHead;
JSUPtrLink* node = mHead;
s32 removed = 0;
while (this->mLength > removed) {
while (mLength > removed) {
node->mList = NULL;
node = node->getNext();
removed += 1;
@ -37,18 +35,18 @@ JSUPtrList::~JSUPtrList() {
}
void JSUPtrList::initiate() {
this->mHead = NULL;
this->mTail = NULL;
this->mLength = 0;
mHead = NULL;
mTail = NULL;
mLength = 0;
}
void JSUPtrList::setFirst(JSUPtrLink* first) {
first->mList = this;
first->mPrev = NULL;
first->mNext = NULL;
this->mTail = first;
this->mHead = first;
this->mLength = 1;
mTail = first;
mHead = first;
mLength = 1;
}
bool JSUPtrList::append(JSUPtrLink* ptr) {
@ -59,15 +57,15 @@ bool JSUPtrList::append(JSUPtrLink* ptr) {
}
if (result) {
if (this->mLength == 0) {
this->setFirst(ptr);
if (mLength == 0) {
setFirst(ptr);
} else {
ptr->mList = this;
ptr->mPrev = this->mTail;
ptr->mPrev = mTail;
ptr->mNext = NULL;
this->mTail->mNext = ptr;
this->mTail = ptr;
this->mLength++;
mTail->mNext = ptr;
mTail = ptr;
mLength++;
}
}
@ -82,15 +80,15 @@ bool JSUPtrList::prepend(JSUPtrLink* ptr) {
}
if (result) {
if (this->mLength == 0) {
this->setFirst(ptr);
if (mLength == 0) {
setFirst(ptr);
} else {
ptr->mList = this;
ptr->mPrev = NULL;
ptr->mNext = this->mHead;
this->mHead->mPrev = ptr;
this->mHead = ptr;
this->mLength++;
ptr->mNext = mHead;
mHead->mPrev = ptr;
mHead = ptr;
mLength++;
}
}
@ -98,10 +96,10 @@ bool JSUPtrList::prepend(JSUPtrLink* ptr) {
}
bool JSUPtrList::insert(JSUPtrLink* before, JSUPtrLink* ptr) {
if (before == this->mHead) {
return this->prepend(ptr);
if (before == mHead) {
return prepend(ptr);
} else if (before == NULL) {
return this->append(ptr);
return append(ptr);
}
if (before->mList != this) {
@ -120,7 +118,7 @@ bool JSUPtrList::insert(JSUPtrLink* before, JSUPtrLink* ptr) {
ptr->mNext = before;
prev->mNext = ptr;
before->mPrev = ptr;
this->mLength++;
mLength++;
}
return result;
@ -129,33 +127,33 @@ bool JSUPtrList::insert(JSUPtrLink* before, JSUPtrLink* ptr) {
bool JSUPtrList::remove(JSUPtrLink* ptr) {
bool is_parent = (ptr->mList == this);
if (is_parent) {
if (this->mLength == 1) {
this->mHead = NULL;
this->mTail = NULL;
} else if (ptr == this->mHead) {
if (mLength == 1) {
mHead = NULL;
mTail = NULL;
} else if (ptr == mHead) {
ptr->mNext->mPrev = NULL;
this->mHead = ptr->mNext;
} else if (ptr == this->mTail) {
mHead = ptr->mNext;
} else if (ptr == mTail) {
ptr->mPrev->mNext = NULL;
this->mTail = ptr->mPrev;
mTail = ptr->mPrev;
} else {
ptr->mPrev->mNext = ptr->mNext;
ptr->mNext->mPrev = ptr->mPrev;
}
ptr->mList = NULL;
this->mLength--;
mLength--;
}
return is_parent;
}
JSUPtrLink* JSUPtrList::getNthLink(u32 index) const {
if (index >= this->mLength) {
if (index >= mLength) {
return NULL;
}
JSUPtrLink* node = this->mHead;
JSUPtrLink* node = mHead;
for (u32 i = 0; i < index; i++) {
node = node->getNext();
}

View File

@ -5,12 +5,6 @@
#include "JSystem/JSupport/JSUMemoryStream.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 */
void JSUMemoryInputStream::setBuffer(void const* pBuffer, s32 length) {
@ -24,10 +18,12 @@ u32 JSUMemoryInputStream::readData(void* pData, s32 length) {
if (mPosition + length > mLength) {
length = mLength - mPosition;
}
if (length > 0) {
memcpy(pData, (void*)((s32)mBuffer + mPosition), length);
mPosition += length;
}
return length;
}
@ -35,6 +31,7 @@ u32 JSUMemoryInputStream::readData(void* pData, s32 length) {
* seekPos__20JSUMemoryInputStreamFl17JSUStreamSeekFrom */
s32 JSUMemoryInputStream::seekPos(s32 pos, JSUStreamSeekFrom seekFrom) {
s32 oldPos = mPosition;
switch (seekFrom) {
case JSUStreamSeekFrom_SET:
mPosition = pos;
@ -46,12 +43,15 @@ s32 JSUMemoryInputStream::seekPos(s32 pos, JSUStreamSeekFrom seekFrom) {
mPosition += pos;
break;
}
if (mPosition < 0) {
mPosition = 0;
}
if (mPosition > mLength) {
mPosition = mLength;
}
return mPosition - oldPos;
}

View File

@ -6,27 +6,30 @@
#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JUtility/JUTDbPrint.h"
#include "JSystem/JUtility/JUTDirectPrint.h"
#include "dol2asm.h"
#include "dolphin/types.h"
#include "dolphin/vi/vi.h"
//
// Declarations:
//
namespace JUTAssertion {
/* 802E495C-802E4960 2DF29C 0004+00 0/0 1/1 0/0 .text create__12JUTAssertionFv */
void JUTAssertion::create() {
/* empty function */
}
void create() {}
/* ############################################################################################## */
namespace {
/* 80451530-80451538 000A30 0004+04 2/2 0/0 0/0 .sbss
* sMessageLife__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ */
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
*/
u32 JUTAssertion::flush_subroutine() {
u32 flush_subroutine() {
if (sMessageLife == 0) {
return 0;
}
@ -38,20 +41,12 @@ u32 JUTAssertion::flush_subroutine() {
if (sMessageLife >= 5) {
return sMessageLife;
}
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 */
void JUTAssertion::flushMessage() {
void flushMessage() {
if (flush_subroutine() && sAssertVisible == true) {
JUTDirectPrint* manager = JUTDirectPrint::getManager();
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 */
void JUTAssertion::flushMessage_dbPrint() {
void flushMessage_dbPrint() {
if (flush_subroutine() && sAssertVisible == true && JUTDbPrint::getManager() != NULL) {
JUTFont* font = JUTDbPrint::getManager()->getFont();
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 */
void JUTAssertion::setVisible(bool visible) {
void setVisible(bool visible) {
sAssertVisible = visible;
}
/* 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;
}
}; // namespace JUTAssertion

View File

@ -4,16 +4,8 @@
//
#include "JSystem/JUtility/JUTCacheFont.h"
#include "JSystem/JUtility/JUTException.h"
#include "dol2asm.h"
#include "dolphin/types.h"
//
// Types:
//
struct JUTException {
/* 802E21FC */ void panic_f(char const*, int, char const*, ...);
};
//
// Forward References:
@ -164,8 +156,8 @@ struct BlockHeader {
};
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,
u32* o_glyTexSize) {
u16* o_glyCount, u32* o_glySize, u16* o_mapCount, u32* o_mapSize,
u32* o_glyTexSize) {
if (p_font == NULL) {
return 0;
}
@ -235,7 +227,7 @@ int JUTCacheFont::getMemorySize(ResFONT const* p_font, u16* o_widCount, u32* o_w
if (o_glyTexSize != NULL) {
*o_glyTexSize = maxGlyTexSize;
}
return 1;
}
#else
@ -243,8 +235,8 @@ int JUTCacheFont::getMemorySize(ResFONT const* p_font, u16* o_widCount, u32* o_w
#pragma optimization_level 0
#pragma optimizewithasm off
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,
u32* param_7) {
u16* param_3, u32* param_4, u16* param_5, u32* param_6,
u32* param_7) {
nofralloc
#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
* initiate__12JUTCacheFontFPC7ResFONTPvUlP7JKRHeap */
int JUTCacheFont::initiate(ResFONT const* p_fontRes, void* param_1, u32 param_2,
JKRHeap* p_heap) {
int JUTCacheFont::initiate(ResFONT const* p_fontRes, void* param_1, u32 param_2, JKRHeap* p_heap) {
if (!internal_initiate(p_fontRes, param_1, param_2, p_heap)) {
deleteMemBlocks_CacheFont();
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
* internal_initiate__12JUTCacheFontFPC7ResFONTPvUlP7JKRHeap */
bool JUTCacheFont::internal_initiate(ResFONT const* p_fontRes, void* param_1, u32 param_2,
JKRHeap* param_3) {
JKRHeap* param_3) {
deleteMemBlocks_CacheFont();
initialize_state();
deleteMemBlocks_ResFont();
JUTResFont::initialize_state();
JUTFont::initialize_state();
if (p_fontRes == NULL) {
return false;
}
mResFont = p_fontRes;
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)) {
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 */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm bool JUTCacheFont::allocArea(void* param_0, u32 param_1, JKRHeap* param_2) {
nofralloc
#include "asm/JSystem/JUtility/JUTCacheFont/allocArea__12JUTCacheFontFPvUlP7JKRHeap.s"
bool JUTCacheFont::allocArea(void* param_0, u32 param_1, JKRHeap* heap) {
mInf1Ptr = (ResFONT::INF1*)new (heap, 0) ResFONT();
if (mInf1Ptr == NULL) {
return false;
}
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 */
#pragma push
@ -399,25 +437,34 @@ asm void JUTCacheFont::invalidiateAllCache() {
/* 802DDF68-802DDFAC 2D88A8 0044+00 2/2 0/0 0/0 .text
* unlink__12JUTCacheFontFPQ212JUTCacheFont15TGlyphCacheInfo */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void JUTCacheFont::unlink(JUTCacheFont::TGlyphCacheInfo* param_0) {
nofralloc
#include "asm/JSystem/JUtility/JUTCacheFont/unlink__12JUTCacheFontFPQ212JUTCacheFont15TGlyphCacheInfo.s"
void JUTCacheFont::unlink(JUTCacheFont::TGlyphCacheInfo* cacheInfo) {
if (cacheInfo->mPrev == NULL) {
field_0x9c = cacheInfo->mNext;
} else {
cacheInfo->mPrev->mNext = cacheInfo->mNext;
}
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
* prepend__12JUTCacheFontFPQ212JUTCacheFont15TGlyphCacheInfo */
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void JUTCacheFont::prepend(JUTCacheFont::TGlyphCacheInfo* param_0) {
nofralloc
#include "asm/JSystem/JUtility/JUTCacheFont/prepend__12JUTCacheFontFPQ212JUTCacheFont15TGlyphCacheInfo.s"
void JUTCacheFont::prepend(JUTCacheFont::TGlyphCacheInfo* cacheInfo) {
TGlyphCacheInfo* oldHead = field_0x9c;
field_0x9c = cacheInfo;
cacheInfo->mPrev = NULL;
cacheInfo->mNext = oldHead;
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 */
#pragma push
@ -488,5 +535,3 @@ asm s32 JUTResFont::getHeight() const {
#include "asm/JSystem/JUtility/JUTCacheFont/getHeight__10JUTResFontCFv.s"
}
#pragma pop
/* 8039D2F0-8039D2F0 029950 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */

View File

@ -10,7 +10,6 @@
#include "JSystem/JUtility/JUTVideo.h"
#include "MSL_C/MSL_Common/Src/printf.h"
#include "dol2asm.h"
#include "dolphin/types.h"
//
// Forward References:
@ -315,10 +314,12 @@ void JUTConsole::scroll(int scrollAmnt) {
}
}
}
field_0x30 += scrollAmnt;
if (field_0x30 < 0) {
field_0x30 += mMaxLines;
}
if (field_0x30 >= mMaxLines) {
field_0x30 -= mMaxLines;
}
@ -346,6 +347,7 @@ JUTConsoleManager* JUTConsoleManager::createManager(JKRHeap* pHeap) {
if (pHeap == NULL) {
pHeap = JKRHeap::sCurrentHeap;
}
JUTConsoleManager* manager = new (pHeap, 0) JUTConsoleManager();
sManager = manager;
return manager;
@ -457,7 +459,8 @@ extern "C" void JUTReportConsole_f_va(const char* fmt, va_list args) {
if (JUTGetReportConsole() == NULL) {
vsnprintf(buf, sizeof(buf), fmt, args);
} else if (JUTGetReportConsole()->getOutput() &
(JUTConsole::OUTPUT_CONSOLE | JUTConsole::OUTPUT_OSREPORT)) {
(JUTConsole::OUTPUT_CONSOLE | JUTConsole::OUTPUT_OSREPORT))
{
vsnprintf(buf, sizeof(buf), fmt, args);
JUTGetReportConsole()->print(buf);
}

View File

@ -8,8 +8,6 @@
#include "JSystem/JUtility/JUTVideo.h"
#include "MSL_C/MSL_Common/Src/printf.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 */
JUTDbPrint::JUTDbPrint(JUTFont* pFont, JKRHeap* pHeap) {
@ -32,6 +30,7 @@ JUTDbPrint* JUTDbPrint::start(JUTFont* pFont, JKRHeap* pHeap) {
}
sDebugPrint = new JUTDbPrint(pFont, pHeap);
}
return sDebugPrint;
}
@ -81,6 +80,7 @@ void JUTDbPrint::flush(int param_0, int param_1, int param_2, int param_3) {
if (mVisible) {
this->drawString(cur->unk_0x04, cur->unk_0x06, cur->unk_0x0A, (u8*)cur->unk_0x0C);
}
if (--cur->unk_0x08 <= 0) {
unk_print* next = cur->mNext;
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, ...) {
va_list args;
va_start(args, fmt);
char buf[0x100];
int ret = vsnprintf(buf, 0x100, fmt, args);
va_end(args);
if (ret < 0) {
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, ...) {
va_list args;
va_start(args, fmt);
char buf[0x100];
int ret = vsnprintf(buf, 0x100, fmt, args);
va_end(args);
if (ret < 0) {
return;
}

View File

@ -8,7 +8,6 @@
#include "Runtime.PPCEABI.H/__va_arg.h"
#include "dol2asm.h"
#include "dolphin/os/OSCache.h"
#include "dolphin/types.h"
#include "global.h"
//

View File

@ -5,13 +5,12 @@
#include "JSystem/JUtility/JUTException.h"
#include "JSystem/JUtility/JUTConsole.h"
#include "JSystem/JUtility/JUTDirectPrint.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/printf.h"
#include "Runtime.PPCEABI.H/__va_arg.h"
#include "dol2asm.h"
#include "dolphin/types.h"
//
// Forward References:
@ -110,7 +109,7 @@ OSErrorHandler JUTException::sPostUserCallback;
/* 802E1D5C-802E1E40 2DC69C 00E4+00 1/1 0/0 0/0 .text __ct__12JUTExceptionFP14JUTDirectPrint */
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_ISI, errorHandler);
OSSetErrorHandler(EXCEPTION_PROGRAM, errorHandler);
@ -945,13 +944,15 @@ bool JUTException::queryMapAddress(char* mapPath, u32 address, s32 section_id, u
strcpy(buffer, mapPath);
strcat(buffer, ".map");
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;
}
} else if (sMapFileList.getFirst() != sMapFileList.getEnd()) {
if (queryMapAddress_single(sMapFileList.getFirst()->getObject()->mPath, address, -1,
out_addr, out_size, out_line, line_length, print,
begin_with_newline) == true) {
begin_with_newline) == true)
{
return true;
}
}
@ -1147,5 +1148,3 @@ JUTException::~JUTException() {}
*/
/* 804508F8-80450900 000378 0008+00 0/0 3/3 0/0 .sdata None */
SECTION_SDATA extern bool sAssertVisible = true;
/* 8039D490-8039D490 029AF0 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */

View File

@ -5,7 +5,6 @@
#include "JSystem/JUtility/JUTFontData_Ascfont_fix12.h"
#include "dol2asm.h"
#include "dolphin/types.h"
//
// Forward References:

View File

@ -377,7 +377,8 @@ void JUTGamePad::update() {
}
if (field_0xa8 == 0 ||
(mButton.mButton & C3ButtonReset::sResetMaskPattern) != C3ButtonReset::sResetPattern) {
(mButton.mButton & C3ButtonReset::sResetMaskPattern) != C3ButtonReset::sResetPattern)
{
mButtonReset.mReset = false;
} else if (!JUTGamePad::C3ButtonReset::sResetOccurred) {
if (mButtonReset.mReset == true) {
@ -488,7 +489,8 @@ void JUTGamePad::CButton::update(PADStatus const* padStatus, u32 stickStatus) {
field_0x1c++;
if (field_0x1c == field_0x28 ||
(field_0x1c > field_0x28 && (field_0x1c - field_0x28) % field_0x2c == 0)) {
(field_0x1c > field_0x28 && (field_0x1c - field_0x28) % field_0x2c == 0))
{
mRepeat = repeatButton;
}
} else {

View File

@ -5,12 +5,6 @@
#include "JSystem/JUtility/JUTGraphFifo.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "dol2asm.h"
#include "dolphin/types.h"
//
// Declarations:
//
/* 804514B8-804514BC 0009B8 0004+00 1/1 0/0 0/0 .sbss None */
static bool data_804514B8;

View File

@ -5,8 +5,6 @@
#include "JSystem/JUtility/JUTNameTab.h"
#include "MSL_C/MSL_Common/Src/string.h"
#include "dol2asm.h"
#include "dolphin/types.h"
JUTNameTab::JUTNameTab() {
setResource(NULL);

View File

@ -224,30 +224,32 @@ SECTION_SDATA2 static f64 lit_2315 = 4503599627370496.0 /* cast u32 to float */;
#ifdef NONMATCHING // float literals
void JUTProcBar::adjustMeterLength(u32 param_0, f32* param_1, f32 param_2, f32 param_3,
int* param_4) {
BOOL var2 = false;
float var1 = *param_1;
while (var1 > param_2) {
if (param_0 * var1 * FLOAT_LABEL(lit_2308) / FLOAT_LABEL(lit_2309) <= field_0x114.mWidth - FLOAT_LABEL(lit_2310))
break;
BOOL var2 = false;
float var1 = *param_1;
while (var1 > param_2) {
if (param_0 * var1 * FLOAT_LABEL(lit_2308) / FLOAT_LABEL(lit_2309) <=
field_0x114.mWidth - FLOAT_LABEL(lit_2310))
break;
var1 -= FLOAT_LABEL(lit_2311);
var2 = true;
}
var1 -= FLOAT_LABEL(lit_2311);
var2 = true;
}
if (var1 >= param_3)
*param_4 = 0;
if (var1 > param_3 - FLOAT_LABEL(lit_2312))
var1 = param_3;
if (var1 >= param_3)
*param_4 = 0;
if (var1 > param_3 - FLOAT_LABEL(lit_2312))
var1 = param_3;
while (!var2 && var1 < param_3) {
(*param_4)++;
if (*param_4 < 0x1e)
break;
if ((param_0 * var1 * FLOAT_LABEL(lit_2308) / FLOAT_LABEL(lit_2309)) < (field_0x114.mWidth - FLOAT_LABEL(lit_2313)))
var1 += FLOAT_LABEL(lit_2312);
break;
}
*param_1 = var1;
while (!var2 && var1 < param_3) {
(*param_4)++;
if (*param_4 < 0x1e)
break;
if ((param_0 * var1 * FLOAT_LABEL(lit_2308) / FLOAT_LABEL(lit_2309)) <
(field_0x114.mWidth - FLOAT_LABEL(lit_2313)))
var1 += FLOAT_LABEL(lit_2312);
break;
}
*param_1 = var1;
}
#else
#pragma push
@ -294,7 +296,8 @@ void JUTProcBar::drawProcessBar() {
}
int r29 = 16666;
if (JUTGetVideoManager() &&
((JUTGetVideoManager()->getRenderMode()->vi_tv_mode >> 2) & 0x0f) == 1) {
((JUTGetVideoManager()->getRenderMode()->vi_tv_mode >> 2) & 0x0f) == 1)
{
r29 = 20000;
}
static int cnt = 0;

View File

@ -4,8 +4,8 @@
//
#include "JSystem/JUtility/JUTResFont.h"
#include "JSystem/JUtility/JUTConsole.h"
#include "dol2asm.h"
#include "dolphin/types.h"
#include "dolphin/gx/GX.h"
//
@ -54,7 +54,6 @@ extern "C" void getDescent__10JUTResFontCFv();
extern "C" void getHeight__10JUTResFontCFv();
extern "C" void __ct__7JUTFontFv();
extern "C" void initialize_state__7JUTFontFv();
extern "C" void JUTReportConsole();
extern "C" void GXClearVtxDesc();
extern "C" void _savegpr_25();
extern "C" void _savegpr_27();
@ -158,7 +157,6 @@ bool JUTResFont::protected_initiate(ResFONT const* param_0, JKRHeap* param_1) {
if (!param_0) {
return false;
}
mResFont = param_0;
mValid = true;
@ -186,59 +184,40 @@ bool JUTResFont::protected_initiate(ResFONT const* param_0, JKRHeap* param_1) {
}
}
/* ############################################################################################## */
/* 8039D45C-8039D45C 029ABC 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
#pragma push
#pragma force_active on
SECTION_DEAD static char const* const stringBase_8039D45C = "JUTResFont: Unknown data block\n";
#pragma pop
/* 802DF248-802DF344 2D9B88 00FC+00 1/1 0/0 0/0 .text countBlock__10JUTResFontFv */
#ifdef NONMATCHING
void JUTResFont::countBlock() {
mWidthBlockCount = 0;
mGlyphBlockCount = 0;
mMapBlockCount = 0;
u8* pData = (u8*)&mResource->mData;
for (u32 i = 0; i < mResource->mChunkNum; i++, pData += ((BlockHeader*)pData)->mSize) {
int magic = ((BlockHeader*)pData)->mMagic;
switch (magic) {
case 'WID1':
mWidthBlockCount++;
break;
case 'GLY1':
mGlyphBlockCount++;
break;
case 'MAP1':
mMapBlockCount++;
break;
case 'INF1':
// mInf1Ptr;
break;
default:
JUTReportConsole("JUTResFont: Unknown data block\n");
}
};
mWid1BlockNum = 0;
mGly1BlockNum = 0;
mMap1BlockNum = 0;
u8* pData = (u8*)&mResFont->data;
for (u32 i = 0; i < mResFont->numBlocks; i++, pData += ((BlockHeader*)pData)->size) {
int magic = ((BlockHeader*)pData)->magic;
switch (magic) {
case 'WID1':
mWid1BlockNum++;
break;
case 'GLY1':
mGly1BlockNum++;
break;
case 'MAP1':
mMap1BlockNum++;
break;
case 'INF1':
break;
default:
JUTReportConsole("JUTResFont: Unknown data block\n");
}
}
}
#else
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm void JUTResFont::countBlock() {
nofralloc
#include "asm/JSystem/JUtility/JUTResFont/countBlock__10JUTResFontFv.s"
}
#pragma pop
#endif
/* ############################################################################################## */
/* 8039D390-8039D39C -00001 000C+00 1/1 1/1 0/0 .rodata saoAboutEncoding___10JUTResFont */
SECTION_RODATA void* const JUTResFont::saoAboutEncoding_[3] = {
(void*)isLeadByte_1Byte__7JUTFontFi,
(void*)isLeadByte_2Byte__7JUTFontFi,
(void*)isLeadByte_ShiftJIS__7JUTFontFi,
IsLeadByte_func const JUTResFont::saoAboutEncoding_[3] = {
JUTFont::isLeadByte_1Byte,
JUTFont::isLeadByte_2Byte,
JUTFont::isLeadByte_ShiftJIS,
};
COMPILER_STRIP_GATE(0x8039D390, &JUTResFont::saoAboutEncoding_);
/* 8039D45C-8039D45C 029ABC 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
#pragma push
@ -328,70 +307,70 @@ SECTION_SDATA2 static f64 lit_651 = 4503599627370496.0 /* cast u32 to float */;
#ifdef NONMATCHING
// still missing a bunch of stuff
f32 JUTResFont::drawChar_scale(f32 pos_x, f32 pos_y, f32 scale_x, f32 scale_y, int str_int,
bool flag) {
bool flag) {
JUTFont::TWidth width;
f32 width_val;
f32 pos_height, ascent, ascent_val, scaled_height;
f32 sca_wid;
f32 width_val;
f32 pos_height, ascent, ascent_val, scaled_height;
f32 sca_wid;
loadFont(str_int, GX_TEXMAP0, &width);
loadFont(str_int, GX_TEXMAP0, &width);
if ((mFixed) || (!flag)) {
width_val = pos_x;
} else {
width_val = (pos_x - width.field_0x0 * (scale_x / getCellWidth()));
}
f32 retval = mFixedWidth * (scale_x / getCellWidth());
if (mFixed == false) {
if (!flag) {
retval = (width.field_0x1 + width.field_0x0) * (scale_x / getCellWidth());
} else {
retval = width.field_0x1 * (scale_x / getCellWidth());
}
}
sca_wid = width_val + scale_x;
ascent_val = pos_y - getAscent() * (scale_y / getHeight());
scaled_height = scale_y / getHeight();
f32 descent = getDescent();
f32 ascent_calc = descent * ascent_val;
f32 deshei = descent * scaled_height + pos_y;
if ((mFixed) || (!flag)) {
width_val = pos_x;
} else {
width_val = (pos_x - width.field_0x0 * (scale_x / getCellWidth()));
}
f32 retval = mFixedWidth * (scale_x / getCellWidth());
if (mFixed == false) {
if (!flag) {
retval = (width.field_0x1 + width.field_0x0) * (scale_x / getCellWidth());
} else {
retval = width.field_0x1 * (scale_x / getCellWidth());
}
}
sca_wid = width_val + scale_x;
ascent_val = pos_y - getAscent() * (scale_y / getHeight());
scaled_height = scale_y / getHeight();
f32 descent = getDescent();
f32 ascent_calc = descent * ascent_val;
f32 deshei = descent * scaled_height + pos_y;
ResFONT::GLY1* used_glyphs = mpGlyphBlocks[field_0x66];
u16 tex_width = used_glyphs->textureWidth;
u16 tex_height = used_glyphs->textureHeight;
int t_width = mWidth;
int t_height = mHeight;
int shift_width = (t_width + used_glyphs->cellHeight) << 15;
int div_width = (t_width << 15) / tex_width;
int div_height = (t_height << 15) / tex_height;
u16 sumWidth = t_width + used_glyphs->cellWidth;
int shift_height = t_height + used_glyphs->cellHeight << 15;
u16 sumHeight = t_height + used_glyphs->cellHeight;
s32 width_ratio = shift_width / tex_width;
s32 height_ratio = shift_height / tex_height;
ResFONT::GLY1* used_glyphs = mpGlyphBlocks[field_0x66];
u16 tex_width = used_glyphs->textureWidth;
u16 tex_height = used_glyphs->textureHeight;
int t_width = mWidth;
int t_height = mHeight;
int shift_width = (t_width + used_glyphs->cellHeight) << 15;
int div_width = (t_width << 15) / tex_width;
int div_height = (t_height << 15) / tex_height;
u16 sumWidth = t_width + used_glyphs->cellWidth;
int shift_height = t_height + used_glyphs->cellHeight << 15;
u16 sumHeight = t_height + used_glyphs->cellHeight;
s32 width_ratio = shift_width / tex_width;
s32 height_ratio = shift_height / tex_height;
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
GXPosition3f32(width_val,ascent_val,0.0f);
GXPosition3f32(width_val, ascent_val, 0.0f);
GXColor1u32(mColor1);
i_GXTexCoord2u16(div_width,div_height);
i_GXTexCoord2u16(div_width, div_height);
GXPosition3f32(sca_wid,ascent_val,0.0f);
GXPosition3f32(sca_wid, ascent_val, 0.0f);
GXColor1u32(mColor2);
i_GXTexCoord2u16(width_ratio,div_height);
i_GXTexCoord2u16(width_ratio, div_height);
GXPosition3f32(sca_wid,deshei,0.0f);
GXPosition3f32(sca_wid, deshei, 0.0f);
GXColor1u32(mColor4);
i_GXTexCoord2u16(width_ratio,height_ratio);
i_GXTexCoord2u16(width_ratio, height_ratio);
GXPosition3f32(width_val,deshei,0.0f);
GXPosition3f32(width_val, deshei, 0.0f);
GXColor1u32(mColor3);
i_GXTexCoord2u16(div_width,height_ratio);
i_GXTexCoord2u16(div_width, height_ratio);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
return retval;
return retval;
}
#else
#pragma push
@ -425,10 +404,10 @@ void JUTResFont::getWidthEntry(int param_0, JUTFont::TWidth* i_width) const {
for (int i = 0; i < mWid1BlockNum; i++) {
if (mpWidthBlocks[i]->startCode <= code && code <= mpWidthBlocks[i]->endCode) {
u8* ptr = &mpWidthBlocks[i]->mChunkNum[(code - mpWidthBlocks[i]->startCode) * 2];
i_width->field_0x0 = ptr[0];
i_width->field_0x1 = ptr[1];
break;
u8* ptr = &mpWidthBlocks[i]->mChunkNum[(code - mpWidthBlocks[i]->startCode) * 2];
i_width->field_0x0 = ptr[0];
i_width->field_0x1 = ptr[1];
break;
}
}
}
@ -443,7 +422,6 @@ int JUTResFont::getCellWidth() const {
if (glyphBlock) {
return glyphBlock->cellWidth;
}
}
return getWidth();
@ -460,7 +438,6 @@ int JUTResFont::getCellHeight() const {
if (glyphBlock) {
return glyphBlock->cellHeight;
}
}
return getHeight();
@ -476,8 +453,6 @@ asm u16 JUTResFont::getCellHeight() const {
#pragma pop
#endif
/* 802DFDA4-802DFDD8 2DA6E4 0034+00 1/0 1/0 0/0 .text isLeadByte__10JUTResFontCFi */
bool JUTResFont::isLeadByte(int param_0) const {
return (*mIsLeadByte)(param_0);
@ -486,22 +461,14 @@ bool JUTResFont::isLeadByte(int param_0) const {
/* ############################################################################################## */
/* 8039D39C-8039D45C 0299FC 00BE+02 1/1 0/0 0/0 .rodata halftofull$726 */
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,
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,
};
/* 802DFDD8-802DFF60 2DA718 0188+00 2/2 0/0 0/0 .text getFontCode__10JUTResFontCFi */
@ -509,54 +476,53 @@ static const u16 halftofull[95] = {
// still many issues
int JUTResFont::getFontCode(int param_0) const {
int ret = mInf1Ptr->width;
if ((getFontType() == 2) && (mMaxCode >= 0x8000U) && (param_0 >= 0x20) && (param_0 < 0x7FU)) {
param_0 = halftofull[param_0 - 32];
}
int j = 0;
for (int i = mMap1BlockNum; i > 0; j++, i--) {
if ((mpMapBlocks[j]->endCode <= param_0) && (param_0 <= mpMapBlocks[j]->numEntries)) {
ResFONT::MAP1* temp_r4 = mpMapBlocks[j];
if (temp_r4->startCode == 0) {
ret = param_0 - temp_r4->endCode;
break;
} else if (temp_r4->startCode == 2) {
ret = *(&mpMapBlocks[j]->mLeading + ((param_0 - mpMapBlocks[j]->endCode)));
break;
} else if (temp_r4->startCode == 3) {
u16* leading_temp = &temp_r4->mLeading;
int phi_r5 = 0;
int phi_r6_2 = temp_r4->numEntries - 1;
if ((getFontType() == 2) && (mMaxCode >= 0x8000U) && (param_0 >= 0x20) && (param_0 < 0x7FU)) {
param_0 = halftofull[param_0 - 32];
}
int j = 0;
for (int i = mMap1BlockNum; i > 0; j++, i--) {
if ((mpMapBlocks[j]->endCode <= param_0) && (param_0 <= mpMapBlocks[j]->numEntries)) {
ResFONT::MAP1* temp_r4 = mpMapBlocks[j];
if (temp_r4->startCode == 0) {
ret = param_0 - temp_r4->endCode;
break;
} else if (temp_r4->startCode == 2) {
ret = *(&mpMapBlocks[j]->mLeading + ((param_0 - mpMapBlocks[j]->endCode)));
break;
} else if (temp_r4->startCode == 3) {
u16* leading_temp = &temp_r4->mLeading;
int phi_r5 = 0;
int phi_r6_2 = temp_r4->numEntries - 1;
while (phi_r6_2 >= phi_r5) {
while (phi_r6_2 >= phi_r5) {
u32 temp_r3 = phi_r6_2 + phi_r5;
int temp_r7 = (int)((temp_r3 >> 0x1FU) + phi_r6_2 + phi_r5) >> 1;
u32 temp_r3 = phi_r6_2 + phi_r5;
int temp_r7 = (int)((temp_r3 >> 0x1FU) + phi_r6_2 + phi_r5) >> 1;
if (param_0 < leading_temp[temp_r7 * 2]) {
phi_r6_2 = temp_r7 - 1;
continue;
}
if (param_0 < leading_temp[temp_r7 * 2]) {
phi_r6_2 = temp_r7 - 1;
continue;
}
if (param_0 > leading_temp[temp_r7 * 2]) {
phi_r5 = temp_r7 + 1;
continue;
}
if (param_0 > leading_temp[temp_r7 * 2]) {
phi_r5 = temp_r7 + 1;
continue;
}
ret = leading_temp[temp_r7 * 2 + 1];
break;
}
} else if (temp_r4->startCode == 1) {
u16* phi_r5_2 = NULL;
if (temp_r4->numEntries == 1) {
phi_r5_2 = &temp_r4->mLeading;
}
ret = convertSjis(param_0, phi_r5_2);
break;
}
break;
}
}
return ret;
ret = leading_temp[temp_r7 * 2 + 1];
break;
}
} else if (temp_r4->startCode == 1) {
u16* phi_r5_2 = NULL;
if (temp_r4->numEntries == 1) {
phi_r5_2 = &temp_r4->mLeading;
}
ret = convertSjis(param_0, phi_r5_2);
break;
}
break;
}
}
return ret;
}
#else
#pragma push
@ -571,9 +537,7 @@ asm int JUTResFont::getFontCode(int param_0) const {
/* 802DFF60-802E00C4 2DA8A0 0164+00 1/0 0/0 0/0 .text loadImage__10JUTResFontFi11_GXTexMapID */
#ifdef NONMATCHING
asm void JUTResFont::loadImage(int param_0, _GXTexMapID param_1) {
}
asm void JUTResFont::loadImage(int param_0, _GXTexMapID param_1) {}
#else
#pragma push
#pragma optimization_level 0
@ -590,17 +554,17 @@ int JUTResFont::convertSjis(int inChr, u16* inLead) const {
int tmp = inChr >> 8 & 0xFF;
int tmp2 = (u8)inChr - 0x40;
if (0x40 <= tmp2) {
tmp2--;
}
if (0x40 <= tmp2) {
tmp2--;
}
u16 lead = 0x31c;
u16 lead = 0x31c;
if (inLead) {
lead = *inLead;
}
if (inLead) {
lead = *inLead;
}
return tmp2 + (tmp - 0x88) * 0xbc + -0x5e + lead;
return tmp2 + (tmp - 0x88) * 0xbc + -0x5e + lead;
}
/* 802E0108-802E0110 2DAA48 0008+00 1/0 0/0 0/0 .text isLeadByte_1Byte__7JUTFontFi */

View File

@ -6,20 +6,8 @@
#include "JSystem/JUtility/JUTVideo.h"
#include "JSystem/JUtility/JUTDirectPrint.h"
#include "JSystem/JUtility/JUTXfb.h"
#include "dol2asm.h"
#include "dolphin/types.h"
#include "dolphin/vi/vi.h"
//
// External References:
//
extern "C" void GXSetDrawDone();
//
// Declarations:
//
/* 80451538-8045153C 000A38 0004+00 4/4 18/18 1/1 .sbss sManager__8JUTVideo */
JUTVideo* JUTVideo::sManager;
@ -32,12 +20,6 @@ OSTick JUTVideo::sVideoInterval;
/* 80451544-80451548 000A44 0004+00 4/4 0/0 0/0 .sbss None */
static bool data_80451544;
/* 80451548-8045154C 000A48 0004+00 1/1 0/0 0/0 .sbss frameBuffer$2222 */
static void* frameBuffer;
/* 8045154C-80451550 000A4C 0004+00 1/1 0/0 0/0 .sbss None */
static s8 data_8045154C;
/* 802E4C54-802E4CAC 2DF594 0058+00 0/0 1/1 0/0 .text
* createManager__8JUTVideoFPC16_GXRenderModeObj */
JUTVideo* JUTVideo::createManager(_GXRenderModeObj const* param_0) {
@ -105,10 +87,7 @@ void JUTVideo::preRetraceProc(u32 retrace_count) {
return;
}
if (!data_8045154C) {
frameBuffer = NULL;
data_8045154C = true;
}
static void* frameBuffer = NULL;
if (frameBuffer) {
JUTVideo* videoManager = JUTGetVideoManager();
@ -234,6 +213,4 @@ void JUTVideo::setRenderMode(GXRenderModeObj const* pObj) {
}
/* 802E5210-802E5214 2DFB50 0004+00 0/0 1/1 0/0 .text waitRetraceIfNeed__8JUTVideoFv */
void JUTVideo::waitRetraceIfNeed() {
/* empty function */
}
void JUTVideo::waitRetraceIfNeed() {}

View File

@ -6,7 +6,6 @@
#include "JSystem/JUtility/JUTXfb.h"
#include "dol2asm.h"
#include "dolphin/gx/GX.h"
#include "dolphin/types.h"
//
// Forward References:
@ -76,8 +75,8 @@ JUTXfb::JUTXfb(_GXRenderModeObj const* pObj, JKRHeap* pHeap, JUTXfb::EXfbNumber
#pragma push
#pragma optimization_level 0
#pragma optimizewithasm off
asm JUTXfb::JUTXfb(_GXRenderModeObj const* param_0, JKRHeap* param_1, JUTXfb::EXfbNumber param_2) {
nofralloc
asm JUTXfb::JUTXfb(_GXRenderModeObj const* param_0, JKRHeap* param_1,
JUTXfb::EXfbNumber param_2){nofralloc
#include "asm/JSystem/JUtility/JUTXfb/__ct__6JUTXfbFPC16_GXRenderModeObjP7JKRHeapQ26JUTXfb10EXfbNumber.s"
}
#pragma pop