mirror of https://github.com/mgba-emu/mgba.git
GB Video: Clear screen when LCDC is off
This commit is contained in:
parent
bf9017c89b
commit
1f0f943526
1
CHANGES
1
CHANGES
|
@ -8,6 +8,7 @@ Bugfixes:
|
||||||
- FFmpeg: Fix encoding AAC
|
- FFmpeg: Fix encoding AAC
|
||||||
- GB Video: Fix video frames getting missed when LCDC is off
|
- GB Video: Fix video frames getting missed when LCDC is off
|
||||||
- LR35902: Fix events running with the wrong cycle active
|
- LR35902: Fix events running with the wrong cycle active
|
||||||
|
- GB Video: Clear screen when LCDC is off
|
||||||
Misc:
|
Misc:
|
||||||
- All: Only update version info if needed
|
- All: Only update version info if needed
|
||||||
- FFmpeg: Encoding cleanup
|
- FFmpeg: Encoding cleanup
|
||||||
|
|
|
@ -21,6 +21,31 @@ static void GBVideoSoftwareRendererPutPixels(struct GBVideoRenderer* renderer, s
|
||||||
static void GBVideoSoftwareRendererDrawBackground(struct GBVideoSoftwareRenderer* renderer, uint8_t* maps, int startX, int endX, int sx, int sy);
|
static void GBVideoSoftwareRendererDrawBackground(struct GBVideoSoftwareRenderer* renderer, uint8_t* maps, int startX, int endX, int sx, int sy);
|
||||||
static void GBVideoSoftwareRendererDrawObj(struct GBVideoSoftwareRenderer* renderer, struct GBObj* obj, int startX, int endX, int y);
|
static void GBVideoSoftwareRendererDrawObj(struct GBVideoSoftwareRenderer* renderer, struct GBObj* obj, int startX, int endX, int y);
|
||||||
|
|
||||||
|
static void _clearScreen(struct GBVideoSoftwareRenderer* renderer) {
|
||||||
|
// TODO: Dynamic from dmgPalette
|
||||||
|
#ifdef COLOR_16_BIT
|
||||||
|
#ifdef COLOR_5_6_5
|
||||||
|
color_t palette0 = 0xFFDF;
|
||||||
|
#else
|
||||||
|
color_t palette0 = 0x7FFF;
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
color_t palette0 = 0xF8F8F8;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int y;
|
||||||
|
for (y = 0; y < GB_VIDEO_VERTICAL_PIXELS; ++y) {
|
||||||
|
color_t* row = &renderer->outputBuffer[renderer->outputBufferStride * y];
|
||||||
|
int x;
|
||||||
|
for (x = 0; x < GB_VIDEO_HORIZONTAL_PIXELS; x += 4) {
|
||||||
|
row[x + 0] = palette0;
|
||||||
|
row[x + 1] = palette0;
|
||||||
|
row[x + 2] = palette0;
|
||||||
|
row[x + 3] = palette0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GBVideoSoftwareRendererCreate(struct GBVideoSoftwareRenderer* renderer) {
|
void GBVideoSoftwareRendererCreate(struct GBVideoSoftwareRenderer* renderer) {
|
||||||
renderer->d.init = GBVideoSoftwareRendererInit;
|
renderer->d.init = GBVideoSoftwareRendererInit;
|
||||||
renderer->d.deinit = GBVideoSoftwareRendererDeinit;
|
renderer->d.deinit = GBVideoSoftwareRendererDeinit;
|
||||||
|
@ -44,14 +69,7 @@ static void GBVideoSoftwareRendererInit(struct GBVideoRenderer* renderer, enum G
|
||||||
softwareRenderer->wx = 0;
|
softwareRenderer->wx = 0;
|
||||||
softwareRenderer->model = model;
|
softwareRenderer->model = model;
|
||||||
|
|
||||||
int y;
|
_clearScreen(softwareRenderer);
|
||||||
for (y = 0; y < GB_VIDEO_VERTICAL_PIXELS; ++y) {
|
|
||||||
color_t* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y];
|
|
||||||
int x;
|
|
||||||
for (x = 0; x < GB_VIDEO_HORIZONTAL_PIXELS; ++x) {
|
|
||||||
row[x] = softwareRenderer->palette[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GBVideoSoftwareRendererDeinit(struct GBVideoRenderer* renderer) {
|
static void GBVideoSoftwareRendererDeinit(struct GBVideoRenderer* renderer) {
|
||||||
|
@ -63,6 +81,9 @@ static uint8_t GBVideoSoftwareRendererWriteVideoRegister(struct GBVideoRenderer*
|
||||||
struct GBVideoSoftwareRenderer* softwareRenderer = (struct GBVideoSoftwareRenderer*) renderer;
|
struct GBVideoSoftwareRenderer* softwareRenderer = (struct GBVideoSoftwareRenderer*) renderer;
|
||||||
switch (address) {
|
switch (address) {
|
||||||
case REG_LCDC:
|
case REG_LCDC:
|
||||||
|
if (GBRegisterLCDCIsEnable(softwareRenderer->lcdc) && !GBRegisterLCDCIsEnable(value)) {
|
||||||
|
_clearScreen(softwareRenderer);
|
||||||
|
}
|
||||||
softwareRenderer->lcdc = value;
|
softwareRenderer->lcdc = value;
|
||||||
break;
|
break;
|
||||||
case REG_SCY:
|
case REG_SCY:
|
||||||
|
|
Loading…
Reference in New Issue