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 (*videoDimensionsChanged)(struct mAVStream*, unsigned width, unsigned height);
25 void (*postVideoFrame)(struct mAVStream*, const color_t* buffer, size_t stride);
26 void (*postAudioFrame)(struct mAVStream*, int16_t left, int16_t right);
27 void (*postAudioBuffer)(struct mAVStream*, struct blip_t* left, struct blip_t* right);
28};
29
30struct mKeyCallback {
31 uint16_t (*readKeys)(struct mKeyCallback*);
32};
33
34struct mStopCallback {
35 void (*stop)(struct mStopCallback*);
36};
37
38struct mRotationSource {
39 void (*sample)(struct mRotationSource*);
40
41 int32_t (*readTiltX)(struct mRotationSource*);
42 int32_t (*readTiltY)(struct mRotationSource*);
43
44 int32_t (*readGyroZ)(struct mRotationSource*);
45};
46
47struct mRTCSource {
48 void (*sample)(struct mRTCSource*);
49
50 time_t (*unixTime)(struct mRTCSource*);
51};
52
53enum mRTCGenericType {
54 RTC_NO_OVERRIDE,
55 RTC_FIXED,
56 RTC_FAKE_EPOCH
57};
58
59struct mRTCGenericSource {
60 struct mRTCSource d;
61 struct mCore* p;
62 enum mRTCGenericType override;
63 int64_t value;
64};
65
66void mRTCGenericSourceInit(struct mRTCGenericSource* rtc, struct mCore* core);
67
68struct mRumble {
69 void (*setRumble)(struct mRumble*, int enable);
70};
71
72#endif