Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
GXInit.h
Go to the documentation of this file.
1
#ifndef GXINIT_H
2
#define GXINIT_H
3
4
#include "
dolphin/gx/GXTexture.h
"
5
6
typedef
struct
_GXData
{
7
// Bypass and vertex info
8
u16
vNumNot
;
// _000, !(# flush verts to send)
9
u16
bpSentNot
;
// _002, !(bypass reg sent last?)
10
u16
vNum
;
// _004, # flush verts to send
11
u16
vLim
;
// _006, max vert size
12
13
// Command process (CP) regs
14
u32
cpEnable
;
// _008
15
u32
cpStatus
;
// _00C
16
u32
cpClr
;
// _010
17
u32
vcdLo
;
// _014
18
u32
vcdHi
;
// _018
19
u32
vatA
[8];
// _01C
20
u32
vatB
[8];
// _03C
21
u32
vatC
[8];
// _05C
22
u32
lpSize
;
// _07C
23
u32
matIdxA
;
// _080
24
u32
matIdxB
;
// _084
25
26
// Index loading base/stride regs (pos, nrm, tex, light)
27
u32
indexBase
[4];
// _088
28
u32
indexStride
[4];
// _098
29
30
// Transform and lighting regs
31
u32
ambColor
[2];
// _0A8
32
u32
matColor
[2];
// _0B0
33
34
// Setup regs
35
u32
suTs0
[8];
// _0B8
36
u32
suTs1
[8];
// _0D8
37
u32
suScis0
;
// _0F8
38
u32
suScis1
;
// _0FC
39
40
// Raster regs
41
u32
tref
[8];
// _100
42
u32
iref
;
// _120
43
44
// Bump/Indirect texture regs
45
u32
bpMask
;
// _124
46
u32
IndTexScale0
;
// _128
47
u32
IndTexScale1
;
// _12C
48
49
// Tev regs
50
u32
tevc
[16];
// _130
51
u32
teva
[16];
// _170
52
u32
tevKsel
[8];
// _1B0
53
54
// Performance regs
55
u32
cmode0
;
// _1D0
56
u32
cmode1
;
// _1D4
57
u32
zmode
;
// _1D8
58
u32
peCtrl
;
// _1DC
59
60
// Display copy regs
61
u32
cpDispSrc
;
// _1E0
62
u32
cpDispSize
;
// _1E4
63
u32
cpDispStride
;
// _1E8
64
u32
cpDisp
;
// _1EC
65
66
// Texture copy regs
67
u32
cpTexSrc
;
// _1F0
68
u32
cpTexSize
;
// _1F4
69
u32
cpTexStride
;
// _1F8
70
u32
cpTex
;
// _1FC
71
GXBool
cpTexZ
;
// _200
72
73
// General raster mode
74
u32
genMode
;
// _204
75
76
// Texture regions
77
GXTexRegion
TexRegions0
[
GX_MAX_TEXMAP
];
// _208
78
GXTexRegion
TexRegions1
[
GX_MAX_TEXMAP
];
// _288
79
GXTexRegion
TexRegions2
[
GX_MAX_TEXMAP
];
// _308
80
81
// Texture lookup table regions
82
GXTlutRegion
TlutRegions
[
GX_MAX_TLUT_ALL
];
// _388
83
GXTexRegionCallback
texRegionCallback
;
// _4C8
84
GXTlutRegionCallback
tlutRegionCallback
;
// _4CC
85
86
// Command processor vars
87
GXAttrType
nrmType
;
// _4D0
88
GXBool
hasNrms
;
// _4D4
89
GXBool
hasBiNrms
;
// _4D5
90
u32
projType
;
// _4D8
91
f32
projMtx
[6];
// _4DC
92
93
// Viewport parms
94
f32
vpLeft
;
// _4F4
95
f32
vpTop
;
// _4F8
96
f32
vpWd
;
// _4FC
97
f32
vpHt
;
// _500
98
f32
vpNearz
;
// _504
99
f32
vpFarz
;
// _508
100
f32
zOffset
;
// _50C
101
f32
zScale
;
// _510
102
103
// Texture regs
104
u32
tImage0
[8];
// _514
105
u32
tMode0
[8];
// _534
106
u32
texmapId
[16];
// _554
107
u32
tcsManEnab
;
// _594
108
u32
tevTcEnab
;
// _598
109
110
// Performance metrics
111
GXPerf0
perf0
;
// _59C
112
GXPerf1
perf1
;
// _5A0
113
u32
perfSel
;
// _5A4
114
115
// Flags
116
GXBool
inDispList
;
// _5A8
117
GXBool
dlSaveContext
;
// _5A9
118
GXBool
abtWaitPECopy
;
// _5AA
119
u8
dirtyVAT
;
// _5AB
120
u32
dirtyState
;
// _5AC
121
}
GXData
;
// Size: 0x5B0
122
123
STATIC_ASSERT
(
sizeof
(
GXData
) == 0x5B0);
124
125
extern
GXData
*
const
__GXData
;
126
127
// Define register addresses.
128
#define GX_CP_ADDR (0x0C000000)
129
#define GX_PE_ADDR (0x0C001000)
130
#define GX_PI_ADDR (0x0C003000)
131
#define GX_MEM_ADDR (0x0C004000)
132
133
extern
u32
*
__piReg
;
134
extern
u16
*
__cpReg
;
135
extern
u16
*
__peReg
;
136
extern
vu16
*
__memReg
;
137
138
#define GX_GET_MEM_REG(offset) (*(vu16*)((vu16*)(__memReg) + (offset)))
139
#define GX_GET_CP_REG(offset) (*(vu16*)((vu16*)(__cpReg) + (offset)))
140
#define GX_GET_PE_REG(offset) (*(vu16*)((vu16*)(__peReg) + (offset)))
141
#define GX_GET_PI_REG(offset) (*(vu32*)((vu32*)(__piReg) + (offset)))
142
143
#define GX_SET_MEM_REG(offset, val) (*(vu16*)((vu16*)(__memReg) + (offset)) = val)
144
#define GX_SET_CP_REG(offset, val) (*(vu16*)((vu16*)(__cpReg) + (offset)) = val)
145
#define GX_SET_PE_REG(offset, val) (*(vu16*)((vu16*)(__peReg) + (offset)) = val)
146
#define GX_SET_PI_REG(offset, val) (*(vu32*)((vu32*)(__piReg) + (offset)) = val)
147
148
inline
void
GXSetWasteFlags
() {
149
GXData
*
data
=
__GXData
;
150
data
->
dirtyState
|=
GX_DIRTY_SU_TEX
|
GX_DIRTY_BP_MASK
;
151
data
->bpSentNot = 0;
152
}
153
154
static
inline
void
set_x2
(
u16
value)
155
{
156
__GXData
->
bpSentNot
= value;
157
}
158
159
#ifdef __cplusplus
160
extern
"C"
{
161
#endif
162
163
static
inline
u32
GXReadMEMReg
(
u32
addrLo
,
u32
addrHi
)
164
{
165
u32
hiStart
,
hiNew
,
lo
;
166
hiStart
=
GX_GET_MEM_REG
(
addrHi
);
167
do
{
168
hiNew
=
hiStart
;
169
lo
=
GX_GET_MEM_REG
(
addrLo
);
170
hiStart
=
GX_GET_MEM_REG
(
addrHi
);
171
}
while
(
hiStart
!=
hiNew
);
172
173
return
((
hiStart
<< 16) |
lo
);
174
}
175
176
GXTexRegion
*
__GXDefaultTexRegionCallback
(
const
GXTexObj
*
obj
,
GXTexMapID
mapID
);
177
GXTlutRegion
*
__GXDefaultTlutRegionCallback
(
u32
tlut
);
178
BOOL
__GXShutdown
(
BOOL
);
179
void
__GXInitRevisionBits
(
void
);
180
GXFifoObj
*
GXInit
(
void
* base,
u32
size);
181
void
__GXInitGX
(
void
);
182
183
#ifdef __cplusplus
184
};
185
#endif
186
187
#endif
/* GXINIT_H */
GXTexMapID
enum _GXTexMapID GXTexMapID
GX_MAX_TLUT_ALL
@ GX_MAX_TLUT_ALL
Definition
GXEnum.h:427
GXPerf0
enum _GXPerf0 GXPerf0
GXPerf1
enum _GXPerf1 GXPerf1
GX_DIRTY_BP_MASK
@ GX_DIRTY_BP_MASK
Definition
GXEnum.h:835
GX_DIRTY_SU_TEX
@ GX_DIRTY_SU_TEX
Definition
GXEnum.h:834
GX_MAX_TEXMAP
@ GX_MAX_TEXMAP
Definition
GXEnum.h:39
GXBool
u8 GXBool
Definition
GXEnum.h:23
GXAttrType
enum _GXAttrType GXAttrType
__memReg
vu16 * __memReg
Definition
GXInit.c:67
GXInit
GXFifoObj * GXInit(void *base, u32 size)
Definition
GXInit.c:224
__GXDefaultTlutRegionCallback
GXTlutRegion * __GXDefaultTlutRegionCallback(u32 tlut)
Definition
GXInit.c:46
__GXDefaultTexRegionCallback
GXTexRegion * __GXDefaultTexRegionCallback(const GXTexObj *obj, GXTexMapID mapID)
Definition
GXInit.c:17
__peReg
u16 * __peReg
Definition
GXInit.c:70
GXSetWasteFlags
void GXSetWasteFlags()
Definition
GXInit.h:148
__GXInitRevisionBits
void __GXInitRevisionBits(void)
Definition
GXInit.c:134
__cpReg
u16 * __cpReg
Definition
GXInit.c:73
GXData
struct _GXData GXData
__GXInitGX
void __GXInitGX(void)
Definition
GXInit.c:374
__GXShutdown
BOOL __GXShutdown(BOOL)
Definition
GXInit.c:80
GXReadMEMReg
static u32 GXReadMEMReg(u32 addrLo, u32 addrHi)
Definition
GXInit.h:163
set_x2
static void set_x2(u16 value)
Definition
GXInit.h:154
STATIC_ASSERT
STATIC_ASSERT(sizeof(GXData)==0x5B0)
__GXData
GXData *const __GXData
Definition
GXInit.c:14
__piReg
u32 * __piReg
Definition
GXInit.c:77
GXTexture.h
GXTlutRegionCallback
GXTlutRegion *(* GXTlutRegionCallback)(u32 idx)
Definition
GXTexture.h:11
GXTexRegionCallback
GXTexRegion *(* GXTexRegionCallback)(const GXTexObj *t_obj, GXTexMapID id)
Definition
GXTexture.h:10
cLib_calcTimer
T cLib_calcTimer(T *value)
Definition
c_lib.h:74
data
static u16 data[4]
Definition
d_vibration.cpp:114
_GXData
Definition
GXInit.h:6
_GXData::cpDispSrc
u32 cpDispSrc
Definition
GXInit.h:61
_GXData::vpHt
f32 vpHt
Definition
GXInit.h:97
_GXData::matColor
u32 matColor[2]
Definition
GXInit.h:32
_GXData::dirtyState
u32 dirtyState
Definition
GXInit.h:120
_GXData::iref
u32 iref
Definition
GXInit.h:42
_GXData::cpDispSize
u32 cpDispSize
Definition
GXInit.h:62
_GXData::perf1
GXPerf1 perf1
Definition
GXInit.h:112
_GXData::vpNearz
f32 vpNearz
Definition
GXInit.h:98
_GXData::cpEnable
u32 cpEnable
Definition
GXInit.h:14
_GXData::cpTexStride
u32 cpTexStride
Definition
GXInit.h:69
_GXData::cpTexSrc
u32 cpTexSrc
Definition
GXInit.h:67
_GXData::vpTop
f32 vpTop
Definition
GXInit.h:95
_GXData::vpFarz
f32 vpFarz
Definition
GXInit.h:99
_GXData::tMode0
u32 tMode0[8]
Definition
GXInit.h:105
_GXData::projType
u32 projType
Definition
GXInit.h:90
_GXData::tcsManEnab
u32 tcsManEnab
Definition
GXInit.h:107
_GXData::indexStride
u32 indexStride[4]
Definition
GXInit.h:28
_GXData::cmode0
u32 cmode0
Definition
GXInit.h:55
_GXData::cpDispStride
u32 cpDispStride
Definition
GXInit.h:63
_GXData::suScis1
u32 suScis1
Definition
GXInit.h:38
_GXData::vpLeft
f32 vpLeft
Definition
GXInit.h:94
_GXData::nrmType
GXAttrType nrmType
Definition
GXInit.h:87
_GXData::tImage0
u32 tImage0[8]
Definition
GXInit.h:104
_GXData::TexRegions2
GXTexRegion TexRegions2[GX_MAX_TEXMAP]
Definition
GXInit.h:79
_GXData::tevKsel
u32 tevKsel[8]
Definition
GXInit.h:52
_GXData::cpTexSize
u32 cpTexSize
Definition
GXInit.h:68
_GXData::zScale
f32 zScale
Definition
GXInit.h:101
_GXData::tlutRegionCallback
GXTlutRegionCallback tlutRegionCallback
Definition
GXInit.h:84
_GXData::ambColor
u32 ambColor[2]
Definition
GXInit.h:31
_GXData::perfSel
u32 perfSel
Definition
GXInit.h:113
_GXData::TexRegions1
GXTexRegion TexRegions1[GX_MAX_TEXMAP]
Definition
GXInit.h:78
_GXData::cmode1
u32 cmode1
Definition
GXInit.h:56
_GXData::vatA
u32 vatA[8]
Definition
GXInit.h:19
_GXData::vpWd
f32 vpWd
Definition
GXInit.h:96
_GXData::vcdLo
u32 vcdLo
Definition
GXInit.h:17
_GXData::tref
u32 tref[8]
Definition
GXInit.h:41
_GXData::vNum
u16 vNum
Definition
GXInit.h:10
_GXData::vatB
u32 vatB[8]
Definition
GXInit.h:20
_GXData::texRegionCallback
GXTexRegionCallback texRegionCallback
Definition
GXInit.h:83
_GXData::IndTexScale1
u32 IndTexScale1
Definition
GXInit.h:47
_GXData::hasBiNrms
GXBool hasBiNrms
Definition
GXInit.h:89
_GXData::cpTex
u32 cpTex
Definition
GXInit.h:70
_GXData::zmode
u32 zmode
Definition
GXInit.h:57
_GXData::suScis0
u32 suScis0
Definition
GXInit.h:37
_GXData::suTs1
u32 suTs1[8]
Definition
GXInit.h:36
_GXData::cpStatus
u32 cpStatus
Definition
GXInit.h:15
_GXData::vLim
u16 vLim
Definition
GXInit.h:11
_GXData::tevc
u32 tevc[16]
Definition
GXInit.h:50
_GXData::dlSaveContext
GXBool dlSaveContext
Definition
GXInit.h:117
_GXData::matIdxB
u32 matIdxB
Definition
GXInit.h:24
_GXData::peCtrl
u32 peCtrl
Definition
GXInit.h:58
_GXData::cpDisp
u32 cpDisp
Definition
GXInit.h:64
_GXData::tevTcEnab
u32 tevTcEnab
Definition
GXInit.h:108
_GXData::abtWaitPECopy
GXBool abtWaitPECopy
Definition
GXInit.h:118
_GXData::vcdHi
u32 vcdHi
Definition
GXInit.h:18
_GXData::cpClr
u32 cpClr
Definition
GXInit.h:16
_GXData::cpTexZ
GXBool cpTexZ
Definition
GXInit.h:71
_GXData::teva
u32 teva[16]
Definition
GXInit.h:51
_GXData::bpMask
u32 bpMask
Definition
GXInit.h:45
_GXData::genMode
u32 genMode
Definition
GXInit.h:74
_GXData::vatC
u32 vatC[8]
Definition
GXInit.h:21
_GXData::inDispList
GXBool inDispList
Definition
GXInit.h:116
_GXData::hasNrms
GXBool hasNrms
Definition
GXInit.h:88
_GXData::lpSize
u32 lpSize
Definition
GXInit.h:22
_GXData::IndTexScale0
u32 IndTexScale0
Definition
GXInit.h:46
_GXData::zOffset
f32 zOffset
Definition
GXInit.h:100
_GXData::bpSentNot
u16 bpSentNot
Definition
GXInit.h:9
_GXData::TlutRegions
GXTlutRegion TlutRegions[GX_MAX_TLUT_ALL]
Definition
GXInit.h:82
_GXData::projMtx
f32 projMtx[6]
Definition
GXInit.h:91
_GXData::TexRegions0
GXTexRegion TexRegions0[GX_MAX_TEXMAP]
Definition
GXInit.h:77
_GXData::vNumNot
u16 vNumNot
Definition
GXInit.h:8
_GXData::dirtyVAT
u8 dirtyVAT
Definition
GXInit.h:119
_GXData::indexBase
u32 indexBase[4]
Definition
GXInit.h:27
_GXData::suTs0
u32 suTs0[8]
Definition
GXInit.h:35
_GXData::texmapId
u32 texmapId[16]
Definition
GXInit.h:106
_GXData::perf0
GXPerf0 perf0
Definition
GXInit.h:111
_GXData::matIdxA
u32 matIdxA
Definition
GXInit.h:23
_GXFifoObj
Definition
GXStruct.h:80
_GXTexObj
Definition
d_a_ep.cpp:147
_GXTexRegion
Definition
GXStruct.h:95
_GXTlutRegion
Definition
GXStruct.h:103
BOOL
int BOOL
Definition
types.h:27
u32
unsigned long u32
Definition
types.h:10
f32
float f32
Definition
types.h:22
vu16
volatile u16 vu16
Definition
types.h:14
u16
unsigned short u16
Definition
types.h:9
u8
unsigned char u8
Definition
types.h:8
include
dolphin
gx
GXInit.h
Generated by
1.9.8