all repos — mgba @ 5122a236e0cb6ed73a274584b94d0639bf0157f3

mGBA Game Boy Advance Emulator

src/gba/renderers/video-software.h (view raw)

 1#ifndef VIDEO_SOFTWARE_H
 2#define VIDEO_SOFTWARE_H
 3
 4#include "gba-video.h"
 5
 6#include <pthread.h>
 7
 8struct GBAVideoSoftwareBackground {
 9	int index;
10	int enabled;
11	int priority;
12	uint32_t charBase;
13	int mosaic;
14	int multipalette;
15	uint32_t screenBase;
16	int overflow;
17	int size;
18	int target1;
19	int target2;
20	uint16_t x;
21	uint16_t y;
22	uint32_t refx;
23	uint32_t refy;
24	uint16_t dx;
25	uint16_t dmx;
26	uint16_t dy;
27	uint16_t dmy;
28	uint32_t sx;
29	uint32_t sy;
30};
31
32enum BlendEffect {
33	BLEND_NONE = 0,
34	BLEND_ALPHA = 1,
35	BLEND_BRIGHTEN = 2,
36	BLEND_DARKEN = 3
37};
38
39struct PixelFlags {
40	unsigned written : 1;
41	unsigned finalized : 1;
42	unsigned target1 : 1;
43	unsigned target2 : 1;
44};
45
46struct GBAVideoSoftwareRenderer {
47	struct GBAVideoRenderer d;
48
49	uint16_t* outputBuffer;
50	unsigned outputBufferStride;
51
52	union GBARegisterDISPCNT dispcnt;
53
54	struct PixelFlags flags[VIDEO_HORIZONTAL_PIXELS];
55
56	// BLDCNT
57	unsigned target1Obj;
58	unsigned target1Bd;
59	unsigned target2Obj;
60	unsigned target2Bd;
61	enum BlendEffect blendEffect;
62	uint16_t variantPalette[512];
63
64	uint16_t blda;
65	uint16_t bldb;
66	uint16_t bldy;
67
68	struct GBAVideoSoftwareBackground bg[4];
69	struct GBAVideoSoftwareBackground* sortedBg[4];
70
71	uint16_t* row;
72
73	pthread_mutex_t mutex;
74	pthread_cond_t cond;
75};
76
77void GBAVideoSoftwareRendererCreate(struct GBAVideoSoftwareRenderer* renderer);
78
79#endif