More symbols from NSMBW

This commit is contained in:
robojumper
2026-01-18 12:27:37 +01:00
parent df5bd1a7b5
commit 679541bee2
13 changed files with 84 additions and 81 deletions
+9 -9
View File
@@ -523,9 +523,9 @@ void DrawGX::SetVtxState(EGG::DrawGX::VtxType type) {
}
}
const u8 sDetailLevels[] = {0x10, 0x20};
void DrawGX::CreateDisplayList(EGG::Heap *pHeap) {
static const u8 POS_NUM[] = {0x10, 0x20};
u8 ALIGN_DECL(32) tmpDisplayList[16 * 1024];
OSInitFastCast();
@@ -567,7 +567,7 @@ void DrawGX::CreateDisplayList(EGG::Heap *pHeap) {
case DL_4: GXDrawSphere(8, 16); break;
case DL_5:
case DL_6: {
u16 numSegments = sDetailLevels[i - DL_5] + 1;
u16 numSegments = POS_NUM[i - DL_5] + 1;
f32 radPerSegment = 2.0f * M_PI / (numSegments - 1);
GXBegin(GX_LINESTRIP, GX_VTXFMT0, numSegments);
for (int i = 0; i < numSegments; i++) {
@@ -579,7 +579,7 @@ void DrawGX::CreateDisplayList(EGG::Heap *pHeap) {
}
case DL_9:
case DL_10: {
u16 numSegments = sDetailLevels[i - DL_9] + 1;
u16 numSegments = POS_NUM[i - DL_9] + 1;
f32 radPerSegment = 2.0f * M_PI / (numSegments - 1);
GXBegin(GX_TRIANGLESTRIP, GX_VTXFMT0, numSegments * 2);
for (int i = 0; i < numSegments; i++) {
@@ -592,21 +592,21 @@ void DrawGX::CreateDisplayList(EGG::Heap *pHeap) {
}
nw4r::math::MTX34 mtx;
PSMTXTrans(mtx, 0.0f, 0.5f, 0.0f);
DrawCircleYPolygonFan(mtx, 0.0f, sDetailLevels[i - DL_9]);
DrawCircleYPolygonFan(mtx, 0.0f, POS_NUM[i - DL_9]);
PSMTXIdentity(mtx);
PSMTXRotRad(mtx, M_PI, 0x7A);
PSMTXTransApply(mtx, mtx, 0.0f, -0.5f, 0.0f);
DrawCircleYPolygonFan(mtx, 0.0f, sDetailLevels[i - DL_9]);
DrawCircleYPolygonFan(mtx, 0.0f, POS_NUM[i - DL_9]);
break;
}
case DL_11:
case DL_12: {
nw4r::math::MTX34 mtx;
PSMTXIdentity(mtx);
DrawCircleYPolygonFan(mtx, 1.0f, sDetailLevels[i - DL_11]);
DrawCircleYPolygonFan(mtx, 1.0f, POS_NUM[i - DL_11]);
PSMTXRotRad(mtx, M_PI, 0x7A);
DrawCircleYPolygonFan(mtx, 0.0f, sDetailLevels[i - DL_11]);
DrawCircleYPolygonFan(mtx, 0.0f, POS_NUM[i - DL_11]);
break;
}
case DL_7:
@@ -614,7 +614,7 @@ void DrawGX::CreateDisplayList(EGG::Heap *pHeap) {
nw4r::math::MTX34 mtx;
PSMTXIdentity(mtx);
PSMTXRotRad(mtx, M_PI / 2.0f, 0x78);
DrawCircleYPolygonFan(mtx, 0.0f, sDetailLevels[i - DL_7]);
DrawCircleYPolygonFan(mtx, 0.0f, POS_NUM[i - DL_7]);
break;
}
+7 -7
View File
@@ -61,7 +61,7 @@ DrawPathDOF::~DrawPathDOF() {
mpMask = nullptr;
}
void DrawPathDOF::execute() {
void DrawPathDOF::updateShimmer() {
field_0x5C += field_0x6C * field_0x7C;
field_0x60 += field_0x70 * field_0x7C;
@@ -115,8 +115,8 @@ void DrawPathDOF::internalResetForDraw() {
void DrawPathDOF::internalDraw(u16 idx) {
if (idx == 0) {
if (StateEfb::CheckFlag0x2() == 0) {
StateEfb::fn_804B4270(
static_cast<StateEfb::BufferType>((field_0x1C >> 2) & 1), reinterpret_cast<u32>(this)
StateEfb::pushWorkBuffer(
static_cast<StateEfb::WorkBuffer>((field_0x1C >> 2) & 1), reinterpret_cast<u32>(this)
);
}
StateGX::invalidateTexAllGX();
@@ -130,8 +130,8 @@ void DrawPathDOF::internalDraw(u16 idx) {
switch (idx) {
case 1:
StateEfb::popWorkBuffer(StateEfb::BUFFER_0, reinterpret_cast<u32>(this));
StateEfb::releaseEfb(StateEfb::BUFFER_3, reinterpret_cast<u32>(this));
StateEfb::popWorkBuffer(false, reinterpret_cast<u32>(this));
StateEfb::releaseEfb(StateEfb::BUFFER_TYPE_3, reinterpret_cast<u32>(this));
break;
case 2:
if (mpTextureBuffer != nullptr) {
@@ -148,13 +148,13 @@ void DrawPathDOF::internalDrawLite(u16 idx) {
const Screen::DataEfb &efb = screen.GetDataEfb();
switch (idx) {
case 0: {
TextureBuffer *capturedBuf = StateEfb::captureEfb(StateEfb::BUFFER_3, false, reinterpret_cast<u32>(this));
TextureBuffer *capturedBuf = StateEfb::captureEfb(StateEfb::BUFFER_TYPE_3, false, reinterpret_cast<u32>(this));
StateGX::setPixelFormatGX(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
StateGX::ScopedColor colorGuard(true);
StateGX::ScopedAlpha alphaGuard(false);
StateGX::ScopedDither ditherGuard(false);
PostEffectBase::setProjection(screen);
f32 *floats = StateEfb::fn_804B4550();
f32 *floats = StateEfb::shiftWorkSpaceViewportGX();
f32 scale = (field_0x1C & 4) != 0 ? 0.25f : 0.5f;
f32 width1 = screen.GetWidth() * scale;
f32 height1 = screen.GetHeight() * scale;
+2 -2
View File
@@ -130,10 +130,10 @@ void LightObject::CalcView(nw4r::math::MTX34 const &viewMtx) {
}
}
void LightObject::fn_804A9C30(const LightTexture *tex, nw4r::math::VEC3 *pVec, GXColor *color) const {
void LightObject::CalcFinalDirColor(const LightTexture &tex, nw4r::math::VEC3 *pVec, GXColor *color) const {
*pVec = field_0x94;
*color = mLightColor;
f32 f = tex->getFloat(mIndex);
f32 f = tex.getFloat(mIndex);
if (f < 1.0f) {
color->r = color->r * f;
color->g = color->g * f;
+2 -2
View File
@@ -308,7 +308,7 @@ void LightTexture::initDrawSetting(u16 u1, u16 u2, u16 u3, u16 u4) {
GXSetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA);
}
void LightTexture::getTexDimensions(u16 *x, u16 *y, u16 *w, u16 *h, u16 count) {
void LightTexture::getRequiredPosAndSize(u16 *x, u16 *y, u16 *w, u16 *h, u16 count) {
*x = sDrawPosX;
*y = sDrawPosY;
@@ -550,7 +550,7 @@ void LightTexture::addLight(const EGG::LightObject &obj) {
nw4r::math::VEC3 vec;
GXColor color;
obj.fn_804A9C30(this, &vec, &color);
obj.CalcFinalDirColor(*this, &vec, &color);
int remainder = field_0x9F % field_0x9D;
if (field_0x9F == field_0x9D) {
GXSetBlendMode(GX_BM_BLEND, GX_BL_ONE, GX_BL_ONE, GX_LO_CLEAR);
+1 -1
View File
@@ -204,7 +204,7 @@ void LightTextureManager::drawAndCaptureTexture(f32 ox, f32 oy, f32 sx, f32 sy)
u16 x1, y1, x2, y2;
TextureBuffer *buf = nullptr;
LightTexture::getTexDimensions(&x1, &y1, &x2, &y2, mTextureCount);
LightTexture::getRequiredPosAndSize(&x1, &y1, &x2, &y2, mTextureCount);
x2 += x2 & 3;
y2 += y2 & 3;
+19 -19
View File
@@ -12,7 +12,7 @@
namespace EGG {
StateEfb::Buffer StateEfb::spBufferSet[BUFFER_MAX];
StateEfb::Buffer StateEfb::spBufferSet[BUFFER_TYPE_MAX];
f32 StateEfb::sWorkSpaceV[6];
f32 StateEfb::sWorkSpaceHideV[6];
f32 StateEfb::sShiftViewPort[6];
@@ -49,9 +49,9 @@ TextureBuffer *StateEfb::captureEfb(BufferType type, bool noTransparencyMaybe, u
bool doCapture = true;
switch (type) {
case BUFFER_0:
case BUFFER_1: {
f32 arg = type == BUFFER_0 ? 0.25f : 0.5f;
case BUFFER_TYPE_0:
case BUFFER_TYPE_1: {
f32 arg = type == BUFFER_TYPE_0 ? 0.25f : 0.5f;
sWorkSpaceV[2] = efb.vp.x2 * arg;
sWorkSpaceV[3] = efb.vp.y2 * arg;
@@ -92,11 +92,11 @@ TextureBuffer *StateEfb::captureEfb(BufferType type, bool noTransparencyMaybe, u
break;
}
case BUFFER_2:
case BUFFER_TYPE_2:
spBufferSet[type].buf = TextureBuffer::alloc(efb.vp.x2, efb.vp.y2, GX_TF_RGBA8);
spBufferSet[type].buf->setPixModeSync(false);
break;
case BUFFER_3:
case BUFFER_TYPE_3:
spBufferSet[type].buf = TextureBuffer::alloc(
efb.vp.x2 / 2.0f, efb.vp.y2 / 2.0f, GetUseTfRgb565() ? GX_TF_RGB565 : GX_TF_RGBA8
);
@@ -138,16 +138,16 @@ bool StateEfb::releaseEfb(BufferType type, u32 userData) {
}
}
void StateEfb::fn_804B4270(BufferType type, u32 userData) {
if (type == BUFFER_0) {
if (sWorkBuffer == 1) {
StateEfb::releaseEfb(BUFFER_0, spBufferSet[0].userData);
void StateEfb::pushWorkBuffer(WorkBuffer buffer, u32 userData) {
if (buffer == WORK_BUFFER_0) {
if (sWorkBuffer == WORK_BUFFER_1) {
StateEfb::releaseEfb(BUFFER_TYPE_0, spBufferSet[BUFFER_TYPE_0].userData);
}
captureEfb(BUFFER_1, false, userData);
sWorkBuffer = 0;
} else if (type == BUFFER_1 && sWorkBuffer != 0) {
captureEfb(BUFFER_0, false, userData);
sWorkBuffer = 1;
captureEfb(BUFFER_TYPE_1, false, userData);
sWorkBuffer = WORK_BUFFER_0;
} else if (buffer == WORK_BUFFER_1 && sWorkBuffer != WORK_BUFFER_0) {
captureEfb(BUFFER_TYPE_0, false, userData);
sWorkBuffer = WORK_BUFFER_1;
}
}
@@ -155,9 +155,9 @@ void StateEfb::popWorkBuffer(bool b, u32 userData) {
if (sWorkBuffer != -1) {
BufferType i = static_cast<BufferType>(-1);
if (sWorkBuffer == 0) {
i = BUFFER_1;
i = BUFFER_TYPE_1;
} else if (sWorkBuffer == 1) {
i = BUFFER_0;
i = BUFFER_TYPE_0;
}
if (spBufferSet[i].userData == userData) {
@@ -195,14 +195,14 @@ void StateEfb::popWorkBuffer(bool b, u32 userData) {
DrawGX::DrawDL(DrawGX::DL_16, mtx, DrawGX::WHITE);
}
}
releaseEfb((i), spBufferSet[i].userData);
releaseEfb(i, spBufferSet[i].userData);
sWorkBuffer = -1;
sPushCount += 1;
}
}
}
f32 *StateEfb::fn_804B4550() {
f32 *StateEfb::shiftWorkSpaceViewportGX() {
const Screen::DataEfb &efb = GlobalDrawState::getScreen().GetDataEfb();
sShiftViewPort[0] = sWorkSpaceV[0];
sShiftViewPort[1] = sWorkSpaceV[1];
+13 -13
View File
@@ -29,7 +29,7 @@ char decompressor_alloc_space[0x9930];
mDvd_param_c l_param;
// unofficial
TUncompressInfo_Base_c *decompressorPtrs[1] = {
UncompressInfo_c *decompressorPtrs[1] = {
&s_UncompressInfoLZ,
};
@@ -38,18 +38,18 @@ int maxChunkSize = 0x10000;
void *somePtr;
u32 someNumber;
TUncompressInfo_Base_c **compressors_ptr;
TUncompressInfo_Base_c **compressors_last;
// official
UncompressInfo_c **s_UncompressInfoTable_begin;
UncompressInfo_c **s_UncompressInfoTable_end;
OSThread *l_OSThread;
mDvd::MyThread_c *l_MyThread;
EGG::Heap *l_CommandHeap;
EGG::Heap *l_ArchiveHeap;
bool l_IsAutoStreamDecomp;
static void unk_setDecompressorPtrs(TUncompressInfo_Base_c **ptr, TUncompressInfo_Base_c **last) {
compressors_ptr = ptr;
compressors_last = last;
static void unk_setDecompressorPtrs(UncompressInfo_c **ptr, UncompressInfo_c **last) {
s_UncompressInfoTable_begin = ptr;
s_UncompressInfoTable_end = last;
}
void unk_initDecompressors() {
@@ -58,9 +58,9 @@ void unk_initDecompressors() {
someNumber = 0x24;
}
static TUncompressInfo_Base_c *findUncompressInfo(u8 type) {
TUncompressInfo_Base_c **ptr = compressors_ptr;
while (ptr != compressors_last) {
static UncompressInfo_c *findUncompressInfo(u8 type) {
UncompressInfo_c **ptr = s_UncompressInfoTable_begin;
while (ptr != s_UncompressInfoTable_end) {
if ((*ptr)->mType == type) {
return *ptr;
}
@@ -70,7 +70,7 @@ static TUncompressInfo_Base_c *findUncompressInfo(u8 type) {
}
static EGG::StreamDecomp *newUncompressObj(u8 type) {
TUncompressInfo_Base_c *factory = findUncompressInfo(type);
UncompressInfo_c *factory = findUncompressInfo(type);
if (factory != nullptr) {
return factory->Construct();
} else {
@@ -79,7 +79,7 @@ static EGG::StreamDecomp *newUncompressObj(u8 type) {
}
static void deleteUncompressObj(u8 type) {
TUncompressInfo_Base_c *factory = findUncompressInfo(type);
UncompressInfo_c *factory = findUncompressInfo(type);
if (factory != nullptr) {
factory->Destruct();
}
@@ -362,7 +362,7 @@ static int ConvertPathToEntrynumASD_(const char *name, u8 *outType) {
end = buf + strlen(buf);
size = sizeof(buf) - (end - buf);
// Append the compressor extension and try to find a compressed version
for (mDvd::TUncompressInfo_Base_c **ptr = mDvd::compressors_ptr; ptr != mDvd::compressors_last; ptr++) {
for (mDvd::UncompressInfo_c **ptr = mDvd::s_UncompressInfoTable_begin; ptr != mDvd::s_UncompressInfoTable_end; ptr++) {
strncpy(end, (*ptr)->mExtension, size);
num = DVDConvertPathToEntrynum(buf);
if (num != -1) {
@@ -380,7 +380,7 @@ static int ConvertPathToEntrynumASD_(const char *name, u8 *outType) {
if (end != nullptr) {
size = sizeof(buf) - (end - buf);
// Append the compressor extension and try to find a compressed version
for (mDvd::TUncompressInfo_Base_c **ptr = mDvd::compressors_ptr; ptr != mDvd::compressors_last; ptr++) {
for (mDvd::UncompressInfo_c **ptr = mDvd::s_UncompressInfoTable_begin; ptr != mDvd::s_UncompressInfoTable_end; ptr++) {
strncpy(end, (*ptr)->mExtension, size);
num = DVDConvertPathToEntrynum(buf);
if (num != -1) {