mirror of
https://github.com/zeldaret/tp
synced 2026-05-22 22:44:28 -04:00
JUtility matching for debug (#3074)
* Jut cleanup work * data section fix * match the last of JUtility * added more helpful comment * Add missed null terminator * do while -> while loop * replace more do whiles * Fix wii regression * Add suggestions * fix null check --------- Co-authored-by: roeming <roeming@users.noreply.github.com>
This commit is contained in:
@@ -3322,7 +3322,7 @@ JSystem/JKernel/JKRDecomp.cpp:
|
||||
.text start:0x8050E3E0 end:0x8050EE10
|
||||
.data start:0x8070EA60 end:0x8070EAB8
|
||||
.sdata start:0x8074AAE0 end:0x8074AAF0
|
||||
.sbss start:0x8074CF78 end:0x8074CF84
|
||||
.sbss start:0x8074CF78 end:0x8074CF80
|
||||
.bss start:0x807E2078 end:0x807E20B8
|
||||
|
||||
JSystem/JSupport/JSUList.cpp:
|
||||
@@ -3435,7 +3435,7 @@ JSystem/JUtility/JUTGraphFifo.cpp:
|
||||
.text start:0x8051A690 end:0x8051A8B0
|
||||
.data start:0x8070FB18 end:0x8070FB38
|
||||
.sdata start:0x8074AD88 end:0x8074AD90
|
||||
.sbss start:0x8074CF84 end:0x8074CF90
|
||||
.sbss start:0x8074CF80 end:0x8074CF90
|
||||
|
||||
JSystem/JUtility/JUTFont.cpp:
|
||||
.text start:0x8051A8B0 end:0x8051AC40
|
||||
|
||||
@@ -103,9 +103,7 @@ public:
|
||||
return --index < 0 ? index = mMaxLines - 1 : index;
|
||||
}
|
||||
|
||||
int nextIndex(int index) const {
|
||||
return ++index >= mMaxLines ? 0 : index;
|
||||
}
|
||||
int nextIndex(int index) const { return (++index >= mMaxLines) ? index = 0 : index; }
|
||||
|
||||
void scrollToLastLine() { scroll(mMaxLines); }
|
||||
void scrollToFirstLine() { scroll(-mMaxLines); }
|
||||
|
||||
@@ -118,9 +118,9 @@ public:
|
||||
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,
|
||||
f32 drawString_scale(f32 posX, f32 posY, f32 width, f32 height, const char* str,
|
||||
bool visible) {
|
||||
drawString_size_scale(posX, posY, width, height, str, strlen(str), visible);
|
||||
return (int)drawString_size_scale(posX, posY, width, height, str, strlen(str), visible);
|
||||
}
|
||||
|
||||
int getWidth(int i_no) const {
|
||||
|
||||
@@ -286,6 +286,8 @@ struct JUTGamePadLongPress {
|
||||
/* 0x50 */ s32 field_0x50;
|
||||
};
|
||||
|
||||
inline void JUTReadGamePad() { JUTGamePad::read(); }
|
||||
inline u32 JUTReadGamePad() {
|
||||
return JUTGamePad::read();
|
||||
}
|
||||
|
||||
#endif /* JUTGAMEPAD_H */
|
||||
|
||||
@@ -24,7 +24,11 @@ public:
|
||||
return mGpStatus[2] == false;
|
||||
}
|
||||
|
||||
void save() { GXSaveCPUFifo(this->mFifo); }
|
||||
void save() {
|
||||
#if !PLATFORM_SHIELD
|
||||
GXSaveCPUFifo(this->mFifo);
|
||||
#endif
|
||||
}
|
||||
|
||||
static JUTGraphFifo* sCurrentFifo;
|
||||
static bool mGpStatus[5];
|
||||
|
||||
@@ -112,8 +112,9 @@ void showAssert_f_va(u32 device, const char* file, int line, const char* msg, va
|
||||
OSEnableInterrupts();
|
||||
|
||||
u32 retrace_count = VIGetRetraceCount();
|
||||
do {
|
||||
} while (retrace_count == VIGetRetraceCount());
|
||||
while (retrace_count == VIGetRetraceCount()){
|
||||
// nop
|
||||
}
|
||||
|
||||
// busy loop for 2 seconds
|
||||
OSTime var1 = OSGetTime();
|
||||
@@ -124,6 +125,8 @@ void showAssert_f_va(u32 device, const char* file, int line, const char* msg, va
|
||||
}
|
||||
|
||||
void showAssert_f(u32 device, const char* file, int line, const char* msg, ...) {
|
||||
UNUSED(msg);
|
||||
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
showAssert_f_va(device, file, line, msg, args);
|
||||
@@ -154,6 +157,8 @@ void setWarningMessage_f_va(u32 device, const char* file, int line, const char*
|
||||
}
|
||||
|
||||
void setWarningMessage_f(u32 device, char* file, int line, const char* msg, ...) {
|
||||
UNUSED(msg);
|
||||
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
setWarningMessage_f_va(device, file, line, msg, args);
|
||||
@@ -184,6 +189,8 @@ void setLogMessage_f_va(u32 device, const char* file, int line, const char* msg,
|
||||
}
|
||||
|
||||
void setLogMessage_f(u32 device, char* file, int line, const char* msg, ...) {
|
||||
UNUSED(msg);
|
||||
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
setLogMessage_f_va(device, file, line, msg, args);
|
||||
|
||||
@@ -70,7 +70,6 @@ int JUTCacheFont::getMemorySize(ResFONT const* p_font, u16* o_widCount, u32* o_w
|
||||
u32 totalGlySize = 0;
|
||||
u32 totalMapSize = 0;
|
||||
u32 maxGlyTexSize = 0;
|
||||
u32 glyTexSize;
|
||||
|
||||
u8* fontInf = (u8*)p_font->data;
|
||||
for (int i = 0; i < p_font->numBlocks; i++) {
|
||||
@@ -83,10 +82,9 @@ int JUTCacheFont::getMemorySize(ResFONT const* p_font, u16* o_widCount, u32* o_w
|
||||
break;
|
||||
case 'GLY1':
|
||||
totalGlySize += ((BlockHeader*)fontInf)->size;
|
||||
glyTexSize = ((ResFONT::GLY1*)fontInf)->textureSize;
|
||||
glyBlockCount++;
|
||||
if (glyTexSize > maxGlyTexSize) {
|
||||
maxGlyTexSize = glyTexSize;
|
||||
if (((ResFONT::GLY1*)fontInf)->textureSize > maxGlyTexSize) {
|
||||
maxGlyTexSize = ((ResFONT::GLY1*)fontInf)->textureSize;
|
||||
}
|
||||
break;
|
||||
case 'MAP1':
|
||||
@@ -183,7 +181,7 @@ bool JUTCacheFont::allocArea(void* cacheBuffer, u32 param_1, JKRHeap* heap) {
|
||||
}
|
||||
|
||||
if (mGly1BlockNum != 0) {
|
||||
field_0x80 = new (heap, 0) ResFONT::GLY1[mGly1BlockNum];
|
||||
field_0x80 = new (heap, 0) u8[mGly1BlockNum * sizeof(ResFONT::GLY1)];
|
||||
if (field_0x80 == NULL) {
|
||||
return false;
|
||||
}
|
||||
@@ -345,7 +343,11 @@ void JUTCacheFont::getGlyphFromAram(JUTCacheFont::TGlyphCacheInfo* param_0,
|
||||
prepend(pGylphCacheInfo);
|
||||
int iVar3 = pGylphCacheInfo->field_0x16 * pGylphCacheInfo->field_0x18;
|
||||
int iVar2 = *r30 / iVar3;
|
||||
#if PLATFORM_SHIELD
|
||||
pGylphCacheInfo->field_0x8 += (u16)(iVar2 * iVar3);
|
||||
#else
|
||||
pGylphCacheInfo->field_0x8 += iVar2 * iVar3;
|
||||
#endif
|
||||
u16 local_30 = pGylphCacheInfo->field_0x8 + iVar3 - 1;
|
||||
pGylphCacheInfo->field_0xa = pGylphCacheInfo->field_0xa < local_30 ? pGylphCacheInfo->field_0xa : local_30;
|
||||
*param_3 = iVar2;
|
||||
|
||||
@@ -29,8 +29,8 @@ JUTConsole* JUTConsole::create(unsigned int param_0, unsigned int maxLines, JKRH
|
||||
JUTConsole* JUTConsole::create(unsigned int param_0, void* buffer, u32 bufferSize) {
|
||||
JUTConsoleManager* pManager = JUTConsoleManager::getManager();
|
||||
JUT_ASSERT(59, pManager != NULL);
|
||||
|
||||
JUT_ASSERT(62, ( (u32)buffer & 0x3 ) == 0);
|
||||
|
||||
u32 maxLines = getLineFromObjectSize(bufferSize, param_0);
|
||||
|
||||
JUTConsole* console = new (buffer) JUTConsole(param_0, maxLines, false);
|
||||
@@ -66,6 +66,10 @@ JUTConsole::JUTConsole(unsigned int param_0, unsigned int maxLines, bool param_2
|
||||
field_0x64 = 8;
|
||||
}
|
||||
|
||||
static void dummystring1() {
|
||||
UNUSED("console != 0");
|
||||
}
|
||||
|
||||
JUTConsole::~JUTConsole() {
|
||||
JUT_ASSERT(154, JUTConsoleManager::getManager());
|
||||
JUTConsoleManager::getManager()->removeConsole(this);
|
||||
@@ -77,7 +81,8 @@ size_t JUTConsole::getObjectSizeFromBufferSize(unsigned int param_0, unsigned in
|
||||
}
|
||||
|
||||
size_t JUTConsole::getLineFromObjectSize(u32 bufferSize, unsigned int param_1) {
|
||||
size_t result = (bufferSize - sizeof(JUTConsole)) / (param_1 + 2);
|
||||
bufferSize -= sizeof(JUTConsole);
|
||||
size_t result = (bufferSize) / (param_1 + 2);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -102,7 +107,9 @@ void JUTConsole::doDraw(JUTConsole::EConsoleType consoleType) const {
|
||||
|
||||
if (mVisible && (mFont != NULL || consoleType == CONSOLE_TYPE_2)) {
|
||||
if (mHeight != 0) {
|
||||
bool temp_r30 = consoleType == CONSOLE_TYPE_0;
|
||||
bool spA = consoleType == CONSOLE_TYPE_0 ? true : false;
|
||||
int spA4 = spA ? 1 : 0;
|
||||
spA4 = 0;
|
||||
font_yOffset = 2.0f + mFontSizeY;
|
||||
|
||||
if (consoleType != CONSOLE_TYPE_2) {
|
||||
@@ -115,21 +122,13 @@ void JUTConsole::doDraw(JUTConsole::EConsoleType consoleType) const {
|
||||
ortho.setPort();
|
||||
}
|
||||
|
||||
const JUtility::TColor* color;
|
||||
if (temp_r30) {
|
||||
color = &field_0x60;
|
||||
} else {
|
||||
color = &field_0x5c;
|
||||
}
|
||||
|
||||
J2DFillBox(mPositionX - 2, (int)(mPositionY - font_yOffset),
|
||||
(int)((mFontSizeX * field_0x20) + 4.0f), (int)(font_yOffset * mHeight),
|
||||
*color);
|
||||
(int)((mFontSizeX * field_0x20) + 4.0f),
|
||||
(int)(font_yOffset * (mHeight + spA4)), spA ? field_0x60 : field_0x5c);
|
||||
mFont->setGX();
|
||||
|
||||
if (temp_r30) {
|
||||
s32 s = (diffIndex(field_0x30, field_0x38) - mHeight) + 1;
|
||||
if (s <= 0) {
|
||||
if (spA) {
|
||||
if (((diffIndex(field_0x30, field_0x38) - (int)mHeight) + 1) <= 0) {
|
||||
mFont->setCharColor(JUtility::TColor(255, 255, 255, 255));
|
||||
} else if (field_0x30 == field_0x34) {
|
||||
mFont->setCharColor(JUtility::TColor(255, 230, 230, 255));
|
||||
@@ -146,38 +145,81 @@ void JUTConsole::doDraw(JUTConsole::EConsoleType consoleType) const {
|
||||
JUTDirectPrint::getManager()->setCharColor(JUtility::TColor(255, 255, 255, 255));
|
||||
}
|
||||
|
||||
char* linePtr;
|
||||
s32 curLine = field_0x30;
|
||||
s32 yFactor = 0;
|
||||
u8* linePtr;
|
||||
|
||||
do {
|
||||
linePtr = (char*)getLinePtr(curLine);
|
||||
|
||||
if ((u8)linePtr[-1] != NULL) {
|
||||
if (consoleType != CONSOLE_TYPE_2) {
|
||||
mFont->drawString_scale(mPositionX, ((yFactor * font_yOffset) + mPositionY),
|
||||
mFontSizeX, mFontSizeY, linePtr, true);
|
||||
} else {
|
||||
JUTDirectPrint::getManager()->drawString(
|
||||
mPositionX, ((yFactor * font_yOffset) + mPositionY), linePtr);
|
||||
}
|
||||
|
||||
changeLine_1 = curLine + 1;
|
||||
yFactor += 1;
|
||||
changeLine_2 = changeLine_1 & ~(-((s32)mMaxLines <= (s32)changeLine_1));
|
||||
curLine = changeLine_2;
|
||||
} else {
|
||||
while (true) {
|
||||
linePtr = getLinePtr(curLine);
|
||||
u8 sp9 = linePtr[-1];
|
||||
if (sp9 == 0) {
|
||||
break;
|
||||
}
|
||||
} while (yFactor < mHeight && changeLine_2 != field_0x34);
|
||||
|
||||
if (consoleType != CONSOLE_TYPE_2) {
|
||||
mFont->drawString_scale(mPositionX, ((yFactor * font_yOffset) + mPositionY),
|
||||
mFontSizeX, mFontSizeY, (char*)linePtr, true);
|
||||
} else {
|
||||
JUTDirectPrint::getManager()->drawString(
|
||||
mPositionX, ((yFactor * font_yOffset) + mPositionY), (char*)linePtr);
|
||||
}
|
||||
curLine = nextIndex(curLine);
|
||||
yFactor++;
|
||||
|
||||
if (yFactor >= mHeight || curLine == field_0x34) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (spA4 != 0) {
|
||||
f32 f31 = mPositionX;
|
||||
int sp94 = mHeight * font_yOffset + mPositionY;
|
||||
mFont->setCharColor(JUtility::TColor(0xff, mVisible ? 0xff : 200, 0xc8, 0xff));
|
||||
mFont->drawString_scale((int)f31, sp94, mFontSizeX, mFontSizeY, "X", TRUE);
|
||||
f31 += mFontSizeX;
|
||||
mFont->drawString_scale((int)f31, sp94, mFontSizeX, mFontSizeY,
|
||||
mVisible ? "[ON]" : "[OFF]", TRUE);
|
||||
f31 += (int)(mFontSizeX * 6.0f);
|
||||
if (this == NULL) // ????
|
||||
{
|
||||
mFont->setCharColor(JUtility::TColor(0xff, 0xff, 0x64, 0xff));
|
||||
mFont->drawString_scale((int)(f31 - mFontSizeX), mFontSizeX, mFontSizeY, sp94,
|
||||
"*", TRUE);
|
||||
}
|
||||
mFont->setCharColor(JUtility::TColor(0xc8, 0xc8, 0xc8, 0xff));
|
||||
char spA8[] = "S----------E";
|
||||
char spB8[0x20];
|
||||
int sp90 = diffIndex(field_0x34, field_0x38) + 1;
|
||||
int sp8C = diffIndex(field_0x34, field_0x30);
|
||||
int sp88 = 0;
|
||||
int sp84;
|
||||
if (sp90 <= mHeight) {
|
||||
sp84 = 9;
|
||||
sp88 = 1;
|
||||
} else {
|
||||
sp84 = (sp8C * 9) / (int)(sp90 - mHeight);
|
||||
}
|
||||
spA8[sp84 + 1] = 'O';
|
||||
mFont->drawString_scale((int)f31, sp94, mFontSizeX, mFontSizeY, spA8, TRUE);
|
||||
f31 += mFontSizeX * 13.0f;
|
||||
if (sp88) {
|
||||
sprintf(spB8, "ALL");
|
||||
} else {
|
||||
f32 f29 = sp8C / (f32)(sp90 - mHeight);
|
||||
sprintf(spB8, "%3d%%(%dL)", (int)(100.0 * f29), sp90);
|
||||
}
|
||||
mFont->drawString_scale(f31, sp94, mFontSizeX, mFontSizeY, spB8, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JUTConsole::print_f(char const* fmt, ...) {
|
||||
UNUSED(fmt);
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
JUTConsole_print_f_va_(this, fmt, args);
|
||||
JUTConsole::print_f_va(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
@@ -187,48 +229,48 @@ void JUTConsole::print(char const* str) {
|
||||
}
|
||||
|
||||
if (mOutput & 1) {
|
||||
const u8* r29 = (const u8*)str;
|
||||
u8* r28 = getLinePtr(field_0x38) + field_0x3c;
|
||||
while (*r29) {
|
||||
u8* src = (u8*)const_cast<char*>(str); // needs to be non-const to match debug
|
||||
u8* dst = (u8*)getLinePtr(field_0x38) + field_0x3c;
|
||||
while (*src != 0) {
|
||||
if (field_0x6a && field_0x34 == nextIndex(field_0x38)) {
|
||||
break;
|
||||
}
|
||||
if (*r29 == '\n') {
|
||||
r29++;
|
||||
if (*src == '\n') {
|
||||
src++;
|
||||
field_0x3c = field_0x20;
|
||||
} else if (*r29 == '\t') {
|
||||
r29++;
|
||||
} else if (*src == '\t') {
|
||||
src++;
|
||||
while (field_0x3c < field_0x20) {
|
||||
*(r28++) = ' ';
|
||||
*dst++ = ' ';
|
||||
field_0x3c++;
|
||||
if (field_0x3c % field_0x64 == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (mFont && mFont->isLeadByte(*r29)) {
|
||||
} else if (mFont && mFont->isLeadByte(*src)) {
|
||||
if (field_0x3c + 1 < field_0x20) {
|
||||
*(r28++) = *(r29++);
|
||||
*(r28++) = *(r29++);
|
||||
*dst++ = *src++;
|
||||
*dst++ = *src++;
|
||||
field_0x3c++;
|
||||
field_0x3c++;
|
||||
} else {
|
||||
*(r28++) = 0;
|
||||
*dst++ = '\0';
|
||||
field_0x3c++;
|
||||
}
|
||||
} else {
|
||||
*(r28++) = *(r29++);
|
||||
*dst++ = *src++;
|
||||
field_0x3c++;
|
||||
}
|
||||
|
||||
if (field_0x3c < field_0x20) {
|
||||
continue;
|
||||
}
|
||||
*r28 = 0;
|
||||
*dst = '\0';
|
||||
field_0x38 = nextIndex(field_0x38);
|
||||
field_0x3c = 0;
|
||||
setLineAttr(field_0x38, 0xff);
|
||||
r28 = getLinePtr(field_0x38);
|
||||
*r28 = 0;
|
||||
dst = getLinePtr(field_0x38);
|
||||
*dst = '\0';
|
||||
int local_28 = diffIndex(field_0x30, field_0x38);
|
||||
if (local_28 == mHeight) {
|
||||
field_0x30 = nextIndex(field_0x30);
|
||||
@@ -244,7 +286,7 @@ void JUTConsole::print(char const* str) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
*r28 = 0;
|
||||
*dst = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,6 +342,15 @@ void JUTConsole::dumpToTerminal(unsigned int param_0) {
|
||||
OS_REPORT(":::dump of console[%x] END----------------------------\n", this);
|
||||
}
|
||||
|
||||
static void dummyStrings2()
|
||||
{
|
||||
UNUSED("console != this && console != 0");
|
||||
UNUSED("\n:::dump of console[%x]----------------\n");
|
||||
UNUSED(":::dump of console[%x] END------------\n");
|
||||
UNUSED("sManager == 0");
|
||||
UNUSED("consoleManager != 0 && sManager == consoleManager");
|
||||
}
|
||||
|
||||
void JUTConsole::scroll(int scrollAmnt) {
|
||||
if (scrollAmnt < 0) {
|
||||
int diff = diffIndex(field_0x34, field_0x30);
|
||||
@@ -404,8 +455,9 @@ void JUTConsoleManager::drawDirect(bool waitRetrace) const {
|
||||
s32 interrupt_status = OSEnableInterrupts();
|
||||
u32 retrace_count = VIGetRetraceCount();
|
||||
u32 new_count;
|
||||
do {
|
||||
} while (retrace_count == VIGetRetraceCount());
|
||||
while (retrace_count == VIGetRetraceCount()){
|
||||
// nop
|
||||
}
|
||||
OSRestoreInterrupts(interrupt_status);
|
||||
}
|
||||
mDirectConsole->doDraw(JUTConsole::CONSOLE_TYPE_2);
|
||||
@@ -459,6 +511,8 @@ extern "C" void JUTReportConsole_f_va(const char* fmt, va_list args) {
|
||||
}
|
||||
|
||||
extern "C" void JUTReportConsole_f(const char* fmt, ...) {
|
||||
UNUSED(fmt);
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
JUTReportConsole_f_va(fmt, args);
|
||||
@@ -490,6 +544,8 @@ void JUTWarningConsole_f_va(const char* fmt, va_list args) {
|
||||
}
|
||||
|
||||
void JUTWarningConsole_f(const char* fmt, ...) {
|
||||
UNUSED(fmt);
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
JUTReportConsole_f_va(fmt, args);
|
||||
|
||||
@@ -6,15 +6,6 @@
|
||||
#include "JSystem/JUtility/JUTVideo.h"
|
||||
#include <cstdio>
|
||||
|
||||
inline void enter_(int param_0, int param_1, int param_2, const char* fmt, va_list args) {
|
||||
char buf[0x100];
|
||||
int ret = vsnprintf(buf, 0x100, fmt, args);
|
||||
if (ret < 0) {
|
||||
return;
|
||||
}
|
||||
JUTDbPrint::getManager()->enter(param_0, param_1, param_2, buf, ret < 0x100 ? ret : 0xFF);
|
||||
}
|
||||
|
||||
JUTDbPrint::JUTDbPrint(JUTFont* pFont, JKRHeap* pHeap) {
|
||||
mFont = pFont;
|
||||
mFirst = NULL;
|
||||
@@ -59,9 +50,13 @@ void JUTDbPrint::enter(int param_0, int param_1, int param_2, const char* param_
|
||||
}
|
||||
}
|
||||
|
||||
static void dummy() {
|
||||
va_list args;
|
||||
enter_(0, 0, 0, 0, args);
|
||||
static inline void enter_(int param_0, int param_1, int param_2, const char* fmt, va_list args) {
|
||||
char buf[0x100];
|
||||
int ret = vsnprintf(buf, 0x100, fmt, args);
|
||||
|
||||
if (ret >= 0) {
|
||||
JUTDbPrint::getManager()->enter(param_0, param_1, param_2, buf, ret < 0x100 ? ret : 0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
void JUTDbPrint::flush() {
|
||||
@@ -101,13 +96,17 @@ void JUTDbPrint::drawString(int posX, int posY, int len, const u8* str) {
|
||||
}
|
||||
|
||||
void JUTReport(int param_0, int param_1, char const* fmt, ...) {
|
||||
UNUSED(fmt); // although not really unused
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
enter_(param_0, param_1, 1, fmt, args);
|
||||
enter_(param_0, param_1, TRUE, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void JUTReport(int param_0, int param_1, int param_2, char const* fmt, ...) {
|
||||
UNUSED(fmt); // although not really unused
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
enter_(param_0, param_1, param_2, fmt, args);
|
||||
|
||||
@@ -160,7 +160,11 @@ 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) {
|
||||
#if PLATFORM_SHIELD
|
||||
position_y += (u16)7;
|
||||
#else
|
||||
position_y += 7;
|
||||
#endif
|
||||
position_x = x;
|
||||
} else if (codepoint == 0xfd) {
|
||||
position_x = position_x + 0x30 - ((position_x - x + 0x2f) % 0x30);
|
||||
@@ -168,7 +172,11 @@ void JUTDirectPrint::printSub(u16 position_x, u16 position_y, char const* format
|
||||
if (codepoint != 0xff) {
|
||||
drawChar(position_x, position_y, codepoint);
|
||||
}
|
||||
#if PLATFORM_SHIELD
|
||||
position_x += (u16)6;
|
||||
#else
|
||||
position_x += 6;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,6 +185,8 @@ void JUTDirectPrint::printSub(u16 position_x, u16 position_y, char const* format
|
||||
}
|
||||
|
||||
void JUTDirectPrint::print(u16 position_x, u16 position_y, char const* format, ...) {
|
||||
UNUSED(format);
|
||||
|
||||
if (mFrameBuffer) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
@@ -190,6 +200,8 @@ void JUTDirectPrint::drawString(u16 position_x, u16 position_y, char* text) {
|
||||
}
|
||||
|
||||
void JUTDirectPrint::drawString_f(u16 position_x, u16 position_y, char const* format, ...) {
|
||||
UNUSED(format);
|
||||
|
||||
if (mFrameBuffer) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
@@ -204,17 +216,15 @@ void JUTDirectPrint::setCharColor(JUtility::TColor color) {
|
||||
|
||||
void JUTDirectPrint::setCharColor(u8 r, u8 g, u8 b) {
|
||||
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;
|
||||
int Y = 0.257 * (int)r + 0.504 * (int)g + 0.098 * (int)b + 16;
|
||||
|
||||
mCharColor_Y = Y << 8;
|
||||
|
||||
int Y = 0.257 * (int)r + 0.504 * (int)g + 0.098 * (int)b + 16.0f;
|
||||
int Cb = -0.148 * (int)r - 0.291 * (int)g + 0.439 * (int)b + 128.0f;
|
||||
int Cr = 0.439 * (int)r - 0.368 * (int)g - 0.071 * (int)b + 128.0f;
|
||||
|
||||
mCharColor_Y = (u16)Y * 256;
|
||||
mCharColor_Cb = Cb;
|
||||
mCharColor_Cb2 = (Cb >> 1) & 0x7fff;
|
||||
mCharColor_Cb4 = (Cb >> 2) & 0x3fff;
|
||||
mCharColor_Cb2 = (u16)Cb / 2;
|
||||
mCharColor_Cb4 = (u16)Cb / 4;
|
||||
mCharColor_Cr = Cr;
|
||||
mCharColor_Cr2 = (Cr >> 1) & 0x7fff;
|
||||
mCharColor_Cr4 = (Cr >> 2) & 0x3fff;
|
||||
mCharColor_Cr2 = (u16)Cr / 2;
|
||||
mCharColor_Cr4 = (u16)Cr / 4;
|
||||
}
|
||||
|
||||
@@ -190,6 +190,8 @@ void JUTException::panic_f_va(char const* file, int line, char const* format, va
|
||||
}
|
||||
|
||||
void JUTException::panic_f(char const* file, int line, char const* format, ...) {
|
||||
UNUSED(format);
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
panic_f_va(file, line, format, args);
|
||||
@@ -308,7 +310,9 @@ void JUTException::showStack(OSContext* context) {
|
||||
u32* stackPointer = (u32*)mStackPointer;
|
||||
sConsole->print_f("Address: BackChain LR save\n");
|
||||
|
||||
for (i = 0; (stackPointer != NULL) && (stackPointer != (u32*)0xFFFFFFFF) && (i++ < 0x100);) {
|
||||
for (i = 0; (stackPointer != NULL) && ((uintptr_t)stackPointer != -1) && (i++ < 0x100);
|
||||
stackPointer = (u32*)stackPointer[0])
|
||||
{
|
||||
if (i > mTraceSuppress) {
|
||||
sConsole->print("Suppress trace.\n");
|
||||
return;
|
||||
@@ -318,7 +322,6 @@ void JUTException::showStack(OSContext* context) {
|
||||
showMapInfo_subroutine(stackPointer[1], false);
|
||||
JUTConsoleManager::getManager()->drawDirect(true);
|
||||
waitTime(mPrintWaitTime1);
|
||||
stackPointer = (u32*)stackPointer[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,8 +532,10 @@ bool JUTException::isEnablePad() const {
|
||||
bool JUTException::readPad(u32* out_trigger, u32* out_button) {
|
||||
bool result = false;
|
||||
OSTime start_time = OSGetTime();
|
||||
do {
|
||||
} while (OSTicksToMilliseconds(OSGetTime() - start_time) < 0x32);
|
||||
OSTime ms;
|
||||
while (((OSGetTime() - start_time) / (OS_TIMER_CLOCK / 1000)) < 50){
|
||||
// nop
|
||||
}
|
||||
|
||||
if (mGamePad == (JUTGamePad*)0xffffffff) {
|
||||
JUTGamePad gamePad0(JUTGamePad::EPort1);
|
||||
@@ -683,7 +688,7 @@ void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u3
|
||||
|
||||
int down = 0;
|
||||
int up = 0;
|
||||
do {
|
||||
while (true) {
|
||||
readPad(&trigger, &button);
|
||||
|
||||
bool draw = false;
|
||||
@@ -720,7 +725,7 @@ void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u3
|
||||
}
|
||||
|
||||
waitTime(30);
|
||||
} while (true);
|
||||
}
|
||||
}
|
||||
|
||||
while (true) {
|
||||
@@ -750,19 +755,19 @@ void JUTException::printContext(OSError error, OSContext* context, u32 dsisr, u3
|
||||
}
|
||||
|
||||
void JUTException::waitTime(s32 timeout_ms) {
|
||||
if (!timeout_ms) {
|
||||
return;
|
||||
OSTime start_time;
|
||||
if (timeout_ms) {
|
||||
start_time = OSGetTime();
|
||||
while (((OSGetTime() - start_time) / (OS_TIMER_CLOCK / 1000)) < timeout_ms) {
|
||||
// nop
|
||||
}
|
||||
}
|
||||
|
||||
OSTime start_time = OSGetTime();
|
||||
do {
|
||||
} while (OSTicksToMilliseconds(OSGetTime() - start_time) < timeout_ms);
|
||||
}
|
||||
|
||||
void JUTException::createFB() {
|
||||
_GXRenderModeObj* renderMode = &GXNtsc480Int;
|
||||
void* end = (void*)OSGetArenaHi();
|
||||
u32 size = (u16(ALIGN_NEXT(u16(renderMode->fbWidth), 16)) * renderMode->xfbHeight) * 2;
|
||||
u32 size = ((u16)ALIGN_NEXT((u16)renderMode->fbWidth, 16) * renderMode->xfbHeight) * 2;
|
||||
|
||||
void* begin = (void*)ALIGN_PREV((uintptr_t)end - size, 32);
|
||||
void* object = (void*)ALIGN_PREV((s32)begin - sizeof(JUTExternalFB), 32);
|
||||
@@ -777,8 +782,9 @@ void JUTException::createFB() {
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
u32 start = VIGetRetraceCount();
|
||||
while (start == VIGetRetraceCount())
|
||||
;
|
||||
while (start == VIGetRetraceCount()) {
|
||||
// nop
|
||||
}
|
||||
}
|
||||
|
||||
mFrameMemory = (JUTExternalFB*)object;
|
||||
@@ -892,68 +898,74 @@ bool JUTException::queryMapAddress_single(char* mapPath, u32 address, s32 sectio
|
||||
if (section_id >= 0 && section_id != section_idx)
|
||||
continue;
|
||||
|
||||
int length;
|
||||
|
||||
int length;
|
||||
while (true) {
|
||||
if ((length = file.fgets(buffer, ARRAY_SIZEU(buffer))) <= 4) {
|
||||
break;
|
||||
}
|
||||
if (length >= 28) {
|
||||
u32 addr;
|
||||
if (buffer[28] == '4') {
|
||||
addr = ((buffer[18] - '0') << 28) | strtol(buffer + 19, NULL, 16);
|
||||
int size = strtol(buffer + 11, NULL, 16);
|
||||
if ((addr <= address && address < addr + size)) {
|
||||
if (out_addr) {
|
||||
*out_addr = addr;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
if ((length = file.fgets(buffer, ARRAY_SIZEU(buffer))) <= 4)
|
||||
break;
|
||||
if ((length < 28))
|
||||
continue;
|
||||
if (buffer[28] == '4') {
|
||||
u32 addr = ((buffer[18] - '0') << 28) | strtol(buffer + 19, NULL, 16);
|
||||
int size = strtol(buffer + 11, NULL, 16);
|
||||
if ((addr <= address && address < addr + size)) {
|
||||
if (out_addr)
|
||||
*out_addr = addr;
|
||||
if (out_size) {
|
||||
*out_size = size;
|
||||
}
|
||||
|
||||
if (out_size)
|
||||
*out_size = size;
|
||||
if (out_line) {
|
||||
const u8* src = (const u8*)&buffer[30];
|
||||
u8* dst = (u8*)out_line;
|
||||
u32 i = 0;
|
||||
|
||||
if (out_line) {
|
||||
const u8* src = (const u8*)&buffer[0x1e];
|
||||
u8* dst = (u8*)out_line;
|
||||
u32 i = 0;
|
||||
for (i = 0; i < line_length - 1; src++) {
|
||||
if ((u8)*src < (u32)' ' && *src != (u32)'\t') {
|
||||
break;
|
||||
}
|
||||
if ((*src == ' ' || *src == (u32)'\t') && (i != 0)) {
|
||||
if (dst[-1] != ' ') {
|
||||
*dst = ' ';
|
||||
dst++;
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
*dst++ = *src;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i != 0 && dst[-1] == ' ') {
|
||||
dst--;
|
||||
i--;
|
||||
}
|
||||
(void)*src; // needed to match debug
|
||||
*dst = 0;
|
||||
if (print) {
|
||||
if (begin_with_newline) {
|
||||
sConsole->print("\n");
|
||||
}
|
||||
sConsole->print_f(" [%08X]: .%s [%08X: %XH]\n %s\n", address,
|
||||
section_name, addr, size, out_line);
|
||||
begin_with_newline = false;
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < line_length - 1; ++src) {
|
||||
if ((u32)(*src) < ' ' && (u32)*src != '\t')
|
||||
break;
|
||||
if ((*src == ' ' || (u32)*src == '\t') && (i != 0)) {
|
||||
if (dst[-1] != ' ') {
|
||||
*dst = ' ';
|
||||
dst++;
|
||||
++i;
|
||||
}
|
||||
} else {
|
||||
*dst++ = *src;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i != 0 && dst[-1] == ' ') {
|
||||
dst--;
|
||||
i--;
|
||||
}
|
||||
*dst = 0;
|
||||
if (print) {
|
||||
if (begin_with_newline) {
|
||||
sConsole->print("\n");
|
||||
}
|
||||
sConsole->print_f(" [%08X]: .%s [%08X: %XH]\n %s\n", address, section_name, addr, size, out_line);
|
||||
begin_with_newline = false;
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (result || (section_id >= 0 && section_id == section_idx)) {
|
||||
if (print && begin_with_newline) {
|
||||
sConsole->print("\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!result && (section_id < 0 || section_id != section_idx)) {
|
||||
continue;
|
||||
}
|
||||
if (print && begin_with_newline) {
|
||||
sConsole->print("\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
file.fclose();
|
||||
@@ -961,7 +973,7 @@ bool JUTException::queryMapAddress_single(char* mapPath, u32 address, s32 sectio
|
||||
}
|
||||
|
||||
void JUTException::createConsole(void* console_buffer, u32 console_buffer_size) {
|
||||
if (!console_buffer || !console_buffer_size) {
|
||||
if (console_buffer == NULL || console_buffer_size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,15 +35,14 @@ 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) {
|
||||
u32 c = *(u8*)str;
|
||||
u32 b = c;
|
||||
for (; usz != 0; --usz, ++str) {
|
||||
s32 b = (u8)*str;
|
||||
if (isLeadByte(b)) {
|
||||
JUT_ASSERT(114, usz >= 2);
|
||||
usz--;
|
||||
str++;
|
||||
b <<= 8;
|
||||
b |= *(u8*)str;
|
||||
b |= (u8)*str;
|
||||
}
|
||||
|
||||
a1 += drawChar_scale(a1, a2, a3, a4, b, a7);
|
||||
|
||||
@@ -391,26 +391,26 @@ u32 JUTGamePad::CStick::update(s8 x, s8 y, JUTGamePad::EStickMode mode,
|
||||
}
|
||||
|
||||
u32 JUTGamePad::CStick::getButton(u32 buttons) {
|
||||
u32 button = buttons & 0xF;
|
||||
u32 button = buttons & (PAD_BUTTON_UP | PAD_BUTTON_DOWN | PAD_BUTTON_LEFT | PAD_BUTTON_RIGHT);
|
||||
|
||||
if (-sReleasePoint < mPosX && mPosX < sReleasePoint) {
|
||||
button = button & ~0x3;
|
||||
button &= ~(PAD_BUTTON_LEFT | PAD_BUTTON_RIGHT);
|
||||
} else if (mPosX <= -sPressPoint) {
|
||||
button = (button & ~0x2);
|
||||
button |= 1;
|
||||
button &= ~PAD_BUTTON_RIGHT;
|
||||
button |= PAD_BUTTON_LEFT;
|
||||
} else if (mPosX >= sPressPoint) {
|
||||
button = (button & ~0x1);
|
||||
button |= 2;
|
||||
button &= ~PAD_BUTTON_LEFT;
|
||||
button |= PAD_BUTTON_RIGHT;
|
||||
}
|
||||
|
||||
if (-sReleasePoint < mPosY && mPosY < sReleasePoint) {
|
||||
button = button & ~0xC;
|
||||
button &= ~(PAD_BUTTON_UP | PAD_BUTTON_DOWN);
|
||||
} else if (mPosY <= -sPressPoint) {
|
||||
button = (button & ~0x8);
|
||||
button |= 4;
|
||||
button &= ~PAD_BUTTON_UP;
|
||||
button |= PAD_BUTTON_DOWN;
|
||||
} else if (mPosY >= sPressPoint) {
|
||||
button = (button & ~0x4);
|
||||
button |= 8;
|
||||
button &= ~PAD_BUTTON_DOWN;
|
||||
button |= PAD_BUTTON_UP;
|
||||
}
|
||||
|
||||
return button;
|
||||
@@ -481,7 +481,7 @@ void JUTGamePad::CRumble::update(s16 port) {
|
||||
return;
|
||||
} else {
|
||||
bool enabled = getNumBit(mPattern, mFrame % mFrameCount);
|
||||
u8 status = mStatus[port] != false;
|
||||
u32 status = mStatus[port] != false;
|
||||
|
||||
if (enabled && !status) {
|
||||
startMotor(port);
|
||||
|
||||
@@ -9,16 +9,16 @@ static bool data_804514B8;
|
||||
JUTGraphFifo* JUTGraphFifo::sCurrentFifo;
|
||||
|
||||
JUTGraphFifo::JUTGraphFifo(u32 size) {
|
||||
mSize = size + 0x1F & ~0x1F;
|
||||
mSize = ROUND(size, 0x20);
|
||||
if (data_804514B8) {
|
||||
u32 r29 = sizeof(GXFifoObj);
|
||||
mFifo = (GXFifoObj*)JKRAllocFromSysHeap(mSize + r29, 32);
|
||||
mBase = (u8*)mFifo + r29;
|
||||
u32 fifoSize = sizeof(GXFifoObj);
|
||||
mFifo = (GXFifoObj*)JKRAllocFromSysHeap(fifoSize + mSize, 32);
|
||||
mBase = (u8*)mFifo + fifoSize;
|
||||
GXInitFifoBase(mFifo, mBase, mSize);
|
||||
GXInitFifoPtrs(mFifo, mBase, mBase);
|
||||
} else {
|
||||
mBase = JKRAllocFromSysHeap(mSize + 0xA0, 32);
|
||||
mBase = (void*)((intptr_t)mBase + 0x1F & ~0x1F);
|
||||
mBase = (void*)ROUND((intptr_t)mBase, 0x20);
|
||||
mFifo = GXInit(mBase, mSize);
|
||||
data_804514B8 = true;
|
||||
sCurrentFifo = this;
|
||||
@@ -30,8 +30,9 @@ bool JUTGraphFifo::mGpStatus[5];
|
||||
JUTGraphFifo::~JUTGraphFifo() {
|
||||
sCurrentFifo->save();
|
||||
|
||||
do {
|
||||
} while (isGPActive());
|
||||
while (isGPActive()) {
|
||||
// nop
|
||||
}
|
||||
|
||||
if (sCurrentFifo == this) {
|
||||
sCurrentFifo = NULL;
|
||||
|
||||
@@ -9,8 +9,8 @@ void JUTPalette::storeTLUT(GXTlut param_0, ResTLUT* tlut) {
|
||||
OSPanic("JUTPalette.cpp", 35, "JUTTexture: TLUT is NULL\n");
|
||||
}
|
||||
mTlutName = param_0;
|
||||
mFormat = tlut->format;
|
||||
mTransparency = tlut->transparency;
|
||||
mFormat = (const u8)tlut->format;
|
||||
mTransparency = (const u8)tlut->transparency;
|
||||
mNumColors = tlut->numColors;
|
||||
mColorTable = tlut + 8;
|
||||
GXInitTlutObj(&mTlutObj, (void*)mColorTable, (GXTlutFmt)mFormat, mNumColors);
|
||||
|
||||
@@ -81,8 +81,9 @@ void JUTProcBar::adjustMeterLength(u32 param_0, f32* param_1, f32 param_2, f32 p
|
||||
int* param_4) {
|
||||
BOOL var2 = false;
|
||||
float var1 = *param_1;
|
||||
u32 frameDuration = 16666;
|
||||
while (var1 > param_2) {
|
||||
if (param_0 * var1 * 20.0f / 16666.0f <= mParams.mWidth - 30.0f)
|
||||
if (param_0 * var1 * 20.0f / frameDuration <= mParams.mWidth - 30.0f)
|
||||
break;
|
||||
|
||||
var1 -= (1.0f / 10.0f);
|
||||
@@ -98,7 +99,7 @@ void JUTProcBar::adjustMeterLength(u32 param_0, f32* param_1, f32 param_2, f32 p
|
||||
(*param_4)++;
|
||||
if (*param_4 < 0x1e)
|
||||
break;
|
||||
if ((param_0 * var1 * 20.0f / 16666.0f) < (mParams.mWidth - 60.0f))
|
||||
if ((param_0 * var1 * 20.0f / frameDuration) < (mParams.mWidth - 60.0f))
|
||||
var1 += (1.0f / 5.0f);
|
||||
break;
|
||||
}
|
||||
@@ -113,10 +114,13 @@ void JUTProcBar::draw() {
|
||||
void JUTProcBar::drawProcessBar() {
|
||||
if (mVisible) {
|
||||
int frameDuration = 16666; // duration in miliseconds? for how long a frame takes,
|
||||
if (JUTVideo::getManager() && ((JUTVideo::getManager()->getRenderMode()->viTVmode >> 2) &
|
||||
0x0f) == 1) // possibly a define
|
||||
frameDuration = 20000; // duration for PAL
|
||||
|
||||
if (JUTVideo::getManager()) {
|
||||
int viMode = JUTVideo::getManager()->getRenderMode()->viTVmode;
|
||||
int viMode2 = ((viMode >> 2) & 0x0f);
|
||||
if (viMode2 == 1) { // possibly a define
|
||||
frameDuration = 20000; // duration for PAL
|
||||
}
|
||||
}
|
||||
static int cnt = 0;
|
||||
adjustMeterLength(mWholeLoop.mCost, &oneFrameRate, 1.0f, 10.0f, &cnt);
|
||||
int r28 = oneFrameRate * 20.0f;
|
||||
@@ -168,14 +172,15 @@ void JUTProcBar::drawProcessBar() {
|
||||
int r21 = mParams.mPosX + 1;
|
||||
bar_subroutine(r21, r22, r26, r28, frameDuration, gpuTime, -1,
|
||||
JUtility::TColor(80, 255, 80, 255), JUtility::TColor(80, 255, 80, 255));
|
||||
int thingy1 = gpuTime * r28 / frameDuration + r21; // inline or define?
|
||||
J2DFillBox(thingy1, r22, mGpWait.calcBarSize(r28, frameDuration), r26,
|
||||
J2DFillBox((int)(gpuTime * r28 / frameDuration + r21), r22,
|
||||
(int)(mGpWait.mCost * r28 / frameDuration), r26,
|
||||
JUtility::TColor(0, 255, 0, 255));
|
||||
int r30 = mGp.calcBarSize(r28, frameDuration) + r21;
|
||||
int r30 = mGp.mCost * r28 / frameDuration + r21;
|
||||
r21 += totalTime * r28 / frameDuration;
|
||||
r22 += mParams.mBarWidth * 2;
|
||||
bar_subroutine(r21, r22, r26, r28, frameDuration, mCpu.mCost, -1,
|
||||
JUtility::TColor(255, 80, 80, 255), JUtility::TColor(255, 80, 80, 255));
|
||||
r21 += mCpu.mCost * r28 / frameDuration;
|
||||
r22 += mParams.mBarWidth * 2;
|
||||
bar_subroutine(r30, r22, r26, r28, frameDuration, mIdle.mCost, -1,
|
||||
JUtility::TColor(180, 180, 160, 255),
|
||||
@@ -192,6 +197,7 @@ void JUTProcBar::drawProcessBar() {
|
||||
u32 temp3 = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
CTime* time = &mUsers[i];
|
||||
u32 sp17c = time->mCost;
|
||||
if (++time->field_0xc >= 0x10 || time->mCost > time->field_0x8) {
|
||||
time->field_0x8 = time->mCost;
|
||||
time->field_0xc = 0;
|
||||
@@ -199,7 +205,8 @@ void JUTProcBar::drawProcessBar() {
|
||||
if (time->field_0x8 > temp3)
|
||||
temp3 = time->field_0x8;
|
||||
}
|
||||
if ((bool)temp3 == true) {
|
||||
bool sp11 = temp3 ? true : false;
|
||||
if (sp11 == true) {
|
||||
static int cntUser = 0;
|
||||
adjustMeterLength(temp3, &oneFrameRateUser, 1.0f, 10.0f, &cntUser);
|
||||
int r21 = oneFrameRateUser * 20.0f;
|
||||
@@ -209,6 +216,7 @@ void JUTProcBar::drawProcessBar() {
|
||||
JUtility::TColor(50, 50, 150, 255), 6);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
CTime* time = &mUsers[i];
|
||||
int unsued = time->mCost;
|
||||
if (++time->field_0xc >= 0x10 || time->mCost > time->field_0x8) {
|
||||
time->field_0x8 = time->mCost;
|
||||
time->field_0xc = 0;
|
||||
|
||||
@@ -90,9 +90,8 @@ void JUTResFont::countBlock() {
|
||||
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) {
|
||||
for (u32 i = 0; i < mResFont->numBlocks; i++) {
|
||||
switch (((BlockHeader*)pData)->magic) {
|
||||
case 'WID1':
|
||||
mWid1BlockNum++;
|
||||
break;
|
||||
@@ -107,6 +106,7 @@ void JUTResFont::countBlock() {
|
||||
default:
|
||||
JUTReportConsole("JUTResFont: Unknown data block\n");
|
||||
}
|
||||
pData += ((BlockHeader*)pData)->size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,18 +117,17 @@ IsLeadByte_func const JUTResFont::saoAboutEncoding_[3] = {
|
||||
};
|
||||
|
||||
void JUTResFont::setBlock() {
|
||||
s32 widthNum, glyphNum, mapNum;
|
||||
widthNum = 0;
|
||||
glyphNum = 0;
|
||||
mapNum = 0;
|
||||
s32 widthNum = 0;
|
||||
s32 glyphNum = 0;
|
||||
s32 mapNum = 0;
|
||||
u32 u;
|
||||
mMaxCode = -1;
|
||||
|
||||
BlockHeader* data = (BlockHeader*)mResFont->data;
|
||||
for (u32 i = 0; i < mResFont->numBlocks; data = (BlockHeader*)data->getNext(), i++) {
|
||||
BlockHeader* data = (BlockHeader*)mResFont->data;
|
||||
for (u32 i = 0; i < mResFont->numBlocks; i++) {
|
||||
switch (data->magic) {
|
||||
case 'INF1': {
|
||||
mInf1Ptr = (ResFONT::INF1*)data;
|
||||
u32 u = mInf1Ptr->fontType;
|
||||
u = mInf1Ptr->fontType;
|
||||
JUT_ASSERT(244, u < suAboutEncoding_);
|
||||
mIsLeadByte = &saoAboutEncoding_[u];
|
||||
break;
|
||||
@@ -156,6 +155,7 @@ void JUTResFont::setBlock() {
|
||||
JUTReportConsole("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
data = (BlockHeader*)(((Ptr)data) + data->size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,8 +212,8 @@ void JUTResFont::setGX(JUtility::TColor col1, JUtility::TColor col2) {
|
||||
f32 JUTResFont::drawChar_scale(f32 pos_x, f32 pos_y, f32 scale_x, f32 scale_y, int str_int,
|
||||
bool flag) {
|
||||
f32 x1;
|
||||
f32 y1;
|
||||
f32 x2;
|
||||
f32 y1;
|
||||
|
||||
JUT_ASSERT(378, mValid);
|
||||
JUTFont::TWidth width;
|
||||
@@ -330,37 +330,37 @@ int JUTResFont::getFontCode(int chr) const {
|
||||
|
||||
int ret = mInf1Ptr->defaultCode;
|
||||
if ((getFontType() == 2) && (mMaxCode >= 0x8000U) && (chr >= 0x20) && (chr < 0x7FU)) {
|
||||
chr = halftofull[chr - 32];
|
||||
chr = (halftofull - 0x20)[chr];
|
||||
}
|
||||
for (int i = 0; i < mMap1BlockNum; i++) {
|
||||
if ((mpMapBlocks[i]->startCode <= chr) && (chr <= mpMapBlocks[i]->endCode)) {
|
||||
if (mpMapBlocks[i]->mappingMethod == 0) {
|
||||
ret = chr - mpMapBlocks[i]->startCode;
|
||||
break;
|
||||
} else if (mpMapBlocks[i]->mappingMethod == 2) {
|
||||
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;
|
||||
int phi_r5 = 0;
|
||||
int phi_r6_2 = mpMapBlocks[i]->numEntries - 1;
|
||||
// invented struct to help match debug, unsure of real struct
|
||||
struct paired_u16 {
|
||||
u16 fullChar;
|
||||
u16 fontCode;
|
||||
};
|
||||
|
||||
while (phi_r6_2 >= phi_r5) {
|
||||
int temp_r7 = (phi_r6_2 + phi_r5) / 2;
|
||||
paired_u16* leading_temp = (paired_u16*)&mpMapBlocks[i]->mLeading;
|
||||
int binarySearchMin = 0;
|
||||
int binarySearchMax = mpMapBlocks[i]->numEntries - 1;
|
||||
|
||||
if (chr < leading_temp[temp_r7 * 2]) {
|
||||
phi_r6_2 = temp_r7 - 1;
|
||||
continue;
|
||||
while (binarySearchMax >= binarySearchMin) {
|
||||
int midIndex = (binarySearchMax + binarySearchMin) / 2;
|
||||
|
||||
if (chr < leading_temp[midIndex].fullChar) {
|
||||
binarySearchMax = midIndex - 1;
|
||||
} else if (chr > leading_temp[midIndex].fullChar) {
|
||||
binarySearchMin = midIndex + 1;
|
||||
} else {
|
||||
ret = leading_temp[midIndex].fontCode;
|
||||
break;
|
||||
}
|
||||
|
||||
if (chr > leading_temp[temp_r7 * 2]) {
|
||||
phi_r5 = temp_r7 + 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = leading_temp[temp_r7 * 2 + 1];
|
||||
break;
|
||||
}
|
||||
} else if (mpMapBlocks[i]->mappingMethod == 1) {
|
||||
u16* phi_r5_2 = NULL;
|
||||
@@ -368,7 +368,6 @@ int JUTResFont::getFontCode(int chr) const {
|
||||
phi_r5_2 = &mpMapBlocks[i]->mLeading;
|
||||
}
|
||||
ret = convertSjis(chr, phi_r5_2);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -398,8 +397,10 @@ void JUTResFont::loadImage(int code, GXTexMapID id){
|
||||
|
||||
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);
|
||||
void* pImg = &mpGlyphBlocks[i]->data[pageIdx * mpGlyphBlocks[i]->textureSize];
|
||||
GXInitTexObj(&mTexObj, pImg, 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;
|
||||
|
||||
@@ -19,11 +19,12 @@ void* JUTResReference::getResource(JSUInputStream* stream, u32 resType, JKRArchi
|
||||
|
||||
|
||||
void* JUTResReference::getResource(const void* data, u32 resType, JKRArchive* archive) {
|
||||
mType = *(u8*)data;
|
||||
mNameLength = *((u8*)data + 1);
|
||||
const u8* pData = (const u8*)data;
|
||||
mType = pData[0];
|
||||
mNameLength = pData[1];
|
||||
|
||||
if (mNameLength != 0) {
|
||||
memcpy(&mName, &((u8*)data)[2], mNameLength);
|
||||
memcpy(&mName, &pData[2], mNameLength);
|
||||
}
|
||||
|
||||
if (mType == RESTYPE_Unk2 || mType == RESTYPE_Unk3 || mType == RESTYPE_Unk4) {
|
||||
|
||||
@@ -132,12 +132,7 @@ void JUTTexture::init() {
|
||||
}
|
||||
|
||||
void JUTTexture::initTexObj() {
|
||||
GXBool mipmapEnabled;
|
||||
if (mTexInfo->mipmapEnabled != 0) {
|
||||
mipmapEnabled = 1;
|
||||
} else {
|
||||
mipmapEnabled = 0;
|
||||
}
|
||||
GXBool mipmapEnabled = mTexInfo->mipmapEnabled != 0 ? GX_TRUE : GX_FALSE;
|
||||
u8* image = ((u8*)mTexInfo);
|
||||
image += (mTexInfo->imageOffset ? mTexInfo->imageOffset : 0x20);
|
||||
GXInitTexObj(&mTexObj, image, mTexInfo->width, mTexInfo->height,
|
||||
@@ -149,12 +144,7 @@ void JUTTexture::initTexObj() {
|
||||
}
|
||||
|
||||
void JUTTexture::initTexObj(GXTlut param_0) {
|
||||
GXBool mipmapEnabled;
|
||||
if (mTexInfo->mipmapEnabled != 0) {
|
||||
mipmapEnabled = 1;
|
||||
} else {
|
||||
mipmapEnabled = 0;
|
||||
}
|
||||
GXBool mipmapEnabled = mTexInfo->mipmapEnabled != 0 ? GX_TRUE : GX_FALSE;
|
||||
mTlutName = param_0;
|
||||
u8* image = ((u8*)mTexInfo);
|
||||
image += (mTexInfo->imageOffset ? mTexInfo->imageOffset : 0x20);
|
||||
|
||||
Reference in New Issue
Block a user