lyt_material OK - Thanks robojumper for pointing out weak function order from header uses

This commit is contained in:
elijah-thomas774
2024-06-05 23:05:18 -04:00
parent c2040790a0
commit afbcb57c62
4 changed files with 104 additions and 65 deletions
+1
View File
@@ -20,6 +20,7 @@ force_active: [
"GetFont__Q34nw4r3lyt24MultiArcResourceAccessorFPCc",
"GetPaneRect__Q34nw4r3lyt4PaneCFRCQ34nw4r3lyt8DrawInfo",
"SetFont__Q34nw4r3lyt7TextBoxFPCQ34nw4r2ut4Font",
"GetTexMapAry__Q34nw4r3lyt8MaterialCFv",
]
# modules:
+1 -1
View File
@@ -360,7 +360,7 @@ config.libs = [
Object(Matching, "nw4r/lyt/lyt_textBox.cpp"),
Object(Matching, "nw4r/lyt/lyt_window.cpp"),
Object(Matching, "nw4r/lyt/lyt_bounding.cpp"),
Object(NonMatching, "nw4r/lyt/lyt_material.cpp"),
Object(Matching, "nw4r/lyt/lyt_material.cpp"),
Object(Matching, "nw4r/lyt/lyt_resourceAccessor.cpp"),
Object(Matching, "nw4r/lyt/lyt_arcResourceAccessor.cpp"),
Object(Matching, "nw4r/lyt/lyt_common.cpp"),
+38
View File
@@ -132,6 +132,44 @@ public:
GetTexCoordGenAry()[idx] = value;
}
// Begin Functions not found in DWARF, but assumed from BBA map and required for weak func ordering
void SetTevColor(u32 idx, const GXColorS10 &color) {
mTevCols[idx] = color;
}
void SetAlphaCompare(const AlphaCompare &alphaComp) {
*GetAlphaComparePtr() = alphaComp;
}
void SetChanControl(u32 idx, const ChanCtrl &chanCtrl) {
GetChanCtrlAry()[idx] = chanCtrl;
}
void SetTevKColor(u32 idx, const ut::Color &color) {
mTevKCols[idx] = color;
}
void SetTevSwapMode(u32 idx, const TevSwapMode &tevSwapMode) {
GetTevSwapAry()[idx] = tevSwapMode;
}
void SetTexSRT(u32 idx, const TexSRT &texSRT) {
GetTexSRTAry()[idx] = texSRT;
}
void SetIndirectStage(u32 idx, const IndirectStage &indStage) {
GetIndirectStageAry()[idx] = indStage;
}
void SetBlendMode(const BlendMode &blendMode) {
*GetBlendModePtr() = blendMode;
}
void SetTevStage(u32 idx, const TevStage &tevStage) {
GetTevStageAry()[idx] = tevStage;
}
// End Functions not found in DWARF, but assumed from BBA map and required for weak func ordering
virtual ~Material(); // at 0x08
virtual bool SetupGX(bool bModVtxCol, u8 alpha); // at 0x0C
virtual void BindAnimation(AnimTransform *pAnimTrans); // at 0x10
+64 -64
View File
@@ -275,78 +275,78 @@ Material::Material(const res::Material *pRes, const ResBlockSet &resBlockSet) :
}
SetTextureNum(di);
}
}
TexSRT *texSRTs = GetTexSRTAry();
for (int i = 0; i < texSRTNum; i++) {
texSRTs[i].translate = pResTexSRTs[i].translate;
texSRTs[i].rotate = pResTexSRTs[i].rotate;
texSRTs[i].scale = pResTexSRTs[i].scale;
}
TexCoordGen *texCoordGens = GetTexCoordGenAry();
SetTexCoordGenNum(texCoordGenNum);
for (int i = 0; i < mGXMemNum.texCoordGen; i++) {
texCoordGens[i] = resTexCoordGen[i];
}
if (allocChanCtrl) {
const ChanCtrl *pResChanCtrl = detail::ConvertOffsToPtr<ChanCtrl>(pRes, resOffs);
GetChanCtrlAry()[0] = *pResChanCtrl;
resOffs += sizeof(ChanCtrl);
}
if (allocMatCol) {
const ut::Color *pResMatCol = detail::ConvertOffsToPtr<ut::Color>(pRes, resOffs);
GetMatColAry()[0] = *pResMatCol;
resOffs += sizeof(ut::Color);
}
if (allocTevSwap) {
const TevSwapMode *tevSwaps = detail::ConvertOffsToPtr<TevSwapMode>(pRes, resOffs);
TevSwapMode *pResTevSwap = GetTevSwapAry();
for (int i = 0; i < 4; i++) {
pResTevSwap[i] = tevSwaps[i];
TexSRT *texSRTs = GetTexSRTAry();
for (int i = 0; i < texSRTNum; i++) {
texSRTs[i].translate = pResTexSRTs[i].translate;
texSRTs[i].rotate = pResTexSRTs[i].rotate;
texSRTs[i].scale = pResTexSRTs[i].scale;
}
resOffs += 4 * sizeof(TevSwapMode);
}
if (indTexSRTNum != 0) {
TexSRT *indTexSRTs = GetIndTexSRTAry();
const TexSRT *pResIndMtx = detail::ConvertOffsToPtr<TexSRT>(pRes, resOffs);
for (int i = 0; i < indTexSRTNum; i++) {
indTexSRTs[i] = pResIndMtx[i];
TexCoordGen *texCoordGens = GetTexCoordGenAry();
SetTexCoordGenNum(texCoordGenNum);
for (int i = 0; i < mGXMemNum.texCoordGen; i++) {
texCoordGens[i] = resTexCoordGen[i];
}
}
resOffs += pRes->resNum.GetIndTexSRTNum() * sizeof(TexSRT);
if (indStageNum != 0) {
SetIndStageNum(indStageNum);
IndirectStage *indirectStages = GetIndirectStageAry();
const IndirectStage *pResIndStg = detail::ConvertOffsToPtr<IndirectStage>(pRes, resOffs);
for (int i = 0; i < indStageNum; i++) {
indirectStages[i] = pResIndStg[i];
if (allocChanCtrl) {
const ChanCtrl *pResChanCtrl = detail::ConvertOffsToPtr<ChanCtrl>(pRes, resOffs);
GetChanCtrlAry()[0] = *pResChanCtrl;
resOffs += sizeof(ChanCtrl);
}
}
resOffs += pRes->resNum.GetIndTexStageNum() * sizeof(IndirectStage);
if (tevStageNum != 0) {
SetTevStageNum(tevStageNum);
TevStage *tevStages = GetTevStageAry();
const TevStage *pResTevStg = detail::ConvertOffsToPtr<TevStage>(pRes, resOffs);
for (int i = 0; i < tevStageNum; i++) {
tevStages[i] = pResTevStg[i];
if (allocMatCol) {
const ut::Color *pResMatCol = detail::ConvertOffsToPtr<ut::Color>(pRes, resOffs);
GetMatColAry()[0] = *pResMatCol;
resOffs += sizeof(ut::Color);
}
}
resOffs += pRes->resNum.GetTevStageNum() * sizeof(TevStage);
if (allocAlpComp) {
const AlphaCompare *pResAlphaCompare = detail::ConvertOffsToPtr<AlphaCompare>(pRes, resOffs);
*GetAlphaComparePtr() = *pResAlphaCompare;
resOffs += sizeof(AlphaCompare);
}
if (allocBlendMode) {
const BlendMode *pResBlendMode = detail::ConvertOffsToPtr<BlendMode>(pRes, resOffs);
*GetBlendModePtr() = *pResBlendMode;
if (allocTevSwap) {
const TevSwapMode *tevSwaps = detail::ConvertOffsToPtr<TevSwapMode>(pRes, resOffs);
TevSwapMode *pResTevSwap = GetTevSwapAry();
for (int i = 0; i < 4; i++) {
pResTevSwap[i] = tevSwaps[i];
}
resOffs += 4 * sizeof(TevSwapMode);
}
if (indTexSRTNum != 0) {
TexSRT *indTexSRTs = GetIndTexSRTAry();
const TexSRT *pResIndMtx = detail::ConvertOffsToPtr<TexSRT>(pRes, resOffs);
for (int i = 0; i < indTexSRTNum; i++) {
indTexSRTs[i] = pResIndMtx[i];
}
}
resOffs += pRes->resNum.GetIndTexSRTNum() * sizeof(TexSRT);
if (indStageNum != 0) {
SetIndStageNum(indStageNum);
IndirectStage *indirectStages = GetIndirectStageAry();
const IndirectStage *pResIndStg = detail::ConvertOffsToPtr<IndirectStage>(pRes, resOffs);
for (int i = 0; i < indStageNum; i++) {
indirectStages[i] = pResIndStg[i];
}
}
resOffs += pRes->resNum.GetIndTexStageNum() * sizeof(IndirectStage);
if (tevStageNum != 0) {
SetTevStageNum(tevStageNum);
TevStage *tevStages = GetTevStageAry();
const TevStage *pResTevStg = detail::ConvertOffsToPtr<TevStage>(pRes, resOffs);
for (int i = 0; i < tevStageNum; i++) {
tevStages[i] = pResTevStg[i];
}
}
resOffs += pRes->resNum.GetTevStageNum() * sizeof(TevStage);
if (allocAlpComp) {
const AlphaCompare *pResAlphaCompare = detail::ConvertOffsToPtr<AlphaCompare>(pRes, resOffs);
*GetAlphaComparePtr() = *pResAlphaCompare;
resOffs += sizeof(AlphaCompare);
}
if (allocBlendMode) {
const BlendMode *pResBlendMode = detail::ConvertOffsToPtr<BlendMode>(pRes, resOffs);
*GetBlendModePtr() = *pResBlendMode;
}
}
}
#pragma dont_inline reset