SSBM Decomp
Toggle main menu visibility
Loading...
Searching...
No Matches
dat_macros.h
Go to the documentation of this file.
1
15
#ifndef DOLDECOMP_DAT_MACROS_H
16
#define DOLDECOMP_DAT_MACROS_H
17
18
#if defined(__clang__) && defined(DAT_ANNOTATIONS)
19
#define DAT_TAG(tag) __attribute__((btf_decl_tag("dat:" tag)))
20
#else
21
#define DAT_TAG(tag)
22
#endif
23
27
#define DAT_COUNT(count) DAT_TAG("count(" #count ")")
28
32
#define DAT_TERMINATED(value) DAT_TAG("terminated(" #value ")")
33
44
#define DAT_EXTENT DAT_TAG("extent")
45
48
#define DAT_IF(cond) DAT_TAG("if(" #cond ")")
49
57
#define DAT_BIND(name, value) DAT_TAG("bind(" #name ", " #value ")")
58
65
#define DAT_SCRIPT(table, ...) DAT_TAG("script(" #table ", " #__VA_ARGS__ ")")
66
71
#define DAT_BLOB DAT_TAG("blob")
72
75
#define DAT_TYPE(type) DAT_TAG("type(" #type ")")
76
85
#if defined(__clang__) && defined(DAT_ANNOTATIONS)
86
#define DAT_ROOTS_ENABLED 1
87
90
#define DAT_ROOTS(...) __VA_OPT__(DAT_EXPAND(DAT_ROOTS_NEXT(__VA_ARGS__)))
91
92
#define DAT_ROOT(dst, name) \
93
static __typeof__(dst) DAT_CAT(__dat_root_, __COUNTER__) \
94
__attribute__((used)) DAT_TAG("root(" #name ")");
95
96
// A lone trailing argument is the terminator
97
#define DAT_ROOTS_NEXT(a, ...) __VA_OPT__(DAT_ROOTS_PAIR(a, __VA_ARGS__))
98
#define DAT_ROOTS_PAIR(dst, name, ...) \
99
DAT_ROOT(dst, name) \
100
__VA_OPT__(DAT_ROOTS_AGAIN DAT_PARENS(__VA_ARGS__))
101
#define DAT_ROOTS_AGAIN() DAT_ROOTS_NEXT
102
#define DAT_PARENS ()
103
104
// Rescans enough times for 256 pairs
105
#define DAT_EXPAND(...) DAT_EXPAND4(DAT_EXPAND4(DAT_EXPAND4(__VA_ARGS__)))
106
#define DAT_EXPAND4(...) DAT_EXPAND3(DAT_EXPAND3(DAT_EXPAND3(__VA_ARGS__)))
107
#define DAT_EXPAND3(...) DAT_EXPAND2(DAT_EXPAND2(DAT_EXPAND2(__VA_ARGS__)))
108
#define DAT_EXPAND2(...) DAT_EXPAND1(DAT_EXPAND1(DAT_EXPAND1(__VA_ARGS__)))
109
#define DAT_EXPAND1(...) __VA_ARGS__
110
111
#define DAT_CAT(a, b) DAT_CAT_(a, b)
112
#define DAT_CAT_(a, b) a##b
113
#else
114
#define DAT_ROOTS(...)
115
#endif
117
118
#if defined(__clang__) && defined(DAT_ANNOTATIONS) && !defined(TARGET_PC)
127
#include <
dolphin/gx/GXVert.h
>
128
129
static
inline
void
GXPosition2u8(
const
u8
x,
const
u8
y)
130
{
131
GXWGFifo
.u8 = x;
132
GXWGFifo
.u8 = y;
133
}
134
135
static
inline
void
GXPosition3u16(
const
u16
x,
const
u16
y,
const
u16
z)
136
{
137
GXWGFifo
.u16 = x;
138
GXWGFifo
.u16 = y;
139
GXWGFifo
.u16 = z;
140
}
141
142
static
inline
void
GXPosition3u8(
const
u8
x,
const
u8
y,
const
u8
z)
143
{
144
GXWGFifo
.u8 = x;
145
GXWGFifo
.u8 = y;
146
GXWGFifo
.u8 = z;
147
}
148
149
static
inline
void
GXPosition3s8(
const
s8
x,
const
s8
y,
const
s8
z)
150
{
151
GXWGFifo
.s8 = x;
152
GXWGFifo
.s8 = y;
153
GXWGFifo
.s8 = z;
154
}
155
156
static
inline
void
GXPosition2u16(
const
u16
x,
const
u16
y)
157
{
158
GXWGFifo
.u16 = x;
159
GXWGFifo
.u16 = y;
160
}
161
162
static
inline
void
GXPosition2s16(
const
s16
x,
const
s16
y)
163
{
164
GXWGFifo
.s16 = x;
165
GXWGFifo
.s16 = y;
166
}
167
168
static
inline
void
GXPosition2s8(
const
s8
x,
const
s8
y)
169
{
170
GXWGFifo
.s8 = x;
171
GXWGFifo
.s8 = y;
172
}
173
174
static
inline
void
GXPosition1x16(
const
u16
index
)
175
{
176
GXWGFifo
.u16 =
index
;
177
}
178
179
static
inline
void
GXPosition1x8(
const
u8
index
)
180
{
181
GXWGFifo
.u8 =
index
;
182
}
183
184
static
inline
void
GXNormal3s16(
const
s16
x,
const
s16
y,
const
s16
z)
185
{
186
GXWGFifo
.s16 = x;
187
GXWGFifo
.s16 = y;
188
GXWGFifo
.s16 = z;
189
}
190
191
static
inline
void
GXNormal3s8(
const
s8
x,
const
s8
y,
const
s8
z)
192
{
193
GXWGFifo
.s8 = x;
194
GXWGFifo
.s8 = y;
195
GXWGFifo
.s8 = z;
196
}
197
198
static
inline
void
GXNormal1x16(
const
u16
index
)
199
{
200
GXWGFifo
.u16 =
index
;
201
}
202
203
static
inline
void
GXNormal1x8(
const
u8
index
)
204
{
205
GXWGFifo
.u8 =
index
;
206
}
207
208
static
inline
void
GXColor3u8(
const
u8
r,
const
u8
g,
const
u8
b)
209
{
210
GXWGFifo
.u8 = r;
211
GXWGFifo
.u8 = g;
212
GXWGFifo
.u8 = b;
213
}
214
215
static
inline
void
GXColor1u32(
const
u32
clr)
216
{
217
GXWGFifo
.u32 = clr;
218
}
219
220
static
inline
void
GXColor1u16(
const
u16
clr)
221
{
222
GXWGFifo
.u16 = clr;
223
}
224
225
static
inline
void
GXColor1x16(
const
u16
index
)
226
{
227
GXWGFifo
.u16 =
index
;
228
}
229
230
static
inline
void
GXColor1x8(
const
u8
index
)
231
{
232
GXWGFifo
.u8 =
index
;
233
}
234
235
static
inline
void
GXTexCoord2u16(
const
u16
s,
const
u16
t)
236
{
237
GXWGFifo
.u16 = s;
238
GXWGFifo
.u16 = t;
239
}
240
241
static
inline
void
GXTexCoord2u8(
const
u8
s,
const
u8
t)
242
{
243
GXWGFifo
.u8 = s;
244
GXWGFifo
.u8 = t;
245
}
246
247
static
inline
void
GXTexCoord2s8(
const
s8
s,
const
s8
t)
248
{
249
GXWGFifo
.s8 = s;
250
GXWGFifo
.s8 = t;
251
}
252
253
static
inline
void
GXTexCoord1f32(
const
f32
s)
254
{
255
GXWGFifo
.f32 = s;
256
}
257
258
static
inline
void
GXTexCoord1u16(
const
u16
s)
259
{
260
GXWGFifo
.u16 = s;
261
}
262
263
static
inline
void
GXTexCoord1s16(
const
s16
s)
264
{
265
GXWGFifo
.s16 = s;
266
}
267
268
static
inline
void
GXTexCoord1u8(
const
u8
s)
269
{
270
GXWGFifo
.u8 = s;
271
}
272
273
static
inline
void
GXTexCoord1s8(
const
s8
s)
274
{
275
GXWGFifo
.s8 = s;
276
}
277
278
static
inline
void
GXTexCoord1x16(
const
u16
index
)
279
{
280
GXWGFifo
.u16 =
index
;
281
}
283
#endif
284
285
#endif
index
static u8 index[20][3]
Definition
GXDraw.c:424
GXVert.h
GXWGFifo
#define GXWGFifo
Definition
GXVert.h:28
u32
unsigned int u32
Definition
types.h:13
s8
signed char s8
Definition
types.h:4
s16
signed short int s16
Definition
types.h:6
f32
float f32
Definition
types.h:18
u16
unsigned short int u16
Definition
types.h:7
u8
unsigned char u8
Definition
types.h:5
libs
doldecomp
include
dat_macros.h
Generated by
1.17.0