src/core/interface.h (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#ifndef CORE_INTERFACE_H
7#define CORE_INTERFACE_H
8
9#include "util/common.h"
10
11struct mCore;
12
13#ifdef COLOR_16_BIT
14typedef uint16_t color_t;
15#define BYTES_PER_PIXEL 2
16#else
17typedef uint32_t color_t;
18#define BYTES_PER_PIXEL 4
19#endif
20
21struct blip_t;
22
23struct mAVStream {
24 void (*postVideoFrame)(struct mAVStream*, const color_t* buffer, size_t stride);
25 void (*postAudioFrame)(struct mAVStream*, int16_t left, int16_t right);
26 void (*postAudioBuffer)(struct mAVStream*, struct blip_t* left, struct blip_t* right);
27};
28
29struct mKeyCallback {
30 uint16_t (*readKeys)(struct mKeyCallback*);
31};
32
33struct mStopCallback {
34 void (*stop)(struct mStopCallback*);
35};
36
37struct mRotationSource {
38 void (*sample)(struct mRotationSource*);
39
40 int32_t (*readTiltX)(struct mRotationSource*);
41 int32_t (*readTiltY)(struct mRotationSource*);
42
43 int32_t (*readGyroZ)(struct mRotationSource*);
44};
45
46struct mRTCSource {
47 void (*sample)(struct mRTCSource*);
48
49 time_t (*unixTime)(struct mRTCSource*);
50};
51
52enum mRTCGenericType {
53 RTC_NO_OVERRIDE,
54 RTC_FIXED,
55 RTC_FAKE_EPOCH
56};
57
58struct mRTCGenericSource {
59 struct mRTCSource d;
60 struct mCore* p;
61 enum mRTCGenericType override;
62 int64_t value;
63};
64
65void mRTCGenericSourceInit(struct mRTCGenericSource* rtc, struct mCore* core);
66
67struct mRumble {
68 void (*setRumble)(struct mRumble*, int enable);
69};
70
71#endif