mirror of
https://github.com/zeldaret/tww.git
synced 2026-08-06 18:02:28 -04:00
J3DMatBlock (#85)
This commit is contained in:
@@ -25,6 +25,11 @@ inline void J3DGDWrite_f32(f32 param) {
|
||||
J3DGDWrite_u32(tmp);
|
||||
}
|
||||
|
||||
inline void J3DGDWriteBPCmd(u32 param_1) {
|
||||
J3DGDWrite_u8(0x61);
|
||||
J3DGDWrite_u32(param_1);
|
||||
}
|
||||
|
||||
inline void J3DGDWriteXFCmd(u16 cmd, u32 param) {
|
||||
J3DGDWrite_u8(0x10);
|
||||
J3DGDWrite_u16(0);
|
||||
@@ -40,7 +45,28 @@ inline void J3DGDWriteXFCmdHdr(u16 cmd, u8 len) {
|
||||
|
||||
void J3DGDSetGenMode(u8 texGenNum, u8 colorChanNum, u8 tevStageNum, u8 IndTexStageNum, _GXCullMode cullMode);
|
||||
void J3DGDSetGenMode_3Param(u8 texGenNum, u8 tevStageNum, u8 indTexStageNum);
|
||||
void J3DGDSetIndTexStageNum(u32);
|
||||
void J3DGDSetLightAttn(_GXLightID, f32, f32, f32, f32, f32, f32);
|
||||
void J3DGDSetLightColor(GXLightID, GXColor);
|
||||
void J3DGDSetLightPos(GXLightID, f32, f32, f32);
|
||||
void J3DGDSetLightDir(GXLightID, f32, f32, f32);
|
||||
void J3DGDSetVtxAttrFmtv(GXVtxFmt, GXVtxAttrFmtList*, bool);
|
||||
void J3DGDSetTexCoordGen(GXTexGenType, GXTexGenSrc);
|
||||
void J3DGDSetTexCoordScale2(GXTexCoordID, u16, u8, u8, u16, u8, u8);
|
||||
void J3DGDSetTexLookupMode(GXTexMapID, GXTexWrapMode, GXTexWrapMode, GXTexFilter, GXTexFilter, f32, f32, f32, u8, u8, GXAnisotropy);
|
||||
void J3DGDSetTexImgAttr(GXTexMapID, u16, u16, GXTexFmt);
|
||||
void J3DGDSetTexImgPtr(GXTexMapID, void*);
|
||||
void J3DGDSetTexImgPtrRaw(GXTexMapID, u32);
|
||||
void J3DGDSetTexTlut(GXTexMapID, u32, GXTlutFmt);
|
||||
void J3DGDLoadTlut(void*, u32, GXTlutSize);
|
||||
void J3DGDSetIndTexMtx(GXIndTexMtxID, Mtx23, s8);
|
||||
void J3DGDSetIndTexCoordScale(GXIndTexStageID, GXIndTexScale, GXIndTexScale, GXIndTexScale, GXIndTexScale);
|
||||
void J3DGDSetIndTexOrder(u32, GXTexCoordID, GXTexMapID, GXTexCoordID, GXTexMapID, GXTexCoordID, GXTexMapID, GXTexCoordID, GXTexMapID);
|
||||
void J3DGDSetTevOrder(GXTevStageID, GXTexCoordID, GXTexMapID, GXChannelID, GXTexCoordID, GXTexMapID, GXChannelID);
|
||||
void J3DGDSetTevKColor(GXTevKColorID, GXColor);
|
||||
void J3DGDSetTevColorS10(GXTevRegID, GXColorS10);
|
||||
void J3DGDSetFog(GXFogType, f32, f32, f32, f32, GXColor);
|
||||
void J3DGDSetFogRangeAdj(u8, u16, GXFogAdjTable*);
|
||||
|
||||
static inline void J3DFifoLoadIndx(u8 cmd, u16 indx, u16 addr) {
|
||||
GFX_FIFO(u8) = cmd;
|
||||
@@ -56,4 +82,8 @@ inline void J3DGDSetNumTexGens(u8 numTexGens) {
|
||||
J3DGDWriteXFCmd(0x103f, numTexGens);
|
||||
}
|
||||
|
||||
inline void J3DGDSetTevKonstantSel_SwapModeTable(GXTevStageID stage, GXTevKColorSel colorSel1, GXTevKAlphaSel alphaSel1, GXTevKColorSel colorSel2, GXTevKAlphaSel alphaSel2, GXTevColorChan chan1, GXTevColorChan chan2) {
|
||||
J3DGDWriteBPCmd((stage / 2 + 0xf6) << 24 | (chan1 | chan2 << 2 | colorSel1 << 4 | alphaSel1 << 9 | colorSel2 << 14 | alphaSel2 << 19) & 0x00FFFFFF);
|
||||
}
|
||||
|
||||
#endif /* J3DGD_H */
|
||||
|
||||
@@ -23,6 +23,13 @@ class J3DShape;
|
||||
class J3DDrawBuffer;
|
||||
class J3DTexture;
|
||||
|
||||
struct J3DTexCoordScaleInfo {
|
||||
/* 0x0 */ u16 field_0x00;
|
||||
/* 0x2 */ u16 field_0x02;
|
||||
/* 0x4 */ u16 field_0x04;
|
||||
/* 0x6 */ u16 field_0x06;
|
||||
};
|
||||
|
||||
enum J3DSysFlag {
|
||||
J3DSysFlag_SkinPosCpu = 0x00000004,
|
||||
J3DSysFlag_SkinNrmCpu = 0x00000008,
|
||||
@@ -100,7 +107,7 @@ public:
|
||||
static Mtx mCurrentMtx;
|
||||
static Vec mCurrentS;
|
||||
static Vec mParentS;
|
||||
static u16 sTexCoordScaleTable[32];
|
||||
static J3DTexCoordScaleInfo sTexCoordScaleTable[8];
|
||||
|
||||
/* 0x000 */ Mtx mViewMtx;
|
||||
/* 0x030 */ J3DMtxCalc* mCurrentMtxCalc;
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#ifndef J3DTEVS_H
|
||||
#define J3DTEVS_H
|
||||
|
||||
#include "dolphin/types.h"
|
||||
#include "JSystem/J3DGraphBase/J3DGD.h"
|
||||
|
||||
extern u8 j3dTevSwapTableTable[1024];
|
||||
|
||||
struct J3DTevStageInfo {
|
||||
/* 0x0 */ u8 field_0x0;
|
||||
@@ -57,6 +59,11 @@ struct J3DTevStage {
|
||||
|
||||
void setTevStageInfo(const J3DTevStageInfo&);
|
||||
|
||||
void load(u32) const {
|
||||
J3DGDWriteBPCmd(*(u32*)&field_0x0);
|
||||
J3DGDWriteBPCmd(*(u32*)&field_0x4);
|
||||
}
|
||||
|
||||
/* 0x0 */ u8 field_0x0;
|
||||
/* 0x1 */ u8 field_0x1;
|
||||
/* 0x1 */ u8 field_0x2;
|
||||
@@ -82,6 +89,10 @@ struct J3DIndTevStageInfo {
|
||||
struct J3DIndTevStage {
|
||||
J3DIndTevStage();
|
||||
|
||||
void load(u32 param_1) {
|
||||
J3DGDWriteBPCmd(mInfo | (param_1 + 16) << 24);
|
||||
}
|
||||
|
||||
/* 0x0 */ u32 mInfo;
|
||||
};
|
||||
|
||||
@@ -94,12 +105,18 @@ struct J3DTevOrderInfo {
|
||||
struct J3DTevOrder : public J3DTevOrderInfo {
|
||||
J3DTevOrder();
|
||||
|
||||
J3DTevOrderInfo* getTevOrderInfo() { return this; }
|
||||
u8 getTexMap() { return mTexMap; }
|
||||
};
|
||||
|
||||
struct J3DTevSwapModeTable {
|
||||
J3DTevSwapModeTable();
|
||||
|
||||
u8 getR() { return j3dTevSwapTableTable[field_0x0 * 4]; }
|
||||
u8 getG() { return j3dTevSwapTableTable[field_0x0 * 4 + 1]; }
|
||||
u8 getB() { return j3dTevSwapTableTable[field_0x0 * 4 + 2]; }
|
||||
u8 getA() { return j3dTevSwapTableTable[field_0x0 * 4 + 3]; }
|
||||
|
||||
/* 0x0 */ u8 field_0x0;
|
||||
}; // Size: 0x1
|
||||
|
||||
@@ -108,6 +125,8 @@ struct J3DTevSwapModeInfo {
|
||||
};
|
||||
|
||||
struct J3DNBTScale;
|
||||
class J3DTexCoord;
|
||||
void loadTexCoordGens(u32, J3DTexCoord*);
|
||||
void loadNBTScale(J3DNBTScale& param_0);
|
||||
|
||||
#endif /* J3DTEVS_H */
|
||||
|
||||
@@ -40,6 +40,10 @@ inline u8* GDGetCurrPointer() {
|
||||
return __GDCurrentDL->ptr;
|
||||
}
|
||||
|
||||
inline s32 GDGetCurrOffset() {
|
||||
return __GDCurrentDL->ptr - __GDCurrentDL->start;
|
||||
}
|
||||
|
||||
inline void GDSetCurrOffset(s32 offs) {
|
||||
__GDCurrentDL->ptr = __GDCurrentDL->start + offs;
|
||||
}
|
||||
|
||||
@@ -301,12 +301,12 @@ typedef enum _GXTevColorArg {
|
||||
/* 0xF */ GX_CC_ZERO,
|
||||
} GXTevColorArg;
|
||||
|
||||
typedef enum _GXTevColor {
|
||||
typedef enum _GXTevColorChan {
|
||||
/* 0x0 */ GX_CH_RED,
|
||||
/* 0x1 */ GX_CH_GREEN,
|
||||
/* 0x2 */ GX_CH_BLUE,
|
||||
/* 0x3 */ GX_CH_ALPHA,
|
||||
} GXTevColor;
|
||||
} GXTevColorChan;
|
||||
|
||||
typedef enum _GXTevScale {
|
||||
/* 0x0 */ GX_CS_SCALE_1,
|
||||
@@ -806,4 +806,4 @@ typedef enum _GXTlutSize {
|
||||
/* 0x400 */ GX_TLUT_16K = 1024,
|
||||
} GXTlutSize;
|
||||
|
||||
#endif /* GXENUM_H */
|
||||
#endif /* GXENUM_H */
|
||||
|
||||
@@ -23,8 +23,8 @@ void GXSetTevKColor(GXTevKColorID id, GXColor color);
|
||||
void GXSetTevKColorSel(GXTevStageID stage, GXTevKColorSel color_sel);
|
||||
void GXSetTevKAlphaSel(GXTevStageID stage, GXTevKAlphaSel alpha_sel);
|
||||
void GXSetTevSwapMode(GXTevStageID stage, GXTevSwapSel ras_sel, GXTevSwapSel tex_sel);
|
||||
void GXSetTevSwapModeTable(GXTevSwapSel select, GXTevColor r, GXTevColor g, GXTevColor b,
|
||||
GXTevColor a);
|
||||
void GXSetTevSwapModeTable(GXTevSwapSel select, GXTevColorChan r, GXTevColorChan g, GXTevColorChan b,
|
||||
GXTevColorChan a);
|
||||
void GXSetAlphaCompare(GXCompare comp0, u8 ref0, GXAlphaOp op, GXCompare comp1, u8 ref1);
|
||||
void GXSetZTexture(GXZTexOp op, GXTexFmt fmt, u32 bias);
|
||||
void GXSetTevOrder(GXTevStageID stage, GXTexCoordID coord, GXTexMapID map, GXChannelID color);
|
||||
|
||||
@@ -7,121 +7,129 @@
|
||||
#include "dolphin/types.h"
|
||||
|
||||
/* 802D5F38-802D60B0 .text J3DGDSetGenMode__FUcUcUcUc11_GXCullMode */
|
||||
void J3DGDSetGenMode(unsigned char, unsigned char, unsigned char, unsigned char, _GXCullMode) {
|
||||
void J3DGDSetGenMode(u8, u8, u8, u8, _GXCullMode) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D60B0-802D6204 .text J3DGDSetGenMode_3Param__FUcUcUc */
|
||||
void J3DGDSetGenMode_3Param(unsigned char, unsigned char, unsigned char) {
|
||||
void J3DGDSetGenMode_3Param(u8, u8, u8) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D6204-802D632C .text J3DGDSetIndTexStageNum__FUl */
|
||||
void J3DGDSetIndTexStageNum(unsigned long) {
|
||||
void J3DGDSetIndTexStageNum(u32) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D632C-802D6624 .text J3DGDSetLightAttn__F10_GXLightIDffffff */
|
||||
void J3DGDSetLightAttn(_GXLightID, float, float, float, float, float, float) {
|
||||
void J3DGDSetLightAttn(GXLightID, f32, f32, f32, f32, f32, f32) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D6624-802D6734 .text J3DGDSetLightColor__F10_GXLightID8_GXColor */
|
||||
void J3DGDSetLightColor(_GXLightID, _GXColor) {
|
||||
void J3DGDSetLightColor(GXLightID, GXColor) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D6734-802D6900 .text J3DGDSetLightPos__F10_GXLightIDfff */
|
||||
void J3DGDSetLightPos(_GXLightID, float, float, float) {
|
||||
void J3DGDSetLightPos(GXLightID, f32, f32, f32) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D6900-802D6ACC .text J3DGDSetLightDir__F10_GXLightIDfff */
|
||||
void J3DGDSetLightDir(_GXLightID, float, float, float) {
|
||||
void J3DGDSetLightDir(GXLightID, f32, f32, f32) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D6ACC-802D702C .text J3DGDSetVtxAttrFmtv__F9_GXVtxFmtP17_GXVtxAttrFmtListb */
|
||||
void J3DGDSetVtxAttrFmtv(_GXVtxFmt, _GXVtxAttrFmtList*, bool) {
|
||||
void J3DGDSetVtxAttrFmtv(GXVtxFmt, GXVtxAttrFmtList*, bool) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D702C-802D71FC .text J3DGDSetTexCoordGen__F13_GXTexGenType12_GXTexGenSrc */
|
||||
void J3DGDSetTexCoordGen(_GXTexGenType, _GXTexGenSrc) {
|
||||
void J3DGDSetTexCoordGen(GXTexGenType, GXTexGenSrc) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D71FC-802D7400 .text J3DGDSetTexCoordScale2__F13_GXTexCoordIDUsUcUcUsUcUc */
|
||||
void J3DGDSetTexCoordScale2(_GXTexCoordID, unsigned short, unsigned char, unsigned char, unsigned short, unsigned char, unsigned char) {
|
||||
void J3DGDSetTexCoordScale2(GXTexCoordID, u16, u8, u8, u16, u8, u8) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D7400-802D759C .text J3DGDSetTexLookupMode__F11_GXTexMapID14_GXTexWrapMode14_GXTexWrapMode12_GXTexFilter12_GXTexFilterfffUcUc13_GXAnisotropy */
|
||||
void J3DGDSetTexLookupMode(_GXTexMapID, _GXTexWrapMode, _GXTexWrapMode, _GXTexFilter, _GXTexFilter, float, float, float, unsigned char, unsigned char, _GXAnisotropy) {
|
||||
void J3DGDSetTexLookupMode(GXTexMapID, GXTexWrapMode, GXTexWrapMode, GXTexFilter, GXTexFilter, f32, f32, f32, u8, u8, GXAnisotropy) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D759C-802D7644 .text J3DGDSetTexImgAttr__F11_GXTexMapIDUsUs9_GXTexFmt */
|
||||
void J3DGDSetTexImgAttr(_GXTexMapID, unsigned short, unsigned short, _GXTexFmt) {
|
||||
void J3DGDSetTexImgAttr(GXTexMapID, u16, u16, GXTexFmt) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D7644-802D76D4 .text J3DGDSetTexImgPtr__F11_GXTexMapIDPv */
|
||||
void J3DGDSetTexImgPtr(_GXTexMapID, void*) {
|
||||
void J3DGDSetTexImgPtr(GXTexMapID, void*) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D76D4-802D77A8 .text J3DGDSetTexImgPtrRaw__F11_GXTexMapIDUl */
|
||||
void J3DGDSetTexImgPtrRaw(_GXTexMapID, unsigned long) {
|
||||
void J3DGDSetTexImgPtrRaw(GXTexMapID, u32) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D77A8-802D7840 .text J3DGDSetTexTlut__F11_GXTexMapIDUl10_GXTlutFmt */
|
||||
void J3DGDSetTexTlut(_GXTexMapID, unsigned long, _GXTlutFmt) {
|
||||
void J3DGDSetTexTlut(GXTexMapID, u32, GXTlutFmt) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D7840-802D7AF8 .text J3DGDLoadTlut__FPvUl11_GXTlutSize */
|
||||
void J3DGDLoadTlut(void*, unsigned long, _GXTlutSize) {
|
||||
void J3DGDLoadTlut(void*, u32, GXTlutSize) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D7AF8-802D7DD8 .text J3DGDSetIndTexMtx__F14_GXIndTexMtxIDPA3_fSc */
|
||||
void J3DGDSetIndTexMtx(_GXIndTexMtxID, float(*)[3], signed char) {
|
||||
void J3DGDSetIndTexMtx(GXIndTexMtxID, Mtx23, s8) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D7DD8-802D7ED0 .text J3DGDSetIndTexCoordScale__F16_GXIndTexStageID14_GXIndTexScale14_GXIndTexScale14_GXIndTexScale14_GXIndTexScale */
|
||||
void J3DGDSetIndTexCoordScale(_GXIndTexStageID, _GXIndTexScale, _GXIndTexScale, _GXIndTexScale, _GXIndTexScale) {
|
||||
void J3DGDSetIndTexCoordScale(GXIndTexStageID, GXIndTexScale, GXIndTexScale, GXIndTexScale, GXIndTexScale) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D7ED0-802D80D0 .text J3DGDSetIndTexOrder__FUl13_GXTexCoordID11_GXTexMapID13_GXTexCoordID11_GXTexMapID13_GXTexCoordID11_GXTexMapID13_GXTexCoordID11_GXTexMapID */
|
||||
void J3DGDSetIndTexOrder(unsigned long, _GXTexCoordID, _GXTexMapID, _GXTexCoordID, _GXTexMapID, _GXTexCoordID, _GXTexMapID, _GXTexCoordID, _GXTexMapID) {
|
||||
void J3DGDSetIndTexOrder(u32, GXTexCoordID, GXTexMapID, GXTexCoordID, GXTexMapID, GXTexCoordID, GXTexMapID, GXTexCoordID, GXTexMapID) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D80D0-802D825C .text J3DGDSetTevOrder__F13_GXTevStageID13_GXTexCoordID11_GXTexMapID12_GXChannelID13_GXTexCoordID11_GXTexMapID12_GXChannelID */
|
||||
void J3DGDSetTevOrder(_GXTevStageID, _GXTexCoordID, _GXTexMapID, _GXChannelID, _GXTexCoordID, _GXTexMapID, _GXChannelID) {
|
||||
void J3DGDSetTevOrder(GXTevStageID stage, GXTexCoordID coord1, GXTexMapID map1, GXChannelID color1, GXTexCoordID coord2, GXTexMapID map2, GXChannelID color2) {
|
||||
/* Nonmatching */
|
||||
static u8 c2r[] = {0, 1, 0, 1, 0, 1, 7, 5, 6, 0, 0, 0, 0, 0, 0, 7};
|
||||
|
||||
GXTexCoordID r31 = coord1 >= 8 ? GX_TEXCOORD0 : coord1;
|
||||
GXTexCoordID r30 = coord2 >= 8 ? GX_TEXCOORD0 : coord2;
|
||||
GDOverflowCheck(5);
|
||||
bool r27 = map1 != GX_TEXMAP_NULL && (map1 & GX_TEXMAP_DISABLE) == 0;
|
||||
bool r26 = map2 != GX_TEXMAP_NULL && (map2 & GX_TEXMAP_DISABLE) == 0;
|
||||
J3DGDWriteBPCmd((stage / 2 + 0x28) << 24 | r31 << 3 | r27 << 6 | c2r[color2 & 0xf] << 19 | r26 << 18 | r30 << 15 | (map2 & 7) << 0xc | c2r[color1 & 0xf] << 7 | r27 << 6 | r31 << 3 | map1 & 7);
|
||||
}
|
||||
|
||||
/* 802D825C-802D83C4 .text J3DGDSetTevKColor__F14_GXTevKColorID8_GXColor */
|
||||
void J3DGDSetTevKColor(_GXTevKColorID, _GXColor) {
|
||||
void J3DGDSetTevKColor(GXTevKColorID, GXColor) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D83C4-802D85F8 .text J3DGDSetTevColorS10__F11_GXTevRegID11_GXColorS10 */
|
||||
void J3DGDSetTevColorS10(_GXTevRegID, _GXColorS10) {
|
||||
void J3DGDSetTevColorS10(GXTevRegID, GXColorS10) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D85F8-802D895C .text J3DGDSetFog__F10_GXFogTypeffff8_GXColor */
|
||||
void J3DGDSetFog(_GXFogType, float, float, float, float, _GXColor) {
|
||||
void J3DGDSetFog(GXFogType, f32, f32, f32, f32, GXColor) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
/* 802D895C-802D8AA8 .text J3DGDSetFogRangeAdj__FUcUsP14_GXFogAdjTable */
|
||||
void J3DGDSetFogRangeAdj(unsigned char, unsigned short, _GXFogAdjTable*) {
|
||||
void J3DGDSetFogRangeAdj(u8, u16, GXFogAdjTable*) {
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "JSystem/J3DGraphBase/J3DTexture.h"
|
||||
#include "JSystem/J3DGraphBase/J3DTransform.h"
|
||||
#include "JSystem/J3DGraphBase/J3DMatBlock.h"
|
||||
#include "JSystem/J3DGraphBase/J3DSys.h"
|
||||
#include "JSystem/J3DGraphBase/J3DTevs.h"
|
||||
#include "dolphin/gd/GDBase.h"
|
||||
#include "dolphin/os/OSCache.h"
|
||||
#include "dolphin/types.h"
|
||||
@@ -30,6 +32,30 @@ static int SizeOfJ3DColorBlockLightOffLoad = SizeOfLoadMatColors + SizeOfLoadCol
|
||||
static int SizeOfJ3DColorBlockAmbientOnLoad =
|
||||
SizeOfLoadMatColors + SizeOfLoadAmbColors + SizeOfLoadColorChans;
|
||||
|
||||
inline void loadMatColors(const J3DGXColor* color) {
|
||||
J3DGDWriteXFCmdHdr(0x100C, 2);
|
||||
J3DGDWrite_u32(*(u32*)color);
|
||||
J3DGDWrite_u32(*(u32*)(color + 1));
|
||||
}
|
||||
|
||||
inline void loadAmbColors(const J3DGXColor* color) {
|
||||
J3DGDWriteXFCmdHdr(0x100A, 2);
|
||||
J3DGDWrite_u32(*(u32*)color);
|
||||
J3DGDWrite_u32(*(u32*)(color + 1));
|
||||
}
|
||||
|
||||
inline void loadTexCoordScale(GXTexCoordID coord, const J3DTexCoordScaleInfo& info) {
|
||||
J3DGDSetTexCoordScale2(coord, info.field_0x00, info.field_0x04 == 1, 0, info.field_0x02, info.field_0x06 == 1, 0);
|
||||
}
|
||||
|
||||
inline void loadTevColor(u32 param_1, const J3DGXColorS10& color) {
|
||||
J3DGDSetTevColorS10(GXTevRegID(param_1 + 1), color);
|
||||
}
|
||||
|
||||
inline void loadTevKColor(u32 param_1, const J3DGXColor& color) {
|
||||
J3DGDSetTevKColor(GXTevKColorID(param_1), color);
|
||||
}
|
||||
|
||||
/* 802DF794-802DF7E4 .text initialize__21J3DColorBlockLightOffFv */
|
||||
void J3DColorBlockLightOff::initialize() {
|
||||
mColorChanNum = 0;
|
||||
@@ -307,11 +333,9 @@ s32 J3DPEBlockFull::countDLSize() {
|
||||
/* 802DFED8-802E0438 .text load__21J3DColorBlockLightOffFv */
|
||||
void J3DColorBlockLightOff::load() {
|
||||
GDOverflowCheck(SizeOfJ3DColorBlockLightOffLoad);
|
||||
mMatColorOffset = GDGetGDLObjOffset(__GDCurrentDL);
|
||||
J3DGDWriteXFCmdHdr(0x100C, 2);
|
||||
J3DGDWrite_u32(*(u32*)(&mMatColor[0]));
|
||||
J3DGDWrite_u32(*(u32*)(&mMatColor[1]));
|
||||
mColorChanOffset = GDGetGDLObjOffset(__GDCurrentDL);
|
||||
mMatColorOffset = GDGetCurrOffset();
|
||||
loadMatColors((J3DGXColor*)mMatColor);
|
||||
mColorChanOffset = GDGetCurrOffset();
|
||||
J3DGDWriteXFCmdHdr(0x100E, 4);
|
||||
/* Nonmatching */
|
||||
}
|
||||
@@ -319,14 +343,10 @@ void J3DColorBlockLightOff::load() {
|
||||
/* 802E0438-802E0AC0 .text load__22J3DColorBlockAmbientOnFv */
|
||||
void J3DColorBlockAmbientOn::load() {
|
||||
GDOverflowCheck(SizeOfJ3DColorBlockAmbientOnLoad);
|
||||
mMatColorOffset = GDGetGDLObjOffset(__GDCurrentDL);
|
||||
J3DGDWriteXFCmdHdr(0x100C, 2);
|
||||
J3DGDWrite_u32(*(u32*)(&mMatColor[0]));
|
||||
J3DGDWrite_u32(*(u32*)(&mMatColor[1]));
|
||||
J3DGDWriteXFCmdHdr(0x100A, 2);
|
||||
J3DGDWrite_u32(*(u32*)(&mAmbColor[0]));
|
||||
J3DGDWrite_u32(*(u32*)(&mAmbColor[1]));
|
||||
mColorChanOffset = GDGetGDLObjOffset(__GDCurrentDL);
|
||||
mMatColorOffset = GDGetCurrOffset();
|
||||
loadMatColors((J3DGXColor*)mMatColor);
|
||||
loadAmbColors((J3DGXColor*)mAmbColor);
|
||||
mColorChanOffset = GDGetCurrOffset();
|
||||
J3DGDWriteXFCmdHdr(0x100E, 4);
|
||||
/* Nonmatching */
|
||||
}
|
||||
@@ -334,16 +354,17 @@ void J3DColorBlockAmbientOn::load() {
|
||||
/* 802E0AC0-802E1180 .text load__20J3DColorBlockLightOnFv */
|
||||
void J3DColorBlockLightOn::load() {
|
||||
GDOverflowCheck(SizeOfJ3DColorBlockAmbientOnLoad);
|
||||
mMatColorOffset = GDGetGDLObjOffset(__GDCurrentDL);
|
||||
J3DGDWriteXFCmdHdr(0x100C, 2);
|
||||
J3DGDWrite_u32(*(u32*)(&mMatColor[0]));
|
||||
J3DGDWrite_u32(*(u32*)(&mMatColor[1]));
|
||||
J3DGDWriteXFCmdHdr(0x100A, 2);
|
||||
J3DGDWrite_u32(*(u32*)(&mAmbColor[0]));
|
||||
J3DGDWrite_u32(*(u32*)(&mAmbColor[1]));
|
||||
mColorChanOffset = GDGetGDLObjOffset(__GDCurrentDL);
|
||||
mMatColorOffset = GDGetCurrOffset();
|
||||
loadMatColors((J3DGXColor*)mMatColor);
|
||||
loadAmbColors((J3DGXColor*)mAmbColor);
|
||||
mColorChanOffset = GDGetCurrOffset();
|
||||
J3DGDWriteXFCmdHdr(0x100E, 4);
|
||||
/* Nonmatching */
|
||||
for (u32 i = 0; i < 8; i++) {
|
||||
if (mLight[i]) {
|
||||
mLight[i]->load(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 802E1180-802E11CC .text patch__21J3DColorBlockLightOffFv */
|
||||
@@ -357,16 +378,20 @@ void J3DColorBlockLightOff::patchMatColor() {
|
||||
GDSetCurrOffset(mMatColorOffset);
|
||||
u8* start = GDGetCurrPointer();
|
||||
GDOverflowCheck(SizeOfLoadMatColors);
|
||||
J3DGDWriteXFCmdHdr(0x100C, 2);
|
||||
J3DGDWrite_u32(*(u32*)(&mMatColor[0]));
|
||||
J3DGDWrite_u32(*(u32*)(&mMatColor[1]));
|
||||
loadMatColors((J3DGXColor*)mMatColor);
|
||||
u8* end = GDGetCurrPointer();
|
||||
DCFlushRange(start, (u32)(end - start));
|
||||
DCFlushRange(start, end - start);
|
||||
}
|
||||
|
||||
/* 802E1378-802E17B4 .text patchLight__21J3DColorBlockLightOffFv */
|
||||
void J3DColorBlockLightOff::patchLight() {
|
||||
GDSetCurrOffset(mColorChanOffset);
|
||||
u8* start = GDGetCurrPointer();
|
||||
GDOverflowCheck(SizeOfLoadColorChans);
|
||||
J3DGDWriteXFCmdHdr(0x100E, 4);
|
||||
/* Nonmatching */
|
||||
u8* end = GDGetCurrPointer();
|
||||
DCFlushRange(start, end - start);
|
||||
}
|
||||
|
||||
/* 802E17B4-802E1800 .text patch__20J3DColorBlockLightOnFv */
|
||||
@@ -380,16 +405,26 @@ void J3DColorBlockLightOn::patchMatColor() {
|
||||
GDSetCurrOffset(mMatColorOffset);
|
||||
u8* start = GDGetCurrPointer();
|
||||
GDOverflowCheck(SizeOfLoadMatColors);
|
||||
J3DGDWriteXFCmdHdr(0x100C, 2);
|
||||
J3DGDWrite_u32(*(u32*)(&mMatColor[0]));
|
||||
J3DGDWrite_u32(*(u32*)(&mMatColor[1]));
|
||||
loadMatColors((J3DGXColor*)mMatColor);
|
||||
u8* end = GDGetCurrPointer();
|
||||
DCFlushRange(start, (u32)(end - start));
|
||||
DCFlushRange(start, end - start);
|
||||
}
|
||||
|
||||
/* 802E19AC-802E1E18 .text patchLight__20J3DColorBlockLightOnFv */
|
||||
void J3DColorBlockLightOn::patchLight() {
|
||||
/* Nonmatching */
|
||||
GDSetCurrOffset(mColorChanOffset);
|
||||
u8* start = GDGetCurrPointer();
|
||||
GDOverflowCheck(SizeOfLoadColorChans);
|
||||
J3DGDWriteXFCmdHdr(0x100E, 4);
|
||||
/* Nonmatching */
|
||||
for (u32 i = 0; i < 8; i++) {
|
||||
if (mLight[i]) {
|
||||
mLight[i]->load(i);
|
||||
}
|
||||
}
|
||||
u8* end = GDGetCurrPointer();
|
||||
DCFlushRange(start, end - start);
|
||||
}
|
||||
|
||||
/* 802E1E18-802E1E80 .text diff__21J3DColorBlockLightOffFUl */
|
||||
@@ -403,13 +438,13 @@ void J3DColorBlockLightOff::diff(u32 flag) {
|
||||
/* 802E1E80-802E1FFC .text diffMatColor__21J3DColorBlockLightOffFv */
|
||||
void J3DColorBlockLightOff::diffMatColor() {
|
||||
GDOverflowCheck(SizeOfLoadMatColors);
|
||||
J3DGDWriteXFCmdHdr(0x100C, 2);
|
||||
J3DGDWrite_u32(*(u32*)(&mMatColor[0]));
|
||||
J3DGDWrite_u32(*(u32*)(&mMatColor[1]));
|
||||
loadMatColors((J3DGXColor*)mMatColor);
|
||||
}
|
||||
|
||||
/* 802E1FFC-802E2408 .text diffLight__21J3DColorBlockLightOffFv */
|
||||
void J3DColorBlockLightOff::diffLight() {
|
||||
GDOverflowCheck(SizeOfLoadColorChans);
|
||||
J3DGDWriteXFCmdHdr(0x100E, 4);
|
||||
/* Nonmatching */
|
||||
}
|
||||
|
||||
@@ -424,9 +459,7 @@ void J3DColorBlockLightOn::diff(u32 flag) {
|
||||
/* 802E2478-802E25F4 .text diffMatColor__20J3DColorBlockLightOnFv */
|
||||
void J3DColorBlockLightOn::diffMatColor() {
|
||||
GDOverflowCheck(SizeOfLoadMatColors);
|
||||
J3DGDWriteXFCmdHdr(0x100C, 2);
|
||||
J3DGDWrite_u32(*(u32*)(&mMatColor[0]));
|
||||
J3DGDWrite_u32(*(u32*)(&mMatColor[1]));
|
||||
loadMatColors((J3DGXColor*)mMatColor);
|
||||
}
|
||||
|
||||
/* 802E25F4-802E2A38 .text diffLight__20J3DColorBlockLightOnFv */
|
||||
@@ -436,27 +469,67 @@ void J3DColorBlockLightOn::diffLight() {
|
||||
|
||||
/* 802E2A38-802E2ACC .text load__15J3DTexGenBlock4Fv */
|
||||
void J3DTexGenBlock4::load() {
|
||||
/* Nonmatching */
|
||||
mTexMtxOffset = GDGetCurrOffset();
|
||||
for (u32 i = 0; i < 4; i++) {
|
||||
if (mTexMtx[i] && mTexCoord[i].getTexGenMtx() != GX_IDENTITY) {
|
||||
mTexMtx[i]->load(i);
|
||||
}
|
||||
}
|
||||
if (mTexGenNum != 0) {
|
||||
loadTexCoordGens(mTexGenNum, mTexCoord);
|
||||
}
|
||||
}
|
||||
|
||||
/* 802E2ACC-802E2B60 .text load__19J3DTexGenBlockBasicFv */
|
||||
void J3DTexGenBlockBasic::load() {
|
||||
/* Nonmatching */
|
||||
mTexMtxOffset = GDGetCurrOffset();
|
||||
for (u32 i = 0; i < 8; i++) {
|
||||
if (mTexMtx[i] && mTexCoord[i].getTexGenMtx() != GX_IDENTITY) {
|
||||
mTexMtx[i]->load(i);
|
||||
}
|
||||
}
|
||||
if (mTexGenNum != 0) {
|
||||
loadTexCoordGens(mTexGenNum, mTexCoord);
|
||||
}
|
||||
}
|
||||
|
||||
/* 802E2B60-802E2BF0 .text patch__21J3DTexGenBlockPatchedFv */
|
||||
void J3DTexGenBlockPatched::patch() {
|
||||
/* Nonmatching */
|
||||
GDSetCurrOffset(mTexMtxOffset);
|
||||
u8* start = GDGetCurrPointer();
|
||||
for (u32 i = 0; i < 8; i++) {
|
||||
if (mTexMtx[i]) {
|
||||
mTexMtx[i]->load(i);
|
||||
}
|
||||
}
|
||||
u8* end = GDGetCurrPointer();
|
||||
DCFlushRange(start, end - start);
|
||||
}
|
||||
|
||||
/* 802E2BF0-802E2C8C .text patch__15J3DTexGenBlock4Fv */
|
||||
void J3DTexGenBlock4::patch() {
|
||||
/* Nonmatching */
|
||||
GDSetCurrOffset(mTexMtxOffset);
|
||||
u8* start = GDGetCurrPointer();
|
||||
for (u32 i = 0; i < 4; i++) {
|
||||
if (mTexMtx[i] && mTexCoord[i].getTexGenMtx() != GX_IDENTITY) {
|
||||
mTexMtx[i]->load(i);
|
||||
}
|
||||
}
|
||||
u8* end = GDGetCurrPointer();
|
||||
DCFlushRange(start, end - start);
|
||||
}
|
||||
|
||||
/* 802E2C8C-802E2D28 .text patch__19J3DTexGenBlockBasicFv */
|
||||
void J3DTexGenBlockBasic::patch() {
|
||||
/* Nonmatching */
|
||||
GDSetCurrOffset(mTexMtxOffset);
|
||||
u8* start = GDGetCurrPointer();
|
||||
for (u32 i = 0; i < 8; i++) {
|
||||
if (mTexMtx[i] && mTexCoord[i].getTexGenMtx() != GX_IDENTITY) {
|
||||
mTexMtx[i]->load(i);
|
||||
}
|
||||
}
|
||||
u8* end = GDGetCurrPointer();
|
||||
DCFlushRange(start, end - start);
|
||||
}
|
||||
|
||||
/* 802E2D28-802E2D90 .text diff__21J3DTexGenBlockPatchedFUl */
|
||||
@@ -491,17 +564,148 @@ void J3DTexGenBlockPatched::diffTexGen() {
|
||||
|
||||
/* 802E2ED0-802E3110 .text load__12J3DTevBlock1Fv */
|
||||
void J3DTevBlock1::load() {
|
||||
/* Nonmatching */
|
||||
mTexNoOffset = GDGetCurrOffset();
|
||||
GDOverflowCheck(0x69);
|
||||
if (mTexNo[0] != 0xffff) {
|
||||
loadTexNo(0, mTexNo[0]);
|
||||
}
|
||||
J3DGDSetTevOrder(
|
||||
GX_TEVSTAGE0,
|
||||
GXTexCoordID(mTevOrder[0].getTevOrderInfo()->mTexCoord),
|
||||
GXTexMapID(mTevOrder[0].getTevOrderInfo()->mTexMap),
|
||||
GXChannelID(mTevOrder[0].getTevOrderInfo()->mColorChan),
|
||||
GX_TEXCOORD_NULL,
|
||||
GX_TEXMAP_NULL,
|
||||
GX_COLOR_NULL
|
||||
);
|
||||
loadTexCoordScale(
|
||||
GXTexCoordID(mTevOrder[0].getTevOrderInfo()->mTexCoord),
|
||||
J3DSys::sTexCoordScaleTable[mTevOrder[0].getTevOrderInfo()->mTexMap & 7]
|
||||
);
|
||||
mTevStage[0].load(0);
|
||||
mIndTevStage[0].load(0);
|
||||
}
|
||||
|
||||
/* 802E3110-802E362C .text load__12J3DTevBlock2Fv */
|
||||
void J3DTevBlock2::load() {
|
||||
/* Nonmatching */
|
||||
u8 tevStageNum = mTevStageNum;
|
||||
mTexNoOffset = GDGetCurrOffset();
|
||||
for (u32 i = 0; i < 2; i++) {
|
||||
if (mTexNo[i] != 0xffff) {
|
||||
loadTexNo(i, mTexNo[i]);
|
||||
}
|
||||
}
|
||||
J3DGDSetTevOrder(
|
||||
GX_TEVSTAGE0,
|
||||
GXTexCoordID(mTevOrder[0].getTevOrderInfo()->mTexCoord),
|
||||
GXTexMapID(mTevOrder[0].getTevOrderInfo()->mTexMap),
|
||||
GXChannelID(mTevOrder[0].getTevOrderInfo()->mColorChan),
|
||||
GXTexCoordID(mTevOrder[1].getTevOrderInfo()->mTexCoord),
|
||||
GXTexMapID(mTevOrder[1].getTevOrderInfo()->mTexMap),
|
||||
GXChannelID(mTevOrder[1].getTevOrderInfo()->mColorChan)
|
||||
);
|
||||
loadTexCoordScale(
|
||||
GXTexCoordID(mTevOrder[0].getTevOrderInfo()->mTexCoord),
|
||||
J3DSys::sTexCoordScaleTable[mTevOrder[0].getTevOrderInfo()->mTexMap & 7]
|
||||
);
|
||||
loadTexCoordScale(
|
||||
GXTexCoordID(mTevOrder[1].getTevOrderInfo()->mTexCoord),
|
||||
J3DSys::sTexCoordScaleTable[mTevOrder[1].getTevOrderInfo()->mTexMap & 7]
|
||||
);
|
||||
mTevRegOffset = GDGetCurrOffset();
|
||||
for (u32 i = 0; i < 3; i++) {
|
||||
loadTevColor(i, ((J3DGXColorS10*)mTevColor)[i]);
|
||||
}
|
||||
for (u32 i = 0; i < 4; i++) {
|
||||
loadTevKColor(i, ((J3DGXColor*)mTevKColor)[i]);
|
||||
}
|
||||
for (u32 i = 0; i < tevStageNum; i++) {
|
||||
mTevStage[i].load(i);
|
||||
mIndTevStage[i].load(i);
|
||||
}
|
||||
for (u32 i = 0; i < 16; i += 4) {
|
||||
J3DGDSetTevKonstantSel_SwapModeTable(
|
||||
GXTevStageID(i),
|
||||
GXTevKColorSel(mTevKColorSel[0]),
|
||||
GXTevKAlphaSel(mTevKAlphaSel[0]),
|
||||
GXTevKColorSel(mTevKColorSel[1]),
|
||||
GXTevKAlphaSel(mTevKAlphaSel[1]),
|
||||
GXTevColorChan(mTevSwapModeTable[i / 4].getR()),
|
||||
GXTevColorChan(mTevSwapModeTable[i / 4].getG())
|
||||
);
|
||||
J3DGDSetTevKonstantSel_SwapModeTable(
|
||||
GXTevStageID(i + 2),
|
||||
GXTevKColorSel(mTevKColorSel[0]),
|
||||
GXTevKAlphaSel(mTevKAlphaSel[0]),
|
||||
GXTevKColorSel(mTevKColorSel[1]),
|
||||
GXTevKAlphaSel(mTevKAlphaSel[1]),
|
||||
GXTevColorChan(mTevSwapModeTable[i / 4].getB()),
|
||||
GXTevColorChan(mTevSwapModeTable[i / 4].getA())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* 802E362C-802E3B70 .text load__12J3DTevBlock4Fv */
|
||||
void J3DTevBlock4::load() {
|
||||
/* Nonmatching */
|
||||
u8 tevStageNum = mTevStageNum;
|
||||
mTexNoOffset = GDGetCurrOffset();
|
||||
for (u32 i = 0; i < 4; i++) {
|
||||
if (mTexNo[i] != 0xffff) {
|
||||
loadTexNo(i, mTexNo[i]);
|
||||
}
|
||||
}
|
||||
for (u32 i = 0; i < mTevStageNum; i += 2) {
|
||||
J3DGDSetTevOrder(
|
||||
GX_TEVSTAGE0,
|
||||
GXTexCoordID(mTevOrder[i].getTevOrderInfo()->mTexCoord),
|
||||
GXTexMapID(mTevOrder[i].getTevOrderInfo()->mTexMap),
|
||||
GXChannelID(mTevOrder[i].getTevOrderInfo()->mColorChan),
|
||||
GXTexCoordID(mTevOrder[i + 1].getTevOrderInfo()->mTexCoord),
|
||||
GXTexMapID(mTevOrder[i + 1].getTevOrderInfo()->mTexMap),
|
||||
GXChannelID(mTevOrder[i + 1].getTevOrderInfo()->mColorChan)
|
||||
);
|
||||
loadTexCoordScale(
|
||||
GXTexCoordID(mTevOrder[i].getTevOrderInfo()->mTexCoord),
|
||||
J3DSys::sTexCoordScaleTable[mTevOrder[i].getTevOrderInfo()->mTexMap & 7]
|
||||
);
|
||||
loadTexCoordScale(
|
||||
GXTexCoordID(mTevOrder[i + 1].getTevOrderInfo()->mTexCoord),
|
||||
J3DSys::sTexCoordScaleTable[mTevOrder[i + 1].getTevOrderInfo()->mTexMap & 7]
|
||||
);
|
||||
}
|
||||
mTevRegOffset = GDGetCurrOffset();
|
||||
for (u32 i = 0; i < 3; i++) {
|
||||
loadTevColor(i, ((J3DGXColorS10*)mTevColor)[i]);
|
||||
}
|
||||
for (u32 i = 0; i < 4; i++) {
|
||||
loadTevKColor(i, ((J3DGXColor*)mTevKColor)[i]);
|
||||
}
|
||||
for (u32 i = 0; i < tevStageNum; i++) {
|
||||
mTevStage[i].load(i);
|
||||
mIndTevStage[i].load(i);
|
||||
}
|
||||
for (u32 i = 0; i < 16; i += 4) {
|
||||
J3DGDSetTevKonstantSel_SwapModeTable(
|
||||
GXTevStageID(i),
|
||||
GXTevKColorSel(mTevKColorSel[0]),
|
||||
GXTevKAlphaSel(mTevKAlphaSel[0]),
|
||||
GXTevKColorSel(mTevKColorSel[1]),
|
||||
GXTevKAlphaSel(mTevKAlphaSel[1]),
|
||||
GXTevColorChan(mTevSwapModeTable[i / 4].getR()),
|
||||
GXTevColorChan(mTevSwapModeTable[i / 4].getG())
|
||||
);
|
||||
J3DGDSetTevKonstantSel_SwapModeTable(
|
||||
GXTevStageID(i + 2),
|
||||
GXTevKColorSel(mTevKColorSel[0]),
|
||||
GXTevKAlphaSel(mTevKAlphaSel[0]),
|
||||
GXTevKColorSel(mTevKColorSel[1]),
|
||||
GXTevKAlphaSel(mTevKAlphaSel[1]),
|
||||
GXTevColorChan(mTevSwapModeTable[i / 4].getB()),
|
||||
GXTevColorChan(mTevSwapModeTable[i / 4].getA())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* 802E3B70-802E40B8 .text load__13J3DTevBlock16Fv */
|
||||
|
||||
@@ -48,11 +48,11 @@ J3DSys::J3DSys() {
|
||||
field_0x104 = NULL;
|
||||
field_0x120 = NULL;
|
||||
|
||||
for (u32 i = 0; i < 32; i += 4) {
|
||||
sTexCoordScaleTable[i + 0] = 1;
|
||||
sTexCoordScaleTable[i + 1] = 1;
|
||||
sTexCoordScaleTable[i + 2] = 0;
|
||||
sTexCoordScaleTable[i + 3] = 0;
|
||||
for (u32 i = 0; i < 8; i ++) {
|
||||
sTexCoordScaleTable[i].field_0x00 = 1;
|
||||
sTexCoordScaleTable[i].field_0x02 = 1;
|
||||
sTexCoordScaleTable[i].field_0x04 = 0;
|
||||
sTexCoordScaleTable[i].field_0x06 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,6 +411,6 @@ J3DSys j3dSys;
|
||||
Mtx J3DSys::mCurrentMtx;
|
||||
Vec J3DSys::mCurrentS;
|
||||
Vec J3DSys::mParentS;
|
||||
u16 J3DSys::sTexCoordScaleTable[32];
|
||||
J3DTexCoordScaleInfo J3DSys::sTexCoordScaleTable[8];
|
||||
|
||||
u32 j3dDefaultViewNo;
|
||||
|
||||
Reference in New Issue
Block a user