GBA Video: Move video registers and structs into common file

This commit is contained in:
Vicki Pfau 2019-05-09 13:32:51 -07:00
parent f5d9e9ec5b
commit e99cd34b66
3 changed files with 25 additions and 25 deletions

View File

@ -49,13 +49,6 @@ struct GBAVideoSoftwareBackground {
int32_t offsetY; int32_t offsetY;
}; };
enum BlendEffect {
BLEND_NONE = 0,
BLEND_ALPHA = 1,
BLEND_BRIGHTEN = 2,
BLEND_DARKEN = 3
};
enum { enum {
#ifdef COLOR_16_BIT #ifdef COLOR_16_BIT
#ifdef COLOR_5_6_5 #ifdef COLOR_5_6_5
@ -87,20 +80,6 @@ struct WindowRegion {
uint8_t start; 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 { struct WindowControl {
GBAWindowControl packed; GBAWindowControl packed;
int8_t priority; int8_t priority;
@ -133,7 +112,7 @@ struct GBAVideoSoftwareRenderer {
unsigned target2Obj; unsigned target2Obj;
unsigned target2Bd; unsigned target2Bd;
bool blendDirty; bool blendDirty;
enum BlendEffect blendEffect; enum GBAVideoBlendEffect blendEffect;
color_t normalPalette[512]; color_t normalPalette[512];
color_t variantPalette[512]; color_t variantPalette[512];

View File

@ -32,18 +32,25 @@ enum {
BASE_TILE = 0x00010000 BASE_TILE = 0x00010000
}; };
enum ObjMode { enum GBAVideoObjMode {
OBJ_MODE_NORMAL = 0, OBJ_MODE_NORMAL = 0,
OBJ_MODE_SEMITRANSPARENT = 1, OBJ_MODE_SEMITRANSPARENT = 1,
OBJ_MODE_OBJWIN = 2 OBJ_MODE_OBJWIN = 2
}; };
enum ObjShape { enum GBAVideoObjShape {
OBJ_SHAPE_SQUARE = 0, OBJ_SHAPE_SQUARE = 0,
OBJ_SHAPE_HORIZONTAL = 1, OBJ_SHAPE_HORIZONTAL = 1,
OBJ_SHAPE_VERTICAL = 2 OBJ_SHAPE_VERTICAL = 2
}; };
enum GBAVideoBlendEffect {
BLEND_NONE = 0,
BLEND_ALPHA = 1,
BLEND_BRIGHTEN = 2,
BLEND_DARKEN = 3
};
DECL_BITFIELD(GBAObjAttributesA, uint16_t); DECL_BITFIELD(GBAObjAttributesA, uint16_t);
DECL_BITS(GBAObjAttributesA, Y, 0, 8); DECL_BITS(GBAObjAttributesA, Y, 0, 8);
DECL_BIT(GBAObjAttributesA, Transformed, 8); DECL_BIT(GBAObjAttributesA, Transformed, 8);
@ -144,6 +151,20 @@ DECL_BIT(GBARegisterBLDCNT, Target2Bg3, 11);
DECL_BIT(GBARegisterBLDCNT, Target2Obj, 12); DECL_BIT(GBARegisterBLDCNT, Target2Obj, 12);
DECL_BIT(GBARegisterBLDCNT, Target2Bd, 13); 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 { struct GBAVideoRenderer {
void (*init)(struct GBAVideoRenderer* renderer); void (*init)(struct GBAVideoRenderer* renderer);
void (*reset)(struct GBAVideoRenderer* renderer); void (*reset)(struct GBAVideoRenderer* renderer);

View File

@ -787,7 +787,7 @@ static void GBAVideoSoftwareRendererWriteBGY_HI(struct GBAVideoSoftwareBackgroun
} }
static void GBAVideoSoftwareRendererWriteBLDCNT(struct GBAVideoSoftwareRenderer* renderer, uint16_t value) { 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[0].target1 = GBARegisterBLDCNTGetTarget1Bg0(value);
renderer->bg[1].target1 = GBARegisterBLDCNTGetTarget1Bg1(value); renderer->bg[1].target1 = GBARegisterBLDCNTGetTarget1Bg1(value);