Files
tp/libs/JSystem/JUtility/JUTAssert.cpp
T

86 lines
2.6 KiB
C++
Raw Normal View History

2021-04-01 02:07:58 +02:00
//
2021-03-28 22:49:05 +02:00
// Generated By: dol2asm
// Translation Unit: JUTAssert
2021-04-01 02:07:58 +02:00
//
2021-03-28 22:49:05 +02:00
2021-04-01 02:07:58 +02:00
#include "JSystem/JUtility/JUTAssert.h"
2022-01-10 04:07:06 -08:00
#include "JSystem/JUtility/JUTDbPrint.h"
#include "JSystem/JUtility/JUTDirectPrint.h"
#include "dolphin/vi/vi.h"
2021-03-28 22:49:05 +02:00
2023-02-26 22:18:40 -08:00
namespace JUTAssertion {
2021-03-28 22:49:05 +02:00
2021-04-06 18:00:35 +02:00
/* 802E495C-802E4960 2DF29C 0004+00 0/0 1/1 0/0 .text create__12JUTAssertionFv */
2023-02-26 22:18:40 -08:00
void create() {}
2021-03-28 22:49:05 +02:00
2023-02-26 22:18:40 -08:00
namespace {
2021-04-06 18:00:35 +02:00
/* 80451530-80451538 000A30 0004+04 2/2 0/0 0/0 .sbss
2021-04-01 02:07:58 +02:00
* sMessageLife__Q212JUTAssertion23@unnamed@JUTAssert_cpp@ */
2022-01-10 04:07:06 -08:00
static u32 sMessageLife;
2021-03-28 22:49:05 +02:00
2023-02-26 22:18:40 -08:00
/* 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
2021-04-06 18:00:35 +02:00
/* 802E4960-802E499C 2DF2A0 003C+00 2/2 0/0 0/0 .text flush_subroutine__12JUTAssertionFv
*/
2023-02-26 22:18:40 -08:00
u32 flush_subroutine() {
2022-01-10 04:07:06 -08:00
if (sMessageLife == 0) {
return 0;
}
if (sMessageLife != -1) {
sMessageLife--;
}
if (sMessageLife >= 5) {
return sMessageLife;
}
2023-02-26 22:18:40 -08:00
2022-01-10 04:07:06 -08:00
return 0;
2021-03-28 22:49:05 +02:00
}
2021-04-06 18:00:35 +02:00
/* 802E499C-802E4A54 2DF2DC 00B8+00 0/0 1/1 0/0 .text flushMessage__12JUTAssertionFv */
2023-02-26 22:18:40 -08:00
void flushMessage() {
2022-01-10 04:07:06 -08:00
if (flush_subroutine() && sAssertVisible == true) {
JUTDirectPrint* manager = JUTDirectPrint::getManager();
JUtility::TColor color = manager->getCharColor();
manager->setCharColor(JUtility::TColor(255, 200, 200, 255));
manager->drawString(16, 16, sMessageFileLine);
manager->drawString(16, 24, sMessageString);
manager->setCharColor(color);
}
2021-03-28 22:49:05 +02:00
}
2021-04-06 18:00:35 +02:00
/* 802E4A54-802E4C34 2DF394 01E0+00 0/0 1/1 0/0 .text flushMessage_dbPrint__12JUTAssertionFv */
2023-02-26 22:18:40 -08:00
void flushMessage_dbPrint() {
2022-01-10 04:07:06 -08:00
if (flush_subroutine() && sAssertVisible == 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);
}
}
2021-03-28 22:49:05 +02:00
}
2021-04-06 18:00:35 +02:00
/* 802E4C34-802E4C3C 2DF574 0008+00 0/0 2/2 0/0 .text setVisible__12JUTAssertionFb */
2023-02-26 22:18:40 -08:00
void setVisible(bool visible) {
2022-01-10 04:07:06 -08:00
sAssertVisible = visible;
2021-03-28 22:49:05 +02:00
}
2021-04-06 18:00:35 +02:00
/* 802E4C3C-802E4C54 2DF57C 0018+00 0/0 2/2 0/0 .text setMessageCount__12JUTAssertionFi
*/
2023-02-26 22:18:40 -08:00
void setMessageCount(int msg_count) {
2022-01-10 04:07:06 -08:00
sMessageLife = msg_count <= 0 ? 0 : msg_count;
2021-03-28 22:49:05 +02:00
}
2023-02-26 22:18:40 -08:00
}; // namespace JUTAssertion