SSBM Decomp
Toggle main menu visibility
Loading...
Searching...
No Matches
dat_macros.h
Go to the documentation of this file.
1
17
#ifndef DOLDECOMP_DAT_MACROS_H
18
#define DOLDECOMP_DAT_MACROS_H
19
20
#if defined(__clang__) && defined(DAT_ANNOTATIONS)
21
#define DAT_TAG(tag) __attribute__((btf_decl_tag("dat:" tag)))
22
#else
23
#define DAT_TAG(tag)
24
#endif
25
30
#define DAT_COUNT(count) DAT_TAG("count(" #count ")")
31
38
#define DAT_TERMINATED(...) DAT_TAG("terminated(" #__VA_ARGS__ ")")
39
50
#define DAT_EXTENT DAT_TAG("extent")
51
54
#define DAT_IF(cond) DAT_TAG("if(" #cond ")")
55
63
#define DAT_BIND(name, value) DAT_TAG("bind(" #name ", " #value ")")
64
71
#define DAT_MATCH(name, values, ...) \
72
DAT_TAG("bind(" #name ", (match " #values " { " #__VA_ARGS__ " }))")
73
88
#define DAT_SCRIPT(...) DAT_TAG("script(" #__VA_ARGS__ ")")
89
97
#define DAT_BYTE_SCRIPT(length) DAT_TAG("bytescript(" #length ")")
98
103
#define DAT_BLOB DAT_TAG("blob")
104
107
#define DAT_TYPE(type) DAT_TAG("type(" #type ")")
108
117
#if defined(__clang__) && defined(DAT_ANNOTATIONS)
118
#define DAT_ROOTS_ENABLED 1
119
122
#define DAT_ROOTS(...) __VA_OPT__(DAT_EXPAND(DAT_ROOTS_NEXT(__VA_ARGS__)))
123
124
#define DAT_ROOT(dst, name) \
125
static __typeof__(dst) DAT_CAT(__dat_root_, __COUNTER__) \
126
__attribute__((used)) DAT_TAG("root(" #name ")");
127
128
// A lone trailing argument is the terminator
129
#define DAT_ROOTS_NEXT(a, ...) __VA_OPT__(DAT_ROOTS_PAIR(a, __VA_ARGS__))
130
#define DAT_ROOTS_PAIR(dst, name, ...) \
131
DAT_ROOT(dst, name) \
132
__VA_OPT__(DAT_ROOTS_AGAIN DAT_PARENS(__VA_ARGS__))
133
#define DAT_ROOTS_AGAIN() DAT_ROOTS_NEXT
134
#define DAT_PARENS ()
135
136
// Rescans enough times for 256 pairs
137
#define DAT_EXPAND(...) DAT_EXPAND4(DAT_EXPAND4(DAT_EXPAND4(__VA_ARGS__)))
138
#define DAT_EXPAND4(...) DAT_EXPAND3(DAT_EXPAND3(DAT_EXPAND3(__VA_ARGS__)))
139
#define DAT_EXPAND3(...) DAT_EXPAND2(DAT_EXPAND2(DAT_EXPAND2(__VA_ARGS__)))
140
#define DAT_EXPAND2(...) DAT_EXPAND1(DAT_EXPAND1(DAT_EXPAND1(__VA_ARGS__)))
141
#define DAT_EXPAND1(...) __VA_ARGS__
142
143
#define DAT_CAT(a, b) DAT_CAT_(a, b)
144
#define DAT_CAT_(a, b) a##b
145
#else
146
#define DAT_ROOTS(...)
147
#endif
149
150
#if defined(__clang__) && defined(DAT_ANNOTATIONS) && !defined(TARGET_PC)
159
#include <
dolphin/gx/GXVert.h
>
160
161
static
inline
void
GXPosition2u8(
const
u8
x
,
const
u8
y
)
162
{
163
GXWGFifo
.u8 =
x
;
164
GXWGFifo
.u8 =
y
;
165
}
166
167
static
inline
void
GXPosition3u16(
const
u16
x
,
const
u16
y
,
const
u16
z)
168
{
169
GXWGFifo
.u16 =
x
;
170
GXWGFifo
.u16 =
y
;
171
GXWGFifo
.u16 = z;
172
}
173
174
static
inline
void
GXPosition3u8(
const
u8
x
,
const
u8
y
,
const
u8
z)
175
{
176
GXWGFifo
.u8 =
x
;
177
GXWGFifo
.u8 =
y
;
178
GXWGFifo
.u8 = z;
179
}
180
181
static
inline
void
GXPosition3s8(
const
s8
x
,
const
s8
y
,
const
s8
z)
182
{
183
GXWGFifo
.s8 =
x
;
184
GXWGFifo
.s8 =
y
;
185
GXWGFifo
.s8 = z;
186
}
187
188
static
inline
void
GXPosition2u16(
const
u16
x
,
const
u16
y
)
189
{
190
GXWGFifo
.u16 =
x
;
191
GXWGFifo
.u16 =
y
;
192
}
193
194
static
inline
void
GXPosition2s16(
const
s16
x
,
const
s16
y
)
195
{
196
GXWGFifo
.s16 =
x
;
197
GXWGFifo
.s16 =
y
;
198
}
199
200
static
inline
void
GXPosition2s8(
const
s8
x
,
const
s8
y
)
201
{
202
GXWGFifo
.s8 =
x
;
203
GXWGFifo
.s8 =
y
;
204
}
205
206
static
inline
void
GXPosition1x16(
const
u16
index
)
207
{
208
GXWGFifo
.u16 =
index
;
209
}
210
211
static
inline
void
GXPosition1x8(
const
u8
index
)
212
{
213
GXWGFifo
.u8 =
index
;
214
}
215
216
static
inline
void
GXNormal3s16(
const
s16
x
,
const
s16
y
,
const
s16
z)
217
{
218
GXWGFifo
.s16 =
x
;
219
GXWGFifo
.s16 =
y
;
220
GXWGFifo
.s16 = z;
221
}
222
223
static
inline
void
GXNormal3s8(
const
s8
x
,
const
s8
y
,
const
s8
z)
224
{
225
GXWGFifo
.s8 =
x
;
226
GXWGFifo
.s8 =
y
;
227
GXWGFifo
.s8 = z;
228
}
229
230
static
inline
void
GXNormal1x16(
const
u16
index
)
231
{
232
GXWGFifo
.u16 =
index
;
233
}
234
235
static
inline
void
GXNormal1x8(
const
u8
index
)
236
{
237
GXWGFifo
.u8 =
index
;
238
}
239
240
static
inline
void
GXColor3u8(
const
u8
r,
const
u8
g,
const
u8
b)
241
{
242
GXWGFifo
.u8 = r;
243
GXWGFifo
.u8 = g;
244
GXWGFifo
.u8 = b;
245
}
246
247
static
inline
void
GXColor1u32(
const
u32
clr)
248
{
249
GXWGFifo
.u32 = clr;
250
}
251
252
static
inline
void
GXColor1u16(
const
u16
clr)
253
{
254
GXWGFifo
.u16 = clr;
255
}
256
257
static
inline
void
GXColor1x16(
const
u16
index
)
258
{
259
GXWGFifo
.u16 =
index
;
260
}
261
262
static
inline
void
GXColor1x8(
const
u8
index
)
263
{
264
GXWGFifo
.u8 =
index
;
265
}
266
267
static
inline
void
GXTexCoord2u16(
const
u16
s,
const
u16
t)
268
{
269
GXWGFifo
.u16 = s;
270
GXWGFifo
.u16 = t;
271
}
272
273
static
inline
void
GXTexCoord2u8(
const
u8
s,
const
u8
t)
274
{
275
GXWGFifo
.u8 = s;
276
GXWGFifo
.u8 = t;
277
}
278
279
static
inline
void
GXTexCoord2s8(
const
s8
s,
const
s8
t)
280
{
281
GXWGFifo
.s8 = s;
282
GXWGFifo
.s8 = t;
283
}
284
285
static
inline
void
GXTexCoord1f32(
const
f32
s)
286
{
287
GXWGFifo
.f32 = s;
288
}
289
290
static
inline
void
GXTexCoord1u16(
const
u16
s)
291
{
292
GXWGFifo
.u16 = s;
293
}
294
295
static
inline
void
GXTexCoord1s16(
const
s16
s)
296
{
297
GXWGFifo
.s16 = s;
298
}
299
300
static
inline
void
GXTexCoord1u8(
const
u8
s)
301
{
302
GXWGFifo
.u8 = s;
303
}
304
305
static
inline
void
GXTexCoord1s8(
const
s8
s)
306
{
307
GXWGFifo
.s8 = s;
308
}
309
310
static
inline
void
GXTexCoord1x16(
const
u16
index
)
311
{
312
GXWGFifo
.u16 =
index
;
313
}
315
#endif
316
323
#if defined(__clang__) && defined(DAT_ANNOTATIONS)
325
typedef
float (*
MtxPtr
)[4]
DAT_TYPE
(
Mtx
);
326
typedef
float (*
Mtx44Ptr
)[4]
DAT_TYPE
(
Mtx44
);
327
typedef
float (*
ROMtxPtr
)[3]
DAT_TYPE
(
ROMtx
);
328
#endif
330
331
#endif
index
static u8 index[20][3]
Definition
GXDraw.c:424
GXVert.h
GXWGFifo
#define GXWGFifo
Definition
GXVert.h:28
DAT_TYPE
#define DAT_TYPE(type)
The untyped pointer, or pointer-sized integer, refers to a type when it is relocated.
Definition
dat_macros.h:107
Mtx44Ptr
f32(* Mtx44Ptr)[4]
Definition
mtx.h:54
ROMtxPtr
f32(* ROMtxPtr)[3]
Definition
mtx.h:57
MtxPtr
f32(* MtxPtr)[4]
Definition
mtx.h:53
ROMtx
f32 ROMtx[4][3]
Definition
mtx.h:56
Mtx44
f32 Mtx44[4][4]
Definition
mtx.h:51
Mtx
f32 Mtx[3][4]
Definition
mtx.h:50
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
y
int y
Definition
types.h:1
x
int x
Definition
types.h:0
libs
doldecomp
include
dat_macros.h
Generated by
1.17.0