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
+20 -23
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
+87 -42
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 */
+5 -2
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);
}
+6 -2
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;
}
-1
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"
//
+6 -7
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 */
@@ -5,7 +5,6 @@
#include "JSystem/JUtility/JUTFontData_Ascfont_fix12.h"
#include "dol2asm.h"
#include "dolphin/types.h"
//
// Forward References:
+4 -2
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 {
-6
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;
-2
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);
+25 -22
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;
+141 -177
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 */
+2 -25
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() {}
+2 -3
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