include/mgba/internal/ds/video.h (view raw)
1/* Copyright (c) 2013-2016 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 DS_VIDEO_H
7#define DS_VIDEO_H
8
9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba/core/log.h>
14
15mLOG_DECLARE_CATEGORY(DS_VIDEO);
16
17enum {
18 DS_VIDEO_HORIZONTAL_PIXELS = 256,
19 DS_VIDEO_HBLANK_PIXELS = 99,
20 DS_VIDEO_HORIZONTAL_LENGTH = (DS_VIDEO_HORIZONTAL_PIXELS + DS_VIDEO_HBLANK_PIXELS) * 6,
21
22 DS_VIDEO_VERTICAL_PIXELS = 192,
23 DS_VIDEO_VBLANK_PIXELS = 71,
24 DS_VIDEO_VERTICAL_TOTAL_PIXELS = DS_VIDEO_VERTICAL_PIXELS + DS_VIDEO_VBLANK_PIXELS,
25
26 DS_VIDEO_TOTAL_LENGTH = DS_VIDEO_HORIZONTAL_LENGTH * DS_VIDEO_VERTICAL_TOTAL_PIXELS,
27};
28
29struct DS;
30struct DSVideo {
31 struct DS* p;
32
33 // VCOUNT
34 int vcount;
35
36 int32_t nextHblank;
37 int32_t nextEvent;
38 int32_t eventDiff;
39
40 int32_t nextHblankIRQ;
41 int32_t nextVblankIRQ;
42 int32_t nextVcounterIRQ;
43
44 int32_t frameCounter;
45 int frameskip;
46 int frameskipCounter;
47};
48
49void DSVideoInit(struct DSVideo* video);
50void DSVideoReset(struct DSVideo* video);
51void DSVideoDeinit(struct DSVideo* video);
52
53CXX_GUARD_START
54
55#endif