mirror of https://github.com/mgba-emu/mgba.git
GBA Video: Move video registers and structs into common file
This commit is contained in:
parent
f5d9e9ec5b
commit
e99cd34b66
|
@ -49,13 +49,6 @@ struct GBAVideoSoftwareBackground {
|
|||
int32_t offsetY;
|
||||
};
|
||||
|
||||
enum BlendEffect {
|
||||
BLEND_NONE = 0,
|
||||
BLEND_ALPHA = 1,
|
||||
BLEND_BRIGHTEN = 2,
|
||||
BLEND_DARKEN = 3
|
||||
};
|
||||
|
||||
enum {
|
||||
#ifdef COLOR_16_BIT
|
||||
#ifdef COLOR_5_6_5
|
||||
|
@ -87,20 +80,6 @@ struct WindowRegion {
|
|||
uint8_t start;
|
||||
};
|
||||
|
||||
DECL_BITFIELD(GBAWindowControl, uint8_t);
|
||||
DECL_BIT(GBAWindowControl, Bg0Enable, 0);
|
||||
DECL_BIT(GBAWindowControl, Bg1Enable, 1);
|
||||
DECL_BIT(GBAWindowControl, Bg2Enable, 2);
|
||||
DECL_BIT(GBAWindowControl, Bg3Enable, 3);
|
||||
DECL_BIT(GBAWindowControl, ObjEnable, 4);
|
||||
DECL_BIT(GBAWindowControl, BlendEnable, 5);
|
||||
|
||||
DECL_BITFIELD(GBAMosaicControl, uint16_t);
|
||||
DECL_BITS(GBAMosaicControl, BgH, 0, 4);
|
||||
DECL_BITS(GBAMosaicControl, BgV, 4, 4);
|
||||
DECL_BITS(GBAMosaicControl, ObjH, 8, 4);
|
||||
DECL_BITS(GBAMosaicControl, ObjV, 12, 4);
|
||||
|
||||
struct WindowControl {
|
||||
GBAWindowControl packed;
|
||||
int8_t priority;
|
||||
|
@ -133,7 +112,7 @@ struct GBAVideoSoftwareRenderer {
|
|||
unsigned target2Obj;
|
||||
unsigned target2Bd;
|
||||
bool blendDirty;
|
||||
enum BlendEffect blendEffect;
|
||||
enum GBAVideoBlendEffect blendEffect;
|
||||
color_t normalPalette[512];
|
||||
color_t variantPalette[512];
|
||||
|
||||
|
|
|
@ -32,18 +32,25 @@ enum {
|
|||
BASE_TILE = 0x00010000
|
||||
};
|
||||
|
||||
enum ObjMode {
|
||||
enum GBAVideoObjMode {
|
||||
OBJ_MODE_NORMAL = 0,
|
||||
OBJ_MODE_SEMITRANSPARENT = 1,
|
||||
OBJ_MODE_OBJWIN = 2
|
||||
};
|
||||
|
||||
enum ObjShape {
|
||||
enum GBAVideoObjShape {
|
||||
OBJ_SHAPE_SQUARE = 0,
|
||||
OBJ_SHAPE_HORIZONTAL = 1,
|
||||
OBJ_SHAPE_VERTICAL = 2
|
||||
};
|
||||
|
||||
enum GBAVideoBlendEffect {
|
||||
BLEND_NONE = 0,
|
||||
BLEND_ALPHA = 1,
|
||||
BLEND_BRIGHTEN = 2,
|
||||
BLEND_DARKEN = 3
|
||||
};
|
||||
|
||||
DECL_BITFIELD(GBAObjAttributesA, uint16_t);
|
||||
DECL_BITS(GBAObjAttributesA, Y, 0, 8);
|
||||
DECL_BIT(GBAObjAttributesA, Transformed, 8);
|
||||
|
@ -144,6 +151,20 @@ DECL_BIT(GBARegisterBLDCNT, Target2Bg3, 11);
|
|||
DECL_BIT(GBARegisterBLDCNT, Target2Obj, 12);
|
||||
DECL_BIT(GBARegisterBLDCNT, Target2Bd, 13);
|
||||
|
||||
DECL_BITFIELD(GBAWindowControl, uint8_t);
|
||||
DECL_BIT(GBAWindowControl, Bg0Enable, 0);
|
||||
DECL_BIT(GBAWindowControl, Bg1Enable, 1);
|
||||
DECL_BIT(GBAWindowControl, Bg2Enable, 2);
|
||||
DECL_BIT(GBAWindowControl, Bg3Enable, 3);
|
||||
DECL_BIT(GBAWindowControl, ObjEnable, 4);
|
||||
DECL_BIT(GBAWindowControl, BlendEnable, 5);
|
||||
|
||||
DECL_BITFIELD(GBAMosaicControl, uint16_t);
|
||||
DECL_BITS(GBAMosaicControl, BgH, 0, 4);
|
||||
DECL_BITS(GBAMosaicControl, BgV, 4, 4);
|
||||
DECL_BITS(GBAMosaicControl, ObjH, 8, 4);
|
||||
DECL_BITS(GBAMosaicControl, ObjV, 12, 4);
|
||||
|
||||
struct GBAVideoRenderer {
|
||||
void (*init)(struct GBAVideoRenderer* renderer);
|
||||
void (*reset)(struct GBAVideoRenderer* renderer);
|
||||
|
|
|
@ -787,7 +787,7 @@ static void GBAVideoSoftwareRendererWriteBGY_HI(struct GBAVideoSoftwareBackgroun
|
|||
}
|
||||
|
||||
static void GBAVideoSoftwareRendererWriteBLDCNT(struct GBAVideoSoftwareRenderer* renderer, uint16_t value) {
|
||||
enum BlendEffect oldEffect = renderer->blendEffect;
|
||||
enum GBAVideoBlendEffect oldEffect = renderer->blendEffect;
|
||||
|
||||
renderer->bg[0].target1 = GBARegisterBLDCNTGetTarget1Bg0(value);
|
||||
renderer->bg[1].target1 = GBARegisterBLDCNTGetTarget1Bg1(value);
|
||||
|
|
Loading…
Reference in New Issue