include/mgba/internal/gb/renderers/software.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 GB_RENDERER_SOFTWARE_H
7#define GB_RENDERER_SOFTWARE_H
8
9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba/core/core.h>
14#include <mgba/internal/gb/gb.h>
15#include <mgba/internal/gb/video.h>
16
17struct GBVideoRendererSprite {
18 struct GBObj obj;
19 int8_t index;
20};
21
22struct GBVideoSoftwareRenderer {
23 struct GBVideoRenderer d;
24
25 color_t* outputBuffer;
26 int outputBufferStride;
27
28 // TODO: Implement the pixel FIFO
29 uint16_t row[GB_VIDEO_HORIZONTAL_PIXELS + 8];
30
31 color_t palette[192];
32 uint8_t lookup[192];
33
34 uint32_t* temporaryBuffer;
35
36 uint8_t scy;
37 uint8_t scx;
38 uint8_t wy;
39 uint8_t wx;
40 uint8_t currentWy;
41 uint8_t currentWx;
42 int lastY;
43 int lastX;
44 bool hasWindow;
45
46 GBRegisterLCDC lcdc;
47 enum GBModel model;
48
49 struct GBVideoRendererSprite obj[GB_VIDEO_MAX_LINE_OBJ];
50 int objMax;
51
52 int16_t objOffsetX;
53 int16_t objOffsetY;
54 int16_t offsetScx;
55 int16_t offsetScy;
56 int16_t offsetWx;
57 int16_t offsetWy;
58
59 int sgbTransfer;
60 uint8_t sgbPacket[128];
61 uint8_t sgbCommandHeader;
62 bool sgbBorders;
63
64 uint8_t lastHighlightAmount;
65};
66
67void GBVideoSoftwareRendererCreate(struct GBVideoSoftwareRenderer*);
68
69CXX_GUARD_END
70
71#endif