mirror of
https://github.com/zeldaret/tww.git
synced 2026-05-23 06:54:16 -04:00
JUTAssert, JUTConsole, JUTException (#63)
* JUTAssert * JUTConsole * JUTException
This commit is contained in:
+1
-1
@@ -814,7 +814,7 @@ config.libs = [
|
||||
Object(NonMatching, "JSystem/JUtility/JUTGamePad.cpp"),
|
||||
Object(NonMatching, "JSystem/JUtility/JUTException.cpp"),
|
||||
Object(NonMatching, "JSystem/JUtility/JUTDirectPrint.cpp"),
|
||||
Object(NonMatching, "JSystem/JUtility/JUTAssert.cpp"),
|
||||
Object(Matching, "JSystem/JUtility/JUTAssert.cpp"),
|
||||
Object(NonMatching, "JSystem/JUtility/JUTVideo.cpp"),
|
||||
Object(NonMatching, "JSystem/JUtility/JUTXfb.cpp"),
|
||||
Object(NonMatching, "JSystem/JUtility/JUTFader.cpp"),
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace JUTAssertion {
|
||||
void setMessageCount(int);
|
||||
};
|
||||
|
||||
extern bool sAssertVisible;
|
||||
extern "C" {
|
||||
void setWarningMessage_f_va(u32 device, const char* file, int line, const char* msg, va_list args);
|
||||
void setLogMessage_f_va(u32 device, const char* file, int line, const char* msg, va_list args);
|
||||
}
|
||||
|
||||
#endif /* JUTASSERT_H */
|
||||
|
||||
@@ -67,6 +67,7 @@ public:
|
||||
bool isVisible() const { return mVisible; }
|
||||
void setVisible(bool visible) { mVisible = visible; }
|
||||
|
||||
u8 getLineAttr(int param_0) { return mBuf[(field_0x20 + 2) * param_0]; }
|
||||
void setLineAttr(int param_0, u8 param_1) { mBuf[(field_0x20 + 2) * param_0] = param_1; }
|
||||
u8* getLinePtr(int param_0) const { return &mBuf[(field_0x20 + 2) * param_0] + 1; }
|
||||
int diffIndex(int param_0, int param_1) const {
|
||||
@@ -77,13 +78,12 @@ public:
|
||||
return diff += mMaxLines;
|
||||
}
|
||||
|
||||
int nextIndex(int param_0) const {
|
||||
int index = param_0 + 1;
|
||||
if (mMaxLines <= index) {
|
||||
index = 0;
|
||||
}
|
||||
int prevIndex(int index) const {
|
||||
return --index < 0 ? index = mMaxLines - 1 : index;
|
||||
}
|
||||
|
||||
return index;
|
||||
int nextIndex(int index) const {
|
||||
return ++index >= mMaxLines ? 0 : index;
|
||||
}
|
||||
|
||||
void scrollToLastLine() { scroll(mMaxLines); }
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
|
||||
private:
|
||||
/* 0x20 */ u32 field_0x20;
|
||||
/* 0x24 */ u32 mMaxLines;
|
||||
/* 0x24 */ int mMaxLines;
|
||||
/* 0x28 */ u8* mBuf;
|
||||
/* 0x2C */ bool field_0x2c;
|
||||
/* 0x30 */ int field_0x30;
|
||||
@@ -146,6 +146,7 @@ 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 JUTWarningConsole_f_va(const char*, va_list);
|
||||
extern "C" void JUTWarningConsole_f(const char* message, ...);
|
||||
extern "C" void JUTReportConsole(const char* message);
|
||||
|
||||
|
||||
@@ -21,8 +21,10 @@ public:
|
||||
|
||||
/* 802E4240 */ static JUTDirectPrint* start();
|
||||
|
||||
void* getFrameBuffer() { return field_0x00; }
|
||||
bool isActive() const { return field_0x00 != 0; }
|
||||
JUtility::TColor getCharColor() const { return mCharColor; }
|
||||
void changeFrameBuffer(void *param_0) { changeFrameBuffer(param_0, mFrameBufferWidth, mFrameBufferHeight); }
|
||||
|
||||
static JUTDirectPrint* getManager() { return sDirectPrint; }
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
};
|
||||
|
||||
/* 802E1D5C */ JUTException(JUTDirectPrint*);
|
||||
/* 802E40EC */ virtual ~JUTException();
|
||||
/* 802E40EC */ virtual ~JUTException() {};
|
||||
|
||||
/* 802E22C4 */ void showFloatSub(int, f32);
|
||||
/* 802E2454 */ void showFloat(OSContext*);
|
||||
@@ -108,7 +108,7 @@ private:
|
||||
static OSMessageQueue sMessageQueue;
|
||||
static const char* sCpuExpName[17];
|
||||
static JSUList<JUTException::JUTExMapFile> sMapFileList;
|
||||
static u8 sMessageBuffer[4 + 4 /* padding */];
|
||||
static OSMessage sMessageBuffer[1];
|
||||
static JUTException* sErrorManager;
|
||||
static OSErrorHandler sPreUserCallback;
|
||||
static OSErrorHandler sPostUserCallback;
|
||||
@@ -128,10 +128,9 @@ private:
|
||||
/* 0x80 */ u32 mTraceSuppress;
|
||||
/* 0x84 */ u32 field_0x98;
|
||||
/* 0x88 */ u32 mPrintFlags;
|
||||
/* 0x8C */ u32 mStackPointer;
|
||||
};
|
||||
|
||||
STATIC_ASSERT(sizeof(JUTException) == 0x90);
|
||||
STATIC_ASSERT(sizeof(JUTException) == 0x8C);
|
||||
|
||||
struct JUTWarn {
|
||||
JUTWarn& operator<<(const char*) { return *this; }
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern GXRenderModeObj GXNtsc480IntDf;
|
||||
extern GXRenderModeObj GXNtsc480Int;
|
||||
extern GXRenderModeObj GXMpal480IntDf;
|
||||
extern GXRenderModeObj GXPal528IntDf;
|
||||
extern GXRenderModeObj GXEurgb60Hz480IntDf;
|
||||
|
||||
void GXSetDispCopySrc(u16 left, u16 top, u16 width, u16 height);
|
||||
void GXSetTexCopySrc(u16 left, u16 top, u16 width, u16 height);
|
||||
void GXSetDispCopyDst(u16 arg0, u16 arg1);
|
||||
|
||||
@@ -4,69 +4,182 @@
|
||||
//
|
||||
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/JUtility/JUTConsole.h"
|
||||
#include "JSystem/JUtility/JUTDbPrint.h"
|
||||
#include "JSystem/JUtility/JUTDirectPrint.h"
|
||||
#include "MSL_C/stdio.h"
|
||||
#include "dolphin/vi/vi.h"
|
||||
|
||||
/* 802C740C-802C7410 .text create__12JUTAssertionFv */
|
||||
void JUTAssertion::create() {
|
||||
/* Nonmatching */
|
||||
namespace JUTAssertion {
|
||||
namespace {
|
||||
static char sMessageFileLine[64];
|
||||
static char sMessageString[96];
|
||||
static s32 sDisplayTime = -1;
|
||||
static s32 sDevice = 3;
|
||||
static bool mVisible = true;
|
||||
static u32 sMessageLife;
|
||||
static s32 sMessageOwner;
|
||||
static u8 mSynchro;
|
||||
}
|
||||
}
|
||||
|
||||
/* 802C740C-802C7410 .text create__12JUTAssertionFv */
|
||||
void JUTAssertion::create() {}
|
||||
|
||||
/* 802C7410-802C744C .text flush_subroutine__12JUTAssertionFv */
|
||||
void JUTAssertion::flush_subroutine() {
|
||||
/* Nonmatching */
|
||||
u32 JUTAssertion::flush_subroutine() {
|
||||
if (sMessageLife == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (sMessageLife != -1) {
|
||||
sMessageLife--;
|
||||
}
|
||||
|
||||
if (sMessageLife >= 5) {
|
||||
return sMessageLife;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 802C744C-802C74B0 .text flushMessage__12JUTAssertionFv */
|
||||
void JUTAssertion::flushMessage() {
|
||||
/* Nonmatching */
|
||||
if (flush_subroutine() && mVisible == true) {
|
||||
JUTDirectPrint::getManager()->drawString(16, 16, sMessageFileLine);
|
||||
JUTDirectPrint::getManager()->drawString(16, 24, sMessageString);
|
||||
}
|
||||
}
|
||||
|
||||
/* 802C74B0-802C7690 .text flushMessage_dbPrint__12JUTAssertionFv */
|
||||
void JUTAssertion::flushMessage_dbPrint() {
|
||||
/* Nonmatching */
|
||||
if (flush_subroutine() && mVisible == true && JUTDbPrint::getManager() != NULL) {
|
||||
JUTFont* font = JUTDbPrint::getManager()->getFont();
|
||||
if (font != NULL) {
|
||||
u8 tmp = ((VIGetRetraceCount() & 0x3C) << 2) | 0xF;
|
||||
font->setGX();
|
||||
font->setCharColor(JUtility::TColor(255, tmp, tmp, 255));
|
||||
font->drawString(30, 36, sMessageFileLine, true);
|
||||
font->drawString(30, 54, sMessageString, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 802C7690-802C7698 .text getSDevice__12JUTAssertionFv */
|
||||
void JUTAssertion::getSDevice() {
|
||||
/* Nonmatching */
|
||||
u32 JUTAssertion::getSDevice() {
|
||||
return sDevice;
|
||||
}
|
||||
|
||||
/* 802C7698-802C7788 .text setConfirmMessage__12JUTAssertionFUlPcibPCc */
|
||||
void JUTAssertion::setConfirmMessage(unsigned long, char*, int, bool, const char*) {
|
||||
/* Nonmatching */
|
||||
void JUTAssertion::setConfirmMessage(u32 param_1, char* file, int line, bool param_4, const char* msg) {
|
||||
if (param_4 == 1) {
|
||||
return;
|
||||
}
|
||||
u32 r28 = sMessageLife;
|
||||
if (r28 == 0 && (param_1 & 1) != 0) {
|
||||
sMessageLife = sDisplayTime;
|
||||
sMessageOwner = 2;
|
||||
snprintf(sMessageFileLine, sizeof(sMessageFileLine) - 1, "FAILED [%s:%d]", file, line);
|
||||
snprintf(sMessageString, sizeof(sMessageString) - 1, "%s", msg);
|
||||
}
|
||||
if ((r28 == 0 || mSynchro == 0) && (param_1 & 2) != 0) {
|
||||
JUTWarningConsole_f("FAILED [%s:%d] %s\n", file, line, msg);
|
||||
}
|
||||
}
|
||||
|
||||
/* 802C7788-802C78E4 .text showAssert__12JUTAssertionFUlPCciPCc */
|
||||
void JUTAssertion::showAssert(unsigned long, const char*, int, const char*) {
|
||||
/* Nonmatching */
|
||||
void JUTAssertion::showAssert(u32 device, const char* file, int line, const char* msg) {
|
||||
OSReport("Failed assertion %s in \"%s\" on line %d\n", msg, file, line);
|
||||
if ((device & 1) == 0) {
|
||||
return;
|
||||
}
|
||||
if (!JUTDirectPrint::getManager()) {
|
||||
return;
|
||||
}
|
||||
JUTDirectPrint::getManager()->erase(10, 0x10, 0x132, 0x18);
|
||||
char buffer[0x100];
|
||||
snprintf(buffer, 95, "Failed assertion: %s:%d", file, line);
|
||||
JUTDirectPrint::getManager()->drawString(0x10, 0x10, buffer);
|
||||
snprintf(buffer, 95, "%s", msg);
|
||||
JUTDirectPrint::getManager()->drawString(0x10, 0x18, buffer);
|
||||
VISetNextFrameBuffer(JUTDirectPrint::getManager()->getFrameBuffer());
|
||||
VIWaitForRetrace();
|
||||
VIFlush();
|
||||
// busy loop for 2 seconds
|
||||
OSTime var1 = OSGetTime();
|
||||
while (OSTicksToMilliseconds(OSGetTime() - var1) < 2000) {}
|
||||
}
|
||||
|
||||
/* 802C78E4-802C79FC .text setWarningMessage_f_va */
|
||||
void setWarningMessage_f_va {
|
||||
/* Nonmatching */
|
||||
void setWarningMessage_f_va(u32 device, const char* file, int line, const char* msg, va_list args) {
|
||||
u32 messageLife = JUTAssertion::sMessageLife;
|
||||
bool r26 = false;
|
||||
if (messageLife == 0) {
|
||||
if (device & 1) {
|
||||
JUTAssertion::sMessageLife = JUTAssertion::sDisplayTime;
|
||||
JUTAssertion::sMessageOwner = 3;
|
||||
snprintf(JUTAssertion::sMessageFileLine, sizeof(JUTAssertion::sMessageFileLine) - 1, "WARNING [%s:%d]", file, line);
|
||||
}
|
||||
vsnprintf(JUTAssertion::sMessageString, sizeof(JUTAssertion::sMessageString) - 1, msg, args);
|
||||
r26 = true;
|
||||
}
|
||||
if ((messageLife == 0 || JUTAssertion::mSynchro == 0) && (device & 2)) {
|
||||
JUTWarningConsole_f("WARNING [%s:%d] ", file, line);
|
||||
if (!r26) {
|
||||
JUTWarningConsole_f_va(msg, args);
|
||||
} else {
|
||||
JUTWarningConsole(JUTAssertion::sMessageString);
|
||||
}
|
||||
JUTWarningConsole("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* 802C79FC-802C7A7C .text setWarningMessage_f__12JUTAssertionFUlPciPCce */
|
||||
void JUTAssertion::setWarningMessage_f(unsigned long, char*, int, const char*, ...) {
|
||||
/* Nonmatching */
|
||||
void JUTAssertion::setWarningMessage_f(u32 device, char* file, int line, const char* msg, ...) {
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
setWarningMessage_f_va(device, file, line, msg, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/* 802C7A7C-802C7B94 .text setLogMessage_f_va */
|
||||
void setLogMessage_f_va {
|
||||
/* Nonmatching */
|
||||
void setLogMessage_f_va(u32 device, const char* file, int line, const char* msg, va_list args) {
|
||||
u32 messageLife = JUTAssertion::sMessageLife;
|
||||
bool r26 = false;
|
||||
if (messageLife == 0) {
|
||||
if (device & 1) {
|
||||
JUTAssertion::sMessageLife = JUTAssertion::sDisplayTime;
|
||||
JUTAssertion::sMessageOwner = 4;
|
||||
snprintf(JUTAssertion::sMessageFileLine, sizeof(JUTAssertion::sMessageFileLine) - 1, "[%s:%d]", file, line);
|
||||
}
|
||||
vsnprintf(JUTAssertion::sMessageString, sizeof(JUTAssertion::sMessageString) - 1, msg, args);
|
||||
r26 = true;
|
||||
}
|
||||
if ((messageLife == 0 || JUTAssertion::mSynchro == 0) && (device & 2)) {
|
||||
JUTReportConsole_f("[%s:%d] ", file, line);
|
||||
if (!r26) {
|
||||
JUTReportConsole_f_va(msg, args);
|
||||
} else {
|
||||
JUTReportConsole(JUTAssertion::sMessageString);
|
||||
}
|
||||
JUTReportConsole("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* 802C7B94-802C7C14 .text setLogMessage_f__12JUTAssertionFUlPciPCce */
|
||||
void JUTAssertion::setLogMessage_f(unsigned long, char*, int, const char*, ...) {
|
||||
/* Nonmatching */
|
||||
void JUTAssertion::setLogMessage_f(u32 device, char* file, int line, const char* msg, ...) {
|
||||
va_list args;
|
||||
va_start(args, msg);
|
||||
setLogMessage_f_va(device, file, line, msg, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/* 802C7C14-802C7C1C .text setVisible__12JUTAssertionFb */
|
||||
void JUTAssertion::setVisible(bool) {
|
||||
/* Nonmatching */
|
||||
void JUTAssertion::setVisible(bool visible) {
|
||||
mVisible = visible;
|
||||
}
|
||||
|
||||
/* 802C7C1C-802C7C34 .text setMessageCount__12JUTAssertionFi */
|
||||
void JUTAssertion::setMessageCount(int) {
|
||||
/* Nonmatching */
|
||||
void JUTAssertion::setMessageCount(int msg_count) {
|
||||
sMessageLife = msg_count <= 0 ? 0 : msg_count;
|
||||
}
|
||||
|
||||
@@ -4,100 +4,376 @@
|
||||
//
|
||||
|
||||
#include "JSystem/JUtility/JUTConsole.h"
|
||||
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTDirectPrint.h"
|
||||
#include "JSystem/JUtility/JUTVideo.h"
|
||||
#include "MSL_C/stdio.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
JUTConsoleManager* JUTConsoleManager::sManager;
|
||||
|
||||
/* 802CA2FC-802CA3CC .text create__10JUTConsoleFUiUiP7JKRHeap */
|
||||
void JUTConsole::create(unsigned int, unsigned int, JKRHeap*) {
|
||||
/* Nonmatching */
|
||||
JUTConsole* JUTConsole::create(unsigned int param_0, unsigned int maxLines, JKRHeap* p_heap) {
|
||||
JUTConsoleManager* pManager = JUTConsoleManager::getManager();
|
||||
JUT_ASSERT(33, pManager != 0);
|
||||
|
||||
void* buffer = JKRAllocFromHeap(p_heap, getObjectSizeFromBufferSize(param_0, maxLines), 0);
|
||||
u8* tmpBuf = (u8*)buffer;
|
||||
|
||||
JUTConsole* newConsole = new (tmpBuf) JUTConsole(param_0, maxLines, true);
|
||||
newConsole->mBuf = tmpBuf + sizeof(JUTConsole);
|
||||
newConsole->clear();
|
||||
|
||||
pManager->appendConsole(newConsole);
|
||||
return newConsole;
|
||||
}
|
||||
|
||||
/* 802CA3CC-802CA4C8 .text create__10JUTConsoleFUiPvUl */
|
||||
void JUTConsole::create(unsigned int, void*, unsigned long) {
|
||||
/* Nonmatching */
|
||||
JUTConsole* JUTConsole::create(unsigned int param_0, void* buffer, u32 bufferSize) {
|
||||
JUTConsoleManager* pManager = JUTConsoleManager::getManager();
|
||||
JUT_ASSERT(59, pManager != 0);
|
||||
JUT_ASSERT(62, ( (u32)buffer & 0x3 ) == 0);
|
||||
u32 maxLines = getLineFromObjectSize(bufferSize, param_0);
|
||||
|
||||
JUTConsole* newConsole = new (buffer) JUTConsole(param_0, maxLines, false);
|
||||
newConsole->mBuf = (u8*)buffer + sizeof(JUTConsole);
|
||||
newConsole->clear();
|
||||
|
||||
pManager->appendConsole(newConsole);
|
||||
return newConsole;
|
||||
}
|
||||
|
||||
/* 802CA4C8-802CA5AC .text __ct__10JUTConsoleFUiUib */
|
||||
JUTConsole::JUTConsole(unsigned int, unsigned int, bool) {
|
||||
/* Nonmatching */
|
||||
JUTConsole::JUTConsole(unsigned int param_0, unsigned int maxLines, bool param_2) {
|
||||
field_0x2c = param_2;
|
||||
field_0x20 = param_0;
|
||||
mMaxLines = maxLines;
|
||||
|
||||
mPositionX = 30;
|
||||
mPositionY = 50;
|
||||
mHeight = 20;
|
||||
|
||||
if (mHeight > mMaxLines) {
|
||||
mHeight = mMaxLines;
|
||||
}
|
||||
|
||||
mFont = NULL;
|
||||
mVisible = true;
|
||||
field_0x65 = false;
|
||||
field_0x66 = false;
|
||||
mOutput = 1;
|
||||
|
||||
field_0x5c.set(0, 0, 0, 100);
|
||||
field_0x60.set(0, 0, 0, 230);
|
||||
}
|
||||
|
||||
static void dummy1() {
|
||||
OSReport("console != 0");
|
||||
}
|
||||
|
||||
/* 802CA5AC-802CA658 .text __dt__10JUTConsoleFv */
|
||||
JUTConsole::~JUTConsole() {
|
||||
/* Nonmatching */
|
||||
JUT_ASSERT(150, JUTConsoleManager::getManager());
|
||||
JUTConsoleManager::getManager()->removeConsole(this);
|
||||
}
|
||||
|
||||
/* 802CA658-802CA668 .text getObjectSizeFromBufferSize__10JUTConsoleFUiUi */
|
||||
void JUTConsole::getObjectSizeFromBufferSize(unsigned int, unsigned int) {
|
||||
/* Nonmatching */
|
||||
size_t JUTConsole::getObjectSizeFromBufferSize(unsigned int param_0, unsigned int maxLines) {
|
||||
return (param_0 + 2) * maxLines + sizeof(JUTConsole);
|
||||
}
|
||||
|
||||
/* 802CA668-802CA678 .text getLineFromObjectSize__10JUTConsoleFUlUi */
|
||||
void JUTConsole::getLineFromObjectSize(unsigned long, unsigned int) {
|
||||
/* Nonmatching */
|
||||
size_t JUTConsole::getLineFromObjectSize(u32 bufferSize, unsigned int param_1) {
|
||||
return (bufferSize - sizeof(JUTConsole)) / (param_1 + 2);
|
||||
}
|
||||
|
||||
/* 802CA678-802CA6D4 .text clear__10JUTConsoleFv */
|
||||
void JUTConsole::clear() {
|
||||
/* Nonmatching */
|
||||
field_0x30 = 0;
|
||||
field_0x34 = 0;
|
||||
field_0x38 = 0;
|
||||
field_0x3c = 0;
|
||||
|
||||
for (u32 i = 0; i < mMaxLines; i++) {
|
||||
setLineAttr(i, 0);
|
||||
}
|
||||
setLineAttr(0, -1);
|
||||
*getLinePtr(0) = 0;
|
||||
}
|
||||
|
||||
/* 802CA6D4-802CAC1C .text doDraw__10JUTConsoleCFQ210JUTConsole12EConsoleType */
|
||||
void JUTConsole::doDraw(JUTConsole::EConsoleType) const {
|
||||
void JUTConsole::doDraw(JUTConsole::EConsoleType consoleType) const {
|
||||
/* Nonmatching */
|
||||
f32 font_yOffset;
|
||||
s32 changeLine_1;
|
||||
s32 changeLine_2;
|
||||
|
||||
if (mVisible && (mFont != NULL || consoleType == CONSOLE_TYPE_2)) {
|
||||
if (mHeight != 0) {
|
||||
bool temp_r30 = consoleType == CONSOLE_TYPE_0;
|
||||
font_yOffset = 2.0f + mFontSizeY;
|
||||
|
||||
if (consoleType != CONSOLE_TYPE_2) {
|
||||
if (JUTVideo::getManager() == NULL) {
|
||||
J2DOrthoGraph ortho(0.0f, 0.0f, 640.0f, 480.0f, -1.0f, 1.0f);
|
||||
ortho.setPort();
|
||||
} else {
|
||||
J2DOrthoGraph ortho(0.0f, 0.0f, JUTVideo::getManager()->getFbWidth(),
|
||||
JUTVideo::getManager()->getEfbHeight(), -1.0f, 1.0f);
|
||||
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);
|
||||
mFont->setGX();
|
||||
|
||||
if (temp_r30) {
|
||||
s32 s = (diffIndex(field_0x30, field_0x38) - mHeight) + 1;
|
||||
if (s <= 0) {
|
||||
mFont->setCharColor(JUtility::TColor(255, 255, 255, 255));
|
||||
} else if (field_0x30 == field_0x34) {
|
||||
mFont->setCharColor(JUtility::TColor(255, 230, 230, 255));
|
||||
} else {
|
||||
mFont->setCharColor(JUtility::TColor(230, 230, 255, 255));
|
||||
}
|
||||
} else {
|
||||
mFont->setCharColor(JUtility::TColor(230, 230, 230, 255));
|
||||
}
|
||||
} else {
|
||||
JUTDirectPrint::getManager()->erase(mPositionX - 3, mPositionY - 2,
|
||||
(field_0x20 * 6) + 6,
|
||||
(int)(font_yOffset * mHeight) + 4);
|
||||
}
|
||||
|
||||
char* linePtr;
|
||||
s32 curLine = field_0x30;
|
||||
s32 yFactor = 0;
|
||||
|
||||
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 {
|
||||
break;
|
||||
}
|
||||
} while (yFactor < mHeight && changeLine_2 != field_0x34);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 802CAC1C-802CAC9C .text print_f__10JUTConsoleFPCce */
|
||||
void JUTConsole::print_f(const char*, ...) {
|
||||
/* Nonmatching */
|
||||
void JUTConsole::print_f(const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
JUTConsole_print_f_va_(this, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/* 802CAC9C-802CAFB0 .text print__10JUTConsoleFPCc */
|
||||
void JUTConsole::print(const char*) {
|
||||
/* Nonmatching */
|
||||
void JUTConsole::print(const char* param_0) {
|
||||
if (mOutput & 2) {
|
||||
OSReport("%s", param_0);
|
||||
}
|
||||
if (mOutput & 1) {
|
||||
const u8* r29 = (const u8*)param_0;
|
||||
u8* r28 = getLinePtr(field_0x38) + field_0x3c;
|
||||
while (*r29) {
|
||||
if (field_0x66 && field_0x34 == nextIndex(field_0x38)) {
|
||||
break;
|
||||
}
|
||||
if (*r29 == '\n') {
|
||||
r29++;
|
||||
field_0x3c = field_0x20;
|
||||
} else if (*r29 == '\t') {
|
||||
r29++;
|
||||
while (field_0x3c < field_0x20) {
|
||||
*(r28++) = ' ';
|
||||
field_0x3c++;
|
||||
if (field_0x3c % 8 == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (mFont && mFont->isLeadByte(*r29)) {
|
||||
if (field_0x3c + 1 < field_0x20) {
|
||||
*(r28++) = *(r29++);
|
||||
*(r28++) = *(r29++);
|
||||
field_0x3c++;
|
||||
field_0x3c++;
|
||||
} else {
|
||||
*(r28++) = 0;
|
||||
field_0x3c++;
|
||||
}
|
||||
} else {
|
||||
*(r28++) = *(r29++);
|
||||
field_0x3c++;
|
||||
}
|
||||
|
||||
if (field_0x3c < field_0x20) {
|
||||
continue;
|
||||
}
|
||||
*r28 = 0;
|
||||
field_0x38 = nextIndex(field_0x38);
|
||||
field_0x3c = 0;
|
||||
setLineAttr(field_0x38, 0xff);
|
||||
r28 = getLinePtr(field_0x38);
|
||||
*r28 = 0;
|
||||
int local_28 = diffIndex(field_0x30, field_0x38);
|
||||
if (local_28 == mHeight) {
|
||||
field_0x30 = nextIndex(field_0x30);
|
||||
}
|
||||
if (field_0x38 == field_0x34) {
|
||||
field_0x34 = nextIndex(field_0x34);
|
||||
}
|
||||
if (field_0x38 == field_0x30) {
|
||||
field_0x30 = nextIndex(field_0x30);
|
||||
}
|
||||
}
|
||||
*r28 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* 802CAFB0-802CB03C .text JUTConsole_print_f_va_ */
|
||||
void JUTConsole_print_f_va_ {
|
||||
/* Nonmatching */
|
||||
void JUTConsole_print_f_va_(JUTConsole* console, const char* fmt, va_list args) {
|
||||
JUT_ASSERT(561, console!=0);
|
||||
char buf[1024];
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
console->print(buf);
|
||||
}
|
||||
|
||||
/* 802CB03C-802CB19C .text dumpToTerminal__10JUTConsoleFUi */
|
||||
void JUTConsole::dumpToTerminal(unsigned int) {
|
||||
void JUTConsole::dumpToTerminal(unsigned int param_0) {
|
||||
/* Nonmatching */
|
||||
if (param_0 == 0) {
|
||||
return;
|
||||
}
|
||||
u32 r29 = field_0x34;
|
||||
if (param_0 != -1) {
|
||||
r29 = field_0x38;
|
||||
for (int i = 0; i != param_0; i++) {
|
||||
int r25 = prevIndex(r29);
|
||||
if (getLineAttr(r25) == 0) {
|
||||
break;
|
||||
}
|
||||
r29 = r25;
|
||||
if (r25 == field_0x34) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int r27 = 0;
|
||||
OSReport("\n:::dump of console[%x]--------------------------------\n",this);
|
||||
do {
|
||||
u8* r28 = getLinePtr(r29);
|
||||
u8 r24 = r28[-1];
|
||||
if (r24 == 0) {
|
||||
break;
|
||||
}
|
||||
if (field_0x65) {
|
||||
OSReport("[%03d] %s\n", r27, r28);
|
||||
} else {
|
||||
OSReport("%s\n", r28);
|
||||
}
|
||||
r29 = nextIndex(r29);
|
||||
r27++;
|
||||
} while (r27 != field_0x34);
|
||||
OSReport(":::dump of console[%x] END----------------------------\n",this);
|
||||
}
|
||||
|
||||
/* 802CB19C-802CB278 .text scroll__10JUTConsoleFi */
|
||||
void JUTConsole::scroll(int) {
|
||||
/* Nonmatching */
|
||||
void JUTConsole::scroll(int scrollAmnt) {
|
||||
if (scrollAmnt < 0) {
|
||||
int diff = diffIndex(field_0x34, field_0x30);
|
||||
if (scrollAmnt < -diff) {
|
||||
scrollAmnt = -diff;
|
||||
}
|
||||
} else {
|
||||
if (scrollAmnt > 0) {
|
||||
int diff = diffIndex(field_0x34, field_0x38);
|
||||
if (diff + 1 <= mHeight) {
|
||||
scrollAmnt = 0;
|
||||
} else {
|
||||
diff = diffIndex(field_0x30, field_0x38);
|
||||
if (scrollAmnt > (int)(diff - mHeight) + 1) {
|
||||
scrollAmnt = (int)(diff - mHeight) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
field_0x30 += scrollAmnt;
|
||||
if (field_0x30 < 0) {
|
||||
field_0x30 += mMaxLines;
|
||||
}
|
||||
|
||||
if (field_0x30 >= mMaxLines) {
|
||||
field_0x30 -= mMaxLines;
|
||||
}
|
||||
}
|
||||
|
||||
/* 802CB278-802CB29C .text getUsedLine__10JUTConsoleCFv */
|
||||
void JUTConsole::getUsedLine() const {
|
||||
/* Nonmatching */
|
||||
int JUTConsole::getUsedLine() const {
|
||||
return diffIndex(field_0x34, field_0x38);
|
||||
}
|
||||
|
||||
/* 802CB29C-802CB2C0 .text getLineOffset__10JUTConsoleCFv */
|
||||
void JUTConsole::getLineOffset() const {
|
||||
/* Nonmatching */
|
||||
int JUTConsole::getLineOffset() const {
|
||||
return diffIndex(field_0x34, field_0x30);
|
||||
}
|
||||
|
||||
/* 802CB2C0-802CB2E8 .text __ct__17JUTConsoleManagerFv */
|
||||
JUTConsoleManager::JUTConsoleManager() {
|
||||
/* Nonmatching */
|
||||
mActiveConsole = NULL;
|
||||
mDirectConsole = NULL;
|
||||
}
|
||||
|
||||
static void dummy2() {
|
||||
OSReport("console != this && console != 0");
|
||||
OSReport("\n:::dump of console[%x]----------------\n");
|
||||
OSReport(":::dump of console[%x] END------------\n");
|
||||
}
|
||||
|
||||
/* 802CB2E8-802CB380 .text createManager__17JUTConsoleManagerFP7JKRHeap */
|
||||
void JUTConsoleManager::createManager(JKRHeap*) {
|
||||
/* Nonmatching */
|
||||
JUTConsoleManager* JUTConsoleManager::createManager(JKRHeap* pHeap) {
|
||||
JUT_ASSERT(922, sManager == 0);
|
||||
if (pHeap == NULL) {
|
||||
pHeap = JKRHeap::sCurrentHeap;
|
||||
}
|
||||
|
||||
JUTConsoleManager* manager = new (pHeap, 0) JUTConsoleManager();
|
||||
sManager = manager;
|
||||
return manager;
|
||||
}
|
||||
|
||||
/* 802CB380-802CB4C4 .text appendConsole__17JUTConsoleManagerFP10JUTConsole */
|
||||
void JUTConsoleManager::appendConsole(JUTConsole*) {
|
||||
void JUTConsoleManager::appendConsole(JUTConsole* console) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802CB4C4-802CB674 .text removeConsole__17JUTConsoleManagerFP10JUTConsole */
|
||||
void JUTConsoleManager::removeConsole(JUTConsole*) {
|
||||
void JUTConsoleManager::removeConsole(JUTConsole* console) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
@@ -107,61 +383,105 @@ void JUTConsoleManager::draw() const {
|
||||
}
|
||||
|
||||
/* 802CB740-802CB7B4 .text drawDirect__17JUTConsoleManagerCFb */
|
||||
void JUTConsoleManager::drawDirect(bool) const {
|
||||
/* Nonmatching */
|
||||
void JUTConsoleManager::drawDirect(bool waitRetrace) const {
|
||||
if (mDirectConsole != NULL) {
|
||||
if (waitRetrace) {
|
||||
s32 interrupt_status = OSEnableInterrupts();
|
||||
u32 retrace_count = VIGetRetraceCount();
|
||||
u32 new_count;
|
||||
do {
|
||||
new_count = VIGetRetraceCount();
|
||||
} while (retrace_count == new_count);
|
||||
OSRestoreInterrupts(interrupt_status);
|
||||
}
|
||||
mDirectConsole->doDraw(JUTConsole::CONSOLE_TYPE_2);
|
||||
}
|
||||
}
|
||||
|
||||
/* 802CB7B4-802CB810 .text setDirectConsole__17JUTConsoleManagerFP10JUTConsole */
|
||||
void JUTConsoleManager::setDirectConsole(JUTConsole*) {
|
||||
/* Nonmatching */
|
||||
void JUTConsoleManager::setDirectConsole(JUTConsole* p_console) {
|
||||
if (mDirectConsole != NULL) {
|
||||
appendConsole(mDirectConsole);
|
||||
}
|
||||
|
||||
if (p_console != NULL) {
|
||||
removeConsole(p_console);
|
||||
}
|
||||
mDirectConsole = p_console;
|
||||
}
|
||||
|
||||
static JUTConsole* sReportConsole;
|
||||
|
||||
/* 802CB810-802CB818 .text JUTSetReportConsole */
|
||||
void JUTSetReportConsole {
|
||||
/* Nonmatching */
|
||||
void JUTSetReportConsole(JUTConsole* p_console) {
|
||||
sReportConsole = p_console;
|
||||
}
|
||||
|
||||
/* 802CB818-802CB820 .text JUTGetReportConsole */
|
||||
void JUTGetReportConsole {
|
||||
/* Nonmatching */
|
||||
JUTConsole* JUTGetReportConsole() {
|
||||
return sReportConsole;
|
||||
}
|
||||
|
||||
static JUTConsole* sWarningConsole;
|
||||
|
||||
/* 802CB820-802CB828 .text JUTSetWarningConsole */
|
||||
void JUTSetWarningConsole {
|
||||
/* Nonmatching */
|
||||
void JUTSetWarningConsole(JUTConsole* p_console) {
|
||||
sWarningConsole = p_console;
|
||||
}
|
||||
|
||||
/* 802CB828-802CB830 .text JUTGetWarningConsole */
|
||||
void JUTGetWarningConsole {
|
||||
/* Nonmatching */
|
||||
JUTConsole* JUTGetWarningConsole() {
|
||||
return sWarningConsole;
|
||||
}
|
||||
|
||||
/* 802CB830-802CB8D0 .text JUTReportConsole_f_va */
|
||||
void JUTReportConsole_f_va {
|
||||
/* Nonmatching */
|
||||
void JUTReportConsole_f_va(const char* fmt, va_list args) {
|
||||
char buf[256];
|
||||
|
||||
if (JUTGetReportConsole() == NULL) {
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
OSReport("%s", buf);
|
||||
} else if (JUTGetReportConsole()->getOutput() & (JUTConsole::OUTPUT_CONSOLE | JUTConsole::OUTPUT_OSREPORT)) {
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
JUTGetReportConsole()->print(buf);
|
||||
}
|
||||
}
|
||||
|
||||
/* 802CB8D0-802CB950 .text JUTReportConsole_f */
|
||||
void JUTReportConsole_f {
|
||||
/* Nonmatching */
|
||||
void JUTReportConsole_f(const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
JUTReportConsole_f_va(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/* 802CB950-802CB984 .text JUTReportConsole */
|
||||
void JUTReportConsole {
|
||||
/* Nonmatching */
|
||||
void JUTReportConsole(const char* message) {
|
||||
JUTReportConsole_f("%s", message);
|
||||
}
|
||||
|
||||
/* 802CB984-802CBA24 .text JUTWarningConsole_f_va */
|
||||
void JUTWarningConsole_f_va {
|
||||
/* Nonmatching */
|
||||
void JUTWarningConsole_f_va(const char* fmt, va_list args) {
|
||||
char buf[256];
|
||||
|
||||
if (JUTGetWarningConsole() == NULL) {
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
OSReport("%s", buf);
|
||||
} else if (JUTGetWarningConsole()->getOutput() & (JUTConsole::OUTPUT_CONSOLE | JUTConsole::OUTPUT_OSREPORT)) {
|
||||
vsnprintf(buf, sizeof(buf), fmt, args);
|
||||
JUTGetWarningConsole()->print(buf);
|
||||
}
|
||||
}
|
||||
|
||||
/* 802CBA24-802CBAA4 .text JUTWarningConsole_f */
|
||||
void JUTWarningConsole_f {
|
||||
/* Nonmatching */
|
||||
void JUTWarningConsole_f(const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
JUTReportConsole_f_va(fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/* 802CBAA4-802CBAD8 .text JUTWarningConsole */
|
||||
void JUTWarningConsole {
|
||||
/* Nonmatching */
|
||||
void JUTWarningConsole(const char* message) {
|
||||
JUTReportConsole_f("%s", message);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user