lyt_material weirdness

This commit is contained in:
elijah-thomas774
2024-06-04 22:22:44 -04:00
parent fa4ce249a1
commit c2040790a0
15 changed files with 1091 additions and 458 deletions
+2 -1
View File
@@ -28,6 +28,7 @@
"limits": "cpp",
"utility": "cpp",
"initializer_list": "cpp",
"new": "cpp"
"new": "cpp",
"cstdlib": "cpp"
}
}
+2
View File
@@ -369,6 +369,8 @@ nw4r/lyt/lyt_bounding.cpp:
nw4r/lyt/lyt_material.cpp:
.text start:0x8048D7D0 end:0x804905D0
.data start:0x8056E738 end:0x8056E7A8
.sdata2 start:0x8057F280 end:0x8057F2A0
.sbss2 start:0x8057FFB8 end:0x8057FFC0
nw4r/lyt/lyt_resourceAccessor.cpp:
.text start:0x80492000 end:0x80492058
+5 -5
View File
@@ -26051,7 +26051,7 @@ Get__Q34nw4r3lyt6TexMapCFP9_GXTexObj = .text:0x804905D0; // type:function size:0
Get__Q34nw4r3lyt6TexMapCFP10_GXTlutObj = .text:0x804906C0; // type:function size:0x1C
Set__Q34nw4r3lyt6TexMapFPCQ34nw4r3lyt6TexMap = .text:0x804906E0; // type:function size:0x14C
Set__Q34nw4r3lyt6TexMapFPC13TPLDescriptor = .text:0x80490830; // type:function size:0x74
ReplaceImage__Q34nw4r3lyt6TexMapFP10TPLPaletteUlPCc = .text:0x804908B0; // type:function size:0xD0
ReplaceImage__Q34nw4r3lyt6TexMapFP10TPLPaletteUl = .text:0x804908B0; // type:function size:0xD0
__ct__Q34nw4r3lyt8DrawInfoFv = .text:0x80490980; // type:function size:0x74
__dt__Q34nw4r3lyt8DrawInfoFv = .text:0x80490A00; // type:function size:0x40
GetStepCurveValue__Q34nw4r3lyt27@unnamed@lyt_animation_cpp@FfPCQ44nw4r3lyt3res7StepKeyUl = .text:0x80490A40; // type:function size:0xE8
@@ -37080,9 +37080,9 @@ __vt__Q34nw4r3lyt7TextBox = .data:0x8056E570; // type:object size:0x84
@LOCAL@GetTextureFlipInfo__Q34nw4r3lyt24@unnamed@lyt_window_cpp@FUc@flipInfos = .data:0x8056E5F8; // type:object size:0x3C
__vt__Q34nw4r3lyt6Window = .data:0x8056E634; // type:object size:0x8C
__vt__Q34nw4r3lyt8Bounding = .data:0x8056E6C0; // type:object size:0x74
lbl_8056E738 = .data:0x8056E738; // type:object size:0x20 data:4byte
lbl_8056E758 = .data:0x8056E758; // type:object size:0x20 data:4byte
lbl_8056E778 = .data:0x8056E778; // type:object size:0x30
@LOCAL@SetupGX__Q34nw4r3lyt8MaterialFbUc@kColSels = .data:0x8056E738; // type:object size:0x20 data:4byte
@LOCAL@SetupGX__Q34nw4r3lyt8MaterialFbUc@kAlpSels = .data:0x8056E758; // type:object size:0x20 data:4byte
__vt__Q34nw4r3lyt8Material = .data:0x8056E778; // type:object size:0x30
lbl_8056E7A8 = .data:0x8056E7A8; // type:object size:0x10
lbl_8056E7B8 = .data:0x8056E7B8; // type:object size:0x28
__vt__Q34nw4r3lyt16ResourceAccessor = .data:0x8056E7E0; // type:object size:0x14
@@ -48085,7 +48085,7 @@ lbl_8057FF90 = .sdata2:0x8057FF90; // type:object size:0x4
lbl_8057FFA0 = .sbss2:0x8057FFA0; // type:object size:0x8 data:4byte
lbl_8057FFA8 = .sbss2:0x8057FFA8; // type:object size:0x8
lbl_8057FFB0 = .sbss2:0x8057FFB0; // type:object size:0x8
lbl_8057FFB8 = .sbss2:0x8057FFB8; // type:object size:0x8 data:2byte
DefaultBlackColor = .sbss2:0x8057FFB8; // type:object size:0x8 scope:local data:2byte
lbl_8057FFC0 = .sbss2:0x8057FFC0; // type:object size:0x8 data:byte
lbl_8057FFC8 = .sbss2:0x8057FFC8; // type:object size:0x4
lbl_80580000 = .bss:0x80580000; // type:object size:0x14 data:4byte
+2
View File
@@ -1,5 +1,6 @@
#ifndef NW4R_LYT_LAYOUT_H
#define NW4R_LYT_LAYOUT_H
#include "common.h"
#include <new.h>
#include <nw4r/lyt/lyt_animation.h>
@@ -8,6 +9,7 @@
#include <nw4r/ut/ut_ResFont.h>
#include <rvl/MEM/mem_allocator.h>
namespace nw4r {
namespace lyt {
+15 -3
View File
@@ -12,6 +12,7 @@ namespace lyt {
class Material {
public:
Material();
Material(const res::Material *pRes, const ResBlockSet &resBlockSet);
void Init();
@@ -19,25 +20,35 @@ public:
void ReserveGXMem(u8 texMapNum, u8 texSRTNum, u8 texCoordGenNum, u8 tevStageNum, bool allocTevSwap, u8 indStageNum,
u8 indSRTNum, bool allocChanCtrl, bool allocMatCol, bool allocAlpComp, bool allocBlendMode);
TexMap *GetTexMapAry() const;
const TexMap *GetTexMapAry() const;
TexMap *GetTexMapAry();
TexSRT *GetTexSRTAry() const;
const TexSRT *GetTexSRTAry() const;
TexSRT *GetTexSRTAry();
TexCoordGen *GetTexCoordGenAry() const;
const TexCoordGen *GetTexCoordGenAry() const;
TexCoordGen *GetTexCoordGenAry();
const ChanCtrl *GetChanCtrlAry() const;
ChanCtrl *GetChanCtrlAry();
const ut::Color *GetMatColAry() const;
ut::Color *GetMatColAry();
const TevSwapMode *GetTevSwapAry() const;
TevSwapMode *GetTevSwapAry();
const AlphaCompare *GetAlphaComparePtr() const;
AlphaCompare *GetAlphaComparePtr();
const BlendMode *GetBlendModePtr() const;
BlendMode *GetBlendModePtr();
const IndirectStage *GetIndirectStageAry() const;
IndirectStage *GetIndirectStageAry();
const TexSRT *GetIndTexSRTAry() const;
TexSRT *GetIndTexSRTAry();
const TevStage *GetTevStageAry() const;
TevStage *GetTevStageAry();
void SetName(const char *name);
void SetTextureNum(u8 val);
void SetTexCoordGenNum(u8 val);
void SetTevStageNum(u8 val);
void SetIndStageNum(u8 val);
s16 GetColorElement(u32 colorType);
void SetColorElement(u32 colorType, s16 value);
void AddAnimationLink(AnimationLink *pAnimationLink);
@@ -67,6 +78,7 @@ public:
}
// SetTexSRTElement__Q34nw4r3lyt8MaterialFUlUlf
// GetTexturePtr__Q34nw4r3lyt8MaterialFUc
// GetTexSRTCap__Q34nw4r3lyt8MaterialCFv
+2 -2
View File
@@ -101,8 +101,8 @@ public:
math::VEC2 GetVtxPos() const;
void CalculateMtxChild(const DrawInfo &drawInfo);
u16 GetExtUserDataNum() const;
res::ExtUserData *GetExtUserData() const;
res::ExtUserData *FindExtUserDataByName(const char *name);
const res::ExtUserData *GetExtUserData() const;
const res::ExtUserData *FindExtUserDataByName(const char *name);
virtual ~Pane(); // at 0x8
NW4R_UT_RTTI_DECL(Pane); // at 0x0C
+11 -10
View File
@@ -4,6 +4,7 @@
#include <common.h>
#include <nw4r/lyt/lyt_common.h>
#include <nw4r/lyt/lyt_types.h>
#include <nw4r/ut/ut_Color.h>
#define PANE_NAME_SIZE 16
#define PANE_USERDATA_SIZE 8
@@ -42,24 +43,24 @@ struct TexSRT {
struct TexMap {
// GetWarpModeS__Q44nw4r3lyt3res6TexMapCFv
GXTexWrapMode GetWarpModeS() const {
return (GXTexWrapMode)wrapSflt; // TODO
return (GXTexWrapMode)(wrapSflt & 3);
}
// GetWarpModeT__Q44nw4r3lyt3res6TexMapCFv
GXTexWrapMode GetWarpModeT() const {
return (GXTexWrapMode)wrapTflt; // TODO
return (GXTexWrapMode)(wrapTflt & 3);
}
// GetMinFilter__Q44nw4r3lyt3res6TexMapCFv
GXTexFilter GetMinFilter() const {
u8 bitData;
return (GXTexFilter)bitData; // TODO
u8 bitData = (wrapSflt >> 2) & 7;
return (GXTexFilter)((bitData + 1) & 7);
}
// GetMagFilter__Q44nw4r3lyt3res6TexMapCFv
GXTexFilter GetMagFilter() const {
u8 bitData;
return (GXTexFilter)bitData; // TODO
u8 bitData = (wrapTflt >> 2) & 1;
return (GXTexFilter)((bitData + 1) & 1);
}
u16 texIdx; // at 0x0
u8 wrapSflt; // at 0x2
@@ -78,7 +79,7 @@ struct MaterialResourceNum {
}
// GetIndTexSRTNum__Q44nw4r3lyt3res19MaterialResourceNumCFv
u8 GetIndTexSRTNum() const {
return (bits >> 4) & 0xF;
return (bits >> 13) & 0x3;
}
// HasBlendMode__Q44nw4r3lyt3res19MaterialResourceNumCFv
@@ -102,7 +103,7 @@ struct MaterialResourceNum {
}
// GetChanCtrlNum__Q44nw4r3lyt3res19MaterialResourceNumCFv
u8 GetChanControlNum() const {
u8 GetChanCtrlNum() const {
return (bits >> 25) & 1;
}
@@ -113,7 +114,7 @@ struct MaterialResourceNum {
// GetTexSRTNum__Q44nw4r3lyt3res19MaterialResourceNumCFv
u8 GetTexSRTNum() const {
return (bits >> 13) & 0x3;
return (bits >> 4) & 0xF;
}
// GetTexMapNum__Q44nw4r3lyt3res19MaterialResourceNumCFv
@@ -126,7 +127,7 @@ struct MaterialResourceNum {
struct Material {
char name[20]; // at 0x00
GXColorS10 tevCols[3]; // at 0x14
GXColorS10 tevKCols[3]; // at 0x2C
GXColor tevKCols[4]; // at 0x2C
MaterialResourceNum resNum; // at 0x3C
};
+64 -33
View File
@@ -14,7 +14,34 @@ inline bool IsCITexelFormat(GXTexFmt fmt) {
class TexMap {
public:
TexMap() {}
TexMap(TPLPalette *pTPLPalette, u32 id) {
Set(pTPLPalette, id);
}
TexMap() {
mpImage = nullptr;
mWidth = 0;
mHeight = 0;
mBits.textureFormat = 0;
mBits.mipmap = 0;
mBits.wrapS = 0;
mBits.wrapT = 0;
mBits.minFilter = 1;
mBits.magFilter = 1;
mMinLOD = 0.0f;
mMaxLOD = 0.0f;
mLODBias = 0;
mBits.biasClampEnable = 0;
mBits.edgeLODEnable = 0;
mpPalette = nullptr;
mBits.anisotropy = 0;
mBits.paletteFormat = 0;
mPaletteEntryNum = 0;
}
void Get(GXTexObj *) const;
void Get(GXTlutObj *) const;
@@ -79,69 +106,74 @@ public:
}
GXTexFmt GetTexelFormat() const {
return (GXTexFmt)mBits.mTexelFormat;
return (GXTexFmt)mBits.textureFormat;
}
void SetTexelFormat(GXTexFmt fmt) {
mBits.mTexelFormat = fmt;
mBits.textureFormat = fmt;
}
bool IsMipMap() const {
return mBits.mIsMipMap;
return mBits.mipmap;
}
void SetMipMap(bool b) {
mBits.mIsMipMap = b;
mBits.mipmap = b;
}
GXTexWrapMode GetWrapModeS() const {
return (GXTexWrapMode)mBits.mWrapModeS;
return (GXTexWrapMode)mBits.wrapS;
}
GXTexWrapMode GetWrapModeT() const {
return (GXTexWrapMode)mBits.mWrapModeT;
return (GXTexWrapMode)mBits.wrapT;
}
void SetWrapMode(GXTexWrapMode wrapS, GXTexWrapMode wrapT) {
mBits.mWrapModeS = wrapS;
mBits.mWrapModeT = wrapT;
mBits.wrapS = wrapS;
mBits.wrapT = wrapT;
}
GXTexFilter GetMinFilter() const {
return (GXTexFilter)mBits.mMinFilter;
return (GXTexFilter)mBits.minFilter;
}
GXTexFilter GetMagFilter() const {
return (GXTexFilter)mBits.mMagFilter;
return (GXTexFilter)mBits.magFilter;
}
void SetFilter(GXTexFilter minFlt, GXTexFilter magFlt) {
mBits.mMinFilter = minFlt;
mBits.mMagFilter = magFlt;
mBits.minFilter = minFlt;
mBits.magFilter = magFlt;
}
bool IsBiasClampEnable() const {
return mBits.mIsBiasClampEnable;
return mBits.biasClampEnable;
}
void SetBiasClampEnable(bool b) {
mBits.mIsBiasClampEnable = b;
mBits.biasClampEnable = b;
}
bool IsEdgeLODEnable() const {
return mBits.mIsEdgeLODEnable;
return mBits.edgeLODEnable;
}
void SetEdgeLODEnable(bool b) {
mBits.mIsEdgeLODEnable = b;
mBits.edgeLODEnable = b;
}
GXAnisotropy GetAnisotropy() const {
return (GXAnisotropy)mBits.mAnisotropy;
return (GXAnisotropy)mBits.anisotropy;
}
void SetAnisotropy(GXAnisotropy a) {
mBits.mAnisotropy = a;
mBits.anisotropy = a;
}
GXTlutFmt GetPaletteFormat() const {
return (GXTlutFmt)mBits.mPaletteFormat;
return (GXTlutFmt)mBits.paletteFormat;
}
void SetPaletteFormat(GXTlutFmt fmt) {
mBits.mPaletteFormat = fmt;
mBits.paletteFormat = fmt;
}
// ReplaceImage__Q34nw4r3lyt6TexMapFP10TPLPaletteUl
void ReplaceImage(TPLPalette *pal, u32 id);
// ReplaceImage__Q34nw4r3lyt6TexMapFPC13TPLDescriptor
void ReplaceImage(TPLDescriptor *pTPLDesc);
private:
void *mpImage; // at 0x00
void *mpPalette; // at 0x04
@@ -152,18 +184,17 @@ private:
u16 mLODBias; // at 0x14
u16 mPaletteEntryNum; // at 0x16
struct {
u32 mTexelFormat : 4; // GXTexFmt
u32 mIsMipMap : 1; // bool
u32 mWrapModeS : 2; // GXTexWrapMode
u32 mWrapModeT : 2; // GXTexWrapMode
u32 mMinFilter : 3; // GXTexFilter
u32 mMagFilter : 3; // GXTexFilter
u32 mIsBiasClampEnable : 1; // bool
u32 mIsEdgeLODEnable : 1; // bool
u32 mAnisotropy : 2; // GXAnisotropy
u32 mPaletteFormat : 2; // GXTlutFmt
} mBits; // at 0x18
u32 textureFormat : 4; // (>> 28) & 0xF : GXTexFmt
u32 mipmap : 1; // (>> 27) & 0x1 : bool
u32 wrapS : 2; // (>> 25) & 0x3 : GXTexWrapMode
u32 wrapT : 2; // (>> 23) & 0x3 : GXTexWrapMode
u32 minFilter : 3; // (>> 20) & 0x7 : GXTexFilter
u32 magFilter : 1; // (>> 19) & 0x1 : GXTexFilter
u32 biasClampEnable : 1; // (>> 18) & 0x1 : bool
u32 edgeLODEnable : 1; // (>> 17) & 0x1 : bool
u32 anisotropy : 2; // (>> 15) & 0x3 : GXAnisotropy
u32 paletteFormat : 2; // (>> 13) & 0x3 : GXTlutFmt
} mBits; // at 0x18
};
} // namespace lyt
} // namespace nw4r
+131 -106
View File
@@ -9,17 +9,17 @@ namespace lyt {
namespace detail {
struct BitGXNums {
u32 texMap : 4;
u32 texSRT : 4;
u32 texCoordGen : 4;
u32 indSRT : 2;
u32 indStage : 3;
u32 tevSwap : 1;
u32 tevStage : 5;
u32 chanCtrl : 1;
u32 matCol : 1;
u32 alpComp : 1;
u32 blendMode : 1;
u32 texMap : 4; // ( >> 28 ) & F
u32 texSRT : 4; // ( >> 24 ) & F
u32 texCoordGen : 4; // ( >> 20 ) & F
u32 indSRT : 2; // ( >> 18 ) & 3
u32 indStage : 3; // ( >> 15 ) & 7
u32 tevSwap : 1; // ( >> 14 ) & 1
u32 tevStage : 5; // ( >> 9 ) & 1F
u32 chanCtrl : 1; // ( >> 8 ) & 1
u32 matCol : 1; // ( >> 7 ) & 1
u32 alpComp : 1; // ( >> 6 ) & 1
u32 blendMode : 1; // ( >> 5 ) & 1
};
template <typename T>
@@ -40,10 +40,15 @@ T GetBits(T bits, int pos, int len) {
}
template <typename T>
T *ConvertOffsToPtr(const void *baseAddress, unsigned int offset) {
T *ConvertOffsToPtr(void *baseAddress, unsigned int offset) {
return (T *)((u32)baseAddress + offset);
}
template <typename T>
const T *ConvertOffsToPtr(const void *baseAddress, unsigned int offset) {
return (const T *)((u32)baseAddress + offset);
}
} // namespace detail
struct Size {
Size() : width(), height() {}
@@ -66,13 +71,14 @@ struct AnimTransform {
u16 GetFrameSize() const;
bool IsLoopData() const;
virtual ~AnimTransform() = 0;
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor) = 0;
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor, u16 animNum) = 0;
virtual void Bind(Pane *pPane, bool bRecursive) = 0;
virtual void Bind(Material *pMaterial, bool bDisable) = 0;
virtual void Animate(u32 idx, Pane *pPane) = 0;
virtual void Animate(u32 idx, Material *pMaterial) = 0;
virtual ~AnimTransform() = 0; // at 0x08
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor) = 0; // at 0x0C
virtual void SetResource(const res::AnimationBlock *pRes, ResourceAccessor *pResAccessor, //
u16 animNum) = 0; // at 0x10
virtual void Bind(Pane *pPane, bool bRecursive) = 0; // at 0x14
virtual void Bind(Material *pMaterial, bool bDisable) = 0; // at 0x18
virtual void Animate(u32 idx, Pane *pPane) = 0; // at 0x1C
virtual void Animate(u32 idx, Material *pMaterial) = 0; // at 0x20
ut::LinkListNode mLink; // at 0x4
res::AnimationBlock *mpRes; // at 0xC
@@ -177,7 +183,9 @@ struct TexCoordGen {
};
struct ChanCtrl { // 17552
// __ct__Q34nw4r3lyt8ChanCtrlFv
ChanCtrl() {}
ChanCtrl() : reserve1(0), reserve2(0) {
Set(GX_SRC_VTX, GX_SRC_VTX);
}
// Set__Q34nw4r3lyt8ChanCtrlF11_GXColorSrc11_GXColorSrc
void Set(GXColorSrc colSrc, GXColorSrc alpSrc) {
@@ -201,15 +209,62 @@ struct ChanCtrl { // 17552
u8 reserve2; // at 0x3
};
struct AlphaCompare { // 17457
// __ct__Q34nw4r3lyt12AlphaCompareFv
AlphaCompare() {
Set(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0);
}
// Set__Q34nw4r3lyt12AlphaCompareF10_GXCompareUc10_GXAlphaOp10_GXCompareUc
void Set(GXCompare aComp0, u8 aRef0, GXAlphaOp aOp, GXCompare aComp1, u8 aRef1) {
comp = (aComp0 & 0x7) | ((aComp1 & 0x7) << 4);
op = aOp;
ref0 = aRef0;
ref1 = aRef1;
}
// GetComp0__Q34nw4r3lyt12AlphaCompareCFv
GXCompare GetComp0() const {
return (GXCompare)((comp >> 0) & 0xF);
}
// GetRef0__Q34nw4r3lyt12AlphaCompareCFv
u8 GetRef0() const {
return ref0;
}
// GetOp__Q34nw4r3lyt12AlphaCompareCFv
GXAlphaOp GetOp() const {
return (GXAlphaOp)op;
}
// GetComp1__Q34nw4r3lyt12AlphaCompareCFv
GXCompare GetComp1() const {
return (GXCompare)((comp >> 4) & 0xF);
}
// GetRef1__Q34nw4r3lyt12AlphaCompareCFv
u8 GetRef1() const {
return ref1;
}
u8 comp; // at 0x0
u8 op; // at 0x1
u8 ref0; // at 0x2
u8 ref1; // at 0x3
};
struct BlendMode { // 10c41
// __ct__Q34nw4r3lyt9BlendModeFv
BlendMode() {}
BlendMode() {
Set(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET);
}
// Set__Q34nw4r3lyt9BlendModeF12_GXBlendMode14_GXBlendFactor14_GXBlendFactor10_GXLogicOp
void Set(GXBlendMode aType, GXBlendFactor srcFactor, GXBlendFactor destFactor, GXLogicOp aOp) {
void Set(GXBlendMode aType, GXBlendFactor aSrcFactor, GXBlendFactor aDestFactor, GXLogicOp aOp) {
type = aType;
srcFactor = srcFactor;
dstFactor = destFactor;
srcFactor = aSrcFactor;
dstFactor = aDestFactor;
op = aOp;
}
@@ -239,46 +294,11 @@ struct BlendMode { // 10c41
u8 op; // at 0x3
};
struct AlphaCompare { // 17457
// __ct__Q34nw4r3lyt12AlphaCompareFv
AlphaCompare() {}
// Set__Q34nw4r3lyt12AlphaCompareF10_GXCompareUc10_GXAlphaOp10_GXCompareUc
void Set(GXCompare aComp0, u8 aRef0, GXAlphaOp aOp, GXCompare aComp1, u8 aRef1) {}
// GetComp0__Q34nw4r3lyt12AlphaCompareCFv
GXCompare GetComp0() const {
// return (GXCompare)
}
// GetRef0__Q34nw4r3lyt12AlphaCompareCFv
u8 GetRef0() const {
return ref0;
}
// GetOp__Q34nw4r3lyt12AlphaCompareCFv
GXAlphaOp GetOp() const {
return (GXAlphaOp)op;
}
// GetComp1__Q34nw4r3lyt12AlphaCompareCFv
GXCompare GetComp1() const {
// return (GXCompare)
}
// GetRef1__Q34nw4r3lyt12AlphaCompareCFv
u8 GetRef1() const {
return ref1;
}
u8 comp; // at 0x0
u8 op; // at 0x1
u8 ref0; // at 0x2
u8 ref1; // at 0x3
};
struct IndirectStage { // 172da
// __ct__Q34nw4r3lyt13IndirectStageFv
IndirectStage() {}
IndirectStage() {
Set(GX_TEXCOORD0, GX_TEXMAP0, GX_ITS_1, GX_ITS_1);
}
// Set__Q34nw4r3lyt13IndirectStageF13_GXTexCoordID11_GXTexMapID14_GXIndTexScale14_GXIndTexScale
void Set(GXTexCoordID aTexCoordGen, GXTexMapID aTexMap, GXIndTexScale aScaleS, GXIndTexScale aScaleT) {
@@ -324,59 +344,65 @@ struct TexSRT { // 17243
struct TevStageInOp { // 16fe7
// GetA__Q34nw4r3lyt12TevStageInOpCFv
u8 GetA() const {
return ab; // TODO
return (ab >> 0) & 0xF;
}
// GetB__Q34nw4r3lyt12TevStageInOpCFv
u8 GetB() const {
return ab; // TODO
return (ab >> 4) & 0xF;
}
// GetC__Q34nw4r3lyt12TevStageInOpCFv
u8 GetC() const {
return cd; // TODO
return (cd >> 0) & 0xF;
}
// GetD__Q34nw4r3lyt12TevStageInOpCFv
u8 GetD() const {
return cd; // TODO
return (cd >> 4) & 0xF;
}
// GetOp__Q34nw4r3lyt12TevStageInOpCFv
u8 GetOp() const {
return op; // TODO
return (op >> 0) & 0xF;
}
// GetBias__Q34nw4r3lyt12TevStageInOpCFv
u8 GetBias() const {
return op; // TODO
return (op >> 4) & 0x3;
}
// GetScale__Q34nw4r3lyt12TevStageInOpCFv
u8 GetScale() const {
return op; // TODO
return (op >> 6) & 0x3;
}
// IsClamp__Q34nw4r3lyt12TevStageInOpCFv
bool IsClamp() const {
return cl; // TODO
return (cl >> 0) & 1;
}
// GetOutReg__Q34nw4r3lyt12TevStageInOpCFv
u8 GetOutReg() const {
return op; // TODO
return (cl >> 1) & 0x3;
}
// GetKSel__Q34nw4r3lyt12TevStageInOpCFv
u8 GetKSel() const {
return cl; // TODO
return (cl >> 3) & 0x1F;
}
// SetIn__Q34nw4r3lyt12TevStageInOpFUcUcUcUc
void SetIn(u8 a, u8 b, u8 c, u8 d) {}
void SetIn(u8 a, u8 b, u8 c, u8 d) {
ab = (a & 0xF) | ((b & 0xF) << 4);
cd = (c & 0xF) | ((d & 0xF) << 4);
}
// SetOp__Q34nw4r3lyt12TevStageInOpFUcUcUcbUcUc
void SetOp(u8 aOp, u8 bias, u8 scale, bool clamp, u8 outReg, u8 kSel) {}
void SetOp(u8 aOp, u8 bias, u8 scale, bool clamp, u8 outReg, u8 kSel) {
op = (aOp & 0xF) | ((bias & 3) << 4) | ((scale & 0x3) << 6);
cl = (clamp & 1) | ((outReg & 0x3) << 1) | ((kSel & 0x1F) << 3);
}
u8 ab; // at 0x0
u8 cd; // at 0x1
@@ -386,7 +412,15 @@ struct TevStageInOp { // 16fe7
struct TevStage { // 17094
// __ct__Q34nw4r3lyt8TevStageFv
TevStage() {}
TevStage() {
SetOrder(GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0, GX_TEV_SWAP0, GX_TEV_SWAP0);
SetColorIn(GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_RASC);
SetAlphaIn(GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_RASA);
SetColorOp(GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV, GX_TEV_KCSEL_K0);
SetAlphaOp(GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV, GX_TEV_KASEL_K0_R);
SetIndirect(GX_INDTEXSTAGE0, GX_ITF_8, GX_ITB_NONE, GX_ITM_OFF, GX_ITW_OFF, GX_ITW_OFF, false, false,
GX_ITBA_OFF);
}
// GetTexCoordGen__Q34nw4r3lyt8TevStageCFv
GXTexCoordID GetTexCoordGen() const {
@@ -395,7 +429,7 @@ struct TevStage { // 17094
// GetTexMap__Q34nw4r3lyt8TevStageCFv
GXTexMapID GetTexMap() const {
return (GXTexMapID)texMap;
return (GXTexMapID)(texMap | (swapSel & 1) << 8);
}
// GetColorChan__Q34nw4r3lyt8TevStageCFv
@@ -405,12 +439,12 @@ struct TevStage { // 17094
// GetRasSwapSel__Q34nw4r3lyt8TevStageCFv
GXTevSwapSel GetRasSwapSel() const {
return (GXTevSwapSel)swapSel; // TODO
return (GXTevSwapSel)((swapSel >> 1) & 3);
}
// GetTexSwapSel__Q34nw4r3lyt8TevStageCFv
GXTevSwapSel GetTexSwapSel() const {
return (GXTevSwapSel)swapSel; // TODO
return (GXTevSwapSel)((swapSel >> 3) & 3);
}
// GetColorInA__Q34nw4r3lyt8TevStageCFv
@@ -515,7 +549,7 @@ struct TevStage { // 17094
// GetIndMtxSel__Q34nw4r3lyt8TevStageCFv
GXIndTexMtxID GetIndMtxSel() const {
return (GXIndTexMtxID)inBiMt; // TODO
return (GXIndTexMtxID)((inBiMt >> 3) & 0xF);
}
// GetIndStage__Q34nw4r3lyt8TevStageCFv
@@ -525,37 +559,37 @@ struct TevStage { // 17094
// GetIndFormat__Q34nw4r3lyt8TevStageCFv
GXIndTexFormat GetIndFormat() const {
return (GXIndTexFormat)indFoAdUtAl; // TODO
return (GXIndTexFormat)((indFoAdUtAl >> 0) & 0x3);
}
// GetIndBiasSel__Q34nw4r3lyt8TevStageCFv
GXIndTexBiasSel GetIndBiasSel() const {
return (GXIndTexBiasSel)inBiMt; // TODO
return (GXIndTexBiasSel)((inBiMt >> 0) & 0x7);
}
// GetIndWrapS__Q34nw4r3lyt8TevStageCFv
GXIndTexWrap GetIndWrapS() const {
return (GXIndTexWrap)indWrap; // TODO
return (GXIndTexWrap)((indWrap >> 0) & 0x7);
}
// GetIndWrapT__Q34nw4r3lyt8TevStageCFv
GXIndTexWrap GetIndWrapT() const {
return (GXIndTexWrap)indWrap; // TODO
return (GXIndTexWrap)((indWrap >> 3) & 0x7);
}
// IsIndAddPrev__Q34nw4r3lyt8TevStageCFv
bool IsIndAddPrev() const {
return indFoAdUtAl; // TODO
u8 IsIndAddPrev() const {
return ((indFoAdUtAl >> 2) & 1);
}
// IsIndUtcLod__Q34nw4r3lyt8TevStageCFv
bool IsIndUtcLod() const {
return indFoAdUtAl; // TODO
u8 IsIndUtcLod() const {
return ((indFoAdUtAl >> 3) & 1);
}
// GetIndAlphaSel__Q34nw4r3lyt8TevStageCFv
GXIndTexAlphaSel GetIndAlphaSel() const {
return (GXIndTexAlphaSel)indFoAdUtAl; // TODO
return (GXIndTexAlphaSel)((indFoAdUtAl >> 4) & 3);
}
// SetOrder__Q34nw4r3lyt8TevStageF13_GXTexCoordID11_GXTexMapID12_GXChannelID13_GXTevSwapSel13_GXTevSwapSel
@@ -564,8 +598,7 @@ struct TevStage { // 17094
texCoordGen = aTexCoordGen;
colChan = aColChan;
texMap = aTexMap;
swapSel = rasSel; // TODO
swapSel = texSel; // TODO
swapSel = ((rasSel & 3) << 1) | ((texSel & 3) << 3);
}
// SetColorIn__Q34nw4r3lyt8TevStageF14_GXTevColorArg14_GXTevColorArg14_GXTevColorArg14_GXTevColorArg
@@ -592,14 +625,9 @@ struct TevStage { // 17094
void SetIndirect(GXIndTexStageID stage, GXIndTexFormat format, GXIndTexBiasSel bias, GXIndTexMtxID mtxSel,
GXIndTexWrap wrapS, GXIndTexWrap wrapT, bool addPrev, bool utcLod, GXIndTexAlphaSel alphaSel) {
indStage = stage;
indFoAdUtAl = format; // TODO
inBiMt = bias; // TODO
inBiMt = mtxSel; // TODO
indWrap = wrapS; // TODO
indWrap = wrapT; // TODO
indFoAdUtAl = addPrev; // TODO
indFoAdUtAl = utcLod; // TODO
indFoAdUtAl = alphaSel; // TODO
inBiMt = (bias & 0x7) | ((mtxSel & 0xF) << 4);
indWrap = (wrapS & 0x7) | ((wrapT & 0x7) << 3);
indFoAdUtAl = (format & 3) | (addPrev << 2) | (utcLod << 3) | ((alphaSel & 0x3) << 4);
}
u8 texCoordGen; // at 0x0
@@ -618,30 +646,27 @@ struct TevSwapMode { // 1750a
// GetR__Q34nw4r3lyt11TevSwapModeCFv
GXTevColorChan GetR() const {
return (GXTevColorChan)swap; // TODO
return (GXTevColorChan)((swap >> 0) & 0x3);
}
// GetG__Q34nw4r3lyt11TevSwapModeCFv
GXTevColorChan GetG() const {
return (GXTevColorChan)swap; // TODO
return (GXTevColorChan)((swap >> 2) & 0x3);
}
// GetB__Q34nw4r3lyt11TevSwapModeCFv
GXTevColorChan GetB() const {
return (GXTevColorChan)swap; // TODO
return (GXTevColorChan)((swap >> 4) & 0x3);
}
// GetA__Q34nw4r3lyt11TevSwapModeCFv
GXTevColorChan GetA() const {
return (GXTevColorChan)swap; // TODO
return (GXTevColorChan)((swap >> 6) & 0x3);
}
// Set__Q34nw4r3lyt11TevSwapModeF15_GXTevColorChan15_GXTevColorChan15_GXTevColorChan15_GXTevColorChan
void Set(GXTevColorChan r, GXTevColorChan g, GXTevColorChan b, GXTevColorChan a) {
swap = r; // TODO
swap = g; // TODO
swap = b; // TODO
swap = a; // TODO
swap = (r << 0) | (g << 2) | (b << 4) | (a << 6);
}
u8 swap; // at 0x0
+4
View File
@@ -34,6 +34,10 @@ public:
return *this;
}
Color &operator=(const GXColor &c) {
*(u32 *)this = *(u32 *)&c; // TODO -> This Seems Maybe Wrong
}
Color operator|(u32 color) {
return Color(ToU32() | color);
}
+1 -1
View File
@@ -13,7 +13,7 @@ void GXSetTevColorOp(GXTevStageID, GXTevOp, GXTevBias, GXTevScale, u8, GXTevRegI
void GXSetTevAlphaOp(GXTevStageID, GXTevOp, GXTevBias, GXTevScale, u8, GXTevRegID);
void GXSetTevColor(GXTevRegID, GXColor);
void GXSetTevColorS10(GXTevRegID, GXColorS10);
void GXSetTevKColor(GXTevKColorID, GXColor);
void GXSetTevKColorSel(GXTevStageID, GXTevKColorSel);
void GXSetTevKAlphaSel(GXTevStageID, GXTevKAlphaSel);
+2
View File
@@ -13,7 +13,9 @@ void __GXSetSUTexRegs(void);
void GXInitTexObj(GXTexObj *, void *, u16, u16, GXTexFmt, GXTexWrapMode, GXTexWrapMode, u8);
void GXInitTexObjLOD(GXTexObj *, GXTexFilter, GXTexFilter, f32, f32, f32, u8, u8, GXAnisotropy);
void GXInitTexObjTlut(GXTexObj *, u32);
void GXLoadTlut(GXTlutObj *, u32);
void GXLoadTexObj(GXTexObj *, GXTexMapID);
#ifdef __cplusplus
+23
View File
@@ -801,6 +801,29 @@ typedef enum _GXTexWrapMode {
GX_MAX_TEXWRAPMODE
} GXTexWrapMode;
typedef enum GXTlut {
GX_TLUT0,
GX_TLUT1,
GX_TLUT2,
GX_TLUT3,
GX_TLUT4,
GX_TLUT5,
GX_TLUT6,
GX_TLUT7,
GX_TLUT8,
GX_TLUT9,
GX_TLUT10,
GX_TLUT11,
GX_TLUT12,
GX_TLUT13,
GX_TLUT14,
GX_TLUT15,
GX_BIGTLUT0,
GX_BIGTLUT1,
GX_BIGTLUT2,
GX_BIGTLUT3,
} GXTlut;
typedef enum _GXTlutFmt {
GX_TL_IA8,
GX_TL_RGB565,
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -512,15 +512,15 @@ u16 Pane::GetExtUserDataNum() const {
}
return 0;
}
res::ExtUserData *Pane::GetExtUserData() const {
const res::ExtUserData *Pane::GetExtUserData() const {
if (this->mpExtUserDataList) {
return detail::ConvertOffsToPtr<res::ExtUserData>(this->mpExtUserDataList, sizeof(res::ExtUserDataList));
}
return nullptr;
}
res::ExtUserData *Pane::FindExtUserDataByName(const char *name) {
res::ExtUserData *pUserData = GetExtUserData();
const res::ExtUserData *Pane::FindExtUserDataByName(const char *name) {
const res::ExtUserData *pUserData = GetExtUserData();
if (!pUserData) {
return nullptr;