all repos — mgba @ 61ef3501c115bbaaced8f9c78685243ed4f31881

mGBA Game Boy Advance Emulator

DS Video: Minor extended background fixes
Vicki Pfau vi@endrift.com
Fri, 03 Mar 2017 19:08:27 -0800
commit

61ef3501c115bbaaced8f9c78685243ed4f31881

parent

7b8fc0dbaaa93ebe3abbedd1e1d523088b0d4c53

2 files changed, 16 insertions(+), 3 deletions(-)

jump to
M include/mgba/internal/ds/video.hinclude/mgba/internal/ds/video.h

@@ -64,6 +64,8 @@ DECL_BITFIELD(DSRegisterPOWCNT1, uint16_t);

// TODO DECL_BIT(DSRegisterPOWCNT1, Swap, 15); +DECL_BIT(GBARegisterBGCNT, ExtendedMode0, 2); +DECL_BIT(GBARegisterBGCNT, ExtendedMode1, 7); DECL_BIT(GBARegisterBGCNT, ExtPaletteSlot, 13); DECL_BITFIELD(DSRegisterMASTER_BRIGHT, uint16_t);
M src/ds/renderers/software.csrc/ds/renderers/software.c

@@ -414,7 +414,11 @@ case 4:

GBAVideoSoftwareRendererDrawBackgroundMode2(softwareRenderer, &softwareRenderer->bg[2], y); break; case 5: - DSVideoSoftwareRendererDrawBackgroundExt0(softwareRenderer, &softwareRenderer->bg[2], y); + if (!GBARegisterBGCNTIsExtendedMode1(softwareRenderer->bg[2].control)) { + DSVideoSoftwareRendererDrawBackgroundExt0(softwareRenderer, &softwareRenderer->bg[2], y); + } else { + // TODO + } break; } }

@@ -430,7 +434,11 @@ break;

case 3: case 4: case 5: - DSVideoSoftwareRendererDrawBackgroundExt0(softwareRenderer, &softwareRenderer->bg[3], y); + if (!GBARegisterBGCNTIsExtendedMode1(softwareRenderer->bg[3].control)) { + DSVideoSoftwareRendererDrawBackgroundExt0(softwareRenderer, &softwareRenderer->bg[3], y); + } else { + // TODO + } break; } }

@@ -659,7 +667,10 @@ BACKGROUND_BITMAP_INIT;

color_t* mainPalette = background->extPalette; if (variant) { - palette = background->variantPalette; + mainPalette = background->variantPalette; + } + if (!mainPalette) { + return; } int paletteData;