GBA Video: Move video registers and structs into common file
Vicki Pfau vi@endrift.com
Thu, 09 May 2019 13:32:51 -0700
3 files changed,
25 insertions(+),
25 deletions(-)
M
include/mgba/internal/gba/renderers/video-software.h
→
include/mgba/internal/gba/renderers/video-software.h
@@ -49,13 +49,6 @@ int32_t offsetX;
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 @@ uint8_t end;
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 @@ unsigned target1Bd;
unsigned target2Obj; unsigned target2Bd; bool blendDirty; - enum BlendEffect blendEffect; + enum GBAVideoBlendEffect blendEffect; color_t normalPalette[512]; color_t variantPalette[512];
M
include/mgba/internal/gba/video.h
→
include/mgba/internal/gba/video.h
@@ -32,16 +32,23 @@
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);@@ -143,6 +150,20 @@ DECL_BIT(GBARegisterBLDCNT, Target2Bg2, 10);
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);
M
src/gba/renderers/video-software.c
→
src/gba/renderers/video-software.c
@@ -787,7 +787,7 @@ bg->sy = bg->refy;
} 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);