include/mgba/internal/ds/video.h (view raw)
1/* Copyright (c) 2013-2017 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#include <mgba/core/timing.h>
15
16mLOG_DECLARE_CATEGORY(DS_VIDEO);
17
18enum {
19 DS_VIDEO_HORIZONTAL_PIXELS = 256,
20 DS_VIDEO_HBLANK_PIXELS = 99,
21 DS7_VIDEO_HBLANK_LENGTH = 1613,
22 DS9_VIDEO_HBLANK_LENGTH = 1606,
23 DS_VIDEO_HORIZONTAL_LENGTH = (DS_VIDEO_HORIZONTAL_PIXELS + DS_VIDEO_HBLANK_PIXELS) * 6,
24
25 DS_VIDEO_VERTICAL_PIXELS = 192,
26 DS_VIDEO_VBLANK_PIXELS = 71,
27 DS_VIDEO_VERTICAL_TOTAL_PIXELS = DS_VIDEO_VERTICAL_PIXELS + DS_VIDEO_VBLANK_PIXELS,
28
29 DS_VIDEO_TOTAL_LENGTH = DS_VIDEO_HORIZONTAL_LENGTH * DS_VIDEO_VERTICAL_TOTAL_PIXELS,
30};
31
32struct DS;
33struct DSVideo {
34 struct DS* p;
35 struct mTimingEvent event7;
36 struct mTimingEvent event9;
37
38 // VCOUNT
39 int vcount;
40
41 uint16_t* vram;
42
43 int32_t frameCounter;
44 int frameskip;
45 int frameskipCounter;
46};
47
48void DSVideoInit(struct DSVideo* video);
49void DSVideoReset(struct DSVideo* video);
50void DSVideoDeinit(struct DSVideo* video);
51
52struct DSCommon;
53void DSVideoWriteDISPSTAT(struct DSCommon* dscore, uint16_t value);
54
55CXX_GUARD_START
56
57#endif