mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-03 10:01:08 -04:00
767ba3bb14
* launch.json cwd * bodge to load gci for testing * stub card stat * gameplay bodges * viewport, ub fixes * add release with debug info cmake variant * be fixes, sound stub * viewport h * d_msg_flow BE * be fopAcM_createItemFromEnemyID * update launch configuration to use iso * more audio stubs * Attempt to set viewport and get messages for brightness check * skip opening scene again, fixed JMessage::TResourceContainer::TCResource::Do_destroy * add guards for viewport changes * moar endian swapping to get Link sitting in PROC_OPENING_SCENE and for dialogues * BE d_msg_class i_data * stub bgm start * fix div by 0 error (for now) * TEMP_BROKEN in d_menu_ring * REQUIRES_GX_LINES * properly stub renderingAmap::draw with REQUIRES_GX_LINES * better stubbing outside of stubs * fix event data getting swapped multiple times * evil draw vp fix * Stub log imgui This redirects all spammy logs to an imgui window that is cleared per frame. This fixes the serious performance dip of the logging, and makes the regular log readable. * Oops move those optimization changes I accidentally committed behind a flag DUSK_SELECTED_OPT * gx_line macro in map * fix audio stubbing * switch to CARD API aurora impl * remove kabufuda from link libs * refactor imgui stuff and add input viewer * merge stub log with refactor * accidentally committed a metaforce header shh * basic map loader * ImGuiConsole: Add missing <thread> include * you may now play as luigi (you may now load stages with bridges) * bloom fix * bloom leak fix * cloud shadow fix * add soft reset button to imgui menu * if it broke dont not fix it * i swear i committed this * BE swap indMtx in JPAResource::setPTev * wnark ct fix * frsqrte implementation from kinoko * Fix Clang compile error in JAISeq::prepare_getSeqData_ * Add endian conversions to dMsgFlow_c::getInitNodeIndex This fixes a freeze when Fado tries to stop you from leaving the starting area. * Add RAII GXTexObj wrapper; fix almost all leaks * Update aurora for indirect texturing * Update aurora for CARD fix * Fix Clang build * More d_msg_flow endian fixes Fixes softlock when trying to talk to Fado and possibly other NPCs. * no frame limiter * get pause menu working * proper frame limiting * particle pointer size fix * improve map loader a bit --------- Co-authored-by: Jasper St. Pierre <jstpierre@mecheye.net> Co-authored-by: TakaRikka <takarikka@outlook.com> Co-authored-by: CraftyBoss <talibabdulmaalik@gmail.com> Co-authored-by: Luke Street <luke@street.dev> Co-authored-by: Lurs <2795933+Lurs@users.noreply.github.com> Co-authored-by: PJB3005 <pieterjan.briers+git@gmail.com> Co-authored-by: tgsm <doodrabbit@hotmail.com> Co-authored-by: Max Roncace <me@caseif.net> Co-authored-by: Phillip Stephens <antidote.crk@gmail.com>
454 lines
14 KiB
C++
454 lines
14 KiB
C++
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
|
|
|
#include "JSystem/JUtility/JUTResFont.h"
|
|
#include "JSystem/JKernel/JKRHeap.h"
|
|
#include "JSystem/JSupport/JSupport.h"
|
|
#include "JSystem/JUtility/JUTAssert.h"
|
|
#include "JSystem/JUtility/JUTConsole.h"
|
|
#include <gx.h>
|
|
|
|
JUTResFont::JUTResFont() {
|
|
initialize_state();
|
|
JUTFont::initialize_state();
|
|
}
|
|
|
|
JUTResFont::JUTResFont(const ResFONT* pFont, JKRHeap* pHeap) {
|
|
initialize_state();
|
|
JUTFont::initialize_state();
|
|
initiate(pFont, pHeap);
|
|
}
|
|
|
|
JUTResFont::~JUTResFont() {
|
|
if (mValid) {
|
|
delete_and_initialize();
|
|
JUTFont::initialize_state();
|
|
}
|
|
}
|
|
|
|
void JUTResFont::deleteMemBlocks_ResFont() {
|
|
JKR_DELETE_ARRAY(mMemBlocks);
|
|
}
|
|
|
|
void JUTResFont::initialize_state() {
|
|
mResFont = NULL;
|
|
mMemBlocks = NULL;
|
|
mpWidthBlocks = NULL;
|
|
mpGlyphBlocks = NULL;
|
|
mpMapBlocks = NULL;
|
|
mWidth = 0;
|
|
mHeight = 0;
|
|
mTexPageIdx = -1;
|
|
}
|
|
|
|
bool JUTResFont::initiate(const ResFONT* pFont, JKRHeap* pHeap) {
|
|
if (!protected_initiate(pFont, pHeap)) {
|
|
delete_and_initialize();
|
|
JUTFont::initialize_state();
|
|
mValid = false;
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool JUTResFont::protected_initiate(const ResFONT* pFont, JKRHeap* pHeap) {
|
|
void** p;
|
|
delete_and_initialize();
|
|
JUTFont::initialize_state();
|
|
|
|
if (!pFont) {
|
|
return false;
|
|
}
|
|
mResFont = pFont;
|
|
mValid = true;
|
|
|
|
countBlock();
|
|
mMemBlocks = JKR_NEW_ARRAY_ARGS(void*, mWid1BlockNum + mGly1BlockNum + mMap1BlockNum, pHeap, 0);
|
|
|
|
if (!mMemBlocks) {
|
|
return false;
|
|
}
|
|
p = mMemBlocks;
|
|
if (mWid1BlockNum != 0) {
|
|
mpWidthBlocks = JKR_NEW_ARRAY_ARGS(ResFONT::WID1*, mWid1BlockNum, p);
|
|
p += mWid1BlockNum;
|
|
}
|
|
if (mGly1BlockNum != 0) {
|
|
mpGlyphBlocks = JKR_NEW_ARRAY_ARGS(ResFONT::GLY1*, mGly1BlockNum, p);
|
|
p += mGly1BlockNum;
|
|
}
|
|
if (mMap1BlockNum != 0) {
|
|
mpMapBlocks = JKR_NEW_ARRAY_ARGS(ResFONT::MAP1*, mMap1BlockNum, p);
|
|
}
|
|
setBlock();
|
|
return true;
|
|
|
|
}
|
|
|
|
void JUTResFont::countBlock() {
|
|
mWid1BlockNum = 0;
|
|
mGly1BlockNum = 0;
|
|
mMap1BlockNum = 0;
|
|
|
|
u8* pData = (u8*)&mResFont->data;
|
|
for (u32 i = 0; i < mResFont->numBlocks; i++) {
|
|
switch (((BlockHeader*)pData)->magic) {
|
|
case 'WID1':
|
|
mWid1BlockNum++;
|
|
break;
|
|
case 'GLY1':
|
|
mGly1BlockNum++;
|
|
break;
|
|
case 'MAP1':
|
|
mMap1BlockNum++;
|
|
break;
|
|
case 'INF1':
|
|
break;
|
|
default:
|
|
JUTReportConsole("JUTResFont: Unknown data block\n");
|
|
}
|
|
pData += ((BlockHeader*)pData)->size;
|
|
}
|
|
}
|
|
|
|
IsLeadByte_func const JUTResFont::saoAboutEncoding_[3] = {
|
|
JUTFont::isLeadByte_1Byte,
|
|
JUTFont::isLeadByte_2Byte,
|
|
JUTFont::isLeadByte_ShiftJIS,
|
|
};
|
|
|
|
void JUTResFont::setBlock() {
|
|
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; i++) {
|
|
switch (data->magic) {
|
|
case 'INF1': {
|
|
mInf1Ptr = (ResFONT::INF1*)data;
|
|
u = mInf1Ptr->fontType;
|
|
JUT_ASSERT(244, u < suAboutEncoding_);
|
|
mIsLeadByte = &saoAboutEncoding_[u];
|
|
break;
|
|
}
|
|
|
|
case 'WID1':
|
|
mpWidthBlocks[widthNum] = (ResFONT::WID1*)data;
|
|
widthNum++;
|
|
break;
|
|
|
|
case 'GLY1':
|
|
mpGlyphBlocks[glyphNum] = (ResFONT::GLY1*)data;
|
|
glyphNum++;
|
|
break;
|
|
|
|
case 'MAP1':
|
|
mpMapBlocks[mapNum] = (ResFONT::MAP1*)data;
|
|
if (mMaxCode > mpMapBlocks[mapNum]->startCode) {
|
|
mMaxCode = mpMapBlocks[mapNum]->startCode;
|
|
}
|
|
mapNum++;
|
|
break;
|
|
|
|
default:
|
|
JUTReportConsole("Unknown data block\n");
|
|
break;
|
|
}
|
|
data = (BlockHeader*)(((Ptr)data) + data->size);
|
|
}
|
|
}
|
|
|
|
void JUTResFont::setGX() {
|
|
GXSetNumChans(1);
|
|
GXSetNumTevStages(1);
|
|
GXSetNumTexGens(1);
|
|
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
|
GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE,
|
|
GX_AF_NONE);
|
|
GXSetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
|
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET);
|
|
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
|
|
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
|
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 15);
|
|
GXClearVtxDesc();
|
|
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
|
GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
|
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
|
}
|
|
|
|
void JUTResFont::setGX(JUtility::TColor col1, JUtility::TColor col2) {
|
|
if (col1 == 0 && col2 == -1) {
|
|
setGX();
|
|
} else {
|
|
GXSetNumChans(1);
|
|
GXSetNumTevStages(2);
|
|
GXSetNumTexGens(1);
|
|
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL);
|
|
GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE,
|
|
GX_AF_NONE);
|
|
GXSetTevColor(GX_TEVREG0, col1);
|
|
GXSetTevColor(GX_TEVREG1, col2);
|
|
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C0, GX_CC_C1, GX_CC_TEXC, GX_CC_ZERO);
|
|
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_A0, GX_CA_A1, GX_CA_TEXA, GX_CA_ZERO);
|
|
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
|
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
|
GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
|
GXSetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_CPREV, GX_CC_RASC, GX_CC_ZERO);
|
|
GXSetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_APREV, GX_CA_RASA, GX_CA_ZERO);
|
|
GXSetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
|
GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
|
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET);
|
|
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
|
|
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
|
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 15);
|
|
GXClearVtxDesc();
|
|
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
|
GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
|
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
|
}
|
|
}
|
|
|
|
f32 JUTResFont::drawChar_scale(f32 pos_x, f32 pos_y, f32 scale_x, f32 scale_y, int str_int,
|
|
bool flag) {
|
|
f32 x1;
|
|
f32 x2;
|
|
f32 y1;
|
|
|
|
JUT_ASSERT(378, mValid);
|
|
JUTFont::TWidth width;
|
|
loadFont(str_int, GX_TEXMAP0, &width);
|
|
|
|
if ((mFixed) || (!flag)) {
|
|
x1 = pos_x;
|
|
} else {
|
|
x1 = (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());
|
|
}
|
|
}
|
|
x2 = x1 + scale_x;
|
|
y1 = pos_y - getAscent() * (scale_y / getHeight());
|
|
f32 y2 = getDescent() * (scale_y / getHeight()) + pos_y;
|
|
|
|
u16 texW = mpGlyphBlocks[field_0x66]->textureWidth;
|
|
u16 texH = mpGlyphBlocks[field_0x66]->textureHeight;
|
|
u16 cellW = mpGlyphBlocks[field_0x66]->cellWidth;
|
|
u16 cellH = mpGlyphBlocks[field_0x66]->cellHeight;
|
|
s32 u1 = (mWidth * 0x8000) / texW;
|
|
s32 v1 = (mHeight * 0x8000) / texH;
|
|
s32 u2 = ((mWidth + cellW) * 0x8000) / texW;
|
|
s32 v2 = ((mHeight + cellH) * 0x8000) / texH;
|
|
|
|
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
|
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
|
|
|
// Bottom Left
|
|
GXPosition3f32(x1, y1, 0.0f);
|
|
GXColor1u32(mColor1);
|
|
GXTexCoord2u16(u1, v1);
|
|
|
|
// Bottom Right
|
|
GXPosition3f32(x2, y1, 0.0f);
|
|
GXColor1u32(mColor2);
|
|
GXTexCoord2u16(u2, v1);
|
|
|
|
// Top Right
|
|
GXPosition3f32(x2, y2, 0.0f);
|
|
GXColor1u32(mColor4);
|
|
GXTexCoord2u16(u2, v2);
|
|
|
|
// Top Left
|
|
GXPosition3f32(x1, y2, 0.0f);
|
|
GXColor1u32(mColor3);
|
|
GXTexCoord2u16(u1, v2);
|
|
GXEnd();
|
|
|
|
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
|
|
|
|
return retval;
|
|
}
|
|
|
|
void JUTResFont::loadFont(int code, GXTexMapID texMapID, JUTFont::TWidth* pDstWidth) {
|
|
if (pDstWidth != 0) {
|
|
getWidthEntry(code, pDstWidth);
|
|
}
|
|
|
|
int fontCode = getFontCode(code);
|
|
loadImage(fontCode, texMapID);
|
|
}
|
|
|
|
void JUTResFont::getWidthEntry(int code, JUTFont::TWidth* i_width) const {
|
|
int fontCode = getFontCode(code);
|
|
i_width->field_0x0 = 0;
|
|
i_width->field_0x1 = mInf1Ptr->width;
|
|
|
|
for (int i = 0; i < mWid1BlockNum; i++) {
|
|
u16 sc = mpWidthBlocks[i]->startCode;
|
|
u16 ec = mpWidthBlocks[i]->endCode;
|
|
if (sc <= fontCode && fontCode <= ec) {
|
|
// TWidth is two u8 fields, no byte-swap needed
|
|
*i_width = *(JUTFont::TWidth*)&mpWidthBlocks[i]->mChunkNum[(fontCode - sc) * 2];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
s32 JUTResFont::getCellWidth() const {
|
|
if (mpGlyphBlocks) {
|
|
if (mpGlyphBlocks[0]) {
|
|
return mpGlyphBlocks[0]->cellWidth;
|
|
}
|
|
}
|
|
|
|
return getWidth();
|
|
}
|
|
|
|
s32 JUTResFont::getCellHeight() const {
|
|
if (mpGlyphBlocks) {
|
|
if (mpGlyphBlocks[0]) {
|
|
return mpGlyphBlocks[0]->cellHeight;
|
|
}
|
|
}
|
|
|
|
return getHeight();
|
|
}
|
|
|
|
bool JUTResFont::isLeadByte(int chr) const {
|
|
return (*mIsLeadByte)(chr);
|
|
}
|
|
|
|
int JUTResFont::getFontCode(int chr) const {
|
|
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,
|
|
};
|
|
|
|
int ret = mInf1Ptr->defaultCode;
|
|
if ((getFontType() == 2) && (mMaxCode >= 0x8000U) && (chr >= 0x20) && (chr < 0x7FU)) {
|
|
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;
|
|
} else if (mpMapBlocks[i]->mappingMethod == 2) {
|
|
BE(u16)* leading_temp = &mpMapBlocks[i]->mLeading;
|
|
ret = leading_temp[chr - mpMapBlocks[i]->startCode];
|
|
} else if (mpMapBlocks[i]->mappingMethod == 3) {
|
|
// invented struct to help match debug, unsure of real struct
|
|
struct paired_u16 {
|
|
BE(u16) fullChar;
|
|
BE(u16) fontCode;
|
|
};
|
|
|
|
paired_u16* leading_temp = (paired_u16*)&mpMapBlocks[i]->mLeading;
|
|
int binarySearchMin = 0;
|
|
int binarySearchMax = mpMapBlocks[i]->numEntries - 1;
|
|
|
|
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;
|
|
}
|
|
}
|
|
} else if (mpMapBlocks[i]->mappingMethod == 1) {
|
|
BE(u16)* phi_r5_2 = NULL;
|
|
if (mpMapBlocks[i]->numEntries == 1) {
|
|
phi_r5_2 = &mpMapBlocks[i]->mLeading;
|
|
}
|
|
ret = convertSjis(chr, phi_r5_2);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
void JUTResFont::loadImage(int code, GXTexMapID id){
|
|
int i = 0;
|
|
for (; i < mGly1BlockNum; i++)
|
|
{
|
|
u16 sc = mpGlyphBlocks[i]->startCode;
|
|
u16 ec = mpGlyphBlocks[i]->endCode;
|
|
if (sc <= code && code <= ec)
|
|
{
|
|
code -= sc;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (i != mGly1BlockNum) {
|
|
u16 numRows = mpGlyphBlocks[i]->numRows;
|
|
u16 numCols = mpGlyphBlocks[i]->numColumns;
|
|
u16 cellW = mpGlyphBlocks[i]->cellWidth;
|
|
u16 cellH = mpGlyphBlocks[i]->cellHeight;
|
|
u32 texSize = mpGlyphBlocks[i]->textureSize;
|
|
u16 texW = mpGlyphBlocks[i]->textureWidth;
|
|
u16 texH = mpGlyphBlocks[i]->textureHeight;
|
|
u16 texFmt = mpGlyphBlocks[i]->textureFormat;
|
|
|
|
s32 pageNumCells = numRows * numCols;
|
|
s32 pageIdx = code / pageNumCells;
|
|
s32 cellIdxInPage = code - pageIdx * pageNumCells;
|
|
s32 cellRow = (cellIdxInPage / numRows);
|
|
s32 cellCol = (cellIdxInPage - cellRow * numRows);
|
|
mWidth = cellCol * cellW;
|
|
mHeight = cellRow * cellH;
|
|
|
|
if (pageIdx != mTexPageIdx || i != field_0x66)
|
|
{
|
|
void* pImg = &mpGlyphBlocks[i]->data[pageIdx * mpGlyphBlocks[i]->textureSize];
|
|
#ifdef TARGET_PC
|
|
mTexObj.reset();
|
|
#endif
|
|
GXInitTexObj(&mTexObj, pImg, mpGlyphBlocks[i]->textureWidth,
|
|
mpGlyphBlocks[i]->textureHeight, (GXTexFmt)(u16)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;
|
|
field_0x66 = i;
|
|
}
|
|
|
|
GXLoadTexObj(&mTexObj, id);
|
|
}
|
|
}
|
|
|
|
int JUTResFont::convertSjis(int inChr, BE(u16)* inLead) const {
|
|
int r29;
|
|
int tmp = JSUHiByte(inChr);
|
|
int tmp2 = JSULoByte(inChr) - 0x40;
|
|
|
|
if (0x40 <= tmp2) {
|
|
tmp2--;
|
|
}
|
|
|
|
u16 lead = 0x31c;
|
|
|
|
if (inLead) {
|
|
lead = *inLead;
|
|
}
|
|
|
|
r29 = tmp2 + (tmp - 0x88) * 0xbc + -0x5e + lead;
|
|
return r29;
|
|
}
|