include/mgba/core/video-proxy.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 VIDEO_PROXY_H
7#define VIDEO_PROXY_H
8
9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13enum mVideoProxyDirtyType {
14 DIRTY_DUMMY = 0,
15 DIRTY_FLUSH,
16 DIRTY_SCANLINE,
17 DIRTY_REGISTER,
18 DIRTY_OAM,
19 DIRTY_PALETTE,
20 DIRTY_VRAM
21};
22
23struct mVideoProxyDirtyInfo {
24 enum mVideoProxyDirtyType type;
25 uint32_t address;
26 uint16_t value;
27 uint32_t padding;
28};
29
30struct mVideoProxy {
31 bool (*writeData)(struct mVideoProxy* proxy, void* data, size_t length);
32 uint16_t* (*vramBlock)(struct mVideoProxy* proxy, uint32_t address);
33 void* context;
34
35 size_t vramSize;
36 size_t oamSize;
37 size_t paletteSize;
38
39 uint32_t* vramDirtyBitmap;
40 uint32_t* oamDirtyBitmap;
41
42 uint16_t* vram;
43 uint16_t* oam;
44 uint16_t* palette;
45};
46
47void mVideoProxyRendererInit(struct mVideoProxy* proxy);
48void mVideoProxyRendererDeinit(struct mVideoProxy* proxy);
49void mVideoProxyRendererReset(struct mVideoProxy* proxy);
50
51void mVideoProxyRendererWriteVideoRegister(struct mVideoProxy* proxy, uint32_t address, uint16_t value);
52void mVideoProxyRendererWriteVRAM(struct mVideoProxy* proxy, uint32_t address);
53void mVideoProxyRendererWritePalette(struct mVideoProxy* proxy, uint32_t address, uint16_t value);
54void mVideoProxyRendererWriteOAM(struct mVideoProxy* proxy, uint32_t address, uint16_t value);
55
56void mVideoProxyRendererDrawScanline(struct mVideoProxy* proxy, int y);
57void mVideoProxyRendererFlush(struct mVideoProxy* proxy);
58
59CXX_GUARD_END
60
61#endif