mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-18 12:52:51 -04:00
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
@@ -44,9 +44,7 @@ char* J2DResReference::getName(u16 idx) const {
|
||||
p_name[0] = 0;
|
||||
return p_name;
|
||||
} else {
|
||||
s8 first = resRef[0];
|
||||
|
||||
switch (first) {
|
||||
switch (resRef[0]) {
|
||||
case 2:
|
||||
case 3:
|
||||
for (s32 i = 0; i < resRef[1]; i++) {
|
||||
@@ -54,8 +52,9 @@ char* J2DResReference::getName(u16 idx) const {
|
||||
}
|
||||
p_name[resRef[1]] = 0;
|
||||
break;
|
||||
case 4:
|
||||
s32 pos = resRef[1] + 1;
|
||||
case 4: {
|
||||
s32 tmp = resRef[1];
|
||||
s32 pos = tmp + 1;
|
||||
for (; pos >= 2; pos--) {
|
||||
if (resRef[pos] == '\\' || resRef[pos] == '/') {
|
||||
break;
|
||||
@@ -70,6 +69,7 @@ char* J2DResReference::getName(u16 idx) const {
|
||||
p_name[i] = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
p_name[0] = 0;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "JSystem/JUtility/JUTTexture.h"
|
||||
#include "dolphin/gx.h"
|
||||
|
||||
// NONMATCHING - instruction order
|
||||
void J2DColorBlock::initialize() {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mMatColor[i] = JUtility::TColor(j2dDefaultColInfo);
|
||||
@@ -848,7 +847,6 @@ J2DTevBlock4::~J2DTevBlock4() {
|
||||
}
|
||||
}
|
||||
|
||||
// NONMATCHING - inlines
|
||||
void J2DTevBlock4::initialize() {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
mTexNo[i] = -1;
|
||||
@@ -1292,7 +1290,6 @@ J2DTevBlock8::~J2DTevBlock8() {
|
||||
}
|
||||
}
|
||||
|
||||
// NONMATCHING - inlines
|
||||
void J2DTevBlock8::initialize() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
mTexNo[i] = 0xffff;
|
||||
@@ -1732,7 +1729,6 @@ J2DTevBlock16::~J2DTevBlock16() {
|
||||
}
|
||||
}
|
||||
|
||||
// NONMATCHING - inlines
|
||||
void J2DTevBlock16::initialize() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
mTexNo[i] = 0xffff;
|
||||
@@ -2187,15 +2183,3 @@ void J2DPEBlock::setGX() {
|
||||
GXSetBlendMode(GXBlendMode(mBlend.getType()), GXBlendFactor(mBlend.getSrcFactor()), GXBlendFactor(mBlend.getDstFactor()), GXLogicOp(mBlend.getOp()));
|
||||
GXSetDither(mDither);
|
||||
}
|
||||
|
||||
J2DTevStage::J2DTevStage() {
|
||||
setTevStageInfo(j2dDefaultTevStageInfo);
|
||||
setTevSwapModeInfo(j2dDefaultTevSwapMode);
|
||||
}
|
||||
|
||||
void J2DTevStage::setTevStageInfo(J2DTevStageInfo const& info) {
|
||||
setColorABCD(info.mColorA, info.mColorB, info.mColorC, info.mColorD);
|
||||
setTevColorOp(info.mCOp, info.mCBias, info.mCScale, info.mCClamp, info.mCReg);
|
||||
setAlphaABCD(info.mAlphaA, info.mAlphaB, info.mAlphaC, info.mAlphaD);
|
||||
setTevAlphaOp(info.mAOp, info.mABias, info.mAScale, info.mAClamp, info.mAReg);
|
||||
}
|
||||
|
||||
@@ -270,18 +270,8 @@ J2DTevOrder J2DMaterialFactory::newTevOrder(int param_0, int param_1) const {
|
||||
}
|
||||
|
||||
J2DGXColorS10 J2DMaterialFactory::newTevColor(int param_0, int param_1) const {
|
||||
// FAKEMATCH
|
||||
#if DEBUG || VERSION == VERSION_WII_USA_R0 || VERSION == VERSION_WII_USA_R2
|
||||
GXColorS10 color = {0, 0, 0, 0};
|
||||
J2DGXColorS10 rv = color;
|
||||
#else
|
||||
GXColorS10 color = {0, 0, 0, 0};
|
||||
J2DGXColorS10 rv;
|
||||
rv.r = color.r;
|
||||
rv.g = color.g;
|
||||
rv.b = color.b;
|
||||
rv.a = color.a;
|
||||
#endif
|
||||
J2DMaterialInitData* iVar2 = &field_0x4[field_0x8[param_0]];
|
||||
|
||||
if (iVar2->field_0x92[param_1] != 0xffff) {
|
||||
@@ -396,8 +386,3 @@ u8 J2DMaterialFactory::newDither(int param_0) const {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
J2DTevStage::J2DTevStage(J2DTevStageInfo const& param_0) {
|
||||
setTevStageInfo(param_0);
|
||||
setTevSwapModeInfo(j2dDefaultTevSwapMode);
|
||||
}
|
||||
|
||||
@@ -343,7 +343,8 @@ void J2DPane::place(JGeometry::TBox2<f32> const& box) {
|
||||
|
||||
f32 xOff = tmpBox.i.x - mBounds.i.x;
|
||||
f32 yOff = tmpBox.i.y - mBounds.i.y;
|
||||
for (J2DPane* child = getFirstChildPane(); child != NULL; child = child->getNextChildPane()) {
|
||||
J2DPane* child;
|
||||
for (child = getFirstChildPane(); child != NULL; child = child->getNextChildPane()) {
|
||||
child->mTranslateX += xOff;
|
||||
child->mTranslateY += yOff;
|
||||
if (xOff != 0 || yOff != 0) {
|
||||
@@ -432,10 +433,9 @@ void J2DPane::rotate(f32 angle) {
|
||||
}
|
||||
|
||||
void J2DPane::clip(JGeometry::TBox2<f32> const& bounds) {
|
||||
JGeometry::TBox2<f32> boxA(bounds);
|
||||
JGeometry::TBox2<f32> boxB(mGlobalBounds);
|
||||
boxA.addPos(boxB.i);
|
||||
mClipRect.intersect(boxA);
|
||||
JGeometry::TBox2<f32> box(bounds);
|
||||
box.addPos(JGeometry::TVec2<f32>(mGlobalBounds.i.x, mGlobalBounds.i.y));
|
||||
mClipRect.intersect(box);
|
||||
}
|
||||
|
||||
J2DPane* J2DPane::search(u64 tag) {
|
||||
|
||||
@@ -1006,6 +1006,7 @@ bool J2DPictureEx::getBlackWhite(JUtility::TColor* black, JUtility::TColor* whit
|
||||
*white = 0xffffffff;
|
||||
|
||||
if (bVar1) {
|
||||
// possible fakematch?
|
||||
#if DEBUG || VERSION == VERSION_WII_USA_R0 || VERSION == VERSION_WII_USA_R2
|
||||
J2DGXColorS10 tevColor0 = *mMaterial->getTevBlock()->getTevColor(0);
|
||||
J2DGXColorS10 tevColor1 = *mMaterial->getTevBlock()->getTevColor(1);
|
||||
|
||||
@@ -149,6 +149,6 @@ extern const u8 j2dDefaultPEBlockDither = 0;
|
||||
|
||||
extern const J2DColorChanInfo j2dDefaultColorChanInfo = {0, 3, 0, 0};
|
||||
|
||||
extern const u8 data_804561AC = 0x1B;
|
||||
extern const u8 j2dDefaultTevSwapTableID = 0x1B;
|
||||
|
||||
extern const u16 j2dDefaultAlphaCmp = 0x00E7;
|
||||
|
||||
@@ -38,11 +38,12 @@ J2DWindowEx::J2DWindowEx(J2DPane* param_0, JSURandomInputStream* param_1, u32 pa
|
||||
J2DWindowExDef auStack_70;
|
||||
param_1->read(&auStack_70, sizeof(J2DWindowExDef));
|
||||
|
||||
JUtility::TColor* colors[4] = {NULL};
|
||||
colors[0] = &field_0x128;
|
||||
colors[1] = &field_0x12C;
|
||||
colors[2] = &field_0x130;
|
||||
colors[3] = &field_0x134;
|
||||
JUtility::TColor* colors[4] = {
|
||||
&field_0x128,
|
||||
&field_0x12C,
|
||||
&field_0x130,
|
||||
&field_0x134
|
||||
};
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
field_0x158[i] = auStack_70.field_0x10[i];
|
||||
@@ -129,169 +130,84 @@ void J2DWindowEx::draw_private(JGeometry::TBox2<f32> const& param_0,
|
||||
JGeometry::TBox2<f32> const& param_1) {
|
||||
if (param_0.getWidth() >= field_0x140 && param_0.getHeight() >= field_0x142) {
|
||||
JUTTexture* textures[4];
|
||||
bool anyFrameMaterialNull = false;
|
||||
bool foundNullTexture = false;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (mFrameMaterial[i] == NULL) {
|
||||
return;
|
||||
}
|
||||
J2DTevBlock* block = mFrameMaterial[i]->getTevBlock();
|
||||
if (block == NULL) {
|
||||
|
||||
if (mFrameMaterial[i]->getTevBlock() == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
textures[i] = block->getTexture(0);
|
||||
textures[i] = mFrameMaterial[i]->getTevBlock()->getTexture(0);
|
||||
if (textures[i] == NULL) {
|
||||
anyFrameMaterialNull = true;
|
||||
foundNullTexture = true;
|
||||
}
|
||||
}
|
||||
|
||||
JGeometry::TBox2<f32> aTStack_b8(param_1);
|
||||
aTStack_b8.addPos(param_0.i);
|
||||
drawContents(aTStack_b8);
|
||||
JGeometry::TBox2<f32> aTStack_38(param_1);
|
||||
aTStack_38.addPos(param_0.i);
|
||||
drawContents(aTStack_38);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
|
||||
if (!anyFrameMaterialNull) {
|
||||
f32 dVar16 = param_0.i.x;
|
||||
f32 dVar15 = param_0.i.y;
|
||||
f32 dVar18 = param_0.f.x - textures[3]->getWidth();
|
||||
f32 dVar17 = param_0.f.y - textures[3]->getHeight();
|
||||
f32 dVar14 = dVar16 + textures[0]->getWidth();
|
||||
f32 dVar12 = dVar15 + textures[0]->getHeight();
|
||||
u16 local_c4;
|
||||
if (field_0x144 & 0x80) {
|
||||
local_c4 = 0;
|
||||
} else {
|
||||
local_c4 = 0x8000;
|
||||
}
|
||||
u16 local_c6;
|
||||
if (field_0x144 & 0x40) {
|
||||
local_c6 = 0;
|
||||
} else {
|
||||
local_c6 = 0x8000;
|
||||
}
|
||||
if (!foundNullTexture) {
|
||||
f32 minX = param_0.i.x;
|
||||
f32 minY = param_0.i.y;
|
||||
f32 f31 = param_0.f.x - textures[3]->getWidth();
|
||||
f32 f30 = param_0.f.y - textures[3]->getHeight();
|
||||
f32 maxX0 = minX + textures[0]->getWidth();
|
||||
f32 maxY0 = minY + textures[0]->getHeight();
|
||||
|
||||
u16 r29 = (field_0x144 & 0x80 ? (u16)0 : (u16)0x8000);
|
||||
u16 r28 = (field_0x144 & 0x40 ? (u16)0 : (u16)0x8000);
|
||||
drawFrameTexture(minX, minY, textures[0]->getWidth(), textures[0]->getHeight(), r29, r28,
|
||||
0x8000 - r29, 0x8000 - r28, mFrameMaterial[0], true);
|
||||
|
||||
drawFrameTexture(dVar16, dVar15, textures[0]->getWidth(), textures[0]->getHeight(),
|
||||
local_c4, local_c6, 0x8000 - local_c4, 0x8000 - local_c6,
|
||||
mFrameMaterial[0], true);
|
||||
bool r9 = mFrameMaterial[1] != mFrameMaterial[0];
|
||||
u16 local_c8;
|
||||
if (field_0x144 & 0x20) {
|
||||
local_c8 = 0;
|
||||
} else {
|
||||
local_c8 = 0x8000;
|
||||
}
|
||||
u16 local_ca;
|
||||
if (field_0x144 & 0x10) {
|
||||
local_ca = 0;
|
||||
} else {
|
||||
local_ca = 0x8000;
|
||||
}
|
||||
drawFrameTexture(dVar18, dVar15, textures[3]->getWidth(), textures[0]->getHeight(),
|
||||
local_c8, local_ca, 0x8000 - local_c8, 0x8000 - local_ca,
|
||||
mFrameMaterial[1], r9);
|
||||
r29 = field_0x144 & 0x20 ? (u16)0 : (u16)0x8000;
|
||||
r28 = field_0x144 & 0x10 ? (u16)0 : (u16)0x8000;
|
||||
drawFrameTexture(f31, minY, textures[3]->getWidth(), textures[0]->getHeight(), r29, r28,
|
||||
0x8000 - r29, 0x8000 - r28, mFrameMaterial[1], r9);
|
||||
|
||||
u16 local_cc;
|
||||
if (field_0x144 & 0x20) {
|
||||
local_cc = 0x8000;
|
||||
} else {
|
||||
local_cc = 0;
|
||||
}
|
||||
|
||||
u16 local_ce;
|
||||
if (field_0x144 & 0x10) {
|
||||
local_ce = 0;
|
||||
} else {
|
||||
local_ce = 0x8000;
|
||||
}
|
||||
drawFrameTexture(dVar14, dVar15, dVar18 - dVar14, textures[0]->getHeight(), local_cc,
|
||||
local_ce, local_cc, local_ce ^ 0x8000, mFrameMaterial[1], false);
|
||||
r29 = field_0x144 & 0x20 ? (u16)0x8000 : (u16)0;
|
||||
u16 sp_30 = r29;
|
||||
r28 = field_0x144 & 0x10 ? (u16)0 : (u16)0x8000;
|
||||
drawFrameTexture(maxX0, minY, f31 - maxX0, textures[0]->getHeight(), r29, r28, sp_30,
|
||||
r28 ^ 0x8000, mFrameMaterial[1], false);
|
||||
|
||||
r9 = mFrameMaterial[3] != mFrameMaterial[1];
|
||||
u16 local_d0;
|
||||
if (field_0x144 & 2) {
|
||||
local_d0 = 0;
|
||||
} else {
|
||||
local_d0 = 0x8000;
|
||||
}
|
||||
u16 local_d2;
|
||||
if (field_0x144 & 1) {
|
||||
local_d2 = 0;
|
||||
} else {
|
||||
local_d2 = 0x8000;
|
||||
}
|
||||
r29 = field_0x144 & 0x2 ? (u16)0 : (u16)0x8000;
|
||||
r28 = field_0x144 & 0x1 ? (u16)0 : (u16)0x8000;
|
||||
drawFrameTexture(f31, f30, textures[3]->getWidth(), textures[3]->getHeight(), r29, r28,
|
||||
0x8000 - r29, 0x8000 - r28, mFrameMaterial[3], r9);
|
||||
|
||||
drawFrameTexture(dVar18, dVar17, textures[3]->getWidth(), textures[3]->getHeight(),
|
||||
local_d0, local_d2, 0x8000 - local_d0, 0x8000 - local_d2,
|
||||
mFrameMaterial[3], r9);
|
||||
r29 = field_0x144 & 0x2 ? (u16)0x8000 : (u16)0;
|
||||
sp_30 = r29;
|
||||
r28 = field_0x144 & 0x1 ? (u16)0 : (u16)0x8000;
|
||||
drawFrameTexture(maxX0, f30, f31 - maxX0, textures[3]->getHeight(), r29, r28, sp_30,
|
||||
r28 ^ 0x8000, mFrameMaterial[3], false);
|
||||
|
||||
u16 local_d4;
|
||||
if (field_0x144 & 2) {
|
||||
local_d4 = 0x8000;
|
||||
} else {
|
||||
local_d4 = 0;
|
||||
}
|
||||
|
||||
u16 local_d6;
|
||||
if (field_0x144 & 1) {
|
||||
local_d6 = 0;
|
||||
} else {
|
||||
local_d6 = 0x8000;
|
||||
}
|
||||
drawFrameTexture(dVar14, dVar17, dVar18 - dVar14, textures[3]->getHeight(), local_d4,
|
||||
local_d6, local_d4, local_d6 ^ 0x8000, mFrameMaterial[3], false);
|
||||
|
||||
u16 local_d8;
|
||||
if (field_0x144 & 2) {
|
||||
local_d8 = 0;
|
||||
} else {
|
||||
local_d8 = 0x8000;
|
||||
}
|
||||
|
||||
u16 local_da;
|
||||
if (field_0x144 & 1) {
|
||||
local_da = 0x8000;
|
||||
} else {
|
||||
local_da = 0;
|
||||
}
|
||||
drawFrameTexture(dVar18, dVar12, textures[3]->getWidth(), dVar17 - dVar12, local_d8,
|
||||
local_da, local_d8 ^ 0x8000, local_da, mFrameMaterial[3], false);
|
||||
r29 = field_0x144 & 0x2 ? (u16)0 : (u16)0x8000;
|
||||
r28 = field_0x144 & 0x1 ? (u16)0x8000 : (u16)0;
|
||||
u16 sp_2E = r28;
|
||||
drawFrameTexture(f31, maxY0, textures[3]->getWidth(), f30 - maxY0, r29, r28, r29 ^ 0x8000,
|
||||
sp_2E, mFrameMaterial[3], false);
|
||||
|
||||
r9 = mFrameMaterial[2] != mFrameMaterial[3];
|
||||
u16 local_dc;
|
||||
if (field_0x144 & 8) {
|
||||
local_dc = 0;
|
||||
} else {
|
||||
local_dc = 0x8000;
|
||||
}
|
||||
r29 = field_0x144 & 0x8 ? (u16)0 : (u16)0x8000;
|
||||
r28 = field_0x144 & 0x4 ? (u16)0 : (u16)0x8000;
|
||||
drawFrameTexture(minX, f30, textures[0]->getWidth(), textures[3]->getHeight(), r29, r28,
|
||||
0x8000 - r29, 0x8000 - r28, mFrameMaterial[2], r9);
|
||||
|
||||
u16 local_de;
|
||||
if (field_0x144 & 4) {
|
||||
local_de = 0;
|
||||
} else {
|
||||
local_de = 0x8000;
|
||||
}
|
||||
drawFrameTexture(dVar16, dVar17, textures[0]->getWidth(), textures[3]->getHeight(),
|
||||
local_dc, local_de, 0x8000 - local_dc, 0x8000 - local_de,
|
||||
mFrameMaterial[2], r9);
|
||||
|
||||
u16 local_e0;
|
||||
if (field_0x144 & 8) {
|
||||
local_e0 = 0;
|
||||
} else {
|
||||
local_e0 = 0x8000;
|
||||
}
|
||||
|
||||
u16 local_e2;
|
||||
if (field_0x144 & 4) {
|
||||
local_e2 = 0x8000;
|
||||
} else {
|
||||
local_e2 = 0;
|
||||
}
|
||||
drawFrameTexture(dVar16, dVar12, textures[0]->getWidth(), dVar17 - dVar12, local_e0,
|
||||
local_e2, local_e0 ^ 0x8000, local_e2, mFrameMaterial[2], false);
|
||||
r29 = field_0x144 & 0x8 ? (u16)0 : (u16)0x8000;
|
||||
r28 = field_0x144 & 0x4 ? (u16)0x8000 : (u16)0;
|
||||
sp_2E = r28;
|
||||
drawFrameTexture(minX, maxY0, textures[0]->getWidth(), f30 - maxY0, r29, r28, r29 ^ 0x8000,
|
||||
sp_2E, mFrameMaterial[2], false);
|
||||
}
|
||||
|
||||
GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR);
|
||||
@@ -406,9 +322,9 @@ void J2DWindowEx::drawFrameTexture(f32 param_1, f32 param_2, f32 param_3, f32 pa
|
||||
aTStack_84 = JUtility::TColor((u32)uVar11 | 0xffffff00);
|
||||
}
|
||||
} else if (parentPane != NULL && mIsInfluencedAlpha != 0 && param_10) {
|
||||
s32 matColorAlpha = param_9->getColorBlock()->getMatColor(0)->a;
|
||||
s32 colorAlpha = parentPane->mColorAlpha;
|
||||
GXSetChanMatColor(GX_ALPHA0, JUtility::TColor((matColorAlpha * colorAlpha / 0xff) & 0xff));
|
||||
u8 matColorAlpha = param_9->getColorBlock()->getMatColor(0)->a;
|
||||
matColorAlpha = matColorAlpha * parentPane->mColorAlpha / 0xff;
|
||||
GXSetChanMatColor(GX_ALPHA0, JUtility::TColor(matColorAlpha));
|
||||
}
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
@@ -478,18 +394,17 @@ void J2DWindowEx::draw(JGeometry::TBox2<f32> const& param_1, JGeometry::TBox2<f3
|
||||
void J2DWindowEx::setTevOrder(bool param_0) {
|
||||
u16 local_28[2];
|
||||
if (!param_0) {
|
||||
local_28[0] = 4;
|
||||
local_28[1] = 0xffff;
|
||||
local_28[0] = (u16)4;
|
||||
local_28[1] = (u16)0xffff;
|
||||
} else {
|
||||
local_28[0] = 0xff;
|
||||
local_28[1] = 0xff04;
|
||||
local_28[0] = (u16)0xff;
|
||||
local_28[1] = (u16)0xff04;
|
||||
}
|
||||
for (u8 i = 0; i < 2; i++) {
|
||||
s32 uVar1 = local_28[i];
|
||||
J2DTevOrderInfo info;
|
||||
info.mTexCoord = uVar1 >> 8;
|
||||
info.mTexMap = uVar1 >> 8;
|
||||
info.mColor = uVar1;
|
||||
info.mTexCoord = local_28[i] >> 8;
|
||||
info.mTexMap = local_28[i] >> 8;
|
||||
info.mColor = local_28[i] & 0xff;
|
||||
J2DTevOrder local_30(info);
|
||||
for (int j = 0; j < 4; j++) {
|
||||
if (mFrameMaterial[j]->getTevBlock()->getMaxStage() > i) {
|
||||
@@ -502,7 +417,7 @@ void J2DWindowEx::setTevOrder(bool param_0) {
|
||||
void J2DWindowEx::setTevStage(bool param_1) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
J2DTevStage* pJVar3 = mFrameMaterial[i]->getTevBlock()->getTevStage(0);
|
||||
JUTTexture* this_00 = mFrameMaterial[i]->getTevBlock()->getTexture(0);
|
||||
const JUTTexture* this_00 = mFrameMaterial[i]->getTevBlock()->getTexture(0);
|
||||
bool bVar1 = false;
|
||||
if (this_00 != NULL && ((s32)this_00->getFormat() == 0 || (s32)this_00->getFormat() == 1) &&
|
||||
this_00->getTransparency() == 0)
|
||||
@@ -512,14 +427,9 @@ void J2DWindowEx::setTevStage(bool param_1) {
|
||||
if (!param_1) {
|
||||
setStage(pJVar3, bVar1 ? STAGE_ENUM_1 : STAGE_ENUM_0);
|
||||
} else {
|
||||
stage_enum sVar5;
|
||||
if (bVar1) {
|
||||
sVar5 = STAGE_ENUM_4;
|
||||
} else {
|
||||
sVar5 = STAGE_ENUM_3;
|
||||
}
|
||||
setStage(pJVar3, sVar5);
|
||||
setStage(mFrameMaterial[i]->getTevBlock()->getTevStage(1), STAGE_ENUM_2);
|
||||
setStage(pJVar3, bVar1 ? STAGE_ENUM_4 : STAGE_ENUM_3);
|
||||
pJVar3 = mFrameMaterial[i]->getTevBlock()->getTevStage(1);
|
||||
setStage(pJVar3, STAGE_ENUM_2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -583,24 +493,24 @@ void J2DWindowEx::setStage(J2DTevStage* param_0, J2DWindowEx::stage_enum param_1
|
||||
}
|
||||
|
||||
|
||||
bool J2DWindowEx::setBlack(JUtility::TColor black) {
|
||||
JUtility::TColor dummy,white;
|
||||
bool J2DWindowEx::setBlack(JUtility::TColor i_black) {
|
||||
JUtility::TColor black, white;
|
||||
|
||||
if (!getBlackWhite(&dummy, &white)) {
|
||||
if (!getBlackWhite(&black, &white)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return setBlackWhite(black, white);
|
||||
return setBlackWhite(i_black, white);
|
||||
}
|
||||
|
||||
bool J2DWindowEx::setWhite(JUtility::TColor white) {
|
||||
JUtility::TColor black,dummy;
|
||||
bool J2DWindowEx::setWhite(JUtility::TColor i_white) {
|
||||
JUtility::TColor black, white;
|
||||
|
||||
if (!getBlackWhite(&black, &dummy)) {
|
||||
if (!getBlackWhite(&black, &white)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return setBlackWhite(black, white);
|
||||
return setBlackWhite(black, i_white);
|
||||
}
|
||||
|
||||
// NONMATCHING - J2DGXColorS10 issue
|
||||
@@ -645,7 +555,7 @@ bool J2DWindowEx::setBlackWhite(JUtility::TColor black, JUtility::TColor white)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool J2DWindowEx::getBlackWhite(JUtility::TColor* param_0, JUtility::TColor* param_1) const {
|
||||
bool J2DWindowEx::getBlackWhite(JUtility::TColor* o_black, JUtility::TColor* o_white) const {
|
||||
if (mFrameMaterial[0] == NULL) {
|
||||
return false;
|
||||
}
|
||||
@@ -654,26 +564,16 @@ bool J2DWindowEx::getBlackWhite(JUtility::TColor* param_0, JUtility::TColor* par
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cVar6 = mFrameMaterial[0]->getTevBlock()->getTevStageNum() != 1;
|
||||
*param_0 = JUtility::TColor(0);
|
||||
*param_1 = JUtility::TColor(0xffffffff);
|
||||
u32 stageNum = mFrameMaterial[0]->getTevBlock()->getTevStageNum();
|
||||
bool cVar6 = stageNum == 1 ? false : true;
|
||||
*o_black = JUtility::TColor(0);
|
||||
*o_white = JUtility::TColor(0xffffffff);
|
||||
if (cVar6) {
|
||||
J2DGXColorS10* color0p = mFrameMaterial[0]->getTevBlock()->getTevColor(0);
|
||||
GXColorS10 color0;
|
||||
color0.r = color0p->r;
|
||||
color0.g = color0p->g;
|
||||
color0.b = color0p->b;
|
||||
color0.a = color0p->a;
|
||||
J2DGXColorS10* color1p = mFrameMaterial[0]->getTevBlock()->getTevColor(1);
|
||||
GXColorS10 color1;
|
||||
color1.r = color1p->r;
|
||||
color1.g = color1p->g;
|
||||
color1.b = color1p->b;
|
||||
color1.a = color1p->a;
|
||||
*param_0 = JUtility::TColor((((u8)color0.r) << 0x18) | (((u8)color0.g) << 0x10)
|
||||
| (((u8)color0.b) << 0x8) | (((u8)color0.a)));
|
||||
*param_1 = JUtility::TColor((((u8)color1.r) << 0x18) | (((u8)color1.g) << 0x10)
|
||||
| (((u8)color1.b) << 0x8) | (((u8)color1.a)));
|
||||
J2DGXColorS10 color0 = *mFrameMaterial[0]->getTevBlock()->getTevColor(0);
|
||||
J2DGXColorS10 color1 = *mFrameMaterial[0]->getTevBlock()->getTevColor(1);
|
||||
#define FAST_GX_COLOR_U32(r, g, b, a) (((u8)(r) << 0x18) | ((u8)(g) << 0x10) | ((u8)(b) << 0x8) | ((u8)(a)))
|
||||
*o_black = JUtility::TColor(FAST_GX_COLOR_U32(color0.r, color0.g, color0.b, color0.a));
|
||||
*o_white = JUtility::TColor(FAST_GX_COLOR_U32(color1.r, color1.g, color1.b, color1.a));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -683,7 +583,8 @@ bool J2DWindowEx::isSetBlackWhite(JUtility::TColor param_0, JUtility::TColor par
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (mFrameMaterial[i]->getTevBlock()->getMaxStage() == 1) {
|
||||
u8 stage = mFrameMaterial[i]->getTevBlock()->getMaxStage();
|
||||
if (stage == 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -853,8 +754,8 @@ void J2DWindowEx::setAnimation(J2DAnmVtxColor* param_0) {
|
||||
if (field_0x168[i] != 0xffff) {
|
||||
for (u16 j = 0; j < uVar3; j++) {
|
||||
J3DAnmVtxColorIndexData* puVar1 = param_0->getAnmVtxColorIndexData(0, j);
|
||||
u16* indexPointer = param_0->getVtxColorIndexPointer(0);
|
||||
u16* indexPointer2 = indexPointer + (uintptr_t)puVar1->mpData;
|
||||
u16* indexPointer2 =
|
||||
param_0->getVtxColorIndexPointer(0) + (uintptr_t)puVar1->mpData;
|
||||
for (u16 k = 0; k < puVar1->mNum; k++) {
|
||||
if (indexPointer2[k] == field_0x168[i]) {
|
||||
mAnmVtxColor = param_0;
|
||||
@@ -884,19 +785,21 @@ const J2DAnmTransform* J2DWindowEx::animationPane(J2DAnmTransform const* param_0
|
||||
}
|
||||
}
|
||||
|
||||
JUtility::TColor* local_38[4] = {NULL};
|
||||
local_38[0] = &field_0x128;
|
||||
local_38[1] = &field_0x12C;
|
||||
local_38[2] = &field_0x130;
|
||||
local_38[3] = &field_0x134;
|
||||
JUtility::TColor* local_38[4] = {
|
||||
&field_0x128,
|
||||
&field_0x12C,
|
||||
&field_0x130,
|
||||
&field_0x134,
|
||||
};
|
||||
|
||||
if (mAnmVtxColor != NULL) {
|
||||
u16 uVar3 = mAnmVtxColor->getAnmTableNum(0);
|
||||
for (u8 i = 0; i < 4; i++) {
|
||||
if ((field_0x17c & (1 << i))) {
|
||||
for (u16 j = 0; j < uVar3; j++) {
|
||||
J3DAnmVtxColorIndexData* puVar1 = mAnmVtxColor->getAnmVtxColorIndexData(0, j);
|
||||
u16* indexPointer = mAnmVtxColor->getVtxColorIndexPointer(0);
|
||||
u16* indexPointer2 = indexPointer + (uintptr_t)puVar1->mpData;
|
||||
u16* indexPointer2 =
|
||||
mAnmVtxColor->getVtxColorIndexPointer(0) + (uintptr_t)puVar1->mpData;
|
||||
for (u16 k = 0; k < puVar1->mNum; k++) {
|
||||
if (indexPointer2[k] == field_0x168[i]) {
|
||||
mAnmVtxColor->getColor(0, j, local_38[i]);
|
||||
|
||||
@@ -507,10 +507,10 @@ inline f32 J3DHermiteInterpolation(f32 p1, f32 const* p2, f32 const* p3, f32 con
|
||||
return JMAHermiteInterpolation(p1, *p2, *p3, *p4, *p5, *p6, *p7);
|
||||
}
|
||||
|
||||
inline f32 J3DHermiteInterpolation(register f32 pp1, register s16 const* pp2,
|
||||
register s16 const* pp3, register s16 const* pp4,
|
||||
register s16 const* pp5, register s16 const* pp6,
|
||||
register s16 const* pp7) {
|
||||
inline f32 J3DHermiteInterpolation(__REGISTER f32 pp1, __REGISTER s16 const* pp2,
|
||||
__REGISTER s16 const* pp3, __REGISTER s16 const* pp4,
|
||||
__REGISTER s16 const* pp5, __REGISTER s16 const* pp6,
|
||||
__REGISTER s16 const* pp7) {
|
||||
#ifdef __MWERKS__
|
||||
register f32 p1 = pp1;
|
||||
register f32 ff8;
|
||||
|
||||
@@ -237,10 +237,10 @@ s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 mtxNum) {
|
||||
static f32 J3DUnit01[] = { 0.0f, 1.0f };
|
||||
|
||||
void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
register MtxP weightAnmMtx;
|
||||
register Mtx* worldMtx;
|
||||
register Mtx* invMtx;
|
||||
register f32 weight;
|
||||
__REGISTER MtxP weightAnmMtx;
|
||||
__REGISTER Mtx* worldMtx;
|
||||
__REGISTER Mtx* invMtx;
|
||||
__REGISTER f32 weight;
|
||||
int idx;
|
||||
int j;
|
||||
int mixNum;
|
||||
@@ -251,27 +251,27 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
u8* pScale;
|
||||
|
||||
#if DEBUG || !__MWERKS__
|
||||
register Mtx mtx;
|
||||
__REGISTER Mtx mtx;
|
||||
#else
|
||||
register f32 var_f1;
|
||||
register f32 var_f2;
|
||||
register f32 var_f3;
|
||||
register f32 var_f4;
|
||||
register f32 var_f5;
|
||||
register f32 var_f6;
|
||||
register f32 var_f7;
|
||||
register f32 var_f8;
|
||||
register f32 var_f9;
|
||||
register f32 var_f10;
|
||||
register f32 var_f11;
|
||||
register f32 var_f12;
|
||||
register f32 var_f13;
|
||||
register f32 var_f31;
|
||||
register f32 var_f30;
|
||||
register f32 var_f29;
|
||||
register f32 var_f28;
|
||||
register f32 var_f27;
|
||||
register f32* var_r7 = J3DUnit01;
|
||||
__REGISTER f32 var_f1;
|
||||
__REGISTER f32 var_f2;
|
||||
__REGISTER f32 var_f3;
|
||||
__REGISTER f32 var_f4;
|
||||
__REGISTER f32 var_f5;
|
||||
__REGISTER f32 var_f6;
|
||||
__REGISTER f32 var_f7;
|
||||
__REGISTER f32 var_f8;
|
||||
__REGISTER f32 var_f9;
|
||||
__REGISTER f32 var_f10;
|
||||
__REGISTER f32 var_f11;
|
||||
__REGISTER f32 var_f12;
|
||||
__REGISTER f32 var_f13;
|
||||
__REGISTER f32 var_f31;
|
||||
__REGISTER f32 var_f30;
|
||||
__REGISTER f32 var_f29;
|
||||
__REGISTER f32 var_f28;
|
||||
__REGISTER f32 var_f27;
|
||||
__REGISTER f32* var_r7 = J3DUnit01;
|
||||
#endif
|
||||
|
||||
i = -1;
|
||||
@@ -316,8 +316,8 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() {
|
||||
MTXConcat(*worldMtx, *invMtx, mtx);
|
||||
#else
|
||||
// Fakematch? Doesn't match if worldMtx and invMtx are used directly.
|
||||
register void* var_r5 = worldMtx;
|
||||
register void* var_r6 = invMtx;
|
||||
__REGISTER void* var_r5 = worldMtx;
|
||||
__REGISTER void* var_r6 = invMtx;
|
||||
asm {
|
||||
psq_l var_f2, 0x0(var_r6), 0, 0 /* qr0 */
|
||||
psq_l var_f1, 0x0(var_r5), 0, 0 /* qr0 */
|
||||
|
||||
@@ -347,10 +347,6 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* pModelData) {
|
||||
return kJ3DError_Success;
|
||||
}
|
||||
|
||||
// NONMATCHING - instruction ordering/optimization issue, matches debug
|
||||
// the compiler needs to delay adding +3 to dl until the end of the while loop for the function to match
|
||||
// but instead it puts the +3 at the start of the for loop and reworks the other instructions
|
||||
// can get a 99.93% match on retail by moving where dl is incremented, but it seems fake as it breaks debug, and introduces an operand swap on src
|
||||
void J3DSkinDeform::changeFastSkinDL(J3DModelData* pModelData) {
|
||||
J3D_ASSERT_NULLPTR(740, pModelData != NULL);
|
||||
for (u16 i = 0; i < pModelData->getShapeNum(); i++) {
|
||||
@@ -389,7 +385,7 @@ void J3DSkinDeform::changeFastSkinDL(J3DModelData* pModelData) {
|
||||
memcpy(dst, src + 1, (int)(vtxSize - 1)); // The -1 is to remove GX_VA_PNMTXIDX
|
||||
dst += (int)(vtxSize - 1);
|
||||
}
|
||||
dl += vtxSize * vtxCount;
|
||||
dl = (u8*)dl + vtxSize * vtxCount;
|
||||
}
|
||||
|
||||
int dlistSize = ((int)dst - (int)displayListStart + 0x1f) & ~0x1f;
|
||||
|
||||
@@ -2019,13 +2019,3 @@ void J3DTexGenBlockPatched::calcPostTexMtxWithoutViewMtx(f32 const (*param_0)[4]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void J3DTevBlock::diffTevReg() {}
|
||||
|
||||
void J3DTevBlock::diffTevStageIndirect() {}
|
||||
|
||||
void J3DTevBlock::diffTevStage() {}
|
||||
|
||||
void J3DTevBlock::diffTexCoordScale() {}
|
||||
|
||||
void J3DTevBlock::diffTexNo() {}
|
||||
|
||||
@@ -8,55 +8,57 @@
|
||||
|
||||
u32 J3DShapeDraw::countVertex(u32 stride) {
|
||||
u32 count = 0;
|
||||
uintptr_t dlStart = (uintptr_t)getDisplayList();
|
||||
u8* dlStart = (u8*)getDisplayList();
|
||||
|
||||
for (u8* dl = (u8*)dlStart; ((uintptr_t)dl - dlStart) < getDisplayListSize();) {
|
||||
if (*dl != GX_TRIANGLEFAN && *dl != GX_TRIANGLESTRIP)
|
||||
for (u8* dl = dlStart; (dl - dlStart) < getDisplayListSize();) {
|
||||
u8 cmd = *(u8*)dl;
|
||||
dl++;
|
||||
if (cmd != GX_TRIANGLEFAN && cmd != GX_TRIANGLESTRIP)
|
||||
break;
|
||||
u16 vtxNum = *((u16*)(dl + 1));
|
||||
int vtxNum = *((u16*)(dl));
|
||||
dl += 2;
|
||||
count += vtxNum;
|
||||
dl += stride * vtxNum;
|
||||
dl += 3;
|
||||
dl = (u8*)dl + stride * vtxNum;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
// NONMATCHING regalloc
|
||||
void J3DShapeDraw::addTexMtxIndexInDL(u32 stride, u32 attrOffs, u32 valueBase) {
|
||||
u32 byteNum = countVertex(stride);
|
||||
u32 newSize = ALIGN_NEXT(mDisplayListSize + byteNum, 0x20);
|
||||
u32 oldSize = mDisplayListSize;
|
||||
u32 newSize = ALIGN_NEXT(oldSize + byteNum, 0x20);
|
||||
u8* newDLStart = new (0x20) u8[newSize];
|
||||
u8* oldDLStart = getDisplayList();
|
||||
u8* oldDLStart = (u8*)mDisplayList;
|
||||
u8* oldDL = oldDLStart;
|
||||
u8* newDL = newDLStart;
|
||||
|
||||
for (; (oldDL - oldDLStart) < mDisplayListSize;) {
|
||||
// Copy command
|
||||
u8 h = *oldDL;
|
||||
*newDL++ = h;
|
||||
u8 cmd = *(u8*)oldDL;
|
||||
oldDL++;
|
||||
*newDL++ = cmd;
|
||||
|
||||
if (h != GX_TRIANGLEFAN && h != GX_TRIANGLESTRIP)
|
||||
if (cmd != GX_TRIANGLEFAN && cmd != GX_TRIANGLESTRIP)
|
||||
break;
|
||||
|
||||
// Copy count
|
||||
// regalloc (I suspect there's a way to shove this in a u16 temp without an mr)
|
||||
s32 vtxNum = *((u16*)(oldDL + 1));
|
||||
*((u16*)newDL) = vtxNum;
|
||||
int vtxNum = *(u16*)oldDL;
|
||||
oldDL += 2;
|
||||
*(u16*)newDL = vtxNum;
|
||||
newDL += 2;
|
||||
|
||||
for (s32 i = 0; i < vtxNum; i++) {
|
||||
u8* oldDLVtx = &oldDL[stride * i + 3];
|
||||
for (int i = 0; i < vtxNum; i++) {
|
||||
u8* oldDLVtx = &oldDL[stride * i];
|
||||
u8 pnmtxidx = *oldDLVtx;
|
||||
memcpy(newDL, oldDLVtx, attrOffs);
|
||||
memcpy(newDL, oldDLVtx, (int)attrOffs);
|
||||
newDL += attrOffs;
|
||||
*newDL++ = valueBase + pnmtxidx;
|
||||
memcpy(newDL, oldDLVtx + attrOffs, stride - attrOffs);
|
||||
newDL += (stride - attrOffs);
|
||||
}
|
||||
|
||||
oldDL += stride * vtxNum;
|
||||
oldDL += 3;
|
||||
oldDL = (u8*)oldDL + stride * vtxNum;
|
||||
}
|
||||
|
||||
u32 realSize = ALIGN_NEXT((uintptr_t)newDL - (uintptr_t)newDLStart, 0x20);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "JSystem/JMath/JMATrigonometric.h"
|
||||
#include "JSystem/JMath/JMath.h"
|
||||
|
||||
void __MTGQR7(register u32 v) {
|
||||
void __MTGQR7(__REGISTER u32 v) {
|
||||
#ifdef __MWERKS__
|
||||
// clang-format off
|
||||
asm {
|
||||
@@ -23,8 +23,8 @@ void J3DGQRSetup7(u32 r0, u32 r1, u32 r2, u32 r3) {
|
||||
|
||||
// this uses a non-standard sqrtf, not sure why or how its supposed to be setup
|
||||
#if !PLATFORM_SHIELD
|
||||
inline f32 J3D_sqrtf(register f32 x) {
|
||||
register f32 recip;
|
||||
inline f32 J3D_sqrtf(__REGISTER f32 x) {
|
||||
__REGISTER f32 recip;
|
||||
|
||||
if (x > 0.0f) {
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
@@ -38,7 +38,7 @@ inline f32 J3D_sqrtf(register f32 x) {
|
||||
#define J3D_sqrtf sqrtf
|
||||
#endif
|
||||
|
||||
void J3DCalcBBoardMtx(register Mtx mtx) {
|
||||
void J3DCalcBBoardMtx(__REGISTER Mtx mtx) {
|
||||
f32 x = (mtx[0][0] * mtx[0][0]) + (mtx[1][0] * mtx[1][0]) + (mtx[2][0] * mtx[2][0]);
|
||||
f32 y = (mtx[0][1] * mtx[0][1]) + (mtx[1][1] * mtx[1][1]) + (mtx[2][1] * mtx[2][1]);
|
||||
f32 z = (mtx[0][2] * mtx[0][2]) + (mtx[1][2] * mtx[1][2]) + (mtx[2][2] * mtx[2][2]);
|
||||
@@ -53,7 +53,7 @@ void J3DCalcBBoardMtx(register Mtx mtx) {
|
||||
z = J3D_sqrtf(z);
|
||||
}
|
||||
|
||||
register f32 zero = 0.0f;
|
||||
__REGISTER f32 zero = 0.0f;
|
||||
// zero out gaps of zeroes
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
asm {
|
||||
@@ -101,7 +101,7 @@ void J3DCalcYBBoardMtx(Mtx mtx) {
|
||||
mtx[2][2] = vec.z * z;
|
||||
}
|
||||
|
||||
asm void J3DPSCalcInverseTranspose(register Mtx src, register Mtx33 dst) {
|
||||
asm void J3DPSCalcInverseTranspose(__REGISTER Mtx src, __REGISTER Mtx33 dst) {
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
psq_l f0, 0(src), 1, 0
|
||||
psq_l f1, 4(src), 0, 0
|
||||
@@ -290,7 +290,7 @@ void J3DGetTextureMtxMayaOld(const J3DTextureSRTInfo& srt, Mtx dst) {
|
||||
dst[2][2] = 1.0f;
|
||||
}
|
||||
|
||||
asm void J3DScaleNrmMtx(register Mtx mtx, const register Vec& scl) {
|
||||
asm void J3DScaleNrmMtx(__REGISTER Mtx mtx, const __REGISTER Vec& scl) {
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
nofralloc;
|
||||
|
||||
@@ -326,7 +326,7 @@ asm void J3DScaleNrmMtx(register Mtx mtx, const register Vec& scl) {
|
||||
#endif // clang-format on
|
||||
}
|
||||
|
||||
asm void J3DScaleNrmMtx33(register Mtx33 mtx, const register Vec& scale) {
|
||||
asm void J3DScaleNrmMtx33(__REGISTER Mtx33 mtx, const __REGISTER Vec& scale) {
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
psq_l f0, 0(mtx), 0, 0
|
||||
psq_l f6, 0(scale), 0, 0
|
||||
@@ -352,7 +352,7 @@ asm void J3DScaleNrmMtx33(register Mtx33 mtx, const register Vec& scale) {
|
||||
#endif // clang-format on
|
||||
}
|
||||
|
||||
asm void J3DMtxProjConcat(register Mtx mtx1, register Mtx mtx2, register Mtx dst) {
|
||||
asm void J3DMtxProjConcat(__REGISTER Mtx mtx1, __REGISTER Mtx mtx2, __REGISTER Mtx dst) {
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
psq_l f2, 0(mtx1), 0, 0
|
||||
psq_l f3, 8(mtx1), 0, 0
|
||||
@@ -541,7 +541,7 @@ loop:
|
||||
}
|
||||
#endif // clang-format on
|
||||
|
||||
extern f32 PSMulUnit01[] = {
|
||||
extern f32 const PSMulUnit01[] = {
|
||||
0.0f,
|
||||
-1.0f,
|
||||
};
|
||||
|
||||
@@ -61,40 +61,41 @@ u16 J3DMaterialFactory::countUniqueMaterials() {
|
||||
s32 id = -1;
|
||||
for (u16 i = 0; i < mMaterialNum; i++) {
|
||||
if (id < mpMaterialID[i]) {
|
||||
count++;
|
||||
id = mpMaterialID[i];
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
u32 J3DMaterialFactory::countTexGens(int i_idx) const {
|
||||
u8 tex_gen_num_index = mpMaterialInitData[mpMaterialID[i_idx]].mTexGenNumIdx;
|
||||
if (tex_gen_num_index != 0xff) {
|
||||
return mpTexGenNum[tex_gen_num_index];
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTexGenNumIdx != 0xff) {
|
||||
return mpTexGenNum[mtl_init_data->mTexGenNumIdx];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 J3DMaterialFactory::countStages(int i_idx) const {
|
||||
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
u32 count1 = 0;
|
||||
u32 count2 = 0;
|
||||
u8 tev_stage_num_index = init_data->mTevStageNumIdx;
|
||||
if (tev_stage_num_index != 0xff) {
|
||||
count2 = mpTevStageNum[tev_stage_num_index];
|
||||
if (mtl_init_data->mTevStageNumIdx != 0xff) {
|
||||
count2 = mpTevStageNum[mtl_init_data->mTevStageNumIdx];
|
||||
}
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (init_data->mTexNoIdx[i] != 0xffff) {
|
||||
if (mtl_init_data->mTexNoIdx[i] != 0xffff) {
|
||||
count1++;
|
||||
}
|
||||
}
|
||||
if (count2 != count1 && count1 != 0) {
|
||||
u32 count3;
|
||||
if (count2 > count1) {
|
||||
return count2;
|
||||
count3 = count2;
|
||||
} else {
|
||||
return count1;
|
||||
count3 = count1;
|
||||
}
|
||||
return count3;
|
||||
}
|
||||
return count2;
|
||||
}
|
||||
@@ -343,24 +344,31 @@ J3DMaterial* J3DMaterialFactory::createLockedMaterial(J3DMaterial* i_material, i
|
||||
u32 i_flags) const {
|
||||
if (i_material == NULL) {
|
||||
i_material = new J3DLockedMaterial();
|
||||
J3D_ASSERT_ALLOCMEM(629, i_material);
|
||||
i_material->mColorBlock = new J3DColorBlockNull();
|
||||
J3D_ASSERT_ALLOCMEM(634, i_material->mColorBlock);
|
||||
i_material->mTexGenBlock = new J3DTexGenBlockNull();
|
||||
J3D_ASSERT_ALLOCMEM(636, i_material->mTexGenBlock);
|
||||
i_material->mTevBlock = new J3DTevBlockNull();
|
||||
J3D_ASSERT_ALLOCMEM(638, i_material->mTevBlock);
|
||||
i_material->mIndBlock = new J3DIndBlockNull();
|
||||
J3D_ASSERT_ALLOCMEM(640, i_material->mIndBlock);
|
||||
i_material->mPEBlock = new J3DPEBlockNull();
|
||||
J3D_ASSERT_ALLOCMEM(642, i_material->mPEBlock);
|
||||
i_material->mIndex = i_idx;
|
||||
i_material->mMaterialMode = mpMaterialMode[i_idx];
|
||||
}
|
||||
|
||||
i_material->mCurrentMtx = mpCurrentMtxInfo[i_idx];
|
||||
i_material->mColorBlock->setMatColorOffset(mpPatchingInfo[i_idx].mMatColorOffset);
|
||||
i_material->mColorBlock->setColorChanOffset(mpPatchingInfo[i_idx].mColorChanOffset);
|
||||
i_material->mTexGenBlock->setTexMtxOffset(mpPatchingInfo[i_idx].mTexMtxOffset);
|
||||
i_material->mTevBlock->setTexNoOffset(mpPatchingInfo[i_idx].mTexNoOffset);
|
||||
i_material->mTevBlock->setTevRegOffset(mpPatchingInfo[i_idx].mTevRegOffset);
|
||||
i_material->mPEBlock->setFogOffset(mpPatchingInfo[i_idx].mFogOffset);
|
||||
i_material->getColorBlock()->setMatColorOffset(mpPatchingInfo[i_idx].mMatColorOffset);
|
||||
i_material->getColorBlock()->setColorChanOffset(mpPatchingInfo[i_idx].mColorChanOffset);
|
||||
i_material->getTexGenBlock()->setTexMtxOffset(mpPatchingInfo[i_idx].mTexMtxOffset);
|
||||
i_material->getTevBlock()->setTexNoOffset(mpPatchingInfo[i_idx].mTexNoOffset);
|
||||
i_material->getTevBlock()->setTevRegOffset(mpPatchingInfo[i_idx].mTevRegOffset);
|
||||
i_material->getPEBlock()->setFogOffset(mpPatchingInfo[i_idx].mFogOffset);
|
||||
if (i_material->mSharedDLObj == NULL) {
|
||||
i_material->mSharedDLObj = new J3DDisplayListObj();
|
||||
J3D_ASSERT_ALLOCMEM(673, i_material->mSharedDLObj);
|
||||
i_material->mSharedDLObj->setSingleDisplayList((void*)(
|
||||
mpDisplayListInit[i_idx].mOffset + (uintptr_t)&mpDisplayListInit[i_idx]),
|
||||
mpDisplayListInit[i_idx].field_0x4
|
||||
@@ -374,13 +382,13 @@ u32 J3DMaterialFactory::calcSize(J3DMaterial* i_material, J3DMaterialFactory::Ma
|
||||
u32 size = 0;
|
||||
switch (i_type) {
|
||||
case MATERIAL_TYPE_NORMAL:
|
||||
size = calcSizeNormalMaterial(i_material, i_idx, i_flags);
|
||||
size += calcSizeNormalMaterial(i_material, i_idx, i_flags);
|
||||
break;
|
||||
case MATERIAL_TYPE_LOCKED:
|
||||
size = calcSizeLockedMaterial(i_material, i_idx, i_flags);
|
||||
size += calcSizeLockedMaterial(i_material, i_idx, i_flags);
|
||||
break;
|
||||
case MATERIAL_TYPE_PATCHED:
|
||||
size = calcSizePatchedMaterial(i_material, i_idx, i_flags);
|
||||
size += calcSizePatchedMaterial(i_material, i_idx, i_flags);
|
||||
break;
|
||||
}
|
||||
return size;
|
||||
@@ -423,15 +431,16 @@ u32 J3DMaterialFactory::calcSizePatchedMaterial(J3DMaterial* i_material, int i_i
|
||||
u32 i_flags) const {
|
||||
u32 size = 0;
|
||||
if (i_material == NULL) {
|
||||
size = sizeof(J3DPatchedMaterial);
|
||||
size += sizeof(J3DPatchedMaterial);
|
||||
}
|
||||
u8 ind_flag = (i_flags & 0x3000000) != 0 ? 1 : 0;
|
||||
u8 ind_flag = (i_flags & 0x3000000) != 0 ? (u8)1 : (u8)0;
|
||||
size += J3DMaterial::calcSizeColorBlock(0x40000000);
|
||||
size += 0x134; // TODO what is this
|
||||
size += sizeof(J3DTexGenBlockPatched);
|
||||
size += sizeof(J3DTevBlockPatched);
|
||||
size += J3DMaterial::calcSizeIndBlock(ind_flag);
|
||||
size += J3DMaterial::calcSizePEBlock(0x10000000, getMaterialMode(i_idx));
|
||||
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (u32 i = 0; i < 8; i++) {
|
||||
if (init_data->mTexMtxIdx[i] != 0xffff) {
|
||||
size += sizeof(J3DTexMtx);
|
||||
}
|
||||
@@ -443,28 +452,31 @@ u32 J3DMaterialFactory::calcSizeLockedMaterial(J3DMaterial* i_material, int i_id
|
||||
u32 i_flags) const {
|
||||
u32 size = 0;
|
||||
if (i_material == NULL) {
|
||||
size = sizeof(J3DLockedMaterial) + sizeof(J3DColorBlockNull) + sizeof(J3DTexGenBlockNull)
|
||||
+ sizeof(J3DTevBlockNull) + sizeof(J3DIndBlockNull) + sizeof(J3DPEBlockNull);
|
||||
size += sizeof(J3DLockedMaterial);
|
||||
size += sizeof(J3DColorBlockNull);
|
||||
size += sizeof(J3DTexGenBlockNull);
|
||||
size += sizeof(J3DTevBlockNull);
|
||||
size += sizeof(J3DIndBlockNull);
|
||||
size += sizeof(J3DPEBlockNull);
|
||||
}
|
||||
return size + sizeof(J3DDisplayListObj);
|
||||
size += sizeof(J3DDisplayListObj);
|
||||
return size;
|
||||
}
|
||||
|
||||
static GXColor const defaultMatColor = {0xff, 0xff, 0xff, 0xff};
|
||||
|
||||
J3DGXColor J3DMaterialFactory::newMatColor(int i_idx, int i_no) const {
|
||||
J3DGXColor dflt = (J3DGXColor)defaultMatColor;
|
||||
u16 mat_color_index = mpMaterialInitData[mpMaterialID[i_idx]].mMatColorIdx[i_no];
|
||||
if (mat_color_index != 0xffff) {
|
||||
return mpMatColor[mat_color_index];
|
||||
J3DGXColor dflt = (GXColor){0xff, 0xff, 0xff, 0xff};
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mMatColorIdx[i_no] != 0xffff) {
|
||||
return mpMatColor[mtl_init_data->mMatColorIdx[i_no]];
|
||||
} else {
|
||||
return dflt;
|
||||
}
|
||||
}
|
||||
|
||||
u8 J3DMaterialFactory::newColorChanNum(int i_idx) const {
|
||||
u8 color_chan_num_index = mpMaterialInitData[mpMaterialID[i_idx]].mColorChanNumIdx;
|
||||
if (color_chan_num_index != 0xff) {
|
||||
return mpColorChanNum[color_chan_num_index];
|
||||
const u8 J3DMaterialFactory::newColorChanNum(int i_idx) const {
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mColorChanNumIdx != 0xff) {
|
||||
return mpColorChanNum[mtl_init_data->mColorChanNumIdx];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@@ -480,31 +492,30 @@ J3DColorChan J3DMaterialFactory::newColorChan(int i_idx, int i_no) const {
|
||||
}
|
||||
}
|
||||
|
||||
static GXColor const defaultAmbColor = {0x32, 0x32, 0x32, 0x32};
|
||||
|
||||
J3DGXColor J3DMaterialFactory::newAmbColor(int i_idx, int i_no) const {
|
||||
J3DGXColor dflt = (J3DGXColor)defaultAmbColor;
|
||||
u16 amb_color_index = mpMaterialInitData[mpMaterialID[i_idx]].mAmbColorIdx[i_no];
|
||||
if (amb_color_index != 0xffff) {
|
||||
return mpAmbColor[amb_color_index];
|
||||
J3DGXColor dflt = (GXColor){0x32, 0x32, 0x32, 0x32};
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mAmbColorIdx[i_no] != 0xffff) {
|
||||
return mpAmbColor[mtl_init_data->mAmbColorIdx[i_no]];
|
||||
} else {
|
||||
return dflt;
|
||||
}
|
||||
}
|
||||
|
||||
u32 J3DMaterialFactory::newTexGenNum(int i_idx) const {
|
||||
u8 tex_gen_num_index = mpMaterialInitData[mpMaterialID[i_idx]].mTexGenNumIdx;
|
||||
if (tex_gen_num_index != 0xff) {
|
||||
return mpTexGenNum[tex_gen_num_index];
|
||||
u32 r30 = 0;
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTexGenNumIdx != 0xff) {
|
||||
return mpTexGenNum[mtl_init_data->mTexGenNumIdx];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
J3DTexCoord J3DMaterialFactory::newTexCoord(int i_idx, int i_no) const {
|
||||
u16 tex_coord_index = mpMaterialInitData[mpMaterialID[i_idx]].mTexCoordIdx[i_no];
|
||||
if (tex_coord_index != 0xffff) {
|
||||
return J3DTexCoord(mpTexCoordInfo[tex_coord_index]);
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTexCoordIdx[i_no] != 0xffff) {
|
||||
return J3DTexCoord(mpTexCoordInfo[mtl_init_data->mTexCoordIdx[i_no]]);
|
||||
} else {
|
||||
return J3DTexCoord();
|
||||
}
|
||||
@@ -520,18 +531,19 @@ J3DTexMtx* J3DMaterialFactory::newTexMtx(int i_idx, int i_no) const {
|
||||
}
|
||||
|
||||
u8 J3DMaterialFactory::newCullMode(int i_idx) const {
|
||||
u8 cull_mode_index = mpMaterialInitData[mpMaterialID[i_idx]].mCullModeIdx;
|
||||
if (cull_mode_index != 0xff) {
|
||||
return mpCullMode[cull_mode_index];
|
||||
u32 r30 = 0;
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mCullModeIdx != 0xff) {
|
||||
return mpCullMode[mtl_init_data->mCullModeIdx];
|
||||
} else {
|
||||
return 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
u16 J3DMaterialFactory::newTexNo(int i_idx, int i_no) const {
|
||||
u16 tex_no_index = mpMaterialInitData[mpMaterialID[i_idx]].mTexNoIdx[i_no];
|
||||
if (tex_no_index != 0xffff) {
|
||||
return mpTexNo[tex_no_index];
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTexNoIdx[i_no] != 0xffff) {
|
||||
return mpTexNo[mtl_init_data->mTexNoIdx[i_no]];
|
||||
} else {
|
||||
return 0xffff;
|
||||
}
|
||||
@@ -547,7 +559,8 @@ J3DTevOrder J3DMaterialFactory::newTevOrder(int i_idx, int i_no) const {
|
||||
}
|
||||
|
||||
J3DGXColorS10 J3DMaterialFactory::newTevColor(int i_idx, int i_no) const {
|
||||
J3DGXColorS10 dflt = (GXColorS10){0, 0, 0, 0};
|
||||
GXColorS10 _dflt = {0, 0, 0, 0};
|
||||
J3DGXColorS10 dflt = _dflt;
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTevColorIdx[i_no] != 0xffff) {
|
||||
return mpTevColor[mtl_init_data->mTevColorIdx[i_no]];
|
||||
@@ -556,50 +569,49 @@ J3DGXColorS10 J3DMaterialFactory::newTevColor(int i_idx, int i_no) const {
|
||||
}
|
||||
}
|
||||
|
||||
static GXColor const defaultTevKColor = {0xff, 0xff, 0xff, 0xff};
|
||||
|
||||
J3DGXColor J3DMaterialFactory::newTevKColor(int i_idx, int i_no) const {
|
||||
J3DGXColor dflt = (J3DGXColor)defaultTevKColor;
|
||||
u16 tev_kcolor_index = mpMaterialInitData[mpMaterialID[i_idx]].mTevKColorIdx[i_no];
|
||||
if (tev_kcolor_index != 0xffff) {
|
||||
return mpTevKColor[tev_kcolor_index];
|
||||
J3DGXColor dflt = (GXColor){0xff, 0xff, 0xff, 0xff};
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTevKColorIdx[i_no] != 0xffff) {
|
||||
return mpTevKColor[mtl_init_data->mTevKColorIdx[i_no]];
|
||||
} else {
|
||||
return dflt;
|
||||
}
|
||||
}
|
||||
|
||||
u8 J3DMaterialFactory::newTevStageNum(int i_idx) const {
|
||||
u8 tev_stage_num_index = mpMaterialInitData[mpMaterialID[i_idx]].mTevStageNumIdx;
|
||||
if (tev_stage_num_index != 0xff) {
|
||||
return mpTevStageNum[tev_stage_num_index];
|
||||
const u8 J3DMaterialFactory::newTevStageNum(int i_idx) const {
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTevStageNumIdx != 0xff) {
|
||||
return mpTevStageNum[mtl_init_data->mTevStageNumIdx];
|
||||
} else {
|
||||
return 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
J3DTevStage J3DMaterialFactory::newTevStage(int i_idx, int i_no) const {
|
||||
u16 tev_stage_index = mpMaterialInitData[mpMaterialID[i_idx]].mTevStageIdx[i_no];
|
||||
if (tev_stage_index != 0xffff) {
|
||||
return J3DTevStage(mpTevStageInfo[tev_stage_index]);
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTevStageIdx[i_no] != 0xffff) {
|
||||
return J3DTevStage(mpTevStageInfo[mtl_init_data->mTevStageIdx[i_no]]);
|
||||
} else {
|
||||
return J3DTevStage();
|
||||
}
|
||||
}
|
||||
|
||||
J3DTevSwapModeTable J3DMaterialFactory::newTevSwapModeTable(int i_idx, int i_no) const {
|
||||
u16 tev_swap_mode_table_index = mpMaterialInitData[mpMaterialID[i_idx]].mTevSwapModeTableIdx[i_no];
|
||||
if (tev_swap_mode_table_index != 0xffff) {
|
||||
return J3DTevSwapModeTable(mpTevSwapModeTableInfo[tev_swap_mode_table_index]);
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTevSwapModeTableIdx[i_no] != 0xffff) {
|
||||
return J3DTevSwapModeTable(mpTevSwapModeTableInfo[mtl_init_data->mTevSwapModeTableIdx[i_no]]);
|
||||
} else {
|
||||
return J3DTevSwapModeTable(j3dDefaultTevSwapModeTable);
|
||||
}
|
||||
}
|
||||
|
||||
u8 J3DMaterialFactory::newIndTexStageNum(int i_idx) const {
|
||||
u8 dflt = 0;
|
||||
if (mpIndInitData[i_idx].mEnabled == true) {
|
||||
return mpIndInitData[i_idx].mIndTexStageNum;
|
||||
} else {
|
||||
return 0;
|
||||
return dflt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -641,9 +653,9 @@ J3DIndTexCoordScale J3DMaterialFactory::newIndTexCoordScale(int i_idx, int i_no)
|
||||
|
||||
J3DFog J3DMaterialFactory::newFog(int i_idx) const {
|
||||
J3DFog fog;
|
||||
u16 fog_index = mpMaterialInitData[mpMaterialID[i_idx]].mFogIdx;
|
||||
if (fog_index != 0xffff) {
|
||||
fog.setFogInfo(mpFogInfo[fog_index]);
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mFogIdx != 0xffff) {
|
||||
fog.setFogInfo(mpFogInfo[mtl_init_data->mFogIdx]);
|
||||
}
|
||||
return fog;
|
||||
}
|
||||
@@ -667,6 +679,7 @@ J3DBlend J3DMaterialFactory::newBlend(int i_idx) const {
|
||||
}
|
||||
|
||||
J3DZMode J3DMaterialFactory::newZMode(int i_idx) const {
|
||||
u32 r29 = 0;
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mZModeIdx != 0xff) {
|
||||
return J3DZMode(mpZModeInfo[mtl_init_data->mZModeIdx]);
|
||||
@@ -675,7 +688,7 @@ J3DZMode J3DMaterialFactory::newZMode(int i_idx) const {
|
||||
}
|
||||
}
|
||||
|
||||
u8 J3DMaterialFactory::newZCompLoc(int i_idx) const {
|
||||
const u8 J3DMaterialFactory::newZCompLoc(int i_idx) const {
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mZCompLocIdx != 0xff){
|
||||
return mpZCompLoc[mtl_init_data->mZCompLocIdx];
|
||||
@@ -684,7 +697,7 @@ u8 J3DMaterialFactory::newZCompLoc(int i_idx) const {
|
||||
}
|
||||
}
|
||||
|
||||
u8 J3DMaterialFactory::newDither(int i_idx) const {
|
||||
const u8 J3DMaterialFactory::newDither(int i_idx) const {
|
||||
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mDitherIdx != 0xff){
|
||||
return mpDither[mtl_init_data->mDitherIdx];
|
||||
|
||||
@@ -39,14 +39,17 @@ J3DMaterialFactory_v21::J3DMaterialFactory_v21(J3DMaterialBlock_v21 const& i_blo
|
||||
u16 J3DMaterialFactory_v21::countUniqueMaterials() {
|
||||
u16 i;
|
||||
for (i = 0; i < mMaterialNum; i++) {
|
||||
if (mpMaterialID[i] - i == 0) {
|
||||
// No code, maybe commented out.
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
u32 J3DMaterialFactory_v21::countTexGens(int i_idx) const {
|
||||
u8 tex_gen_num_index = mpMaterialInitData[mpMaterialID[i_idx]].mTexGenNumIdx;
|
||||
if (tex_gen_num_index != 0xff) {
|
||||
return mpTexGenNum[tex_gen_num_index];
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTexGenNumIdx != 0xff) {
|
||||
return mpTexGenNum[mtl_init_data->mTexGenNumIdx];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -55,9 +58,8 @@ u32 J3DMaterialFactory_v21::countStages(int i_idx) const {
|
||||
J3DMaterialInitData_v21* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
u32 count1 = 0;
|
||||
u32 count2 = 0;
|
||||
u8 tev_stage_num_index = init_data->mTevStageNumIdx;
|
||||
if (tev_stage_num_index != 0xff) {
|
||||
count2 = mpTevStageNum[tev_stage_num_index];
|
||||
if (init_data->mTevStageNumIdx != 0xff) {
|
||||
count2 = mpTevStageNum[init_data->mTevStageNumIdx];
|
||||
}
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (init_data->mTexNoIdx[i] != 0xffff) {
|
||||
@@ -65,11 +67,13 @@ u32 J3DMaterialFactory_v21::countStages(int i_idx) const {
|
||||
}
|
||||
}
|
||||
if (count2 != count1 && count1 != 0) {
|
||||
u32 count3;
|
||||
if (count2 > count1) {
|
||||
return count2;
|
||||
count3 = count2;
|
||||
} else {
|
||||
return count1;
|
||||
count3 = count1;
|
||||
}
|
||||
return count3;
|
||||
}
|
||||
return count2;
|
||||
}
|
||||
@@ -163,25 +167,25 @@ J3DMaterial* J3DMaterialFactory_v21::create(J3DMaterial* i_material, int i_idx,
|
||||
}
|
||||
|
||||
J3DGXColor J3DMaterialFactory_v21::newMatColor(int i_idx, int i_no) const {
|
||||
GXColor defaultColor = {0xff,0xff,0xff,0xff};
|
||||
J3DGXColor defaultJ3DGXColor = J3DGXColor(defaultColor);
|
||||
J3DGXColor defaultColor = (GXColor){0xff, 0xff, 0xff, 0xff};
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mMatColorIdx[i_no] != 0xffff) {
|
||||
return J3DGXColor(mpMatColor[mtl_init_data->mMatColorIdx[i_no]]);
|
||||
}
|
||||
return J3DGXColor(defaultJ3DGXColor);
|
||||
return J3DGXColor(defaultColor);
|
||||
}
|
||||
|
||||
u8 J3DMaterialFactory_v21::newColorChanNum(int i_idx) const {
|
||||
u8 color_chan_num_index = mpMaterialInitData[mpMaterialID[i_idx]].mColorChanNumIdx;
|
||||
if (color_chan_num_index != 0xff) {
|
||||
return mpColorChanNum[color_chan_num_index];
|
||||
const u8 J3DMaterialFactory_v21::newColorChanNum(int i_idx) const {
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mColorChanNumIdx != 0xff) {
|
||||
return mpColorChanNum[mtl_init_data->mColorChanNumIdx];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
J3DColorChan J3DMaterialFactory_v21::newColorChan(int i_idx, int i_no) const {
|
||||
u8 r29 = 0;
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mColorChanIdx[i_no] != 0xffff) {
|
||||
return J3DColorChan(mpColorChanInfo[mtl_init_data->mColorChanIdx[i_no]]);
|
||||
@@ -191,18 +195,19 @@ J3DColorChan J3DMaterialFactory_v21::newColorChan(int i_idx, int i_no) const {
|
||||
}
|
||||
|
||||
u32 J3DMaterialFactory_v21::newTexGenNum(int i_idx) const {
|
||||
u8 tex_gen_num_index = mpMaterialInitData[mpMaterialID[i_idx]].mTexGenNumIdx;
|
||||
if (tex_gen_num_index != 0xff) {
|
||||
return mpTexGenNum[tex_gen_num_index];
|
||||
u8 r30 = 0;
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTexGenNumIdx != 0xff) {
|
||||
return mpTexGenNum[mtl_init_data->mTexGenNumIdx];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
J3DTexCoord J3DMaterialFactory_v21::newTexCoord(int i_idx, int i_no) const {
|
||||
u16 tex_coord_index = mpMaterialInitData[mpMaterialID[i_idx]].mTexCoordIdx[i_no];
|
||||
if (tex_coord_index != 0xffff) {
|
||||
return J3DTexCoord(mpTexCoordInfo[tex_coord_index]);
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTexCoordIdx[i_no] != 0xffff) {
|
||||
return J3DTexCoord(mpTexCoordInfo[mtl_init_data->mTexCoordIdx[i_no]]);
|
||||
} else {
|
||||
return J3DTexCoord();
|
||||
}
|
||||
@@ -218,18 +223,19 @@ J3DTexMtx* J3DMaterialFactory_v21::newTexMtx(int i_idx, int i_no) const {
|
||||
}
|
||||
|
||||
u8 J3DMaterialFactory_v21::newCullMode(int i_idx) const {
|
||||
u8 cull_mode_index = mpMaterialInitData[mpMaterialID[i_idx]].mCullModeIdx;
|
||||
if (cull_mode_index != 0xff) {
|
||||
return mpCullMode[cull_mode_index];
|
||||
u8 r30 = 0;
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mCullModeIdx != 0xff) {
|
||||
return mpCullMode[mtl_init_data->mCullModeIdx];
|
||||
} else {
|
||||
return 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
u16 J3DMaterialFactory_v21::newTexNo(int i_idx, int i_no) const {
|
||||
u16 tex_no_index = mpMaterialInitData[mpMaterialID[i_idx]].mTexNoIdx[i_no];
|
||||
if (tex_no_index != 0xffff) {
|
||||
return mpTexNo[tex_no_index];
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTexNoIdx[i_no] != 0xffff) {
|
||||
return mpTexNo[mtl_init_data->mTexNoIdx[i_no]];
|
||||
} else {
|
||||
return 0xffff;
|
||||
}
|
||||
@@ -251,33 +257,32 @@ J3DGXColorS10 J3DMaterialFactory_v21::newTevColor(int i_idx, int i_no) const {
|
||||
if (mtl_init_data->mTevColorIdx[i_no] != 0xffff) {
|
||||
return mpTevColor[mtl_init_data->mTevColorIdx[i_no]];
|
||||
} else {
|
||||
return defaultTevColor;
|
||||
return dflt;
|
||||
}
|
||||
}
|
||||
|
||||
J3DGXColor J3DMaterialFactory_v21::newTevKColor(int i_idx, int param_1) const {
|
||||
GXColor defaultColor = {0xff,0xff,0xff,0xff};
|
||||
J3DGXColor defaultJ3DGXColor = J3DGXColor(defaultColor);
|
||||
J3DGXColor defaultColor = (GXColor){0xff, 0xff, 0xff, 0xff};
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTevKColorIdx[param_1] != 0xffff) {
|
||||
return J3DGXColor(mpTevKColor[mtl_init_data->mTevKColorIdx[param_1]]);
|
||||
}
|
||||
return J3DGXColor(defaultJ3DGXColor);
|
||||
return J3DGXColor(defaultColor);
|
||||
}
|
||||
|
||||
u8 J3DMaterialFactory_v21::newTevStageNum(int i_idx) const {
|
||||
u8 tev_stage_num_index = mpMaterialInitData[mpMaterialID[i_idx]].mTevStageNumIdx;
|
||||
if (tev_stage_num_index != 0xff) {
|
||||
return mpTevStageNum[tev_stage_num_index];
|
||||
const u8 J3DMaterialFactory_v21::newTevStageNum(int i_idx) const {
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTevStageNumIdx != 0xff) {
|
||||
return mpTevStageNum[mtl_init_data->mTevStageNumIdx];
|
||||
} else {
|
||||
return 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
J3DTevStage J3DMaterialFactory_v21::newTevStage(int i_idx, int i_no) const {
|
||||
u16 tev_stage_index = mpMaterialInitData[mpMaterialID[i_idx]].mTevStageIdx[i_no];
|
||||
if (tev_stage_index != 0xffff) {
|
||||
return J3DTevStage(mpTevStageInfo[tev_stage_index]);
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mTevStageIdx[i_no] != 0xffff) {
|
||||
return J3DTevStage(mpTevStageInfo[mtl_init_data->mTevStageIdx[i_no]]);
|
||||
} else {
|
||||
return J3DTevStage();
|
||||
}
|
||||
@@ -293,9 +298,9 @@ J3DTevSwapModeTable J3DMaterialFactory_v21::newTevSwapModeTable(int i_idx, int p
|
||||
|
||||
J3DFog J3DMaterialFactory_v21::newFog(int i_idx) const {
|
||||
J3DFog fog;
|
||||
u16 fog_index = mpMaterialInitData[mpMaterialID[i_idx]].mFogIdx;
|
||||
if (fog_index != 0xffff) {
|
||||
fog.setFogInfo(mpFogInfo[fog_index]);
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mFogIdx != 0xffff) {
|
||||
fog.setFogInfo(mpFogInfo[mtl_init_data->mFogIdx]);
|
||||
}
|
||||
return fog;
|
||||
}
|
||||
@@ -317,7 +322,8 @@ J3DBlend J3DMaterialFactory_v21::newBlend(int i_idx) const {
|
||||
}
|
||||
}
|
||||
|
||||
J3DZMode J3DMaterialFactory_v21::newZMode(int i_idx) const {
|
||||
const J3DZMode J3DMaterialFactory_v21::newZMode(int i_idx) const {
|
||||
u8 r29 = 0;
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mZModeIdx != 0xff) {
|
||||
return J3DZMode(mpZModeInfo[mtl_init_data->mZModeIdx]);
|
||||
@@ -326,7 +332,7 @@ J3DZMode J3DMaterialFactory_v21::newZMode(int i_idx) const {
|
||||
}
|
||||
}
|
||||
|
||||
u8 J3DMaterialFactory_v21::newZCompLoc(int i_idx) const {
|
||||
const u8 J3DMaterialFactory_v21::newZCompLoc(int i_idx) const {
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mZCompLocIdx != 0xff){
|
||||
return mpZCompLoc[mtl_init_data->mZCompLocIdx];
|
||||
@@ -335,7 +341,7 @@ u8 J3DMaterialFactory_v21::newZCompLoc(int i_idx) const {
|
||||
}
|
||||
}
|
||||
|
||||
u8 J3DMaterialFactory_v21::newDither(int i_idx) const {
|
||||
const u8 J3DMaterialFactory_v21::newDither(int i_idx) const {
|
||||
J3DMaterialInitData_v21* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
|
||||
if (mtl_init_data->mDitherIdx != 0xff){
|
||||
return mpDither[mtl_init_data->mDitherIdx];
|
||||
|
||||
@@ -97,15 +97,14 @@ void JAISeq::releaseChildTracks_() {
|
||||
}
|
||||
|
||||
bool JAISeq::prepare_getSeqData_() {
|
||||
JAISoundID id(soundID_); // fakematch, should be using getID but it messes up stack
|
||||
if (id.isAnonymous()) {
|
||||
if (getID().isAnonymous()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
JAISeqDataMgr* seqDataMgr = inner_.seqMgr->getSeqDataMgr();
|
||||
JUT_ASSERT(162, seqDataMgr);
|
||||
|
||||
switch (seqDataMgr->getSeqData(id, &inner_.mSeqData)) {
|
||||
switch (seqDataMgr->getSeqData(getID(), &inner_.mSeqData)) {
|
||||
case 0:
|
||||
OS_REPORT("Failed In Loading Sequence Data:SEQ(0x%08x)\n", getID());
|
||||
status_.state.unk = 2;
|
||||
|
||||
@@ -27,7 +27,7 @@ JAIStream::JAIStream(JAIStreamMgr* streamMgr, JAISoundStrategyMgr<JAIStream>* so
|
||||
field_0x2c5 = 0;
|
||||
field_0x2c6 = 0;
|
||||
|
||||
for (int i = 0; i < CHANNEL_MAX; i++) {
|
||||
for (int i = 0; i < NUM_CHILDREN; i++) {
|
||||
children_[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ void JAIStream::JAIStreamMgr_mixOut_(const JASSoundParams& inParams, JAISoundAct
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < CHANNEL_MAX; i++) {
|
||||
for (int i = 0; i < NUM_CHILDREN; i++) {
|
||||
inner_.aramStream_.setPitch(mixParams->mPitch);
|
||||
if (children_[i] != NULL) {
|
||||
inner_.aramStream_.setChannelVolume(i, children_[i]->mMove.params_.mVolume * mixParams->mVolume);
|
||||
@@ -186,7 +186,7 @@ void JAIStream::JAIStreamMgr_mixOut_(const JASSoundParams& inParams, JAISoundAct
|
||||
void JAIStream::die_JAIStream_() {
|
||||
die_JAISound_();
|
||||
|
||||
for (int i = 0; i < CHANNEL_MAX; i++) {
|
||||
for (int i = 0; i < NUM_CHILDREN; i++) {
|
||||
if (children_[i] != NULL) {
|
||||
delete children_[i];
|
||||
children_[i] = NULL;
|
||||
@@ -231,7 +231,7 @@ void JAIStream::JAIStreamMgr_calc_() {
|
||||
}
|
||||
|
||||
if (calc_JAISound_()) {
|
||||
for (int i = 0; i < CHANNEL_MAX; i++) {
|
||||
for (int i = 0; i < NUM_CHILDREN; i++) {
|
||||
if (children_[i] != NULL) {
|
||||
children_[i]->calc();
|
||||
}
|
||||
|
||||
@@ -46,11 +46,10 @@ f32 JASDriver::sDacRate = 32028.5f;
|
||||
|
||||
u32 JASDriver::sSubFrames = 0x00000007;
|
||||
|
||||
// NONMATCHING missing instructions
|
||||
void JASDriver::initAI(void (*param_0)(void)) {
|
||||
setOutputRate(OUTPUT_RATE_0);
|
||||
u32 dacSize = getDacSize();
|
||||
u32 size = dacSize * 2;
|
||||
const u32 size = dacSize * 2;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
sDmaDacBuffer[i] = new(JASDram, 0x20) s16[dacSize];
|
||||
JUT_ASSERT(102, sDmaDacBuffer[i])
|
||||
@@ -145,7 +144,7 @@ void JASDriver::updateDSP() {
|
||||
JASProbe::start(3, "SFR-UPDATE");
|
||||
JASDsp::invalChannelAll();
|
||||
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
JASDsp::dspMutex = 1;
|
||||
#endif
|
||||
|
||||
@@ -160,7 +159,7 @@ void JASDriver::updateDSP() {
|
||||
JUT_ASSERT(254, subFrame <= 10);
|
||||
history[subFrame - r26] = r27;
|
||||
if (subFrame != r26 && f32(history[0]) / r27 < 1.1f) {
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
static int killCounter;
|
||||
JASReport("kill DSP channel", killCounter);
|
||||
JASDSPChannel::killActiveChannel();
|
||||
@@ -173,7 +172,7 @@ void JASDriver::updateDSP() {
|
||||
JASChannel::receiveBankDisposeMsg();
|
||||
JASDSPChannel::updateAll();
|
||||
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
JASDsp::dspMutex = 0;
|
||||
#endif
|
||||
|
||||
@@ -198,7 +197,7 @@ void JASDriver::readDspBuffer(s16* param_0, u32 param_1) {
|
||||
for (int i = param_1; i < param_1 * 2; i++) {
|
||||
sDspDacBuffer[sDspDacReadBuffer][i] = (s16)r24;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
JASReport("readDspBuffer nbuf:%d sWBuf:%d BCount:%d stat:%d", nbuf, sDspDacWriteBuffer,
|
||||
data_804507A8, sDspStatus);
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "JSystem/JAudio2/JASDvdThread.h"
|
||||
#include "JSystem/JKernel/JKRAram.h"
|
||||
#include "JSystem/JKernel/JKRSolidHeap.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
|
||||
JASTaskThread* JASAramStream::sLoadThread;
|
||||
|
||||
@@ -37,7 +38,6 @@ void JASAramStream::initSystem(u32 i_blockSize, u32 i_channelMax) {
|
||||
}
|
||||
}
|
||||
|
||||
// NONMATCHING missing load
|
||||
JASAramStream::JASAramStream() {
|
||||
field_0x0a8 = NULL;
|
||||
field_0x0ac = false;
|
||||
@@ -84,7 +84,6 @@ JASAramStream::JASAramStream() {
|
||||
}
|
||||
}
|
||||
|
||||
// NONMATCHING missing load
|
||||
void JASAramStream::init(u32 param_0, u32 param_1, StreamCallback i_callback, void* i_callbackData) {
|
||||
field_0x148 = param_0;
|
||||
field_0x14c = param_1;
|
||||
@@ -257,7 +256,6 @@ bool JASAramStream::headerLoad(u32 param_0, int param_1) {
|
||||
}
|
||||
|
||||
|
||||
// NONMATCHING regalloc and one instruction swap
|
||||
bool JASAramStream::load() {
|
||||
{
|
||||
JASCriticalSection cs;
|
||||
@@ -271,51 +269,57 @@ bool JASAramStream::load() {
|
||||
}
|
||||
u32 loop_end_block = (mLoopEnd - 1) / getBlockSamples();
|
||||
u32 loop_start_block = mLoopStart / getBlockSamples();
|
||||
u32 block = mBlock;
|
||||
if (block > loop_end_block) {
|
||||
if (mBlock > loop_end_block) {
|
||||
return false;
|
||||
}
|
||||
u32 offset = mBlock * (sBlockSize * mChannelNum + sizeof(BlockHeader)) + sizeof(Header);
|
||||
u32 size = sBlockSize * mChannelNum + sizeof(BlockHeader);
|
||||
u32 offset = block * size + sizeof(Header);
|
||||
u32 size2 = size;
|
||||
if (block == loop_end_block) {
|
||||
size2 = mDvdFileInfo.length - offset;
|
||||
if (mBlock == loop_end_block) {
|
||||
size = mDvdFileInfo.length - offset;
|
||||
}
|
||||
if (DVDReadPrio(&mDvdFileInfo, sReadBuffer, size2, offset, 1) < 0) {
|
||||
if (DVDReadPrio(&mDvdFileInfo, sReadBuffer, size, offset, 1) < 0) {
|
||||
JUT_WARN(507, "%s", "DVDReadPrio Failed");
|
||||
struct_80451261 = true;
|
||||
return false;
|
||||
}
|
||||
BlockHeader* bhead = (BlockHeader*)sReadBuffer;
|
||||
JUT_ASSERT(512, bhead->tag == 'BLCK');
|
||||
if (field_0x114 != 0) {
|
||||
return false;
|
||||
}
|
||||
u32 uvar2 = field_0x148 + field_0x10c * sBlockSize;
|
||||
u32 sp08 = field_0x148 + field_0x10c * sBlockSize;
|
||||
for (int i = 0; i < mChannelNum; i++) {
|
||||
if (!JKRAram::mainRamToAram(sReadBuffer + bhead->field_0x4 * i + sizeof(BlockHeader),
|
||||
uvar2 + sBlockSize * field_0x160 * i,
|
||||
bhead->field_0x4, EXPAND_SWITCH_UNKNOWN0, 0, NULL, -1, NULL)) {
|
||||
(void)i;
|
||||
// Fakematch? It seems the only way to get the bhead->field_0x4 load in the right order is
|
||||
// with a pointer cast on its address in one of the two places it is read, but not both.
|
||||
if (!JKRMainRamToAram(sReadBuffer + *(u32*)&bhead->field_0x4 * i + sizeof(BlockHeader),
|
||||
sp08 + sBlockSize * field_0x160 * i,
|
||||
bhead->field_0x4, EXPAND_SWITCH_UNKNOWN0, 0, NULL, -1, NULL)) {
|
||||
JUT_WARN(522, "%s", "JKRMainRamToAram Failed");
|
||||
struct_80451261 = 1;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
field_0x10c++;
|
||||
if (field_0x10c >= field_0x108) {
|
||||
u32 uvar8 = field_0x108 - 1 + mBlock;
|
||||
u32 r28 = mBlock;
|
||||
r28 += field_0x108 - 1;
|
||||
if (mLoop) {
|
||||
while (uvar8 > loop_end_block) {
|
||||
uvar8 -= loop_end_block;
|
||||
uvar8 += loop_start_block;
|
||||
JUT_ASSERT(537, loop_start_block < loop_end_block);
|
||||
while (r28 > loop_end_block) {
|
||||
r28 -= loop_end_block;
|
||||
r28 += loop_start_block;
|
||||
}
|
||||
}
|
||||
if (uvar8 == loop_end_block || uvar8 + 2 == loop_end_block) {
|
||||
if (r28 == loop_end_block || r28 + 2 == loop_end_block) {
|
||||
field_0x108 = field_0x160;
|
||||
OSSendMessage(&field_0x020, (OSMessage)5, OS_MESSAGE_BLOCK);
|
||||
} else {
|
||||
field_0x108 = field_0x160 - 1;
|
||||
}
|
||||
for (int i = 0; i < mChannelNum; i++) {
|
||||
field_0x130[i] = bhead->field_0x8[i].field_0x0;
|
||||
field_0x13c[i] = bhead->field_0x8[i].field_0x2;
|
||||
field_0x130[i] = (s16)bhead->field_0x8[i].field_0x0;
|
||||
field_0x13c[i] = (s16)bhead->field_0x8[i].field_0x2;
|
||||
}
|
||||
field_0x10c = 0;
|
||||
}
|
||||
@@ -358,7 +362,6 @@ void JASAramStream::channelCallback(u32 i_callbackType, JASChannel* i_channel,
|
||||
((JASAramStream*)i_this)->updateChannel(i_callbackType, i_channel, i_dspChannel);
|
||||
}
|
||||
|
||||
// NONMATCHING missing extra loads of field_0x0c4
|
||||
void JASAramStream::updateChannel(u32 i_callbackType, JASChannel* i_channel,
|
||||
JASDsp::TChannel* i_dspChannel) {
|
||||
u32 block_samples = getBlockSamples();
|
||||
@@ -379,17 +382,16 @@ void JASAramStream::updateChannel(u32 i_callbackType, JASChannel* i_channel,
|
||||
if (i_dspChannel->field_0x008 == 0) {
|
||||
if (i_channel == field_0x0a8) {
|
||||
field_0x12c = 0;
|
||||
u32 uvar8 = i_dspChannel->field_0x074 + i_dspChannel->field_0x064;
|
||||
u32 uvar5 = field_0x0b4;
|
||||
if (uvar8 <= uvar5) {
|
||||
field_0x0b8 += uvar5 - uvar8;
|
||||
u32 sp28 = i_dspChannel->field_0x074 + i_dspChannel->field_0x064;
|
||||
if (sp28 <= field_0x0b4) {
|
||||
field_0x0b8 += field_0x0b4 - sp28;
|
||||
} else {
|
||||
if (!field_0x0c0) {
|
||||
field_0x0b8 += uvar5;
|
||||
field_0x0b8 += block_samples * mBufCount - uvar8;
|
||||
field_0x0b8 += field_0x0b4;
|
||||
field_0x0b8 += block_samples * mBufCount - sp28;
|
||||
} else {
|
||||
field_0x0b8 += uvar5;
|
||||
field_0x0b8 += block_samples * mBufCount - uvar8
|
||||
field_0x0b8 += field_0x0b4;
|
||||
field_0x0b8 += block_samples * mBufCount - sp28
|
||||
- i_dspChannel->field_0x110;
|
||||
field_0x0b8 -= mLoopEnd;
|
||||
field_0x0b8 += mLoopStart;
|
||||
@@ -403,6 +405,7 @@ void JASAramStream::updateChannel(u32 i_callbackType, JASChannel* i_channel,
|
||||
}
|
||||
}
|
||||
if (field_0x0b8 > mLoopEnd) {
|
||||
JUT_WARN(686, "%s", "mReadSample > mLoopEnd");
|
||||
struct_80451261 = true;
|
||||
}
|
||||
f32 fvar1 = field_0x0c4;
|
||||
@@ -427,8 +430,8 @@ void JASAramStream::updateChannel(u32 i_callbackType, JASChannel* i_channel,
|
||||
field_0x128 = 0;
|
||||
field_0x12c |= 8;
|
||||
}
|
||||
i_dspChannel->field_0x074 -= block_samples * mBufCount
|
||||
- (field_0x0bc * block_samples + mLoopEnd % block_samples);
|
||||
int sp20 = field_0x0bc * block_samples + mLoopEnd % block_samples;
|
||||
i_dspChannel->field_0x074 -= block_samples * mBufCount - sp20;
|
||||
field_0x11c = i_dspChannel->field_0x074;
|
||||
field_0x12c |= 1;
|
||||
field_0x0bc += (mLoopEnd - 1) / block_samples - mLoopStart / block_samples + 1;
|
||||
@@ -438,12 +441,13 @@ void JASAramStream::updateChannel(u32 i_callbackType, JASChannel* i_channel,
|
||||
if (uvar4 != 0) {
|
||||
uvar4--;
|
||||
}
|
||||
uvar5 = uvar4 / sBlockSize;
|
||||
getBlockSamples();
|
||||
if (uvar5 != field_0x0b0) {
|
||||
bool cmp = uvar5 < field_0x0b0;
|
||||
while (uvar5 != field_0x0b0) {
|
||||
u32 sp18 = uvar4 / sBlockSize;
|
||||
u32 sp14 = (mLoopEnd - 1) / getBlockSamples();
|
||||
if (sp18 != field_0x0b0) {
|
||||
bool cmp = sp18 < field_0x0b0;
|
||||
while (sp18 != field_0x0b0) {
|
||||
if (!sLoadThread->sendCmdMsg(loadToAramTask, this)) {
|
||||
JUT_WARN(741, "sendCmdMsg Failed %d %d (%d %d)", i_dspChannel->field_0x070, i_channel->field_0x104, sp18, field_0x0b0);
|
||||
struct_80451261 = true;
|
||||
break;
|
||||
}
|
||||
@@ -491,7 +495,8 @@ void JASAramStream::updateChannel(u32 i_callbackType, JASChannel* i_channel,
|
||||
}
|
||||
field_0x0b4 = i_dspChannel->field_0x074 + i_dspChannel->field_0x064;
|
||||
if (field_0x118 >= field_0x160 - 2) {
|
||||
field_0x0ae |= 4;
|
||||
JUT_WARN_DEVICE(810, 1, "%s", "buffer under error");
|
||||
field_0x0ae |= (u8)4;
|
||||
}
|
||||
} else {
|
||||
if (field_0x12c & 1) {
|
||||
@@ -507,14 +512,15 @@ void JASAramStream::updateChannel(u32 i_callbackType, JASChannel* i_channel,
|
||||
i_dspChannel->field_0x102 = field_0x128;
|
||||
}
|
||||
}
|
||||
int i = 0;
|
||||
for (; i < 6; i++) {
|
||||
if (i_channel == mChannels[i]) {
|
||||
int ch = 0;
|
||||
for (; ch < 6; ch++) {
|
||||
if (i_channel == mChannels[ch]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
i_dspChannel->field_0x104 = field_0x130[i];
|
||||
i_dspChannel->field_0x106 = field_0x13c[i];
|
||||
JUT_ASSERT(834, ch < CHANNEL_MAX);
|
||||
i_dspChannel->field_0x104 = (s16)field_0x130[ch];
|
||||
i_dspChannel->field_0x106 = (s16)field_0x13c[ch];
|
||||
}
|
||||
break;
|
||||
case JASChannel::CB_STOP:
|
||||
@@ -529,16 +535,16 @@ void JASAramStream::updateChannel(u32 i_callbackType, JASChannel* i_channel,
|
||||
if (!open_channel) {
|
||||
field_0x114 = 1;
|
||||
if (!sLoadThread->sendCmdMsg(finishTask, this)) {
|
||||
JUT_WARN(854, "%s", "sendCmdMsg finishTask Failed");
|
||||
struct_80451261 = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
i_channel->mPauseFlag = field_0x0ae != 0;
|
||||
i_channel->setPauseFlag(field_0x0ae != 0);
|
||||
}
|
||||
|
||||
// NONMATCHING instruction ordering / regalloc
|
||||
s32 JASAramStream::channelProc() {
|
||||
OSMessage msg;
|
||||
while (OSReceiveMessage(&field_0x020, &msg, OS_MESSAGE_NOBLOCK)) {
|
||||
@@ -562,7 +568,7 @@ s32 JASAramStream::channelProc() {
|
||||
channelStart();
|
||||
break;
|
||||
case 1:
|
||||
channelStop((u32)msg >> 0x10);
|
||||
channelStop(JSUHiHalf((u32)msg));
|
||||
break;
|
||||
case 2:
|
||||
field_0x0ae |= 1;
|
||||
|
||||
@@ -19,7 +19,7 @@ JASAudioThread::JASAudioThread(int stackSize, int msgCount, u32 threadPriority)
|
||||
OSInitThreadQueue(&sThreadQueue);
|
||||
}
|
||||
|
||||
void JASAudioThread::create(long threadPriority) {
|
||||
void JASAudioThread::create(s32 threadPriority) {
|
||||
JASAudioThread* sAudioThread = new (JASDram, 0) JASAudioThread(threadPriority, 0x10, 0x1400);
|
||||
sAudioThread->setCurrentHeap(JKRGetSystemHeap());
|
||||
sAudioThread->resume();
|
||||
|
||||
@@ -305,3 +305,7 @@ JASOscillator::Point const* JASBNKParser::Ver0::getOscTableEndPtr(JASOscillator:
|
||||
} while (tmp <= 10);
|
||||
return points;
|
||||
}
|
||||
|
||||
// Fakematch? Why is this here?
|
||||
template<>
|
||||
JASMemPool_MultiThreaded<JASChannel> JASPoolAllocObject_MultiThreaded<JASChannel>::memPool_;
|
||||
|
||||
@@ -264,11 +264,11 @@ s16 const JASCalc::CUTOFF_TO_IIR_TABLE[128][4] = {
|
||||
};
|
||||
|
||||
// currently required because of missing functions
|
||||
// JASCalc::hannWindow(short *, unsigned long)
|
||||
// JASCalc::hammWindow(short *, unsigned long)
|
||||
// JASCalc::fft(float *, float *, unsigned long, long)
|
||||
// JASCalc::hannWindow(short *, u32)
|
||||
// JASCalc::hammWindow(short *, u32)
|
||||
// JASCalc::fft(float *, float *, u32, s32)
|
||||
f32 JASCalc::fake1() { return 0.5f; }
|
||||
f32 JASCalc::fake2(long x) { return JASCalc::clamp<s16, long>(x); }
|
||||
f32 JASCalc::fake2(s32 x) { return JASCalc::clamp<s16, s32>(x); }
|
||||
f32 JASCalc::fake3() { return 0.0f; }
|
||||
|
||||
f32 JASCalc::pow2(f32 x) {
|
||||
|
||||
@@ -659,6 +659,6 @@ u16 DSP_CreateMap2(u32 param_0) {
|
||||
|
||||
u32 JASWaveInfo::one = 1;
|
||||
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
s32 dspMutex = 1;
|
||||
#endif
|
||||
|
||||
@@ -27,9 +27,7 @@ bool JASHeap::alloc(JASHeap* mother, u32 param_1) {
|
||||
JUT_ASSERT(120, mother != NULL);
|
||||
JASMutexLock lock(&mMutex);
|
||||
if (isAllocated()) {
|
||||
#ifdef DEBUG
|
||||
OSReport("[JASHeap::alloc] すでにヒープは確保されています。初期化してからにしてください。\n");
|
||||
#endif
|
||||
OS_REPORT("[JASHeap::alloc] すでにヒープは確保されています。初期化してからにしてください。\n");
|
||||
return 0;
|
||||
}
|
||||
if (!mother->isAllocated()) {
|
||||
@@ -71,9 +69,7 @@ bool JASHeap::alloc(JASHeap* mother, u32 param_1) {
|
||||
}
|
||||
}
|
||||
if (!local_43) {
|
||||
#ifdef DEBUG
|
||||
OSReport("[JASHeap::alloc] マザーメモリが足りないので確保できません。\n");
|
||||
#endif
|
||||
OS_REPORT("[JASHeap::alloc] マザーメモリが足りないので確保できません。\n");
|
||||
return 0;
|
||||
}
|
||||
mother->insertChild(this, local_30, local_34, param_1, false);
|
||||
@@ -199,11 +195,19 @@ JASGenericMemPool::~JASGenericMemPool() {
|
||||
|
||||
JKRSolidHeap* JASDram;
|
||||
|
||||
void JASGenericMemPool::newMemPool(u32 size, int param_1) {
|
||||
// TODO: What is this and Where does it go?
|
||||
struct TNextOnFreeList {
|
||||
u8 pad[4];
|
||||
}; // Size: 0x4
|
||||
|
||||
void JASGenericMemPool::newMemPool(u32 n, int param_1) {
|
||||
JUT_ASSERT(734, n >= sizeof(TNextOnFreeList));
|
||||
void* runner;
|
||||
for (int i = 0; i < param_1; i++) {
|
||||
void* chunk = new (JASDram, 0) u8[size];
|
||||
*(void**)chunk = field_0x0;
|
||||
field_0x0 = chunk;
|
||||
runner = new (JASDram, 0) u8[n];
|
||||
JUT_ASSERT(739, runner);
|
||||
*(void**)runner = field_0x0;
|
||||
field_0x0 = runner;
|
||||
}
|
||||
freeMemCount += param_1;
|
||||
totalMemCount += param_1;
|
||||
|
||||
@@ -81,12 +81,11 @@ int JASTaskThread::sendCmdMsg(JASThreadCallback callback, void* msg) {
|
||||
return iVar2;
|
||||
}
|
||||
|
||||
// NONMATCHING Regalloc
|
||||
void* JASTaskThread::run() {
|
||||
JASThreadCallStack* callstack;
|
||||
OSInitFastCast();
|
||||
do {
|
||||
callstack = (JASThreadCallStack*)waitMessageBlock();
|
||||
callstack = static_cast<JASThreadCallStack*>(waitMessageBlock());
|
||||
if (field_0x84) {
|
||||
OSSleepThread(&threadQueue_);
|
||||
}
|
||||
|
||||
@@ -728,8 +728,8 @@ void JASTrack::TList::append(JASTrack* i_track) {
|
||||
Push_back(i_track);
|
||||
}
|
||||
|
||||
// NONMATCHING - missing load instruction (matches debug, equivalent)
|
||||
void JASTrack::TList::seqMain() {
|
||||
#if DEBUG
|
||||
iterator it, it2;
|
||||
for (it = begin(); it != end(); it = it2) {
|
||||
it2 = it;
|
||||
@@ -742,6 +742,25 @@ void JASTrack::TList::seqMain() {
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
iterator it;
|
||||
for (it = begin(); it != end();) {
|
||||
// Fakematch: Debug shows that it2 should be declared outside the loop and then this line
|
||||
// should use operator=, but that results in a missing load instruction for retail, so we
|
||||
// use the copy constructor instead of the assignment operator, which fixes it for some
|
||||
// reason. Might be related to the fakematch in the assignment operator?
|
||||
iterator it2 = it;
|
||||
++it2;
|
||||
int seqMainRes = it->seqMain();
|
||||
if (seqMainRes < 0) {
|
||||
Remove(&*it);
|
||||
if (it->mFlags.autoDelete) {
|
||||
delete &*it;
|
||||
}
|
||||
}
|
||||
it = it2;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
JASTrack::TChannelMgr::TChannelMgr(JASTrack* i_track) : mSoundParams(NULL), mTrack(i_track) {
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
|
||||
#include "JSystem/JAudio2/JAUAudioMgr.h"
|
||||
#include "JSystem/JAudio2/JASHeapCtrl.h"
|
||||
#include "JSystem/JAudio2/JAUStreamAramMgr.h"
|
||||
|
||||
// Here to generate JASHeap::__defctor (ctor generated by default arguments)
|
||||
void dummyDefCtor() {
|
||||
JASHeap dummy[20];
|
||||
JAUStreamStaticAramMgr_<1>* streamStaticAramMgr = new(NULL, 0) JAUStreamStaticAramMgr_<1>();
|
||||
streamStaticAramMgr->reserveAram(NULL, 0, 0x14);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ namespace {
|
||||
}
|
||||
return field_0x8[short_id];
|
||||
}
|
||||
virtual ~TStreamDataMgr() {}
|
||||
|
||||
bool isValid() { return field_0x4; }
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "dolphin/gx.h"
|
||||
#include <dolphin/vi.h>
|
||||
#include "global.h"
|
||||
#include "stdint.h"
|
||||
|
||||
void JFWDisplay::ctor_subroutine(bool enableAlpha) {
|
||||
mEnableAlpha = enableAlpha;
|
||||
@@ -362,8 +363,8 @@ static void waitForTick(u32 p1, u16 p2) {
|
||||
if (!OSReceiveMessage(JUTVideo::getManager()->getMessageQueue(), &msg, OS_MESSAGE_BLOCK)) {
|
||||
msg = 0;
|
||||
}
|
||||
} while (((int)msg - (int)nextCount) < 0);
|
||||
nextCount = (int)msg + uVar1;
|
||||
} while (((intptr_t)msg - (intptr_t)nextCount) < 0);
|
||||
nextCount = (intptr_t)msg + uVar1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,6 @@ JUTConsole* JFWSystem::systemConsole;
|
||||
|
||||
bool JFWSystem::sInitCalled = false;
|
||||
|
||||
// NONMATCHING - regalloc, equivalent
|
||||
void JFWSystem::init() {
|
||||
JUT_ASSERT(101, sInitCalled == false);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "JSystem/JHostIO/JHIMccBuf.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JHostIO/JHIRMcc.h"
|
||||
#include <dolphin.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
#include <cstring.h>
|
||||
|
||||
extern "C" int HIO2Read(u32, u32, void*, u32);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "JSystem/JHostIO/JHICommonMem.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include <dolphin.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
int JHIMemBuf::create() {
|
||||
int rt = 1;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "JSystem/JHostIO/JHIMccBuf.h"
|
||||
#include "JSystem/JHostIO/JHIRMcc.h"
|
||||
#include <dolphin.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
#include "global.h"
|
||||
|
||||
u32 gsEnableHostio;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "JSystem/JHostIO/JORFile.h"
|
||||
#include "JSystem/JHostIO/JORServer.h"
|
||||
#include <dolphin.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
JORFile::JORFile()
|
||||
: mHandle(0),
|
||||
|
||||
@@ -143,9 +143,7 @@ cleanup:
|
||||
JKRFreeToSysHeap(mem);
|
||||
}
|
||||
if (mMountMode == 0) {
|
||||
#ifdef DEBUG
|
||||
OSReport(":::[%s: %d] Cannot alloc memory\n", __FILE__, 415);
|
||||
#endif
|
||||
OS_REPORT(":::[%s: %d] Cannot alloc memory\n", __FILE__, 415);
|
||||
if (mDvdFile != NULL) {
|
||||
delete mDvdFile;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "JSystem/JKernel/JKRAssertHeap.h"
|
||||
|
||||
JKRAssertHeap::JKRAssertHeap(void* data, unsigned long size, JKRHeap* parent, bool errorFlag)
|
||||
JKRAssertHeap::JKRAssertHeap(void* data, u32 size, JKRHeap* parent, bool errorFlag)
|
||||
: JKRHeap(data, size, parent, errorFlag) {}
|
||||
|
||||
JKRAssertHeap::~JKRAssertHeap() {
|
||||
|
||||
@@ -206,10 +206,8 @@ bool JKRCompArchive::open(s32 entryNum) {
|
||||
{
|
||||
JKRFreeToSysHeap(arcHeader);
|
||||
}
|
||||
if(mMountMode == 0) {
|
||||
#ifdef DEBUG
|
||||
OSReport(":::[%s: %d] Cannot alloc memory in mounting CompArchive\n", __FILE__, 567);
|
||||
#endif
|
||||
if (mMountMode == 0) {
|
||||
OS_REPORT(":::[%s: %d] Cannot alloc memory in mounting CompArchive\n", __FILE__, 567);
|
||||
if(mDvdFile != NULL) {
|
||||
delete mDvdFile;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,8 @@ bool JKRDvdArchive::open(s32 entryNum) {
|
||||
JKRDvdRipper::ALLOC_DIRECTION_FORWARD, 0, &mCompression, NULL);
|
||||
DCInvalidateRange(arcHeader, sizeof(SArcHeader));
|
||||
|
||||
int alignment = mMountDirection == MOUNT_DIRECTION_HEAD ? 0x20 : -0x20;
|
||||
int alignment;
|
||||
alignment = mMountDirection == MOUNT_DIRECTION_HEAD ? 0x20 : -0x20;
|
||||
|
||||
mArcInfoBlock = (SArcDataInfo*)JKRAllocFromHeap(mHeap, arcHeader->file_data_offset, alignment);
|
||||
if (!mArcInfoBlock) {
|
||||
@@ -93,8 +94,10 @@ bool JKRDvdArchive::open(s32 entryNum) {
|
||||
mStringTable = (char*)((int)&mArcInfoBlock->num_nodes + mArcInfoBlock->string_table_offset);
|
||||
mExpandedSize = NULL;
|
||||
|
||||
u8 useCompression = 0;
|
||||
SDIFileEntry* fileEntry = mFiles;
|
||||
u8 useCompression;
|
||||
useCompression = 0;
|
||||
SDIFileEntry* fileEntry;
|
||||
fileEntry = mFiles;
|
||||
for (u32 i = 0; i < mArcInfoBlock->num_file_entries; fileEntry++, i++) {
|
||||
if (fileEntry->isUnknownFlag1()) {
|
||||
useCompression |= fileEntry->getCompressFlag();
|
||||
@@ -124,9 +127,7 @@ cleanup:
|
||||
}
|
||||
|
||||
if (mMountMode == UNKNOWN_MOUNT_MODE) {
|
||||
#ifdef DEBUG
|
||||
OSReport(":::Cannot alloc memory [%s][%d]\n", __FILE__, 397);
|
||||
#endif
|
||||
OS_REPORT(":::Cannot alloc memory [%s][%d]\n", __FILE__, 397);
|
||||
if (mDvdFile) {
|
||||
delete mDvdFile;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
bool data_804508B0 = 1;
|
||||
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
u8 data_804508B1;
|
||||
u8 data_804508B2;
|
||||
u8 data_804508B3;
|
||||
@@ -355,10 +355,8 @@ void JKRHeap::copyMemory(void* dst, void* src, u32 size) {
|
||||
}
|
||||
|
||||
void JKRDefaultMemoryErrorRoutine(void* heap, u32 size, int alignment) {
|
||||
#ifdef DEBUG
|
||||
OSReport("Error: Cannot allocate memory %d(0x%x)byte in %d byte alignment from %08x\n", size,
|
||||
OS_REPORT("Error: Cannot allocate memory %d(0x%x)byte in %d byte alignment from %08x\n", size,
|
||||
size, alignment, heap);
|
||||
#endif
|
||||
JUTException::panic(__FILE__, 831, "abort\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ bool JKRMemArchive::open(s32 entryNum, JKRArchive::EMountDirection mountDirectio
|
||||
mIsOpen = true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
if (mMountMode == 0) {
|
||||
OSReport(":::Cannot alloc memory [%s][%d]\n", __FILE__, 460);
|
||||
}
|
||||
@@ -195,15 +195,18 @@ u32 JKRMemArchive::fetchResource_subroutine(u8* src, u32 srcLength, u8* dst, u32
|
||||
return srcLength;
|
||||
|
||||
case COMPRESSION_YAY0:
|
||||
case COMPRESSION_YAZ0:
|
||||
case COMPRESSION_YAZ0: {
|
||||
u32 expendedSize = JKRDecompExpandSize(src);
|
||||
#if VERSION != VERSION_SHIELD_DEBUG
|
||||
srcLength = expendedSize;
|
||||
#endif
|
||||
if (expendedSize > dstLength) {
|
||||
srcLength = dstLength;
|
||||
}
|
||||
|
||||
JKRDecompress(src, dst, srcLength, 0);
|
||||
return srcLength;
|
||||
}
|
||||
|
||||
default: {
|
||||
JUTException::panic(__FILE__, 723, "??? bad sequence\n");
|
||||
|
||||
@@ -73,7 +73,7 @@ s32 JKRSolidHeap::adjustSize(void) {
|
||||
}
|
||||
|
||||
void* JKRSolidHeap::do_alloc(u32 size, int alignment) {
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
// TODO(Julgodis): JUTAssertion::setConfirmMessage
|
||||
/* if (alignment != 0) {
|
||||
int u = abs(alignment);
|
||||
@@ -179,7 +179,7 @@ void JKRSolidHeap::do_freeTail(void) {
|
||||
}
|
||||
|
||||
void JKRSolidHeap::do_fillFreeArea() {
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
// fillMemory(mSolidHead, mEnd - mSolidHead, (uint)DAT_8074a8ba);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -185,10 +185,10 @@ void JKRThreadSwitch::callback(OSThread* current, OSThread* next) {
|
||||
next_heap = JKRHeap::getCurrentHeap();
|
||||
} else if (JKRHeap::getRootHeap()->isSubHeap(next_heap)) {
|
||||
continue;
|
||||
#ifdef DEBUG
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
} else if (!JKRHeap::getRootHeap2()->isSubHeap(next_heap)) {
|
||||
continue;
|
||||
#endif
|
||||
#endif
|
||||
} else {
|
||||
switch (thread->getCurrentHeapError()) {
|
||||
case 0:
|
||||
@@ -224,10 +224,8 @@ void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list, JUTConsole* console
|
||||
const char* print_1 = " -------------------------------------\n";
|
||||
|
||||
if (!console) {
|
||||
#ifdef DEBUG
|
||||
OSReport(print_0, getTotalCount(), (int)this->field_0x18, this->field_0x10);
|
||||
OSReport(print_1);
|
||||
#endif
|
||||
OS_REPORT(print_0, getTotalCount(), (int)this->field_0x18, this->field_0x10);
|
||||
OS_REPORT(print_1);
|
||||
} else {
|
||||
console->clear();
|
||||
console->print_f(print_0, getTotalCount(), (int)this->field_0x18, this->field_0x10);
|
||||
@@ -264,10 +262,8 @@ void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list, JUTConsole* console
|
||||
u32 cost_int = (u32)(cost_per_0x18 * 100.0f);
|
||||
u32 cost_float = (u32)(cost_per_0x18 * 1000.0f) % 10;
|
||||
if (!console) {
|
||||
#ifdef DEBUG
|
||||
OSReport(" [%10s] switch:%5d cost:%2d.%d%%\n", thread_print_name, switch_count,
|
||||
OS_REPORT(" [%10s] switch:%5d cost:%2d.%d%%\n", thread_print_name, switch_count,
|
||||
cost_int, cost_float);
|
||||
#endif
|
||||
} else {
|
||||
console->print_f(" [%10s] switch:%5d cost:%2d.%d%%\n", thread_print_name,
|
||||
switch_count, cost_int, cost_float);
|
||||
|
||||
@@ -70,10 +70,10 @@ struct TAsinAcosTable {
|
||||
|
||||
namespace JMath {
|
||||
|
||||
TSinCosTable<13, f32> sincosTable_;
|
||||
TSinCosTable<13, f32> sincosTable_ ATTRIBUTE_ALIGN(32);
|
||||
|
||||
TAtanTable atanTable_;
|
||||
TAtanTable atanTable_ ATTRIBUTE_ALIGN(32);
|
||||
|
||||
TAsinAcosTable asinAcosTable_;
|
||||
TAsinAcosTable asinAcosTable_ ATTRIBUTE_ALIGN(32);
|
||||
|
||||
} // namespace JMath
|
||||
|
||||
+15
-15
@@ -19,10 +19,10 @@ void JMAEulerToQuat(s16 x, s16 y, s16 z, Quaternion* quat) {
|
||||
quat->z = sinZ * (cosX * cosY) - cosZ * (sinX * sinY);
|
||||
}
|
||||
|
||||
void JMAQuatLerp(register const Quaternion* p, register const Quaternion* q, f32 t,
|
||||
void JMAQuatLerp(__REGISTER const Quaternion* p, __REGISTER const Quaternion* q, f32 t,
|
||||
Quaternion* dst) {
|
||||
register f32 pxy, pzw, qxy, qzw;
|
||||
register f32 dp;
|
||||
__REGISTER f32 pxy, pzw, qxy, qzw;
|
||||
__REGISTER f32 dp;
|
||||
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
// compute dot product
|
||||
@@ -52,8 +52,8 @@ void JMAQuatLerp(register const Quaternion* p, register const Quaternion* q, f32
|
||||
}
|
||||
}
|
||||
|
||||
void JMAFastVECNormalize(register const Vec* src, register Vec* dst) {
|
||||
register f32 vxy, rxy, vz, length;
|
||||
void JMAFastVECNormalize(__REGISTER const Vec* src, __REGISTER Vec* dst) {
|
||||
__REGISTER f32 vxy, rxy, vz, length;
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
asm {
|
||||
psq_l vxy, 0(src), 0, 0
|
||||
@@ -70,11 +70,11 @@ void JMAFastVECNormalize(register const Vec* src, register Vec* dst) {
|
||||
#endif // clang-format on
|
||||
}
|
||||
|
||||
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 rxy, v1z, v2z, rz;
|
||||
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 rxy, v1z, v2z, rz;
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
asm {
|
||||
psq_l v1xy, 0(vec1), 0, 0
|
||||
@@ -90,11 +90,11 @@ void JMAVECScaleAdd(register const Vec* vec1, register const Vec* vec2, register
|
||||
#endif // clang-format on
|
||||
}
|
||||
|
||||
void JMAMTXApplyScale(register const Mtx src, register Mtx dst, register f32 xScale,
|
||||
register f32 yScale, register f32 zScale) {
|
||||
register f32 scale = yScale;
|
||||
register f32 x, y, z;
|
||||
register f32 normal = 1.0f;
|
||||
void JMAMTXApplyScale(__REGISTER const Mtx src, __REGISTER Mtx dst, __REGISTER f32 xScale,
|
||||
__REGISTER f32 yScale, __REGISTER f32 zScale) {
|
||||
__REGISTER f32 scale = yScale;
|
||||
__REGISTER f32 x, y, z;
|
||||
__REGISTER f32 normal = 1.0f;
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
asm {
|
||||
// scale first 2 components
|
||||
|
||||
@@ -100,10 +100,8 @@ JMessage::TResourceContainer::TCResource::TCResource() {}
|
||||
JMessage::TResourceContainer::TCResource::~TCResource() {
|
||||
JGADGET_ASSERTWARN(173, empty());
|
||||
}
|
||||
|
||||
// NONMATCHING - likely due to incorrect enumerator setup compared to debug
|
||||
JMessage::TResource* JMessage::TResourceContainer::TCResource::Get_groupID(u16 u16GroupID) {
|
||||
JGadget::TContainerEnumerator<TResource, 0> enumerator(this);
|
||||
JGadget::TContainerEnumerator<TResourceContainer::TCResource> enumerator(*this);
|
||||
while (enumerator) {
|
||||
const TResource* res = &(*enumerator);
|
||||
if (res->getGroupID() == u16GroupID)
|
||||
@@ -117,9 +115,12 @@ JMessage::TResource* JMessage::TResourceContainer::TCResource::Do_create() {
|
||||
return new TResource();
|
||||
}
|
||||
|
||||
// NONMATCHING extra null comparison
|
||||
void JMessage::TResourceContainer::TCResource::Do_destroy(JMessage::TResource* pResource) {
|
||||
#if DEBUG
|
||||
delete pResource;
|
||||
#else
|
||||
operator delete(pResource);
|
||||
#endif
|
||||
}
|
||||
|
||||
JMessage::TResourceContainer::TResourceContainer() : encodingType_(0), pfnParseCharacter_(NULL) {}
|
||||
@@ -141,14 +142,17 @@ void JMessage::TResourceContainer::setEncoding_(u8 e) {
|
||||
}
|
||||
|
||||
JMessage::TParse::TParse(JMessage::TResourceContainer* pContainer) {
|
||||
u8 sp8[5];
|
||||
JMessage::TResourceContainer* cont;
|
||||
JUT_ASSERT(324, pContainer!=NULL);
|
||||
pContainer_ = pContainer;
|
||||
cont = pContainer;
|
||||
pContainer_ = cont;
|
||||
pResource_ = NULL;
|
||||
sp8[0] = 0;
|
||||
}
|
||||
|
||||
JMessage::TParse::~TParse() {}
|
||||
|
||||
// NONMATCHING regalloc, missing clrlwi
|
||||
bool JMessage::TParse::parseHeader_next(const void** ppData_inout, u32* puBlock_out, u32 param_2) {
|
||||
JUT_ASSERT(343, ppData_inout!=NULL);
|
||||
JUT_ASSERT(344, puBlock_out!=NULL);
|
||||
@@ -172,7 +176,7 @@ bool JMessage::TParse::parseHeader_next(const void** ppData_inout, u32* puBlock_
|
||||
return false;
|
||||
}
|
||||
|
||||
u8 uEncoding = oHeader.get_encoding();
|
||||
const u8 uEncoding = oHeader.get_encoding();
|
||||
if (uEncoding != 0) {
|
||||
if (!pContainer_->isEncodingSettable(uEncoding)) {
|
||||
JGADGET_WARNMSG(369, "encoding not acceptable");
|
||||
@@ -243,7 +247,7 @@ bool JMessage::TParse::parseBlock_next(const void** ppData_inout, u32* puData_ou
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
JMessage::TResource* pResource = rcResource.Get_groupID(u16GroupID);
|
||||
if (pResource != pResource_) {
|
||||
JGADGET_WARNMSG1(444, "group-ID already exist : ", u16GroupID);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JStage/JSGCamera.h"
|
||||
#include "math.h"
|
||||
#include "limits.h"
|
||||
|
||||
JStage::TCamera::~TCamera() {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JStage/JSGFog.h"
|
||||
#include "math.h"
|
||||
#include "limits.h"
|
||||
|
||||
JStage::TFog::~TFog() {}
|
||||
|
||||
@@ -22,7 +22,7 @@ f32 JStage::TFog::JSGGetStartZ() const {
|
||||
void JStage::TFog::JSGSetStartZ(f32) {}
|
||||
|
||||
f32 JStage::TFog::JSGGetEndZ() const {
|
||||
return FLT_MAX;
|
||||
return std::numeric_limits<f32>::max();
|
||||
}
|
||||
|
||||
void JStage::TFog::JSGSetEndZ(f32) {}
|
||||
|
||||
@@ -16,31 +16,37 @@ int JStudio::ctb::TObject_TxyzRy::getScheme() const {
|
||||
|
||||
JStudio::ctb::TControl::TControl() : pFactory_(NULL) {}
|
||||
|
||||
JStudio::ctb::TControl::~TControl() {}
|
||||
|
||||
void JStudio::ctb::TControl::appendObject(JStudio::ctb::TObject* param_0) {
|
||||
mList.Push_back(param_0);
|
||||
JStudio::ctb::TControl::~TControl() {
|
||||
JGADGET_ASSERTWARN(94, ocObject_.empty());
|
||||
}
|
||||
|
||||
void JStudio::ctb::TControl::removeObject(JStudio::ctb::TObject* param_0) {
|
||||
mList.Erase(param_0);
|
||||
void JStudio::ctb::TControl::appendObject(JStudio::ctb::TObject* p) {
|
||||
JUT_ASSERT(106, p!=NULL)
|
||||
ocObject_.Push_back(p);
|
||||
}
|
||||
|
||||
void JStudio::ctb::TControl::removeObject(JStudio::ctb::TObject* p) {
|
||||
JUT_ASSERT(113, p!=NULL)
|
||||
ocObject_.Erase(p);
|
||||
}
|
||||
|
||||
void JStudio::ctb::TControl::destroyObject(JStudio::ctb::TObject* param_0) {
|
||||
removeObject(param_0);
|
||||
getFactory()->destroy(param_0);
|
||||
TFactory *pFactory = getFactory();
|
||||
JUT_ASSERT(129, pFactory!=NULL);
|
||||
pFactory->destroy(param_0);
|
||||
}
|
||||
|
||||
void JStudio::ctb::TControl::destroyObject_all() {
|
||||
while (!mList.empty()) {
|
||||
destroyObject(&mList.back());
|
||||
while (!ocObject_.empty()) {
|
||||
destroyObject(&ocObject_.back());
|
||||
}
|
||||
}
|
||||
|
||||
// NONMATCHING - TPRObject_ID_equal issues
|
||||
JStudio::ctb::TObject* JStudio::ctb::TControl::getObject(void const* param_0, u32 param_1) {
|
||||
JGadget::TLinkList<TObject, -12>::iterator begin = mList.begin();
|
||||
JGadget::TLinkList<TObject, -12>::iterator end = mList.end();
|
||||
JGadget::TLinkList<TObject, -12>::iterator begin = ocObject_.begin();
|
||||
JGadget::TLinkList<TObject, -12>::iterator end = ocObject_.end();
|
||||
JGadget::TLinkList<TObject, -12>::iterator local_50 = std::find_if(begin, end, object::TPRObject_ID_equal(param_0, param_1));
|
||||
if ((local_50 != end) != false) {
|
||||
return &*local_50;
|
||||
@@ -49,11 +55,11 @@ JStudio::ctb::TObject* JStudio::ctb::TControl::getObject(void const* param_0, u3
|
||||
}
|
||||
|
||||
JStudio::ctb::TObject* JStudio::ctb::TControl::getObject_index(u32 param_0) {
|
||||
if (param_0 >= mList.size()) {
|
||||
if (param_0 >= ocObject_.size()) {
|
||||
return 0;
|
||||
}
|
||||
JGadget::TLinkList<TObject, -12>::iterator aiStack_14 = mList.begin();
|
||||
std::advance_fake(aiStack_14, param_0);
|
||||
JGadget::TLinkList<TObject, -12>::iterator aiStack_14 = ocObject_.begin();
|
||||
std::advance(aiStack_14, param_0);
|
||||
return &*aiStack_14;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "JSystem/JGadget/linklist.h"
|
||||
#include "math.h"
|
||||
#include "stdlib.h"
|
||||
#include "limits.h"
|
||||
|
||||
namespace JStudio {
|
||||
|
||||
@@ -185,7 +186,7 @@ void TFunctionValueAttribute_range::range_set(f64 begin, f64 end) {
|
||||
fEnd_ = end;
|
||||
fDifference_ = end - begin;
|
||||
|
||||
JUT_ASSERT(458, fDifference_ >= TValue(0));
|
||||
JUT_ASSERT(458, fDifference_>=TValue(0));
|
||||
}
|
||||
|
||||
// /* 80281A08-80281D18 27C348 0310+00 2/2 0/0 0/0 .text
|
||||
@@ -261,13 +262,13 @@ f64 TFunctionValue_composite::getValue(f64 arg1) {
|
||||
f64 TFunctionValue_composite::composite_raw(TVector_pointer<TFunctionValue*> const& param_1,
|
||||
TData const& param_2, f64 param_3) {
|
||||
u32 index = param_2.get_unsignedInteger();
|
||||
u32 size = param_1.size();
|
||||
if (index >= size) {
|
||||
if (index >= param_1.size()) {
|
||||
return 0.0;
|
||||
}
|
||||
TFunctionValue** local_18 = (TFunctionValue**)param_1.begin();
|
||||
std::advance_pointer(local_18, index);
|
||||
TFunctionValue* piVar4 = *local_18;
|
||||
TFunctionValue** p = (TFunctionValue**)param_1.begin();
|
||||
std::advance(p, index);
|
||||
JUT_ASSERT(0x247, p!=0);
|
||||
TFunctionValue* piVar4 = *p;
|
||||
return piVar4->getValue(param_3);
|
||||
}
|
||||
|
||||
@@ -284,9 +285,9 @@ f64 TFunctionValue_composite::composite_index(TVector_pointer<TFunctionValue*> c
|
||||
TFunctionValue** local_148 = (TFunctionValue**)param_1.begin();
|
||||
TFunctionValue* pFront = *local_148;
|
||||
JUT_ASSERT(599, pFront!=NULL);
|
||||
f64 dVar4 = pFront->getValue(param_3);
|
||||
s32 index = floor(dVar4);
|
||||
u32 uVar2 = param_2.get_unsignedInteger();
|
||||
TValue fData = pFront->getValue(param_3);
|
||||
s32 index = floor(fData);
|
||||
u32 uVar2 = param_2.get_outside();
|
||||
switch (uVar2) {
|
||||
case 0:
|
||||
case 3:
|
||||
@@ -360,8 +361,9 @@ f64 TFunctionValue_composite::composite_add(TVector_pointer<TFunctionValue*> con
|
||||
f64 dVar4 = param_2.get_value();
|
||||
TContainerEnumerator_const_TVector<TFunctionValue*> aTStack_18(param_1);
|
||||
while (aTStack_18) {
|
||||
TFunctionValue* const* ppiVar3 = *aTStack_18;
|
||||
TFunctionValue* piVar3 = *ppiVar3;
|
||||
TFunctionValue* const* p = *aTStack_18;
|
||||
JUT_ASSERT(0x2a1, p!=0);
|
||||
TFunctionValue* piVar3 = *p;
|
||||
dVar4 += piVar3->getValue(param_3);
|
||||
}
|
||||
return dVar4;
|
||||
@@ -382,8 +384,9 @@ f64 TFunctionValue_composite::composite_subtract(TVector_pointer<TFunctionValue*
|
||||
JUT_ASSERT(688, pFront!=NULL);
|
||||
f64 dVar4 = pFront->getValue(param_3);
|
||||
while (aTStack_18) {
|
||||
TFunctionValue* const* ppiVar3 = *aTStack_18;
|
||||
TFunctionValue* piVar3 = *ppiVar3;
|
||||
TFunctionValue* const* p = *aTStack_18;
|
||||
JUT_ASSERT(0x2b5, p!=0);
|
||||
TFunctionValue* piVar3 = *p;
|
||||
dVar4 -= piVar3->getValue(param_3);
|
||||
}
|
||||
dVar4 -= param_2.f32data;
|
||||
@@ -399,8 +402,9 @@ f64 TFunctionValue_composite::composite_multiply(TVector_pointer<TFunctionValue*
|
||||
f64 dVar4 = param_2.get_value();
|
||||
TContainerEnumerator_const_TVector<TFunctionValue*> aTStack_18(param_1);
|
||||
while (aTStack_18) {
|
||||
TFunctionValue* const* ppiVar3 = *aTStack_18;
|
||||
TFunctionValue* piVar3 = *ppiVar3;
|
||||
TFunctionValue* const* p = *aTStack_18;
|
||||
JUT_ASSERT(0x2c5, p!=0);
|
||||
TFunctionValue* piVar3 = *p;
|
||||
dVar4 *= piVar3->getValue(param_3);
|
||||
}
|
||||
return dVar4;
|
||||
@@ -419,18 +423,29 @@ f64 TFunctionValue_composite::composite_divide(TVector_pointer<TFunctionValue*>
|
||||
TFunctionValue* const* local_148 = *aTStack_18;
|
||||
TFunctionValue* pFront = *local_148;
|
||||
JUT_ASSERT(724, pFront!=NULL);
|
||||
f64 dVar4 = pFront->getValue(param_3);
|
||||
TValue fData = pFront->getValue(param_3);
|
||||
while (aTStack_18) {
|
||||
TFunctionValue* const* ppiVar3 = *aTStack_18;
|
||||
TFunctionValue* piVar3 = *ppiVar3;
|
||||
dVar4 /= piVar3->getValue(param_3);
|
||||
TFunctionValue* const* p = *aTStack_18;
|
||||
JUT_ASSERT(0x2d9, p!=0);
|
||||
TFunctionValue* piVar3 = *p;
|
||||
fData /= piVar3->getValue(param_3);
|
||||
JGADGET_ASSERTWARN(0x2db, fData!=TValue(0));
|
||||
}
|
||||
dVar4 /= param_2.f32data;
|
||||
return dVar4;
|
||||
#if DEBUG
|
||||
TValue v = param_2.get_value();
|
||||
JGADGET_ASSERTWARN(0x2df, fData!=TValue(0));
|
||||
#endif
|
||||
fData /= param_2.f32data;
|
||||
return fData;
|
||||
}
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
#define NUMERIC_LIMIT double
|
||||
#else
|
||||
#define NUMERIC_LIMIT float
|
||||
#endif
|
||||
|
||||
TFunctionValue_constant::TFunctionValue_constant() : fValue_(NAN) {}
|
||||
TFunctionValue_constant::TFunctionValue_constant() : fValue_(std::numeric_limits<NUMERIC_LIMIT>::signaling_NaN()) {}
|
||||
|
||||
u32 TFunctionValue_constant::getType() const {
|
||||
return 2;
|
||||
@@ -654,7 +669,7 @@ f64 TFunctionValue_list::update_INTERPOLATE_BSPLINE_dataMore3_(
|
||||
dVar8 = rThis._44[param_2._10 + 2];
|
||||
}
|
||||
}
|
||||
functionvalue::interpolateValue_BSpline_uniform(param_2._0 - param_2._8, dVar9, dVar11, dVar10, dVar8);
|
||||
return functionvalue::interpolateValue_BSpline_uniform(param_2._0 - param_2._8, dVar9, dVar11, dVar10, dVar8);
|
||||
}
|
||||
|
||||
|
||||
@@ -678,7 +693,7 @@ void TFunctionValue_list_parameter::data_set(const f32* pf, u32 u) {
|
||||
dat1.set(pfData_);
|
||||
dat2.set(&pfData_[uData_ * 2]);
|
||||
dat3 = dat1;
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
pfnUpdate_ = NULL;
|
||||
#endif
|
||||
}
|
||||
@@ -778,8 +793,8 @@ f64 TFunctionValue_list_parameter::update_INTERPOLATE_BSPLINE_dataMore3_(
|
||||
local_68[2] = pfVar2[1];
|
||||
local_48[2] = pfVar2[-2];
|
||||
local_48[3] = pfVar2[0];
|
||||
s32 iVar5 = ((int)pfVar2 - (int)rThis.dat1.get()) / 4;
|
||||
s32 iVar3 = ((int)rThis.dat2.get() - (int)pfVar2) / 4;
|
||||
s32 iVar5 = ((intptr_t)pfVar2 - (intptr_t)rThis.dat1.get()) / 4;
|
||||
s32 iVar3 = ((intptr_t)rThis.dat2.get() - (intptr_t)pfVar2) / 4;
|
||||
switch(iVar5) {
|
||||
case 2:
|
||||
local_68[0] = 2.0 * local_68[1] - local_68[2];
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
|
||||
#include "JSystem/JStudio/JStudio/fvb-data-parse.h"
|
||||
|
||||
void JStudio::fvb::data::TParse_TParagraph::getData(TParse_TParagraph::TData* data) const
|
||||
void JStudio::fvb::data::TParse_TParagraph::getData(TParse_TParagraph::TData* pData) const
|
||||
{
|
||||
u16* parse = (u16*)JGadget::binary::parseVariableUInt_16_32_following(getRaw(), (u32*)data, (u32*)&data->u32Type, NULL);
|
||||
u32 t = (u32)data->u32Size;
|
||||
JUT_ASSERT(24, pData!=NULL);
|
||||
const void *ptr = getRaw();
|
||||
ptr = JGadget::binary::parseVariableUInt_16_32_following(ptr, (u32*)pData, (u32*)&pData->u32Type, NULL);
|
||||
u32 t = (u32)pData->u32Size;
|
||||
if (!t) {
|
||||
data->pContent = NULL;
|
||||
data->next = parse;
|
||||
pData->pContent = NULL;
|
||||
pData->next = (const u16*)ptr;
|
||||
} else {
|
||||
data->pContent = parse;
|
||||
data->next = parse + ((t + 3) >> 1 & ~1);
|
||||
pData->pContent = (const u16*)ptr;
|
||||
pData->next = (u8*)ptr + JGadget::binary::align_roundUp(t, 4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ bool TParse::parseHeader_next(void const** ppData_inout, u32* puBlock_out, u32 f
|
||||
u16 version = header.get_version();
|
||||
if (version < 2) {
|
||||
JUTWarn w;
|
||||
w << "obselete version : " << (long)0;
|
||||
w << "obselete version : " << (s32)0;
|
||||
return false;
|
||||
} else if (version > 0x100) {
|
||||
JUTWarn w;
|
||||
|
||||
@@ -48,7 +48,7 @@ int JStudio::TControl::transformOnGet_setOrigin_TxyzRy(Vec const& param_0, f32 p
|
||||
|
||||
int JStudio::TControl::transform_setOrigin_ctb(JStudio::ctb::TObject const& param_0) {
|
||||
switch (param_0.getScheme()) {
|
||||
case 1:
|
||||
case 1: {
|
||||
const f32* pfVar4 = (const f32*)param_0.getData();
|
||||
Vec local_144 = {0.0f, 0.0f, 0.0f};
|
||||
local_144.x = pfVar4[0];
|
||||
@@ -56,6 +56,7 @@ int JStudio::TControl::transform_setOrigin_ctb(JStudio::ctb::TObject const& para
|
||||
local_144.z = pfVar4[2];
|
||||
transform_setOrigin_TxyzRy(local_144, pfVar4[3]);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -79,15 +80,25 @@ void JStudio::TFactory::appendCreateObject(JStudio::TCreateObject* param_0) {
|
||||
mList.Push_back(param_0);
|
||||
}
|
||||
|
||||
JStudio::TObject* JStudio::TFactory::create(JStudio::stb::data::TParse_TBlock_object const& param_0) {
|
||||
JGadget::TContainerEnumerator<TCreateObject, -4> aTStack_368(&mList);
|
||||
|
||||
JStudio::TObject* JStudio::TFactory::create(JStudio::stb::data::TParse_TBlock_object const& rParse) {
|
||||
JGadget::TContainerEnumerator<JGadget::TLinkList<TCreateObject, -4> > aTStack_368(mList);
|
||||
while(aTStack_368) {
|
||||
TCreateObject& piVar1 = *aTStack_368;
|
||||
JStudio::TObject* obj;
|
||||
if (piVar1.create(&obj, param_0)) {
|
||||
if (piVar1.create(&obj, rParse)) {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
#if DEBUG
|
||||
u32 type = rParse.get_type();
|
||||
char a5c[8];
|
||||
stb::data::toString_block(a5c, type);
|
||||
const char* szID = (const char*)rParse.get_ID();
|
||||
JGADGET_ASSERTWARN(0x108, rParse.get_IDSize()>0);
|
||||
JGADGET_ASSERTWARN(0x109, szID[rParse.get_IDSize()-1]=='\\0');
|
||||
JGADGET_WARNMSG3(0x10c, "ID not found\n demo object : ", szID, "\n type : ", a5c);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,12 +73,16 @@ void JStudio::TVariableValue::update_immediate_(JStudio::TVariableValue* param_0
|
||||
}
|
||||
|
||||
void JStudio::TVariableValue::update_time_(JStudio::TVariableValue* param_0, f64 param_1) {
|
||||
param_0->mValue = param_0->field_0xc.val * (param_0->field_0x4 * param_1);
|
||||
f64 v = param_0->field_0xc.val * (param_0->field_0x4 * param_1);
|
||||
param_0->mValue = v;
|
||||
}
|
||||
|
||||
void JStudio::TVariableValue::update_functionValue_(JStudio::TVariableValue* param_0,
|
||||
f64 param_1) {
|
||||
param_0->mValue = param_0->field_0xc.fv->getValue(param_0->field_0x4 * param_1);
|
||||
|
||||
TFunctionValue *fv = param_0->field_0xc.fv;
|
||||
f64 v = fv->getValue(param_0->field_0x4 * param_1);
|
||||
param_0->mValue = v;
|
||||
}
|
||||
|
||||
JStudio::TVariableValue::TOutput_none_::~TOutput_none_() {}
|
||||
@@ -182,7 +186,7 @@ void JStudio::TAdaptor::adaptor_setVariableValue_n(JStudio::TControl* pControl,
|
||||
JGadget::TEnumerator<const u32*> enumerator(param_2, param_2 + param_3);
|
||||
while (enumerator) {
|
||||
(*pcVar6)(this, pControl, **enumerator, param_5, iVar7);
|
||||
param_5 = (const void*)((int)param_5 + iVar7);
|
||||
param_5 = (const void*)((intptr_t)param_5 + iVar7);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,45 +3,48 @@
|
||||
#include "JSystem/JStudio/JStudio/stb-data-parse.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "stdint.h"
|
||||
|
||||
namespace JStudio {
|
||||
namespace stb {
|
||||
namespace data {
|
||||
|
||||
void TParse_TSequence::getData(TData* pData) const {
|
||||
ASSERT(pData != NULL);
|
||||
JUT_ASSERT(50, pData!=NULL);
|
||||
|
||||
pData->content = NULL;
|
||||
pData->next = NULL;
|
||||
u32 head = get_head();
|
||||
u8 type = head >> 24;
|
||||
u32 param = head & 0xffffff;
|
||||
pData->type = type;
|
||||
pData->type = type & 0xff;
|
||||
pData->param = param;
|
||||
if (type != 0) {
|
||||
const void* next = (const void*)((int)getRaw() + 4);
|
||||
if (type <= 0x7f) {
|
||||
pData->next = next;
|
||||
} else {
|
||||
pData->content = next;
|
||||
pData->next = (const void*)((int)next + param);
|
||||
}
|
||||
|
||||
if (type == 0)
|
||||
return;
|
||||
|
||||
const void* next = (const void*)((intptr_t)getRaw() + 4);
|
||||
if (type <= 0x7f) {
|
||||
pData->next = next;
|
||||
} else {
|
||||
pData->content = next;
|
||||
pData->next = (const void*)((intptr_t)next + param);
|
||||
}
|
||||
}
|
||||
|
||||
void TParse_TParagraph::getData(TData* pData) const {
|
||||
ASSERT(pData != NULL);
|
||||
JUT_ASSERT(80, pData!=NULL);
|
||||
|
||||
const void* data = getRaw();
|
||||
u32 result;
|
||||
const void* next = parseVariableUInt_16_32_following(data, &result, &pData->type, NULL);
|
||||
data = parseVariableUInt_16_32_following(data, &result, &pData->type, NULL);
|
||||
pData->param = result;
|
||||
if (result == 0) {
|
||||
pData->content = NULL;
|
||||
pData->next = next;
|
||||
pData->next = data;
|
||||
} else {
|
||||
pData->content = next;
|
||||
pData->next = (const void*)((int)next + align_roundUp(result, 4));
|
||||
pData->content = data;
|
||||
pData->next = (const void*)((intptr_t)data + align_roundUp(result, 4));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,12 +67,20 @@ void TObject::setFlag_operation(u8 op, int val) {
|
||||
}
|
||||
}
|
||||
|
||||
#if !PLATFORM_SHIELD || DEBUG
|
||||
void TObject::reset(const void* arg1) {
|
||||
bSequence_ = 0;
|
||||
mStatus = STATUS_STILL;
|
||||
pSequence_next = arg1;
|
||||
u32Wait_ = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
void TObject::reset() {
|
||||
reset(NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool TObject::forward(u32 arg1) {
|
||||
bool temp = false;
|
||||
@@ -334,10 +342,10 @@ TObject* TControl::getObject(void const* param_0, u32 param_1) {
|
||||
|
||||
void TControl::reset() {
|
||||
resetStatus_();
|
||||
mObject_control.reset(NULL);
|
||||
JGadget::TContainerEnumerator<JStudio::stb::TObject, -12> aTStack_18(&mObjectContainer);
|
||||
mObject_control.reset();
|
||||
JGadget::TContainerEnumerator<JGadget::TLinkList<JStudio::stb::TObject, -12> > aTStack_18(mObjectContainer);
|
||||
while (aTStack_18) {
|
||||
(*aTStack_18).reset(NULL);
|
||||
(*aTStack_18).reset();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +354,7 @@ bool TControl::forward(u32 param_0) {
|
||||
bool rv = mObject_control.forward(param_0);
|
||||
int uVar7 = 0xf;
|
||||
int uVar6 = 0;
|
||||
JGadget::TContainerEnumerator<JStudio::stb::TObject, -12> aTStack_38(&mObjectContainer);
|
||||
JGadget::TContainerEnumerator<JGadget::TLinkList<JStudio::stb::TObject, -12> > aTStack_38(mObjectContainer);
|
||||
while (aTStack_38) {
|
||||
JStudio::stb::TObject& this_00 = *aTStack_38;
|
||||
rv = this_00.forward(param_0) || rv;
|
||||
@@ -397,7 +405,7 @@ bool TParse::parseHeader_next(const void** ppData_inout, u32* puBlock_out, u32 f
|
||||
u16 version = header.get_version();
|
||||
if (version < 1) {
|
||||
JUTWarn w;
|
||||
w << "obselete version : " << (long)0;
|
||||
w << "obselete version : " << (s32)0;
|
||||
return false;
|
||||
} else if (version > 3) {
|
||||
JUTWarn w;
|
||||
|
||||
@@ -109,11 +109,11 @@ void JStudio_JAudio2::TAdaptor_sound::adaptor_do_update(u32 param_1) {
|
||||
JUT_ASSERT(196, pControl!=NULL);
|
||||
JStudio::TControl::TTransform_position VStack_148;
|
||||
JStudio::TControl::TTransform_position VStack_154;
|
||||
JStudio::TControl::TTransform_position* pVVar2;
|
||||
const JStudio::TControl::TTransform_position* pVVar2;
|
||||
adaptor_getVariableValue_Vec(&VStack_148,
|
||||
JStudio::TAdaptor_sound::sauVariableValue_3_POSITION_XYZ);
|
||||
if (field_0x144 == 0) {
|
||||
pVVar2 = pControl->transformOnSet_transform_ifEnabled(&VStack_148, &VStack_154);
|
||||
pVVar2 = pControl->transformOnSet_transform_ifEnabled(VStack_148, &VStack_154);
|
||||
} else {
|
||||
if (!JStudio_JStage::transform_toGlobalFromLocal(&VStack_154, VStack_148, field_0x13c, field_0x140)) {
|
||||
return;
|
||||
|
||||
@@ -281,10 +281,10 @@ JStudio_JParticle::TAdaptor_particle::TJPACallback_emitter_::execute(JPABaseEmit
|
||||
&VStack_19c.scaling,
|
||||
sauVariableValue_3_SCALING_XYZ);
|
||||
if (pThis_->field_0x1d8 == 0) {
|
||||
JStudio::TControl::TTransform_translation_rotation_scaling* pVVar9 = &VStack_19c;
|
||||
const JStudio::TControl::TTransform_translation_rotation_scaling* pVVar9 = &VStack_19c;
|
||||
switch(pThis_->field_0x1cc) {
|
||||
case 0:
|
||||
pVVar9 = pControl->transformOnSet_transform_ifEnabled(&VStack_19c, &aTStack_1c0);
|
||||
pVVar9 = pControl->transformOnSet_transform_ifEnabled(VStack_19c, &aTStack_1c0);
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
JStudio_JStage::TAdaptor_actor::TAdaptor_actor(JStage::TSystem const* param_1,
|
||||
JStage::TActor* param_2) :
|
||||
TAdaptor_object_(param_1,param_2) {
|
||||
TAdaptor_object_(this, param_1,param_2) {
|
||||
field_0x130 = 0;
|
||||
field_0x134 = 0;
|
||||
field_0x138 = 0;
|
||||
@@ -36,7 +36,7 @@ void JStudio_JStage::TAdaptor_actor::adaptor_do_prepare() {
|
||||
void JStudio_JStage::TAdaptor_actor::adaptor_do_begin() {
|
||||
adaptor_object_begin_();
|
||||
const JStage::TActor* pActor = get_pJSG_();
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
{ // This block is needed to match the stack in debug
|
||||
const JStudio::TObject* pObject = adaptor_getObject();
|
||||
JUT_ASSERT(72, pObject!=NULL);
|
||||
@@ -265,9 +265,9 @@ void JStudio_JStage::TAdaptor_actor::setJSG_SRT_(JStudio::TControl const* pContr
|
||||
adaptor_getVariableValue_Vec(&transform.translation, sauVariableValue_3_TRANSLATION_XYZ);
|
||||
adaptor_getVariableValue_Vec(&transform.rotation, sauVariableValue_3_ROTATION_XYZ);
|
||||
adaptor_getVariableValue_Vec(&transform.scaling, sauVariableValue_3_SCALING_XYZ);
|
||||
JStudio::TControl::TTransform_translation_rotation_scaling* pTransform;
|
||||
const JStudio::TControl::TTransform_translation_rotation_scaling* pTransform;
|
||||
if (field_0x144 == 0) {
|
||||
pTransform = pControl->transformOnSet_transform_ifEnabled(&transform, &multipliedTransform);
|
||||
pTransform = pControl->transformOnSet_transform_ifEnabled(transform, &multipliedTransform);
|
||||
} else {
|
||||
pTransform = &transform;
|
||||
switch (field_0x138) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
JStudio_JStage::TAdaptor_ambientLight::TAdaptor_ambientLight(JStage::TSystem const* param_1,
|
||||
JStage::TAmbientLight* param_2)
|
||||
: TAdaptor_object_(param_1, param_2) {}
|
||||
: TAdaptor_object_(this, param_1, param_2) {}
|
||||
|
||||
JStudio_JStage::TAdaptor_ambientLight::~TAdaptor_ambientLight() {
|
||||
adaptor_do_end();
|
||||
@@ -19,7 +19,8 @@ void JStudio_JStage::TAdaptor_ambientLight::adaptor_do_prepare() {
|
||||
|
||||
void JStudio_JStage::TAdaptor_ambientLight::adaptor_do_begin() {
|
||||
adaptor_object_begin_();
|
||||
GXColor color = get_pJSG_()->JSGGetColor();
|
||||
JStage::TAmbientLight* light = get_pJSG_();
|
||||
GXColor color = light->JSGGetColor();
|
||||
adaptor_setVariableValue_GXColor(sauVariableValue_4_COLOR_RGBA, color);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
JStudio_JStage::TAdaptor_camera::TAdaptor_camera(JStage::TSystem const* param_1,
|
||||
JStage::TCamera* param_2)
|
||||
: TAdaptor_object_(param_1, param_2) {
|
||||
: TAdaptor_object_(this, param_1, param_2) {
|
||||
field_0x108 = 0;
|
||||
field_0x10c = 0;
|
||||
field_0x110 = -1;
|
||||
@@ -117,9 +117,9 @@ JStudio_JStage::TAdaptor_camera::adaptor_do_PARENT_ENABLE(JStudio::data::TEOpera
|
||||
case JStudio::data::UNK_0x2:
|
||||
JUT_ASSERT(185, uSize==4);
|
||||
JUT_ASSERT(186, pContent!=NULL);
|
||||
field_0x114 = *(u32*)pContent ? 1 : 0;
|
||||
field_0x114 = *(u32*)pContent ? true : false;
|
||||
switch(field_0x108) {
|
||||
case 1:
|
||||
case 1: {
|
||||
JStage::TObject* parent = 0;
|
||||
int idx = -1;
|
||||
if (field_0x114 != 0) {
|
||||
@@ -128,6 +128,7 @@ JStudio_JStage::TAdaptor_camera::adaptor_do_PARENT_ENABLE(JStudio::data::TEOpera
|
||||
}
|
||||
pJSGObject_->JSGSetParent(parent, idx);
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
@@ -201,13 +202,13 @@ void JStudio_JStage::TAdaptor_camera::setJSG_position_(JStudio::TControl const*
|
||||
JStudio::TControl::TTransform_position VStack_138;
|
||||
JStudio::TControl::TTransform_position VStack_144;
|
||||
adaptor_getVariableValue_Vec(&VStack_138, sauVariableValue_3_POSITION_XYZ);
|
||||
Vec* pViewPosition;
|
||||
const Vec* pViewPosition;
|
||||
if (field_0x114 == 0) {
|
||||
pViewPosition = param_1->transformOnSet_transform_ifEnabled(&VStack_138, &VStack_144);
|
||||
pViewPosition = param_1->transformOnSet_transform_ifEnabled(VStack_138, &VStack_144);
|
||||
} else {
|
||||
pViewPosition = &VStack_138;
|
||||
switch (field_0x108) {
|
||||
case 0:
|
||||
case 0: {
|
||||
int iVar1 =
|
||||
transform_toGlobalFromLocal(&VStack_144, VStack_138, field_0x10c, field_0x110);
|
||||
if (iVar1 == 0) {
|
||||
@@ -215,6 +216,7 @@ void JStudio_JStage::TAdaptor_camera::setJSG_position_(JStudio::TControl const*
|
||||
}
|
||||
pViewPosition = &VStack_144;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
break;
|
||||
}
|
||||
@@ -226,12 +228,12 @@ void JStudio_JStage::TAdaptor_camera::getJSG_position_(JStudio::TControl const*
|
||||
Mtx mtx;
|
||||
JStudio::TControl::TTransform_position transform;
|
||||
JStudio::TControl::TTransform_position tempTransform;
|
||||
JStudio::TControl::TTransform_position* outTransform;
|
||||
const JStudio::TControl::TTransform_position* outTransform;
|
||||
|
||||
get_pJSG_()->JSGGetViewPosition(&transform);
|
||||
|
||||
if (!field_0x114) {
|
||||
outTransform = param_1->transformOnGet_transform_ifEnabled(&transform, &tempTransform);
|
||||
outTransform = param_1->transformOnGet_transform_ifEnabled(transform, &tempTransform);
|
||||
} else {
|
||||
outTransform = &transform;
|
||||
switch (field_0x108) {
|
||||
@@ -262,11 +264,11 @@ void JStudio_JStage::TAdaptor_camera::getJSG_position_(JStudio::TControl const*
|
||||
void JStudio_JStage::TAdaptor_camera::setJSG_targetPosition_(JStudio::TControl const* param_1) {
|
||||
JStudio::TControl::TTransform_position transform;
|
||||
JStudio::TControl::TTransform_position tempTransform;
|
||||
JStudio::TControl::TTransform_position* outTransform;
|
||||
const JStudio::TControl::TTransform_position* outTransform;
|
||||
adaptor_getVariableValue_Vec(&transform, sauVariableValue_3_TARGET_POSITION_XYZ);
|
||||
if (field_0x120 == 0) {
|
||||
outTransform = param_1->transformOnSet_transform_ifEnabled(
|
||||
&transform, &tempTransform);
|
||||
transform, &tempTransform);
|
||||
} else {
|
||||
if (transform_toGlobalFromLocal(&tempTransform, transform,
|
||||
field_0x118, field_0x11c) == 0) {
|
||||
@@ -281,12 +283,12 @@ void JStudio_JStage::TAdaptor_camera::getJSG_targetPosition_(JStudio::TControl c
|
||||
Mtx mtx;
|
||||
JStudio::TControl::TTransform_position transform;
|
||||
JStudio::TControl::TTransform_position tempTransform;
|
||||
JStudio::TControl::TTransform_position* outTransform;
|
||||
const JStudio::TControl::TTransform_position* outTransform;
|
||||
|
||||
get_pJSG_()->JSGGetViewTargetPosition(&transform);
|
||||
|
||||
if (!field_0x120) {
|
||||
outTransform = param_1->transformOnGet_transform_ifEnabled(&transform, &tempTransform);
|
||||
outTransform = param_1->transformOnGet_transform_ifEnabled(transform, &tempTransform);
|
||||
} else {
|
||||
outTransform = &transform;
|
||||
bool check;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "JSystem/JStudio/JStudio_JStage/object-fog.h"
|
||||
|
||||
JStudio_JStage::TAdaptor_fog::TAdaptor_fog(JStage::TSystem const* param_0, JStage::TFog* param_1)
|
||||
: TAdaptor_object_(param_0, param_1) {}
|
||||
: TAdaptor_object_(this, param_0, param_1) {}
|
||||
|
||||
JStudio_JStage::TAdaptor_fog::~TAdaptor_fog() {
|
||||
adaptor_do_end();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
JStudio_JStage::TAdaptor_light::TAdaptor_light(JStage::TSystem const* param_1,
|
||||
JStage::TLight* param_2)
|
||||
: JStudio_JStage::TAdaptor_object_(param_1, param_2) {
|
||||
: JStudio_JStage::TAdaptor_object_(this, param_1, param_2) {
|
||||
field_0x11c = 0;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ void JStudio_JStage::TAdaptor_light::adaptor_do_prepare() {
|
||||
}
|
||||
}
|
||||
|
||||
// NONMATCHING - regalloc
|
||||
void JStudio_JStage::TAdaptor_light::adaptor_do_begin() {
|
||||
{
|
||||
adaptor_object_begin_();
|
||||
@@ -55,8 +54,9 @@ void JStudio_JStage::TAdaptor_light::adaptor_do_begin() {
|
||||
JStudio::TControl::TTransform_position_direction aTStack_b8;
|
||||
pLightObj->JSGGetPosition(&lightObjTransform.position);
|
||||
pLightObj->JSGGetDirection(&lightObjTransform.direction);
|
||||
JStudio::TControl::TTransform_position_direction* finalTransform =
|
||||
pControl->transformOnGet_transform_ifEnabled(lightObjTransform, &aTStack_b8);
|
||||
const JStudio::TControl::TTransform_position_direction* finalTransform =
|
||||
(const JStudio::TControl::TTransform_position_direction*)
|
||||
pControl->transformOnGet_transform_ifEnabled(lightObjTransform, &aTStack_b8);
|
||||
adaptor_setVariableValue_Vec(sauVariableValue_3_POSITION_XYZ, finalTransform->position);
|
||||
f32 dirx = finalTransform->direction.x;
|
||||
f32 diry = finalTransform->direction.y;
|
||||
@@ -106,8 +106,8 @@ void JStudio_JStage::TAdaptor_light::adaptor_do_update(u32 param_1) {
|
||||
adaptor_getVariableValue_Vec(&VStack_1c0, sauVariableValue_3_TARGET_POSITION_XYZ);
|
||||
VECSubtract(&VStack_1c0, &VStack_198.position, &VStack_198.direction);
|
||||
}
|
||||
JStudio::TControl::TTransform_position_direction* pTrans =
|
||||
pControl->transformOnSet_transform_ifEnabled(&VStack_198, &aTStack_1b0);
|
||||
const JStudio::TControl::TTransform_position_direction* pTrans =
|
||||
pControl->transformOnSet_transform_ifEnabled(VStack_198, &aTStack_1b0);
|
||||
lightObj->JSGSetPosition(pTrans->position);
|
||||
lightObj->JSGSetDirection(pTrans->direction);
|
||||
pJSGObject_->JSGUpdate();
|
||||
@@ -152,5 +152,7 @@ void JStudio_JStage::TAdaptor_light::adaptor_do_ENABLE(JStudio::data::TEOperatio
|
||||
|
||||
void JStudio_JStage::TAdaptor_light::TVVOutput_direction_::operator()(
|
||||
f32 param_0, JStudio::TAdaptor* param_1) const {
|
||||
((JStudio_JStage::TAdaptor_light*)param_1)->field_0x11c = field_0x8;
|
||||
JStudio_JStage::TAdaptor_light* p = (JStudio_JStage::TAdaptor_light*)param_1;
|
||||
JUT_ASSERT(246, p!=NULL);
|
||||
p->field_0x11c = field_0x8;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "JSystem/JSupport/JSUInputStream.h"
|
||||
#include "JSystem/JSupport/JSURandomInputStream.h"
|
||||
#include <dolphin.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
JSUInputStream::~JSUInputStream() {
|
||||
if (!isGood()) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "JSystem/JSupport/JSUOutputStream.h"
|
||||
#include "JSystem/JSupport/JSURandomOutputStream.h"
|
||||
#include <dolphin.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
#include <cstring.h>
|
||||
|
||||
JSUOutputStream::~JSUOutputStream() {
|
||||
|
||||
@@ -130,10 +130,6 @@ void showAssert_f(u32 device, const char* file, int line, const char* msg, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void showAssert(u32 device, const char* file, int line, const char* msg) {
|
||||
showAssert_f(device, file, line, "%s", msg);
|
||||
}
|
||||
|
||||
void setWarningMessage_f_va(u32 device, const char* file, int line, const char* msg, va_list args) {
|
||||
u32 messageLife = sMessageLife;
|
||||
bool r26 = false;
|
||||
|
||||
@@ -277,9 +277,9 @@ void JUTCacheFont::setBlock() {
|
||||
break;
|
||||
case 'GLY1':
|
||||
memcpy(piVar5, pData, 0x20);
|
||||
JKRAramBlock* iVar1 =
|
||||
JKRMainRamToAram((u8*)pData + 0x20, aramAddress, pData[1] - 0x20,
|
||||
EXPAND_SWITCH_UNKNOWN0, 0, NULL, 0xffffffff, NULL);
|
||||
JKRAramBlock* iVar1;
|
||||
iVar1 = JKRMainRamToAram((u8*)pData + 0x20, aramAddress, pData[1] - 0x20,
|
||||
EXPAND_SWITCH_UNKNOWN0, 0, NULL, 0xffffffff, NULL);
|
||||
if (iVar1 == NULL) {
|
||||
JUTException::panic("JUTCacheFont.cpp", 0x1dd,
|
||||
"trouble occurred in JKRMainRamToAram.");
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <dolphin.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
#include <stdint.h>
|
||||
|
||||
OSMessageQueue JUTException::sMessageQueue = {0};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include <dolphin.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
#include "global.h"
|
||||
|
||||
extern u8 const JUTResFONT_Ascfont_fix12[16736] ATTRIBUTE_ALIGN(32) = {
|
||||
|
||||
@@ -126,14 +126,15 @@ void JUTResFont::setBlock() {
|
||||
mMaxCode = -1;
|
||||
|
||||
BlockHeader* data = (BlockHeader*)mResFont->data;
|
||||
for (u32 i = 0; i < mResFont->numBlocks; i++, data = (BlockHeader*)data->getNext()) {
|
||||
for (u32 i = 0; i < mResFont->numBlocks; data = (BlockHeader*)data->getNext(), i++) {
|
||||
switch (data->magic) {
|
||||
case 'INF1':
|
||||
mInf1Ptr = (ResFONT::INF1*)data;
|
||||
case 'INF1': {
|
||||
mInf1Ptr = (ResFONT::INF1*)data;
|
||||
u32 u = mInf1Ptr->fontType;
|
||||
JUT_ASSERT(244, u < suAboutEncoding_);
|
||||
mIsLeadByte = &saoAboutEncoding_[u];
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'WID1':
|
||||
mpWidthBlocks[widthNum] = (ResFONT::WID1*)data;
|
||||
|
||||
@@ -31,7 +31,9 @@ inline ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last,
|
||||
template <class ForwardIterator, class T>
|
||||
ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, const T& val) {
|
||||
// For some reason, calling the other lower_bound matches for debug, but not for retail:
|
||||
// return lower_bound(first, last, val, std::detail::less<T, T>());
|
||||
#if DEBUG
|
||||
return lower_bound(first, last, val, std::detail::less<T, T>());
|
||||
#else
|
||||
|
||||
typedef typename iterator_traits<ForwardIterator>::difference_type difference_type;
|
||||
difference_type len = std::distance(first, last);
|
||||
@@ -50,6 +52,7 @@ ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, const T
|
||||
}
|
||||
|
||||
return first;
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class ForwardIterator, class T, class Predicate>
|
||||
@@ -73,6 +76,7 @@ ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last, const T
|
||||
return first;
|
||||
}
|
||||
|
||||
// should be inline, but breaks JStudio/JStudio/ctb weak function order
|
||||
template<class InputIt, class UnaryPredicate>
|
||||
InputIt find_if(InputIt first, InputIt last, UnaryPredicate p) {
|
||||
while (first != last && !p(*first)) {
|
||||
@@ -155,7 +159,7 @@ struct __copy_backward<T, true>
|
||||
{
|
||||
static T* copy_backward(T* first, T* last, T* result)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
size_t n = static_cast<size_t>(last - first);
|
||||
result -= n;
|
||||
memmove(result, first, n*sizeof(T));
|
||||
|
||||
@@ -16,10 +16,10 @@ template<size_t N> class __bitset_base {
|
||||
public:
|
||||
__bitset_base();
|
||||
|
||||
bool test(size_t pos) const;
|
||||
bool any() const;
|
||||
void set(size_t pos, bool val);
|
||||
void reset(size_t pos);
|
||||
bool test(size_t pos) const;
|
||||
bool any() const;
|
||||
private:
|
||||
size_t data[N];
|
||||
};
|
||||
@@ -28,10 +28,20 @@ template<> class __bitset_base<1> {
|
||||
public:
|
||||
__bitset_base() { data = 0; }
|
||||
|
||||
bool test(size_t pos) const { return data & (1 << pos); }
|
||||
bool test(size_t pos) const {
|
||||
u32 r31 = 1UL << pos;
|
||||
return data & r31;
|
||||
}
|
||||
bool any() const { return data != 0; }
|
||||
void set(size_t pos, bool val) { data |= (1 << pos); }
|
||||
void reset(size_t pos) { data &= ~(1 << pos); }
|
||||
void set(size_t pos, bool val) {
|
||||
u32 r31 = 1UL << pos;
|
||||
if (val) {
|
||||
data |= r31;
|
||||
} else {
|
||||
data &= ~r31;
|
||||
}
|
||||
}
|
||||
void reset(size_t pos) { data &= ~(1UL << pos); }
|
||||
private:
|
||||
size_t data;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef STD_NEW_H_
|
||||
#define STD_NEW_H_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
inline void* (operator new)(size_t, void *ptr) { return ptr; }
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,90 @@
|
||||
#ifndef MSL_TYPE_TRAITS_H_
|
||||
#define MSL_TYPE_TRAITS_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
namespace std {
|
||||
// helper class
|
||||
template<class T, T v> struct integral_constant { static const T value = v;};
|
||||
|
||||
typedef integral_constant<bool, true> true_type;
|
||||
typedef integral_constant<bool, false> false_type;
|
||||
|
||||
template <bool B, typename T = void>
|
||||
struct enable_if {};
|
||||
|
||||
template <typename T>
|
||||
struct enable_if<true, T> { typedef T type; };
|
||||
|
||||
template<class T> struct remove_reference { typedef T type; };
|
||||
template<class T> struct remove_reference<T&> { typedef T type; };
|
||||
|
||||
template<bool B, class T, class F>
|
||||
struct conditional { typedef T type; };
|
||||
|
||||
template<class T, class F>
|
||||
struct conditional<false, T, F> { typedef F type; };
|
||||
|
||||
template<class T>
|
||||
struct is_array : false_type {};
|
||||
|
||||
template<class T>
|
||||
struct is_array<T[]> : std::true_type {};
|
||||
|
||||
template<class T, size_t N>
|
||||
struct is_array<T[N]> : std::true_type {};
|
||||
|
||||
template <typename T>
|
||||
struct add_pointer
|
||||
{
|
||||
typedef T* type;
|
||||
};
|
||||
template <typename T>
|
||||
struct add_pointer<T&>
|
||||
{
|
||||
typedef T* type;
|
||||
};
|
||||
template <typename T>
|
||||
struct add_pointer<T const&>
|
||||
{
|
||||
typedef T* type;
|
||||
};
|
||||
template <typename T>
|
||||
struct add_pointer<T volatile&>
|
||||
{
|
||||
typedef T* type;
|
||||
};
|
||||
template <typename T>
|
||||
struct add_pointer<T const volatile&>
|
||||
{
|
||||
typedef T* type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_extent { typedef T type; };
|
||||
|
||||
template<class T>
|
||||
struct remove_extent<T[]> { typedef T type; };
|
||||
|
||||
template<class T, size_t N>
|
||||
struct remove_extent<T[N]> { typedef T type; };
|
||||
|
||||
template<class T> struct remove_cv { typedef T type; };
|
||||
template<class T> struct remove_cv<const T> { typedef T type; };
|
||||
template<class T> struct remove_cv<volatile T> { typedef T type; };
|
||||
template<class T> struct remove_cv<const volatile T> { typedef T type; };
|
||||
|
||||
template<class T> struct remove_const { typedef T type; };
|
||||
template<class T> struct remove_const<const T> { typedef T type; };
|
||||
|
||||
template<class T> struct remove_volatile { typedef T type; };
|
||||
template<class T> struct remove_volatile<volatile T> { typedef T type; };
|
||||
|
||||
template<class T, class U>
|
||||
struct is_same : std::false_type {};
|
||||
|
||||
template<class T>
|
||||
struct is_same<T, T> : std::true_type {};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -39,6 +39,14 @@ inline float tan(float num) {
|
||||
return ::i_tanf(num);
|
||||
}
|
||||
|
||||
inline float tanf(float num) {
|
||||
return ::i_tanf(num);
|
||||
}
|
||||
|
||||
inline float acos(float num) {
|
||||
return ::acosf(num);
|
||||
}
|
||||
|
||||
inline float pow(float x, float y) {
|
||||
return ::pow(x, y);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
namespace std {
|
||||
using ::strlen;
|
||||
using ::strcpy;
|
||||
using ::wcslen;
|
||||
using ::strncpy;
|
||||
using ::strcmp;
|
||||
using ::strncmp;
|
||||
using ::strcat;
|
||||
|
||||
using ::memset;
|
||||
using ::memcpy;
|
||||
|
||||
inline char* strchr(char* str, int c) {
|
||||
return ::strchr(str, c);
|
||||
|
||||
@@ -12,10 +12,16 @@
|
||||
|
||||
#define FP_NAN FP_QNAN
|
||||
|
||||
#if __REVOLUTION_SDK__
|
||||
#define fpclassify(x) \
|
||||
((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : \
|
||||
(sizeof(x) == sizeof(double)) ? __fpclassifyd((double)(x)) : \
|
||||
__fpclassifyl((long double)(x)) )
|
||||
#else
|
||||
#define fpclassify(x) \
|
||||
((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : \
|
||||
__fpclassifyd((double)(x)) )
|
||||
#endif
|
||||
#define signbit(x) ((sizeof(x) == sizeof(float)) ? __signbitf(x) : __signbitd(x))
|
||||
#define isfinite(x) ((fpclassify(x) > FP_INFINITE))
|
||||
#define isnan(x) (fpclassify(x) == FP_NAN)
|
||||
@@ -26,27 +32,25 @@
|
||||
// TODO: OK?
|
||||
#define __signbitd(x) ((int)(__HI(x) & 0x80000000))
|
||||
|
||||
extern unsigned long __float_nan[];
|
||||
extern unsigned long __float_huge[];
|
||||
extern unsigned long __float_max[];
|
||||
extern unsigned long __float_epsilon[];
|
||||
extern int __float_nan[];
|
||||
extern int __float_huge[];
|
||||
extern int __float_max[];
|
||||
extern int __float_epsilon[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
inline int __fpclassifyf(float __value) {
|
||||
unsigned long integer = *(unsigned long*)&__value;
|
||||
|
||||
switch (integer & 0x7f800000) {
|
||||
switch (*(int*)&__value & 0x7f800000) {
|
||||
case 0x7f800000:
|
||||
if ((integer & 0x7fffff) != 0) {
|
||||
if ((*(int*)&__value & 0x7fffff) != 0) {
|
||||
return FP_QNAN;
|
||||
}
|
||||
return FP_INFINITE;
|
||||
|
||||
case 0:
|
||||
if ((integer & 0x7fffff) != 0) {
|
||||
if ((*(int*)&__value & 0x7fffff) != 0) {
|
||||
return FP_SUBNORMAL;
|
||||
}
|
||||
return FP_ZERO;
|
||||
@@ -89,7 +93,7 @@ int __fpclassifyl(long double __value);
|
||||
#define FLT_MAX_EXP 128
|
||||
#define FLT_MAX_10_EXP 38
|
||||
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
#define FLT_MAX 3.4028235e38f
|
||||
#define FLT_EPSILON 1.1920929e-7f
|
||||
#else
|
||||
|
||||
@@ -104,8 +104,20 @@ class numeric_limits<float> {
|
||||
public:
|
||||
inline static float min();
|
||||
inline static float max() { return FLT_MAX; }
|
||||
inline static float signaling_NaN() { return *(float*)__float_nan; }
|
||||
};
|
||||
|
||||
#if __REVOLUTION_SDK__
|
||||
template <>
|
||||
class numeric_limits<double> {
|
||||
public:
|
||||
static const unsigned long long x = 0x7ff0000000000001ULL;
|
||||
inline static double min();
|
||||
inline static double max();
|
||||
inline static double signaling_NaN() { return *reinterpret_cast<const double*>(&x); }
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace std
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -98,11 +98,12 @@ inline float sqrtf(float mag) {
|
||||
static const double _three = 3.0;
|
||||
#endif
|
||||
if (mag > 0.0f) {
|
||||
double tmpd = __frsqrte(mag);
|
||||
tmpd = tmpd * _half * (_three - mag * (tmpd * tmpd));
|
||||
tmpd = tmpd * _half * (_three - mag * (tmpd * tmpd));
|
||||
tmpd = tmpd * _half * (_three - mag * (tmpd * tmpd));
|
||||
return mag * tmpd;
|
||||
double dmag = (double)mag;
|
||||
double tmpd = __frsqrte(dmag);
|
||||
tmpd = _half * tmpd * (_three - tmpd * tmpd * dmag);
|
||||
tmpd = _half * tmpd * (_three - tmpd * tmpd * dmag);
|
||||
tmpd = _half * tmpd * (_three - tmpd * tmpd * dmag);
|
||||
return (float)(dmag * tmpd);
|
||||
} else if (mag < 0.0) {
|
||||
return NAN;
|
||||
} else if (isnan(mag)) {
|
||||
|
||||
@@ -15,8 +15,17 @@ int snprintf(char* s, size_t n, const char* format, ...);
|
||||
int vsnprintf(char* s, size_t n, const char* format, va_list arg);
|
||||
int vprintf(const char* format, va_list arg);
|
||||
|
||||
int vswprintf(wchar_t* s, size_t n, const wchar_t* format, va_list arg);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace std {
|
||||
extern "C" { using ::vsnprintf; }
|
||||
extern "C" { using ::vswprintf; }
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MSL_COMMON_PRINTF_H */
|
||||
#endif /* _MSL_COMMON_PRINTF_H */
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define _MSL_COMMON_STRING_H
|
||||
|
||||
#include "stddef.h"
|
||||
#include "ansi_files.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -22,6 +23,8 @@ char* strncpy(char* dst, const char* src, size_t n);
|
||||
char* strcpy(char* dst, const char* src);
|
||||
size_t strlen(const char* str);
|
||||
|
||||
size_t wcslen(const wchar_t* s);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
#include "float.h"
|
||||
|
||||
unsigned long __float_nan[] = {0x7FFFFFFF};
|
||||
int __float_nan[] = {0x7FFFFFFF};
|
||||
|
||||
unsigned long __float_huge[] = {0x7F800000};
|
||||
int __float_huge[] = {0x7F800000};
|
||||
|
||||
unsigned long __float_max[] = {0x7F7FFFFF};
|
||||
#if !__REVOLUTION_SDK__
|
||||
int __float_max[] = {0x7F7FFFFF};
|
||||
|
||||
unsigned long __float_epsilon[] = {0x34000000};
|
||||
int __float_epsilon[] = {0x34000000};
|
||||
#endif
|
||||
|
||||
#if DEBUG
|
||||
unsigned long long __double_huge[] = {0x7ff0000000000000ULL};
|
||||
#endif
|
||||
|
||||
@@ -1000,7 +1000,7 @@ static int __pformatter(void* (*WriteProc)(void*, const char*, size_t), void* Wr
|
||||
if (format.argument_options == long_double_argument) {
|
||||
long_double_num = va_arg(arg, long double);
|
||||
} else {
|
||||
long_double_num = va_arg(arg, f64);
|
||||
long_double_num = va_arg(arg, double);
|
||||
}
|
||||
|
||||
if (!(buff_ptr = float2str(long_double_num, buff + 512, format))) {
|
||||
@@ -1015,7 +1015,7 @@ static int __pformatter(void* (*WriteProc)(void*, const char*, size_t), void* Wr
|
||||
if (format.argument_options == long_double_argument) {
|
||||
long_double_num = va_arg(arg, long double);
|
||||
} else {
|
||||
long_double_num = va_arg(arg, f64);
|
||||
long_double_num = va_arg(arg, double);
|
||||
}
|
||||
|
||||
if (!(buff_ptr = double2hex(long_double_num, buff + 512, format))) {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#ifndef __VA_ARG_H
|
||||
#define __VA_ARG_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct __va_list_struct {
|
||||
char gpr;
|
||||
@@ -13,11 +15,7 @@ typedef struct __va_list_struct {
|
||||
|
||||
typedef _va_list_struct __va_list[1];
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" void* __va_arg(_va_list_struct*, int);
|
||||
#else
|
||||
void* __va_arg(_va_list_struct*, int);
|
||||
#endif
|
||||
|
||||
#ifndef __MWERKS__
|
||||
#define __builtin_va_info(...)
|
||||
@@ -37,4 +35,12 @@ void* __va_arg(_va_list_struct*, int);
|
||||
|
||||
#define __va_copy(a, b) (*(a) = *(b))
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace std { extern "C" { using ::va_list; } }
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __VA_ARG_H */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <dolphin.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
__declspec(section ".init") void* memcpy(void* dst, const void* src, size_t n) {
|
||||
const unsigned char* s;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <dolphin.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -106,7 +106,7 @@ static const u32 __constants[] = {
|
||||
0x00000000, 0x00000000, 0x41F00000, 0x00000000, 0x41E00000, 0x00000000,
|
||||
};
|
||||
|
||||
asm u32 __cvt_fp2unsigned(register f64 d)
|
||||
asm u32 __cvt_fp2unsigned(__REGISTER f64 d)
|
||||
{
|
||||
#ifdef __MWERKS__ // clang-format off
|
||||
nofralloc
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* @param src Pointer to source data to be copied
|
||||
* @param num Number of bytes to copy
|
||||
*/
|
||||
void cLib_memCpy(void* dst, const void* src, unsigned long num) {
|
||||
void cLib_memCpy(void* dst, const void* src, u32 num) {
|
||||
memcpy(dst, src, num);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ void cLib_memCpy(void* dst, const void* src, unsigned long num) {
|
||||
* @param value Value to be set
|
||||
* @param num Number of bytes to set
|
||||
*/
|
||||
void cLib_memSet(void* ptr, int value, unsigned long num) {
|
||||
void cLib_memSet(void* ptr, int value, u32 num) {
|
||||
memset(ptr, value, num);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,19 +39,20 @@ static f32 dummy(f32 x) {
|
||||
bool cM3d_Len2dSqPntAndSegLine(f32 param_1, f32 param_2, f32 param_3, f32 param_4, f32 p5, f32 p6,
|
||||
f32* param_7, f32* param_8, f32* param_9) {
|
||||
bool retVal = false;
|
||||
f32 param_5 = p5 - param_3;
|
||||
f32 param_6 = p6 - param_4;
|
||||
f32 len = param_5 * param_5 + param_6 * param_6;
|
||||
f32 f31 = p5 - param_3;
|
||||
f32 f30 = p6 - param_4;
|
||||
f32 len = f31 * f31 + f30 * f30;
|
||||
f32 f29;
|
||||
if (cM3d_IsZero(len)) {
|
||||
*param_9 = 0.0f;
|
||||
return retVal;
|
||||
return false;
|
||||
} else {
|
||||
len = (param_5 * (param_1 - param_3) + param_6 * (param_2 - param_4)) / len;
|
||||
if (len >= 0.0f && len <= 1.0f) {
|
||||
f29 = (f31 * (param_1 - param_3) + f30 * (param_2 - param_4)) / len;
|
||||
if (f29 >= 0.0f && f29 <= 1.0f) {
|
||||
retVal = true;
|
||||
}
|
||||
*param_7 = param_3 + param_5 * len;
|
||||
*param_8 = param_4 + param_6 * len;
|
||||
*param_7 = param_3 + f31 * f29;
|
||||
*param_8 = param_4 + f30 * f29;
|
||||
*param_9 = cM3d_Len2dSq(*param_7, *param_8, param_1, param_2);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -90,10 +90,10 @@ DSError TRKInitializeTarget() {
|
||||
#define __dcbi(a, b) asm { dcbi a, b }
|
||||
#define __dcbfASM(a, b) asm { dcbf a, b }
|
||||
|
||||
void TRK__read_aram(register int c, register u32 p2, void* p3) {
|
||||
void TRK__read_aram(__REGISTER int c, __REGISTER u32 p2, void* p3) {
|
||||
u32 err;
|
||||
int i;
|
||||
register int counter;
|
||||
__REGISTER int counter;
|
||||
u16 r;
|
||||
u32 g;
|
||||
u32 x;
|
||||
@@ -131,16 +131,16 @@ void TRK__read_aram(register int c, register u32 p2, void* p3) {
|
||||
}
|
||||
}
|
||||
|
||||
void TRK__write_aram(register int c, register u32 p2, void* p3) {
|
||||
void TRK__write_aram(__REGISTER int c, __REGISTER u32 p2, void* p3) {
|
||||
u8 buff[32] ATTRIBUTE_ALIGN(32);
|
||||
u32 err;
|
||||
register int count = c;
|
||||
register u32 bf;
|
||||
__REGISTER int count = c;
|
||||
__REGISTER u32 bf;
|
||||
u32 uVar1;
|
||||
u32 size;
|
||||
u16 r;
|
||||
register u32 g;
|
||||
register int counter;
|
||||
__REGISTER u32 g;
|
||||
__REGISTER int counter;
|
||||
u32 i;
|
||||
|
||||
if ((size_t)p2 < 0x4000 || p2 + *(u32*)p3 > 0x8000000) {
|
||||
|
||||
+10
-10
@@ -71,12 +71,12 @@ DSError TRKPPCAccessFPRegister(void* srcDestPtr, u32 fpr, BOOL read);
|
||||
DSError TRKPPCAccessSpecialReg(void* value, u32* access_func, BOOL read);
|
||||
static void TRKExceptionHandler(u16);
|
||||
void TRKInterruptHandlerEnableInterrupts(void);
|
||||
void WriteFPSCR(register f64*);
|
||||
void ReadFPSCR(register f64*);
|
||||
void __TRK_set_MSR(register u32 msr);
|
||||
void WriteFPSCR(__REGISTER f64*);
|
||||
void ReadFPSCR(__REGISTER f64*);
|
||||
void __TRK_set_MSR(__REGISTER u32 msr);
|
||||
u32 __TRK_get_MSR();
|
||||
void TRK_ppc_memcpy(register void* dest, register const void* src, register int n,
|
||||
register u32 param_4, register u32 param_5);
|
||||
void TRK_ppc_memcpy(__REGISTER void* dest, __REGISTER const void* src, __REGISTER int n,
|
||||
__REGISTER u32 param_4, __REGISTER u32 param_5);
|
||||
|
||||
void TRKRestoreExtended1Block();
|
||||
void TRKUARTInterruptHandler();
|
||||
@@ -827,7 +827,7 @@ asm u32 __TRK_get_MSR() {
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
asm void __TRK_set_MSR(register u32) {
|
||||
asm void __TRK_set_MSR(__REGISTER u32) {
|
||||
// clang-format off
|
||||
nofralloc
|
||||
mtmsr r3
|
||||
@@ -835,8 +835,8 @@ asm void __TRK_set_MSR(register u32) {
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
static asm void TRK_ppc_memcpy(register void* dest, register const void* src, register int n,
|
||||
register u32 param_4, register u32 param_5) {
|
||||
static asm void TRK_ppc_memcpy(__REGISTER void* dest, __REGISTER const void* src, __REGISTER int n,
|
||||
__REGISTER u32 param_4, __REGISTER u32 param_5) {
|
||||
// clang-format off
|
||||
#define msr r8
|
||||
#define byte r9
|
||||
@@ -1113,7 +1113,7 @@ asm void TRKInterruptHandlerEnableInterrupts(void) {
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
asm void ReadFPSCR(register f64*) {
|
||||
asm void ReadFPSCR(__REGISTER f64*) {
|
||||
// clang-format off
|
||||
nofralloc
|
||||
stwu r1, -0x40(r1)
|
||||
@@ -1128,7 +1128,7 @@ asm void ReadFPSCR(register f64*) {
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
asm void WriteFPSCR(register f64*) {
|
||||
asm void WriteFPSCR(__REGISTER f64*) {
|
||||
// clang-format off
|
||||
nofralloc
|
||||
stwu r1, -0x40(r1)
|
||||
|
||||
@@ -500,7 +500,11 @@ Z2Audience::Z2Audience() : JASGlobalInstance<Z2Audience>(true), field_0x4(1.0f),
|
||||
}
|
||||
|
||||
Z2Audience::~Z2Audience() {
|
||||
// JUT_ASSERT(751, !isActive()); // TODO: need to setup rest of JASMemPool stuff
|
||||
JUT_ASSERT(751, !isActive());
|
||||
}
|
||||
|
||||
bool Z2Audience::isActive() const {
|
||||
return Z2Audible::getTotalMemCount() != Z2Audible::getFreeMemCount();
|
||||
}
|
||||
|
||||
void Z2Audience::setAudioCamera(f32 (*param_0)[4], Vec& pos, Vec& param_2, f32 param_3,
|
||||
|
||||
@@ -24,7 +24,6 @@ Z2AudioMgr::Z2AudioMgr() : mSoundStarter(true) {
|
||||
field_0x519 = false;
|
||||
}
|
||||
|
||||
// NONMATCHING JASPoolAllocObject<_> locations
|
||||
void Z2AudioMgr::init(JKRSolidHeap* heap, u32 memSize, void* baaData, JKRArchive* seqArc) {
|
||||
JAU_JASInitializer JASInitializer;
|
||||
JASInitializer.audioMemSize_ = memSize;
|
||||
@@ -62,6 +61,10 @@ void Z2AudioMgr::init(JKRSolidHeap* heap, u32 memSize, void* baaData, JKRArchive
|
||||
categoryArrangement.mItems[8].mMaxInactiveSe = 5;
|
||||
categoryArrangement.mItems[9].mMaxActiveSe = 8;
|
||||
categoryArrangement.mItems[9].mMaxInactiveSe = 4;
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
categoryArrangement.mItems[10].mMaxInactiveSe = 4;
|
||||
categoryArrangement.mItems[11].mMaxInactiveSe = 2;
|
||||
#endif
|
||||
seMgr->setCategoryArrangement(categoryArrangement);
|
||||
|
||||
seMgr->getCategory(0)->getParams()->moveVolume(Z2Param::VOL_SE_SYSTEM_DEFAULT, 0);
|
||||
@@ -74,6 +77,9 @@ void Z2AudioMgr::init(JKRSolidHeap* heap, u32 memSize, void* baaData, JKRArchive
|
||||
seMgr->getCategory(7)->getParams()->moveVolume(Z2Param::VOL_SE_CHAR_VOICE_DEFAULT, 0);
|
||||
seMgr->getCategory(8)->getParams()->moveVolume(Z2Param::VOL_SE_OBJECT_DEFAULT, 0);
|
||||
seMgr->getCategory(9)->getParams()->moveVolume(Z2Param::VOL_SE_ATMOSPHERE_DEFAULT, 0);
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
seMgr->getCategory(10)->getParams()->moveVolume(1.0f, 0);
|
||||
#endif
|
||||
|
||||
seMgr->getParams()->moveVolume(1.0f, 0);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "d/d_save.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
static const char* sSpotName[] = {
|
||||
"F_SP00",
|
||||
"F_SP103",
|
||||
@@ -1039,7 +1039,7 @@ void Z2EnvSeMgr::setHyrulSewerOpen(bool isSewerOpen) {
|
||||
}
|
||||
|
||||
bool Z2EnvSeMgr::startRiverSe(s8 param_1) {
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
const char** spotName = sSpotName;
|
||||
#endif
|
||||
|
||||
@@ -1271,7 +1271,7 @@ void Z2EnvSeMgr::registEtcSePos(Vec* posPtr) {
|
||||
}
|
||||
|
||||
bool Z2EnvSeMgr::startEtcSe(s8 reverb) {
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
const char** spotName = sSpotName;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ JAISoundHandle* Z2CreatureLink::startLinkSoundLevel(JAISoundID soundID, u32 mapi
|
||||
case Z2SE_AL_SNOBO_RIDE:
|
||||
case Z2SE_AL_SNOBO_BREAK:
|
||||
/* dSv_event_flag_c::F_0266 - Snowpeak Ruins - Snowpeak Ruins clear */
|
||||
if (dComIfGs_isEventBit((u16)dSv_event_flag_c::saveBitLabels[266])
|
||||
if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[266])
|
||||
&& Z2GetSeqMgr()->getSubBgmID() != Z2BGM_SNOW_BOARD) {
|
||||
volume = 0.0f;
|
||||
volumeMoveSteps = 0;
|
||||
|
||||
@@ -182,7 +182,6 @@ void Z2SceneMgr::setFadeInStart(u8 fadeType) {
|
||||
inGame = true;
|
||||
}
|
||||
|
||||
// NONMATCHING JSULink<JAIStream>::getNext() inlining
|
||||
void Z2SceneMgr::setSceneName(char* spot, s32 room, s32 layer) {
|
||||
OS_REPORT("[Z2SceneMgr::setSceneName] spot = %s, room = %d, layer = %d\n", spot, room, layer);
|
||||
JAISoundID bgm_id = -1;
|
||||
@@ -1927,7 +1926,6 @@ void Z2SceneMgr::load2ndDynamicWave() {
|
||||
}
|
||||
}
|
||||
|
||||
// NONMATCHING - extra BGM_ID load
|
||||
void Z2SceneMgr::sceneBgmStart() {
|
||||
OS_REPORT("[Z2SceneMgr::sceneBgmStart] %08x\n", *(u32*)&BGM_ID);
|
||||
inGame = true;
|
||||
|
||||
@@ -30,12 +30,12 @@ Z2MultiSeObj::Z2MultiSeObj() {
|
||||
}
|
||||
|
||||
void Z2SeMgr::initSe() {
|
||||
#if VERSION == VERSION_SHIELD_DEBUG
|
||||
dbg_field_0x68.releaseSound();
|
||||
dbg_field_0x6c = 0.5f;
|
||||
dbg_field_0x70 = 0.0f;
|
||||
dbg_field_0x74 = 0.0f;
|
||||
dbg_field_0x78 = 0.0f;
|
||||
#if VERSION >= VERSION_WII_USA_R0
|
||||
wii_field_0x68.releaseSound();
|
||||
wii_field_0x6c = 0.5f;
|
||||
wii_field_0x70 = 0.0f;
|
||||
wii_field_0x74 = 0.0f;
|
||||
wii_field_0x78 = 0.0f;
|
||||
#endif
|
||||
|
||||
for (u8 i = 0; i < 10; i++) {
|
||||
@@ -999,6 +999,12 @@ void Z2SeMgr::processSeFramework() {
|
||||
}
|
||||
}
|
||||
|
||||
#if PLATFORM_WII || VERSION == VERSION_SHIELD_DEBUG
|
||||
void Z2SeMgr::playNaviFlySound(f32 param_1, f32 param_2) {
|
||||
wii_field_0x6c = param_1;
|
||||
wii_field_0x70 = JMAAbs(param_2);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Z2SeMgr::isLevelSe(JAISoundID soundID) {
|
||||
switch (soundID) {
|
||||
|
||||
@@ -106,7 +106,7 @@ Z2SeqMgr::Z2SeqMgr() : JASGlobalInstance<Z2SeqMgr>(true) {
|
||||
mAllBgmMaster.forceIn();
|
||||
field_0xa4.forceIn();
|
||||
|
||||
#ifdef DEBUG
|
||||
#if DEBUG
|
||||
field_0x00_debug = 1.0f;
|
||||
field_0x04_debug = 0;
|
||||
#endif
|
||||
@@ -131,7 +131,7 @@ Z2SeqMgr::Z2SeqMgr() : JASGlobalInstance<Z2SeqMgr>(true) {
|
||||
|
||||
void Z2SeqMgr::bgmStart(u32 bgmID, u32 fadeTime, s32 param_2) {
|
||||
switch (bgmID) {
|
||||
case -1:
|
||||
case 0xFFFFFFFF:
|
||||
return;
|
||||
case 0x200005D:
|
||||
bgmAllUnMute(33);
|
||||
|
||||
@@ -5,12 +5,15 @@
|
||||
#include "Z2AudioLib/Z2SeqMgr.h"
|
||||
#include "Z2AudioLib/Z2SeMgr.h"
|
||||
#include "Z2AudioLib/Z2SoundInfo.h"
|
||||
#include "Z2AudioLib/Z2AudioCS.h"
|
||||
#include "JSystem/JAudio2/JASCalc.h"
|
||||
#include "JSystem/JAudio2/JASDriverIF.h"
|
||||
#include "JSystem/JAudio2/JAUSectionHeap.h"
|
||||
#include "d/d_com_inf_game.h"
|
||||
|
||||
#if PLATFORM_WII || PLATFORM_SHIELD
|
||||
#include "Z2AudioLib/Z2AudioCS.h"
|
||||
#endif
|
||||
|
||||
u16 seqCallback(JASTrack* track, u16 command) {
|
||||
switch (command) {
|
||||
case 0x1000:
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#endif
|
||||
|
||||
Z2SoundObjBase::Z2SoundObjBase()
|
||||
#if VERSION == VERSION_SHIELD_DEBUG
|
||||
#if DEBUG
|
||||
: JSULink<Z2SoundObjBase>(this)
|
||||
#endif
|
||||
{
|
||||
@@ -30,7 +30,7 @@ Z2SoundObjBase::~Z2SoundObjBase() {
|
||||
}
|
||||
|
||||
void Z2SoundObjBase::init(Vec* posPtr, u8 handleNum) {
|
||||
#if VERSION == VERSION_SHIELD_DEBUG
|
||||
#if DEBUG
|
||||
Z2GetSoundObjMgr()->getAllList()->append(this);
|
||||
#endif
|
||||
|
||||
@@ -40,7 +40,7 @@ void Z2SoundObjBase::init(Vec* posPtr, u8 handleNum) {
|
||||
}
|
||||
|
||||
void Z2SoundObjBase::deleteObject() {
|
||||
#if VERSION == VERSION_SHIELD_DEBUG
|
||||
#if DEBUG
|
||||
Z2GetSoundObjMgr()->getAllList()->remove(this);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -475,7 +475,7 @@ void Z2SpeechMgr2::setString(const u16* s, s16 textNum, u8 speakerID, u16 mood)
|
||||
mTextNum = textNum;
|
||||
}
|
||||
|
||||
#if VERSION == VERSION_SHIELD_DEBUG
|
||||
#if VERSION >= VERSION_WII_USA_R2
|
||||
for (int i = 0; i <= mTextNum; i++)
|
||||
#else
|
||||
for (int i = 0; i < mTextNum; i++)
|
||||
|
||||
+1
-1
@@ -795,7 +795,7 @@ static DynamicNameTableEntry const DynamicNameTable[] = {
|
||||
#if !PLATFORM_SHIELD
|
||||
{PROC_GRASS, "d_a_grass"},
|
||||
#endif
|
||||
{0xFFFF, NULL},
|
||||
{-1, NULL},
|
||||
};
|
||||
|
||||
static DynamicModuleControlBase* DMC[PROC_MAX_NUM];
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user