Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
J3DGD.h
Go to the documentation of this file.
1#ifndef J3DGD_H
2#define J3DGD_H
3
4#include "dolphin/gd/GDBase.h"
5
6inline void J3DGDWrite_u8(u8 param) {
7 __GDWrite(param);
8}
9
10inline void J3DGDWrite_u16(u16 param) {
11 __GDWrite((param & 0xffff) >> 8);
12 __GDWrite(param & 0xff);
13}
14
15inline void J3DGDWrite_u32(u32 param) {
16 __GDWrite((param >> 24) & 0xff);
17 __GDWrite((param >> 16) & 0xff);
18 __GDWrite((param >> 8) & 0xff);
19 __GDWrite(param & 0xff);
20}
21
22inline void J3DGDWrite_f32(f32 param) {
23 u32 tmp = *(u32*)&param;
25}
26
27inline void J3DGDWriteBPCmd(u32 cmd) {
28 J3DGDWrite_u8(0x61);
29 J3DGDWrite_u32(cmd);
30}
31
32inline void J3DFifoLoadBPCmd(u32 cmd) {
33 GXWGFifo.u8 = 0x61;
34 GXWGFifo.u32 = cmd;
35}
36
37inline void J3DGDWriteXFCmd(u16 addr, u32 cmd) {
38 J3DGDWrite_u8(0x10);
40 J3DGDWrite_u16(addr);
41 J3DGDWrite_u32(cmd);
42}
43
44inline void J3DGDWriteXFCmdHdr(u16 addr, u8 len) {
45 J3DGDWrite_u8(0x10);
47 J3DGDWrite_u16(addr);
48}
49
50inline void J3DFifoWriteXFCmdHdr(u16 addr, u8 len) {
51 GXWGFifo.u8 = 0x10;
52 GXWGFifo.u16 = len - 1;
53 GXWGFifo.u16 = addr;
54}
55
56inline void J3DGXCmd1f32ptr(f32* value) {
57 GXWGFifo.u32 = *(u32*)value;
58}
59
60inline void J3DGXCmd1f32(f32 value) {
61 GXWGFifo.u32 = *(u32*)&value;
62}
63
64inline void J3DGDWriteCPCmd(u8 reg, u32 value) {
67 J3DGDWrite_u32(value);
68}
69
83void J3DGDSetTexImgPtr(GXTexMapID, void*);
104
105static inline void J3DFifoLoadIndx(u8 cmd, u16 indx, u16 addr) {
106 GXWGFifo.u8 = cmd;
107 GXWGFifo.u16 = indx;
108 GXWGFifo.u16 = addr;
109}
110
112 J3DGDWriteXFCmd(0x1009, numChans);
113}
114
118
122
124 J3DGDWriteBPCmd(ref0 | ref1 << 8 | cmp0 << 16 | cmp1 << 19 | op << 22 | 0xF3 << 24);
125}
126
128 J3DGDWriteBPCmd(0xFE00FFE3);
130 (mode == GX_BM_BLEND || mode == GX_BM_SUBTRACT) << 0 |
131 (mode == GX_BM_LOGIC) << 1 |
132 dstFactor << 5 |
133 srcFactor << 8 |
134 (mode == GX_BM_SUBTRACT) << 11 |
135 logicOp << 12 |
136 0x41 << 24);
137}
138
140 J3DGDWriteBPCmd(0xFE00FFE7);
142 u32(mode == GX_BM_BLEND || mode == GX_BM_SUBTRACT) << 0 |
143 (mode == GX_BM_LOGIC) << 1 |
144 ditherEnable << 2 |
145 dstFactor << 5 |
146 srcFactor << 8 |
147 (mode == GX_BM_SUBTRACT) << 11 |
148 logicOp << 12 |
149 0x41 << 24);
150}
151
153 J3DGDWriteBPCmd(compareEnable | func << 1 | writeEnable << 4 | 0x40 << 24);
154}
155
157 J3DGDWriteBPCmd(0xFE000040);
158 J3DGDWriteBPCmd(compLocEnable << 6 | 0x43 << 24);
159}
160
161
162#endif /* J3DGD_H */
static void __GDWrite(u8 data)
Definition GDBase.h:26
enum _GXTevKColorID GXTevKColorID
@ GX_BM_BLEND
Definition GXEnum.h:147
@ GX_BM_SUBTRACT
Definition GXEnum.h:149
@ GX_BM_LOGIC
Definition GXEnum.h:148
enum _GXTexCoordID GXTexCoordID
_GXTlutSize
Definition GXEnum.h:819
enum _GXTexGenSrc GXTexGenSrc
enum _GXIndTexScale GXIndTexScale
enum _GXIndTexStageID GXIndTexStageID
enum _GXTexFmt GXTexFmt
enum _GXTexMapID GXTexMapID
_GXTlutFmt
Definition GXEnum.h:397
enum _GXAlphaOp GXAlphaOp
enum _GXTevColor GXTevColor
enum _GXTexCacheSize GXTexCacheSize
enum _GXBlendMode GXBlendMode
enum _GXLightID GXLightID
enum _GXVtxFmt GXVtxFmt
enum _GXCullMode GXCullMode
enum _GXTevKAlphaSel GXTevKAlphaSel
enum _GXTexWrapMode GXTexWrapMode
enum _GXIndTexMtxID GXIndTexMtxID
enum _GXChannelID GXChannelID
enum _GXTevKColorSel GXTevKColorSel
enum _GXFogType GXFogType
enum _GXTevRegID GXTevRegID
enum _GXTevStageID GXTevStageID
enum _GXCompare GXCompare
enum _GXTexFilter GXTexFilter
enum _GXLogicOp GXLogicOp
enum _GXTexGenType GXTexGenType
enum _GXAnisotropy GXAnisotropy
enum _GXBlendFactor GXBlendFactor
void J3DGDWrite_f32(f32 param)
Definition J3DGD.h:22
void J3DGDSetTexImgPtr(GXTexMapID, void *)
Definition J3DGD.cpp:364
void J3DGDSetIndTexMtx(GXIndTexMtxID, f32(*)[3], s8)
void J3DGDSetGenMode_3Param(u8 texGenNum, u8 tevStageNum, u8 indTexStageNum)
Definition J3DGD.cpp:20
void J3DGDWriteCPCmd(u8 reg, u32 value)
Definition J3DGD.h:64
void J3DGDWriteXFCmdHdr(u16 addr, u8 len)
Definition J3DGD.h:44
void J3DGDWrite_u32(u32 param)
Definition J3DGD.h:15
void J3DFifoLoadNrmMtxImm3x3(f32(*)[3], u32)
void J3DFifoLoadNrmMtxToTexMtx3x3(f32(*)[3], u32)
void J3DGDSetNumTexGens(u8 numTexGens)
Definition J3DGD.h:115
void J3DGDSetTevKColor(GXTevKColorID, GXColor)
Definition J3DGD.cpp:499
void J3DGDSetZCompLoc(u32 compLocEnable)
Definition J3DGD.h:156
void J3DGDSetAlphaCompare(GXCompare cmp0, u8 ref0, GXAlphaOp op, GXCompare cmp1, u8 ref1)
Definition J3DGD.h:123
void J3DGXCmd1f32(f32 value)
Definition J3DGD.h:60
void J3DGDSetBlendMode(GXBlendMode mode, GXBlendFactor srcFactor, GXBlendFactor dstFactor, GXLogicOp logicOp)
Definition J3DGD.h:127
void J3DFifoLoadBPCmd(u32 cmd)
Definition J3DGD.h:32
void J3DGDSetTexLookupMode(GXTexMapID, GXTexWrapMode, GXTexWrapMode, GXTexFilter, GXTexFilter, f32, f32, f32, u8, u8, GXAnisotropy)
Definition J3DGD.cpp:344
void J3DGDWriteBPCmd(u32 cmd)
Definition J3DGD.h:27
void J3DGDSetIndTexOrder(u32, GXTexCoordID, GXTexMapID, GXTexCoordID, GXTexMapID, GXTexCoordID, GXTexMapID, GXTexCoordID, GXTexMapID)
Definition J3DGD.cpp:452
void J3DGDSetIndTexCoordScale(GXIndTexStageID, GXIndTexScale, GXIndTexScale, GXIndTexScale, GXIndTexScale)
Definition J3DGD.cpp:442
void J3DFifoLoadNrmMtxImm(f32(*)[4], u32)
void J3DGDSetTevColorS10(GXTevRegID, GXColorS10)
Definition J3DGD.cpp:509
void J3DGXCmd1f32ptr(f32 *value)
Definition J3DGD.h:56
void J3DGDWrite_u16(u16 param)
Definition J3DGD.h:10
void J3DFifoLoadTexCached(GXTexMapID, u32, GXTexCacheSize, u32, GXTexCacheSize)
Definition J3DGD.cpp:657
void J3DGDSetZMode(u8 compareEnable, GXCompare func, u8 writeEnable)
Definition J3DGD.h:152
void J3DGDLoadTlut(void *, u32, _GXTlutSize)
void J3DGDSetFog(GXFogType, f32, f32, f32, f32, GXColor)
Definition J3DGD.cpp:522
void J3DGDSetTexCoordGen(GXTexGenType, GXTexGenSrc)
Definition J3DGD.cpp:189
void J3DGDSetLightColor(GXLightID, GXColor)
Definition J3DGD.cpp:39
void J3DGDSetFogRangeAdj(u8, u16, _GXFogAdjTable *)
Definition J3DGD.cpp:553
void J3DGDSetNumChans(u8 numChans)
Definition J3DGD.h:111
void J3DGDSetTexTlut(GXTexMapID, u32, _GXTlutFmt)
void J3DGDSetTevKonstantSel_SwapModeTable(GXTevStageID stage, GXTevKColorSel colorSel1, GXTevKAlphaSel alphaSel1, GXTevKColorSel colorSel2, GXTevKAlphaSel alphaSel2, GXTevColor chan1, GXTevColor chan2)
Definition J3DGD.h:119
void J3DGDSetLightDir(GXLightID, f32, f32, f32)
Definition J3DGD.cpp:55
void J3DGDSetTexImgAttr(GXTexMapID, u16, u16, GXTexFmt)
Definition J3DGD.cpp:357
void J3DGDWriteXFCmd(u16 addr, u32 cmd)
Definition J3DGD.h:37
void J3DGDSetLightPos(GXLightID, f32, f32, f32)
Definition J3DGD.cpp:46
static void J3DFifoLoadIndx(u8 cmd, u16 indx, u16 addr)
Definition J3DGD.h:105
void J3DGDSetLightAttn(GXLightID, f32, f32, f32, f32, f32, f32)
Definition J3DGD.cpp:27
void J3DGDSetTevOrder(GXTevStageID, GXTexCoordID, GXTexMapID, GXChannelID, GXTexCoordID, GXTexMapID, GXChannelID)
Definition J3DGD.cpp:482
void J3DGDSetTexImgPtrRaw(GXTexMapID, u32)
Definition J3DGD.cpp:369
void J3DGDWrite_u8(u8 param)
Definition J3DGD.h:6
void J3DFifoLoadNrmMtxToTexMtx(f32(*)[4], u32)
void J3DFifoWriteXFCmdHdr(u16 addr, u8 len)
Definition J3DGD.h:50
void J3DGDSetTexCoordScale2(GXTexCoordID, u16, u8, u8, u16, u8, u8)
Definition J3DGD.cpp:301
void J3DGDSetGenMode(u8 texGenNum, u8 colorChanNum, u8 tevStageNum, u8 IndTexStageNum, GXCullMode cullMode)
Definition J3DGD.cpp:10
void J3DFifoLoadPosMtxImm(f32(*)[4], u32)
void J3DGDSetVtxAttrFmtv(GXVtxFmt, GXVtxAttrFmtList const *, bool)
Definition J3DGD.cpp:64
T cLib_calcTimer(T *value)
Definition c_lib.h:74
static char * tmp[5]
Definition d_a_npc_ashB.cpp:231
Definition d_a_obj_sekizoa.cpp:191
Definition d_a_ep.cpp:68
Definition GXStruct.h:76
Definition GXAttr.h:15
signed char s8
Definition types.h:4
unsigned long u32
Definition types.h:10
float f32
Definition types.h:22
unsigned short u16
Definition types.h:9
unsigned char u8
Definition types.h:8