src/platform/wii/main.c (view raw)
1/* Copyright (c) 2013-2015 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#define asm __asm__
7
8#include <fat.h>
9#include <gccore.h>
10#include <malloc.h>
11#include <wiiuse/wpad.h>
12
13#include "util/common.h"
14
15#include "gba/renderers/video-software.h"
16#include "gba/context/context.h"
17#include "gba/gui/gui-runner.h"
18#include "util/gui.h"
19#include "util/gui/file-select.h"
20#include "util/gui/font.h"
21#include "util/vfs.h"
22
23#define SAMPLES 1024
24
25static void GBAWiiLog(struct GBAThread* thread, enum GBALogLevel level, const char* format, va_list args);
26
27static void _audioDMA(void);
28static void _setRumble(struct GBARumble* rumble, int enable);
29static void _sampleRotation(struct GBARotationSource* source);
30static int32_t _readTiltX(struct GBARotationSource* source);
31static int32_t _readTiltY(struct GBARotationSource* source);
32static int32_t _readGyroZ(struct GBARotationSource* source);
33
34static void _drawStart(void);
35static void _drawEnd(void);
36static uint32_t _pollInput(void);
37static enum GUICursorState _pollCursor(int* x, int* y);
38static void _guiPrepare(void);
39static void _guiFinish(void);
40
41static void _setup(struct GBAGUIRunner* runner);
42static void _gameLoaded(struct GBAGUIRunner* runner);
43static void _gameUnloaded(struct GBAGUIRunner* runner);
44static void _drawFrame(struct GBAGUIRunner* runner, bool faded);
45static uint16_t _pollGameInput(struct GBAGUIRunner* runner);
46
47static struct GBAVideoSoftwareRenderer renderer;
48static struct GBARumble rumble;
49static struct GBARotationSource rotation;
50static FILE* logfile;
51static GXRModeObj* mode;
52static Mtx model, view, modelview;
53static uint16_t* texmem;
54static GXTexObj tex;
55static int32_t tiltX;
56static int32_t tiltY;
57static int32_t gyroZ;
58
59static void* framebuffer[2];
60static int whichFb = 0;
61
62static struct GBAStereoSample audioBuffer[3][SAMPLES] __attribute__((__aligned__(32)));
63static volatile size_t audioBufferSize = 0;
64static volatile int currentAudioBuffer = 0;
65
66static struct GUIFont* font;
67
68int main() {
69 VIDEO_Init();
70 PAD_Init();
71 WPAD_Init();
72 WPAD_SetDataFormat(0, WPAD_FMT_BTNS_ACC_IR);
73 AUDIO_Init(0);
74 AUDIO_SetDSPSampleRate(AI_SAMPLERATE_48KHZ);
75 AUDIO_RegisterDMACallback(_audioDMA);
76
77 memset(audioBuffer, 0, sizeof(audioBuffer));
78
79#if !defined(COLOR_16_BIT) && !defined(COLOR_5_6_5)
80#error This pixel format is unsupported. Please use -DCOLOR_16-BIT -DCOLOR_5_6_5
81#endif
82
83 mode = VIDEO_GetPreferredMode(0);
84 framebuffer[0] = SYS_AllocateFramebuffer(mode);
85 framebuffer[1] = SYS_AllocateFramebuffer(mode);
86
87 VIDEO_Configure(mode);
88 VIDEO_SetNextFramebuffer(framebuffer[whichFb]);
89 VIDEO_SetBlack(FALSE);
90 VIDEO_Flush();
91 VIDEO_WaitVSync();
92 if (mode->viTVMode & VI_NON_INTERLACE) {
93 VIDEO_WaitVSync();
94 }
95
96 GXColor bg = { 0, 0, 0, 0xFF };
97 void* fifo = memalign(32, 0x40000);
98 memset(fifo, 0, 0x40000);
99 GX_Init(fifo, 0x40000);
100 GX_SetCopyClear(bg, 0x00FFFFFF);
101 GX_SetViewport(0, 0, mode->fbWidth, mode->efbHeight, 0, 1);
102
103 f32 yscale = GX_GetYScaleFactor(mode->efbHeight, mode->xfbHeight);
104 u32 xfbHeight = GX_SetDispCopyYScale(yscale);
105 GX_SetScissor(0, 0, mode->viWidth, mode->viWidth);
106 GX_SetDispCopySrc(0, 0, mode->fbWidth, mode->efbHeight);
107 GX_SetDispCopyDst(mode->fbWidth, xfbHeight);
108 GX_SetCopyFilter(mode->aa, mode->sample_pattern, GX_TRUE, mode->vfilter);
109 GX_SetFieldMode(mode->field_rendering, ((mode->viHeight == 2 * mode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
110
111 GX_SetCullMode(GX_CULL_NONE);
112 GX_CopyDisp(framebuffer[whichFb], GX_TRUE);
113 GX_SetDispCopyGamma(GX_GM_1_0);
114
115 GX_ClearVtxDesc();
116 GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
117 GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
118 GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
119
120 GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XY, GX_S16, 0);
121 GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_S16, 0);
122 GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
123
124 GX_SetNumChans(1);
125 GX_SetNumTexGens(1);
126 GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
127 GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
128
129 GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
130 GX_InvVtxCache();
131 GX_InvalidateTexAll();
132
133 guVector cam = { 0.0f, 0.0f, 0.0f };
134 guVector up = { 0.0f, 1.0f, 0.0f };
135 guVector look = { 0.0f, 0.0f, -1.0f };
136 guLookAt(view, &cam, &up, &look);
137
138 guMtxIdentity(model);
139 guMtxTransApply(model, model, 0.0f, 0.0f, -6.0f);
140 guMtxConcat(view, model, modelview);
141 GX_LoadPosMtxImm(modelview, GX_PNMTX0);
142
143 texmem = memalign(32, 256 * 256 * BYTES_PER_PIXEL);
144 memset(texmem, 0, 256 * 256 * BYTES_PER_PIXEL);
145 GX_InitTexObj(&tex, texmem, 256, 256, GX_TF_RGB565, GX_CLAMP, GX_CLAMP, GX_FALSE);
146
147 font = GUIFontCreate();
148
149 fatInitDefault();
150
151 logfile = fopen("/mgba.log", "w");
152
153 rumble.setRumble = _setRumble;
154
155 rotation.sample = _sampleRotation;
156 rotation.readTiltX = _readTiltX;
157 rotation.readTiltY = _readTiltY;
158 rotation.readGyroZ = _readGyroZ;
159
160 struct GBAGUIRunner runner = {
161 .params = {
162 352, 230,
163 font, "/",
164 _drawStart, _drawEnd,
165 _pollInput, _pollCursor,
166 _guiPrepare, _guiFinish,
167
168 GUI_PARAMS_TRAIL
169 },
170 .setup = _setup,
171 .teardown = 0,
172 .gameLoaded = _gameLoaded,
173 .gameUnloaded = _gameUnloaded,
174 .prepareForFrame = 0,
175 .drawFrame = _drawFrame,
176 .paused = _gameUnloaded,
177 .unpaused = 0,
178 .pollGameInput = _pollGameInput
179 };
180 GBAGUIInit(&runner, 0);
181 GBAGUIRunloop(&runner);
182 GBAGUIDeinit(&runner);
183
184 fclose(logfile);
185 free(fifo);
186
187 free(renderer.outputBuffer);
188 GUIFontDestroy(font);
189
190 return 0;
191}
192
193void GBAWiiLog(struct GBAThread* thread, enum GBALogLevel level, const char* format, va_list args) {
194 UNUSED(thread);
195 UNUSED(level);
196 if (!logfile) {
197 return;
198 }
199 vfprintf(logfile, format, args);
200 fprintf(logfile, "\n");
201 fflush(logfile);
202}
203
204static void _audioDMA(void) {
205 if (!audioBufferSize) {
206 return;
207 }
208 DCFlushRange(audioBuffer[currentAudioBuffer], audioBufferSize * sizeof(struct GBAStereoSample));
209 AUDIO_InitDMA((u32) audioBuffer[currentAudioBuffer], audioBufferSize * sizeof(struct GBAStereoSample));
210 currentAudioBuffer = (currentAudioBuffer + 1) % 3;
211 audioBufferSize = 0;
212}
213
214static void _drawStart(void) {
215 VIDEO_WaitVSync();
216 GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
217 GX_SetColorUpdate(GX_TRUE);
218
219 GX_SetViewport(0, 0, mode->fbWidth, mode->efbHeight, 0, 1);
220}
221
222static void _drawEnd(void) {
223 GX_DrawDone();
224
225 whichFb = !whichFb;
226
227 GX_CopyDisp(framebuffer[whichFb], GX_TRUE);
228 VIDEO_SetNextFramebuffer(framebuffer[whichFb]);
229 VIDEO_Flush();
230}
231
232static uint32_t _pollInput(void) {
233 PAD_ScanPads();
234 u16 padkeys = PAD_ButtonsHeld(0);
235
236 WPAD_ScanPads();
237 u32 wiiPad = WPAD_ButtonsHeld(0);
238 u32 ext = 0;
239 WPAD_Probe(0, &ext);
240
241 int keys = 0;
242 int x = PAD_StickX(0);
243 int y = PAD_StickY(0);
244 if (x < -0x40) {
245 keys |= 1 << GUI_INPUT_LEFT;
246 }
247 if (x > 0x40) {
248 keys |= 1 << GUI_INPUT_RIGHT;
249 }
250 if (y < -0x40) {
251 keys |= 1 << GUI_INPUT_DOWN;
252 }
253 if (y > 0x40) {
254 keys |= 1 << GUI_INPUT_UP;
255 }
256 if ((padkeys & PAD_BUTTON_A) || (wiiPad & WPAD_BUTTON_2) ||
257 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & (WPAD_CLASSIC_BUTTON_A | WPAD_CLASSIC_BUTTON_Y)))) {
258 keys |= 1 << GUI_INPUT_SELECT;
259 }
260 if ((padkeys & PAD_BUTTON_B) || (wiiPad & WPAD_BUTTON_1) || (wiiPad & WPAD_BUTTON_B) ||
261 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & (WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_X)))) {
262 keys |= 1 << GUI_INPUT_BACK;
263 }
264 if ((padkeys & PAD_TRIGGER_Z) || (wiiPad & WPAD_BUTTON_HOME) ||
265 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & (WPAD_CLASSIC_BUTTON_HOME)))) {
266 keys |= 1 << GUI_INPUT_CANCEL;
267 }
268 if ((padkeys & PAD_BUTTON_LEFT)|| (wiiPad & WPAD_BUTTON_UP) ||
269 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & WPAD_CLASSIC_BUTTON_LEFT))) {
270 keys |= 1 << GUI_INPUT_LEFT;
271 }
272 if ((padkeys & PAD_BUTTON_RIGHT) || (wiiPad & WPAD_BUTTON_DOWN) ||
273 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & WPAD_CLASSIC_BUTTON_RIGHT))) {
274 keys |= 1 << GUI_INPUT_RIGHT;
275 }
276 if ((padkeys & PAD_BUTTON_UP) || (wiiPad & WPAD_BUTTON_RIGHT) ||
277 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & WPAD_CLASSIC_BUTTON_UP))) {
278 keys |= 1 << GUI_INPUT_UP;
279 }
280 if ((padkeys & PAD_BUTTON_DOWN) || (wiiPad & WPAD_BUTTON_LEFT) ||
281 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & WPAD_CLASSIC_BUTTON_DOWN))) {
282 keys |= 1 << GUI_INPUT_DOWN;
283 }
284 return keys;
285}
286
287static enum GUICursorState _pollCursor(int* x, int* y) {
288 ir_t ir;
289 WPAD_IR(0, &ir);
290 if (!ir.smooth_valid) {
291 return GUI_CURSOR_NOT_PRESENT;
292 }
293 *x = ir.sx;
294 *y = ir.sy;
295 WPAD_ScanPads();
296 u32 wiiPad = WPAD_ButtonsHeld(0);
297 if (wiiPad & WPAD_BUTTON_A) {
298 return GUI_CURSOR_DOWN;
299 }
300 return GUI_CURSOR_UP;
301}
302
303void _guiPrepare(void) {
304 Mtx44 proj;
305 guOrtho(proj, -20, 240, 0, 352, 0, 300);
306 GX_LoadProjectionMtx(proj, GX_ORTHOGRAPHIC);
307}
308
309void _guiFinish(void) {
310 Mtx44 proj;
311 guOrtho(proj, -10, VIDEO_VERTICAL_PIXELS + 10, 0, VIDEO_HORIZONTAL_PIXELS, 0, 300);
312 GX_LoadProjectionMtx(proj, GX_ORTHOGRAPHIC);
313}
314
315void _setup(struct GBAGUIRunner* runner) {
316 struct GBAOptions opts = {
317 .useBios = true,
318 .logLevel = 0,
319 .idleOptimization = IDLE_LOOP_DETECT
320 };
321 GBAConfigLoadDefaults(&runner->context.config, &opts);
322 runner->context.gba->logHandler = GBAWiiLog;
323 runner->context.gba->rumble = &rumble;
324 runner->context.gba->rotationSource = &rotation;
325
326 GBAVideoSoftwareRendererCreate(&renderer);
327 renderer.outputBuffer = memalign(32, 256 * 256 * BYTES_PER_PIXEL);
328 renderer.outputBufferStride = 256;
329 runner->context.renderer = &renderer.d;
330
331 GBAAudioResizeBuffer(&runner->context.gba->audio, SAMPLES);
332
333#if RESAMPLE_LIBRARY == RESAMPLE_BLIP_BUF
334 double ratio = GBAAudioCalculateRatio(1, 60 / 1.001, 1);
335 blip_set_rates(runner->context.gba->audio.left, GBA_ARM7TDMI_FREQUENCY, 48000 * ratio);
336 blip_set_rates(runner->context.gba->audio.right, GBA_ARM7TDMI_FREQUENCY, 48000 * ratio);
337#endif
338}
339
340void _gameUnloaded(struct GBAGUIRunner* runner) {
341 UNUSED(runner);
342 AUDIO_StopDMA();
343}
344
345void _gameLoaded(struct GBAGUIRunner* runner) {
346 if (runner->context.gba->memory.hw.devices & HW_GYRO) {
347 int i;
348 for (i = 0; i < 6; ++i) {
349 u32 result = WPAD_SetMotionPlus(0, 1);
350 if (result == WPAD_ERR_NONE) {
351 break;
352 }
353 sleep(1);
354 }
355 }
356}
357
358void _drawFrame(struct GBAGUIRunner* runner, bool faded) {
359#if RESAMPLE_LIBRARY == RESAMPLE_BLIP_BUF
360 int available = blip_samples_avail(runner->context.gba->audio.left);
361 if (available + audioBufferSize > SAMPLES) {
362 available = SAMPLES - audioBufferSize;
363 }
364 available &= ~((32 / sizeof(struct GBAStereoSample)) - 1); // Force align to 32 bytes
365 if (available > 0) {
366 blip_read_samples(runner->context.gba->audio.left, &audioBuffer[currentAudioBuffer][audioBufferSize].left, available, true);
367 blip_read_samples(runner->context.gba->audio.right, &audioBuffer[currentAudioBuffer][audioBufferSize].right, available, true);
368 audioBufferSize += available;
369 }
370 if (audioBufferSize == SAMPLES && !AUDIO_GetDMAEnableFlag()) {
371 _audioDMA();
372 AUDIO_StartDMA();
373 }
374#endif
375
376 uint32_t color = 0xFFFFFF3F;
377 if (!faded) {
378 color |= 0xC0;
379 }
380 size_t x, y;
381 uint64_t* texdest = (uint64_t*) texmem;
382 uint64_t* texsrc = (uint64_t*) renderer.outputBuffer;
383 for (y = 0; y < VIDEO_VERTICAL_PIXELS; y += 4) {
384 for (x = 0; x < VIDEO_HORIZONTAL_PIXELS >> 2; ++x) {
385 texdest[0 + x * 4 + y * 64] = texsrc[0 + x + y * 64];
386 texdest[1 + x * 4 + y * 64] = texsrc[64 + x + y * 64];
387 texdest[2 + x * 4 + y * 64] = texsrc[128 + x + y * 64];
388 texdest[3 + x * 4 + y * 64] = texsrc[192 + x + y * 64];
389 }
390 }
391 DCFlushRange(texdest, 256 * 256 * BYTES_PER_PIXEL);
392
393 if (faded) {
394 GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_NOOP);
395 } else {
396 GX_SetBlendMode(GX_BM_NONE, GX_BL_ONE, GX_BL_ZERO, GX_LO_NOOP);
397 }
398 GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_S16, 0);
399 GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
400 GX_InvalidateTexAll();
401 GX_LoadTexObj(&tex, GX_TEXMAP0);
402
403 GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
404 GX_Position2s16(0, 256);
405 GX_Color1u32(color);
406 GX_TexCoord2s16(0, 1);
407
408 GX_Position2s16(256, 256);
409 GX_Color1u32(color);
410 GX_TexCoord2s16(1, 1);
411
412 GX_Position2s16(256, 0);
413 GX_Color1u32(color);
414 GX_TexCoord2s16(1, 0);
415
416 GX_Position2s16(0, 0);
417 GX_Color1u32(color);
418 GX_TexCoord2s16(0, 0);
419 GX_End();
420}
421
422uint16_t _pollGameInput(struct GBAGUIRunner* runner) {
423 UNUSED(runner);
424 PAD_ScanPads();
425 u16 padkeys = PAD_ButtonsHeld(0);
426 WPAD_ScanPads();
427 u32 wiiPad = WPAD_ButtonsHeld(0);
428 u32 ext = 0;
429 uint16_t keys = 0;
430 WPAD_Probe(0, &ext);
431
432 if ((padkeys & PAD_BUTTON_A) || (wiiPad & WPAD_BUTTON_2) ||
433 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & (WPAD_CLASSIC_BUTTON_A | WPAD_CLASSIC_BUTTON_Y)))) {
434 keys |= 1 << GBA_KEY_A;
435 }
436 if ((padkeys & PAD_BUTTON_B) || (wiiPad & WPAD_BUTTON_1) ||
437 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & (WPAD_CLASSIC_BUTTON_B | WPAD_CLASSIC_BUTTON_X)))) {
438 keys |= 1 << GBA_KEY_B;
439 }
440 if ((padkeys & PAD_TRIGGER_L) || (wiiPad & WPAD_BUTTON_B) ||
441 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & WPAD_CLASSIC_BUTTON_FULL_L))) {
442 keys |= 1 << GBA_KEY_L;
443 }
444 if ((padkeys & PAD_TRIGGER_R) || (wiiPad & WPAD_BUTTON_A) ||
445 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & WPAD_CLASSIC_BUTTON_FULL_R))) {
446 keys |= 1 << GBA_KEY_R;
447 }
448 if ((padkeys & PAD_BUTTON_START) || (wiiPad & WPAD_BUTTON_PLUS) ||
449 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & WPAD_CLASSIC_BUTTON_PLUS))) {
450 keys |= 1 << GBA_KEY_START;
451 }
452 if ((padkeys & (PAD_BUTTON_X | PAD_BUTTON_Y)) || (wiiPad & WPAD_BUTTON_MINUS) ||
453 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & WPAD_CLASSIC_BUTTON_MINUS))) {
454 keys |= 1 << GBA_KEY_SELECT;
455 }
456 if ((padkeys & PAD_BUTTON_LEFT) || (wiiPad & WPAD_BUTTON_UP) ||
457 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & WPAD_CLASSIC_BUTTON_LEFT))) {
458 keys |= 1 << GBA_KEY_LEFT;
459 }
460 if ((padkeys & PAD_BUTTON_RIGHT) || (wiiPad & WPAD_BUTTON_DOWN) ||
461 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & WPAD_CLASSIC_BUTTON_RIGHT))) {
462 keys |= 1 << GBA_KEY_RIGHT;
463 }
464 if ((padkeys & PAD_BUTTON_UP) || (wiiPad & WPAD_BUTTON_RIGHT) ||
465 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & WPAD_CLASSIC_BUTTON_UP))) {
466 keys |= 1 << GBA_KEY_UP;
467 }
468 if ((padkeys & PAD_BUTTON_DOWN) || (wiiPad & WPAD_BUTTON_LEFT) ||
469 ((ext == WPAD_EXP_CLASSIC) && (wiiPad & WPAD_CLASSIC_BUTTON_DOWN))) {
470 keys |= 1 << GBA_KEY_DOWN;
471 }
472 int x = PAD_StickX(0);
473 int y = PAD_StickY(0);
474 if (x < -0x40) {
475 keys |= 1 << GBA_KEY_LEFT;
476 }
477 if (x > 0x40) {
478 keys |= 1 << GBA_KEY_RIGHT;
479 }
480 if (y < -0x40) {
481 keys |= 1 << GBA_KEY_DOWN;
482 }
483 if (y > 0x40) {
484 keys |= 1 << GBA_KEY_UP;
485 }
486 return keys;
487}
488
489void _setRumble(struct GBARumble* rumble, int enable) {
490 UNUSED(rumble);
491 WPAD_Rumble(0, enable);
492 if (enable) {
493 PAD_ControlMotor(0, PAD_MOTOR_RUMBLE);
494 } else {
495 PAD_ControlMotor(0, PAD_MOTOR_STOP);
496 }
497}
498
499void _sampleRotation(struct GBARotationSource* source) {
500 UNUSED(source);
501 vec3w_t accel;
502 WPAD_Accel(0, &accel);
503 // These are swapped
504 tiltX = (accel.y - 0x1EA) << 22;
505 tiltY = (accel.x - 0x1EA) << 22;
506
507 // This doesn't seem to work at all with -TR remotes
508 struct expansion_t exp;
509 WPAD_Expansion(0, &exp);
510 if (exp.type != EXP_MOTION_PLUS) {
511 return;
512 }
513 gyroZ = exp.mp.rz - 0x1FA0;
514 gyroZ <<= 18;
515}
516
517int32_t _readTiltX(struct GBARotationSource* source) {
518 UNUSED(source);
519 return tiltX;
520}
521
522int32_t _readTiltY(struct GBARotationSource* source) {
523 UNUSED(source);
524 return tiltY;
525}
526
527int32_t _readGyroZ(struct GBARotationSource* source) {
528 UNUSED(source);
529 return gyroZ;
530}