mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-25 16:04:28 -04:00
Merge branch 'main' of https://github.com/zeldaret/tp into compile
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "CaptureScreen.h"
|
||||
#include "global.h"
|
||||
|
||||
CaptureScreen::CaptureScreen(const JFWDisplay* pDisplay) {
|
||||
mpDisplay = pDisplay;
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@
|
||||
#include "JSystem/JKernel/JKRExpHeap.h"
|
||||
#include "JSystem/JKernel/JKRFileCache.h"
|
||||
#include "JSystem/JUtility/JUTConsole.h"
|
||||
#include <stdio>
|
||||
#include <cstdio>
|
||||
#include "m_Do/m_Do_dvd_thread.h"
|
||||
#include "m_Do/m_Do_ext.h"
|
||||
|
||||
@@ -474,14 +474,14 @@ extern "C" void ModuleUnresolved() {
|
||||
OSReport_Error("\n");
|
||||
}
|
||||
|
||||
extern "C" void ModuleConstructorsX(void (**ctors)()) {
|
||||
extern "C" void ModuleConstructorsX(void (*const *ctors)()) {
|
||||
while (*ctors != 0) {
|
||||
(**ctors)();
|
||||
ctors++;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void ModuleDestructorsX(void (**dtors)()) {
|
||||
extern "C" void ModuleDestructorsX(void (*const *dtors)()) {
|
||||
while (*dtors != 0) {
|
||||
(**dtors)();
|
||||
dtors++;
|
||||
|
||||
@@ -7,90 +7,138 @@
|
||||
#include "JSystem/JUtility/JUTResource.h"
|
||||
#include "dolphin/os.h"
|
||||
|
||||
f32 J2DGetKeyFrameInterpolationf(f32 param_0, J3DAnmKeyTableBase* param_1, f32* param_2);
|
||||
f32 J2DGetKeyFrameInterpolations(f32 param_0, J3DAnmKeyTableBase* param_1, s16* param_2);
|
||||
template<typename T>
|
||||
f32 J2DGetKeyFrameInterpolation(f32 param_0, J3DAnmKeyTableBase* param_1, T* param_2) {
|
||||
J3D_PANIC(101, param_2, "Error : null pointer.");
|
||||
if (param_0 < param_2[0]) {
|
||||
return param_2[1];
|
||||
} else {
|
||||
if (param_1->mType == 0) {
|
||||
if (param_2[(param_1->mMaxFrame - 1) * 3] <= param_0) {
|
||||
return param_2[(param_1->mMaxFrame - 1) * 3 + 1];
|
||||
} else {
|
||||
u32 tmp = param_1->mMaxFrame;
|
||||
while (tmp > 1) {
|
||||
u32 halfTmp = tmp / 2;
|
||||
u32 upIdx = halfTmp * 3;
|
||||
if (param_0 >= param_2[upIdx]) {
|
||||
param_2 = param_2 + upIdx;
|
||||
tmp -= halfTmp;
|
||||
} else {
|
||||
tmp = halfTmp;
|
||||
}
|
||||
}
|
||||
f32 result = J2DHermiteInterpolation(param_0, ¶m_2[0], ¶m_2[1], ¶m_2[2], ¶m_2[3], ¶m_2[4], ¶m_2[5]);
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
if (param_2[(param_1->mMaxFrame - 1) * 4] <= param_0) {
|
||||
return param_2[(param_1->mMaxFrame - 1) * 4 + 1];
|
||||
} else {
|
||||
u32 tmp = param_1->mMaxFrame;
|
||||
while (tmp > 1) {
|
||||
u32 halfTmp = tmp / 2;
|
||||
u32 upIdx = halfTmp * 4;
|
||||
if (param_0 >= param_2[upIdx]) {
|
||||
param_2 = param_2 + upIdx;
|
||||
tmp -= halfTmp;
|
||||
} else {
|
||||
tmp = halfTmp;
|
||||
}
|
||||
}
|
||||
f32 result = J2DHermiteInterpolation(param_0, ¶m_2[0], ¶m_2[1], ¶m_2[3], ¶m_2[4], ¶m_2[5], ¶m_2[6]);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void J2DAnmTransformFull::getTransform(u16 param_0, J3DTransformInfo* transformInfo) const {
|
||||
u32 local_3c = mFrame;
|
||||
J3D_PANIC(169, param_0 < field_0x22, "Error : range over.");
|
||||
J3D_PANIC(170, transformInfo, "Error : null pointer.");
|
||||
u16 idx = (param_0 * 3);
|
||||
J3DAnmTransformFullTable* xPart = &mTableInfo[idx];
|
||||
J3DAnmTransformFullTable* yPart = &mTableInfo[idx + 1];
|
||||
J3DAnmTransformFullTable* zPart = &mTableInfo[idx + 2];
|
||||
u16 xMaxFrame = xPart->mScaleMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
u32 maxFrame = xPart->mScaleMaxFrame;
|
||||
if (mFrame < 0) {
|
||||
transformInfo->mScale.x = mScaleValues[xPart->mScaleOffset];
|
||||
} else if (getFrame() >= xMaxFrame) {
|
||||
transformInfo->mScale.x = mScaleValues[(xPart->mScaleOffset + (xMaxFrame - 1))];
|
||||
} else if (mFrame >= maxFrame) {
|
||||
transformInfo->mScale.x = mScaleValues[(xPart->mScaleOffset + (maxFrame - 1))];
|
||||
} else {
|
||||
transformInfo->mScale.x = mScaleValues[(xPart->mScaleOffset + (int)getFrame())];
|
||||
transformInfo->mScale.x = mScaleValues[(xPart->mScaleOffset + (int)mFrame)];
|
||||
}
|
||||
u16 yMaxFrame = yPart->mScaleMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
maxFrame = yPart->mScaleMaxFrame;
|
||||
if (mFrame < 0) {
|
||||
transformInfo->mScale.y = mScaleValues[yPart->mScaleOffset];
|
||||
} else if (getFrame() >= yMaxFrame) {
|
||||
transformInfo->mScale.y = mScaleValues[(yPart->mScaleOffset + (yMaxFrame - 1))];
|
||||
} else if (mFrame >= maxFrame) {
|
||||
transformInfo->mScale.y = mScaleValues[(yPart->mScaleOffset + (maxFrame - 1))];
|
||||
} else {
|
||||
transformInfo->mScale.y = mScaleValues[(yPart->mScaleOffset + (int)getFrame())];
|
||||
transformInfo->mScale.y = mScaleValues[(yPart->mScaleOffset + (int)mFrame)];
|
||||
}
|
||||
u16 zMaxFrame = zPart->mScaleMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
maxFrame = zPart->mScaleMaxFrame;
|
||||
if (mFrame < 0) {
|
||||
transformInfo->mScale.z = mScaleValues[zPart->mScaleOffset];
|
||||
} else if (getFrame() >= zMaxFrame) {
|
||||
transformInfo->mScale.z = mScaleValues[(zPart->mScaleOffset + (zMaxFrame - 1))];
|
||||
} else if (mFrame >= maxFrame) {
|
||||
transformInfo->mScale.z = mScaleValues[(zPart->mScaleOffset + (maxFrame - 1))];
|
||||
} else {
|
||||
transformInfo->mScale.z = mScaleValues[(zPart->mScaleOffset + (int)getFrame())];
|
||||
transformInfo->mScale.z = mScaleValues[(zPart->mScaleOffset + (int)mFrame)];
|
||||
}
|
||||
xMaxFrame = xPart->mRotationMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
maxFrame = xPart->mRotationMaxFrame;
|
||||
if (mFrame < 0) {
|
||||
transformInfo->mRotation.x = mRotationValues[xPart->mRotationOffset];
|
||||
} else if (getFrame() >= xMaxFrame) {
|
||||
transformInfo->mRotation.x = mRotationValues[(xPart->mRotationOffset + (xMaxFrame - 1))];
|
||||
} else if (mFrame >= maxFrame) {
|
||||
transformInfo->mRotation.x = mRotationValues[(xPart->mRotationOffset + (maxFrame - 1))];
|
||||
} else {
|
||||
transformInfo->mRotation.x = mRotationValues[(xPart->mRotationOffset + (int)getFrame())];
|
||||
transformInfo->mRotation.x = mRotationValues[(xPart->mRotationOffset + (int)mFrame)];
|
||||
}
|
||||
yMaxFrame = yPart->mRotationMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
maxFrame = yPart->mRotationMaxFrame;
|
||||
if (mFrame < 0) {
|
||||
transformInfo->mRotation.y = mRotationValues[yPart->mRotationOffset];
|
||||
} else if (getFrame() >= yMaxFrame) {
|
||||
transformInfo->mRotation.y = mRotationValues[(yPart->mRotationOffset + (yMaxFrame - 1))];
|
||||
} else if (mFrame >= maxFrame) {
|
||||
transformInfo->mRotation.y = mRotationValues[(yPart->mRotationOffset + (maxFrame - 1))];
|
||||
} else {
|
||||
transformInfo->mRotation.y = mRotationValues[(yPart->mRotationOffset + (int)getFrame())];
|
||||
transformInfo->mRotation.y = mRotationValues[(yPart->mRotationOffset + (int)mFrame)];
|
||||
}
|
||||
zMaxFrame = zPart->mRotationMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
maxFrame = zPart->mRotationMaxFrame;
|
||||
if (mFrame < 0) {
|
||||
transformInfo->mRotation.z = mRotationValues[zPart->mRotationOffset];
|
||||
} else if (getFrame() >= zMaxFrame) {
|
||||
transformInfo->mRotation.z = mRotationValues[(zPart->mRotationOffset + (zMaxFrame - 1))];
|
||||
} else if (mFrame >= maxFrame) {
|
||||
transformInfo->mRotation.z = mRotationValues[(zPart->mRotationOffset + (maxFrame - 1))];
|
||||
} else {
|
||||
transformInfo->mRotation.z = mRotationValues[(zPart->mRotationOffset + (int)getFrame())];
|
||||
transformInfo->mRotation.z = mRotationValues[(zPart->mRotationOffset + (int)mFrame)];
|
||||
}
|
||||
xMaxFrame = xPart->mTranslateMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
maxFrame = xPart->mTranslateMaxFrame;
|
||||
if (mFrame < 0) {
|
||||
transformInfo->mTranslate.x = mTranslateValues[xPart->mTranslateOffset];
|
||||
} else if (getFrame() >= xMaxFrame) {
|
||||
transformInfo->mTranslate.x = mTranslateValues[(xPart->mTranslateOffset + (xMaxFrame - 1))];
|
||||
} else if (mFrame >= maxFrame) {
|
||||
transformInfo->mTranslate.x = mTranslateValues[(xPart->mTranslateOffset + (maxFrame - 1))];
|
||||
} else {
|
||||
transformInfo->mTranslate.x = mTranslateValues[(xPart->mTranslateOffset + (int)getFrame())];
|
||||
transformInfo->mTranslate.x = mTranslateValues[(xPart->mTranslateOffset + (int)mFrame)];
|
||||
}
|
||||
yMaxFrame = yPart->mTranslateMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
maxFrame = yPart->mTranslateMaxFrame;
|
||||
if (mFrame < 0) {
|
||||
transformInfo->mTranslate.y = mTranslateValues[yPart->mTranslateOffset];
|
||||
} else if (getFrame() >= yMaxFrame) {
|
||||
transformInfo->mTranslate.y = mTranslateValues[(yPart->mTranslateOffset + (yMaxFrame - 1))];
|
||||
} else if (mFrame >= maxFrame) {
|
||||
transformInfo->mTranslate.y = mTranslateValues[(yPart->mTranslateOffset + (maxFrame - 1))];
|
||||
} else {
|
||||
transformInfo->mTranslate.y = mTranslateValues[(yPart->mTranslateOffset + (int)getFrame())];
|
||||
transformInfo->mTranslate.y = mTranslateValues[(yPart->mTranslateOffset + (int)mFrame)];
|
||||
}
|
||||
zMaxFrame = zPart->mTranslateMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
maxFrame = zPart->mTranslateMaxFrame;
|
||||
if (mFrame < 0) {
|
||||
transformInfo->mTranslate.z = mTranslateValues[zPart->mTranslateOffset];
|
||||
} else if (getFrame() >= zMaxFrame) {
|
||||
transformInfo->mTranslate.z = mTranslateValues[(zPart->mTranslateOffset + (zMaxFrame - 1))];
|
||||
} else if (mFrame >= maxFrame) {
|
||||
transformInfo->mTranslate.z = mTranslateValues[(zPart->mTranslateOffset + (maxFrame - 1))];
|
||||
} else {
|
||||
transformInfo->mTranslate.z = mTranslateValues[(zPart->mTranslateOffset + (int)getFrame())];
|
||||
transformInfo->mTranslate.z = mTranslateValues[(zPart->mTranslateOffset + (int)mFrame)];
|
||||
}
|
||||
}
|
||||
|
||||
void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
J3DTransformInfo* transformInfo) const {
|
||||
J3D_PANIC(268, param_1 < field_0x22, "Error : range over.");
|
||||
J3D_PANIC(269, transformInfo, "Error : null pointer.");
|
||||
u16 idx = param_1 * 3;
|
||||
J3DAnmTransformKeyTable* xInf = &mInfoTable[idx];
|
||||
J3DAnmTransformKeyTable* yInf = &mInfoTable[idx + 1];
|
||||
@@ -103,7 +151,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
transformInfo->mScale.x = mScaleValues[xInf->mScaleInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
transformInfo->mScale.x = J2DGetKeyFrameInterpolationf(
|
||||
transformInfo->mScale.x = J2DGetKeyFrameInterpolation<f32>(
|
||||
param_0, &xInf->mScaleInfo, &mScaleValues[xInf->mScaleInfo.mOffset]);
|
||||
}
|
||||
switch (yInf->mScaleInfo.mMaxFrame) {
|
||||
@@ -114,7 +162,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
transformInfo->mScale.y = mScaleValues[yInf->mScaleInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
transformInfo->mScale.y = J2DGetKeyFrameInterpolationf(
|
||||
transformInfo->mScale.y = J2DGetKeyFrameInterpolation<f32>(
|
||||
param_0, &yInf->mScaleInfo, &mScaleValues[yInf->mScaleInfo.mOffset]);
|
||||
}
|
||||
switch (zInf->mScaleInfo.mMaxFrame) {
|
||||
@@ -125,7 +173,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
transformInfo->mScale.z = mScaleValues[zInf->mScaleInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
transformInfo->mScale.z = J2DGetKeyFrameInterpolationf(
|
||||
transformInfo->mScale.z = J2DGetKeyFrameInterpolation<f32>(
|
||||
param_0, &zInf->mScaleInfo, &mScaleValues[zInf->mScaleInfo.mOffset]);
|
||||
}
|
||||
switch (xInf->mRotationInfo.mMaxFrame) {
|
||||
@@ -137,7 +185,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
break;
|
||||
default:
|
||||
transformInfo->mRotation.x =
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolations(
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolation<s16>(
|
||||
param_0, &xInf->mRotationInfo, &mRotationValues[xInf->mRotationInfo.mOffset]))
|
||||
<< field_0x24;
|
||||
}
|
||||
@@ -150,7 +198,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
break;
|
||||
default:
|
||||
transformInfo->mRotation.y =
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolations(
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolation<s16>(
|
||||
param_0, &yInf->mRotationInfo, &mRotationValues[yInf->mRotationInfo.mOffset]))
|
||||
<< field_0x24;
|
||||
}
|
||||
@@ -163,7 +211,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
break;
|
||||
default:
|
||||
transformInfo->mRotation.z =
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolations(
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolation<s16>(
|
||||
param_0, &zInf->mRotationInfo, &mRotationValues[zInf->mRotationInfo.mOffset]))
|
||||
<< field_0x24;
|
||||
}
|
||||
@@ -175,7 +223,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
transformInfo->mTranslate.x = mTranslateValues[xInf->mTranslateInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
transformInfo->mTranslate.x = J2DGetKeyFrameInterpolationf(
|
||||
transformInfo->mTranslate.x = J2DGetKeyFrameInterpolation<f32>(
|
||||
param_0, &xInf->mTranslateInfo, &mTranslateValues[xInf->mTranslateInfo.mOffset]);
|
||||
}
|
||||
switch (yInf->mTranslateInfo.mMaxFrame) {
|
||||
@@ -186,7 +234,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
transformInfo->mTranslate.y = mTranslateValues[yInf->mTranslateInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
transformInfo->mTranslate.y = J2DGetKeyFrameInterpolationf(
|
||||
transformInfo->mTranslate.y = J2DGetKeyFrameInterpolation<f32>(
|
||||
param_0, &yInf->mTranslateInfo, &mTranslateValues[yInf->mTranslateInfo.mOffset]);
|
||||
}
|
||||
switch (zInf->mTranslateInfo.mMaxFrame) {
|
||||
@@ -197,7 +245,7 @@ void J2DAnmTransformKey::calcTransform(f32 param_0, u16 param_1,
|
||||
transformInfo->mTranslate.z = mTranslateValues[zInf->mTranslateInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
transformInfo->mTranslate.z = J2DGetKeyFrameInterpolationf(
|
||||
transformInfo->mTranslate.z = J2DGetKeyFrameInterpolation<f32>(
|
||||
param_0, &zInf->mTranslateInfo, &mTranslateValues[zInf->mTranslateInfo.mOffset]);
|
||||
}
|
||||
}
|
||||
@@ -216,42 +264,46 @@ void J2DAnmColor::searchUpdateMaterialID(J2DScreen* pScreen) {
|
||||
}
|
||||
|
||||
void J2DAnmColorFull::getColor(u16 param_0, _GXColor* pColor) const {
|
||||
J3D_PANIC(432, param_0 < mUpdateMaterialNum, "Error : range over.");
|
||||
J3D_PANIC(433, pColor, "Error : null pointer.");
|
||||
J3DAnmColorFullTable* info = &mInfoTable[param_0];
|
||||
u16 maxFrame = info->mRMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
if (mFrame < 0) {
|
||||
pColor->r = mRValues[info->mROffset];
|
||||
} else if (getFrame() >= maxFrame) {
|
||||
} else if (mFrame >= maxFrame) {
|
||||
pColor->r = mRValues[info->mROffset + (maxFrame - 1)];
|
||||
} else {
|
||||
pColor->r = mRValues[info->mROffset + (int)getFrame()];
|
||||
pColor->r = mRValues[info->mROffset + (int)mFrame];
|
||||
}
|
||||
maxFrame = info->mGMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
if (mFrame < 0) {
|
||||
pColor->g = mGValues[info->mGOffset];
|
||||
} else if (getFrame() >= maxFrame) {
|
||||
} else if (mFrame >= maxFrame) {
|
||||
pColor->g = mGValues[info->mGOffset + (maxFrame - 1)];
|
||||
} else {
|
||||
pColor->g = mGValues[info->mGOffset + (int)getFrame()];
|
||||
pColor->g = mGValues[info->mGOffset + (int)mFrame];
|
||||
}
|
||||
maxFrame = info->mBMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
if (mFrame < 0) {
|
||||
pColor->b = mBValues[info->mBOffset];
|
||||
} else if (getFrame() >= maxFrame) {
|
||||
} else if (mFrame >= maxFrame) {
|
||||
pColor->b = mBValues[info->mBOffset + (maxFrame - 1)];
|
||||
} else {
|
||||
pColor->b = mBValues[info->mBOffset + (int)getFrame()];
|
||||
pColor->b = mBValues[info->mBOffset + (int)mFrame];
|
||||
}
|
||||
maxFrame = info->mAMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
if (mFrame < 0) {
|
||||
pColor->a = mAValues[info->mAOffset];
|
||||
} else if (getFrame() >= maxFrame) {
|
||||
} else if (mFrame >= maxFrame) {
|
||||
pColor->a = mAValues[info->mAOffset + (maxFrame - 1)];
|
||||
} else {
|
||||
pColor->a = mAValues[info->mAOffset + (int)getFrame()];
|
||||
pColor->a = mAValues[info->mAOffset + (int)mFrame];
|
||||
}
|
||||
}
|
||||
|
||||
void J2DAnmColorKey::getColor(u16 param_0, _GXColor* pColor) const {
|
||||
J3D_PANIC(490, param_0 < mUpdateMaterialNum, "Error : range over.");
|
||||
J3D_PANIC(491, pColor, "Error : null pointer.");
|
||||
J3DAnmColorKeyTable* info = &mInfoTable[param_0];
|
||||
f32 val;
|
||||
switch (info->mRInfo.mMaxFrame) {
|
||||
@@ -262,7 +314,7 @@ void J2DAnmColorKey::getColor(u16 param_0, _GXColor* pColor) const {
|
||||
pColor->r = mRValues[info->mRInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mRInfo,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mRInfo,
|
||||
&mRValues[info->mRInfo.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->r = 0;
|
||||
@@ -280,7 +332,7 @@ void J2DAnmColorKey::getColor(u16 param_0, _GXColor* pColor) const {
|
||||
pColor->g = mGValues[info->mGInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mGInfo,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mGInfo,
|
||||
&mGValues[info->mGInfo.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->g = 0;
|
||||
@@ -298,7 +350,7 @@ void J2DAnmColorKey::getColor(u16 param_0, _GXColor* pColor) const {
|
||||
pColor->b = mBValues[info->mBInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mBInfo,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mBInfo,
|
||||
&mBValues[info->mBInfo.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->b = 0;
|
||||
@@ -316,7 +368,7 @@ void J2DAnmColorKey::getColor(u16 param_0, _GXColor* pColor) const {
|
||||
pColor->a = mAValues[info->mAInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mAInfo,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mAInfo,
|
||||
&mAValues[info->mAInfo.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->a = 0;
|
||||
@@ -329,42 +381,44 @@ void J2DAnmColorKey::getColor(u16 param_0, _GXColor* pColor) const {
|
||||
}
|
||||
|
||||
void J2DAnmVtxColorFull::getColor(u8 param_0, u16 param_1, _GXColor* pColor) const {
|
||||
J3D_PANIC(597, pColor, "Error : null pointer.");
|
||||
J3DAnmColorFullTable* info = &mInfoTable[param_0][param_1];
|
||||
u16 maxFrame = info->mRMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
if (mFrame < 0) {
|
||||
pColor->r = mRValues[info->mROffset];
|
||||
} else if (getFrame() >= maxFrame) {
|
||||
} else if (mFrame >= maxFrame) {
|
||||
pColor->r = mRValues[info->mROffset + (maxFrame - 1)];
|
||||
} else {
|
||||
pColor->r = mRValues[info->mROffset + (int)getFrame()];
|
||||
pColor->r = mRValues[info->mROffset + (int)mFrame];
|
||||
}
|
||||
maxFrame = info->mGMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
if (mFrame < 0) {
|
||||
pColor->g = mGValues[info->mGOffset];
|
||||
} else if (getFrame() >= maxFrame) {
|
||||
} else if (mFrame >= maxFrame) {
|
||||
pColor->g = mGValues[info->mGOffset + (maxFrame - 1)];
|
||||
} else {
|
||||
pColor->g = mGValues[info->mGOffset + (int)getFrame()];
|
||||
pColor->g = mGValues[info->mGOffset + (int)mFrame];
|
||||
}
|
||||
maxFrame = info->mBMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
if (mFrame < 0) {
|
||||
pColor->b = mBValues[info->mBOffset];
|
||||
} else if (getFrame() >= maxFrame) {
|
||||
} else if (mFrame >= maxFrame) {
|
||||
pColor->b = mBValues[info->mBOffset + (maxFrame - 1)];
|
||||
} else {
|
||||
pColor->b = mBValues[info->mBOffset + (int)getFrame()];
|
||||
pColor->b = mBValues[info->mBOffset + (int)mFrame];
|
||||
}
|
||||
maxFrame = info->mAMaxFrame;
|
||||
if (getFrame() < 0) {
|
||||
if (mFrame < 0) {
|
||||
pColor->a = mAValues[info->mAOffset];
|
||||
} else if (getFrame() >= maxFrame) {
|
||||
} else if (mFrame >= maxFrame) {
|
||||
pColor->a = mAValues[info->mAOffset + (maxFrame - 1)];
|
||||
} else {
|
||||
pColor->a = mAValues[info->mAOffset + (int)getFrame()];
|
||||
pColor->a = mAValues[info->mAOffset + (int)mFrame];
|
||||
}
|
||||
}
|
||||
|
||||
void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, _GXColor* pColor) const {
|
||||
J3D_PANIC(658, pColor, "Error : null pointer.");
|
||||
J3DAnmColorKeyTable* info = &mInfoTable[param_0][param_1];
|
||||
f32 val;
|
||||
switch (info->mRInfo.mMaxFrame) {
|
||||
@@ -375,7 +429,7 @@ void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, _GXColor* pColor) cons
|
||||
pColor->r = mRValues[info->mRInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mRInfo,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mRInfo,
|
||||
&mRValues[info->mRInfo.mOffset]);
|
||||
if ((val <= 0)) {
|
||||
pColor->r = 0;
|
||||
@@ -393,7 +447,7 @@ void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, _GXColor* pColor) cons
|
||||
pColor->g = mGValues[info->mGInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mGInfo,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mGInfo,
|
||||
&mGValues[info->mGInfo.mOffset]);
|
||||
if (val <= 0) {
|
||||
pColor->g = 0;
|
||||
@@ -411,7 +465,7 @@ void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, _GXColor* pColor) cons
|
||||
pColor->b = mBValues[info->mBInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mBInfo,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mBInfo,
|
||||
&mBValues[info->mBInfo.mOffset]);
|
||||
if (val <= 0) {
|
||||
pColor->b = 0;
|
||||
@@ -429,7 +483,7 @@ void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, _GXColor* pColor) cons
|
||||
pColor->a = mAValues[info->mAInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mAInfo,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mAInfo,
|
||||
&mAValues[info->mAInfo.mOffset]);
|
||||
if (val <= 0) {
|
||||
pColor->a = 0;
|
||||
@@ -442,6 +496,8 @@ void J2DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, _GXColor* pColor) cons
|
||||
}
|
||||
|
||||
void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTInfo* pInfo) const {
|
||||
J3D_PANIC(766, param_1 < mUpdateMaterialNum, "Error : range over.");
|
||||
J3D_PANIC(767, pInfo, "Error : null pointer.");
|
||||
u16 idx = param_1 * 3;
|
||||
J3DAnmTransformKeyTable* xInf = &mInfoTable[idx];
|
||||
J3DAnmTransformKeyTable* yInf = &mInfoTable[idx + 1];
|
||||
@@ -454,7 +510,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI
|
||||
pInfo->mScaleX = mScaleValues[xInf->mScaleInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
pInfo->mScaleX = J2DGetKeyFrameInterpolationf(param_0, &xInf->mScaleInfo,
|
||||
pInfo->mScaleX = J2DGetKeyFrameInterpolation<f32>(param_0, &xInf->mScaleInfo,
|
||||
&mScaleValues[xInf->mScaleInfo.mOffset]);
|
||||
}
|
||||
switch (yInf->mScaleInfo.mMaxFrame) {
|
||||
@@ -465,7 +521,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI
|
||||
pInfo->mScaleY = mScaleValues[yInf->mScaleInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
pInfo->mScaleY = J2DGetKeyFrameInterpolationf(param_0, &yInf->mScaleInfo,
|
||||
pInfo->mScaleY = J2DGetKeyFrameInterpolation<f32>(param_0, &yInf->mScaleInfo,
|
||||
&mScaleValues[yInf->mScaleInfo.mOffset]);
|
||||
}
|
||||
switch (zInf->mRotationInfo.mMaxFrame) {
|
||||
@@ -477,7 +533,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI
|
||||
break;
|
||||
default:
|
||||
pInfo->mRotation =
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolations(
|
||||
static_cast<s32>(J2DGetKeyFrameInterpolation<s16>(
|
||||
param_0, &zInf->mRotationInfo, &mRotationValues[zInf->mRotationInfo.mOffset]))
|
||||
<< field_0x10;
|
||||
}
|
||||
@@ -489,7 +545,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI
|
||||
pInfo->mTranslationX = mTranslationValues[xInf->mTranslateInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
pInfo->mTranslationX = J2DGetKeyFrameInterpolationf(
|
||||
pInfo->mTranslationX = J2DGetKeyFrameInterpolation<f32>(
|
||||
param_0, &xInf->mTranslateInfo, &mTranslationValues[xInf->mTranslateInfo.mOffset]);
|
||||
}
|
||||
switch (yInf->mTranslateInfo.mMaxFrame) {
|
||||
@@ -500,7 +556,7 @@ void J2DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, J3DTextureSRTI
|
||||
pInfo->mTranslationY = mTranslationValues[yInf->mTranslateInfo.mOffset];
|
||||
break;
|
||||
default:
|
||||
pInfo->mTranslationY = J2DGetKeyFrameInterpolationf(
|
||||
pInfo->mTranslationY = J2DGetKeyFrameInterpolation<f32>(
|
||||
param_0, &yInf->mTranslateInfo, &mTranslationValues[yInf->mTranslateInfo.mOffset]);
|
||||
}
|
||||
}
|
||||
@@ -533,7 +589,7 @@ void J2DAnmTexPattern::searchUpdateMaterialID(J2DScreen* pScreen) {
|
||||
if (mTIMGPtrArray != NULL) {
|
||||
JUTResReference resRef;
|
||||
for (u16 i = 0; i < pScreen->mTexRes->mCount; i++) {
|
||||
s8* var1 = pScreen->mTexRes->getResReference(i);
|
||||
char* var1 = pScreen->mTexRes->getResReference(i);
|
||||
ResTIMG* var2 = NULL;
|
||||
if (var1 != NULL) {
|
||||
var2 = (ResTIMG*)resRef.getResource(var1, 'TIMG', NULL);
|
||||
@@ -544,11 +600,13 @@ void J2DAnmTexPattern::searchUpdateMaterialID(J2DScreen* pScreen) {
|
||||
}
|
||||
mTIMGPtrArray[i].mRes = var2;
|
||||
if (var2 != NULL && var2->indexTexture) {
|
||||
JUTPalette* palette =
|
||||
new JUTPalette(GX_TLUT0, (_GXTlutFmt)var2->colorFormat,
|
||||
(JUTTransparency)var2->alphaEnabled, var2->numColors,
|
||||
((u8*)var2) + var2->paletteOffset);
|
||||
mTIMGPtrArray[i].mPalette = palette;
|
||||
mTIMGPtrArray[i].mPalette = new JUTPalette(
|
||||
GX_TLUT0,
|
||||
GXTlutFmt(var2->colorFormat),
|
||||
JUTTransparency(var2->alphaEnabled),
|
||||
var2->numColors,
|
||||
((u8*)var2) + var2->paletteOffset
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -557,49 +615,56 @@ void J2DAnmTexPattern::searchUpdateMaterialID(J2DScreen* pScreen) {
|
||||
|
||||
void J2DAnmTexPattern::getTexNo(u16 param_0, u16* pTexNo) const {
|
||||
u16 maxFrame = mAnmTable[param_0].mMaxFrame;
|
||||
f32 frame = getFrame();
|
||||
if (frame < 0) {
|
||||
J3D_PANIC(1024, param_0 < mUpdateMaterialNum, "Error : range over.");
|
||||
J3D_PANIC(1025, pTexNo, "Error : null pointer.");
|
||||
if (mFrame < 0) {
|
||||
*pTexNo = mValues[mAnmTable[param_0].mOffset];
|
||||
} else if (frame >= maxFrame) {
|
||||
} else if (mFrame >= maxFrame) {
|
||||
*pTexNo = mValues[mAnmTable[param_0].mOffset + (maxFrame - 1)];
|
||||
} else {
|
||||
*pTexNo = mValues[mAnmTable[param_0].mOffset + (int)frame];
|
||||
*pTexNo = mValues[mAnmTable[param_0].mOffset + (int)mFrame];
|
||||
}
|
||||
}
|
||||
|
||||
ResTIMG* J2DAnmTexPattern::getResTIMG(u16 param_0) const {
|
||||
if (mTIMGPtrArray == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
u16 texNo;
|
||||
this->getTexNo(param_0, &texNo);
|
||||
return mTIMGPtrArray[texNo].mRes;
|
||||
}
|
||||
u16 maxFrame = mAnmTable[param_0].mMaxFrame;
|
||||
J3D_PANIC(1053, param_0 < mUpdateMaterialNum, "Error : range over.");
|
||||
|
||||
u16 texNo;
|
||||
this->getTexNo(param_0, &texNo);
|
||||
return mTIMGPtrArray[texNo].mRes;
|
||||
}
|
||||
|
||||
JUTPalette* J2DAnmTexPattern::getPalette(u16 param_0) const {
|
||||
if (mTIMGPtrArray == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
u16 texNo;
|
||||
this->getTexNo(param_0, &texNo);
|
||||
return mTIMGPtrArray[texNo].mPalette;
|
||||
}
|
||||
u16 maxFrame = mAnmTable[param_0].mMaxFrame;
|
||||
J3D_PANIC(1076, param_0 < mUpdateMaterialNum, "Error : range over.");
|
||||
u16 texNo;
|
||||
this->getTexNo(param_0, &texNo);
|
||||
return mTIMGPtrArray[texNo].mPalette;
|
||||
}
|
||||
|
||||
void J2DAnmVisibilityFull::getVisibility(u16 param_0, u8* pOut) const {
|
||||
u16 maxFrame = mTable[param_0]._0;
|
||||
if (getFrame() < 0) {
|
||||
J3D_PANIC(1094, param_0 < field_0x10, "Error : range over.");
|
||||
J3D_PANIC(1095, pOut, "Error : null pointer.");
|
||||
if (mFrame < 0) {
|
||||
*pOut = mValues[mTable[param_0]._2];
|
||||
} else if (getFrame() >= maxFrame) {
|
||||
} else if (mFrame >= maxFrame) {
|
||||
*pOut = mValues[mTable[param_0]._2 + (maxFrame - 1)];
|
||||
} else {
|
||||
int frame = getFrame();
|
||||
*pOut = mValues[mTable[param_0]._2 + frame];
|
||||
*pOut = mValues[mTable[param_0]._2 + (int)mFrame];
|
||||
}
|
||||
}
|
||||
|
||||
void J2DAnmTevRegKey::getTevColorReg(u16 param_0, _GXColorS10* pColor) const {
|
||||
void J2DAnmTevRegKey::getTevColorReg(u16 param_0, GXColorS10* pColor) const {
|
||||
J3D_PANIC(1116, param_0 < mCRegUpdateMaterialNum, "Error : range over.");
|
||||
J3D_PANIC(1117, pColor, "Error : null pointer.");
|
||||
J3DAnmCRegKeyTable* info = &mAnmCRegKeyTable[param_0];
|
||||
f32 val;
|
||||
switch (info->mRTable.mMaxFrame) {
|
||||
@@ -610,7 +675,7 @@ void J2DAnmTevRegKey::getTevColorReg(u16 param_0, _GXColorS10* pColor) const {
|
||||
pColor->r = mCRValues[info->mRTable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mRTable,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mRTable,
|
||||
&mCRValues[info->mRTable.mOffset]);
|
||||
if (val < -0x400) {
|
||||
pColor->r = -0x400;
|
||||
@@ -628,7 +693,7 @@ void J2DAnmTevRegKey::getTevColorReg(u16 param_0, _GXColorS10* pColor) const {
|
||||
pColor->g = mCGValues[info->mGTable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mGTable,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mGTable,
|
||||
&mCGValues[info->mGTable.mOffset]);
|
||||
if (val < -0x400) {
|
||||
pColor->g = -0x400;
|
||||
@@ -646,7 +711,7 @@ void J2DAnmTevRegKey::getTevColorReg(u16 param_0, _GXColorS10* pColor) const {
|
||||
pColor->b = mCBValues[info->mBTable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mBTable,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mBTable,
|
||||
&mCBValues[info->mBTable.mOffset]);
|
||||
if (val < -0x400) {
|
||||
pColor->b = -0x400;
|
||||
@@ -664,7 +729,7 @@ void J2DAnmTevRegKey::getTevColorReg(u16 param_0, _GXColorS10* pColor) const {
|
||||
pColor->a = mCAValues[info->mATable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mATable,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mATable,
|
||||
&mCAValues[info->mATable.mOffset]);
|
||||
if (val < -0x400) {
|
||||
pColor->a = -0x400;
|
||||
@@ -676,7 +741,9 @@ void J2DAnmTevRegKey::getTevColorReg(u16 param_0, _GXColorS10* pColor) const {
|
||||
}
|
||||
}
|
||||
|
||||
void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, _GXColor* pColor) const {
|
||||
void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, GXColor* pColor) const {
|
||||
J3D_PANIC(1222, param_0 < mKRegUpdateMaterialNum, "Error : range over.");
|
||||
J3D_PANIC(1223, pColor, "Error : null pointer.");
|
||||
J3DAnmKRegKeyTable* info = &mAnmKRegKeyTable[param_0];
|
||||
f32 val;
|
||||
switch (info->mRTable.mMaxFrame) {
|
||||
@@ -687,7 +754,7 @@ void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, _GXColor* pColor) const {
|
||||
pColor->r = mKRValues[info->mRTable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mRTable,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mRTable,
|
||||
&mKRValues[info->mRTable.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->r = 0;
|
||||
@@ -705,7 +772,7 @@ void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, _GXColor* pColor) const {
|
||||
pColor->g = mKGValues[info->mGTable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mGTable,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mGTable,
|
||||
&mKGValues[info->mGTable.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->g = 0;
|
||||
@@ -723,7 +790,7 @@ void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, _GXColor* pColor) const {
|
||||
pColor->b = mKBValues[info->mBTable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mBTable,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mBTable,
|
||||
&mKBValues[info->mBTable.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->b = 0;
|
||||
@@ -741,7 +808,7 @@ void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, _GXColor* pColor) const {
|
||||
pColor->a = mKAValues[info->mATable.mOffset];
|
||||
break;
|
||||
default:
|
||||
val = J2DGetKeyFrameInterpolations(getFrame(), &info->mATable,
|
||||
val = J2DGetKeyFrameInterpolation<s16>(mFrame, &info->mATable,
|
||||
&mKAValues[info->mATable.mOffset]);
|
||||
if (val < 0) {
|
||||
pColor->a = 0;
|
||||
@@ -755,7 +822,7 @@ void J2DAnmTevRegKey::getTevKonstReg(u16 param_0, _GXColor* pColor) const {
|
||||
|
||||
void J2DAnmTevRegKey::searchUpdateMaterialID(J2DScreen* pScreen) {
|
||||
if (pScreen != NULL && pScreen->mNameTable != NULL) {
|
||||
for (u16 i = 0; i < mCRegUpdateMaterialNum; i++) {
|
||||
for (u16 i = 0; i < getCRegUpdateMaterialNum(); i++) {
|
||||
s32 idx = pScreen->mNameTable->getIndex(mCRegNameTab.getName(i));
|
||||
if (idx != -1) {
|
||||
mCRegUpdateMaterialID[i] = idx;
|
||||
@@ -763,7 +830,7 @@ void J2DAnmTevRegKey::searchUpdateMaterialID(J2DScreen* pScreen) {
|
||||
mCRegUpdateMaterialID[i] = 0xFFFF;
|
||||
}
|
||||
}
|
||||
for (u16 i = 0; i < mKRegUpdateMaterialNum; i++) {
|
||||
for (u16 i = 0; i < getKRegUpdateMaterialNum(); i++) {
|
||||
s32 idx = pScreen->mNameTable->getIndex(mKRegNameTab.getName(i));
|
||||
if (idx != -1) {
|
||||
mKRegUpdateMaterialID[i] = idx;
|
||||
@@ -773,106 +840,3 @@ void J2DAnmTevRegKey::searchUpdateMaterialID(J2DScreen* pScreen) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// should be J2DGetKeyFrameInterpolation<s16>
|
||||
f32 J2DGetKeyFrameInterpolations(f32 param_0, J3DAnmKeyTableBase* param_1, s16* param_2) {
|
||||
if (param_0 < param_2[0]) {
|
||||
return param_2[1];
|
||||
} else {
|
||||
if (param_1->mType == 0) {
|
||||
if (param_2[(param_1->mMaxFrame - 1) * 3] <= param_0) {
|
||||
return param_2[(param_1->mMaxFrame - 1) * 3 + 1];
|
||||
} else {
|
||||
u32 tmp = param_1->mMaxFrame;
|
||||
while (tmp > 1) {
|
||||
u32 halfTmp = tmp / 2;
|
||||
u32 upIdx = halfTmp * 3;
|
||||
if (param_0 >= param_2[upIdx]) {
|
||||
param_2 = param_2 + upIdx;
|
||||
tmp -= halfTmp;
|
||||
} else {
|
||||
tmp = halfTmp;
|
||||
}
|
||||
}
|
||||
return J2DHermiteInterpolation<s16>(param_0, ¶m_2[0], ¶m_2[1], ¶m_2[2],
|
||||
¶m_2[3], ¶m_2[4], ¶m_2[5]);
|
||||
}
|
||||
} else {
|
||||
if (param_2[(param_1->mMaxFrame - 1) * 4] <= param_0) {
|
||||
return param_2[(param_1->mMaxFrame - 1) * 4 + 1];
|
||||
} else {
|
||||
u32 tmp = param_1->mMaxFrame;
|
||||
while (tmp > 1) {
|
||||
u32 halfTmp = tmp / 2;
|
||||
u32 upIdx = halfTmp * 4;
|
||||
if (param_0 >= param_2[upIdx]) {
|
||||
param_2 = param_2 + upIdx;
|
||||
tmp -= halfTmp;
|
||||
} else {
|
||||
tmp = halfTmp;
|
||||
}
|
||||
}
|
||||
return J2DHermiteInterpolation<s16>(param_0, ¶m_2[0], ¶m_2[1], ¶m_2[3],
|
||||
¶m_2[4], ¶m_2[5], ¶m_2[6]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// should be J2DGetKeyFrameInterpolation<s16>
|
||||
f32 J2DGetKeyFrameInterpolationf(f32 param_0, J3DAnmKeyTableBase* param_1, f32* param_2) {
|
||||
if (param_0 < param_2[0]) {
|
||||
return param_2[1];
|
||||
} else {
|
||||
if (param_1->mType == 0) {
|
||||
if (param_2[(param_1->mMaxFrame - 1) * 3] <= param_0) {
|
||||
return param_2[(param_1->mMaxFrame - 1) * 3 + 1];
|
||||
} else {
|
||||
u32 tmp = param_1->mMaxFrame;
|
||||
while (tmp > 1) {
|
||||
u32 halfTmp = tmp / 2;
|
||||
u32 upIdx = halfTmp * 3;
|
||||
if (param_0 >= param_2[upIdx]) {
|
||||
param_2 = param_2 + upIdx;
|
||||
tmp -= halfTmp;
|
||||
} else {
|
||||
tmp = halfTmp;
|
||||
}
|
||||
}
|
||||
return J2DHermiteInterpolation<f32>(param_0, ¶m_2[0], ¶m_2[1], ¶m_2[2],
|
||||
¶m_2[3], ¶m_2[4], ¶m_2[5]);
|
||||
}
|
||||
} else {
|
||||
if (param_2[(param_1->mMaxFrame - 1) * 4] <= param_0) {
|
||||
return param_2[(param_1->mMaxFrame - 1) * 4 + 1];
|
||||
} else {
|
||||
u32 tmp = param_1->mMaxFrame;
|
||||
while (tmp > 1) {
|
||||
u32 halfTmp = tmp / 2;
|
||||
u32 upIdx = halfTmp * 4;
|
||||
if (param_0 >= param_2[upIdx]) {
|
||||
param_2 = param_2 + upIdx;
|
||||
tmp -= halfTmp;
|
||||
} else {
|
||||
tmp = halfTmp;
|
||||
}
|
||||
}
|
||||
return J2DHermiteInterpolation<f32>(param_0, ¶m_2[0], ¶m_2[1], ¶m_2[3],
|
||||
¶m_2[4], ¶m_2[5], ¶m_2[6]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
J2DAnmTexPattern::J2DAnmTexPatternTIMGPointer::J2DAnmTexPatternTIMGPointer() {
|
||||
mRes = NULL;
|
||||
mPalette = NULL;
|
||||
}
|
||||
|
||||
J2DAnmTexPattern::J2DAnmTexPatternTIMGPointer::~J2DAnmTexPatternTIMGPointer() {
|
||||
delete mPalette;
|
||||
}
|
||||
|
||||
static void dummyDelete(J2DAnmTexPattern* pattern) {
|
||||
delete pattern;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
J2DAnmBase* J2DAnmLoaderDataBase::load(void const* p_data) {
|
||||
const J3DAnmDataHeader* hdr = (const J3DAnmDataHeader*)p_data;
|
||||
J3D_PANIC(38, p_data, "Error : null pointer.");
|
||||
|
||||
if (hdr == NULL) {
|
||||
if (p_data == NULL) {
|
||||
return NULL;
|
||||
} else if (hdr->mMagic == 'J3D1') {
|
||||
switch (hdr->mType) {
|
||||
@@ -27,6 +28,7 @@ J2DAnmBase* J2DAnmLoaderDataBase::load(void const* p_data) {
|
||||
break;
|
||||
}
|
||||
case 'blk1':
|
||||
OS_REPORT("J2DAnmLoader: this is a J3D Binary that cannot use J2D.\n");
|
||||
return NULL;
|
||||
case 'btk1': {
|
||||
J2DAnmKeyLoader_v15 loader;
|
||||
@@ -70,24 +72,32 @@ J2DAnmBase* J2DAnmLoaderDataBase::load(void const* p_data) {
|
||||
break;
|
||||
}
|
||||
case 'bla1':
|
||||
OS_REPORT("J2DAnmLoader: this is a J3D Binary that cannot use J2D.\n");
|
||||
return NULL;
|
||||
case 'bxa1': {
|
||||
J2DAnmFullLoader_v15 loader;
|
||||
loader.mpResource = new J2DAnmVtxColorFull();
|
||||
return (J2DAnmBase*)loader.load(p_data);
|
||||
}
|
||||
default:
|
||||
OS_REPORT("J2DAnmLoader: this is not a J3D Binary.\n");
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void dummy() {
|
||||
OS_REPORT("J3DAnmLoader: this is not a J3D Binary.\n");
|
||||
}
|
||||
|
||||
J2DAnmKeyLoader_v15::J2DAnmKeyLoader_v15() {}
|
||||
|
||||
J2DAnmKeyLoader_v15::~J2DAnmKeyLoader_v15() {}
|
||||
|
||||
void* J2DAnmKeyLoader_v15::load(void const* p_data) {
|
||||
J3D_PANIC(317, p_data, "Error : null pointer.");
|
||||
const J3DAnmDataHeader* hdr = (const J3DAnmDataHeader*)p_data;
|
||||
const J3DAnmDataBlockHeader* dataPtr = &hdr->mFirst;
|
||||
|
||||
@@ -108,6 +118,9 @@ void* J2DAnmKeyLoader_v15::load(void const* p_data) {
|
||||
case 'TRK1':
|
||||
readAnmTevReg((J3DAnmTevRegKeyData*)dataPtr);
|
||||
break;
|
||||
default:
|
||||
OS_REPORT("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
dataPtr = (J3DAnmDataBlockHeader*)((s32)dataPtr + dataPtr->mNextOffset);
|
||||
}
|
||||
@@ -116,6 +129,7 @@ void* J2DAnmKeyLoader_v15::load(void const* p_data) {
|
||||
}
|
||||
|
||||
void J2DAnmKeyLoader_v15::setResource(J2DAnmBase* p_anm, void const* p_data) {
|
||||
J3D_PANIC(355, p_data, "Error : null pointer.");
|
||||
const J3DAnmDataHeader* hdr = (const J3DAnmDataHeader*)p_data;
|
||||
const J3DAnmDataBlockHeader* dataPtr = &hdr->mFirst;
|
||||
|
||||
@@ -147,17 +161,23 @@ void J2DAnmKeyLoader_v15::setResource(J2DAnmBase* p_anm, void const* p_data) {
|
||||
setAnmVtxColor((J2DAnmVtxColorKey*)p_anm, (J3DAnmVtxColorKeyData*)dataPtr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
OS_REPORT("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
dataPtr = (J3DAnmDataBlockHeader*)((s32)dataPtr + dataPtr->mNextOffset);
|
||||
}
|
||||
}
|
||||
|
||||
void J2DAnmKeyLoader_v15::readAnmTransform(J3DAnmTransformKeyData const* p_data) {
|
||||
setAnmTransform((J2DAnmTransformKey*)mpResource, p_data);
|
||||
J2DAnmTransformKey* p_anm = (J2DAnmTransformKey*)mpResource;
|
||||
setAnmTransform(p_anm, p_data);
|
||||
}
|
||||
|
||||
void J2DAnmKeyLoader_v15::setAnmTransform(J2DAnmTransformKey* p_anm,
|
||||
J3DAnmTransformKeyData const* p_data) {
|
||||
J3D_PANIC(439, p_anm, "Error : null pointer.");
|
||||
J3D_PANIC(440, p_data, "Error : null pointer.");
|
||||
p_anm->field_0x22 = p_data->field_0xc;
|
||||
p_anm->mFrameMax = p_data->mFrameMax;
|
||||
p_anm->field_0x4 = p_data->field_0x8;
|
||||
@@ -172,11 +192,14 @@ void J2DAnmKeyLoader_v15::setAnmTransform(J2DAnmTransformKey* p_anm,
|
||||
}
|
||||
|
||||
void J2DAnmKeyLoader_v15::readAnmTextureSRT(J3DAnmTextureSRTKeyData const* p_data) {
|
||||
setAnmTextureSRT((J2DAnmTextureSRTKey*)mpResource, p_data);
|
||||
J2DAnmTextureSRTKey* p_anm = (J2DAnmTextureSRTKey*)mpResource;
|
||||
setAnmTextureSRT(p_anm, p_data);
|
||||
}
|
||||
|
||||
void J2DAnmKeyLoader_v15::setAnmTextureSRT(J2DAnmTextureSRTKey* p_anm,
|
||||
J3DAnmTextureSRTKeyData const* p_data) {
|
||||
J3D_PANIC(480, p_anm, "Error : null pointer.");
|
||||
J3D_PANIC(481, p_data, "Error : null pointer.");
|
||||
p_anm->mUpdateMaterialNum = p_data->field_0xc;
|
||||
p_anm->mFrameMax = p_data->field_0xa;
|
||||
p_anm->field_0x4 = p_data->field_0x8;
|
||||
@@ -226,10 +249,13 @@ void J2DAnmKeyLoader_v15::setAnmTextureSRT(J2DAnmTextureSRTKey* p_anm,
|
||||
}
|
||||
|
||||
void J2DAnmKeyLoader_v15::readAnmColor(J3DAnmColorKeyData const* p_data) {
|
||||
setAnmColor((J2DAnmColorKey*)mpResource, p_data);
|
||||
J2DAnmColorKey* p_anm = (J2DAnmColorKey*)mpResource;
|
||||
setAnmColor(p_anm, p_data);
|
||||
}
|
||||
|
||||
void J2DAnmKeyLoader_v15::setAnmColor(J2DAnmColorKey* p_anm, J3DAnmColorKeyData const* p_data) {
|
||||
J3D_PANIC(573, p_anm, "Error : null pointer.");
|
||||
J3D_PANIC(574, p_data, "Error : null pointer.");
|
||||
p_anm->mFrameMax = p_data->mFrameMax;
|
||||
p_anm->field_0x4 = p_data->field_0x8;
|
||||
p_anm->mFrame = 0;
|
||||
@@ -251,11 +277,14 @@ void J2DAnmKeyLoader_v15::setAnmColor(J2DAnmColorKey* p_anm, J3DAnmColorKeyData
|
||||
}
|
||||
|
||||
void J2DAnmKeyLoader_v15::readAnmVtxColor(J3DAnmVtxColorKeyData const* p_data) {
|
||||
setAnmVtxColor((J2DAnmVtxColorKey*)mpResource, p_data);
|
||||
J2DAnmVtxColorKey* p_anm = (J2DAnmVtxColorKey*)mpResource;
|
||||
setAnmVtxColor(p_anm, p_data);
|
||||
}
|
||||
|
||||
void J2DAnmKeyLoader_v15::setAnmVtxColor(J2DAnmVtxColorKey* p_anm,
|
||||
J3DAnmVtxColorKeyData const* p_data) {
|
||||
J3D_PANIC(628, p_anm, "Error : null pointer.");
|
||||
J3D_PANIC(629, p_data, "Error : null pointer.");
|
||||
p_anm->mFrameMax = p_data->mFrameMax;
|
||||
p_anm->field_0x4 = p_data->field_0x8;
|
||||
p_anm->mFrame = 0;
|
||||
@@ -280,6 +309,7 @@ void J2DAnmKeyLoader_v15::setAnmVtxColor(J2DAnmVtxColorKey* p_anm,
|
||||
}
|
||||
|
||||
void* J2DAnmFullLoader_v15::load(void const* p_data) {
|
||||
J3D_PANIC(670, p_data, "Error : null pointer.");
|
||||
const J3DAnmDataHeader* hdr = (const J3DAnmDataHeader*)p_data;
|
||||
const J3DAnmDataBlockHeader* dataPtr = &hdr->mFirst;
|
||||
|
||||
@@ -300,6 +330,9 @@ void* J2DAnmFullLoader_v15::load(void const* p_data) {
|
||||
case 'VCF1':
|
||||
readAnmVtxColor((J3DAnmVtxColorFullData*)dataPtr);
|
||||
break;
|
||||
default:
|
||||
OS_REPORT("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
dataPtr = (J3DAnmDataBlockHeader*)((s32)dataPtr + dataPtr->mNextOffset);
|
||||
}
|
||||
@@ -307,6 +340,7 @@ void* J2DAnmFullLoader_v15::load(void const* p_data) {
|
||||
}
|
||||
|
||||
void J2DAnmFullLoader_v15::setResource(J2DAnmBase* p_anm, void const* p_data) {
|
||||
J3D_PANIC(710, p_data, "Error : null pointer.");
|
||||
const J3DAnmDataHeader* hdr = (const J3DAnmDataHeader*)p_data;
|
||||
const J3DAnmDataBlockHeader* dataPtr = &hdr->mFirst;
|
||||
|
||||
@@ -334,6 +368,9 @@ void J2DAnmFullLoader_v15::setResource(J2DAnmBase* p_anm, void const* p_data) {
|
||||
if (p_anm->getKind() == KIND_VTX_COLOR)
|
||||
setAnmVtxColor((J2DAnmVtxColorFull*)p_anm, (J3DAnmVtxColorFullData*)dataPtr);
|
||||
break;
|
||||
default:
|
||||
OS_REPORT("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
dataPtr = (J3DAnmDataBlockHeader*)((s32)dataPtr + dataPtr->mNextOffset);
|
||||
}
|
||||
@@ -344,11 +381,14 @@ J2DAnmFullLoader_v15::J2DAnmFullLoader_v15() {}
|
||||
J2DAnmFullLoader_v15::~J2DAnmFullLoader_v15() {}
|
||||
|
||||
void J2DAnmFullLoader_v15::readAnmTransform(J3DAnmTransformFullData const* p_data) {
|
||||
setAnmTransform((J2DAnmTransformFull*)mpResource, p_data);
|
||||
J2DAnmTransformFull* p_anm = (J2DAnmTransformFull*)mpResource;
|
||||
setAnmTransform(p_anm, p_data);
|
||||
}
|
||||
|
||||
void J2DAnmFullLoader_v15::setAnmTransform(J2DAnmTransformFull* p_anm,
|
||||
J3DAnmTransformFullData const* p_data) {
|
||||
J3D_PANIC(813, p_anm, "Error : null pointer.");
|
||||
J3D_PANIC(814, p_data, "Error : null pointer.");
|
||||
p_anm->field_0x22 = p_data->field_0xc;
|
||||
p_anm->mFrameMax = p_data->mFrameMax;
|
||||
p_anm->field_0x4 = p_data->field_0x8;
|
||||
@@ -361,10 +401,13 @@ void J2DAnmFullLoader_v15::setAnmTransform(J2DAnmTransformFull* p_anm,
|
||||
}
|
||||
|
||||
void J2DAnmFullLoader_v15::readAnmColor(J3DAnmColorFullData const* p_data) {
|
||||
setAnmColor((J2DAnmColorFull*)mpResource, p_data);
|
||||
J2DAnmColorFull* p_anm = (J2DAnmColorFull*)mpResource;
|
||||
setAnmColor(p_anm, p_data);
|
||||
}
|
||||
|
||||
void J2DAnmFullLoader_v15::setAnmColor(J2DAnmColorFull* p_anm, J3DAnmColorFullData const* p_data) {
|
||||
J3D_PANIC(857, p_anm, "Error : null pointer.");
|
||||
J3D_PANIC(858, p_data, "Error : null pointer.");
|
||||
p_anm->mFrameMax = p_data->mFrameMax;
|
||||
p_anm->field_0x4 = p_data->field_0x8;
|
||||
p_anm->mFrame = 0;
|
||||
@@ -382,11 +425,14 @@ void J2DAnmFullLoader_v15::setAnmColor(J2DAnmColorFull* p_anm, J3DAnmColorFullDa
|
||||
}
|
||||
|
||||
void J2DAnmFullLoader_v15::readAnmTexPattern(J3DAnmTexPatternFullData const* p_data) {
|
||||
setAnmTexPattern((J2DAnmTexPattern*)mpResource, p_data);
|
||||
J2DAnmTexPattern* p_anm = (J2DAnmTexPattern*)mpResource;
|
||||
setAnmTexPattern(p_anm, p_data);
|
||||
}
|
||||
|
||||
void J2DAnmFullLoader_v15::setAnmTexPattern(J2DAnmTexPattern* p_anm,
|
||||
J3DAnmTexPatternFullData const* p_data) {
|
||||
J3D_PANIC(906, p_anm, "Error : null pointer.");
|
||||
J3D_PANIC(907, p_data, "Error : null pointer.");
|
||||
p_anm->mFrameMax = p_data->mFrameMax;
|
||||
p_anm->field_0x4 = p_data->field_0x8;
|
||||
p_anm->mFrame = 0;
|
||||
@@ -402,10 +448,13 @@ void J2DAnmFullLoader_v15::setAnmTexPattern(J2DAnmTexPattern* p_anm,
|
||||
}
|
||||
|
||||
void J2DAnmKeyLoader_v15::readAnmTevReg(J3DAnmTevRegKeyData const* p_data) {
|
||||
setAnmTevReg((J2DAnmTevRegKey*)mpResource, p_data);
|
||||
J2DAnmTevRegKey* p_anm = (J2DAnmTevRegKey*)mpResource;
|
||||
setAnmTevReg(p_anm, p_data);
|
||||
}
|
||||
|
||||
void J2DAnmKeyLoader_v15::setAnmTevReg(J2DAnmTevRegKey* p_anm, J3DAnmTevRegKeyData const* p_data) {
|
||||
J3D_PANIC(955, p_anm, "Error : null pointer.");
|
||||
J3D_PANIC(956, p_data, "Error : null pointer.");
|
||||
p_anm->mFrameMax = p_data->mFrameMax;
|
||||
p_anm->field_0x4 = p_data->field_0x8;
|
||||
p_anm->mFrame = 0;
|
||||
@@ -442,11 +491,14 @@ void J2DAnmKeyLoader_v15::setAnmTevReg(J2DAnmTevRegKey* p_anm, J3DAnmTevRegKeyDa
|
||||
}
|
||||
|
||||
void J2DAnmFullLoader_v15::readAnmVisibility(J3DAnmVisibilityFullData const* p_data) {
|
||||
setAnmVisibility((J2DAnmVisibilityFull*)mpResource, p_data);
|
||||
J2DAnmVisibilityFull* p_anm = (J2DAnmVisibilityFull*)mpResource;
|
||||
setAnmVisibility(p_anm, p_data);
|
||||
}
|
||||
|
||||
void J2DAnmFullLoader_v15::setAnmVisibility(J2DAnmVisibilityFull* p_anm,
|
||||
J3DAnmVisibilityFullData const* p_data) {
|
||||
J3D_PANIC(1025, p_anm, "Error : null pointer.");
|
||||
J3D_PANIC(1026, p_data, "Error : null pointer.");
|
||||
p_anm->mFrameMax = p_data->mFrameMax;
|
||||
p_anm->field_0x4 = p_data->field_0x8;
|
||||
p_anm->mFrame = 0;
|
||||
@@ -458,11 +510,14 @@ void J2DAnmFullLoader_v15::setAnmVisibility(J2DAnmVisibilityFull* p_anm,
|
||||
}
|
||||
|
||||
void J2DAnmFullLoader_v15::readAnmVtxColor(J3DAnmVtxColorFullData const* p_data) {
|
||||
setAnmVtxColor((J2DAnmVtxColorFull*)mpResource, p_data);
|
||||
J2DAnmVtxColorFull* p_anm = (J2DAnmVtxColorFull*)mpResource;
|
||||
setAnmVtxColor(p_anm, p_data);
|
||||
}
|
||||
|
||||
void J2DAnmFullLoader_v15::setAnmVtxColor(J2DAnmVtxColorFull* p_anm,
|
||||
J3DAnmVtxColorFullData const* p_data) {
|
||||
J3D_PANIC(1070, p_anm, "Error : null pointer.");
|
||||
J3D_PANIC(1071, p_data, "Error : null pointer.");
|
||||
p_anm->mFrameMax = p_data->mFrameMax;
|
||||
p_anm->field_0x4 = p_data->field_0x8;
|
||||
p_anm->mFrame = 0;
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
#include <string>
|
||||
|
||||
void* J2DDataManage::get(char const* name) {
|
||||
for (J2DataManageLink* link = mList; link != NULL; link = link->mNext) {
|
||||
J2DataManageLink* link;
|
||||
for (link = mList; link != NULL; link = link->mNext) {
|
||||
if (strcmp(link->mName, name) == 0) {
|
||||
return link->mData;
|
||||
}
|
||||
@@ -19,26 +20,26 @@ void* J2DDataManage::get(JSUInputStream* inputStream) {
|
||||
|
||||
if (nameLen == 0) {
|
||||
return NULL;
|
||||
} else {
|
||||
char nameBuffer[257];
|
||||
inputStream->read(&nameBuffer, nameLen);
|
||||
nameBuffer[nameLen] = 0;
|
||||
return this->get(nameBuffer);
|
||||
}
|
||||
|
||||
char nameBuffer[257];
|
||||
inputStream->read(&nameBuffer, nameLen);
|
||||
nameBuffer[nameLen] = 0;
|
||||
return this->get(nameBuffer);
|
||||
}
|
||||
|
||||
s8* J2DResReference::getResReference(u16 idx) const {
|
||||
char* J2DResReference::getResReference(u16 idx) const {
|
||||
if (mCount <= idx || idx == 0xFFFF) {
|
||||
return NULL;
|
||||
} else {
|
||||
return (((s8*)this) + mOffsets[idx]);
|
||||
}
|
||||
u16 offset = mOffsets[idx];
|
||||
return ((char*)this) + offset;
|
||||
}
|
||||
|
||||
char* J2DResReference::getName(u16 idx) const {
|
||||
static char p_name[257];
|
||||
|
||||
s8* resRef = this->getResReference(idx);
|
||||
char* resRef = (char*)this->getResReference(idx);
|
||||
|
||||
if (resRef == NULL) {
|
||||
p_name[0] = 0;
|
||||
|
||||
@@ -76,11 +76,13 @@ void J2DTexGenBlock::setTexMtx(u32 param_0, J2DTexMtx& param_1) {
|
||||
|
||||
void J2DTexGenBlock::getTexMtx(u32 param_0, J2DTexMtx& param_1) {
|
||||
J3D_PANIC(123, param_0 < 8, "Error : range over.");
|
||||
|
||||
if (mTexMtx[param_0]) {
|
||||
J2DTexMtxInfo& texMtxInfo = mTexMtx[param_0]->getTexMtxInfo();
|
||||
param_1.setTexMtxInfo(texMtxInfo);
|
||||
|
||||
if (!mTexMtx[param_0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
J2DTexMtxInfo& texMtxInfo = mTexMtx[param_0]->getTexMtxInfo();
|
||||
param_1.setTexMtxInfo(texMtxInfo);
|
||||
}
|
||||
|
||||
JUTTexture* J2DTevBlock::getTexture(u32) {
|
||||
@@ -349,6 +351,7 @@ void J2DTevBlock1::shiftDeleteFlag(u8, bool) {
|
||||
|
||||
void J2DTevBlock1::setGX() {
|
||||
loadTexture(GX_TEXMAP0, 0);
|
||||
(void)bool(mFont);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, (GXTexCoordID)mTevOrder[0].getTexCoord(), (GXTexMapID)mTevOrder[0].getTexMap(), (GXChannelID)mTevOrder[0].getColor());
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
@@ -366,10 +369,10 @@ void J2DTevBlock1::setGX() {
|
||||
GXTevAlphaArg(mTevStage[0].getAlphaD()));
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GXTevOp(mTevStage[0].getCOp()),
|
||||
GXTevBias(mTevStage[0].getCBias()), GXTevScale(mTevStage[0].getCScale()),
|
||||
mTevStage[0].getCClamp(), GXTevRegID(mTevStage[0].getCReg()));
|
||||
GXBool(mTevStage[0].getCClamp()), GXTevRegID(mTevStage[0].getCReg()));
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, (GXTevOp)mTevStage[0].getAOp(),
|
||||
GXTevBias(mTevStage[0].getABias()), GXTevScale(mTevStage[0].getAScale()),
|
||||
mTevStage[0].getAClamp(), GXTevRegID(mTevStage[0].getAReg()));
|
||||
GXBool(mTevStage[0].getAClamp()), GXTevRegID(mTevStage[0].getAReg()));
|
||||
GXSetTevKColorSel(GX_TEVSTAGE0, mTevKColorSel[0] != 0xff ? GXTevKColorSel(mTevKColorSel[0]) : GX_TEV_KCSEL_1);
|
||||
GXSetTevKAlphaSel(GX_TEVSTAGE0, mTevKAlphaSel[0] != 0xff ? GXTevKAlphaSel(mTevKAlphaSel[0]) : GX_TEV_KASEL_1);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
@@ -483,28 +486,27 @@ bool J2DTevBlock2::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette*
|
||||
return false;
|
||||
}
|
||||
|
||||
JUTTexture* tex;
|
||||
u8 tlutid = 0;
|
||||
if (p_timg->indexTexture && p_tlut == NULL) {
|
||||
tex = mTexture[0];
|
||||
if (tex != NULL && tex->getTexInfo() != NULL && tex->getTexInfo()->indexTexture) {
|
||||
int tlutname = tex->getTlutName();
|
||||
if (p_timg->indexTexture && p_tlut == NULL && mTexture[0] != NULL) {
|
||||
const ResTIMG* timg = mTexture[0]->getTexInfo();
|
||||
if (timg != NULL && timg->indexTexture) {
|
||||
int tlutname = mTexture[0]->getTlutName();
|
||||
if (tlutname == GX_TLUT0 || tlutname == GX_BIGTLUT0) {
|
||||
tlutid = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tex = mTexture[texNo];
|
||||
if (tex == NULL) {
|
||||
JUTTexture* newtex = new JUTTexture(p_timg, tlutid);
|
||||
JUTTexture* tex;
|
||||
if (mTexture[texNo] == NULL) {
|
||||
tex = new JUTTexture(p_timg, tlutid);
|
||||
|
||||
if (newtex == NULL) {
|
||||
if (tex == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p_tlut != NULL) {
|
||||
newtex->storeTIMG(p_timg, p_tlut);
|
||||
tex->storeTIMG(p_timg, p_tlut);
|
||||
}
|
||||
|
||||
if (param_0 == 0) {
|
||||
@@ -512,10 +514,11 @@ bool J2DTevBlock2::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette*
|
||||
mPalette[1] = mPalette[0];
|
||||
mTexNo[1] = mTexNo[0];
|
||||
}
|
||||
mTexture[param_0] = newtex;
|
||||
mTexture[param_0] = tex;
|
||||
shiftDeleteFlag(param_0, true);
|
||||
mUndeleteFlag |= (1 << param_0);
|
||||
} else {
|
||||
tex = mTexture[texNo];
|
||||
if (p_tlut == NULL) {
|
||||
tex->storeTIMG(p_timg, tlutid);
|
||||
} else {
|
||||
@@ -604,9 +607,8 @@ bool J2DTevBlock2::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
const ResTIMG* timg = mTexture[idx]->getTexInfo();
|
||||
if (timg != NULL && timg->indexTexture) {
|
||||
int tlutname = mTexture[idx]->getTlutName();
|
||||
u8 tlut_no = tlutname - (tlutname >= GX_BIGTLUT0 ? GX_BIGTLUT0 : GX_TLUT0);
|
||||
|
||||
if (tlut_no == 0) {
|
||||
if (u8(tlutname - (tlutname >= GX_BIGTLUT0 ? GX_BIGTLUT0 : GX_TLUT0)) == 0) {
|
||||
tlutid = 1;
|
||||
}
|
||||
}
|
||||
@@ -763,7 +765,7 @@ void J2DTevBlock2::shiftDeleteFlag(u8 param_0, bool param_1) {
|
||||
mUndeleteFlag = (mUndeleteFlag & ((1 << param_0) - 1)) | ((mUndeleteFlag & ~((1 << (param_0 + 1)) - 1)) >> 1);
|
||||
}
|
||||
|
||||
mUndeleteFlag = (mUndeleteFlag | tmpFlags) & 0xFF;
|
||||
mUndeleteFlag = u8(mUndeleteFlag | tmpFlags);
|
||||
}
|
||||
|
||||
void J2DTevBlock2::setGX() {
|
||||
@@ -771,6 +773,8 @@ void J2DTevBlock2::setGX() {
|
||||
loadTexture(GXTexMapID(i), i);
|
||||
}
|
||||
|
||||
(void)bool(mFont);
|
||||
|
||||
for (int i = 0; i < mTevStageNum; i++) {
|
||||
GXSetTevOrder(GXTevStageID(i), (GXTexCoordID)mTevOrder[i].getTexCoord(), (GXTexMapID)mTevOrder[i].getTexMap(), (GXChannelID)mTevOrder[i].getColor());
|
||||
}
|
||||
@@ -791,10 +795,10 @@ void J2DTevBlock2::setGX() {
|
||||
GXTevAlphaArg(mTevStage[i].getAlphaD()));
|
||||
GXSetTevColorOp(GXTevStageID(i), GXTevOp(mTevStage[i].getCOp()),
|
||||
GXTevBias(mTevStage[i].getCBias()), GXTevScale(mTevStage[i].getCScale()),
|
||||
mTevStage[i].getCClamp(), GXTevRegID(mTevStage[i].getCReg()));
|
||||
GXBool(mTevStage[i].getCClamp()), GXTevRegID(mTevStage[i].getCReg()));
|
||||
GXSetTevAlphaOp(GXTevStageID(i), (GXTevOp)mTevStage[i].getAOp(),
|
||||
GXTevBias(mTevStage[i].getABias()), GXTevScale(mTevStage[i].getAScale()),
|
||||
mTevStage[i].getAClamp(), GXTevRegID(mTevStage[i].getAReg()));
|
||||
GXBool(mTevStage[i].getAClamp()), GXTevRegID(mTevStage[i].getAReg()));
|
||||
GXSetTevKColorSel(GXTevStageID(i), mTevKColorSel[i] != 0xff ? GXTevKColorSel(mTevKColorSel[i]) : GX_TEV_KCSEL_1);
|
||||
GXSetTevKAlphaSel(GXTevStageID(i), mTevKAlphaSel[i] != 0xff ? GXTevKAlphaSel(mTevKAlphaSel[i]) : GX_TEV_KASEL_1);
|
||||
}
|
||||
@@ -943,8 +947,9 @@ bool J2DTevBlock4::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette*
|
||||
}
|
||||
}
|
||||
}
|
||||
JUTTexture* texture;
|
||||
if (!mTexture[idx]) {
|
||||
JUTTexture* texture = new JUTTexture(p_timg, local_43);
|
||||
texture = new JUTTexture(p_timg, local_43);
|
||||
if (!texture) {
|
||||
return false;
|
||||
}
|
||||
@@ -960,7 +965,7 @@ bool J2DTevBlock4::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette*
|
||||
shiftDeleteFlag(param_0, true);
|
||||
mUndeleteFlag |= 1 << param_0;
|
||||
} else {
|
||||
JUTTexture* texture = mTexture[idx];
|
||||
texture = mTexture[idx];
|
||||
if (!p_tlut) {
|
||||
texture->storeTIMG(p_timg, local_43);
|
||||
} else {
|
||||
@@ -1037,10 +1042,9 @@ bool J2DTevBlock4::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
u8 used_tlut;
|
||||
u8 tlutid = 0;
|
||||
if (p_timg != NULL && p_timg->indexTexture) {
|
||||
used_tlut = 0;
|
||||
u8 used_tlut = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (i != param_0 && mTexture[i] != NULL) {
|
||||
const ResTIMG* timg = mTexture[i]->getTexInfo();
|
||||
@@ -1213,13 +1217,14 @@ void J2DTevBlock4::shiftDeleteFlag(u8 param_0, bool param_1) {
|
||||
mUndeleteFlag = (mUndeleteFlag & ((1 << param_0) - 1)) | ((mUndeleteFlag & ~((1 << (param_0 + 1)) - 1)) >> 1);
|
||||
}
|
||||
|
||||
mUndeleteFlag |= tmpFlags;
|
||||
mUndeleteFlag = u8(mUndeleteFlag | tmpFlags);
|
||||
}
|
||||
|
||||
void J2DTevBlock4::setGX() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
loadTexture(GXTexMapID(i), i);
|
||||
}
|
||||
(void)bool(mFont);
|
||||
for (int i = 0; i < mTevStageNum; i++) {
|
||||
GXSetTevOrder(GXTevStageID(i), (GXTexCoordID)mTevOrder[i].getTexCoord(), (GXTexMapID)mTevOrder[i].getTexMap(), (GXChannelID)mTevOrder[i].getColor());
|
||||
}
|
||||
@@ -1238,10 +1243,10 @@ void J2DTevBlock4::setGX() {
|
||||
GXTevAlphaArg(mTevStage[i].getAlphaD()));
|
||||
GXSetTevColorOp(GXTevStageID(i), GXTevOp(mTevStage[i].getCOp()),
|
||||
GXTevBias(mTevStage[i].getCBias()), GXTevScale(mTevStage[i].getCScale()),
|
||||
mTevStage[i].getCClamp(), GXTevRegID(mTevStage[i].getCReg()));
|
||||
GXBool(mTevStage[i].getCClamp()), GXTevRegID(mTevStage[i].getCReg()));
|
||||
GXSetTevAlphaOp(GXTevStageID(i), (GXTevOp)mTevStage[i].getAOp(),
|
||||
GXTevBias(mTevStage[i].getABias()), GXTevScale(mTevStage[i].getAScale()),
|
||||
mTevStage[i].getAClamp(), GXTevRegID(mTevStage[i].getAReg()));
|
||||
GXBool(mTevStage[i].getAClamp()), GXTevRegID(mTevStage[i].getAReg()));
|
||||
GXSetTevKColorSel(GXTevStageID(i), mTevKColorSel[i] != 0xff ? GXTevKColorSel(mTevKColorSel[i]) : GX_TEV_KCSEL_1);
|
||||
GXSetTevKAlphaSel(GXTevStageID(i), mTevKAlphaSel[i] != 0xff ? GXTevKAlphaSel(mTevKAlphaSel[i]) : GX_TEV_KASEL_1);
|
||||
}
|
||||
@@ -1387,8 +1392,9 @@ bool J2DTevBlock8::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette*
|
||||
}
|
||||
}
|
||||
}
|
||||
JUTTexture* texture;
|
||||
if (!mTexture[idx]) {
|
||||
JUTTexture* texture = new JUTTexture(p_timg, local_43);
|
||||
texture = new JUTTexture(p_timg, local_43);
|
||||
if (!texture) {
|
||||
return false;
|
||||
}
|
||||
@@ -1404,7 +1410,7 @@ bool J2DTevBlock8::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette*
|
||||
shiftDeleteFlag(param_0, true);
|
||||
mUndeleteFlag |= 1 << param_0;
|
||||
} else {
|
||||
JUTTexture* texture = mTexture[idx];
|
||||
texture = mTexture[idx];
|
||||
if (!p_tlut) {
|
||||
texture->storeTIMG(p_timg, local_43);
|
||||
} else {
|
||||
@@ -1459,7 +1465,7 @@ bool J2DTevBlock8::insertTexture(u32 param_0, JUTTexture* p_tex) {
|
||||
delete mTexture[7];
|
||||
}
|
||||
|
||||
mUndeleteFlag &= 0x7F;
|
||||
mUndeleteFlag &= ~0x80;
|
||||
}
|
||||
|
||||
for (u8 i = 7; i > param_0; i--) {
|
||||
@@ -1481,10 +1487,9 @@ bool J2DTevBlock8::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
u8 used_tlut;
|
||||
u8 tlutid = 0;
|
||||
if (p_timg != NULL && p_timg->indexTexture) {
|
||||
used_tlut = 0;
|
||||
u8 used_tlut = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (i != param_0 && mTexture[i] != NULL) {
|
||||
const ResTIMG* timg = mTexture[i]->getTexInfo();
|
||||
@@ -1659,6 +1664,7 @@ void J2DTevBlock8::setGX() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
loadTexture(GXTexMapID(i), i);
|
||||
}
|
||||
(void)bool(mFont);
|
||||
for (int i = 0; i < mTevStageNum; i++) {
|
||||
GXSetTevOrder(GXTevStageID(i), (GXTexCoordID)mTevOrder[i].getTexCoord(), (GXTexMapID)mTevOrder[i].getTexMap(), (GXChannelID)mTevOrder[i].getColor());
|
||||
}
|
||||
@@ -1677,10 +1683,10 @@ void J2DTevBlock8::setGX() {
|
||||
GXTevAlphaArg(mTevStage[i].getAlphaD()));
|
||||
GXSetTevColorOp(GXTevStageID(i), GXTevOp(mTevStage[i].getCOp()),
|
||||
GXTevBias(mTevStage[i].getCBias()), GXTevScale(mTevStage[i].getCScale()),
|
||||
mTevStage[i].getCClamp(), GXTevRegID(mTevStage[i].getCReg()));
|
||||
GXBool(mTevStage[i].getCClamp()), GXTevRegID(mTevStage[i].getCReg()));
|
||||
GXSetTevAlphaOp(GXTevStageID(i), (GXTevOp)mTevStage[i].getAOp(),
|
||||
GXTevBias(mTevStage[i].getABias()), GXTevScale(mTevStage[i].getAScale()),
|
||||
mTevStage[i].getAClamp(), GXTevRegID(mTevStage[i].getAReg()));
|
||||
GXBool(mTevStage[i].getAClamp()), GXTevRegID(mTevStage[i].getAReg()));
|
||||
GXSetTevKColorSel(GXTevStageID(i), mTevKColorSel[i] != 0xff ? GXTevKColorSel(mTevKColorSel[i]) : GX_TEV_KCSEL_1);
|
||||
GXSetTevKAlphaSel(GXTevStageID(i), mTevKAlphaSel[i] != 0xff ? GXTevKAlphaSel(mTevKAlphaSel[i]) : GX_TEV_KASEL_1);
|
||||
}
|
||||
@@ -1826,8 +1832,9 @@ bool J2DTevBlock16::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette
|
||||
}
|
||||
}
|
||||
}
|
||||
JUTTexture* texture;
|
||||
if (!mTexture[idx]) {
|
||||
JUTTexture* texture = new JUTTexture(p_timg, local_43);
|
||||
texture = new JUTTexture(p_timg, local_43);
|
||||
if (!texture) {
|
||||
return false;
|
||||
}
|
||||
@@ -1843,7 +1850,7 @@ bool J2DTevBlock16::insertTexture(u32 param_0, ResTIMG const* p_timg, JUTPalette
|
||||
shiftDeleteFlag(param_0, true);
|
||||
mUndeleteFlag |= 1 << param_0;
|
||||
} else {
|
||||
JUTTexture* texture = mTexture[idx];
|
||||
texture = mTexture[idx];
|
||||
if (!p_tlut) {
|
||||
texture->storeTIMG(p_timg, local_43);
|
||||
} else {
|
||||
@@ -1898,7 +1905,7 @@ bool J2DTevBlock16::insertTexture(u32 param_0, JUTTexture* p_tex) {
|
||||
delete mTexture[7];
|
||||
}
|
||||
|
||||
mUndeleteFlag &= 0x7F;
|
||||
mUndeleteFlag &= ~0x80;
|
||||
}
|
||||
|
||||
for (u8 i = 7; i > param_0; i--) {
|
||||
@@ -1920,10 +1927,9 @@ bool J2DTevBlock16::setTexture(u32 param_0, ResTIMG const* p_timg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
u8 used_tlut;
|
||||
u8 tlutid = 0;
|
||||
if (p_timg != NULL && p_timg->indexTexture) {
|
||||
used_tlut = 0;
|
||||
u8 used_tlut = 0;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (i != param_0 && mTexture[i] != NULL) {
|
||||
const ResTIMG* timg = mTexture[i]->getTexInfo();
|
||||
@@ -2098,6 +2104,7 @@ void J2DTevBlock16::setGX() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
loadTexture(GXTexMapID(i), i);
|
||||
}
|
||||
(void)bool(mFont);
|
||||
for (int i = 0; i < mTevStageNum; i++) {
|
||||
GXSetTevOrder(GXTevStageID(i), (GXTexCoordID)mTevOrder[i].getTexCoord(), (GXTexMapID)mTevOrder[i].getTexMap(), (GXChannelID)mTevOrder[i].getColor());
|
||||
}
|
||||
@@ -2116,10 +2123,10 @@ void J2DTevBlock16::setGX() {
|
||||
GXTevAlphaArg(mTevStage[i].getAlphaD()));
|
||||
GXSetTevColorOp(GXTevStageID(i), GXTevOp(mTevStage[i].getCOp()),
|
||||
GXTevBias(mTevStage[i].getCBias()), GXTevScale(mTevStage[i].getCScale()),
|
||||
mTevStage[i].getCClamp(), GXTevRegID(mTevStage[i].getCReg()));
|
||||
GXBool(mTevStage[i].getCClamp()), GXTevRegID(mTevStage[i].getCReg()));
|
||||
GXSetTevAlphaOp(GXTevStageID(i), (GXTevOp)mTevStage[i].getAOp(),
|
||||
GXTevBias(mTevStage[i].getABias()), GXTevScale(mTevStage[i].getAScale()),
|
||||
mTevStage[i].getAClamp(), GXTevRegID(mTevStage[i].getAReg()));
|
||||
GXBool(mTevStage[i].getAClamp()), GXTevRegID(mTevStage[i].getAReg()));
|
||||
GXSetTevKColorSel(GXTevStageID(i), mTevKColorSel[i] != 0xff ? GXTevKColorSel(mTevKColorSel[i]) : GX_TEV_KCSEL_1);
|
||||
GXSetTevKAlphaSel(GXTevStageID(i), mTevKAlphaSel[i] != 0xff ? GXTevKAlphaSel(mTevKAlphaSel[i]) : GX_TEV_KASEL_1);
|
||||
}
|
||||
@@ -2149,13 +2156,13 @@ void J2DTevBlock16::loadTexture(GXTexMapID texmapID, u32 texIndex) {
|
||||
void J2DIndBlockFull::initialize() {
|
||||
mIndTexStageNum = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
mIndTexOrder[i] = j2dDefaultIndTexOrderNull;
|
||||
mIndTexOrder[i].setIndTexOrderInfo(j2dDefaultIndTexOrderNull);
|
||||
}
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mIndTexMtx[i] = j2dDefaultIndTexMtxInfo;
|
||||
mIndTexMtx[i].setIndTexMtxInfo(j2dDefaultIndTexMtxInfo);
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
mTexCoordScale[i] = j2dDefaultIndTexCoordScaleInfo;
|
||||
mTexCoordScale[i].setIndTexCoordScaleInfo(j2dDefaultIndTexCoordScaleInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2181,5 +2188,5 @@ void J2DPEBlock::initialize() {
|
||||
void J2DPEBlock::setGX() {
|
||||
GXSetAlphaCompare(GXCompare(mAlphaComp.getComp0()), mAlphaComp.getRef0(), GXAlphaOp(mAlphaComp.getOp()), GXCompare(mAlphaComp.getComp1()), mAlphaComp.getRef1());
|
||||
GXSetBlendMode(GXBlendMode(mBlend.getType()), GXBlendFactor(mBlend.getSrcFactor()), GXBlendFactor(mBlend.getDstFactor()), GXLogicOp(mBlend.getOp()));
|
||||
GXSetDither(mDither);
|
||||
GXSetDither(GXBool(mDither));
|
||||
}
|
||||
|
||||
@@ -67,9 +67,7 @@ J2DTevBlock* J2DMaterial::createTevBlock(int block_type, bool noAlign) {
|
||||
block = new (-4) J2DTevBlock16();
|
||||
}
|
||||
}
|
||||
if (!block) {
|
||||
OS_PANIC(101, "Error : allocate memory.");
|
||||
}
|
||||
ASSERTMSGLINE(101, block, "Error : allocate memory.");
|
||||
|
||||
return block;
|
||||
}
|
||||
@@ -90,9 +88,7 @@ J2DIndBlock* J2DMaterial::createIndBlock(int block_type, bool noAlign) {
|
||||
block = new (-4) J2DIndBlockNull();
|
||||
}
|
||||
}
|
||||
if (!block) {
|
||||
OS_PANIC(133, "Error : allocate memory.");
|
||||
}
|
||||
ASSERTMSGLINE(133, block, "Error : allocate memory.");
|
||||
|
||||
return block;
|
||||
}
|
||||
@@ -148,9 +144,7 @@ void J2DMaterial::setAnimation(J2DAnmColor* anm) {
|
||||
u16 index = getIndex();
|
||||
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
u16 matID = anm->getUpdateMaterialID(i);
|
||||
|
||||
if (index == matID) {
|
||||
if (index == anm->getUpdateMaterialID(i)) {
|
||||
mAnmPointer->mColorIds = i;
|
||||
return;
|
||||
}
|
||||
@@ -219,9 +213,7 @@ void J2DMaterial::setAnimation(J2DAnmTevRegKey* anm) {
|
||||
u16 index = getIndex();
|
||||
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
u16 matID = anm->getCRegUpdateMaterialID(i);
|
||||
|
||||
if (index == matID) {
|
||||
if (index == anm->getCRegUpdateMaterialID(i)) {
|
||||
J3DAnmCRegKeyTable* anmTbl = anm->getAnmCRegKeyTable();
|
||||
mAnmPointer->mTevCRegIds[anmTbl[i].mColorId] = i;
|
||||
}
|
||||
@@ -237,9 +229,7 @@ void J2DMaterial::setAnimation(J2DAnmTevRegKey* anm) {
|
||||
u16 index = getIndex();
|
||||
|
||||
for (u16 i = 0; i < matNum; i++) {
|
||||
u16 matID = anm->getKRegUpdateMaterialID(i);
|
||||
|
||||
if (index == matID) {
|
||||
if (index == anm->getKRegUpdateMaterialID(i)) {
|
||||
J3DAnmKRegKeyTable* anmTbl = anm->getAnmKRegKeyTable();
|
||||
mAnmPointer->mTevKRegIds[anmTbl[i].mColorId] = i;
|
||||
}
|
||||
|
||||
@@ -52,10 +52,7 @@ u32 J2DMaterialFactory::countStages(int param_0) const {
|
||||
}
|
||||
}
|
||||
if ((uVar3 != uVar4 && uVar4 != 0)) {
|
||||
if (uVar3 > uVar4) {
|
||||
return uVar3;
|
||||
}
|
||||
return uVar4;
|
||||
return uVar3 > uVar4 ? uVar3 : uVar4;
|
||||
}
|
||||
return uVar3;
|
||||
}
|
||||
@@ -64,16 +61,14 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par
|
||||
J2DResReference* param_3, J2DResReference* param_4,
|
||||
JKRArchive* param_5) const {
|
||||
u32 stages = countStages(index);
|
||||
u32 uVar1 = ((param_2 & 0x1f0000) >> 16);
|
||||
u32 r28 = stages > uVar1 ? stages : uVar1;
|
||||
|
||||
u32 r25 = r28 <= 8 ? r28 : 8;
|
||||
|
||||
s32 local_3bc = ((param_2 & 0x1000000) != 0);
|
||||
s32 local_3c0 = (param_2 & 0x1f0000) ? local_3bc : 0;
|
||||
bool temp = (param_2 & 0x1f0000);
|
||||
param_0->mTevBlock = J2DMaterial::createTevBlock((u16)r28, temp);
|
||||
param_0->mIndBlock = J2DMaterial::createIndBlock(local_3c0, temp);
|
||||
u32 local_36c = ((param_2 & 0x1f0000) >> 16);
|
||||
u32 local_370 = stages > local_36c ? stages : local_36c;
|
||||
u32 local_374 = local_370 > 8 ? 8 : local_370;
|
||||
s32 local_378 = (param_2 & 0x1000000) ? 1 : 0;
|
||||
local_378 = (param_2 & 0x1f0000) ? local_378 : 0;
|
||||
bool local_403 = (param_2 & 0x1f0000);
|
||||
param_0->mTevBlock = J2DMaterial::createTevBlock((u16)local_370, local_403);
|
||||
param_0->mIndBlock = J2DMaterial::createIndBlock(local_378, local_403);
|
||||
param_0->mIndex = index;
|
||||
param_0->field_0x8 = getMaterialMode(index);
|
||||
param_0->getColorBlock()->setColorChanNum(newColorChanNum(index));
|
||||
@@ -86,9 +81,9 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par
|
||||
param_0->mMaterialAlphaCalc = getMaterialAlphaCalc(index);
|
||||
|
||||
JUTResReference aJStack_12c;
|
||||
for (u8 i = 0; i < r25; i++) {
|
||||
for (u8 i = 0; i < local_374; i++) {
|
||||
u16 texNo = newTexNo(index, i);
|
||||
s8* local_37c = param_3->getResReference(texNo);
|
||||
char* local_37c = param_3->getResReference(texNo);
|
||||
void* local_380 = NULL;
|
||||
if (local_37c != NULL) {
|
||||
local_380 = aJStack_12c.getResource(local_37c, 'TIMG', param_5);
|
||||
@@ -107,7 +102,7 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par
|
||||
u16 fontNo = newFontNo(index);
|
||||
param_0->getTevBlock()->setFontNo(fontNo);
|
||||
|
||||
s8* local_384 = param_4->getResReference(param_0->getTevBlock()->getFontNo());
|
||||
char* local_384 = param_4->getResReference(param_0->getTevBlock()->getFontNo());
|
||||
void* local_388 = NULL;
|
||||
if (local_384 != NULL) {
|
||||
local_388 = aJStack_12c.getResource(local_384, 'FONT', param_5);
|
||||
@@ -122,10 +117,10 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par
|
||||
}
|
||||
|
||||
param_0->getTevBlock()->setFont((ResFONT*)local_388);
|
||||
for (u8 i = 0; i < r28; i++) {
|
||||
for (u8 i = 0; i < local_370; i++) {
|
||||
param_0->getTevBlock()->setTevOrder(i, newTevOrder(index, i));
|
||||
}
|
||||
for (u8 i = 0; i < r28; i++) {
|
||||
for (u8 i = 0; i < local_370; i++) {
|
||||
J2DMaterialInitData* local_38c = &field_0x4[field_0x8[index]];
|
||||
param_0->getTevBlock()->setTevStage(i, newTevStage(index, i));
|
||||
if (local_38c->field_0xba[i] != 0xffff) {
|
||||
@@ -157,13 +152,13 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par
|
||||
param_0->getTexGenBlock()->setTexMtx(i, newTexMtx(index, i));
|
||||
}
|
||||
J2DMaterialInitData* local_394 = &field_0x4[field_0x8[index]];
|
||||
for (u8 i = 0; i < r28; i++) {
|
||||
for (u8 i = 0; i < local_370; i++) {
|
||||
param_0->getTevBlock()->setTevKColorSel(i, local_394->field_0x52[i]);
|
||||
}
|
||||
for (u8 i = 0; i < r28; i++) {
|
||||
for (u8 i = 0; i < local_370; i++) {
|
||||
param_0->getTevBlock()->setTevKAlphaSel(i, local_394->field_0x62[i]);
|
||||
}
|
||||
if (field_0xc != NULL || local_3c0 != 0) {
|
||||
if (field_0xc != NULL || local_378 != 0) {
|
||||
u8 local_410 = newIndTexStageNum(index);
|
||||
param_0->mIndBlock->setIndTexStageNum(local_410);
|
||||
for (u8 i = 0; i < local_410; i++) {
|
||||
@@ -175,7 +170,7 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par
|
||||
for (u8 i = 0; i < local_410; i++) {
|
||||
param_0->getIndBlock()->setIndTexCoordScale(i, newIndTexCoordScale(index, i));
|
||||
}
|
||||
for (u8 i = 0; i < r28; i++) {
|
||||
for (u8 i = 0; i < local_370; i++) {
|
||||
param_0->getTevBlock()->setIndTevStage(i, newIndTevStage(index, i));
|
||||
}
|
||||
}
|
||||
@@ -183,8 +178,7 @@ J2DMaterial* J2DMaterialFactory::create(J2DMaterial* param_0, int index, u32 par
|
||||
}
|
||||
|
||||
JUtility::TColor J2DMaterialFactory::newMatColor(int param_0, int param_1) const {
|
||||
GXColor color = {0xff,0xff,0xff,0xff};
|
||||
JUtility::TColor local_20 = GXColor(color);
|
||||
JUtility::TColor local_20 = (GXColor){0xff,0xff,0xff,0xff};
|
||||
J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]];
|
||||
if (iVar2->field_0x8[param_1] != 0xffff) {
|
||||
return field_0x10[iVar2->field_0x8[param_1]];
|
||||
@@ -201,6 +195,7 @@ u8 J2DMaterialFactory::newColorChanNum(int param_0) const {
|
||||
}
|
||||
|
||||
J2DColorChan J2DMaterialFactory::newColorChan(int param_0, int param_1) const {
|
||||
int r29 = 0;
|
||||
J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]];
|
||||
if (iVar2->field_0xc[param_1] != 0xffff) {
|
||||
return J2DColorChan(field_0x18[iVar2->field_0xc[param_1]]);
|
||||
@@ -209,6 +204,7 @@ J2DColorChan J2DMaterialFactory::newColorChan(int param_0, int param_1) const {
|
||||
}
|
||||
|
||||
u32 J2DMaterialFactory::newTexGenNum(int param_0) const {
|
||||
int r30 = 0;
|
||||
J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]];
|
||||
if (iVar2->field_0x3 != 0xff) {
|
||||
return field_0x1c[iVar2->field_0x3];
|
||||
@@ -235,6 +231,7 @@ J2DTexMtx* J2DMaterialFactory::newTexMtx(int param_0, int param_1) const {
|
||||
}
|
||||
|
||||
u8 J2DMaterialFactory::newCullMode(int param_0) const {
|
||||
int r30 = 0;
|
||||
J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]];
|
||||
if (iVar2->field_0x1 != 0xff) {
|
||||
return field_0x30[iVar2->field_0x1];
|
||||
@@ -312,12 +309,13 @@ J2DTevSwapModeTable J2DMaterialFactory::newTevSwapModeTable(int param_0, int par
|
||||
}
|
||||
|
||||
u8 J2DMaterialFactory::newIndTexStageNum(int param_0) const {
|
||||
u8 r31 = 0;
|
||||
if (field_0xc != NULL) {
|
||||
if (field_0xc[param_0].field_0x0 == 1) {
|
||||
return field_0xc[param_0].field_0x1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return r31;
|
||||
}
|
||||
|
||||
J2DIndTexOrder J2DMaterialFactory::newIndTexOrder(int param_0, int param_1) const {
|
||||
@@ -373,7 +371,7 @@ J2DBlend J2DMaterialFactory::newBlend(int param_0) const {
|
||||
if (iVar2->field_0xe4 != 0xffff) {
|
||||
return J2DBlend(field_0x54[iVar2->field_0xe4]);
|
||||
}
|
||||
return J2DBlend();
|
||||
return J2DBlend(j2dDefaultBlendInfo);
|
||||
}
|
||||
|
||||
u8 J2DMaterialFactory::newDither(int param_0) const {
|
||||
|
||||
+121
-155
@@ -21,10 +21,15 @@ J2DPane::J2DPane() : mBounds(), mGlobalBounds(), mClipRect(), mPaneTree(this) {
|
||||
|
||||
void J2DPane::initiate() {
|
||||
field_0x4 = -1;
|
||||
mRotateOffsetY = mRotateOffsetX = mRotateZ = mRotateY = mRotateX = 0;
|
||||
mRotateX = 0.0f;
|
||||
mRotateY = 0.0f;
|
||||
mRotateZ = 0.0f;
|
||||
mRotateOffsetX = 0.0f;
|
||||
mRotateOffsetY = 0.0f;
|
||||
mBasePosition = 0;
|
||||
mRotAxis = ROTATE_Z;
|
||||
mScaleY = mScaleX = 1;
|
||||
mScaleX = 1.0f;
|
||||
mScaleY = 1.0f;
|
||||
mCullMode = GX_CULL_NONE;
|
||||
mAlpha = 255;
|
||||
mIsInfluencedAlpha = true;
|
||||
@@ -98,8 +103,8 @@ J2DPane::J2DPane(J2DPane* p_pane, JSURandomInputStream* p_stream, u8 isEx) : mPa
|
||||
|
||||
void J2DPane::makePaneStream(J2DPane* p_pane, JSURandomInputStream* p_stream) {
|
||||
u8 unk;
|
||||
p_stream->read(&unk, 1);
|
||||
p_stream->read(&mVisible, 1);
|
||||
p_stream->read(unk);
|
||||
p_stream->read(mVisible);
|
||||
p_stream->skip(2);
|
||||
|
||||
mInfoTag = p_stream->read32b();
|
||||
@@ -110,7 +115,7 @@ void J2DPane::makePaneStream(J2DPane* p_pane, JSURandomInputStream* p_stream) {
|
||||
f32 y1 = y0 + p_stream->readS16();
|
||||
mBounds.set(x0, y0, x1, y1);
|
||||
|
||||
unk -= 6;
|
||||
unk -= u8(6);
|
||||
mRotateX = 0;
|
||||
mRotateY = 0;
|
||||
mRotateZ = 0;
|
||||
@@ -120,7 +125,8 @@ void J2DPane::makePaneStream(J2DPane* p_pane, JSURandomInputStream* p_stream) {
|
||||
}
|
||||
|
||||
if (unk != 0) {
|
||||
mBasePosition = p_stream->readU8();
|
||||
u8 r28 = p_stream->readU8();
|
||||
mBasePosition = r28;
|
||||
unk--;
|
||||
} else {
|
||||
mBasePosition = 0;
|
||||
@@ -159,15 +165,15 @@ void J2DPane::changeUseTrans(J2DPane* p_pane) {
|
||||
f32 xOffset = 0;
|
||||
f32 yOffset = 0;
|
||||
if (mBasePosition % 3 == 1) {
|
||||
xOffset = mBounds.getWidth() / 2;
|
||||
xOffset = getWidth() / 2;
|
||||
} else if (mBasePosition % 3 == 2) {
|
||||
xOffset = mBounds.getWidth();
|
||||
xOffset = getWidth();
|
||||
}
|
||||
|
||||
if (mBasePosition / 3 == 1) {
|
||||
yOffset = mBounds.getHeight() / 2;
|
||||
yOffset = getHeight() / 2;
|
||||
} else if (mBasePosition / 3 == 2) {
|
||||
yOffset = mBounds.getHeight();
|
||||
yOffset = getHeight();
|
||||
}
|
||||
|
||||
mTranslateX = mBounds.i.x + xOffset;
|
||||
@@ -176,9 +182,7 @@ void J2DPane::changeUseTrans(J2DPane* p_pane) {
|
||||
mRotateOffsetX = xOffset;
|
||||
mRotateOffsetY = yOffset;
|
||||
|
||||
f32 addX = -mTranslateX;
|
||||
f32 addY = -mTranslateY;
|
||||
mBounds.addPos(addX, addY);
|
||||
mBounds.addPos(JGeometry::TVec2<f32>(-mTranslateX, -mTranslateY));
|
||||
|
||||
if (p_pane != NULL) {
|
||||
u8 otherBasePos = p_pane->mBasePosition;
|
||||
@@ -200,10 +204,9 @@ void J2DPane::changeUseTrans(J2DPane* p_pane) {
|
||||
}
|
||||
|
||||
J2DPane::~J2DPane() {
|
||||
JSUTreeIterator<J2DPane> iterator;
|
||||
for (iterator = mPaneTree.getFirstChild(); iterator != mPaneTree.getEndChild();) {
|
||||
J2DPane* child = (iterator++).getObject();
|
||||
delete child;
|
||||
JSUTreeIterator<J2DPane> iterator = mPaneTree.getFirstChild();
|
||||
for (; iterator != mPaneTree.getEndChild();) {
|
||||
delete (iterator++).getObject();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +243,7 @@ bool J2DPane::insertChild(J2DPane* p_prev, J2DPane* p_child) {
|
||||
}
|
||||
|
||||
void J2DPane::draw(f32 x, f32 y, J2DGrafContext const* p_grafCtx, bool isOrthoGraf, bool param_4) {
|
||||
bool unkBool = param_4 && mVisible;
|
||||
param_4 = param_4 && mVisible;
|
||||
if (p_grafCtx->getGrafType() != 1) {
|
||||
isOrthoGraf = false;
|
||||
}
|
||||
@@ -254,22 +257,36 @@ void J2DPane::draw(f32 x, f32 y, J2DGrafContext const* p_grafCtx, bool isOrthoGr
|
||||
if (mBounds.isValid()) {
|
||||
mGlobalBounds = mBounds;
|
||||
|
||||
f32 addX = mTranslateX;
|
||||
f32 addY = mTranslateY;
|
||||
mGlobalBounds.addPos(addX, addY);
|
||||
mGlobalBounds.addPos(JGeometry::TVec2<f32>(mTranslateX, mTranslateY));
|
||||
|
||||
if (unkBool) {
|
||||
if (param_4) {
|
||||
mClipRect = mBounds;
|
||||
rewriteAlpha();
|
||||
}
|
||||
|
||||
if (parent != NULL) {
|
||||
f32 width = parent->mGlobalBounds.i.x - parent->mBounds.i.x;
|
||||
f32 height = parent->mGlobalBounds.i.y - parent->mBounds.i.y;
|
||||
mGlobalBounds.addPos(width, height);
|
||||
mGlobalBounds.addPos(JGeometry::TVec2<f32>(parent->mGlobalBounds.i.x - parent->mBounds.i.x, parent->mGlobalBounds.i.y - parent->mBounds.i.y));
|
||||
#if !PLATFORM_GCN
|
||||
f32 f28 = mPositionMtx[0][0];
|
||||
f32 f27 = mPositionMtx[1][0];
|
||||
f32 f26 = mPositionMtx[2][0];
|
||||
if (getUserInfo() == 'n_43' && p_grafCtx->getGrafType() == 1) {
|
||||
JGeometry::TBox2<f32>* bounds = ((J2DOrthoGraph*)p_grafCtx)->getBounds();
|
||||
const JGeometry::TBox2<f32>* ortho = ((J2DOrthoGraph*)p_grafCtx)->getOrtho();
|
||||
f32 f31 = 608.0f / (ortho->f.x - ortho->i.x);
|
||||
mPositionMtx[0][0] *= f31;
|
||||
mPositionMtx[0][1] *= f31;
|
||||
mPositionMtx[0][2] *= f31;
|
||||
}
|
||||
#endif
|
||||
MTXConcat(parent->mGlobalMtx, mPositionMtx, mGlobalMtx);
|
||||
#if !PLATFORM_GCN
|
||||
mPositionMtx[0][0] = f28;
|
||||
mPositionMtx[1][0] = f27;
|
||||
mPositionMtx[2][0] = f26;
|
||||
#endif
|
||||
|
||||
if (unkBool) {
|
||||
if (param_4) {
|
||||
if (isOrthoGraf) {
|
||||
mClipRect = mGlobalBounds;
|
||||
mClipRect.intersect(parent->mClipRect);
|
||||
@@ -281,19 +298,35 @@ void J2DPane::draw(f32 x, f32 y, J2DGrafContext const* p_grafCtx, bool isOrthoGr
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mGlobalBounds.addPos(x, y);
|
||||
#if !PLATFORM_GCN
|
||||
f32 f25 = mScaleX;
|
||||
f32 f24 = mTranslateX;
|
||||
if (getUserInfo() != 'n_43' && p_grafCtx->getGrafType() == 1) {
|
||||
JGeometry::TBox2<f32>* bounds = ((J2DOrthoGraph*)p_grafCtx)->getBounds();
|
||||
const JGeometry::TBox2<f32>* ortho = ((J2DOrthoGraph*)p_grafCtx)->getOrtho();
|
||||
f32 f30 = (ortho->f.x - ortho->i.x) / 608.0f;
|
||||
f32 f29 = 304.0f;
|
||||
mScaleX *= f30;
|
||||
mTranslateX = f30 * (mTranslateX - f29) + f29;
|
||||
}
|
||||
#endif
|
||||
mGlobalBounds.addPos(JGeometry::TVec2<f32>(x, y));
|
||||
makeMatrix(mTranslateX + x, mTranslateY + y);
|
||||
MTXCopy(mPositionMtx, mGlobalMtx);
|
||||
mClipRect = mGlobalBounds;
|
||||
mColorAlpha = mAlpha;
|
||||
#if !PLATFORM_GCN
|
||||
mScaleX = f25;
|
||||
mTranslateX = f24;
|
||||
#endif
|
||||
}
|
||||
|
||||
JGeometry::TBox2<f32> scissorBounds(0, 0, 0, 0);
|
||||
if (unkBool && isOrthoGraf) {
|
||||
if (param_4 && isOrthoGraf) {
|
||||
((J2DOrthoGraph*)p_grafCtx)->scissorBounds(&scissorBounds, &mClipRect);
|
||||
}
|
||||
|
||||
if (unkBool && (mClipRect.isValid() || !isOrthoGraf)) {
|
||||
if (param_4 && (mClipRect.isValid() || !isOrthoGraf)) {
|
||||
J2DGrafContext tmpGraf(*p_grafCtx);
|
||||
if (isOrthoGraf) {
|
||||
tmpGraf.scissor(scissorBounds);
|
||||
@@ -303,9 +336,8 @@ void J2DPane::draw(f32 x, f32 y, J2DGrafContext const* p_grafCtx, bool isOrthoGr
|
||||
drawSelf(x, y, &tmpGraf.mPosMtx);
|
||||
}
|
||||
|
||||
JSUTreeIterator<J2DPane> iter;
|
||||
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
iter.getObject()->draw(0, 0, p_grafCtx, isOrthoGraf, unkBool);
|
||||
for (JSUTreeIterator<J2DPane> iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
iter->draw(0, 0, p_grafCtx, isOrthoGraf, param_4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -362,8 +394,8 @@ void J2DPane::place(JGeometry::TBox2<f32> const& box) {
|
||||
}
|
||||
|
||||
void J2DPane::move(f32 x, f32 y) {
|
||||
f32 width = getWidth();
|
||||
f32 height = getHeight();
|
||||
f32 width = mBounds.getWidth();
|
||||
f32 height = mBounds.getHeight();
|
||||
place(JGeometry::TBox2<f32>(x, y, x + width, y + height));
|
||||
}
|
||||
|
||||
@@ -376,16 +408,11 @@ void J2DPane::add(f32 x, f32 y) {
|
||||
void J2DPane::resize(f32 x, f32 y) {
|
||||
JGeometry::TBox2<f32> box = mBounds;
|
||||
|
||||
f32 tX = mTranslateX;
|
||||
f32 tY = mTranslateY;
|
||||
|
||||
box.addPos(tX, tY);
|
||||
box.addPos(JGeometry::TVec2<f32>(mTranslateX, mTranslateY));
|
||||
|
||||
const J2DPane* parent = getParentPane();
|
||||
if (parent != NULL) {
|
||||
f32 xAdd = -parent->mBounds.i.x;
|
||||
f32 yAdd = -parent->mBounds.i.y;
|
||||
box.addPos(xAdd, yAdd);
|
||||
box.addPos(JGeometry::TVec2<f32>(-parent->mBounds.i.x, -parent->mBounds.i.y));
|
||||
}
|
||||
|
||||
box.f.x = box.i.x + x;
|
||||
@@ -398,16 +425,11 @@ JGeometry::TBox2<f32> J2DPane::static_mBounds(0, 0, 0, 0);
|
||||
JGeometry::TBox2<f32>& J2DPane::getBounds() {
|
||||
static_mBounds = mBounds;
|
||||
|
||||
f32 tX = mTranslateX;
|
||||
f32 tY = mTranslateY;
|
||||
|
||||
static_mBounds.addPos(tX, tY);
|
||||
static_mBounds.addPos(JGeometry::TVec2<f32>(mTranslateX, mTranslateY));
|
||||
|
||||
const J2DPane* parent = getParentPane();
|
||||
if (parent != NULL) {
|
||||
f32 xAdd = -parent->mBounds.i.x;
|
||||
f32 yAdd = -parent->mBounds.i.y;
|
||||
static_mBounds.addPos(xAdd, yAdd);
|
||||
static_mBounds.addPos(JGeometry::TVec2<f32>(-parent->mBounds.i.x, -parent->mBounds.i.y));
|
||||
}
|
||||
|
||||
return static_mBounds;
|
||||
@@ -443,8 +465,7 @@ J2DPane* J2DPane::search(u64 tag) {
|
||||
return this;
|
||||
}
|
||||
|
||||
JSUTreeIterator<J2DPane> iter;
|
||||
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
for (JSUTreeIterator<J2DPane> iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
if (J2DPane* result = iter.getObject()->search(tag)) {
|
||||
return result;
|
||||
}
|
||||
@@ -457,8 +478,7 @@ J2DPane* J2DPane::searchUserInfo(u64 tag) {
|
||||
return this;
|
||||
}
|
||||
|
||||
JSUTreeIterator<J2DPane> iter;
|
||||
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
for (JSUTreeIterator<J2DPane> iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
if (J2DPane* result = iter.getObject()->searchUserInfo(tag)) {
|
||||
return result;
|
||||
}
|
||||
@@ -467,8 +487,7 @@ J2DPane* J2DPane::searchUserInfo(u64 tag) {
|
||||
}
|
||||
|
||||
bool J2DPane::isUsed(const ResTIMG* p_timg) {
|
||||
JSUTreeIterator<J2DPane> iter;
|
||||
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
for (JSUTreeIterator<J2DPane> iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
if (iter.getObject()->isUsed(p_timg))
|
||||
return true;
|
||||
}
|
||||
@@ -476,8 +495,7 @@ bool J2DPane::isUsed(const ResTIMG* p_timg) {
|
||||
}
|
||||
|
||||
bool J2DPane::isUsed(const ResFONT* p_font) {
|
||||
JSUTreeIterator<J2DPane> iter;
|
||||
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
for (JSUTreeIterator<J2DPane> iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
if (iter.getObject()->isUsed(p_font))
|
||||
return true;
|
||||
}
|
||||
@@ -502,8 +520,7 @@ void J2DPane::makeMatrix(f32 param_0, f32 param_1, f32 param_2, f32 param_3) {
|
||||
void J2DPane::setCullBack(GXCullMode mode) {
|
||||
mCullMode = mode;
|
||||
|
||||
JSUTreeIterator<J2DPane> iter;
|
||||
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
for (JSUTreeIterator<J2DPane> iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
iter.getObject()->setCullBack(mode);
|
||||
}
|
||||
}
|
||||
@@ -515,20 +532,16 @@ void J2DPane::setBasePosition(J2DBasePosition position) {
|
||||
mRotateOffsetX = 0;
|
||||
|
||||
if (position % 3 == 1) {
|
||||
f32 width = getWidth();
|
||||
mRotateOffsetX = width / 2;
|
||||
mRotateOffsetX = getWidth() / 2;
|
||||
} else if (position % 3 == 2) {
|
||||
f32 width = getWidth();
|
||||
mRotateOffsetX = width;
|
||||
mRotateOffsetX = getWidth();
|
||||
}
|
||||
|
||||
mRotateOffsetY = 0;
|
||||
if (position / 3 == 1) {
|
||||
f32 height = getHeight();
|
||||
mRotateOffsetY = height / 2;
|
||||
mRotateOffsetY = getHeight() / 2;
|
||||
} else if (position / 3 == 2) {
|
||||
f32 height = getHeight();
|
||||
mRotateOffsetY = height;
|
||||
mRotateOffsetY = getHeight();
|
||||
}
|
||||
|
||||
calcMtx();
|
||||
@@ -545,7 +558,7 @@ void J2DPane::setInfluencedAlpha(bool influencedAlpha, bool param_1) {
|
||||
break;
|
||||
}
|
||||
alpha = (((f32)alpha) * parent->getAlpha() / 255);
|
||||
if (!parent->mIsInfluencedAlpha) {
|
||||
if (!parent->isInfluencedAlpha()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -554,7 +567,7 @@ void J2DPane::setInfluencedAlpha(bool influencedAlpha, bool param_1) {
|
||||
if (alpha == 0) {
|
||||
setAlpha(0);
|
||||
} else {
|
||||
f32 fAlpha = ((f32)mAlpha) / alpha * 255;
|
||||
f32 fAlpha = ((f32)getAlpha()) / alpha * 255;
|
||||
|
||||
u8 alpha;
|
||||
if (fAlpha > 255) {
|
||||
@@ -565,7 +578,8 @@ void J2DPane::setInfluencedAlpha(bool influencedAlpha, bool param_1) {
|
||||
setAlpha(alpha);
|
||||
}
|
||||
} else {
|
||||
setAlpha((f32)(alpha * mAlpha) / 255);
|
||||
f32 fAlpha = f32(alpha * getAlpha()) / 255;
|
||||
setAlpha(fAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,25 +593,15 @@ Vec J2DPane::getGlbVtx(u8 param_0) const {
|
||||
out.y = 0;
|
||||
out.z = 0;
|
||||
return out;
|
||||
} else {
|
||||
f32 x, y;
|
||||
if (param_0 & 1) {
|
||||
x = mBounds.f.x;
|
||||
} else {
|
||||
x = mBounds.i.x;
|
||||
}
|
||||
|
||||
if (param_0 & 2) {
|
||||
y = mBounds.f.y;
|
||||
} else {
|
||||
y = mBounds.i.y;
|
||||
}
|
||||
|
||||
out.x = x * mGlobalMtx[0][0] + y * mGlobalMtx[0][1] + mGlobalMtx[0][3];
|
||||
out.y = x * mGlobalMtx[1][0] + y * mGlobalMtx[1][1] + mGlobalMtx[1][3];
|
||||
out.z = x * mGlobalMtx[2][0] + y * mGlobalMtx[2][1] + mGlobalMtx[2][3];
|
||||
return out;
|
||||
}
|
||||
|
||||
f32 x = param_0 & 1 ? mBounds.f.x : mBounds.i.x;
|
||||
f32 y = param_0 & 2 ? mBounds.f.y : mBounds.i.y;
|
||||
|
||||
out.x = x * mGlobalMtx[0][0] + y * mGlobalMtx[0][1] + mGlobalMtx[0][3];
|
||||
out.y = x * mGlobalMtx[1][0] + y * mGlobalMtx[1][1] + mGlobalMtx[1][3];
|
||||
out.z = x * mGlobalMtx[2][0] + y * mGlobalMtx[2][1] + mGlobalMtx[2][3];
|
||||
return out;
|
||||
}
|
||||
|
||||
J2DPane* J2DPane::getFirstChildPane() {
|
||||
@@ -643,7 +647,7 @@ struct J2DPaneInfo {
|
||||
}; // Size: 0x48
|
||||
|
||||
void J2DPane::makePaneExStream(J2DPane* p_parent, JSURandomInputStream* p_stream) {
|
||||
p_stream->getPosition();
|
||||
s32 r30 = p_stream->getPosition();
|
||||
|
||||
J2DPaneInfo data;
|
||||
p_stream->read(&data, sizeof(data));
|
||||
@@ -696,24 +700,24 @@ void J2DPane::makePaneExStream(J2DPane* p_parent, JSURandomInputStream* p_stream
|
||||
s16 J2DPane::J2DCast_F32_to_S16(f32 value, u8 arg2) {
|
||||
if (arg2 >= 0xF) {
|
||||
return 0;
|
||||
} else {
|
||||
f32 tmpF;
|
||||
tmpF = value;
|
||||
}
|
||||
|
||||
f32 tmpF;
|
||||
tmpF = value;
|
||||
if (value < 0) {
|
||||
tmpF = -tmpF;
|
||||
}
|
||||
int tmp = tmpF * (1 << arg2);
|
||||
if (tmp >= 0x8000) {
|
||||
if (value < 0) {
|
||||
tmpF = -value;
|
||||
}
|
||||
int tmp = tmpF * (1 << arg2);
|
||||
if (tmp >= 0x8000) {
|
||||
if (value < 0) {
|
||||
return 0x8000;
|
||||
} else {
|
||||
return 0x7FFF;
|
||||
}
|
||||
} else if (value < 0) {
|
||||
return ~tmp + 1;
|
||||
return 0x8000;
|
||||
} else {
|
||||
return tmp;
|
||||
return 0x7FFF;
|
||||
}
|
||||
} else if (value < 0) {
|
||||
return ~tmp + 1;
|
||||
} else {
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -753,8 +757,6 @@ void* J2DPane::getPointer(JSURandomInputStream* p_stream, u32 param_1, JKRArchiv
|
||||
void J2DPane::setAnimation(J2DAnmBase* p_anm) {
|
||||
if (p_anm != NULL) {
|
||||
switch (p_anm->getKind()) {
|
||||
default:
|
||||
break;
|
||||
case KIND_TRANSFORM:
|
||||
setAnimation(static_cast<J2DAnmTransform*>(p_anm));
|
||||
break;
|
||||
@@ -776,6 +778,9 @@ void J2DPane::setAnimation(J2DAnmBase* p_anm) {
|
||||
case KIND_TEV_REG:
|
||||
setAnimation(static_cast<J2DAnmTevRegKey*>(p_anm));
|
||||
break;
|
||||
default:
|
||||
OS_REPORT("J2DPane: this is not a J3D Binary.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -790,11 +795,9 @@ void J2DPane::animationTransform() {
|
||||
}
|
||||
|
||||
void J2DPane::clearAnmTransform() {
|
||||
J2DAnmTransform* none = NULL;
|
||||
setAnimation(none);
|
||||
setAnimation((J2DAnmTransform*)NULL);
|
||||
|
||||
JSUTreeIterator<J2DPane> iter;
|
||||
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
for (JSUTreeIterator<J2DPane> iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
iter.getObject()->clearAnmTransform();
|
||||
}
|
||||
}
|
||||
@@ -804,8 +807,7 @@ const J2DAnmTransform* J2DPane::animationTransform(const J2DAnmTransform* p_tran
|
||||
if (mTransform != NULL)
|
||||
p = mTransform;
|
||||
|
||||
JSUTreeIterator<J2DPane> iter;
|
||||
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
for (JSUTreeIterator<J2DPane> iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
iter.getObject()->animationTransform(p);
|
||||
}
|
||||
|
||||
@@ -816,8 +818,7 @@ const J2DAnmTransform* J2DPane::animationTransform(const J2DAnmTransform* p_tran
|
||||
void J2DPane::setVisibileAnimation(J2DAnmVisibilityFull* p_visibility) {
|
||||
setAnimationVF(p_visibility);
|
||||
|
||||
JSUTreeIterator<J2DPane> iter;
|
||||
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
for (JSUTreeIterator<J2DPane> iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
iter.getObject()->setVisibileAnimation(p_visibility);
|
||||
}
|
||||
}
|
||||
@@ -825,8 +826,7 @@ void J2DPane::setVisibileAnimation(J2DAnmVisibilityFull* p_visibility) {
|
||||
void J2DPane::setVtxColorAnimation(J2DAnmVtxColor* p_vtxColor) {
|
||||
setAnimationVC(p_vtxColor);
|
||||
|
||||
JSUTreeIterator<J2DPane> iter;
|
||||
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
for (JSUTreeIterator<J2DPane> iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
iter.getObject()->setVtxColorAnimation(p_vtxColor);
|
||||
}
|
||||
}
|
||||
@@ -836,8 +836,7 @@ const J2DAnmTransform* J2DPane::animationPane(const J2DAnmTransform* p_transform
|
||||
if (mTransform != NULL)
|
||||
p = mTransform;
|
||||
|
||||
JSUTreeIterator<J2DPane> iter;
|
||||
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
for (JSUTreeIterator<J2DPane> iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
|
||||
iter.getObject()->animationPane(p);
|
||||
}
|
||||
|
||||
@@ -860,42 +859,9 @@ void J2DPane::updateTransform(J2DAnmTransform const* p_anmTransform) {
|
||||
}
|
||||
}
|
||||
|
||||
void J2DPane::drawSelf(f32, f32, f32 (*)[3][4]) {
|
||||
/* empty function */
|
||||
}
|
||||
|
||||
void J2DPane::rewriteAlpha() {
|
||||
/* empty function */
|
||||
}
|
||||
|
||||
void J2DPane::setAnimationVF(J2DAnmVisibilityFull* p_visibility) {
|
||||
setAnimation(p_visibility);
|
||||
}
|
||||
|
||||
void J2DPane::setAnimationVC(J2DAnmVtxColor* p_vtxColor) {
|
||||
setAnimation(p_vtxColor);
|
||||
}
|
||||
|
||||
void J2DPane::setCullBack(bool cull) {
|
||||
GXCullMode mode;
|
||||
|
||||
if (!cull)
|
||||
mode = GX_CULL_NONE;
|
||||
else
|
||||
mode = GX_CULL_BACK;
|
||||
|
||||
setCullBack(mode);
|
||||
}
|
||||
|
||||
bool J2DPane::setConnectParent(bool connected) {
|
||||
mConnected = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
void J2DPane::update() {
|
||||
/* empty function */
|
||||
}
|
||||
|
||||
void J2DPane::drawSelf(f32, f32) {
|
||||
/* empty function */
|
||||
static void dummy(J2DPane* pane) {
|
||||
pane->drawSelf(0.0f, 0.0f);
|
||||
pane->update();
|
||||
pane->setConnectParent(false);
|
||||
pane->setCullBack(false);
|
||||
}
|
||||
|
||||
+100
-108
@@ -10,7 +10,7 @@
|
||||
#include "dolphin/gx.h"
|
||||
|
||||
J2DPicture::J2DPicture() : mPalette(NULL) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (u32 i = 0; i < 2; i++) {
|
||||
mTexture[i] = NULL;
|
||||
}
|
||||
|
||||
@@ -67,23 +67,12 @@ J2DPicture::J2DPicture(J2DPane* p_pane, JSURandomInputStream* p_stream, J2DMater
|
||||
|
||||
if (material != NULL && material->getTevBlock() != NULL) {
|
||||
u8 texgenNum = material->getTexGenBlock()->getTexGenNum();
|
||||
u32 stageNum = material->getTevBlock()->getTevStageNum();
|
||||
u8 stageNum = u8(material->getTevBlock()->getTevStageNum());
|
||||
|
||||
if ((texgenNum == 1 && stageNum != 1) || (texgenNum != 1 && (int)stageNum != texgenNum + 1))
|
||||
{
|
||||
J2DGXColorS10* color0p = material->getTevBlock()->getTevColor(0);
|
||||
GXColorS10 color0;
|
||||
color0.r = color0p->r;
|
||||
color0.g = color0p->g;
|
||||
color0.b = color0p->b;
|
||||
color0.a = color0p->a;
|
||||
|
||||
J2DGXColorS10* color1p = material->getTevBlock()->getTevColor(1);
|
||||
GXColorS10 color1;
|
||||
color1.r = color1p->r;
|
||||
color1.g = color1p->g;
|
||||
color1.b = color1p->b;
|
||||
color1.a = color1p->a;
|
||||
J2DGXColorS10 color0 = *material->getTevBlock()->getTevColor(0);
|
||||
J2DGXColorS10 color1 = *material->getTevBlock()->getTevColor(1);
|
||||
|
||||
mBlack = JUtility::TColor(((u8)color0.r << 0x18) | ((u8)color0.g << 0x10) |
|
||||
((u8)color0.b << 8) | (u8)color0.a);
|
||||
@@ -91,7 +80,7 @@ J2DPicture::J2DPicture(J2DPane* p_pane, JSURandomInputStream* p_stream, J2DMater
|
||||
((u8)color1.b << 8) | (u8)color1.a);
|
||||
}
|
||||
|
||||
mTextureNum = texgenNum <= 2 ? texgenNum : 2;
|
||||
mTextureNum = texgenNum > 2 ? 2 : texgenNum;
|
||||
}
|
||||
|
||||
field_0x109 = 0;
|
||||
@@ -127,7 +116,7 @@ J2DPicture::J2DPicture(J2DPane* p_pane, JSURandomInputStream* p_stream, J2DMater
|
||||
}
|
||||
|
||||
J2DPicture::J2DPicture(ResTIMG const* p_timg) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (u32 i = 0; i < 2; i++) {
|
||||
mTexture[i] = NULL;
|
||||
}
|
||||
|
||||
@@ -145,7 +134,7 @@ J2DPicture::J2DPicture(ResTIMG const* p_timg) {
|
||||
J2DPicture::J2DPicture(u64 tag, JGeometry::TBox2<f32> const& bounds, ResTIMG const* p_timg,
|
||||
ResTLUT const* p_tlut)
|
||||
: J2DPane(tag, bounds), mPalette(NULL) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (u32 i = 0; i < 2; i++) {
|
||||
mTexture[i] = NULL;
|
||||
}
|
||||
|
||||
@@ -169,47 +158,48 @@ void J2DPicture::private_readStream(J2DPane* parent, JSURandomInputStream* strea
|
||||
|
||||
ResTIMG* img;
|
||||
ResTLUT* lut;
|
||||
u32 var_r27 = 0;
|
||||
u8 var_r26 = stream->readU8();
|
||||
u8 local_172 = 0;
|
||||
u8 local_173 = 0;
|
||||
u8 r29 = stream->readU8();
|
||||
|
||||
img = (ResTIMG*)getPointer(stream, 'TIMG', archive);
|
||||
lut = (ResTLUT*)getPointer(stream, 'TLUT', archive);
|
||||
|
||||
u8 spA = stream->read8b();
|
||||
local_172 = stream->read8b();
|
||||
|
||||
var_r26 -= 3;
|
||||
if (var_r26 != 0) {
|
||||
var_r27 = stream->read8b();
|
||||
var_r26--;
|
||||
r29 -= 3;
|
||||
if (r29 != 0) {
|
||||
local_173 = stream->read8b();
|
||||
r29--;
|
||||
}
|
||||
|
||||
if (var_r26 != 0) {
|
||||
stream->read8b();
|
||||
var_r26--;
|
||||
if (r29 != 0) {
|
||||
u8 local_174 = stream->read8b();
|
||||
r29--;
|
||||
}
|
||||
|
||||
mBlack = 0;
|
||||
mWhite = 0xFFFFFFFF;
|
||||
|
||||
if (var_r26 != 0) {
|
||||
if (r29 != 0) {
|
||||
mBlack = stream->readU32();
|
||||
var_r26--;
|
||||
r29--;
|
||||
}
|
||||
|
||||
if (var_r26 != 0) {
|
||||
if (r29 != 0) {
|
||||
mWhite = stream->readU32();
|
||||
var_r26--;
|
||||
r29--;
|
||||
}
|
||||
|
||||
setCornerColor(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
|
||||
for (int i = 0; var_r26 != 0 && i < 4; i++) {
|
||||
for (int i = 0; r29 != 0 && i < 4; i++) {
|
||||
mCornerColor[i] = stream->readU32();
|
||||
var_r26--;
|
||||
r29--;
|
||||
}
|
||||
|
||||
stream->seek(headerPosition + header.mSize, JSUStreamSeekFrom_SET);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (u32 i = 0; i < 2; i++) {
|
||||
mTexture[i] = NULL;
|
||||
}
|
||||
|
||||
@@ -226,7 +216,7 @@ void J2DPicture::private_readStream(J2DPane* parent, JSURandomInputStream* strea
|
||||
mTexture[0]->attachPalette(mPalette);
|
||||
}
|
||||
|
||||
setTexCoord(mTexture[0], (J2DBinding)spA, (J2DMirror)(var_r27 & 3), (bool)((var_r27 >> 2) & 1));
|
||||
setTexCoord(mTexture[0], J2DBinding(local_172), J2DMirror(local_173 & 3), bool(local_173 & 4));
|
||||
setBlendRatio(1.0f, 1.0f);
|
||||
}
|
||||
|
||||
@@ -295,8 +285,7 @@ bool J2DPicture::prepareTexture(u8 param_0) {
|
||||
}
|
||||
|
||||
if (mTexture[i] == NULL) {
|
||||
JUTTexture* tmp = new JUTTexture();
|
||||
mTexture[i] = tmp;
|
||||
mTexture[i] = new JUTTexture();
|
||||
|
||||
if (mTexture[i] == NULL) {
|
||||
return 0;
|
||||
@@ -337,12 +326,12 @@ bool J2DPicture::insert(ResTIMG const* img, JUTPalette* palette, u8 param_2, f32
|
||||
} else {
|
||||
var_r31 = mTexture[mTextureNum];
|
||||
if (palette == NULL) {
|
||||
mTexture[mTextureNum]->storeTIMG(img, var_r26);
|
||||
var_r31->storeTIMG(img, var_r26);
|
||||
} else {
|
||||
mTexture[mTextureNum]->storeTIMG(img, palette);
|
||||
var_r31->storeTIMG(img, palette);
|
||||
}
|
||||
|
||||
u8 sp8[2];
|
||||
bool sp8[2];
|
||||
for (u8 i = 0; i < 2; i++) {
|
||||
sp8[i] = (field_0x109 & (1 << i)) != 0;
|
||||
}
|
||||
@@ -382,8 +371,7 @@ bool J2DPicture::insert(ResTIMG const* img, JUTPalette* palette, u8 param_2, f32
|
||||
|
||||
|
||||
bool J2DPicture::insert(char const* resName, JUTPalette* palette, u8 param_2, f32 param_3) {
|
||||
void* resource = J2DScreen::getNameResource(resName);
|
||||
return insert((ResTIMG*)resource, palette, param_2, param_3);
|
||||
return insert((ResTIMG*)J2DScreen::getNameResource(resName), palette, param_2, param_3);
|
||||
}
|
||||
|
||||
bool J2DPicture::insert(JUTTexture* texture, u8 param_1, f32 param_2) {
|
||||
@@ -464,8 +452,7 @@ const ResTIMG* J2DPicture::changeTexture(ResTIMG const* img, u8 texIndex) {
|
||||
|
||||
const ResTIMG* result;
|
||||
if (texIndex < mTextureNum) {
|
||||
JUTTexture* tex = getTexture(texIndex);
|
||||
result = tex->getTexInfo();
|
||||
result = getTexture(texIndex)->getTexInfo();
|
||||
|
||||
u8 var_r30 = 0;
|
||||
if (img->indexTexture != 0) {
|
||||
@@ -481,8 +468,7 @@ const ResTIMG* J2DPicture::changeTexture(ResTIMG const* img, u8 texIndex) {
|
||||
|
||||
|
||||
const ResTIMG* J2DPicture::changeTexture(char const* resName, u8 param_1) {
|
||||
void* resource = J2DScreen::getNameResource(resName);
|
||||
return changeTexture((ResTIMG*)resource, param_1);
|
||||
return changeTexture((ResTIMG*)J2DScreen::getNameResource(resName), param_1);
|
||||
}
|
||||
|
||||
static bool dummy_weak_order(JUTTexture* tex) {
|
||||
@@ -497,12 +483,12 @@ const ResTIMG* J2DPicture::changeTexture(ResTIMG const* img, u8 texIndex, JUTPal
|
||||
|
||||
const ResTIMG* result;
|
||||
if (texIndex < mTextureNum) {
|
||||
JUTTexture* tex = getTexture(texIndex);
|
||||
result = tex->getTexInfo();
|
||||
result = getTexture(texIndex)->getTexInfo();
|
||||
|
||||
GXTlut var_r30 = GX_TLUT0;
|
||||
if (img->indexTexture != 0) {
|
||||
var_r30 = getTlutID(img, getUsableTlut(texIndex));
|
||||
u8 tlut = getUsableTlut(texIndex);
|
||||
var_r30 = getTlutID(img, tlut);
|
||||
}
|
||||
getTexture(texIndex)->storeTIMG(img, palette, var_r30);
|
||||
return result;
|
||||
@@ -514,8 +500,7 @@ const ResTIMG* J2DPicture::changeTexture(ResTIMG const* img, u8 texIndex, JUTPal
|
||||
|
||||
|
||||
const ResTIMG* J2DPicture::changeTexture(char const* param_0, u8 param_1, JUTPalette* param_2) {
|
||||
void* resource = J2DScreen::getNameResource(param_0);
|
||||
return changeTexture((ResTIMG*)resource, param_1, param_2);
|
||||
return changeTexture((ResTIMG*)J2DScreen::getNameResource(param_0), param_1, param_2);
|
||||
}
|
||||
|
||||
void J2DPicture::drawSelf(f32 param_0, f32 param_1) {
|
||||
@@ -528,7 +513,7 @@ void J2DPicture::drawSelf(f32 param_0, f32 param_1) {
|
||||
void J2DPicture::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) {
|
||||
if (mTexture[0] != NULL && mTextureNum != 0) {
|
||||
drawFullSet(mGlobalBounds.i.x + param_0, mGlobalBounds.i.y + param_1,
|
||||
mBounds.f.x - mBounds.i.x, mBounds.f.y - mBounds.i.y, param_2);
|
||||
getWidth(), getHeight(), param_2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -543,6 +528,8 @@ void J2DPicture::drawFullSet(f32 param_0, f32 param_1, f32 param_2, f32 param_3,
|
||||
void J2DPicture::draw(f32 x, f32 y, f32 width, f32 height, bool mirrorX, bool mirrorY,
|
||||
bool rotate90) {
|
||||
if (isVisible() && mTextureNum != 0 && mTexture[0] != NULL) {
|
||||
f32 x2 = x + width;
|
||||
f32 y2 = y + height;
|
||||
for (u8 i = 0; i < mTextureNum; i++) {
|
||||
load(i);
|
||||
}
|
||||
@@ -802,6 +789,36 @@ void J2DPicture::swap(f32& lhs, f32& rhs) {
|
||||
rhs = tmp;
|
||||
}
|
||||
|
||||
J2DBinding J2DPicture::getBinding() const {
|
||||
int r30 = J2DBind_None;
|
||||
bool r29 = isTumble();
|
||||
if (field_0x10a[0].x == 0 || field_0x10a[0].x == 256) {
|
||||
r30 |= !r29 ? J2DBind_Left : J2DBind_Top;
|
||||
}
|
||||
if (field_0x10a[0].y == 0 || field_0x10a[0].y == 256) {
|
||||
r30 |= !r29 ? J2DBind_Top : J2DBind_Left;
|
||||
}
|
||||
if (field_0x10a[3].x == 0 || field_0x10a[3].x == 256) {
|
||||
r30 |= !r29 ? J2DBind_Right : J2DBind_Bottom;
|
||||
}
|
||||
if (field_0x10a[3].y == 0 || field_0x10a[3].y == 256) {
|
||||
r30 |= !r29 ? J2DBind_Bottom : J2DBind_Right;
|
||||
}
|
||||
return J2DBinding(r30);
|
||||
}
|
||||
|
||||
void J2DPicture::setMirror(J2DMirror mirror) {
|
||||
if (getTexture(0)) {
|
||||
J2DBinding binding = getBinding();
|
||||
bool r28 = isTumble();
|
||||
setTexCoord(getTexture(0), binding, mirror, r28);
|
||||
}
|
||||
}
|
||||
|
||||
bool J2DPicture::isTumble() const {
|
||||
return field_0x10a[1] == JGeometry::TVec2<s16>(s16(field_0x10a[0].x), s16(field_0x10a[3].y));
|
||||
}
|
||||
|
||||
void J2DPicture::setBlendColorRatio(f32 param_0, f32 param_1) {
|
||||
field_0x11c[0] = param_0;
|
||||
field_0x11c[1] = param_1;
|
||||
@@ -822,10 +839,9 @@ void J2DPicture::setBlendKonstColor() {
|
||||
tmp += field_0x11c[j];
|
||||
}
|
||||
|
||||
f32 tmp2 = tmp + field_0x11c[i];
|
||||
if (tmp2 != 0.0f) {
|
||||
// probably fake match but idk whats happening here
|
||||
uvar3 |= (u8)(255.0f * (1.0f - tmp / tmp2)) << (i - 1) * 8;
|
||||
if (tmp + field_0x11c[i] != 0.0f) {
|
||||
f32 tmp2 = 255.0f * (1.0f - tmp / (tmp + field_0x11c[i]));
|
||||
uvar3 |= (u8)tmp2 << (i - 1) * 8;
|
||||
}
|
||||
}
|
||||
mBlendKonstColor = uvar3;
|
||||
@@ -839,10 +855,9 @@ void J2DPicture::setBlendKonstAlpha() {
|
||||
tmp += field_0x124[j];
|
||||
}
|
||||
|
||||
f32 tmp2 = tmp + field_0x124[i];
|
||||
if (tmp2 != 0.0f) {
|
||||
// probably fake match but idk whats happening here
|
||||
uvar3 |= (u8)(255.0f * (1.0f - tmp / tmp2)) << (i - 1) * 8;
|
||||
if (tmp + field_0x124[i] != 0.0f) {
|
||||
f32 tmp2 = 255.0f * (1.0f - tmp / (tmp + field_0x124[i]));
|
||||
uvar3 |= (u8)tmp2 << (i - 1) * 8;
|
||||
}
|
||||
}
|
||||
mBlendKonstAlpha = uvar3;
|
||||
@@ -875,45 +890,15 @@ void J2DPicture::setTexCoord(JGeometry::TVec2<s16>* param_0, JUTTexture const* p
|
||||
bool bindBottom;
|
||||
|
||||
if (!rotate90) {
|
||||
if (mirror & J2DMirror_X)
|
||||
bindLeft = binding & J2DBind_Right;
|
||||
else
|
||||
bindLeft = binding & J2DBind_Left;
|
||||
|
||||
if (mirror & J2DMirror_X)
|
||||
bindRight = binding & J2DBind_Left;
|
||||
else
|
||||
bindRight = binding & J2DBind_Right;
|
||||
|
||||
if (mirror & J2DMirror_Y)
|
||||
bindTop = binding & J2DBind_Bottom;
|
||||
else
|
||||
bindTop = binding & J2DBind_Top;
|
||||
|
||||
if (mirror & J2DMirror_Y)
|
||||
bindBottom = binding & J2DBind_Top;
|
||||
else
|
||||
bindBottom = binding & J2DBind_Bottom;
|
||||
bindLeft = mirror & J2DMirror_X ? bool(binding & J2DBind_Right) : bool(binding & J2DBind_Left);
|
||||
bindRight = mirror & J2DMirror_X ? bool(binding & J2DBind_Left) : bool(binding & J2DBind_Right);
|
||||
bindTop = mirror & J2DMirror_Y ? bool(binding & J2DBind_Bottom) : bool(binding & J2DBind_Top);
|
||||
bindBottom = mirror & J2DMirror_Y ? bool(binding & J2DBind_Top) : bool(binding & J2DBind_Bottom);
|
||||
} else {
|
||||
if (mirror & J2DMirror_X)
|
||||
bindLeft = binding & J2DBind_Bottom;
|
||||
else
|
||||
bindLeft = binding & J2DBind_Top;
|
||||
|
||||
if (mirror & J2DMirror_X)
|
||||
bindRight = binding & J2DBind_Top;
|
||||
else
|
||||
bindRight = binding & J2DBind_Bottom;
|
||||
|
||||
if (mirror & J2DMirror_Y)
|
||||
bindTop = binding & J2DBind_Left;
|
||||
else
|
||||
bindTop = binding & J2DBind_Right;
|
||||
|
||||
if (mirror & J2DMirror_Y)
|
||||
bindBottom = binding & J2DBind_Right;
|
||||
else
|
||||
bindBottom = binding & J2DBind_Left;
|
||||
bindLeft = mirror & J2DMirror_X ? bool(binding & J2DBind_Bottom) : bool(binding & J2DBind_Top);
|
||||
bindRight = mirror & J2DMirror_X ? bool(binding & J2DBind_Top) : bool(binding & J2DBind_Bottom);
|
||||
bindTop = mirror & J2DMirror_Y ? bool(binding & J2DBind_Left) : bool(binding & J2DBind_Right);
|
||||
bindBottom = mirror & J2DMirror_Y ? bool(binding & J2DBind_Right) : bool(binding & J2DBind_Left);
|
||||
}
|
||||
|
||||
f32 rectWidth;
|
||||
@@ -992,7 +977,7 @@ bool J2DPicture::isUsed(ResTIMG const* param_0) {
|
||||
}
|
||||
|
||||
u8 J2DPicture::getUsableTlut(u8 param_0) {
|
||||
u8 var_r8 = 0;
|
||||
u8 r27 = 0;
|
||||
|
||||
for (u8 i = 0; i < mTextureNum; i++) {
|
||||
if (i != param_0 && mTexture[i] != NULL) {
|
||||
@@ -1000,25 +985,32 @@ u8 J2DPicture::getUsableTlut(u8 param_0) {
|
||||
|
||||
if (img != NULL && img->indexTexture != 0) {
|
||||
int name = mTexture[i]->getTlutName();
|
||||
int var_r0 = name >= GX_BIGTLUT0 ? GX_BIGTLUT0 : GX_TLUT0;
|
||||
|
||||
u8 temp_r0 = name - var_r0;
|
||||
if (temp_r0 < 2) {
|
||||
var_r8 |= (1 << temp_r0);
|
||||
GXTlut local_34;
|
||||
(void)&local_34; // force this variable to the stack
|
||||
if (name >= GX_BIGTLUT0) {
|
||||
local_34 = GX_BIGTLUT0;
|
||||
} else {
|
||||
local_34 = GX_TLUT0;
|
||||
}
|
||||
|
||||
u8 r24 = name - local_34;
|
||||
if (r24 < 2) {
|
||||
r27 |= (1 << r24);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u8 var_r26 = 0;
|
||||
u8 r23 = 0;
|
||||
for (u8 i = 0; i < 2; i++) {
|
||||
if (!(var_r8 & (1 << i))) {
|
||||
var_r26 = i;
|
||||
if (!(r27 & (1 << i))) {
|
||||
r23 = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return var_r26;
|
||||
return r23;
|
||||
}
|
||||
|
||||
GXTlut J2DPicture::getTlutID(ResTIMG const* img, u8 param_1) {
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include "dolphin/types.h"
|
||||
|
||||
void J2DPictureEx::initiate(ResTIMG const* param_0, ResTLUT const* param_1) {
|
||||
J2DTexGenBlock* this_00 = mMaterial->getTexGenBlock();
|
||||
if (this_00->getTexGenNum() == 0 && append(param_0, 1.0f) && param_1 != NULL) {
|
||||
u32 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum();
|
||||
if (texGenNum == 0 && append(param_0, 1.0f) && param_1 != NULL) {
|
||||
if (mMaterial->getTevBlock()->getPalette(0) == NULL) {
|
||||
mMaterial->getTevBlock()->setPalette(0, param_1);
|
||||
}
|
||||
@@ -102,43 +102,44 @@ void J2DPictureEx::drawTexCoord(f32 param_0, f32 param_1, f32 param_2, f32 param
|
||||
f32 dVar11 = param_1 + param_3;
|
||||
Mtx auStack_88;
|
||||
MTXConcat(*param_12, mGlobalMtx, auStack_88);
|
||||
if (mMaterial == NULL || mMaterial->isVisible()) {
|
||||
GXLoadPosMtxImm(auStack_88, 0);
|
||||
JUtility::TColor TStack_8c = mCornerColor[0];
|
||||
JUtility::TColor TStack_90 = mCornerColor[1];
|
||||
JUtility::TColor TStack_94 = mCornerColor[2];
|
||||
JUtility::TColor TStack_98 = mCornerColor[3];
|
||||
if (mMaterial != NULL) {
|
||||
if (mMaterial->getColorBlock()->getColorChan(1)->getMatSrc() == 1) {
|
||||
if (mMaterial->getMaterialAlphaCalc() == 1) {
|
||||
TStack_8c.a = TStack_8c.a * mColorAlpha / 255;
|
||||
TStack_90.a = TStack_90.a * mColorAlpha / 255;
|
||||
TStack_94.a = TStack_94.a * mColorAlpha / 255;
|
||||
TStack_98.a = TStack_98.a * mColorAlpha / 255;
|
||||
}
|
||||
} else if (mIsInfluencedAlpha) {
|
||||
GXSetChanMatColor(GX_ALPHA0, JUtility::TColor(mColorAlpha));
|
||||
}
|
||||
}
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBA4, 8);
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
GXPosition3f32(param_0, param_1, 0.0f);
|
||||
GXColor1u32(TStack_8c);
|
||||
GXTexCoord2s16(param_4, param_5);
|
||||
GXPosition3f32(dVar12, param_1, 0.0f);
|
||||
GXColor1u32(TStack_90);
|
||||
GXTexCoord2s16(param_6, param_7);
|
||||
GXPosition3f32(dVar12, dVar11, 0.0f);
|
||||
GXColor1u32(TStack_98);
|
||||
GXTexCoord2s16(param_10, param_11);
|
||||
GXPosition3f32(param_0, dVar11, 0.0f);
|
||||
GXColor1u32(TStack_94);
|
||||
GXTexCoord2s16(param_8, param_9);
|
||||
GXEnd();
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
|
||||
if (mMaterial && !mMaterial->isVisible()) {
|
||||
return;
|
||||
}
|
||||
GXLoadPosMtxImm(auStack_88, 0);
|
||||
JUtility::TColor TStack_8c = mCornerColor[0];
|
||||
JUtility::TColor TStack_90 = mCornerColor[1];
|
||||
JUtility::TColor TStack_94 = mCornerColor[2];
|
||||
JUtility::TColor TStack_98 = mCornerColor[3];
|
||||
if (mMaterial != NULL) {
|
||||
if (mMaterial->getColorBlock()->getColorChan(1)->getMatSrc() == 1) {
|
||||
if (mMaterial->getMaterialAlphaCalc() == 1) {
|
||||
TStack_8c.a = TStack_8c.a * mColorAlpha / 255;
|
||||
TStack_90.a = TStack_90.a * mColorAlpha / 255;
|
||||
TStack_94.a = TStack_94.a * mColorAlpha / 255;
|
||||
TStack_98.a = TStack_98.a * mColorAlpha / 255;
|
||||
}
|
||||
} else if (mIsInfluencedAlpha) {
|
||||
GXSetChanMatColor(GX_ALPHA0, JUtility::TColor(mColorAlpha));
|
||||
}
|
||||
}
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBA4, 8);
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
GXPosition3f32(param_0, param_1, 0.0f);
|
||||
GXColor1u32(TStack_8c);
|
||||
GXTexCoord2s16(param_4, param_5);
|
||||
GXPosition3f32(dVar12, param_1, 0.0f);
|
||||
GXColor1u32(TStack_90);
|
||||
GXTexCoord2s16(param_6, param_7);
|
||||
GXPosition3f32(dVar12, dVar11, 0.0f);
|
||||
GXColor1u32(TStack_98);
|
||||
GXTexCoord2s16(param_10, param_11);
|
||||
GXPosition3f32(param_0, dVar11, 0.0f);
|
||||
GXColor1u32(TStack_94);
|
||||
GXTexCoord2s16(param_8, param_9);
|
||||
GXEnd();
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +148,8 @@ bool J2DPictureEx::append(ResTIMG const* param_0, JUTPalette* param_1, f32 param
|
||||
return false;
|
||||
}
|
||||
|
||||
return insert(param_0, param_1, mMaterial->getTexGenBlock()->getTexGenNum(), param_2);
|
||||
u32 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum();
|
||||
return insert(param_0, param_1, texGenNum, param_2);
|
||||
}
|
||||
|
||||
bool J2DPictureEx::append(char const* param_0, JUTPalette* param_1, f32 param_2) {
|
||||
@@ -155,7 +157,8 @@ bool J2DPictureEx::append(char const* param_0, JUTPalette* param_1, f32 param_2)
|
||||
return false;
|
||||
}
|
||||
|
||||
return insert(param_0, param_1, mMaterial->getTexGenBlock()->getTexGenNum(), param_2);
|
||||
u32 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum();
|
||||
return insert(param_0, param_1, texGenNum, param_2);
|
||||
}
|
||||
|
||||
bool J2DPictureEx::append(JUTTexture* param_0, f32 param_1) {
|
||||
@@ -163,7 +166,8 @@ bool J2DPictureEx::append(JUTTexture* param_0, f32 param_1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return insert(param_0, mMaterial->getTexGenBlock()->getTexGenNum(), param_1);
|
||||
u32 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum();
|
||||
return insert(param_0, texGenNum, param_1);
|
||||
}
|
||||
|
||||
bool J2DPictureEx::insert(ResTIMG const* param_0, JUTPalette* param_1, u8 param_2,
|
||||
@@ -182,8 +186,7 @@ bool J2DPictureEx::insert(ResTIMG const* param_0, JUTPalette* param_1, u8 param_
|
||||
}
|
||||
|
||||
bool J2DPictureEx::insert(char const* param_0, JUTPalette* param_1, u8 param_2, f32 param_3) {
|
||||
ResTIMG const* resource = (ResTIMG const*)J2DScreen::getNameResource(param_0);
|
||||
return insert(resource, param_1, param_2, param_3);
|
||||
return insert((ResTIMG*)J2DScreen::getNameResource(param_0), param_1, param_2, param_3);
|
||||
}
|
||||
|
||||
bool J2DPictureEx::insert(JUTTexture* param_0, u8 param_1, f32 param_2) {
|
||||
@@ -201,15 +204,14 @@ bool J2DPictureEx::insert(JUTTexture* param_0, u8 param_1, f32 param_2) {
|
||||
}
|
||||
|
||||
void J2DPictureEx::insertCommon(u8 pos, f32 param_1) {
|
||||
u8 new_tev_stage_num;
|
||||
u8 tex_gen_num = mMaterial->getTexGenBlock()->getTexGenNum();
|
||||
mMaterial->getTevBlock()->getMaxStage();
|
||||
int tev_stage_num = mMaterial->getTevBlock()->getTevStageNum();
|
||||
u8 maxStage = mMaterial->getTevBlock()->getMaxStage();
|
||||
u8 tev_stage_num = u8(mMaterial->getTevBlock()->getTevStageNum());
|
||||
bool bVar1;
|
||||
if (tex_gen_num <= 1) {
|
||||
bVar1 = tev_stage_num != 1;
|
||||
bVar1 = tev_stage_num == 1 ? false : true;
|
||||
} else {
|
||||
bVar1 = tev_stage_num != tex_gen_num + 1;
|
||||
bVar1 = int(tev_stage_num) == tex_gen_num + 1 ? false : true;
|
||||
}
|
||||
|
||||
shiftSetBlendRatio(pos, param_1, true, true);
|
||||
@@ -228,21 +230,22 @@ void J2DPictureEx::insertCommon(u8 pos, f32 param_1) {
|
||||
}
|
||||
|
||||
for (int i = tex_gen_num - 1; i > pos; i--) {
|
||||
mMaterial->getTexGenBlock()->setTexMtx((u8)i, mMaterial->getTexGenBlock()->getTexMtx((u8)(i - 1)));
|
||||
J2DTexMtx* texMtx = &mMaterial->getTexGenBlock()->getTexMtx((u8)(i - 1));
|
||||
mMaterial->getTexGenBlock()->setTexMtx((u8)i, *texMtx);
|
||||
}
|
||||
|
||||
J2DTexMtx tex_mtx;
|
||||
mMaterial->getTexGenBlock()->setTexMtx(pos, tex_mtx);
|
||||
|
||||
if (tex_gen_num == 1) {
|
||||
new_tev_stage_num = 1;
|
||||
tev_stage_num = 1;
|
||||
} else {
|
||||
new_tev_stage_num = tex_gen_num + (bVar1 ? 2 : 1);
|
||||
tev_stage_num = tex_gen_num + (bVar1 ? 2 : 1);
|
||||
}
|
||||
mMaterial->getTevBlock()->setTevStageNum(new_tev_stage_num);
|
||||
mMaterial->getTevBlock()->setTevStageNum(tev_stage_num);
|
||||
|
||||
setTevOrder(tex_gen_num, new_tev_stage_num, bVar1);
|
||||
setTevStage(tex_gen_num, new_tev_stage_num, bVar1);
|
||||
setTevOrder(tex_gen_num, tev_stage_num, bVar1);
|
||||
setTevStage(tex_gen_num, tev_stage_num, bVar1);
|
||||
setTevKColor(tex_gen_num);
|
||||
setTevKColorSel(tex_gen_num);
|
||||
setTevKAlphaSel(tex_gen_num);
|
||||
@@ -265,7 +268,8 @@ bool J2DPictureEx::isInsert(u8 pos) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (maxStage == mMaterial->getTevBlock()->getTevStageNum() && texGenNum != 0) {
|
||||
u8 tevStageNum = u8(mMaterial->getTevBlock()->getTevStageNum());
|
||||
if (maxStage == tevStageNum && texGenNum != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -278,7 +282,7 @@ bool J2DPictureEx::remove(u8 pos) {
|
||||
}
|
||||
|
||||
u8 tex_gen_num = mMaterial->getTexGenBlock()->getTexGenNum();
|
||||
u8 tev_stage_num = mMaterial->getTevBlock()->getTevStageNum();
|
||||
u8 tev_stage_num = u8(mMaterial->getTevBlock()->getTevStageNum());
|
||||
bool bVar1 = tev_stage_num == tex_gen_num + 1 ? false : true;
|
||||
|
||||
shiftSetBlendRatio(pos, 0.0f, true, false);
|
||||
@@ -360,18 +364,17 @@ void J2DPictureEx::draw(f32 param_0, f32 param_1, u8 texNo, bool param_3, bool p
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isVisible()) {
|
||||
return;
|
||||
}
|
||||
if (isVisible()) {
|
||||
u32 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum();
|
||||
if (texNo >= texGenNum) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (texNo >= mMaterial->getTexGenBlock()->getTexGenNum()) {
|
||||
return;
|
||||
}
|
||||
|
||||
JUTTexture* texture = mMaterial->getTevBlock()->getTexture(texNo);
|
||||
if (texture != NULL) {
|
||||
draw(param_0, param_1, texture->getWidth(), texture->getHeight(),
|
||||
param_3, param_4, param_5);
|
||||
JUTTexture* texture = mMaterial->getTevBlock()->getTexture(texNo);
|
||||
if (texture != NULL) {
|
||||
draw(param_0, param_1, texture->getWidth(), texture->getHeight(),
|
||||
param_3, param_4, param_5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,8 +619,9 @@ void J2DPictureEx::setTevOrder(u8 param_0, u8 param_1, bool param_2) {
|
||||
}
|
||||
|
||||
void J2DPictureEx::setTevStage(u8 param_0, u8 param_1, bool param_2) {
|
||||
J2DTevStage* stage;
|
||||
if (param_0 == 1) {
|
||||
J2DTevStage* stage = mMaterial->getTevBlock()->getTevStage(0);
|
||||
stage = mMaterial->getTevBlock()->getTevStage(0);
|
||||
JUTTexture* texture = mMaterial->getTevBlock()->getTexture(0);
|
||||
bool bVar1 = false;
|
||||
if (texture != NULL && texture->getTexInfo() != NULL
|
||||
@@ -634,7 +638,7 @@ void J2DPictureEx::setTevStage(u8 param_0, u8 param_1, bool param_2) {
|
||||
setStage(stage, STAGE_4);
|
||||
}
|
||||
} else if (!param_2) {
|
||||
J2DTevStage* stage = mMaterial->getTevBlock()->getTevStage(0);
|
||||
stage = mMaterial->getTevBlock()->getTevStage(0);
|
||||
setStage(stage, STAGE_2);
|
||||
for (u8 i = 1; i < param_0; i++) {
|
||||
stage = mMaterial->getTevBlock()->getTevStage(i);
|
||||
@@ -643,7 +647,7 @@ void J2DPictureEx::setTevStage(u8 param_0, u8 param_1, bool param_2) {
|
||||
stage = mMaterial->getTevBlock()->getTevStage(param_0);
|
||||
setStage(stage, STAGE_4);
|
||||
} else {
|
||||
J2DTevStage* stage = mMaterial->getTevBlock()->getTevStage(0);
|
||||
stage = mMaterial->getTevBlock()->getTevStage(0);
|
||||
setStage(stage, STAGE_2);
|
||||
for (u8 i = 1; i < param_0; i++) {
|
||||
stage = mMaterial->getTevBlock()->getTevStage(i);
|
||||
@@ -812,7 +816,8 @@ void J2DPictureEx::setBlendColorRatio(f32 param_0, f32 param_1) {
|
||||
field_0x160[i] = 1.0f;
|
||||
}
|
||||
|
||||
setTevKColor(mMaterial->getTexGenBlock()->getTexGenNum());
|
||||
u8 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum();
|
||||
setTevKColor(texGenNum);
|
||||
}
|
||||
|
||||
|
||||
@@ -828,7 +833,8 @@ void J2DPictureEx::setBlendAlphaRatio(f32 param_0, f32 param_1) {
|
||||
field_0x178[i] = 1.0f;
|
||||
}
|
||||
|
||||
setTevKColor(mMaterial->getTexGenBlock()->getTexGenNum());
|
||||
u8 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum();
|
||||
setTevKColor(texGenNum);
|
||||
}
|
||||
|
||||
|
||||
@@ -862,8 +868,7 @@ const ResTIMG* J2DPictureEx::changeTexture(ResTIMG const* img, u8 param_1) {
|
||||
}
|
||||
|
||||
const ResTIMG* J2DPictureEx::changeTexture(char const* param_0, u8 param_1) {
|
||||
ResTIMG const* resource = (ResTIMG const*)J2DScreen::getNameResource(param_0);
|
||||
return changeTexture(resource, param_1);
|
||||
return changeTexture((ResTIMG*)J2DScreen::getNameResource(param_0), param_1);
|
||||
}
|
||||
|
||||
const ResTIMG* J2DPictureEx::changeTexture(ResTIMG const* param_0, u8 param_1, JUTPalette* param_2) {
|
||||
@@ -884,7 +889,8 @@ const ResTIMG* J2DPictureEx::changeTexture(ResTIMG const* param_0, u8 param_1, J
|
||||
const ResTIMG* texInfo = getTexture(param_1)->getTexInfo();
|
||||
GXTlut _Var7 = GX_TLUT0;
|
||||
if (param_0->indexTexture != 0) {
|
||||
_Var7 = getTlutID(param_0, getUsableTlut(param_1));
|
||||
u8 tlut = getUsableTlut(param_1);
|
||||
_Var7 = getTlutID(param_0, tlut);
|
||||
}
|
||||
getTexture(param_1)->storeTIMG(param_0, param_2, _Var7);
|
||||
return texInfo;
|
||||
@@ -894,8 +900,7 @@ const ResTIMG* J2DPictureEx::changeTexture(ResTIMG const* param_0, u8 param_1, J
|
||||
}
|
||||
|
||||
const ResTIMG* J2DPictureEx::changeTexture(char const* param_0, u8 param_1, JUTPalette* param_2) {
|
||||
ResTIMG const* resource = (ResTIMG const*)J2DScreen::getNameResource(param_0);
|
||||
return changeTexture(resource, param_1, param_2);
|
||||
return changeTexture((ResTIMG*)J2DScreen::getNameResource(param_0), param_1, param_2);
|
||||
}
|
||||
|
||||
JUTTexture* J2DPictureEx::getTexture(u8 param_0) const {
|
||||
@@ -952,10 +957,7 @@ bool J2DPictureEx::setBlackWhite(JUtility::TColor param_0, JUtility::TColor para
|
||||
bool bVar1;
|
||||
u8 uVar2;
|
||||
u8 texGenNum = mMaterial->getTexGenBlock()->getTexGenNum();
|
||||
bVar1 = true;
|
||||
if ((param_0 == 0) && (param_1 == 0xffffffff)) {
|
||||
bVar1 = false;
|
||||
}
|
||||
bVar1 = (param_0 != 0) || (param_1 != 0xffffffff);
|
||||
if (texGenNum == 1) {
|
||||
uVar2 = (bVar1) ? 2 : 1;
|
||||
} else {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
#include "JSystem/J2DGraph/J2DPrint.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTFont.h"
|
||||
#include <stdio>
|
||||
#include <stdlib>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
char* J2DPrint::mStrBuff;
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ s32 J2DScreen::makeHierarchyPanes(J2DPane* p_basePane, JSURandomInputStream* p_s
|
||||
|
||||
J2DPane* J2DScreen::createPane(J2DScrnBlockHeader const& header, JSURandomInputStream* p_stream,
|
||||
J2DPane* p_basePane, u32 param_3, JKRArchive* p_archive) {
|
||||
J2DPane* newPane;
|
||||
J2DPane* newPane = NULL;
|
||||
|
||||
switch (header.mTag) {
|
||||
case 'PAN1':
|
||||
@@ -212,6 +212,7 @@ J2DPane* J2DScreen::createPane(J2DScrnBlockHeader const& header, JSURandomInputS
|
||||
newPane = new J2DTextBox(p_basePane, p_stream, param_3, mMaterials);
|
||||
break;
|
||||
default:
|
||||
JUT_WARN(446, "%s", "unknown pane");
|
||||
s32 position = p_stream->getPosition();
|
||||
s32 size = header.mSize;
|
||||
s32 start = size + position;
|
||||
@@ -280,29 +281,30 @@ void J2DScreen::drawSelf(f32 param_0, f32 param_1, Mtx* param_2) {
|
||||
JUtility::TColor color(mColor);
|
||||
u8 alpha = (color.a * mAlpha) / 255;
|
||||
|
||||
if (alpha != 0) {
|
||||
JUtility::TColor sp8(alpha | ((u32)color & 0xFFFFFF00));
|
||||
color = sp8;
|
||||
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
|
||||
GXPosition3f32(0.0f, 0.0f, 0.0f);
|
||||
GXColor1u32(color);
|
||||
|
||||
GXPosition3f32(getWidth(), 0.0f, 0.0f);
|
||||
GXColor1u32(color);
|
||||
|
||||
GXPosition3f32(getWidth(), getHeight(), 0.0f);
|
||||
GXColor1u32(color);
|
||||
|
||||
GXPosition3f32(0.0f, getHeight(), 0.0f);
|
||||
GXColor1u32(color);
|
||||
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
|
||||
GXEnd();
|
||||
if (alpha == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
color = JUtility::TColor(alpha | ((u32)color & 0xFFFFFF00));
|
||||
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
|
||||
GXPosition3f32(0.0f, 0.0f, 0.0f);
|
||||
GXColor1u32(color);
|
||||
|
||||
GXPosition3f32(getWidth(), 0.0f, 0.0f);
|
||||
GXColor1u32(color);
|
||||
|
||||
GXPosition3f32(getWidth(), getHeight(), 0.0f);
|
||||
GXColor1u32(color);
|
||||
|
||||
GXPosition3f32(0.0f, getHeight(), 0.0f);
|
||||
GXColor1u32(color);
|
||||
GXEnd();
|
||||
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
|
||||
}
|
||||
|
||||
J2DResReference* J2DScreen::getResReference(JSURandomInputStream* p_stream, u32 param_1) {
|
||||
@@ -407,7 +409,7 @@ bool J2DScreen::isUsed(ResFONT const* p_font) {
|
||||
J2DDataManage* J2DScreen::mDataManage;
|
||||
|
||||
void* J2DScreen::getNameResource(char const* resName) {
|
||||
void* res = JKRFileLoader::getGlbResource(resName, NULL);
|
||||
void* res = JKRGetNameResource(resName, NULL);
|
||||
|
||||
if (res == NULL && mDataManage != NULL) {
|
||||
res = mDataManage->get(resName);
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J2DGraph/J2DTevs.h"
|
||||
#include "JSystem/J2DGraph/J2DMatBlock.h"
|
||||
#include <math>
|
||||
#include "JSystem/J2DGraph/J2DMaterial.h"
|
||||
#include <cmath>
|
||||
#include "dolphin/gx.h"
|
||||
|
||||
void J2DTexMtx::load(u32 mtxIdx) {
|
||||
@@ -76,22 +76,33 @@ void J2DIndTexOrder::load(u8 indTexStage) {
|
||||
GXSetIndTexOrder((GXIndTexStageID)indTexStage, (GXTexCoordID)mInfo.mTexCoordID, (GXTexMapID)mInfo.mTexMapID);
|
||||
}
|
||||
|
||||
static void dummyVirtual(J2DTevBlock* block, J2DIndBlock* indBlock) {
|
||||
static void dummyVirtual(J2DMaterial* material) {
|
||||
J2DIndBlock* indBlock = material->getIndBlock();
|
||||
indBlock->getIndTexStageNum();
|
||||
indBlock->getIndTexOrder(0);
|
||||
indBlock->getIndTexStageNum();
|
||||
indBlock->getIndTexOrder(0);
|
||||
indBlock->getIndTexMtx(0);
|
||||
indBlock->getIndTexCoordScale(0);
|
||||
J2DColorBlock* colorBlock = material->getColorBlock();
|
||||
J2DTexGenBlock* texGenBlock = material->getTexGenBlock();
|
||||
texGenBlock->getTexGenNum();
|
||||
J2DTevBlock* block = material->getTevBlock();
|
||||
block->getIndTevStage(0);
|
||||
block->getTevStageNum();
|
||||
material->getPEBlock();
|
||||
material->getMaterialAlphaCalc();
|
||||
colorBlock->getMatColor(0);
|
||||
colorBlock->getColorChan(0);
|
||||
texGenBlock->getTexCoord(0);
|
||||
texGenBlock->getTexMtx(0).getTexMtxInfo();
|
||||
block->getTexNo(0);
|
||||
block->getFontNo();
|
||||
block->getTevKColor(0);
|
||||
block->getTevKColorSel(0);
|
||||
block->getTevKAlphaSel(0);
|
||||
block->getTevOrder(0);
|
||||
block->getTevColor(0);
|
||||
J2DGXColorS10 color(*block->getTevColor(0));
|
||||
block->getTevStage(0);
|
||||
block->getTevSwapModeTable(0);
|
||||
}
|
||||
|
||||
@@ -95,23 +95,16 @@ J2DWindow::J2DWindow(J2DPane* param_0, JSURandomInputStream* param_1, J2DMateria
|
||||
mWhite = JUtility::TColor(0xffffffff);
|
||||
|
||||
if (local_98[0] != NULL && local_98[0]->getTevBlock() != NULL) {
|
||||
if (local_98[0]->getTevBlock()->getTevStageNum() != 1) {
|
||||
J2DGXColorS10* local_c8 = local_98[0]->getTevBlock()->getTevColor(0);
|
||||
s16 blackr = local_c8->r;
|
||||
s16 blackg = local_c8->g;
|
||||
s16 blackb = local_c8->b;
|
||||
s16 blacka = local_c8->a;
|
||||
J2DGXColorS10* local_d0 = local_98[0]->getTevBlock()->getTevColor(1);
|
||||
s16 whiter = local_d0->r;
|
||||
s16 whiteg = local_d0->g;
|
||||
s16 whiteb = local_d0->b;
|
||||
s16 whitea = local_d0->a;
|
||||
u8 tevStageNum = u8(local_98[0]->getTevBlock()->getTevStageNum());
|
||||
if (tevStageNum != 1) {
|
||||
J2DGXColorS10 local_c8 = *local_98[0]->getTevBlock()->getTevColor(0);
|
||||
J2DGXColorS10 local_d0 = *local_98[0]->getTevBlock()->getTevColor(1);
|
||||
mBlack = JUtility::TColor(
|
||||
(((u8)blackr) << 24) | (((u8)blackg) << 16) | (((u8)blackb) << 8) |
|
||||
((u8)blacka));
|
||||
(((u8)local_c8.r) << 24) | (((u8)local_c8.g) << 16) | (((u8)local_c8.b) << 8) |
|
||||
((u8)local_c8.a));
|
||||
mWhite = JUtility::TColor(
|
||||
(((u8)whiter) << 24) | (((u8)whiteg) << 16) | (((u8)whiteb) << 8) |
|
||||
((u8)whitea));
|
||||
(((u8)local_d0.r) << 24) | (((u8)local_d0.g) << 16) | (((u8)local_d0.b) << 8) |
|
||||
((u8)local_d0.a));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,14 +115,12 @@ J2DWindow::J2DWindow(J2DPane* param_0, JSURandomInputStream* param_1, J2DMateria
|
||||
&field_0x10c,
|
||||
};
|
||||
|
||||
J2DMaterial * mat;
|
||||
for (u32 uVar6 = 0; uVar6 < 4; uVar6++) {
|
||||
mat = local_98[uVar6];
|
||||
if (mat != NULL && mat->getTevBlock() != NULL) {
|
||||
JUTTexture* local_e0 = mat->getTevBlock()->getTexture(0);
|
||||
if (local_98[uVar6] != NULL && local_98[uVar6]->getTevBlock() != NULL) {
|
||||
JUTTexture* local_e0 = local_98[uVar6]->getTevBlock()->getTexture(0);
|
||||
if (local_e0 != NULL) {
|
||||
*textures[uVar6] = local_e0;
|
||||
mat->getTevBlock()->setUndeleteFlag(0xfe);
|
||||
local_98[uVar6]->getTevBlock()->setUndeleteFlag(0xfe);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,6 +215,7 @@ void J2DWindow::private_readStream(J2DPane* param_0, JSURandomInputStream* param
|
||||
r27 -= u8(14);
|
||||
field_0x110 = NULL;
|
||||
if (r27) {
|
||||
int unused;
|
||||
timg = (ResTIMG*)getPointer(param_1, 'TIMG', param_2);
|
||||
if (timg) {
|
||||
field_0x110 = new JUTTexture(timg, 0);
|
||||
@@ -334,74 +326,39 @@ void J2DWindow::draw_private(JGeometry::TBox2<f32> const& param_0,
|
||||
f32 f27 = f29 + field_0x100->getWidth();
|
||||
f32 f26 = f28 + field_0x100->getHeight();
|
||||
drawFrameTexture(field_0x100, f29, f28, field_0x144 & 0x80, field_0x144 & 0x40, true);
|
||||
bool r24 = isField0x145Set(1);
|
||||
bool r24 = field_0x145 & 1;
|
||||
drawFrameTexture(field_0x104, f31, f28, field_0x144 & 0x20, field_0x144 & 0x10, r24);
|
||||
u16 local_a6;
|
||||
if (field_0x144 & 0x20) {
|
||||
local_a6 = 0x8000;
|
||||
} else {
|
||||
local_a6 = 0;
|
||||
}
|
||||
u16 local_a8;
|
||||
if (field_0x144 & 0x10) {
|
||||
local_a8 = 0;
|
||||
} else {
|
||||
local_a8 = 0x8000;
|
||||
}
|
||||
u16 local_a82 = local_a8 ^ 0x8000;
|
||||
|
||||
drawFrameTexture(field_0x104, f27, f28, f31 - f27, field_0x104->getHeight(), local_a6,
|
||||
local_a8, local_a6, local_a82, false);
|
||||
bool isset2 = isField0x145Set(2);
|
||||
drawFrameTexture(field_0x10c, f31, f30, field_0x144 & 2, field_0x144 & 1, isset2);
|
||||
u16 local_aa;
|
||||
if (field_0x144 & 2) {
|
||||
local_aa = 0x8000;
|
||||
} else {
|
||||
local_aa = 0;
|
||||
}
|
||||
u16 local_ac;
|
||||
if (field_0x144 & 1) {
|
||||
local_ac = 0;
|
||||
} else {
|
||||
local_ac = 0x8000;
|
||||
}
|
||||
local_a82 = local_ac ^ 0x8000;
|
||||
drawFrameTexture(field_0x10c, f27, f30, f31 - f27, field_0x10c->getHeight(), local_aa,
|
||||
local_ac, local_aa, local_a82, false);
|
||||
u16 local_ae;
|
||||
if (field_0x144 & 2) {
|
||||
local_ae = 0;
|
||||
} else {
|
||||
local_ae = 0x8000;
|
||||
}
|
||||
u16 local_ae2 = local_ae ^ 0x8000;
|
||||
u16 local_b0;
|
||||
if (field_0x144 & 1) {
|
||||
local_b0 = 0x8000;
|
||||
} else {
|
||||
local_b0 = 0;
|
||||
}
|
||||
drawFrameTexture(field_0x10c, f31, f26, field_0x10c->getWidth(), f30 - f26, local_ae,
|
||||
local_b0, local_ae2, local_b0, false);
|
||||
bool isset4 = isField0x145Set(4);
|
||||
drawFrameTexture(field_0x108, f29, f30, field_0x144 & 8, field_0x144 & 4, isset4);
|
||||
u16 r29, r28, r27, r26;
|
||||
r27 = field_0x144 & 0x20 ? u16(0x8000) : u16(0);
|
||||
r29 = r27;
|
||||
r28 = field_0x144 & 0x10 ? u16(0) : u16(0x8000);
|
||||
r26 = r28 ^ 0x8000;
|
||||
|
||||
u16 local_b2;
|
||||
if (field_0x144 & 8) {
|
||||
local_b2 = 0;
|
||||
} else {
|
||||
local_b2 = 0x8000;
|
||||
}
|
||||
u16 local_b22 = local_b2 ^ 0x8000;
|
||||
u16 local_b4;
|
||||
if (field_0x144 & 4) {
|
||||
local_b4 = 0x8000;
|
||||
} else {
|
||||
local_b4 = 0;
|
||||
}
|
||||
drawFrameTexture(field_0x108, f29, f26, field_0x108->getWidth(), f30 - f26, local_b2,
|
||||
local_b4, local_b22, local_b4, false);
|
||||
drawFrameTexture(field_0x104, f27, f28, f31 - f27, field_0x104->getHeight(), r29,
|
||||
r28, r27, r26, false);
|
||||
r24 = field_0x145 & 2;
|
||||
drawFrameTexture(field_0x10c, f31, f30, field_0x144 & 2, field_0x144 & 1, r24);
|
||||
r27 = field_0x144 & 2 ? u16(0x8000) : u16(0);
|
||||
r29 = r27;
|
||||
r28 = field_0x144 & 1 ? u16(0) : u16(0x8000);
|
||||
r26 = r28 ^ 0x8000;
|
||||
drawFrameTexture(field_0x10c, f27, f30, f31 - f27, field_0x10c->getHeight(), r29,
|
||||
r28, r27, r26, false);
|
||||
r29 = field_0x144 & 2 ? u16(0) : u16(0x8000);
|
||||
r27 = r29 ^ 0x8000;
|
||||
r26 = field_0x144 & 1 ? u16(0x8000) : u16(0);
|
||||
r28 = r26;
|
||||
drawFrameTexture(field_0x10c, f31, f26, field_0x10c->getWidth(), f30 - f26, r29,
|
||||
r28, r27, r26, false);
|
||||
r24 = field_0x145 & 4;
|
||||
drawFrameTexture(field_0x108, f29, f30, field_0x144 & 8, field_0x144 & 4, r24);
|
||||
|
||||
r29 = field_0x144 & 8 ? u16(0) : u16(0x8000);
|
||||
r27 = r29 ^ 0x8000;
|
||||
r26 = field_0x144 & 4 ? u16(0x8000) : u16(0);
|
||||
r28 = r26;
|
||||
drawFrameTexture(field_0x108, f29, f26, field_0x108->getWidth(), f30 - f26, r29,
|
||||
r28, r27, r26, false);
|
||||
}
|
||||
GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
@@ -671,42 +628,3 @@ bool J2DWindow::isUsed(ResTIMG const* param_0) {
|
||||
}
|
||||
return J2DPane::isUsed(param_0);
|
||||
}
|
||||
|
||||
u16 J2DWindow::getTypeID() const {
|
||||
return 17;
|
||||
}
|
||||
|
||||
void J2DWindow::draw(f32 param_0, f32 param_1, f32 param_2, f32 param_3) {
|
||||
draw(JGeometry::TBox2<f32>(param_0, param_1, param_0 + param_2, param_1 + param_3));
|
||||
}
|
||||
|
||||
JUTTexture* J2DWindow::getContentsTexture(u8 param_0) const {
|
||||
if (param_0 != 0) {
|
||||
return NULL;
|
||||
}
|
||||
return field_0x110;
|
||||
}
|
||||
|
||||
void J2DWindow::getMaterial(J2DWindow::TMaterial& param_0) const {
|
||||
param_0.field_0x0 = NULL;
|
||||
param_0.field_0x4 = NULL;
|
||||
param_0.field_0x8 = NULL;
|
||||
param_0.field_0xc = NULL;
|
||||
param_0.field_0x10 = NULL;
|
||||
}
|
||||
|
||||
J2DMaterial* J2DWindow::getFrameMaterial(u8 param_0) const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
J2DMaterial* J2DWindow::getContentsMaterial() const {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool J2DWindow::isUsed(ResFONT const* param_0) {
|
||||
return J2DPane::isUsed(param_0);
|
||||
}
|
||||
|
||||
void J2DWindow::rewriteAlpha() {
|
||||
/* empty function */
|
||||
}
|
||||
|
||||
@@ -81,6 +81,10 @@ J2DWindowEx::J2DWindowEx(J2DPane* param_0, JSURandomInputStream* param_1, u32 pa
|
||||
setMinSize();
|
||||
}
|
||||
|
||||
static void dummy(J2DTexGenBlock* block) {
|
||||
block->setTexCoord(0, J2DTexCoord());
|
||||
}
|
||||
|
||||
void J2DWindowEx::setMinSize() {
|
||||
field_0x140 = 1;
|
||||
field_0x142 = 1;
|
||||
|
||||
@@ -565,9 +565,8 @@ f32 J3DGetKeyFrameInterpolation(f32 frame, J3DAnmKeyTableBase* pKeyTable, T* pDa
|
||||
}
|
||||
|
||||
if (pKeyTable->mType == 0) {
|
||||
u32 idx = pKeyTable->mMaxFrame - 1;
|
||||
if (pData[idx * 3] <= frame) {
|
||||
return pData[idx * 3 + 1];
|
||||
if (pData[(pKeyTable->mMaxFrame - 1) * 3] <= frame) {
|
||||
return pData[(pKeyTable->mMaxFrame - 1) * 3 + 1];
|
||||
}
|
||||
|
||||
u32 uVar7 = pKeyTable->mMaxFrame;
|
||||
@@ -585,9 +584,8 @@ f32 J3DGetKeyFrameInterpolation(f32 frame, J3DAnmKeyTableBase* pKeyTable, T* pDa
|
||||
f32 interpolated = J3DHermiteInterpolation(frame, &pData[0], &pData[1], &pData[2], &pData[3], &pData[4], &pData[5]);
|
||||
return interpolated;
|
||||
} else {
|
||||
u32 idx = pKeyTable->mMaxFrame - 1;
|
||||
if (pData[idx * 4] <= frame) {
|
||||
return pData[idx * 4 + 1];
|
||||
if (pData[(pKeyTable->mMaxFrame - 1) * 4] <= frame) {
|
||||
return pData[(pKeyTable->mMaxFrame - 1) * 4 + 1];
|
||||
}
|
||||
|
||||
u32 var_r27 = pKeyTable->mMaxFrame;
|
||||
|
||||
@@ -252,6 +252,10 @@ void J3DDeformer::deform(J3DVertexBuffer* i_buffer, u16 param_1, f32* i_weights)
|
||||
}
|
||||
}
|
||||
|
||||
static void dummy(J3DDeformData* data) {
|
||||
data->getClusterNum();
|
||||
}
|
||||
|
||||
void J3DDeformer::normalizeWeight(int i_keyNum, f32* i_weights) {
|
||||
f32 totalWeight = 0.0f;
|
||||
for (u16 i = 0; i < i_keyNum; i++) {
|
||||
|
||||
@@ -10,16 +10,16 @@
|
||||
|
||||
void J3DMtxCalcJ3DSysInitBasic::init(Vec const& scale, Mtx const& mtx) {
|
||||
J3DSys::mCurrentS = scale;
|
||||
J3DSys::mParentS = (Vec){1.0f, 1.0f, 1.0f};
|
||||
JMAMTXApplyScale(mtx, J3DSys::mCurrentMtx, J3DSys::mCurrentS.x, J3DSys::mCurrentS.y,
|
||||
J3DSys::mCurrentS.z);
|
||||
Vec init = {1.0f, 1.0f, 1.0f};
|
||||
J3DSys::mParentS = init;
|
||||
JMAMTXApplyScale(mtx, J3DSys::mCurrentMtx, scale.x, scale.y, scale.z);
|
||||
}
|
||||
|
||||
void J3DMtxCalcJ3DSysInitMaya::init(Vec const& scale, Mtx const& mtx) {
|
||||
J3DSys::mParentS = (Vec){1.0f, 1.0f, 1.0f};
|
||||
Vec init = {1.0f, 1.0f, 1.0f};
|
||||
J3DSys::mParentS = init;
|
||||
J3DSys::mCurrentS = scale;
|
||||
JMAMTXApplyScale(mtx, J3DSys::mCurrentMtx, J3DSys::mCurrentS.x, J3DSys::mCurrentS.y,
|
||||
J3DSys::mCurrentS.z);
|
||||
JMAMTXApplyScale(mtx, J3DSys::mCurrentMtx, scale.x, scale.y, scale.z);
|
||||
}
|
||||
|
||||
J3DMtxBuffer* J3DMtxCalc::mMtxBuffer;
|
||||
@@ -35,8 +35,9 @@ inline s32 checkScaleOne(const Vec& param_0) {
|
||||
}
|
||||
|
||||
void J3DMtxCalcCalcTransformBasic::calcTransform(J3DTransformInfo const& transInfo) {
|
||||
J3DJoint* joint = J3DMtxCalc::getJoint();
|
||||
J3DMtxBuffer* mtxBuf = J3DMtxCalc::getMtxBuffer();
|
||||
u16 jntNo = J3DMtxCalc::getJoint()->getJntNo();
|
||||
u16 jntNo = joint->getJntNo();
|
||||
|
||||
MtxP anmMtx = mtxBuf->getAnmMtx(jntNo);
|
||||
|
||||
@@ -58,8 +59,9 @@ void J3DMtxCalcCalcTransformBasic::calcTransform(J3DTransformInfo const& transIn
|
||||
}
|
||||
|
||||
void J3DMtxCalcCalcTransformSoftimage::calcTransform(J3DTransformInfo const& transInfo) {
|
||||
J3DJoint* joint = J3DMtxCalc::getJoint();
|
||||
J3DMtxBuffer* mtxBuf = J3DMtxCalc::getMtxBuffer();
|
||||
u16 jntNo = J3DMtxCalc::getJoint()->getJntNo();
|
||||
u16 jntNo = joint->getJntNo();
|
||||
|
||||
MtxP anmMtx = mtxBuf->getAnmMtx(jntNo);
|
||||
|
||||
@@ -104,20 +106,22 @@ void J3DMtxCalcCalcTransformMaya::calcTransform(J3DTransformInfo const& transInf
|
||||
transInfo.mScale.z);
|
||||
}
|
||||
|
||||
if (joint->getScaleCompensate() == 1) {
|
||||
f32 invX = JMath::fastReciprocal(J3DSys::mParentS.x);
|
||||
f32 invY = JMath::fastReciprocal(J3DSys::mParentS.y);
|
||||
f32 invZ = JMath::fastReciprocal(J3DSys::mParentS.z);
|
||||
u8 scaleCompensate = joint->getScaleCompensate();
|
||||
if (scaleCompensate == 1) {
|
||||
Vec inv;
|
||||
inv.x = JMath::fastReciprocal(J3DSys::mParentS.x);
|
||||
inv.y = JMath::fastReciprocal(J3DSys::mParentS.y);
|
||||
inv.z = JMath::fastReciprocal(J3DSys::mParentS.z);
|
||||
|
||||
anmMtx[0][0] *= invX;
|
||||
anmMtx[0][1] *= invX;
|
||||
anmMtx[0][2] *= invX;
|
||||
anmMtx[1][0] *= invY;
|
||||
anmMtx[1][1] *= invY;
|
||||
anmMtx[1][2] *= invY;
|
||||
anmMtx[2][0] *= invZ;
|
||||
anmMtx[2][1] *= invZ;
|
||||
anmMtx[2][2] *= invZ;
|
||||
anmMtx[0][0] *= inv.x;
|
||||
anmMtx[0][1] *= inv.x;
|
||||
anmMtx[0][2] *= inv.x;
|
||||
anmMtx[1][0] *= inv.y;
|
||||
anmMtx[1][1] *= inv.y;
|
||||
anmMtx[1][2] *= inv.y;
|
||||
anmMtx[2][0] *= inv.z;
|
||||
anmMtx[2][1] *= inv.z;
|
||||
anmMtx[2][2] *= inv.z;
|
||||
}
|
||||
|
||||
MTXConcat(J3DSys::mCurrentMtx, anmMtx, J3DSys::mCurrentMtx);
|
||||
@@ -131,13 +135,13 @@ void J3DMtxCalcCalcTransformMaya::calcTransform(J3DTransformInfo const& transInf
|
||||
void J3DJoint::appendChild(J3DJoint* pChild) {
|
||||
if (mChild == NULL) {
|
||||
mChild = pChild;
|
||||
} else {
|
||||
J3DJoint* curChild = mChild;
|
||||
while (curChild->getYounger() != NULL) {
|
||||
curChild = curChild->getYounger();
|
||||
}
|
||||
curChild->setYounger(pChild);
|
||||
return;
|
||||
}
|
||||
J3DJoint* curChild = mChild;
|
||||
while (curChild->getYounger() != NULL) {
|
||||
curChild = curChild->getYounger();
|
||||
}
|
||||
curChild->setYounger(pChild);
|
||||
}
|
||||
|
||||
J3DJoint::J3DJoint() {
|
||||
@@ -149,7 +153,8 @@ J3DJoint::J3DJoint() {
|
||||
mJntNo = 0;
|
||||
mKind = 1;
|
||||
mScaleCompensate = false;
|
||||
__memcpy(&mTransformInfo, &j3dDefaultTransformInfo, sizeof(J3DTransformInfo));
|
||||
J3DTransformInfo* r30 = &mTransformInfo;
|
||||
void* r29 = __memcpy(r30, &j3dDefaultTransformInfo, sizeof(J3DTransformInfo));
|
||||
mBoundingSphereRadius = 0.0f;
|
||||
mMtxCalc = NULL;
|
||||
mMesh = NULL;
|
||||
@@ -173,16 +178,16 @@ void J3DJoint::entryIn() {
|
||||
j3dSys.getModel()->getShapePacket(mesh->getShape()->getIndex());
|
||||
if (!matPacket->isLocked()) {
|
||||
if (mesh->getMaterialAnm()) {
|
||||
J3DMaterialAnm* piVar8 = mesh->getMaterialAnm();
|
||||
piVar8->calc(mesh);
|
||||
mesh->getMaterialAnm()->calc(mesh);
|
||||
}
|
||||
mesh->calc(anmMtx);
|
||||
}
|
||||
mesh->setCurrentMtx();
|
||||
matPacket->setMaterialAnmID(mesh->getMaterialAnm());
|
||||
matPacket->setShapePacket(shapePacket);
|
||||
J3DDrawBuffer* drawBuffer = j3dSys.getDrawBuffer(mesh->isDrawModeOpaTexEdge());
|
||||
if ((u8)matPacket->entry(drawBuffer)) {
|
||||
bool isDrawModeOpaTexEdge = mesh->isDrawModeOpaTexEdge() == FALSE;
|
||||
u8 r24 = matPacket->entry(j3dSys.getDrawBuffer(isDrawModeOpaTexEdge));
|
||||
if (r24) {
|
||||
j3dSys.setMatPacket(matPacket);
|
||||
J3DDrawBuffer::entryNum++;
|
||||
mesh->makeDisplayList();
|
||||
@@ -197,18 +202,18 @@ J3DMtxCalc* J3DJoint::mCurrentMtxCalc;
|
||||
void J3DJoint::recursiveCalc() {
|
||||
J3DMtxCalc* prevMtxCalc = NULL;
|
||||
Mtx prevCurrentMtx;
|
||||
mDoMtx_copy(J3DSys::mCurrentMtx, prevCurrentMtx);
|
||||
f32 currentX = J3DSys::mCurrentS.x;
|
||||
f32 currentY = J3DSys::mCurrentS.y;
|
||||
f32 currentZ = J3DSys::mCurrentS.z;
|
||||
f32 parentX = J3DSys::mParentS.x;
|
||||
f32 parentY = J3DSys::mParentS.y;
|
||||
f32 parentZ = J3DSys::mParentS.z;
|
||||
MTXCopy(J3DSys::mCurrentMtx, prevCurrentMtx);
|
||||
Vec current, parent;
|
||||
current = J3DSys::mCurrentS;
|
||||
parent = J3DSys::mParentS;
|
||||
if (getMtxCalc() != NULL) {
|
||||
prevMtxCalc = getCurrentMtxCalc();
|
||||
J3DMtxCalc* piVar2 = this->getMtxCalc();
|
||||
setCurrentMtxCalc(piVar2);
|
||||
J3DMtxCalc::setJoint(this);
|
||||
#if DEBUG
|
||||
J3DMtxCalc::setMtxBuffer(J3DMtxCalc::getMtxBuffer());
|
||||
#endif
|
||||
piVar2->calc();
|
||||
} else {
|
||||
if (getCurrentMtxCalc() != NULL) {
|
||||
@@ -223,18 +228,14 @@ void J3DJoint::recursiveCalc() {
|
||||
(*jointCallback)(this, 0);
|
||||
}
|
||||
|
||||
J3DJoint* child = getChild();
|
||||
if (child != NULL) {
|
||||
child->recursiveCalc();
|
||||
J3DJoint* joint = getChild();
|
||||
if (joint != NULL) {
|
||||
joint->recursiveCalc();
|
||||
}
|
||||
mDoMtx_copy(prevCurrentMtx, J3DSys::mCurrentMtx);
|
||||
MTXCopy(prevCurrentMtx, J3DSys::mCurrentMtx);
|
||||
|
||||
J3DSys::mCurrentS.x = currentX;
|
||||
J3DSys::mCurrentS.y = currentY;
|
||||
J3DSys::mCurrentS.z = currentZ;
|
||||
J3DSys::mParentS.x = parentX;
|
||||
J3DSys::mParentS.y = parentY;
|
||||
J3DSys::mParentS.z = parentZ;
|
||||
J3DSys::mCurrentS = current;
|
||||
J3DSys::mParentS = parent;
|
||||
|
||||
if (prevMtxCalc != NULL) {
|
||||
setCurrentMtxCalc(prevMtxCalc);
|
||||
@@ -243,8 +244,8 @@ void J3DJoint::recursiveCalc() {
|
||||
(*jointCallback)(this, 1);
|
||||
}
|
||||
|
||||
J3DJoint* younger = getYounger();
|
||||
if (younger != NULL) {
|
||||
younger->recursiveCalc();
|
||||
joint = getYounger();
|
||||
if (joint != NULL) {
|
||||
joint->recursiveCalc();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DJointTree.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAttach.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShapeMtx.h"
|
||||
#include "JSystem/J3DGraphBase/J3DSys.h"
|
||||
|
||||
#define J3D_ASSERTMSG(LINE, COND, MSG) JUT_ASSERT_MSG(LINE, (COND) != 0, MSG)
|
||||
#define J3D_WARN1(LINE, MSG, ARG1) JUT_WARN(LINE, MSG, ARG1)
|
||||
@@ -146,8 +148,8 @@ s32 J3DModel::createMatPacket(J3DModelData* pModelData, u32 mdlFlags) {
|
||||
} else {
|
||||
if (pModelData->getModelDataType() == 1) {
|
||||
if (mdlFlags & J3DMdlFlag_UseSingleDL) {
|
||||
matPacket->mpDisplayListObj = materialNode->getSharedDisplayListObj();
|
||||
matPacket->setDisplayListObj(matPacket->mpDisplayListObj);
|
||||
J3DDisplayListObj* dlobj = materialNode->getSharedDisplayListObj();
|
||||
matPacket->setDisplayListObj(dlobj);
|
||||
} else {
|
||||
J3DDisplayListObj* dlobj = materialNode->getSharedDisplayListObj();
|
||||
ret = dlobj->single_To_Double();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DMtxBuffer.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DModelLoader.h"
|
||||
@@ -408,7 +409,10 @@ void J3DMtxBuffer::calcDrawMtx(u32 mdlFlag, Vec const& param_1, Mtx const& param
|
||||
|
||||
MtxP viewMtx;
|
||||
Mtx viewBaseMtx;
|
||||
u16 fullWgtNum;
|
||||
u16 fullWgtNum; // r25
|
||||
u16 local_68;
|
||||
u16 local_6a;
|
||||
u16 local_6c;
|
||||
|
||||
switch (mdlFlag) {
|
||||
case 0:
|
||||
@@ -423,19 +427,19 @@ void J3DMtxBuffer::calcDrawMtx(u32 mdlFlag, Vec const& param_1, Mtx const& param
|
||||
}
|
||||
return;
|
||||
case 1:
|
||||
fullWgtNum = mJointTree->getDrawFullWgtMtxNum();
|
||||
for (u16 i = 0; i < fullWgtNum; i++) {
|
||||
local_68 = mJointTree->getDrawFullWgtMtxNum();
|
||||
for (u16 i = 0; i < local_68; i++) {
|
||||
MTXCopy(getAnmMtx(mJointTree->getDrawMtxIndex(i)), *getDrawMtx(i));
|
||||
}
|
||||
fullWgtNum = mJointTree->getDrawFullWgtMtxNum();
|
||||
for (u16 i = 0; i < fullWgtNum; i++) {
|
||||
local_6a = mJointTree->getDrawFullWgtMtxNum();
|
||||
for (u16 i = 0; i < local_6a; i++) {
|
||||
MTXCopy(getWeightAnmMtx(i), *getDrawMtx(mJointTree->getDrawFullWgtMtxNum() + i));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
J3DCalcViewBaseMtx(j3dSys.getViewMtx(), param_1, param_2, viewBaseMtx);
|
||||
fullWgtNum = mJointTree->getDrawFullWgtMtxNum();
|
||||
for (u16 i = 0; i < fullWgtNum; i++) {
|
||||
local_6c = mJointTree->getDrawFullWgtMtxNum();
|
||||
for (u16 i = 0; i < local_6c; i++) {
|
||||
MTXConcat(viewBaseMtx, getAnmMtx(mJointTree->getDrawMtxIndex(i)), *getDrawMtx(i));
|
||||
}
|
||||
if (mJointTree->getDrawMtxNum() > mJointTree->getDrawFullWgtMtxNum()) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
|
||||
#include "JSystem/J3DGraphBase/J3DShape.h"
|
||||
|
||||
void J3DShapeTable::hide() {
|
||||
u16 shapeNum = mShapeNum;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphAnimator/J3DSkinDeform.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include <string>
|
||||
@@ -675,4 +676,23 @@ void J3DVtxColorCalc::calc(J3DModel* pModel) {
|
||||
calc(pModel->getVertexBuffer());
|
||||
}
|
||||
|
||||
void J3DVtxColorCalc::calc(J3DVertexBuffer* buffer) {
|
||||
J3D_ASSERT_NULLPTR(1366, buffer != NULL);
|
||||
if (checkFlag(1) && mpVtxColor) {
|
||||
buffer->swapVtxColArrayPointer();
|
||||
u16 anmTableNum = mpVtxColor->getAnmTableNum(0);
|
||||
GXColor* colorArray = buffer->getVtxColArrayPointer(0);
|
||||
for (u32 i = 0; i < anmTableNum; i++) {
|
||||
GXColor color;
|
||||
mpVtxColor->getColor(0, i, &color);
|
||||
J3DAnmVtxColorIndexData* r28 = mpVtxColor->getAnmVtxColorIndexData(0, i);
|
||||
for (u32 j = 0; j < r28->mNum; j++) {
|
||||
colorArray[((u16*)r28->mpData)[j]] = color;
|
||||
}
|
||||
}
|
||||
DCStoreRange(colorArray, buffer->getVertexData()->getColNum() * 4);
|
||||
buffer->setCurrentVtxCol(colorArray);
|
||||
}
|
||||
}
|
||||
|
||||
J3DSkinDeform::~J3DSkinDeform() {}
|
||||
|
||||
@@ -72,9 +72,11 @@ void J3DShape::addTexMtxIndexInVcd(GXAttr attr) {
|
||||
GXVtxDescList* vtxDesc = getVtxDesc();
|
||||
s32 attrCount = 0;
|
||||
|
||||
for (; vtxDesc->attr != GX_VA_NULL; attrCount++, vtxDesc++) {
|
||||
if (vtxDesc->attr == GX_VA_PNMTXIDX)
|
||||
for (; vtxDesc->attr != GX_VA_NULL; vtxDesc++) {
|
||||
if (vtxDesc->attr == GX_VA_PNMTXIDX) {
|
||||
attrIdx = stride;
|
||||
}
|
||||
attrCount++;
|
||||
}
|
||||
|
||||
if (attrIdx == -1)
|
||||
@@ -85,7 +87,7 @@ void J3DShape::addTexMtxIndexInVcd(GXAttr attr) {
|
||||
|
||||
vtxDesc = getVtxDesc();
|
||||
GXVtxDescList* dst = newVtxDesc;
|
||||
for (; vtxDesc->attr != GX_VA_NULL; dst++, vtxDesc++) {
|
||||
for (; vtxDesc->attr != GX_VA_NULL; vtxDesc++) {
|
||||
if ((attr < vtxDesc->attr) && !inserted) {
|
||||
dst->attr = attr;
|
||||
dst->type = GX_DIRECT;
|
||||
@@ -98,6 +100,7 @@ void J3DShape::addTexMtxIndexInVcd(GXAttr attr) {
|
||||
dst->attr = vtxDesc->attr;
|
||||
dst->type = vtxDesc->type;
|
||||
stride = stride + kSize[vtxDesc->type];
|
||||
dst++;
|
||||
}
|
||||
|
||||
dst->attr = GX_VA_NULL;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "JSystem/J3DGraphBase/J3DShapeDraw.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include <string>
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
#include <dolphin/gx.h>
|
||||
|
||||
u32 J3DShapeDraw::countVertex(u32 stride) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "JSystem/J3DGraphAnimator/J3DModel.h"
|
||||
#include "JSystem/J3DGraphBase/J3DFifo.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMatBlock.h"
|
||||
#include "JSystem/J3DGraphBase/J3DSys.h"
|
||||
#include "JSystem/J3DGraphBase/J3DTexture.h"
|
||||
|
||||
u16 J3DShapeMtx::sMtxLoadCache[10];
|
||||
@@ -270,9 +271,7 @@ void J3DDifferedTexMtx::loadExecute(f32 const (*param_0)[4]) {
|
||||
MTXInverse(j3dSys.getViewMtx(), sp_a8);
|
||||
MTXConcat(sp_e8, sp_a8, sp_e8);
|
||||
MTXConcat(sp_e8, param_0, sp_e8);
|
||||
sp_e8[2][3] = 0.0f;
|
||||
sp_e8[1][3] = 0.0f;
|
||||
sp_e8[0][3] = 0.0f;
|
||||
sp_e8[0][3] = sp_e8[1][3] = sp_e8[2][3] = 0.0f;
|
||||
mtx = &sp_e8;
|
||||
break;
|
||||
}
|
||||
@@ -414,6 +413,11 @@ void J3DShapeMtxMulti::calcNBTScale(Vec const& param_0, Mtx33* param_1, Mtx33* p
|
||||
}
|
||||
|
||||
void J3DShapeMtxMultiConcatView::load() const {
|
||||
static u8 mtxCache[20] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
};
|
||||
|
||||
sMtxPtrTbl[0] = j3dSys.getModel()->getMtxBuffer()->getUserAnmMtx(0);
|
||||
sMtxPtrTbl[1] = j3dSys.getModel()->getWeightAnmMtx(0);
|
||||
|
||||
@@ -433,8 +437,7 @@ void J3DShapeMtxMultiConcatView::load() const {
|
||||
|
||||
int use_mtx_num = mUseMtxNum;
|
||||
for (int i = 0; i < use_mtx_num; i++) {
|
||||
u32 current_pipeline = sCurrentPipeline;
|
||||
J3DShapeMtxConcatView_LoadFunc func = sMtxLoadLODPipeline[current_pipeline];
|
||||
J3DShapeMtxConcatView_LoadFunc func = sMtxLoadLODPipeline[sCurrentPipeline];
|
||||
|
||||
if (mUseMtxIndexTable[i] != 0xffff) {
|
||||
u16 important_mtx_index = important_mtx_indices[mUseMtxIndexTable[i]];
|
||||
@@ -545,8 +548,5 @@ void J3DShapeMtxYBBoardConcatView::load() const {
|
||||
}
|
||||
|
||||
static void dummy() {
|
||||
static u8 mtxCache[20] = {
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,41 @@
|
||||
#include "JSystem/J3DGraphBase/J3DStruct.h"
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
|
||||
bool J3DTextureSRTInfo::operator==(J3DTextureSRTInfo& other) const {
|
||||
if (mScaleX == other.mScaleX &&
|
||||
mScaleY == other.mScaleY &&
|
||||
mRotation == other.mRotation &&
|
||||
mTranslationX == other.mTranslationX &&
|
||||
mTranslationY == other.mTranslationY
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool J3DLightInfo::operator==(J3DLightInfo& other) const {
|
||||
if (mLightPosition.x == other.mLightPosition.x &&
|
||||
mLightPosition.y == other.mLightPosition.y &&
|
||||
mLightPosition.z == other.mLightPosition.z &&
|
||||
mLightDirection.x == other.mLightDirection.x &&
|
||||
mLightDirection.y == other.mLightDirection.y &&
|
||||
mLightDirection.z == other.mLightDirection.z &&
|
||||
mColor.r == other.mColor.r &&
|
||||
mColor.g == other.mColor.g &&
|
||||
mColor.b == other.mColor.b &&
|
||||
mColor.a == other.mColor.a &&
|
||||
mCosAtten.x == other.mCosAtten.x &&
|
||||
mCosAtten.y == other.mCosAtten.y &&
|
||||
mCosAtten.z == other.mCosAtten.z &&
|
||||
mDistAtten.x == other.mDistAtten.x &&
|
||||
mDistAtten.y == other.mDistAtten.y &&
|
||||
mDistAtten.z == other.mDistAtten.z
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
J3DLightInfo& J3DLightInfo::operator=(J3DLightInfo const& param_0) {
|
||||
JMath::gekko_ps_copy6(&mLightPosition, ¶m_0.mLightPosition);
|
||||
mColor = param_0.mColor;
|
||||
@@ -14,6 +49,42 @@ J3DLightInfo& J3DLightInfo::operator=(J3DLightInfo const& param_0) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool J3DTexMtxInfo::operator==(J3DTexMtxInfo& other) const {
|
||||
if (mProjection != other.mProjection ||
|
||||
mInfo != other.mInfo ||
|
||||
!(mSRT == other.mSRT)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (mEffectMtx[0][0] != other.mEffectMtx[0][0] ||
|
||||
mEffectMtx[0][1] != other.mEffectMtx[0][1] ||
|
||||
mEffectMtx[0][2] != other.mEffectMtx[0][2] ||
|
||||
mEffectMtx[0][3] != other.mEffectMtx[0][3] ||
|
||||
mEffectMtx[1][0] != other.mEffectMtx[1][0] ||
|
||||
mEffectMtx[1][1] != other.mEffectMtx[1][1] ||
|
||||
mEffectMtx[1][2] != other.mEffectMtx[1][2] ||
|
||||
mEffectMtx[1][3] != other.mEffectMtx[1][3] ||
|
||||
mEffectMtx[2][0] != other.mEffectMtx[2][0] ||
|
||||
mEffectMtx[2][1] != other.mEffectMtx[2][1] ||
|
||||
mEffectMtx[2][2] != other.mEffectMtx[2][2] ||
|
||||
mEffectMtx[2][3] != other.mEffectMtx[2][3] ||
|
||||
mEffectMtx[3][0] != other.mEffectMtx[3][0] ||
|
||||
mEffectMtx[3][1] != other.mEffectMtx[3][1] ||
|
||||
mEffectMtx[3][2] != other.mEffectMtx[3][2] ||
|
||||
mEffectMtx[3][3] != other.mEffectMtx[3][3]
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
mCenter.x != other.mCenter.x ||
|
||||
mCenter.y != other.mCenter.y ||
|
||||
mCenter.z != other.mCenter.z
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
J3DTexMtxInfo& J3DTexMtxInfo::operator=(J3DTexMtxInfo const& param_0) {
|
||||
mProjection = param_0.mProjection;
|
||||
mInfo = param_0.mInfo;
|
||||
@@ -47,7 +118,30 @@ J3DIndTexMtxInfo& J3DIndTexMtxInfo::operator=(J3DIndTexMtxInfo const& param_0) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
J3DFogInfo& J3DFogInfo::operator=(J3DFogInfo const& param_0) {
|
||||
bool J3DFogInfo::operator==(J3DFogInfo& other) const {
|
||||
if (mType == other.mType &&
|
||||
mAdjEnable == other.mAdjEnable &&
|
||||
mCenter == other.mCenter &&
|
||||
mStartZ == other.mStartZ &&
|
||||
mEndZ == other.mEndZ &&
|
||||
mNearZ == other.mNearZ &&
|
||||
mFarZ == other.mFarZ &&
|
||||
mColor.r == other.mColor.r &&
|
||||
mColor.g == other.mColor.g &&
|
||||
mColor.b == other.mColor.b &&
|
||||
mColor.a == other.mColor.a
|
||||
) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (mFogAdjTable.r[i] != other.mFogAdjTable.r[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
J3DFogInfo& J3DFogInfo::operator=(const J3DFogInfo& param_0) {
|
||||
mType = param_0.mType;
|
||||
mAdjEnable = param_0.mAdjEnable;
|
||||
mCenter = param_0.mCenter;
|
||||
@@ -55,15 +149,31 @@ J3DFogInfo& J3DFogInfo::operator=(J3DFogInfo const& param_0) {
|
||||
mEndZ = param_0.mEndZ;
|
||||
mNearZ = param_0.mNearZ;
|
||||
mFarZ = param_0.mFarZ;
|
||||
mColor = param_0.mColor;
|
||||
mColor.r = param_0.mColor.r;
|
||||
mColor.g = param_0.mColor.g;
|
||||
mColor.b = param_0.mColor.b;
|
||||
mColor.a = param_0.mColor.a;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
mFogAdjTable.r[i] = param_0.mFogAdjTable.r[i];
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
J3DNBTScaleInfo& J3DNBTScaleInfo::operator=(J3DNBTScaleInfo const& param_0) {
|
||||
mbHasScale = param_0.mbHasScale;
|
||||
mScale = param_0.mScale;
|
||||
bool J3DNBTScaleInfo::operator==(const J3DNBTScaleInfo& other) const {
|
||||
if (mbHasScale == other.mbHasScale &&
|
||||
mScale.x == other.mScale.x &&
|
||||
mScale.y == other.mScale.y &&
|
||||
mScale.z == other.mScale.z
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
J3DNBTScaleInfo& J3DNBTScaleInfo::operator=(const J3DNBTScaleInfo& other) {
|
||||
mbHasScale = other.mbHasScale;
|
||||
mScale.x = other.mScale.x;
|
||||
mScale.y = other.mScale.y;
|
||||
mScale.z = other.mScale.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ J3DSys::J3DSys() {
|
||||
}
|
||||
|
||||
void J3DSys::loadPosMtxIndx(int addr, u16 indx) const {
|
||||
// J3DFifoLoadPosMtxIndx(indx, addr * 3); // matches debug, not retail
|
||||
//J3DFifoLoadPosMtxIndx(indx, addr * 3); // matches debug, not retail
|
||||
J3DFifoLoadIndx(GX_LOAD_INDX_A, indx, 0xB000 | ((u16)(addr * 0x0C)));
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ void J3DTexMtx::calcTexMtx(const Mtx param_0) {
|
||||
};
|
||||
|
||||
u32 r28 = mTexMtxInfo.mInfo & 0x3f;
|
||||
u32 r30 = (mTexMtxInfo.mInfo >> 7) & 1;
|
||||
u32 r30 = u32(mTexMtxInfo.mInfo & 0x80) >> 7;
|
||||
switch (r28) {
|
||||
case 8:
|
||||
case 9:
|
||||
@@ -176,7 +176,7 @@ void J3DTexMtx::calcPostTexMtx(const Mtx param_0) {
|
||||
};
|
||||
|
||||
u32 r29 = mTexMtxInfo.mInfo & 0x3f;
|
||||
u32 r30 = (mTexMtxInfo.mInfo >> 7) & 1;
|
||||
u32 r30 = u32(mTexMtxInfo.mInfo & 0x80) >> 7;
|
||||
switch (r29) {
|
||||
case 8:
|
||||
case 11:
|
||||
|
||||
@@ -55,18 +55,22 @@ void J3DCalcBBoardMtx(__REGISTER Mtx mtx) {
|
||||
|
||||
__REGISTER f32 zero = 0.0f;
|
||||
// zero out gaps of zeroes
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
#if DEBUG || !defined(__MWERKS__)
|
||||
mtx[0][1] = 0.0f;
|
||||
mtx[0][2] = 0.0f;
|
||||
mtx[2][0] = 0.0f;
|
||||
mtx[2][1] = 0.0f;
|
||||
#else // clang-format off
|
||||
asm {
|
||||
psq_st zero, 0x04(mtx), 0, 0
|
||||
|
||||
psq_st zero, 0x20(mtx), 0, 0
|
||||
}
|
||||
#endif // clang-format on
|
||||
|
||||
mtx[0][0] = x;
|
||||
mtx[1][0] = zero;
|
||||
mtx[1][0] = 0.0f;
|
||||
mtx[1][1] = y;
|
||||
mtx[1][2] = zero;
|
||||
mtx[1][2] = 0.0f;
|
||||
mtx[2][2] = z;
|
||||
}
|
||||
|
||||
|
||||
@@ -210,6 +210,10 @@ s32 J3DVertexBuffer::allocTransformedVtxNrmArray() {
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
static void dummy(J3DVertexData* vertexData) {
|
||||
vertexData->getColNum();
|
||||
}
|
||||
|
||||
J3DDrawMtxData::J3DDrawMtxData() {
|
||||
mEntryNum = 0;
|
||||
mDrawMtxFlag = NULL;
|
||||
|
||||
@@ -5,14 +5,16 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphLoader/J3DAnmLoader.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
#include "dolphin/os.h"
|
||||
|
||||
J3DAnmBase* J3DAnmLoaderDataBase::load(const void* i_data, J3DAnmLoaderDataBaseFlag flag) {
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)i_data;
|
||||
J3D_ASSERT_NULLPTR(48, i_data);
|
||||
if (!i_data) {
|
||||
return NULL;
|
||||
}
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)i_data;
|
||||
if (header->mMagic == 'J3D1') {
|
||||
switch (header->mType) {
|
||||
case 'bck1': {
|
||||
@@ -89,9 +91,10 @@ J3DAnmBase* J3DAnmLoaderDataBase::load(const void* i_data, J3DAnmLoaderDataBaseF
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void J3DAnmLoaderDataBase::setResource(J3DAnmBase* param_1, const void* param_2) {
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)param_2;
|
||||
if (!header) {
|
||||
void J3DAnmLoaderDataBase::setResource(J3DAnmBase* param_1, const void* i_data) {
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)i_data;
|
||||
J3D_ASSERT_NULLPTR(188, i_data);
|
||||
if (!i_data) {
|
||||
return;
|
||||
}
|
||||
if (header->mMagic != 'J3D1') {
|
||||
@@ -100,64 +103,64 @@ void J3DAnmLoaderDataBase::setResource(J3DAnmBase* param_1, const void* param_2)
|
||||
switch (header->mType) {
|
||||
case 'bck1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'bpk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'blk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'btk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'brk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
if (param_1->getKind() == 5) {
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'bxk1': {
|
||||
J3DAnmKeyLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'bca1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'bpa1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'btp1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'bla1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'bxa1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
case 'bva1': {
|
||||
J3DAnmFullLoader_v15 loader;
|
||||
loader.setResource(param_1, param_2);
|
||||
loader.setResource(param_1, i_data);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@@ -175,8 +178,9 @@ J3DAnmKeyLoader_v15::J3DAnmKeyLoader_v15() {}
|
||||
|
||||
J3DAnmKeyLoader_v15::~J3DAnmKeyLoader_v15() {}
|
||||
|
||||
J3DAnmBase* J3DAnmFullLoader_v15::load(const void* param_1) {
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)param_1;
|
||||
J3DAnmBase* J3DAnmFullLoader_v15::load(const void* i_data) {
|
||||
J3D_ASSERT_NULLPTR(357, i_data);
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)i_data;
|
||||
const JUTDataBlockHeader* block = &header->mFirstBlock;
|
||||
for (int i = 0; i < header->mBlockNum; i++) {
|
||||
switch (block->mType) {
|
||||
@@ -202,49 +206,59 @@ J3DAnmBase* J3DAnmFullLoader_v15::load(const void* param_1) {
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
block = block->getNext();
|
||||
block = (JUTDataBlockHeader*)((u8*)block + block->mSize);
|
||||
}
|
||||
return mAnm;
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::setResource(J3DAnmBase* param_1, const void* param_2) {
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)param_2;
|
||||
void J3DAnmFullLoader_v15::setResource(J3DAnmBase* param_1, const void* i_data) {
|
||||
J3D_ASSERT_NULLPTR(416, i_data);
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)i_data;
|
||||
const JUTDataBlockHeader* block = &header->mFirstBlock;
|
||||
for (int i = 0; i < header->mBlockNum; i++) {
|
||||
switch (block->mType) {
|
||||
case 'ANF1':
|
||||
JUT_ASSERT_MSG(428, param_1->getKind() == 9, "Error: Resource type inconsistency");
|
||||
setAnmTransform((J3DAnmTransformFull*)param_1, (const J3DAnmTransformFullData*)block);
|
||||
break;
|
||||
case 'PAF1':
|
||||
JUT_ASSERT_MSG(435, param_1->getKind() == 10, "Error: Resource type inconsistency");
|
||||
setAnmColor((J3DAnmColorFull*)param_1, (const J3DAnmColorFullData*)block);
|
||||
break;
|
||||
case 'TPT1':
|
||||
JUT_ASSERT_MSG(441, param_1->getKind() == 2, "Error: Resource type inconsistency");
|
||||
setAnmTexPattern((J3DAnmTexPattern*)param_1, (const J3DAnmTexPatternFullData*)block);
|
||||
break;
|
||||
case 'CLF1':
|
||||
JUT_ASSERT_MSG(448, param_1->getKind() == 12, "Error: Resource type inconsistency");
|
||||
setAnmCluster((J3DAnmClusterFull*)param_1, (const J3DAnmClusterFullData*)block);
|
||||
break;
|
||||
case 'VAF1':
|
||||
JUT_ASSERT_MSG(454, param_1->getKind() == 6, "Error: Resource type inconsistency");
|
||||
setAnmVisibility((J3DAnmVisibilityFull*)param_1,
|
||||
(const J3DAnmVisibilityFullData*)block);
|
||||
break;
|
||||
case 'VCF1':
|
||||
JUT_ASSERT_MSG(461, param_1->getKind() == 14, "Error: Resource type inconsistency");
|
||||
setAnmVtxColor((J3DAnmVtxColorFull*)param_1, (const J3DAnmVtxColorFullData*)block);
|
||||
break;
|
||||
default:
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
block = block->getNext();
|
||||
block = (JUTDataBlockHeader*)((u8*)block + block->mSize);
|
||||
}
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::readAnmTransform(const J3DAnmTransformFullData* param_1) {
|
||||
setAnmTransform((J3DAnmTransformFull*)mAnm, param_1);
|
||||
J3DAnmTransformFull* anm = (J3DAnmTransformFull*)mAnm;
|
||||
setAnmTransform(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::setAnmTransform(J3DAnmTransformFull* param_1,
|
||||
const J3DAnmTransformFullData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(504, param_1);
|
||||
J3D_ASSERT_NULLPTR(505, param_2);
|
||||
param_1->field_0x1e = param_2->field_0xc;
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
@@ -258,11 +272,14 @@ void J3DAnmFullLoader_v15::setAnmTransform(J3DAnmTransformFull* param_1,
|
||||
|
||||
|
||||
void J3DAnmFullLoader_v15::readAnmColor(const J3DAnmColorFullData* param_1) {
|
||||
setAnmColor((J3DAnmColorFull*)mAnm, param_1);
|
||||
J3DAnmColorFull* anm = (J3DAnmColorFull*)mAnm;
|
||||
setAnmColor(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::setAnmColor(J3DAnmColorFull* param_1,
|
||||
const J3DAnmColorFullData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(550, param_1);
|
||||
J3D_ASSERT_NULLPTR(551, param_2);
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
@@ -280,11 +297,14 @@ void J3DAnmFullLoader_v15::setAnmColor(J3DAnmColorFull* param_1,
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::readAnmTexPattern(const J3DAnmTexPatternFullData* param_1) {
|
||||
setAnmTexPattern((J3DAnmTexPattern*)mAnm, param_1);
|
||||
J3DAnmTexPattern* anm = (J3DAnmTexPattern*)mAnm;
|
||||
setAnmTexPattern(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::setAnmTexPattern(J3DAnmTexPattern* param_1,
|
||||
const J3DAnmTexPatternFullData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(603, param_1);
|
||||
J3D_ASSERT_NULLPTR(604, param_2);
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
@@ -300,11 +320,14 @@ void J3DAnmFullLoader_v15::setAnmTexPattern(J3DAnmTexPattern* param_1,
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::readAnmVisibility(const J3DAnmVisibilityFullData* param_1) {
|
||||
setAnmVisibility((J3DAnmVisibilityFull*)mAnm, param_1);
|
||||
J3DAnmVisibilityFull* anm = (J3DAnmVisibilityFull*)mAnm;
|
||||
setAnmVisibility(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::setAnmVisibility(J3DAnmVisibilityFull* param_1,
|
||||
const J3DAnmVisibilityFullData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(654, param_1);
|
||||
J3D_ASSERT_NULLPTR(655, param_2);
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
@@ -316,11 +339,14 @@ void J3DAnmFullLoader_v15::setAnmVisibility(J3DAnmVisibilityFull* param_1,
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::readAnmCluster(const J3DAnmClusterFullData* param_1) {
|
||||
setAnmCluster((J3DAnmClusterFull*)mAnm, param_1);
|
||||
J3DAnmClusterFull* anm = (J3DAnmClusterFull*)mAnm;
|
||||
setAnmCluster(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::setAnmCluster(J3DAnmClusterFull* param_1,
|
||||
const J3DAnmClusterFullData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(697, param_1);
|
||||
J3D_ASSERT_NULLPTR(698, param_2);
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
@@ -330,11 +356,14 @@ void J3DAnmFullLoader_v15::setAnmCluster(J3DAnmClusterFull* param_1,
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::readAnmVtxColor(const J3DAnmVtxColorFullData* param_1) {
|
||||
setAnmVtxColor((J3DAnmVtxColorFull*)mAnm, param_1);
|
||||
J3DAnmVtxColorFull* anm = (J3DAnmVtxColorFull*)mAnm;
|
||||
setAnmVtxColor(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmFullLoader_v15::setAnmVtxColor(J3DAnmVtxColorFull* dst,
|
||||
const J3DAnmVtxColorFullData* data) {
|
||||
J3D_ASSERT_NULLPTR(738, dst);
|
||||
J3D_ASSERT_NULLPTR(739, data);
|
||||
dst->mFrameMax = data->mFrameMax;
|
||||
dst->mAttribute = data->field_0x8;
|
||||
dst->mFrame = 0.0f;
|
||||
@@ -367,6 +396,7 @@ void J3DAnmFullLoader_v15::setAnmVtxColor(J3DAnmVtxColorFull* dst,
|
||||
}
|
||||
|
||||
J3DAnmBase* J3DAnmKeyLoader_v15::load(const void* param_1) {
|
||||
J3D_ASSERT_NULLPTR(801, param_1);
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)param_1;
|
||||
const JUTDataBlockHeader* block = &header->mFirstBlock;
|
||||
for (int i = 0; i < header->mBlockNum; i++) {
|
||||
@@ -393,48 +423,58 @@ J3DAnmBase* J3DAnmKeyLoader_v15::load(const void* param_1) {
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
block = block->getNext();
|
||||
block = (JUTDataBlockHeader*)((u8*)block + block->mSize);
|
||||
}
|
||||
return mAnm;
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::setResource(J3DAnmBase* param_1, const void* param_2) {
|
||||
J3D_ASSERT_NULLPTR(858, param_2);
|
||||
const JUTDataFileHeader* header = (const JUTDataFileHeader*)param_2;
|
||||
const JUTDataBlockHeader* block = &header->mFirstBlock;
|
||||
for (int i = 0; i < header->mBlockNum; i++) {
|
||||
switch (block->mType) {
|
||||
case 'ANK1':
|
||||
JUT_ASSERT_MSG(870, param_1->getKind() == 8, "Error: Resource type inconsistency");
|
||||
setAnmTransform((J3DAnmTransformKey*)param_1, (const J3DAnmTransformKeyData*)block);
|
||||
break;
|
||||
case 'PAK1':
|
||||
JUT_ASSERT_MSG(876, param_1->getKind() == 11, "Error: Resource type inconsistency");
|
||||
setAnmColor((J3DAnmColorKey*)param_1, (const J3DAnmColorKeyData*)block);
|
||||
break;
|
||||
case 'CLK1':
|
||||
JUT_ASSERT_MSG(883, param_1->getKind() == 13, "Error: Resource type inconsistency");
|
||||
setAnmCluster((J3DAnmClusterKey*)param_1, (const J3DAnmClusterKeyData*)block);
|
||||
break;
|
||||
case 'TTK1':
|
||||
JUT_ASSERT_MSG(888, param_1->getKind() == 4, "Error: Resource type inconsistency");
|
||||
setAnmTextureSRT((J3DAnmTextureSRTKey*)param_1, (const J3DAnmTextureSRTKeyData*)block);
|
||||
break;
|
||||
case 'TRK1':
|
||||
JUT_ASSERT_MSG(894, param_1->getKind() == 5, "Error: Resource type inconsistency");
|
||||
setAnmTevReg((J3DAnmTevRegKey*)param_1, (const J3DAnmTevRegKeyData*)block);
|
||||
break;
|
||||
case 'VCK1':
|
||||
JUT_ASSERT_MSG(901, param_1->getKind() == 15, "Error: Resource type inconsistency");
|
||||
setAnmVtxColor((J3DAnmVtxColorKey*)param_1, (const J3DAnmVtxColorKeyData*)block);
|
||||
break;
|
||||
default:
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
block = block->getNext();
|
||||
block = (JUTDataBlockHeader*)((u8*)block + block->mSize);
|
||||
}
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::readAnmTransform(const J3DAnmTransformKeyData* param_1) {
|
||||
setAnmTransform((J3DAnmTransformKey*)mAnm, param_1);
|
||||
J3DAnmTransformKey* anm = (J3DAnmTransformKey*)mAnm;
|
||||
setAnmTransform(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::setAnmTransform(J3DAnmTransformKey* param_1,
|
||||
const J3DAnmTransformKeyData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(944, param_1);
|
||||
J3D_ASSERT_NULLPTR(945, param_2);
|
||||
param_1->field_0x1e = param_2->field_0xc;
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
@@ -449,11 +489,14 @@ void J3DAnmKeyLoader_v15::setAnmTransform(J3DAnmTransformKey* param_1,
|
||||
|
||||
|
||||
void J3DAnmKeyLoader_v15::readAnmTextureSRT(const J3DAnmTextureSRTKeyData* param_1) {
|
||||
setAnmTextureSRT((J3DAnmTextureSRTKey*)mAnm, param_1);
|
||||
J3DAnmTextureSRTKey* anm = (J3DAnmTextureSRTKey*)mAnm;
|
||||
setAnmTextureSRT(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::setAnmTextureSRT(J3DAnmTextureSRTKey* param_1,
|
||||
const J3DAnmTextureSRTKeyData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(987, param_1);
|
||||
J3D_ASSERT_NULLPTR(988, param_2);
|
||||
param_1->mTrackNum = param_2->field_0xc;
|
||||
param_1->mFrameMax = param_2->field_0xa;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
@@ -504,10 +547,13 @@ void J3DAnmKeyLoader_v15::setAnmTextureSRT(J3DAnmTextureSRTKey* param_1,
|
||||
|
||||
|
||||
void J3DAnmKeyLoader_v15::readAnmColor(const J3DAnmColorKeyData* param_1) {
|
||||
setAnmColor((J3DAnmColorKey*)mAnm, param_1);
|
||||
J3DAnmColorKey* anm = (J3DAnmColorKey*)mAnm;
|
||||
setAnmColor(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::setAnmColor(J3DAnmColorKey* param_1, const J3DAnmColorKeyData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(1097, param_1);
|
||||
J3D_ASSERT_NULLPTR(1098, param_2);
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
@@ -530,11 +576,14 @@ void J3DAnmKeyLoader_v15::setAnmColor(J3DAnmColorKey* param_1, const J3DAnmColor
|
||||
|
||||
|
||||
void J3DAnmKeyLoader_v15::readAnmCluster(const J3DAnmClusterKeyData* param_1) {
|
||||
setAnmCluster((J3DAnmClusterKey*)mAnm, param_1);
|
||||
J3DAnmClusterKey* anm = (J3DAnmClusterKey*)mAnm;
|
||||
setAnmCluster(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::setAnmCluster(J3DAnmClusterKey* param_1,
|
||||
const J3DAnmClusterKeyData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(1156, param_1);
|
||||
J3D_ASSERT_NULLPTR(1157, param_2);
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
@@ -545,11 +594,14 @@ void J3DAnmKeyLoader_v15::setAnmCluster(J3DAnmClusterKey* param_1,
|
||||
|
||||
|
||||
void J3DAnmKeyLoader_v15::readAnmTevReg(const J3DAnmTevRegKeyData* param_1) {
|
||||
setAnmTevReg((J3DAnmTevRegKey*)mAnm, param_1);
|
||||
J3DAnmTevRegKey* anm = (J3DAnmTevRegKey*)mAnm;
|
||||
setAnmTevReg(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::setAnmTevReg(J3DAnmTevRegKey* param_1,
|
||||
const J3DAnmTevRegKeyData* param_2) {
|
||||
J3D_ASSERT_NULLPTR(1195, param_1);
|
||||
J3D_ASSERT_NULLPTR(1196, param_2);
|
||||
param_1->mFrameMax = param_2->mFrameMax;
|
||||
param_1->mAttribute = param_2->field_0x8;
|
||||
param_1->mFrame = 0.0f;
|
||||
@@ -587,11 +639,14 @@ void J3DAnmKeyLoader_v15::setAnmTevReg(J3DAnmTevRegKey* param_1,
|
||||
|
||||
|
||||
void J3DAnmKeyLoader_v15::readAnmVtxColor(const J3DAnmVtxColorKeyData* param_1) {
|
||||
setAnmVtxColor((J3DAnmVtxColorKey*)mAnm, param_1);
|
||||
J3DAnmVtxColorKey* anm = (J3DAnmVtxColorKey*)mAnm;
|
||||
setAnmVtxColor(anm, param_1);
|
||||
}
|
||||
|
||||
void J3DAnmKeyLoader_v15::setAnmVtxColor(J3DAnmVtxColorKey* dst,
|
||||
const J3DAnmVtxColorKeyData* data) {
|
||||
J3D_ASSERT_NULLPTR(1275, dst);
|
||||
J3D_ASSERT_NULLPTR(1276, data);
|
||||
dst->mFrameMax = data->mFrameMax;
|
||||
dst->mAttribute = data->field_0x8;
|
||||
dst->mFrame = 0.0f;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <string>
|
||||
|
||||
void* J3DClusterLoaderDataBase::load(const void* i_data) {
|
||||
J3D_ASSERT_NULLPTR(41, i_data);
|
||||
const JUTDataFileHeader* fileHeader = (JUTDataFileHeader*)i_data;
|
||||
if (fileHeader->mMagic == 'J3D1' && fileHeader->mType == 'bls1') {
|
||||
J3DClusterLoader_v15 loader;
|
||||
@@ -27,6 +28,7 @@ J3DClusterLoader_v15::J3DClusterLoader_v15() {}
|
||||
J3DClusterLoader_v15::~J3DClusterLoader_v15() {}
|
||||
|
||||
void* J3DClusterLoader_v15::load(const void* i_data) {
|
||||
J3D_ASSERT_NULLPTR(98, i_data);
|
||||
mpDeformData = new J3DDeformData();
|
||||
|
||||
const JUTDataFileHeader* fileHeader = (JUTDataFileHeader*)i_data;
|
||||
@@ -40,13 +42,14 @@ void* J3DClusterLoader_v15::load(const void* i_data) {
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
}
|
||||
block = block->getNext();
|
||||
block = (JUTDataBlockHeader*)((u8*)block + block->mSize);
|
||||
}
|
||||
|
||||
return mpDeformData;
|
||||
}
|
||||
|
||||
void J3DClusterLoader_v15::readCluster(const J3DClusterBlock* block) {
|
||||
J3D_ASSERT_NULLPTR(147, block);
|
||||
mpDeformData->mClusterNum = block->mClusterNum;
|
||||
mpDeformData->mClusterKeyNum = block->mClusterKeyNum;
|
||||
mpDeformData->mVtxPosNum = block->mVtxPosNum;
|
||||
@@ -70,11 +73,11 @@ void J3DClusterLoader_v15::readCluster(const J3DClusterBlock* block) {
|
||||
mpDeformData->mVtxNrm = JSUConvertOffsetToPtr<f32>(block, block->mVtxNrm);
|
||||
|
||||
void* clusterPointer = block->mClusterPointer;
|
||||
int clusterKeyPointerSize = (intptr_t)block->mClusterKeyPointer - (intptr_t)clusterPointer;
|
||||
int clusterVertexPointerSize = (intptr_t)block->mClusterVertex - (intptr_t)clusterPointer;
|
||||
int vtxPosSize = (intptr_t)block->mVtxPos - (intptr_t)clusterPointer;
|
||||
int clusterKeyPointerSize = (intptr_t)block->mClusterKeyPointer - (intptr_t)block->mClusterPointer;
|
||||
int clusterVertexPointerSize = (intptr_t)block->mClusterVertex - (intptr_t)block->mClusterPointer;
|
||||
int vtxPosSize = (intptr_t)block->mVtxPos - (intptr_t)block->mClusterPointer;
|
||||
u8* arr = new (0x20) u8[vtxPosSize];
|
||||
memcpy(arr, JSUConvertOffsetToPtr<J3DCluster>(block, clusterPointer), vtxPosSize);
|
||||
memcpy(arr, JSUConvertOffsetToPtr<J3DCluster>(block, block->mClusterPointer), vtxPosSize);
|
||||
mpDeformData->mClusterPointer = (J3DCluster*)arr;
|
||||
mpDeformData->mClusterKeyPointer = (J3DClusterKey*)&arr[clusterKeyPointerSize];
|
||||
mpDeformData->mClusterVertex = (J3DClusterVertex*)&arr[clusterVertexPointerSize];
|
||||
|
||||
@@ -12,6 +12,7 @@ J3DJointFactory::J3DJointFactory(J3DJointBlock const& block) {
|
||||
|
||||
J3DJoint* J3DJointFactory::create(int no) {
|
||||
J3DJoint* joint = new J3DJoint();
|
||||
J3D_ASSERT_ALLOCMEM(50, joint);
|
||||
joint->mJntNo = no;
|
||||
joint->mKind = getKind(no);
|
||||
joint->mScaleCompensate = getScaleCompensate(no);
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DGraphLoader/J3DModelLoader.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DShapeTable.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DJointTree.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DJointFactory.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DMaterialFactory.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.h"
|
||||
@@ -10,7 +14,6 @@
|
||||
#include "JSystem/JUtility/JUTNameTab.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
#include "dolphin/os.h"
|
||||
|
||||
J3DModelLoader::J3DModelLoader() :
|
||||
mpModelData(NULL),
|
||||
@@ -24,26 +27,45 @@ J3DModelLoader::J3DModelLoader() :
|
||||
}
|
||||
|
||||
J3DModelData* J3DModelLoaderDataBase::load(void const* i_data, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(52, i_data);
|
||||
const J3DModelFileData* header = (const J3DModelFileData*)i_data;
|
||||
if (i_data == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
if (*(u32*)i_data == 'J3D1' && *(u32*)((uintptr_t)i_data + 4) == 'bmd1') {
|
||||
if (header->mMagic1 == 'J3D1' && header->mMagic2 == 'bmd1') {
|
||||
JUT_PANIC(64, "Error : version error.");
|
||||
return NULL;
|
||||
}
|
||||
if (*(u32*)i_data == 'J3D2' && *(u32*)((uintptr_t)i_data + 4) == 'bmd2') {
|
||||
if (header->mMagic1 == 'J3D2' && header->mMagic2 == 'bmd2') {
|
||||
J3DModelLoader_v21 loader;
|
||||
return loader.load(i_data, i_flags);
|
||||
}
|
||||
if (*(u32*)i_data == 'J3D2' && *(u32*)((uintptr_t)i_data + 4) == 'bmd3') {
|
||||
if (header->mMagic1 == 'J3D2' && header->mMagic2 == 'bmd3') {
|
||||
J3DModelLoader_v26 loader;
|
||||
return loader.load(i_data, i_flags);
|
||||
}
|
||||
JUT_PANIC(89, "Error : version error.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
J3DModelData* J3DModelLoaderDataBase::loadBinaryDisplayList(const void* i_data, u32 flags) {
|
||||
J3D_ASSERT_NULLPTR(138, i_data);
|
||||
const J3DModelFileData* header = (const J3DModelFileData*)i_data;
|
||||
if (!i_data) {
|
||||
return NULL;
|
||||
}
|
||||
if (header->mMagic1 == 'J3D2' && (header->mMagic2 == 'bdl3' || header->mMagic2 == 'bdl4')) {
|
||||
J3DModelLoader_v26 loader;
|
||||
return loader.loadBinaryDisplayList(i_data, flags);
|
||||
}
|
||||
JUT_PANIC(157, "Error : version error.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) {
|
||||
JKRGetCurrentHeap()->getTotalFreeSize();
|
||||
s32 freeSize = JKRGetCurrentHeap()->getTotalFreeSize();
|
||||
mpModelData = new J3DModelData();
|
||||
J3D_ASSERT_ALLOCMEM(177, mpModelData);
|
||||
mpModelData->clear();
|
||||
mpModelData->mpRawData = i_data;
|
||||
mpModelData->setModelDataType(0);
|
||||
@@ -100,17 +122,19 @@ J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) {
|
||||
|
||||
|
||||
J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) {
|
||||
int flags = 0x51100000;
|
||||
mpMaterialTable = new J3DMaterialTable();
|
||||
J3D_ASSERT_ALLOCMEM(279, mpMaterialTable);
|
||||
mpMaterialTable->clear();
|
||||
J3DModelFileData const* data = (J3DModelFileData*)i_data;
|
||||
J3DModelBlock const* block = data->mBlocks;
|
||||
for (u32 block_no = 0; block_no < data->mBlockNum; block_no++) {
|
||||
switch (block->mBlockType) {
|
||||
case 'MAT3':
|
||||
readMaterialTable((J3DMaterialBlock*)block, 0x51100000);
|
||||
readMaterialTable((J3DMaterialBlock*)block, flags);
|
||||
break;
|
||||
case 'MAT2':
|
||||
readMaterialTable_v21((J3DMaterialBlock_v21*)block, 0x51100000);
|
||||
readMaterialTable_v21((J3DMaterialBlock_v21*)block, flags);
|
||||
break;
|
||||
case 'TEX1':
|
||||
readTextureTable((J3DTextureBlock*)block);
|
||||
@@ -123,12 +147,18 @@ J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) {
|
||||
}
|
||||
if (mpMaterialTable->mTexture == NULL) {
|
||||
mpMaterialTable->mTexture = new J3DTexture(0, NULL);
|
||||
J3D_ASSERT_ALLOCMEM(319, mpMaterialTable->mTexture);
|
||||
}
|
||||
return mpMaterialTable;
|
||||
}
|
||||
|
||||
inline u32 getBdlFlag_MaterialType(u32 flags) {
|
||||
return flags & (J3DMLF_13 | J3DMLF_DoBdlMaterialCalc);
|
||||
}
|
||||
|
||||
J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_flags) {
|
||||
mpModelData = new J3DModelData();
|
||||
J3D_ASSERT_ALLOCMEM(338, mpModelData);
|
||||
mpModelData->clear();
|
||||
mpModelData->mpRawData = i_data;
|
||||
mpModelData->setModelDataType(1);
|
||||
@@ -137,6 +167,7 @@ J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_fl
|
||||
J3DModelBlock const* block = data->mBlocks;
|
||||
for (u32 block_no = 0; block_no < data->mBlockNum; block_no++) {
|
||||
s32 flags;
|
||||
u32 materialType;
|
||||
switch (block->mBlockType) {
|
||||
case 'INF1':
|
||||
flags = i_flags;
|
||||
@@ -168,9 +199,10 @@ J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_fl
|
||||
flags = 0x50100000;
|
||||
flags |= (i_flags & 0x3000000);
|
||||
mpMaterialBlock = (J3DMaterialBlock*)block;
|
||||
if (((u32)i_flags & 0x3000) == 0) {
|
||||
materialType = getBdlFlag_MaterialType(i_flags);
|
||||
if (materialType == 0) {
|
||||
readMaterial((J3DMaterialBlock*)block, flags);
|
||||
} else if (((u32)i_flags & 0x3000) == 0x2000) {
|
||||
} else if (materialType == 0x2000) {
|
||||
readPatchedMaterial((J3DMaterialBlock*)block, flags);
|
||||
}
|
||||
break;
|
||||
@@ -193,31 +225,27 @@ void J3DModelLoader::setupBBoardInfo() {
|
||||
for (u16 i = 0; i < mpModelData->getJointNum(); i++) {
|
||||
J3DMaterial* mesh = mpModelData->getJointNodePointer(i)->getMesh();
|
||||
if (mesh != NULL) {
|
||||
u16 shape_index = mesh->getShape()->getIndex();
|
||||
u32 shape_index = mesh->getShape()->getIndex();
|
||||
u16* index_table = JSUConvertOffsetToPtr<u16>(mpShapeBlock,
|
||||
(uintptr_t)mpShapeBlock->mpIndexTable);
|
||||
J3DShapeInitData* shape_init_data =
|
||||
JSUConvertOffsetToPtr<J3DShapeInitData>(mpShapeBlock,
|
||||
(uintptr_t)mpShapeBlock->mpShapeInitData);
|
||||
J3DJoint* joint;
|
||||
switch (shape_init_data[index_table[shape_index]].mShapeMtxType) {
|
||||
J3DShapeInitData* r26 = &shape_init_data[index_table[shape_index]];
|
||||
switch (r26->mShapeMtxType) {
|
||||
case 0:
|
||||
joint = mpModelData->getJointNodePointer(i);
|
||||
joint->setMtxType(0);
|
||||
mpModelData->getJointNodePointer(i)->setMtxType(0);
|
||||
break;
|
||||
case 1:
|
||||
joint = mpModelData->getJointNodePointer(i);
|
||||
joint->setMtxType(1);
|
||||
mpModelData->getJointNodePointer(i)->setMtxType(1);
|
||||
mpModelData->mbHasBillboard = true;
|
||||
break;
|
||||
case 2:
|
||||
joint = mpModelData->getJointNodePointer(i);
|
||||
joint->setMtxType(2);
|
||||
mpModelData->getJointNodePointer(i)->setMtxType(2);
|
||||
mpModelData->mbHasBillboard = true;
|
||||
break;
|
||||
case 3:
|
||||
joint = mpModelData->getJointNodePointer(i);
|
||||
joint->setMtxType(0);
|
||||
mpModelData->getJointNodePointer(i)->setMtxType(0);
|
||||
break;
|
||||
default:
|
||||
OSReport("WRONG SHAPE MATRIX TYPE (__FILE__)\n");
|
||||
@@ -228,6 +256,7 @@ void J3DModelLoader::setupBBoardInfo() {
|
||||
}
|
||||
|
||||
void J3DModelLoader::readInformation(J3DModelInfoBlock const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(506, i_block);
|
||||
mpModelData->mFlags = i_flags | i_block->mFlags;
|
||||
mpModelData->getJointTree().setFlag(mpModelData->mFlags);
|
||||
J3DMtxCalc* mtx_calc = NULL;
|
||||
@@ -241,7 +270,11 @@ void J3DModelLoader::readInformation(J3DModelInfoBlock const* i_block, u32 i_fla
|
||||
case 2:
|
||||
mtx_calc = new J3DMtxCalcNoAnm<J3DMtxCalcCalcTransformMaya,J3DMtxCalcJ3DSysInitMaya>();
|
||||
break;
|
||||
default:
|
||||
JUT_PANIC(529, "Error : Invalid MtxCalcType.");
|
||||
break;
|
||||
}
|
||||
J3D_ASSERT_ALLOCMEM(532, mtx_calc);
|
||||
mpModelData->setBasicMtxCalc(mtx_calc);
|
||||
mpModelData->getVertexData().mPacketNum = i_block->mPacketNum;
|
||||
mpModelData->getVertexData().mVtxNum = i_block->mVtxNum;
|
||||
@@ -258,6 +291,7 @@ static _GXCompType getFmtType(_GXVtxAttrFmtList* i_fmtList, _GXAttr i_attr) {
|
||||
}
|
||||
|
||||
void J3DModelLoader::readVertex(J3DVertexBlock const* i_block) {
|
||||
J3D_ASSERT_NULLPTR(577, i_block);
|
||||
J3DVertexData& vertex_data = mpModelData->getVertexData();
|
||||
vertex_data.mVtxAttrFmtList =
|
||||
JSUConvertOffsetToPtr<GXVtxAttrFmtList>(i_block, i_block->mpVtxAttrFmtList);
|
||||
@@ -273,8 +307,12 @@ void J3DModelLoader::readVertex(J3DVertexBlock const* i_block) {
|
||||
JSUConvertOffsetToPtr<void>(i_block, i_block->mpVtxTexCoordArray[i]);
|
||||
}
|
||||
|
||||
_GXCompType nrm_type = getFmtType(vertex_data.mVtxAttrFmtList, GX_VA_NRM);
|
||||
u32 nrm_size = nrm_type == GX_F32 ? 12 : 6;
|
||||
u32 nrm_size = 12;
|
||||
if (getFmtType(vertex_data.mVtxAttrFmtList, GX_VA_NRM) == GX_F32) {
|
||||
nrm_size = 12;
|
||||
} else {
|
||||
nrm_size = 6;
|
||||
}
|
||||
|
||||
void* nrm_end = NULL;
|
||||
if (vertex_data.mVtxNBTArray != NULL) {
|
||||
@@ -308,14 +346,24 @@ void J3DModelLoader::readVertex(J3DVertexBlock const* i_block) {
|
||||
vertex_data.mColNum = (i_block->mBlockSize - (uintptr_t)i_block->mpVtxColorArray[0]) / 4 + 1;
|
||||
}
|
||||
|
||||
int local_28 = 0;
|
||||
if (vertex_data.mVtxTexCoordArray[1]) {
|
||||
color0_end = vertex_data.mVtxTexCoordArray[1];
|
||||
}
|
||||
|
||||
if (vertex_data.mVtxTexCoordArray[0] == NULL) {
|
||||
vertex_data.mTexCoordNum = 0;
|
||||
return;
|
||||
}
|
||||
if (local_28) {
|
||||
vertex_data.mTexCoordNum = (local_28 - (uintptr_t)vertex_data.mVtxTexCoordArray[0]) / 8 + 1;
|
||||
} else {
|
||||
vertex_data.mTexCoordNum = (i_block->mBlockSize - (uintptr_t)i_block->mpVtxTexCoordArray[0]) / 8 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void J3DModelLoader::readEnvelop(J3DEnvelopeBlock const* i_block) {
|
||||
J3D_ASSERT_NULLPTR(724, i_block);
|
||||
mpModelData->getJointTree().mWEvlpMtxNum = i_block->mWEvlpMtxNum;
|
||||
mpModelData->getJointTree().mWEvlpMixMtxNum =
|
||||
JSUConvertOffsetToPtr<u8>(i_block, i_block->mpWEvlpMixMtxNum);
|
||||
@@ -328,50 +376,58 @@ void J3DModelLoader::readEnvelop(J3DEnvelopeBlock const* i_block) {
|
||||
}
|
||||
|
||||
void J3DModelLoader::readDraw(J3DDrawBlock const* i_block) {
|
||||
J3DJointTree& joint_tree = mpModelData->getJointTree();
|
||||
joint_tree.mDrawMtxData.mEntryNum = i_block->mMtxNum - mpModelData->getJointTree().mWEvlpMtxNum;
|
||||
joint_tree.mDrawMtxData.mDrawMtxFlag = JSUConvertOffsetToPtr<u8>(i_block, i_block->mpDrawMtxFlag);
|
||||
joint_tree.mDrawMtxData.mDrawMtxIndex = JSUConvertOffsetToPtr<u16>(i_block, i_block->mpDrawMtxIndex);
|
||||
J3D_ASSERT_NULLPTR(747, i_block);
|
||||
J3DDrawMtxData* drawMtxData = mpModelData->getDrawMtxData();
|
||||
drawMtxData->mEntryNum = i_block->mMtxNum - mpModelData->getWEvlpMtxNum();
|
||||
drawMtxData->mDrawMtxFlag = JSUConvertOffsetToPtr<u8>(i_block, i_block->mpDrawMtxFlag);
|
||||
drawMtxData->mDrawMtxIndex = JSUConvertOffsetToPtr<u16>(i_block, i_block->mpDrawMtxIndex);
|
||||
u16 i;
|
||||
for (i = 0; i < joint_tree.mDrawMtxData.mEntryNum; i++) {
|
||||
if (joint_tree.mDrawMtxData.mDrawMtxFlag[i] == 1) {
|
||||
for (i = 0; i < drawMtxData->mEntryNum; i++) {
|
||||
if (drawMtxData->mDrawMtxFlag[i] == 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
joint_tree.mDrawMtxData.mDrawFullWgtMtxNum = i;
|
||||
mpModelData->getJointTree().mWEvlpImportantMtxIdx = new u16[joint_tree.mDrawMtxData.mEntryNum];
|
||||
|
||||
drawMtxData->mDrawFullWgtMtxNum = i;
|
||||
mpModelData->getJointTree().mWEvlpImportantMtxIdx = new u16[drawMtxData->mEntryNum];
|
||||
J3D_ASSERT_ALLOCMEM(767, mpModelData->getJointTree().mWEvlpImportantMtxIdx);
|
||||
}
|
||||
|
||||
void J3DModelLoader::readJoint(J3DJointBlock const* i_block) {
|
||||
J3D_ASSERT_NULLPTR(781, i_block);
|
||||
J3DJointFactory factory(*i_block);
|
||||
mpModelData->getJointTree().mJointNum = i_block->mJointNum;
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpModelData->getJointTree().mJointName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(791, mpModelData->getJointTree().mJointName);
|
||||
} else {
|
||||
mpModelData->getJointTree().mJointName = NULL;
|
||||
}
|
||||
mpModelData->getJointTree().mJointNodePointer =
|
||||
new J3DJoint*[mpModelData->getJointTree().mJointNum];
|
||||
for (u16 i = 0; i < mpModelData->getJointTree().getJointNum(); i++) {
|
||||
J3D_ASSERT_ALLOCMEM(797, mpModelData->getJointTree().mJointNodePointer);
|
||||
for (u16 i = 0; i < mpModelData->getJointNum(); i++) {
|
||||
mpModelData->getJointTree().mJointNodePointer[i] = factory.create(i);
|
||||
}
|
||||
}
|
||||
|
||||
void J3DModelLoader_v26::readMaterial(J3DMaterialBlock const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(817, i_block);
|
||||
J3DMaterialFactory factory(*i_block);
|
||||
mpMaterialTable->mMaterialNum = i_block->mMaterialNum;
|
||||
mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials();
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(832, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(841, mpMaterialTable->mMaterialNodePointer);
|
||||
if (i_flags & 0x200000) {
|
||||
mpMaterialTable->field_0x10 = new (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum];
|
||||
J3D_ASSERT_ALLOCMEM(846, mpMaterialTable->field_0x10);
|
||||
} else {
|
||||
mpMaterialTable->field_0x10 = NULL;
|
||||
}
|
||||
@@ -402,18 +458,22 @@ void J3DModelLoader_v26::readMaterial(J3DMaterialBlock const* i_block, u32 i_fla
|
||||
}
|
||||
|
||||
void J3DModelLoader_v21::readMaterial_v21(J3DMaterialBlock_v21 const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(913, i_block);
|
||||
J3DMaterialFactory_v21 factory(*i_block);
|
||||
mpMaterialTable->mMaterialNum = i_block->mMaterialNum;
|
||||
mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials();
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(930, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(940, mpMaterialTable->mMaterialNodePointer);
|
||||
if (i_flags & 0x200000) {
|
||||
mpMaterialTable->field_0x10 = new (0x20) J3DMaterial[mpMaterialTable->mUniqueMatNum];
|
||||
J3D_ASSERT_ALLOCMEM(945, mpMaterialTable->field_0x10);
|
||||
} else {
|
||||
mpMaterialTable->field_0x10 = NULL;
|
||||
}
|
||||
@@ -441,6 +501,7 @@ void J3DModelLoader_v21::readMaterial_v21(J3DMaterialBlock_v21 const* i_block, u
|
||||
}
|
||||
|
||||
void J3DModelLoader::readShape(J3DShapeBlock const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(1009, i_block);
|
||||
mpShapeBlock = i_block;
|
||||
J3DShapeTable* shape_table = mpModelData->getShapeTable();
|
||||
J3DShapeFactory factory(*i_block);
|
||||
@@ -448,10 +509,12 @@ void J3DModelLoader::readShape(J3DShapeBlock const* i_block, u32 i_flags) {
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
shape_table->mShapeName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1026, shape_table->mShapeName);
|
||||
} else {
|
||||
shape_table->mShapeName = NULL;
|
||||
}
|
||||
shape_table->mShapeNodePointer = new J3DShape*[shape_table->mShapeNum];
|
||||
J3D_ASSERT_ALLOCMEM(1034, shape_table->mShapeNodePointer);
|
||||
factory.allocVcdVatCmdBuffer(shape_table->mShapeNum);
|
||||
J3DModelHierarchy const* hierarchy_entry = mpModelData->getHierarchy();
|
||||
GXVtxDescList* vtx_desc_list = NULL;
|
||||
@@ -465,27 +528,33 @@ void J3DModelLoader::readShape(J3DShapeBlock const* i_block, u32 i_flags) {
|
||||
}
|
||||
|
||||
void J3DModelLoader::readTexture(J3DTextureBlock const* i_block) {
|
||||
J3D_ASSERT_NULLPTR(1067, i_block);
|
||||
u16 texture_num = i_block->mTextureNum;
|
||||
ResTIMG* texture_res = JSUConvertOffsetToPtr<ResTIMG>(i_block, i_block->mpTextureRes);
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mTextureName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1077, mpMaterialTable->mTextureName);
|
||||
} else {
|
||||
mpMaterialTable->mTextureName = NULL;
|
||||
}
|
||||
mpMaterialTable->mTexture = new J3DTexture(texture_num, texture_res);
|
||||
J3D_ASSERT_ALLOCMEM(1084, mpMaterialTable->mTexture);
|
||||
}
|
||||
|
||||
void J3DModelLoader_v26::readMaterialTable(J3DMaterialBlock const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(1101, i_block);
|
||||
J3DMaterialFactory factory(*i_block);
|
||||
mpMaterialTable->mMaterialNum = i_block->mMaterialNum;
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1114, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(1121, mpMaterialTable->mMaterialNodePointer);
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
mpMaterialTable->mMaterialNodePointer[i] =
|
||||
factory.create(NULL, J3DMaterialFactory::MATERIAL_TYPE_NORMAL, i, i_flags);
|
||||
@@ -497,15 +566,18 @@ void J3DModelLoader_v26::readMaterialTable(J3DMaterialBlock const* i_block, u32
|
||||
}
|
||||
|
||||
void J3DModelLoader_v21::readMaterialTable_v21(J3DMaterialBlock_v21 const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(1152, i_block);
|
||||
J3DMaterialFactory_v21 factory(*i_block);
|
||||
mpMaterialTable->mMaterialNum = i_block->mMaterialNum;
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1165, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(1172, mpMaterialTable->mMaterialNodePointer);
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
mpMaterialTable->mMaterialNodePointer[i] =
|
||||
factory.create(NULL, i, i_flags);
|
||||
@@ -517,28 +589,34 @@ void J3DModelLoader_v21::readMaterialTable_v21(J3DMaterialBlock_v21 const* i_blo
|
||||
}
|
||||
|
||||
void J3DModelLoader::readTextureTable(J3DTextureBlock const* i_block) {
|
||||
J3D_ASSERT_NULLPTR(1200, i_block);
|
||||
u16 texture_num = i_block->mTextureNum;
|
||||
ResTIMG* texture_res = JSUConvertOffsetToPtr<ResTIMG>(i_block, i_block->mpTextureRes);
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mTextureName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1211, mpMaterialTable->mTextureName);
|
||||
} else {
|
||||
mpMaterialTable->mTextureName = NULL;
|
||||
}
|
||||
mpMaterialTable->mTexture = new J3DTexture(texture_num, texture_res);
|
||||
J3D_ASSERT_ALLOCMEM(1218, mpMaterialTable->mTexture);
|
||||
}
|
||||
|
||||
void J3DModelLoader::readPatchedMaterial(J3DMaterialBlock const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(1234, i_block);
|
||||
J3DMaterialFactory factory(*i_block);
|
||||
mpMaterialTable->mMaterialNum = i_block->mMaterialNum;
|
||||
mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials();
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1251, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(1260, mpMaterialTable->mMaterialNodePointer);
|
||||
mpMaterialTable->field_0x10 = NULL;
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
mpMaterialTable->mMaterialNodePointer[i] =
|
||||
@@ -549,6 +627,7 @@ void J3DModelLoader::readPatchedMaterial(J3DMaterialBlock const* i_block, u32 i_
|
||||
}
|
||||
|
||||
void J3DModelLoader::readMaterialDL(J3DMaterialDLBlock const* i_block, u32 i_flags) {
|
||||
J3D_ASSERT_NULLPTR(1290, i_block);
|
||||
J3DMaterialFactory factory(*i_block);
|
||||
s32 flags;
|
||||
if (mpMaterialTable->mMaterialNum == 0) {
|
||||
@@ -558,10 +637,12 @@ void J3DModelLoader::readMaterialDL(J3DMaterialDLBlock const* i_block, u32 i_fla
|
||||
if (i_block->mpNameTable != NULL) {
|
||||
mpMaterialTable->mMaterialName =
|
||||
new JUTNameTab(JSUConvertOffsetToPtr<ResNTAB>(i_block, i_block->mpNameTable));
|
||||
J3D_ASSERT_ALLOCMEM(1312, mpMaterialTable->mMaterialName);
|
||||
} else {
|
||||
mpMaterialTable->mMaterialName = NULL;
|
||||
}
|
||||
mpMaterialTable->mMaterialNodePointer = new J3DMaterial*[mpMaterialTable->mMaterialNum];
|
||||
J3D_ASSERT_ALLOCMEM(1320, mpMaterialTable->mMaterialNodePointer);
|
||||
mpMaterialTable->field_0x10 = NULL;
|
||||
for (u16 i = 0; i < mpMaterialTable->mMaterialNum; i++) {
|
||||
flags = i_flags;
|
||||
|
||||
@@ -5,33 +5,38 @@
|
||||
#include "JSystem/J3DGraphLoader/J3DShapeFactory.h"
|
||||
#include "JSystem/J3DGraphLoader/J3DMaterialFactory.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMaterial.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DJoint.h"
|
||||
#include "JSystem/J3DGraphAnimator/J3DModelData.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "global.h"
|
||||
|
||||
|
||||
u16 J3DModelLoader::countMaterialNum(const void* stream) {
|
||||
const J3DModelFileData* header = (const J3DModelFileData*)stream;
|
||||
const J3DModelBlock* block = header->mBlocks;
|
||||
for (int i = 0; i < header->mBlockNum; block = (const J3DModelBlock*)((u8*)block + block->mBlockSize), i++)
|
||||
for (int i = 0; i < header->mBlockNum; i++)
|
||||
{
|
||||
if (block->mBlockType == 'MAT3') {
|
||||
return ((const J3DMaterialBlock*)block)->mMaterialNum;
|
||||
const J3DMaterialBlock* materialBlock = (const J3DMaterialBlock*)block;
|
||||
return materialBlock->mMaterialNum;
|
||||
}
|
||||
block = (const J3DModelBlock*)((u8*)block + block->mBlockSize);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void dummy() {
|
||||
JUT_PANIC(0, "Error : null pointer.");
|
||||
}
|
||||
|
||||
u32 J3DModelLoader::calcLoadSize(void const* stream, u32 flags_) {
|
||||
int flags = flags_;
|
||||
const J3DModelFileData* header = static_cast<const J3DModelFileData*>(stream);
|
||||
size_t size = 0;
|
||||
const J3DModelBlock* nextBlock = header->mBlocks;
|
||||
u32 i = 0;
|
||||
// TODO: What sizeof will get us a size of 0xE4?
|
||||
size += 0xE4;
|
||||
for (; i < header->mBlockNum; i++) {
|
||||
const J3DModelFileData* header = static_cast<const J3DModelFileData*>(stream);
|
||||
const J3DModelBlock* nextBlock = header->mBlocks;
|
||||
for (u32 i = 0; i < header->mBlockNum; i++) {
|
||||
switch (nextBlock->mBlockType) {
|
||||
case 'INF1':
|
||||
size += calcSizeInformation((const J3DModelInfoBlock*)nextBlock, flags);
|
||||
@@ -39,8 +44,6 @@ u32 J3DModelLoader::calcLoadSize(void const* stream, u32 flags_) {
|
||||
case 'JNT1':
|
||||
size += calcSizeJoint((const J3DJointBlock*)nextBlock);
|
||||
break;
|
||||
case 'MAT2':
|
||||
break;
|
||||
case 'MAT3':
|
||||
size += calcSizeMaterial((const J3DMaterialBlock*)nextBlock, flags);
|
||||
break;
|
||||
@@ -58,6 +61,9 @@ u32 J3DModelLoader::calcLoadSize(void const* stream, u32 flags_) {
|
||||
break;
|
||||
case 'VTX1':
|
||||
break;
|
||||
case 'MAT2':
|
||||
JUT_PANIC(282, "Error : version error.");
|
||||
break;
|
||||
default:
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
@@ -68,30 +74,27 @@ u32 J3DModelLoader::calcLoadSize(void const* stream, u32 flags_) {
|
||||
}
|
||||
|
||||
u32 J3DModelLoader::calcLoadMaterialTableSize(const void* stream) {
|
||||
size_t size;
|
||||
u32 flags = J3DMLF_21 | J3DMLF_Material_UseIndirect | J3DMLF_Material_PE_Full | J3DMLF_Material_Color_LightOn;
|
||||
size_t size = 0;
|
||||
// TODO: What sizeof will get us a size of 0x20? Is this just the file header???
|
||||
size += 0x20;
|
||||
const J3DModelBlock* nextBlock;
|
||||
bool hasTextureTable;
|
||||
u32 i;
|
||||
const J3DModelFileData* header = reinterpret_cast<const J3DModelFileData*>(stream);
|
||||
nextBlock = header->mBlocks;
|
||||
hasTextureTable = false;
|
||||
i = 0;
|
||||
// TODO: What sizeof will get us a size of 0x20? Is this just the file header???
|
||||
size = 0x20;
|
||||
for (; i < header->mBlockNum; i++) {
|
||||
for (u32 i = 0; i < header->mBlockNum; i++) {
|
||||
switch (nextBlock->mBlockType) {
|
||||
case 'MAT2':
|
||||
break;
|
||||
case 'MAT3':
|
||||
size +=
|
||||
calcSizeMaterialTable((const J3DMaterialBlock*)nextBlock,
|
||||
J3DMLF_21 | J3DMLF_Material_UseIndirect |
|
||||
J3DMLF_Material_PE_Full | J3DMLF_Material_Color_LightOn);
|
||||
size += calcSizeMaterialTable((const J3DMaterialBlock*)nextBlock, flags);
|
||||
break;
|
||||
case 'TEX1':
|
||||
size += calcSizeTextureTable((const J3DTextureBlock*)nextBlock);
|
||||
hasTextureTable = true;
|
||||
break;
|
||||
case 'MAT2':
|
||||
JUT_PANIC(334, "Error : version error.");
|
||||
break;
|
||||
default:
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
@@ -132,8 +135,6 @@ u32 J3DModelLoader::calcLoadBinaryDisplayListSize(const void* stream, u32 flags)
|
||||
case 'MDL3':
|
||||
size += calcSizeMaterialDL((const J3DMaterialDLBlock*)nextBlock, flags);
|
||||
break;
|
||||
case 'MAT2':
|
||||
break;
|
||||
case 'MAT3': {
|
||||
u32 flags2 = (J3DMLF_21 | J3DMLF_Material_PE_Full | J3DMLF_Material_Color_LightOn);
|
||||
flags2 |= (u32)flags & (J3DMLF_Material_UseIndirect | J3DMLF_26);
|
||||
@@ -156,6 +157,9 @@ u32 J3DModelLoader::calcLoadBinaryDisplayListSize(const void* stream, u32 flags)
|
||||
break;
|
||||
case 'VTX1':
|
||||
break;
|
||||
case 'MAT2':
|
||||
JUT_PANIC(436, "Error : version error.");
|
||||
break;
|
||||
default:
|
||||
OSReport("Unknown data block\n");
|
||||
break;
|
||||
@@ -166,18 +170,22 @@ u32 J3DModelLoader::calcLoadBinaryDisplayListSize(const void* stream, u32 flags)
|
||||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizeInformation(const J3DModelInfoBlock* block, u32 flags) {
|
||||
J3D_ASSERT_NULLPTR(462, block);
|
||||
int size = 0;
|
||||
switch ((flags | block->mFlags) & J3DMLF_MtxTypeMask) {
|
||||
u32 flags2 = flags | block->mFlags;
|
||||
int r27 = 0;
|
||||
switch (flags2 & J3DMLF_MtxTypeMask) {
|
||||
case J3DMLF_None: // Basic
|
||||
size = 4;
|
||||
size += 4;
|
||||
break;
|
||||
case J3DMLF_MtxSoftImageCalc:
|
||||
size = 4;
|
||||
size += 4;
|
||||
break;
|
||||
case J3DMLF_MtxMayaCalc:
|
||||
size = 4;
|
||||
size += 4;
|
||||
break;
|
||||
default:
|
||||
JUT_PANIC(481, "Error : Invalid MtxCalcType.");
|
||||
break;
|
||||
}
|
||||
mpModelHierarchy = JSUConvertOffsetToPtr<J3DModelHierarchy>(block, block->mpHierarchy);
|
||||
@@ -185,9 +193,10 @@ u32 J3DModelLoader::calcSizeInformation(const J3DModelInfoBlock* block, u32 flag
|
||||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizeJoint(const J3DJointBlock* block) {
|
||||
J3D_ASSERT_NULLPTR(499, block);
|
||||
int size = 0;
|
||||
if (block->mpNameTable) {
|
||||
size = 0x10;
|
||||
size += 0x10;
|
||||
}
|
||||
size += (block->mJointNum * sizeof(J3DJoint*));
|
||||
size += (block->mJointNum * sizeof(J3DJoint));
|
||||
@@ -195,23 +204,28 @@ u32 J3DModelLoader::calcSizeJoint(const J3DJointBlock* block) {
|
||||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizeEnvelope(const J3DEnvelopeBlock* block) {
|
||||
J3D_ASSERT_NULLPTR(522, block);
|
||||
mEnvelopeSize = block->mWEvlpMtxNum;
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizeDraw(const J3DDrawBlock* block) {
|
||||
return (block->mMtxNum - mEnvelopeSize) * 2;
|
||||
J3D_ASSERT_NULLPTR(538, block);
|
||||
u32 size = 0;
|
||||
size += (block->mMtxNum - mEnvelopeSize) * 2;
|
||||
return size;
|
||||
}
|
||||
|
||||
u32 J3DModelLoader_v26::calcSizeMaterial(const J3DMaterialBlock* block, u32 flags) {
|
||||
int padding = 0;
|
||||
J3D_ASSERT_NULLPTR(558, block);
|
||||
size_t size = 0;
|
||||
J3DMaterialFactory factory(*block);
|
||||
u32 count = block->mMaterialNum;
|
||||
int uniqueCount = factory.countUniqueMaterials();
|
||||
if (block->mpNameTable != NULL) {
|
||||
padding = 0x10;
|
||||
size += 0x10;
|
||||
}
|
||||
size_t size = padding + (count * sizeof(J3DMaterial*));
|
||||
size += (count * sizeof(J3DMaterial*));
|
||||
|
||||
if ((flags & J3DMLF_UseUniqueMaterials) != 0) {
|
||||
// calc for allocated materials as well
|
||||
@@ -229,15 +243,17 @@ u32 J3DModelLoader_v26::calcSizeMaterial(const J3DMaterialBlock* block, u32 flag
|
||||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizeShape(const J3DShapeBlock* block, u32 flags) {
|
||||
J3D_ASSERT_NULLPTR(616, block);
|
||||
int size = 0;
|
||||
J3DShapeFactory factory(*block);
|
||||
int count = block->mShapeNum;
|
||||
if (block->mpNameTable) {
|
||||
size = 0x10;
|
||||
size += 0x10;
|
||||
}
|
||||
size += count * sizeof(J3DShape*);
|
||||
size += factory.calcSizeVcdVatCmdBuffer(count);
|
||||
for (J3DModelHierarchy* hierarchy = mpModelHierarchy; hierarchy->mType != 0; hierarchy++) {
|
||||
J3DModelHierarchy* hierarchy;
|
||||
for (hierarchy = mpModelHierarchy; hierarchy->mType != 0; hierarchy++) {
|
||||
if (hierarchy->mType == 0x12) {
|
||||
size += factory.calcSize(hierarchy->mValue, flags);
|
||||
}
|
||||
@@ -246,12 +262,14 @@ u32 J3DModelLoader::calcSizeShape(const J3DShapeBlock* block, u32 flags) {
|
||||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizeTexture(const J3DTextureBlock* block) {
|
||||
J3D_ASSERT_NULLPTR(663, block);
|
||||
// TODO: use sizeofs here.
|
||||
int padding = 0;
|
||||
int size = 0;
|
||||
if (block->mpNameTable) {
|
||||
padding = 0x10;
|
||||
size += 0x10;
|
||||
}
|
||||
return padding + 0xC;
|
||||
size += 0xC;
|
||||
return size;
|
||||
}
|
||||
|
||||
u32 J3DModelLoader_v26::calcSizeMaterialTable(const J3DMaterialBlock* block, u32 flags) {
|
||||
@@ -259,7 +277,7 @@ u32 J3DModelLoader_v26::calcSizeMaterialTable(const J3DMaterialBlock* block, u32
|
||||
u32 count = block->mMaterialNum;
|
||||
J3DMaterialFactory factory(*block);
|
||||
if (block->mpNameTable) {
|
||||
size = 0x10;
|
||||
size += 0x10;
|
||||
}
|
||||
size += (count * sizeof(J3DMaterial*));
|
||||
for (u16 i = 0; i < count; i++) {
|
||||
@@ -273,13 +291,13 @@ u32 J3DModelLoader::calcSizeTextureTable(const J3DTextureBlock* block) {
|
||||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizePatchedMaterial(const J3DMaterialBlock* block, u32 flags) {
|
||||
int padding = 0;
|
||||
int size = 0;
|
||||
u32 count = block->mMaterialNum;
|
||||
J3DMaterialFactory factory(*block);
|
||||
if (block->mpNameTable) {
|
||||
padding = 0x10;
|
||||
size += 0x10;
|
||||
}
|
||||
u32 size = padding + (count * sizeof(J3DMaterial*));
|
||||
size += (count * sizeof(J3DMaterial*));
|
||||
for (u16 i = 0; i < count; i++) {
|
||||
size += factory.calcSize(NULL, J3DMaterialFactory::MATERIAL_TYPE_PATCHED, i, flags);
|
||||
}
|
||||
@@ -287,14 +305,14 @@ u32 J3DModelLoader::calcSizePatchedMaterial(const J3DMaterialBlock* block, u32 f
|
||||
}
|
||||
|
||||
u32 J3DModelLoader::calcSizeMaterialDL(const J3DMaterialDLBlock* block, u32 flags_) {
|
||||
J3D_ASSERT_NULLPTR(758, block);
|
||||
int flags = flags_;
|
||||
size_t size = 0;
|
||||
J3DMaterialFactory factory(*block);
|
||||
;
|
||||
if (!field_0x18) {
|
||||
u32 count = block->mMaterialNum;
|
||||
if (block->mpNameTable) {
|
||||
size = 0x10;
|
||||
size += 0x10;
|
||||
}
|
||||
size += count * sizeof(J3DLockedMaterial*);
|
||||
for (u16 i = 0; i < count; i++) {
|
||||
|
||||
@@ -11,21 +11,24 @@
|
||||
J3DShapeFactory::J3DShapeFactory(J3DShapeBlock const& block) {
|
||||
mShapeInitData = JSUConvertOffsetToPtr<J3DShapeInitData>(&block, (uintptr_t)block.mpShapeInitData);
|
||||
mIndexTable = JSUConvertOffsetToPtr<u16>(&block, (uintptr_t)block.mpIndexTable);
|
||||
mVtxDescList = JSUConvertOffsetToPtr<GXVtxDescList>(&block, (uintptr_t)block.mpVtxDescList),
|
||||
mVtxDescList = JSUConvertOffsetToPtr<GXVtxDescList>(&block, (uintptr_t)block.mpVtxDescList);
|
||||
mMtxTable = JSUConvertOffsetToPtr<u16>(&block, (uintptr_t)block.mpMtxTable);
|
||||
mDisplayListData = JSUConvertOffsetToPtr<u8>(&block, (uintptr_t)block.mpDisplayListData),
|
||||
mMtxInitData = JSUConvertOffsetToPtr<J3DShapeMtxInitData>(&block, (uintptr_t)block.mpMtxInitData),
|
||||
mDrawInitData = JSUConvertOffsetToPtr<J3DShapeDrawInitData>(&block, (uintptr_t)block.mpDrawInitData),
|
||||
mDisplayListData = JSUConvertOffsetToPtr<u8>(&block, (uintptr_t)block.mpDisplayListData);
|
||||
mMtxInitData = JSUConvertOffsetToPtr<J3DShapeMtxInitData>(&block, (uintptr_t)block.mpMtxInitData);
|
||||
mDrawInitData = JSUConvertOffsetToPtr<J3DShapeDrawInitData>(&block, (uintptr_t)block.mpDrawInitData);
|
||||
mVcdVatCmdBuffer = NULL;
|
||||
}
|
||||
|
||||
J3DShape* J3DShapeFactory::create(int no, u32 flag, GXVtxDescList* vtxDesc) {
|
||||
J3DShape* shape = new J3DShape;
|
||||
J3D_ASSERT_ALLOCMEM(67, shape);
|
||||
shape->mMtxGroupNum = getMtxGroupNum(no);
|
||||
shape->mRadius = getRadius(no);
|
||||
shape->mVtxDesc = getVtxDescList(no);
|
||||
shape->mShapeMtx = new J3DShapeMtx*[shape->mMtxGroupNum];
|
||||
J3D_ASSERT_ALLOCMEM(74, shape->mShapeMtx);
|
||||
shape->mShapeDraw = new J3DShapeDraw*[shape->mMtxGroupNum];
|
||||
J3D_ASSERT_ALLOCMEM(76, shape->mShapeDraw);
|
||||
shape->mMin = getMin(no);
|
||||
shape->mMax = getMax(no);
|
||||
shape->mVcdVatCmd = mVcdVatCmdBuffer + no * J3DShape::kVcdVatDLSize;
|
||||
@@ -56,7 +59,8 @@ J3DShapeMtx* J3DShapeFactory::newShapeMtx(u32 flag, int shapeNo, int mtxGroupNo)
|
||||
const J3DShapeMtxInitData& mtxInitData =
|
||||
(&mMtxInitData[shapeInitData.mMtxInitDataIndex])[mtxGroupNo];
|
||||
|
||||
switch (getMdlDataFlag_MtxLoadType(flag)) {
|
||||
u32 mtxLoadType = getMdlDataFlag_MtxLoadType(flag);
|
||||
switch (mtxLoadType) {
|
||||
case J3DMdlDataFlag_ConcatView:
|
||||
switch (shapeInitData.mShapeMtxType) {
|
||||
case J3DShapeMtxType_Mtx:
|
||||
@@ -94,36 +98,41 @@ J3DShapeMtx* J3DShapeFactory::newShapeMtx(u32 flag, int shapeNo, int mtxGroupNo)
|
||||
OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n");
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
J3D_ASSERT_ALLOCMEM(167, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
J3DShapeDraw* J3DShapeFactory::newShapeDraw(int shapeNo, int mtxGroupNo) const {
|
||||
J3DShapeDraw* shapeDraw = NULL;
|
||||
const J3DShapeInitData& shapeInitData = mShapeInitData[mIndexTable[shapeNo]];
|
||||
const J3DShapeDrawInitData& drawInitData =
|
||||
(&mDrawInitData[shapeInitData.mDrawInitDataIndex])[mtxGroupNo];
|
||||
return new J3DShapeDraw(&mDisplayListData[drawInitData.mDisplayListIndex],
|
||||
drawInitData.mDisplayListSize);
|
||||
shapeDraw = new J3DShapeDraw(&mDisplayListData[drawInitData.mDisplayListIndex], drawInitData.mDisplayListSize);
|
||||
J3D_ASSERT_ALLOCMEM(193, shapeDraw);
|
||||
return shapeDraw;
|
||||
}
|
||||
|
||||
void J3DShapeFactory::allocVcdVatCmdBuffer(u32 count) {
|
||||
mVcdVatCmdBuffer = new (0x20) u8[J3DShape::kVcdVatDLSize * count];
|
||||
J3D_ASSERT_ALLOCMEM(211, mVcdVatCmdBuffer);
|
||||
for (u32 i = 0; i < (J3DShape::kVcdVatDLSize * count) / 4; i++)
|
||||
((u32*)mVcdVatCmdBuffer)[i] = 0;
|
||||
}
|
||||
|
||||
s32 J3DShapeFactory::calcSize(int shapeNo, u32 flag) {
|
||||
s32 size = 0x68;
|
||||
s32 size = 0;
|
||||
|
||||
s32 mtxGroupNo = getMtxGroupNum(shapeNo);
|
||||
size += sizeof(J3DShape);
|
||||
size += mtxGroupNo * 4;
|
||||
size += mtxGroupNo * 4;
|
||||
|
||||
for (u32 i = 0; i < mtxGroupNo; i++) {
|
||||
s32 shapeMtxSize = calcSizeShapeMtx(flag, shapeNo, i);
|
||||
size += shapeMtxSize;
|
||||
size += calcSizeShapeMtx(flag, shapeNo, i);
|
||||
size += 0x0C;
|
||||
}
|
||||
|
||||
@@ -135,7 +144,9 @@ s32 J3DShapeFactory::calcSizeVcdVatCmdBuffer(u32 count) {
|
||||
}
|
||||
|
||||
s32 J3DShapeFactory::calcSizeShapeMtx(u32 flag, int shapeNo, int mtxGroupNo) const {
|
||||
int local_18 = 0;
|
||||
const J3DShapeInitData& shapeInitData = mShapeInitData[mIndexTable[shapeNo]];
|
||||
J3DShapeMtxInitData& mtxInitData = (&mMtxInitData[shapeInitData.mMtxInitDataIndex])[mtxGroupNo];
|
||||
u32 ret = 0;
|
||||
|
||||
u32 mtxLoadType = getMdlDataFlag_MtxLoadType(flag);
|
||||
@@ -143,16 +154,16 @@ s32 J3DShapeFactory::calcSizeShapeMtx(u32 flag, int shapeNo, int mtxGroupNo) con
|
||||
case J3DMdlDataFlag_ConcatView:
|
||||
switch (shapeInitData.mShapeMtxType) {
|
||||
case J3DShapeMtxType_Mtx:
|
||||
ret = 0x08;
|
||||
ret += sizeof(J3DShapeMtxConcatView);
|
||||
break;
|
||||
case J3DShapeMtxType_BBoard:
|
||||
ret = 0x08;
|
||||
ret += sizeof(J3DShapeMtxBBoardConcatView);
|
||||
break;
|
||||
case J3DShapeMtxType_YBBoard:
|
||||
ret = 0x08;
|
||||
ret += sizeof(J3DShapeMtxYBBoardConcatView);
|
||||
break;
|
||||
case J3DShapeMtxType_Multi:
|
||||
ret = 0x10;
|
||||
ret += sizeof(J3DShapeMtxMultiConcatView);
|
||||
break;
|
||||
default:
|
||||
OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n");
|
||||
@@ -165,10 +176,10 @@ s32 J3DShapeFactory::calcSizeShapeMtx(u32 flag, int shapeNo, int mtxGroupNo) con
|
||||
case J3DShapeMtxType_Mtx:
|
||||
case J3DShapeMtxType_BBoard:
|
||||
case J3DShapeMtxType_YBBoard:
|
||||
ret = 0x08;
|
||||
ret += 0x08;
|
||||
break;
|
||||
case J3DShapeMtxType_Multi:
|
||||
ret = 0x10;
|
||||
ret += sizeof(J3DShapeMtxMultiConcatView);
|
||||
break;
|
||||
default:
|
||||
OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/J3DU/J3DUClipper.h"
|
||||
#include <math>
|
||||
#include <cmath>
|
||||
|
||||
void J3DUClipper::init() {
|
||||
mNear = 1.0f;
|
||||
@@ -10,7 +10,7 @@ void J3DUClipper::init() {
|
||||
|
||||
void J3DUClipper::calcViewFrustum() {
|
||||
static const f32 unused[3] = {0.0f};
|
||||
f32 f0 = tan(0.5f * mFovY * 0.01745329238474369f);
|
||||
f32 f0 = tan(0.5f * mFovY * (M_PI / 180.0f));
|
||||
f32 f4 = mNear * f0;
|
||||
f32 f5 = mAspect * f4;
|
||||
Vec tmp1 = {-f5, -f4, -mNear};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JAHostIO/JAHioUtil.h"
|
||||
#include <stdio>
|
||||
#include <cstdio>
|
||||
|
||||
char JAHioUtil::mStringBuffer[256];
|
||||
|
||||
|
||||
@@ -22,8 +22,6 @@ JAWWindow::JAWWindow(const char* param_1, int param_2, int param_3) :
|
||||
field_0x38.appendChild(&field_0x2b0);
|
||||
}
|
||||
|
||||
JAWWindow::TJ2DWindowDraw::TJ2DWindowDraw(u32 param_1, const JGeometry::TBox2<f32>& param_2, const char* param_3) : J2DWindow(param_1, param_2, param_3, TEXTUREBASE_0, NULL) {}
|
||||
|
||||
JAWWindow::~JAWWindow() {}
|
||||
|
||||
BOOL JAWWindow::initIf() {
|
||||
@@ -194,6 +192,8 @@ JAWWindow::TWindowText::TWindowText(JAWWindow* window) :
|
||||
field_0x11c(0, 0) {
|
||||
}
|
||||
|
||||
JAWWindow::TWindowText::~TWindowText() {}
|
||||
|
||||
void JAWWindow::TWindowText::drawSelf(f32 param_1, f32 param_2) {
|
||||
Mtx mtx;
|
||||
MTXIdentity(mtx);
|
||||
@@ -211,3 +211,7 @@ void JAWWindow::TWindowText::drawSelf(f32, f32, Mtx* param_3) {
|
||||
m_pParent->setMatrix(stack_48);
|
||||
m_pParent->onDraw(&field_0xfc);
|
||||
}
|
||||
|
||||
static void dummy(J2DPane* pane, J2DWindow* window) {
|
||||
pane->rewriteAlpha();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/ai.h"
|
||||
#include <dolphin/os.h>
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
s16* JASDriver::sDmaDacBuffer[3];
|
||||
|
||||
|
||||
@@ -4,16 +4,9 @@
|
||||
#include "JSystem/JAudio2/JASAudioThread.h"
|
||||
#include "JSystem/JAudio2/JASCriticalSection.h"
|
||||
#include "JSystem/JAudio2/JASDriverIF.h"
|
||||
#include "JSystem/JAudio2/JASDSPChannel.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
struct JASDSPChannel {
|
||||
void drop();
|
||||
static JASDSPChannel* getHandle(u32);
|
||||
|
||||
inline u8 getStatus() const { return mStatus; }
|
||||
u32 mStatus;
|
||||
};
|
||||
|
||||
JASAudioReseter::JASAudioReseter() {
|
||||
field_0x0 = 0;
|
||||
mDoneFlag = true;
|
||||
@@ -52,16 +45,15 @@ s32 JASAudioReseter::checkDone() const {
|
||||
return mDoneFlag;
|
||||
}
|
||||
|
||||
|
||||
s32 JASAudioReseter::calc() {
|
||||
if(field_0x0==0) {
|
||||
for(size_t i = 0; i<64; i++) {
|
||||
if (field_0x0==0) {
|
||||
for (size_t i = 0; i<64; i++) {
|
||||
JASDSPChannel* handle = JASDSPChannel::getHandle(i);
|
||||
if ((handle->getStatus())==0) {
|
||||
if (handle->getStatus() == 0) {
|
||||
handle->drop();
|
||||
}
|
||||
}
|
||||
if(mThreadStopFlag!=false) {
|
||||
if (mThreadStopFlag!=false) {
|
||||
JASAudioThread* pAudioThread = JASGlobalInstance<JASAudioThread>::getInstance();
|
||||
JUT_ASSERT(78, pAudioThread);
|
||||
pAudioThread->stop();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "JSystem/JAudio2/JASReport.h"
|
||||
#include "JSystem/JKernel/JKRSolidHeap.h"
|
||||
#include "dolphin/dsp.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
JASAudioThread::JASAudioThread(int stackSize, int msgCount, u32 threadPriority)
|
||||
:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "JSystem/JAudio2/JASMutex.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
JASBasicWaveBank::JASBasicWaveBank() {
|
||||
mWaveTable = NULL;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JAudio2/JASCalc.h"
|
||||
#include <math>
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
|
||||
void JASCalc::imixcopy(const s16* s1, const s16* s2, s16* dst, u32 n) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "JSystem/JAudio2/JASCalc.h"
|
||||
#include "JSystem/JAudio2/JASMutex.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include <stdio>
|
||||
#include <cstdio>
|
||||
|
||||
static OSMutex sMutex;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JAudio2/JASSimpleWaveBank.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
JASSimpleWaveBank::JASSimpleWaveBank() {
|
||||
mWaveTable = NULL;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "JSystem/JKernel/JKRDvdAramRipper.h"
|
||||
#include <string>
|
||||
#include "dolphin/os.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
JASHeap* JASWaveArcLoader::sAramHeap;
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
// Here to generate JASHeap::__defctor (ctor generated by default arguments)
|
||||
void dummyDefCtor() {
|
||||
JASHeap dummy[20];
|
||||
//TODO: ShieldD needs the weak functions this pulls in, but in retail it breaks weak function
|
||||
// placement
|
||||
#if VERSION == VERSION_SHIELD_DEBUG
|
||||
JAUStreamStaticAramMgr_<1>* streamStaticAramMgr = new(NULL, 0) JAUStreamStaticAramMgr_<1>();
|
||||
streamStaticAramMgr->reserveAram(NULL, 0, 0x14);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ static void DspHandShake(void* param_0);
|
||||
static int DspStartWork(u32 param_0, void (*param_1)(u16));
|
||||
|
||||
extern int Dsp_Running_Check();
|
||||
extern int Dsp_Running_Start();
|
||||
extern void Dsp_Running_Start();
|
||||
|
||||
void DspHandShake(void*) {
|
||||
OS_REPORT("DSP InitCallback \n");
|
||||
|
||||
@@ -151,8 +151,8 @@ static void Dsp_Update_Request() {
|
||||
}
|
||||
}
|
||||
|
||||
bool Dsp_Running_Check() {
|
||||
return struct_80451308 == 1;
|
||||
int Dsp_Running_Check() {
|
||||
return struct_80451308 == 1 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
void Dsp_Running_Start() {
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
#include "dolphin/gx.h"
|
||||
#include <dolphin/vi.h>
|
||||
#include "global.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
void JFWDisplay::ctor_subroutine(bool enableAlpha) {
|
||||
mEnableAlpha = enableAlpha;
|
||||
mClamp = GX_CLAMP_TOP | GX_CLAMP_BOTTOM;
|
||||
mClearColor.set(0, 0, 0, 0);
|
||||
mClearColor = JUtility::TColor(0, 0, 0, 0);
|
||||
mZClear = 0xFFFFFF;
|
||||
mGamma = 0;
|
||||
mFader = NULL;
|
||||
@@ -36,19 +36,6 @@ void JFWDisplay::ctor_subroutine(bool enableAlpha) {
|
||||
field_0x44 = 0;
|
||||
}
|
||||
|
||||
static Mtx e_mtx ATTRIBUTE_ALIGN(32) = {
|
||||
{1.0f, 0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 1.0f, 0.0f, 0.0f},
|
||||
{0.0f, 0.0f, 1.0f, 0.0f},
|
||||
};
|
||||
|
||||
static u8 clear_z_TX[64] ATTRIBUTE_ALIGN(32) = {
|
||||
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
|
||||
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
};
|
||||
|
||||
JFWDisplay::JFWDisplay(JKRHeap* p_heap, JUTXfb::EXfbNumber xfb_num, bool enableAlpha) {
|
||||
ctor_subroutine(enableAlpha);
|
||||
mXfbManager = JUTXfb::createManager(p_heap, xfb_num);
|
||||
@@ -67,6 +54,7 @@ JFWDisplay* JFWDisplay::sManager;
|
||||
|
||||
JFWDisplay* JFWDisplay::createManager(_GXRenderModeObj const* p_rObj, JKRHeap* p_heap,
|
||||
JUTXfb::EXfbNumber xfb_num, bool enableAlpha) {
|
||||
JUT_CONFIRM(173, sManager == NULL);
|
||||
if (p_rObj != NULL) {
|
||||
JUTVideo::getManager()->setRenderMode(p_rObj);
|
||||
}
|
||||
@@ -79,16 +67,17 @@ JFWDisplay* JFWDisplay::createManager(_GXRenderModeObj const* p_rObj, JKRHeap* p
|
||||
}
|
||||
|
||||
static void callDirectDraw() {
|
||||
JUTChangeFrameBuffer(JUTXfb::getManager()->getDrawingXfb(),
|
||||
JUTVideo::getManager()->getEfbHeight(),
|
||||
JUTVideo::getManager()->getFbWidth());
|
||||
u16 width = JUTVideo::getManager()->getFbWidth();
|
||||
u16 height = JUTVideo::getManager()->getEfbHeight();
|
||||
JUTChangeFrameBuffer(JUTXfb::getManager()->getDrawingXfb(), width, height);
|
||||
JUTAssertion::flushMessage();
|
||||
}
|
||||
|
||||
void JFWDisplay::prepareCopyDisp() {
|
||||
u16 width = JUTVideo::getManager()->getFbWidth();
|
||||
u16 height = JUTVideo::getManager()->getEfbHeight();
|
||||
f32 y_scaleF = GXGetYScaleFactor(height, JUTVideo::getManager()->getXfbHeight());
|
||||
u16 xfbHeight = JUTVideo::getManager()->getXfbHeight();
|
||||
f32 y_scaleF = GXGetYScaleFactor(height, xfbHeight);
|
||||
u16 line_num = GXGetNumXfbLines(height, y_scaleF);
|
||||
|
||||
GXSetCopyClear(mClearColor, mZClear);
|
||||
@@ -109,11 +98,13 @@ void JFWDisplay::prepareCopyDisp() {
|
||||
|
||||
void JFWDisplay::drawendXfb_single() {
|
||||
JUTXfb* manager = JUTXfb::getManager();
|
||||
s16 idx;
|
||||
if (manager->getDrawingXfbIndex() >= 0) {
|
||||
prepareCopyDisp();
|
||||
JFWDrawDoneAlarm();
|
||||
GXFlush();
|
||||
manager->setDrawnXfbIndex(manager->getDrawingXfbIndex());
|
||||
idx = manager->getDrawingXfbIndex();
|
||||
manager->setDrawnXfbIndex(idx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,8 +192,10 @@ void JFWDisplay::preGX() {
|
||||
}
|
||||
|
||||
void JFWDisplay::endGX() {
|
||||
f32 width = JUTVideo::getManager()->getFbWidth();
|
||||
f32 height = JUTVideo::getManager()->getEfbHeight();
|
||||
s32 bufferNum = JUTXfb::getManager()->getBufferNum();
|
||||
u16 width = JUTVideo::getManager()->getFbWidth();
|
||||
u16 height = JUTVideo::getManager()->getEfbHeight();
|
||||
u16 xfbHeight = JUTVideo::getManager()->getXfbHeight();
|
||||
|
||||
J2DOrthoGraph ortho(0.0f, 0.0f, width, height, -1.0f, 1.0f);
|
||||
|
||||
@@ -334,6 +327,7 @@ void JFWDisplay::endFrame() {
|
||||
if (field_0x40) {
|
||||
static u32 prevFrame = VIGetRetraceCount();;
|
||||
u32 retrace_cnt = VIGetRetraceCount();
|
||||
u32 r28 = retrace_cnt - prevFrame;
|
||||
JUTProcBar::getManager()->setCostFrame(retrace_cnt - prevFrame);
|
||||
prevFrame = retrace_cnt;
|
||||
}
|
||||
@@ -383,11 +377,28 @@ void JFWDisplay::threadSleep(s64 time) {
|
||||
s32 status = OSDisableInterrupts();
|
||||
alarm.appendLink();
|
||||
|
||||
OSSetAlarm(&alarm, time, JFWThreadAlarmHandler);
|
||||
OSSetAlarm(alarm.getAlarm(), time, JFWThreadAlarmHandler);
|
||||
OSSuspendThread(alarm.getThread());
|
||||
OSRestoreInterrupts(status);
|
||||
}
|
||||
|
||||
static void dummy() {
|
||||
JUTXfb::getManager()->setDisplayingXfbIndex(0);
|
||||
}
|
||||
|
||||
static Mtx e_mtx ATTRIBUTE_ALIGN(32) = {
|
||||
{1.0f, 0.0f, 0.0f, 0.0f},
|
||||
{0.0f, 1.0f, 0.0f, 0.0f},
|
||||
{0.0f, 0.0f, 1.0f, 0.0f},
|
||||
};
|
||||
|
||||
static u8 clear_z_TX[64] ATTRIBUTE_ALIGN(32) = {
|
||||
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
|
||||
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
};
|
||||
|
||||
static GXTexObj clear_z_tobj;
|
||||
|
||||
void JFWDisplay::clearEfb_init() {
|
||||
@@ -401,8 +412,8 @@ void JFWDisplay::clearEfb() {
|
||||
}
|
||||
|
||||
void JFWDisplay::clearEfb(GXColor color) {
|
||||
int width = JUTVideo::getManager()->getFbWidth();
|
||||
int height = JUTVideo::getManager()->getEfbHeight();
|
||||
u16 width = JUTVideo::getManager()->getFbWidth();
|
||||
u16 height = JUTVideo::getManager()->getEfbHeight();
|
||||
|
||||
clearEfb(0, 0, width, height, color);
|
||||
}
|
||||
@@ -432,7 +443,7 @@ void JFWDisplay::clearEfb(int param_0, int param_1, int param_2, int param_3, GX
|
||||
GXSetChanCtrl(GX_COLOR1A1, GX_DISABLE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE,
|
||||
GX_AF_NONE);
|
||||
GXSetNumTexGens(1);
|
||||
GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 60, GX_DISABLE, 125);
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 60);
|
||||
GXLoadTexObj(&clear_z_tobj, GX_TEXMAP0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevColor(GX_TEVREG0, color);
|
||||
@@ -465,6 +476,7 @@ void JFWDisplay::clearEfb(int param_0, int param_1, int param_2, int param_3, GX
|
||||
|
||||
GXPosition2u16(param_0, param_1 + param_3);
|
||||
GXTexCoord2u8(0, 1);
|
||||
GXEnd();
|
||||
|
||||
GXSetZTexture(GX_ZT_DISABLE, GX_TF_Z24X8, 0);
|
||||
GXSetZCompLoc(GX_ENABLE);
|
||||
@@ -481,11 +493,11 @@ void JFWDisplay::calcCombinationRatio() {
|
||||
for (; i < unk30; i += vidInterval) {
|
||||
}
|
||||
|
||||
s32 tmp = (i - unk30) - field_0x34;
|
||||
if (tmp < 0) {
|
||||
tmp += vidInterval;
|
||||
i = (i - unk30) - field_0x34;
|
||||
if (i < 0) {
|
||||
i += vidInterval;
|
||||
}
|
||||
mCombinationRatio = (f32)tmp / (f32)field_0x30;
|
||||
mCombinationRatio = (f32)i / (f32)field_0x30;
|
||||
if (mCombinationRatio > 1.0f) {
|
||||
mCombinationRatio = 1.0f;
|
||||
}
|
||||
@@ -496,7 +508,9 @@ static void JFWDrawDoneAlarm() {
|
||||
s32 status = OSDisableInterrupts();
|
||||
alarm.createAlarm();
|
||||
alarm.appendLink();
|
||||
OSSetAlarm(&alarm, 0.5 * (*(u32*)0x800000F8 / 4), JFWGXAbortAlarmHandler);
|
||||
#if !PLATFORM_SHIELD
|
||||
OSSetAlarm(&alarm, OSSecondsToTicks(0.5), JFWGXAbortAlarmHandler);
|
||||
#endif
|
||||
GXDrawDone();
|
||||
alarm.cancelAlarm();
|
||||
alarm.removeLink();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "JSystem/JGadget/binary.h"
|
||||
#include "JSystem/JGadget/define.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
#if DEBUG
|
||||
static void dummyString() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "JSystem/JGadget/define.h"
|
||||
|
||||
#define MSL_USE_INLINES 1
|
||||
#include <ctype>
|
||||
#include <cctype>
|
||||
|
||||
JGadget_outMessage::JGadget_outMessage(MessageFunc fn, const char* file, int line) {
|
||||
mMsgFunc = fn;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JGadget/linklist.h"
|
||||
#include "JSystem/JGadget/define.h"
|
||||
|
||||
namespace JGadget {
|
||||
namespace {
|
||||
template <typename T>
|
||||
class TPRIsEqual_pointer_ {
|
||||
public:
|
||||
@@ -12,29 +15,45 @@ public:
|
||||
private:
|
||||
const T* p_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
JGadget::TNodeLinkList::~TNodeLinkList() {}
|
||||
JGadget::TNodeLinkList::~TNodeLinkList() {
|
||||
#if DEBUG
|
||||
Confirm();
|
||||
clear();
|
||||
JGADGET_ASSERTWARN(84, empty())
|
||||
oNode_.clear_();
|
||||
#endif
|
||||
}
|
||||
|
||||
JGadget::TNodeLinkList::iterator
|
||||
JGadget::TNodeLinkList::erase(JGadget::TNodeLinkList::iterator it) {
|
||||
JUT_ASSERT(102, it.p_!=&oNode_);
|
||||
iterator next = it;
|
||||
++next;
|
||||
return erase(it, next);
|
||||
}
|
||||
|
||||
JGadget::TNodeLinkList::iterator JGadget::TNodeLinkList::erase(iterator a, iterator b) {
|
||||
TLinkListNode* cur = a.node;
|
||||
TLinkListNode* end = b.node;
|
||||
TLinkListNode* cur = a.p_;
|
||||
TLinkListNode* end = b.p_;
|
||||
TLinkListNode* next;
|
||||
|
||||
for (; cur != end; cur = next) {
|
||||
next = cur->mNext;
|
||||
next = cur->pNext_;
|
||||
Erase(cur);
|
||||
}
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
void JGadget::TNodeLinkList::splice(iterator it, TNodeLinkList& rSrc) {
|
||||
JUT_ASSERT(146, this!=&rSrc);
|
||||
splice(it, rSrc, rSrc.begin(), rSrc.end());
|
||||
JUT_ASSERT(148, rSrc.empty());
|
||||
}
|
||||
|
||||
void JGadget::TNodeLinkList::splice(iterator it, TNodeLinkList& rSrc, iterator itSrc) {
|
||||
iterator itSrcNext = itSrc;
|
||||
++itSrcNext;
|
||||
@@ -48,24 +67,69 @@ void JGadget::TNodeLinkList::splice(iterator it, TNodeLinkList& rSrc, iterator i
|
||||
}
|
||||
}
|
||||
|
||||
JGadget::TNodeLinkList::iterator JGadget::TNodeLinkList::Insert(iterator it, TLinkListNode* p) {
|
||||
TLinkListNode* pIt = it.node;
|
||||
TLinkListNode* pItPrev = pIt->mPrev;
|
||||
void JGadget::TNodeLinkList::splice(iterator it, TNodeLinkList& rSrc, iterator itBegin, iterator itEnd) {
|
||||
s32 dist = 0;
|
||||
if (this == &rSrc) {
|
||||
if (itBegin == itEnd) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
dist = std::distance(itBegin, itEnd);
|
||||
if (dist == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
TLinkListNode* r31 = it.p_;
|
||||
TLinkListNode* r30 = itBegin.p_;
|
||||
TLinkListNode* r29 = itEnd.p_;
|
||||
TLinkListNode* r25 = r29->pPrev_;
|
||||
TLinkListNode* r24 = r30->pPrev_;
|
||||
r24->pNext_ = r29;
|
||||
r29->pPrev_ = r24;
|
||||
rSrc.count -= dist;
|
||||
TLinkListNode* r23 = r31->pPrev_;
|
||||
r23->pNext_ = r30;
|
||||
r30->pPrev_ = r23;
|
||||
r25->pNext_ = r31;
|
||||
r31->pPrev_ = r25;
|
||||
count += dist;
|
||||
}
|
||||
|
||||
p->mNext = pIt;
|
||||
p->mPrev = pItPrev;
|
||||
pIt->mPrev = p;
|
||||
pItPrev->mNext = p;
|
||||
JGadget::TNodeLinkList::iterator JGadget::TNodeLinkList::Find(const JGadget::TLinkListNode* p) {
|
||||
return std::find_if(begin(), end(), TPRIsEqual_pointer_<TLinkListNode>(p));
|
||||
}
|
||||
|
||||
JGadget::TNodeLinkList::iterator JGadget::TNodeLinkList::Insert(iterator it, TLinkListNode* p) {
|
||||
JUT_ASSERT(300, p!=NULL);
|
||||
TLinkListNode* pIt = it.p_;
|
||||
JUT_ASSERT(302, pIt!=NULL);
|
||||
TLinkListNode* pItPrev = pIt->pPrev_;
|
||||
JUT_ASSERT(305, pItPrev!=0);
|
||||
JGADGET_ASSERTWARN(307, p->pNext_==NULL);
|
||||
JGADGET_ASSERTWARN(308, p->pPrev_==NULL);
|
||||
|
||||
p->pNext_ = pIt;
|
||||
p->pPrev_ = pItPrev;
|
||||
pIt->pPrev_ = p;
|
||||
pItPrev->pNext_ = p;
|
||||
count++;
|
||||
return iterator(p);
|
||||
}
|
||||
|
||||
JGadget::TNodeLinkList::iterator JGadget::TNodeLinkList::Erase(TLinkListNode* p) {
|
||||
TLinkListNode* pNext = p->mNext;
|
||||
TLinkListNode* pPrev = p->mPrev;
|
||||
pNext->mPrev = pPrev;
|
||||
pPrev->mNext = pNext;
|
||||
JUT_ASSERT(325, !empty());
|
||||
JUT_ASSERT(326, p!=0);
|
||||
JUT_ASSERT(327, p!=&oNode_);
|
||||
TLinkListNode* pNext = p->pNext_;
|
||||
TLinkListNode* pPrev = p->pPrev_;
|
||||
JUT_ASSERT(330, pNext!=NULL);
|
||||
pNext->pPrev_ = pPrev;
|
||||
JUT_ASSERT(332, pPrev!=NULL);
|
||||
pPrev->pNext_ = pNext;
|
||||
count--;
|
||||
#if DEBUG
|
||||
p->clear_();
|
||||
#endif
|
||||
return iterator(pNext);
|
||||
}
|
||||
|
||||
@@ -73,3 +137,34 @@ JGadget::TNodeLinkList::iterator JGadget::TNodeLinkList::Erase(TLinkListNode* p)
|
||||
void JGadget::TNodeLinkList::Remove(TLinkListNode* p) {
|
||||
remove_if(TPRIsEqual_pointer_<TLinkListNode>(p));
|
||||
}
|
||||
|
||||
bool JGadget::TNodeLinkList::Confirm() const {
|
||||
int u = 0;
|
||||
const_iterator itEnd = end();
|
||||
JGADGET_EXITWARN(357, itEnd.p_==&oNode_);
|
||||
const_iterator it = begin();
|
||||
JGADGET_EXITWARN(359, it.p_==oNode_.pNext_);
|
||||
for (; it != itEnd; ++it, ++u) {
|
||||
JGADGET_EXITWARN(362, u<size());
|
||||
const TLinkListNode* pIt = it.p_;
|
||||
JUT_ASSERT(364, pIt!=NULL);
|
||||
JGADGET_EXITWARN(365, pIt->pNext_->pPrev_==pIt);
|
||||
JGADGET_EXITWARN(366, pIt->pPrev_->pNext_==pIt);
|
||||
}
|
||||
JGADGET_EXITWARN(368, it.p_==&oNode_);
|
||||
JGADGET_EXITWARN(369, u==size());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JGadget::TNodeLinkList::Confirm_iterator(const_iterator it) const {
|
||||
const_iterator itBegin = begin();
|
||||
const_iterator itEnd = end();
|
||||
while (itBegin != itEnd) {
|
||||
if (itBegin == it) {
|
||||
return true;
|
||||
}
|
||||
++itBegin;
|
||||
}
|
||||
JGADGET_EXITWARN(383, it==itEnd);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "JSystem/JGadget/std-stream.h"
|
||||
#include "JSystem/JGadget/define.h"
|
||||
#include <ctype>
|
||||
#include <cctype>
|
||||
#include <float.h>
|
||||
|
||||
namespace JGadget {
|
||||
|
||||
@@ -9,13 +9,13 @@ u32 JGadget::vector::extend_default(u32 param_0, u32 param_1, u32 param_2) {
|
||||
JGadget::TVector_pointer_void::TVector_pointer_void(JGadget::TAllocator<void*> const& param_0) : TVector<void*>(param_0) {
|
||||
}
|
||||
|
||||
JGadget::TVector_pointer_void::~TVector_pointer_void() {
|
||||
}
|
||||
|
||||
void dummy_weak_order(JGadget::TVector<void*> vec) {
|
||||
vec.insert(NULL, 0, NULL);
|
||||
}
|
||||
|
||||
JGadget::TVector_pointer_void::~TVector_pointer_void() {
|
||||
}
|
||||
|
||||
void JGadget::TVector_pointer_void::insert(void** param_0, void* const& param_1) {
|
||||
TVector<void*>::insert(param_0, param_1);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "JSystem/JKernel/JKRDvdFile.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include <math>
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
|
||||
JKRAramArchive::JKRAramArchive() {}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "JSystem/JKernel/JKRAramPiece.h"
|
||||
#include "JSystem/JSupport/JSUFileStream.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
#if PLATFORM_GCN
|
||||
const u32 stack_size = 0xc00;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "JSystem/JKernel/JKRArchive.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include <ctype>
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
|
||||
u32 JKRArchive::sCurrentDirID;
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
#include "JSystem/JKernel/JKRMemArchive.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include <math>
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
JKRCompArchive::JKRCompArchive(s32 entryNum, JKRArchive::EMountDirection eMountDirection)
|
||||
: JKRArchive(entryNum, MOUNT_COMP) {
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
#include "JSystem/JKernel/JKRDvdRipper.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include <math>
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include "global.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
JKRDvdArchive::JKRDvdArchive(s32 entryNum, JKRArchive::EMountDirection mountDirection)
|
||||
: JKRArchive(entryNum, MOUNT_DVD) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "JSystem/JKernel/JKRDvdFile.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
JSUList<JKRDvdFile> JKRDvdFile::sDvdList;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <string>
|
||||
#include <dolphin/os.h>
|
||||
#include "dolphin/vi.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
static int JKRDecompressFromDVD(JKRDvdFile*, void*, u32, u32, u32, u32, u32*);
|
||||
static int decompSZS_subroutine(u8*, u8*);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
#include "JSystem/JUtility/JUTConsole.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include <stdlib>
|
||||
#include <cstdlib>
|
||||
|
||||
JKRExpHeap* JKRExpHeap::createRoot(int maxHeaps, bool errorFlag) {
|
||||
JKRExpHeap* heap = NULL;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
#include <ctype>
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
#include "global.h"
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#define MSL_USE_INLINES 1 // needed to inline tolower call. not inlined elsewhere in the repo
|
||||
|
||||
#include <string>
|
||||
#include <ctype>
|
||||
#include <cctype>
|
||||
#include "global.h"
|
||||
|
||||
JKRFileLoader* JKRFileLoader::sCurrentVolume;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
#if DEBUG
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include <string>
|
||||
#include "global.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
JKRMemArchive::JKRMemArchive(s32 entryNum, JKRArchive::EMountDirection mountDirection)
|
||||
: JKRArchive(entryNum, MOUNT_MEM) {
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTConsole.h"
|
||||
#include "global.h"
|
||||
#include <stdint>
|
||||
#include <stdlib>
|
||||
#include <stdint.h>
|
||||
#include <cstdlib>
|
||||
|
||||
JKRSolidHeap* JKRSolidHeap::create(u32 size, JKRHeap* heap, bool useErrorHandler) {
|
||||
if (!heap) {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
#include "JSystem/JKernel/JKRThread.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTConsole.h"
|
||||
#include <stdio>
|
||||
#include <cstdio>
|
||||
#include "global.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
JSUList<JKRThread> JKRThread::sThreadList(0);
|
||||
|
||||
|
||||
@@ -1,79 +1,25 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
// don't include header until this "zero" mess is figured out
|
||||
// #include "JSystem/JMath/JMATrigonometric.h"
|
||||
#include <math>
|
||||
#include "JSystem/JMath/JMATrigonometric.h"
|
||||
#include <cmath>
|
||||
#include "global.h"
|
||||
|
||||
static f32 dummy() {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
namespace std {
|
||||
template <typename A1, typename B1>
|
||||
struct pair {
|
||||
A1 a1;
|
||||
B1 b1;
|
||||
pair() {
|
||||
f32 tmp = 0.0f;
|
||||
a1 = tmp;
|
||||
b1 = tmp;
|
||||
// a1 = A1();
|
||||
// b1 = B1();
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
inline f64 getConst() {
|
||||
return 6.2831854820251465;
|
||||
}
|
||||
|
||||
template<int N, typename T>
|
||||
struct TSinCosTable {
|
||||
std::pair<T, T> table[1 << N];
|
||||
TSinCosTable() {
|
||||
for (int i = 0; i < 1 << N; i++) {
|
||||
table[i].a1 = sin((i * getConst()) / (1 << N));
|
||||
table[i].b1 = cos((i * getConst()) / (1 << N));
|
||||
}
|
||||
}
|
||||
};
|
||||
namespace JMath {
|
||||
template<typename T>
|
||||
struct TAngleConstant_;
|
||||
|
||||
inline f64 getConst2() {
|
||||
return 9.765625E-4;
|
||||
}
|
||||
|
||||
struct TAtanTable {
|
||||
f32 table[1025];
|
||||
u8 pad[0x1C];
|
||||
TAtanTable() {
|
||||
// (u32) cast needed for cmplwi instead of cmpwi
|
||||
for (int i = 0; i < (u32)1024; i++) {
|
||||
table[i] = atan(getConst2() * i);
|
||||
}
|
||||
table[0] = 0.0f;
|
||||
table[1024] = 0.7853982; // 0.25 * PI
|
||||
}
|
||||
};
|
||||
|
||||
struct TAsinAcosTable {
|
||||
f32 table[1025];
|
||||
u8 pad[0x1C];
|
||||
TAsinAcosTable() {
|
||||
for (int i = 0; i < 1024; i++) {
|
||||
table[i] = asin(getConst2() * i);
|
||||
}
|
||||
table[0] = 0.0f;
|
||||
table[1024] = 0.7853982; // 0.25 * PI
|
||||
}
|
||||
};
|
||||
|
||||
namespace JMath {
|
||||
|
||||
TSinCosTable<13, f32> sincosTable_ ATTRIBUTE_ALIGN(32);
|
||||
|
||||
TAtanTable atanTable_ ATTRIBUTE_ALIGN(32);
|
||||
TAtanTable<1024, f32> atanTable_ ATTRIBUTE_ALIGN(32);
|
||||
|
||||
TAsinAcosTable asinAcosTable_ ATTRIBUTE_ALIGN(32);
|
||||
TAsinAcosTable<1024, f32> asinAcosTable_ ATTRIBUTE_ALIGN(32);
|
||||
|
||||
} // namespace JMath
|
||||
|
||||
@@ -38,8 +38,9 @@ void JMAQuatLerp(__REGISTER const Quaternion* p, __REGISTER const Quaternion* q,
|
||||
ps_sum0 dp, dp, dp, dp
|
||||
}
|
||||
#endif // clang-format on
|
||||
|
||||
if (dp < 0.0) {
|
||||
f32 local_78 = dp;
|
||||
if (local_78 < 0.0) {
|
||||
int unused;
|
||||
dst->x = -t * (p->x + q->x) + p->x;
|
||||
dst->y = -t * (p->y + q->y) + p->y;
|
||||
dst->z = -t * (p->z + q->z) + p->z;
|
||||
@@ -73,7 +74,7 @@ void JMAFastVECNormalize(__REGISTER const Vec* src, __REGISTER Vec* dst) {
|
||||
void JMAVECScaleAdd(__REGISTER const Vec* vec1, __REGISTER const Vec* vec2, __REGISTER Vec* dst,
|
||||
__REGISTER f32 scale) {
|
||||
__REGISTER f32 v1xy;
|
||||
__REGISTER f32 v2xy = scale;
|
||||
__REGISTER f32 v2xy;
|
||||
__REGISTER f32 rxy, v1z, v2z, rz;
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
asm {
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
#include "JSystem/JMath/random.h"
|
||||
|
||||
JMath::TRandom_fast_::TRandom_fast_(u32 param_0) {
|
||||
value = param_0;
|
||||
JMath::TRandom_fast_::TRandom_fast_(u32 seed) {
|
||||
setSeed(seed);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JGadget/linklist.h"
|
||||
#include <math>
|
||||
#include <stdlib>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <limits>
|
||||
|
||||
namespace JStudio {
|
||||
@@ -291,7 +291,11 @@ f64 TFunctionValue_composite::composite_index(TVector_pointer<TFunctionValue*> c
|
||||
}
|
||||
break;
|
||||
case 1: {
|
||||
#ifdef __MWERKS__
|
||||
div_t dt = div(index, size - 1);
|
||||
#else
|
||||
div_t dt = div((int)index, (int)size - 1);
|
||||
#endif
|
||||
index = dt.rem;
|
||||
if (index < 0) {
|
||||
index = size + index;
|
||||
@@ -304,7 +308,11 @@ f64 TFunctionValue_composite::composite_index(TVector_pointer<TFunctionValue*> c
|
||||
index = 0;
|
||||
} else {
|
||||
u32 uVar3 = (u32)(size - 2) * 2;
|
||||
#ifdef __MWERKS__
|
||||
div_t dt2 = div(index, uVar3);
|
||||
#else
|
||||
div_t dt2 = div((int)index, (int)uVar3);
|
||||
#endif
|
||||
index = dt2.rem;
|
||||
if (index < 0) {
|
||||
index += uVar3;
|
||||
@@ -315,8 +323,12 @@ f64 TFunctionValue_composite::composite_index(TVector_pointer<TFunctionValue*> c
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __MWERKS__
|
||||
std::advance_pointer(local_148, index + 1);
|
||||
#else
|
||||
std::advance(local_148, index + 1);
|
||||
#endif
|
||||
pFront = *local_148;
|
||||
return pFront->getValue(param_3);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "JSystem/JStudio/JStudio/jstudio-math.h"
|
||||
#include "JSystem/JGeometry.h"
|
||||
#include "JSystem/TPosition3.h"
|
||||
#include <math>
|
||||
#include <cmath>
|
||||
|
||||
void JStudio::math::getRotation_xyz(MtxP param_1, f32 x, f32 y, f32 z) {
|
||||
f32 cosx = cosf(DEG_TO_RAD(x));
|
||||
@@ -62,7 +62,7 @@ void JStudio::math::getFromTransformation_SRxyzT(Vec* param_1, Vec* param_2, Vec
|
||||
param_4[1][0] * dVar9, param_4[1][1] * dVar8, param_4[1][2] * dVar7,
|
||||
param_4[2][0] * dVar9, param_4[2][1] * dVar8, param_4[2][2] * dVar7);
|
||||
aTStack_88.getEulerXYZ(&local_a0);
|
||||
local_a0 *= 57.29577951308232;
|
||||
local_a0 *= 180.0 / m_PI_D;
|
||||
param_2->x = local_a0.x;
|
||||
param_2->y = local_a0.y;
|
||||
param_2->z = local_a0.z;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "JSystem/JStudio/JStudio/stb-data-parse.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/os.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace JStudio {
|
||||
namespace stb {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "JSystem/JUtility/JUTConsole.h"
|
||||
#include "JSystem/JUtility/JUTDbPrint.h"
|
||||
#include "JSystem/JUtility/JUTDirectPrint.h"
|
||||
#include <stdio>
|
||||
#include <cstdio>
|
||||
#include <dolphin/vi.h>
|
||||
|
||||
namespace JUTAssertion {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "JSystem/JUtility/JUTConsole.h"
|
||||
#include "JSystem/JKernel/JKRAram.h"
|
||||
#include "dolphin/gx.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
JUTCacheFont::JUTCacheFont(ResFONT const* p_fontRes, u32 cacheSize, JKRHeap* p_heap) {
|
||||
initialize_state();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "JSystem/JUtility/JUTDirectPrint.h"
|
||||
#include "JSystem/JUtility/JUTVideo.h"
|
||||
#include <dolphin/vi.h>
|
||||
#include <stdio>
|
||||
#include <cstdio>
|
||||
#include "global.h"
|
||||
|
||||
JUTConsoleManager* JUTConsoleManager::sManager;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTVideo.h"
|
||||
#include <stdio>
|
||||
#include <cstdio>
|
||||
|
||||
JUTDbPrint::JUTDbPrint(JUTFont* pFont, JKRHeap* pHeap) {
|
||||
mFont = pFont;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "JSystem/JUtility/JUTDirectFile.h"
|
||||
#include <dolphin/os.h>
|
||||
#include "global.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
int JUTDirectFile::fetch32byte() {
|
||||
mToRead = mLength - ALIGN_PREV(mPos, DVD_MIN_TRANSFER_SIZE);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JUtility/JUTDirectPrint.h"
|
||||
#include <stdio>
|
||||
#include <cstdio>
|
||||
#include <dolphin/os.h>
|
||||
#include "global.h"
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
#include "JSystem/JUtility/JUTConsole.h"
|
||||
#include "JSystem/JUtility/JUTDirectPrint.h"
|
||||
#include "JSystem/JUtility/JUTDirectFile.h"
|
||||
#include <math>
|
||||
#include <stdio>
|
||||
#include <stdlib>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <dolphin/dolphin.h>
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
OSMessageQueue JUTException::sMessageQueue = {0};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JUtility/JUTGamePad.h"
|
||||
#include <math>
|
||||
#include <cmath>
|
||||
|
||||
u32 JUTGamePad::CRumble::sChannelMask[4] = {
|
||||
PAD_CHAN0_BIT,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "JSystem/JUtility/JUTGraphFifo.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
static bool data_804514B8;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTVideo.h"
|
||||
#include <stdint>
|
||||
#include <stdint.h>
|
||||
|
||||
JUTProcBar::JUTProcBar() {
|
||||
mVisible = true;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#ifndef MSL_MEMORY_H_
|
||||
#define MSL_MEMORY_H_
|
||||
|
||||
#include <new>
|
||||
|
||||
namespace std {
|
||||
|
||||
template<class ForwardIt, class Size, class T>
|
||||
inline ForwardIt uninitialized_fill_n(ForwardIt first, Size count, const T& value) {
|
||||
inline void uninitialized_fill_n(ForwardIt first, Size count, const T& value) {
|
||||
ForwardIt r29 = first;
|
||||
for (; count--; ++first) {
|
||||
if (first != NULL) {
|
||||
*first = value;
|
||||
}
|
||||
new (first) T(value);
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
template<class InputIterator, class ForwardIterator>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <stdio>
|
||||
|
||||
inline void* (operator new)(size_t, void *ptr) { return ptr; }
|
||||
inline void* operator new(size_t, void *ptr) { return ptr; }
|
||||
inline void* operator new[](size_t, void* ptr) { return ptr; }
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,4 +20,15 @@ typedef struct decform {
|
||||
short digits;
|
||||
} decform;
|
||||
|
||||
void __ull2dec(decimal*, unsigned long long);
|
||||
void __timesdec(decimal*, const decimal*, const decimal*);
|
||||
void __str2dec(decimal*, const char*, short);
|
||||
void __two_exp(decimal*, long);
|
||||
int __equals_dec(const decimal*, const decimal*);
|
||||
int __less_dec(const decimal*, const decimal*);
|
||||
void __minus_dec(decimal*, const decimal*, const decimal*);
|
||||
void __num2dec_internal(decimal*, double);
|
||||
void __num2dec(const decform*, double, decimal*);
|
||||
double __dec2num(const decimal*);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
typedef struct div_t {
|
||||
int quot; /* quotient */
|
||||
int rem; /* remainder */
|
||||
} div_t;
|
||||
|
||||
@@ -151,6 +151,62 @@ MSL_INLINE float tanf(float x) {
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
||||
namespace std {
|
||||
template<typename T>
|
||||
inline double fabs(T x) {
|
||||
return ::fabs(x);
|
||||
}
|
||||
|
||||
inline float fabs(float num) {
|
||||
return ::fabsf(num);
|
||||
}
|
||||
|
||||
inline float fabsf(float num) {
|
||||
return ::fabsf(num);
|
||||
}
|
||||
|
||||
inline float sqrt(float x) {
|
||||
return ::sqrtf(x);
|
||||
}
|
||||
|
||||
inline float abs(float x) {
|
||||
return ::fabsf(x);
|
||||
}
|
||||
|
||||
inline float fmod(float x, float y) {
|
||||
return ::fmod(x, y);
|
||||
}
|
||||
|
||||
inline float ceil(float num) {
|
||||
return ::ceilf(num);
|
||||
}
|
||||
|
||||
inline float floor(float num) {
|
||||
return ::floorf(num);
|
||||
}
|
||||
|
||||
inline float tan(float num) {
|
||||
return ::tanf(num);
|
||||
}
|
||||
|
||||
inline float tanf(float num) {
|
||||
return ::tanf(num);
|
||||
}
|
||||
|
||||
inline float acos(float num) {
|
||||
return ::acosf(num);
|
||||
}
|
||||
|
||||
inline float pow(float x, float y) {
|
||||
return ::pow(x, y);
|
||||
}
|
||||
|
||||
inline float pow(float x, int y) {
|
||||
// FIXME: Needs to use powf
|
||||
return ::pow(x, y);
|
||||
}
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,4 +13,24 @@
|
||||
#define stdout (&__files._stdout)
|
||||
#define stderr (&__files._stderr)
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <stdarg>
|
||||
|
||||
extern "C" {
|
||||
namespace std {
|
||||
using ::fputs;
|
||||
using ::fflush;
|
||||
using ::fclose;
|
||||
using ::fprintf;
|
||||
using ::printf;
|
||||
using ::sprintf;
|
||||
using ::snprintf;
|
||||
using ::vsnprintf;
|
||||
using ::vprintf;
|
||||
using ::vswprintf;
|
||||
using ::sscanf;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,4 +5,18 @@
|
||||
#include <arith.h>
|
||||
#include <strtoul.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
namespace std {
|
||||
using ::strtol;
|
||||
using ::strtoul;
|
||||
using ::div;
|
||||
using ::exit;
|
||||
using ::abort;
|
||||
using ::atoi;
|
||||
using ::atof;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
#ifndef MSL_MATH_H_
|
||||
#define MSL_MATH_H_
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace std {
|
||||
template<typename T>
|
||||
inline double fabs(T x) {
|
||||
return ::fabs(x);
|
||||
}
|
||||
|
||||
inline float fabs(float num) {
|
||||
return ::fabsf(num);
|
||||
}
|
||||
|
||||
inline float fabsf(float num) {
|
||||
return ::fabsf(num);
|
||||
}
|
||||
|
||||
inline float sqrt(float x) {
|
||||
return ::sqrtf(x);
|
||||
}
|
||||
|
||||
inline float abs(float x) {
|
||||
return ::fabsf(x);
|
||||
}
|
||||
|
||||
inline float fmod(float x, float y) {
|
||||
return ::fmod(x, y);
|
||||
}
|
||||
|
||||
inline float ceil(float num) {
|
||||
return ::ceilf(num);
|
||||
}
|
||||
|
||||
inline float floor(float num) {
|
||||
return ::floorf(num);
|
||||
}
|
||||
|
||||
inline float tan(float num) {
|
||||
return ::tanf(num);
|
||||
}
|
||||
|
||||
inline float tanf(float num) {
|
||||
return ::tanf(num);
|
||||
}
|
||||
|
||||
inline float acos(float num) {
|
||||
return ::acosf(num);
|
||||
}
|
||||
|
||||
inline float pow(float x, float y) {
|
||||
return ::pow(x, y);
|
||||
}
|
||||
|
||||
inline float pow(float x, int y) {
|
||||
// FIXME: Needs to use powf
|
||||
return ::pow(x, y);
|
||||
}
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
@@ -1,3 +1,4 @@
|
||||
#include "alloc.h"
|
||||
#include "ansi_files.h"
|
||||
#include "critical_regions.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "buffer_io.h"
|
||||
#include "char_io.h"
|
||||
#include "critical_regions.h"
|
||||
#include "FILE_POS.h"
|
||||
#include "misc_io.h"
|
||||
#include "wchar_io.h"
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user