Several JSystem file matches

This commit is contained in:
Noah McQueen
2023-09-10 23:17:07 -06:00
parent b82520becb
commit da415ac542
14 changed files with 487 additions and 210 deletions
+34 -8
View File
@@ -8,25 +8,51 @@
/* 802C1DA4-802C1DD0 .text __ct__7JUTFontFv */
JUTFont::JUTFont() {
/* Nonmatching */
mValid = false;
}
/* 802C1DD0-802C1E1C .text initialize_state__7JUTFontFv */
void JUTFont::initialize_state() {
/* Nonmatching */
setCharColor(JUtility::TColor());
mFixed = false;
mFixedWidth = 0;
mValid = false;
}
/* 802C1E1C-802C1EA0 .text setCharColor__7JUTFontFQ28JUtility6TColor */
void JUTFont::setCharColor(JUtility::TColor) {
/* Nonmatching */
void JUTFont::setCharColor(JUtility::TColor col1) {
mColor1 = col1;
mColor2 = col1;
mColor3 = col1;
mColor4 = col1;
}
/* 802C1EA0-802C1F24 .text setGradColor__7JUTFontFQ28JUtility6TColorQ28JUtility6TColor */
void JUTFont::setGradColor(JUtility::TColor, JUtility::TColor) {
/* Nonmatching */
void JUTFont::setGradColor(JUtility::TColor col1, JUtility::TColor col2) {
mColor1 = col1;
mColor2 = col1;
mColor3 = col2;
mColor4 = col2;
}
/* 802C1F24-802C2044 .text drawString_size_scale__7JUTFontFffffPCcUlb */
void JUTFont::drawString_size_scale(float, float, float, float, const char*, unsigned long, bool) {
/* Nonmatching */
f32 JUTFont::drawString_size_scale(f32 a1, f32 a2, f32 a3, f32 a4, const char* str, u32 usz,
bool a7) {
f32 temp = a1;
for (; usz > 0; usz--, str++) {
u32 c = *(u8*)str;
u32 b = c;
if (isLeadByte(b)) {
str++;
b <<= 8;
b |= *(u8*)str;
usz--;
}
a1 += drawChar_scale(a1, a2, a3, a4, b, a7);
a7 = 1;
}
return a1 - temp;
}
+29 -3
View File
@@ -4,14 +4,40 @@
//
#include "JSystem/JUtility/JUTGraphFifo.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "dolphin/types.h"
bool JUTGraphFifo::sInitiated;
JUTGraphFifo* JUTGraphFifo::sCurrentFifo;
/* 802C1C04-802C1CE0 .text __ct__12JUTGraphFifoFUl */
JUTGraphFifo::JUTGraphFifo(unsigned long) {
/* Nonmatching */
JUTGraphFifo::JUTGraphFifo(u32 size) {
mSize = size + 0x1F & ~0x1F;
if (sInitiated) {
mFifo = (GXFifoObj*)JKRAllocFromSysHeap(mSize + 0x80, 32);
mBase = mFifo + 1;
GXInitFifoBase(mFifo, mBase, mSize);
GXInitFifoPtrs(mFifo, mBase, mBase);
} else {
mBase = JKRAllocFromSysHeap(mSize + 0xA0, 32);
mBase = (void*)((int)mBase + 0x1F & ~0x1F);
mFifo = GXInit(mBase, mSize);
sInitiated = true;
sCurrentFifo = this;
}
}
bool JUTGraphFifo::mGpStatus[5];
/* 802C1CE0-802C1DA4 .text __dt__12JUTGraphFifoFv */
JUTGraphFifo::~JUTGraphFifo() {
/* Nonmatching */
sCurrentFifo->save();
do {
} while (isGPActive());
if (sCurrentFifo == this) {
sCurrentFifo = NULL;
}
JKRFreeToSysHeap(mBase);
}
+29 -4
View File
@@ -4,14 +4,39 @@
//
#include "JSystem/JUtility/JUTResource.h"
#include "JSystem/JKernel/JKRArchive.h"
#include "JSystem/JSupport/JSUInputStream.h"
#include "dolphin/types.h"
/* 802C12DC-802C1384 .text getResource__15JUTResReferenceFP14JSUInputStreamUlP10JKRArchive */
void JUTResReference::getResource(JSUInputStream*, unsigned long, JKRArchive*) {
/* Nonmatching */
void* JUTResReference::getResource(JSUInputStream* stream, u32 resType, JKRArchive* archive) {
stream->read(&mType, 1);
stream->read(&mNameLength, 1);
stream->read(&mName, mNameLength);
if (mType == RESTYPE_Unk2 || mType == RESTYPE_Unk3 || mType == RESTYPE_Unk4) {
mName[mNameLength] = 0;
}
return getResource(resType, archive);
}
/* 802C1384-802C13FC .text getResource__15JUTResReferenceFUlP10JKRArchive */
void JUTResReference::getResource(unsigned long, JKRArchive*) {
/* Nonmatching */
void* JUTResReference::getResource(u32 resType, JKRArchive* archive) {
void* res = NULL;
switch (mType) {
case RESTYPE_Unk1:
break;
case RESTYPE_Unk2:
res = JKRArchive::getGlbResource(resType, mName, archive);
break;
case RESTYPE_Unk3:
res = JKRFileLoader::getGlbResource(mName, archive);
break;
case RESTYPE_Unk4:
res = JKRFileLoader::getGlbResource(mName);
break;
}
return res;
}
+93 -10
View File
@@ -4,34 +4,117 @@
//
#include "JSystem/JUtility/JUTTexture.h"
#include "JSystem/JUtility/JUTPalette.h"
#include "dolphin/gx/GX.h"
#include "dolphin/types.h"
/* 802C13FC-802C1470 .text __dt__10JUTTextureFv */
JUTTexture::~JUTTexture() {
/* Nonmatching */
if (getCaptureFlag()) {
delete[] field_0x3c;
}
if (getEmbPaletteDelFlag()) {
delete mEmbPalette;
}
}
/* 802C1470-802C15FC .text storeTIMG__10JUTTextureFPC7ResTIMGUc */
void JUTTexture::storeTIMG(const ResTIMG*, unsigned char) {
/* Nonmatching */
void JUTTexture::storeTIMG(const ResTIMG* pTimg, u8 param_1) {
_GXTlut tlut;
if (pTimg && param_1 < 0x10) {
mTexInfo = pTimg;
mTexData = (void*)((int)mTexInfo + mTexInfo->imageOffset);
if (mTexInfo->imageOffset == 0) {
mTexData = (void*)((int)mTexInfo + 0x20);
}
if (getEmbPaletteDelFlag()) {
delete mEmbPalette;
}
mEmbPalette = NULL;
mAttachedPalette = NULL;
mTlutName = 0;
mWrapS = mTexInfo->wrapS;
mWrapT = mTexInfo->wrapT;
mMinFilter = mTexInfo->minFilter;
mMagFilter = mTexInfo->magFilter;
mMinLOD = (s8)mTexInfo->minLOD;
mMaxLOD = (s8)mTexInfo->maxLOD;
mLODBias = mTexInfo->LODBias;
if (mTexInfo->numColors == 0) {
initTexObj();
} else {
if (mTexInfo->numColors > 0x100) {
tlut = (_GXTlut)((param_1 % 4) + GX_BIGTLUT0);
} else {
tlut = (_GXTlut)param_1;
}
mEmbPalette = new JUTPalette(
tlut, (_GXTlutFmt)mTexInfo->colorFormat, (JUTTransparency)mTexInfo->alphaEnabled,
mTexInfo->numColors, (void*)(&mTexInfo->format + mTexInfo->paletteOffset));
mFlags = mFlags & 1 | 2;
attachPalette(mEmbPalette);
}
}
}
/* 802C15FC-802C1654 .text attachPalette__10JUTTextureFP10JUTPalette */
void JUTTexture::attachPalette(JUTPalette*) {
/* Nonmatching */
void JUTTexture::attachPalette(JUTPalette* pPalette) {
if (mTexInfo->indexTexture) {
if (pPalette == NULL && mEmbPalette != NULL) {
mAttachedPalette = mEmbPalette;
} else {
mAttachedPalette = pPalette;
}
_GXTlut name = (_GXTlut)mAttachedPalette->getTlutName();
initTexObj(name);
}
}
/* 802C1654-802C1740 .text initTexObj__10JUTTextureFv */
void JUTTexture::initTexObj() {
/* Nonmatching */
GXBool mipmapEnabled;
if (mTexInfo->mipmapEnabled != 0) {
mipmapEnabled = 1;
} else {
mipmapEnabled = 0;
}
u8* image = ((u8*)mTexInfo);
image += (mTexInfo->imageOffset ? mTexInfo->imageOffset : 0x20);
GXInitTexObj(&mTexObj, image, mTexInfo->width, mTexInfo->height, (GXTexFmt)mTexInfo->format,
(GXTexWrapMode)mWrapS, (GXTexWrapMode)mWrapT, mipmapEnabled);
GXInitTexObjLOD(&mTexObj, (GXTexFilter)mMinFilter, (GXTexFilter)mMagFilter, mMinLOD / 8.0f,
mMaxLOD / 8.0f, mLODBias / 100.0f, mTexInfo->biasClamp, mTexInfo->doEdgeLOD,
(GXAnisotropy)mTexInfo->maxAnisotropy);
}
/* 802C1740-802C183C .text initTexObj__10JUTTextureF7_GXTlut */
void JUTTexture::initTexObj(_GXTlut) {
/* Nonmatching */
void JUTTexture::initTexObj(_GXTlut tlut) {
GXBool mipmapEnabled;
if (mTexInfo->mipmapEnabled != 0) {
mipmapEnabled = 1;
} else {
mipmapEnabled = 0;
}
mTlutName = tlut;
u8* image = ((u8*)mTexInfo);
image += (mTexInfo->imageOffset ? mTexInfo->imageOffset : 0x20);
GXInitTexObjCI(&mTexObj, image, mTexInfo->width, mTexInfo->height, (GXCITexFmt)mTexInfo->format,
(GXTexWrapMode)mWrapS, (GXTexWrapMode)mWrapT, mipmapEnabled, tlut);
GXInitTexObjLOD(&mTexObj, (GXTexFilter)mMinFilter, (GXTexFilter)mMagFilter, mMinLOD / 8.0f,
mMaxLOD / 8.0f, mLODBias / 100.0f, mTexInfo->biasClamp, mTexInfo->doEdgeLOD,
(GXAnisotropy)mTexInfo->maxAnisotropy);
}
/* 802C183C-802C188C .text load__10JUTTextureF11_GXTexMapID */
void JUTTexture::load(_GXTexMapID) {
/* Nonmatching */
void JUTTexture::load(_GXTexMapID id) {
if (mAttachedPalette) {
mAttachedPalette->load();
}
GXLoadTexObj(&mTexObj, id);
}