all repos — mgba @ 8533f01be57d725e9c8e779869761f8f5d859b2e

mGBA Game Boy Advance Emulator

GBA Video: Ability to hide individual background layers, or OBJs
Jeffrey Pfau jeffrey@endrift.com
Sun, 05 Apr 2015 01:25:25 -0700
commit

8533f01be57d725e9c8e779869761f8f5d859b2e

parent

db2659962b45e242562c23c4b907eec7ce568464

4 files changed, 37 insertions(+), 5 deletions(-)

jump to
M CHANGESCHANGES

@@ -1,4 +1,6 @@

0.3.0: (Future) +Features: + - Ability to hide individual background layers, or OBJs Bugfixes: - GBA: Fix timers not updating timing when writing to only the reload register - All: Fix sanitize-deb script not cleaning up after itself
M src/gba/renderers/video-software.csrc/gba/renderers/video-software.c

@@ -87,6 +87,12 @@ renderer->d.drawScanline = GBAVideoSoftwareRendererDrawScanline;

renderer->d.finishFrame = GBAVideoSoftwareRendererFinishFrame; renderer->d.getPixels = GBAVideoSoftwareRendererGetPixels; renderer->d.putPixels = GBAVideoSoftwareRendererPutPixels; + + renderer->d.disableBG[0] = false; + renderer->d.disableBG[1] = false; + renderer->d.disableBG[2] = false; + renderer->d.disableBG[3] = false; + renderer->d.disableOBJ = false; } static void GBAVideoSoftwareRendererInit(struct GBAVideoRenderer* renderer) {

@@ -522,6 +528,8 @@ } else {

softwareRenderer->windows[0].control.packed = 0xFF; } + GBAVideoSoftwareRendererUpdateDISPCNT(softwareRenderer); + int w; x = 0; for (w = 0; w < softwareRenderer->nWindows; ++w) {

@@ -599,10 +607,10 @@ }

} static void GBAVideoSoftwareRendererUpdateDISPCNT(struct GBAVideoSoftwareRenderer* renderer) { - renderer->bg[0].enabled = GBARegisterDISPCNTGetBg0Enable(renderer->dispcnt); - renderer->bg[1].enabled = GBARegisterDISPCNTGetBg1Enable(renderer->dispcnt); - renderer->bg[2].enabled = GBARegisterDISPCNTGetBg2Enable(renderer->dispcnt); - renderer->bg[3].enabled = GBARegisterDISPCNTGetBg3Enable(renderer->dispcnt); + renderer->bg[0].enabled = GBARegisterDISPCNTGetBg0Enable(renderer->dispcnt) && !renderer->d.disableBG[0]; + renderer->bg[1].enabled = GBARegisterDISPCNTGetBg1Enable(renderer->dispcnt) && !renderer->d.disableBG[1]; + renderer->bg[2].enabled = GBARegisterDISPCNTGetBg2Enable(renderer->dispcnt) && !renderer->d.disableBG[2]; + renderer->bg[3].enabled = GBARegisterDISPCNTGetBg3Enable(renderer->dispcnt) && !renderer->d.disableBG[3]; } static void GBAVideoSoftwareRendererWriteBGCNT(struct GBAVideoSoftwareRenderer* renderer, struct GBAVideoSoftwareBackground* bg, uint16_t value) {

@@ -691,7 +699,7 @@ static void _drawScanline(struct GBAVideoSoftwareRenderer* renderer, int y) {

int w; renderer->end = 0; int spriteLayers = 0; - if (GBARegisterDISPCNTIsObjEnable(renderer->dispcnt)) { + if (GBARegisterDISPCNTIsObjEnable(renderer->dispcnt) && !renderer->d.disableOBJ) { if (renderer->oamDirty) { _cleanOAM(renderer); }
M src/gba/video.hsrc/gba/video.h

@@ -167,6 +167,9 @@

uint16_t* palette; uint16_t* vram; union GBAOAM* oam; + + bool disableBG[4]; + bool disableOBJ; }; struct GBAVideo {
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -799,6 +799,25 @@ connect(recordGIF, SIGNAL(triggered()), this, SLOT(openGIFWindow()));

addControlledAction(avMenu, recordGIF, "recordGIF"); #endif + avMenu->addSeparator(); + QMenu* videoLayers = avMenu->addMenu(tr("Video layers")); + + for (int i = 0; i < 4; ++i) { + QAction* enableBg = new QAction(tr("Background %0").arg(i), videoLayers); + enableBg->setCheckable(true); + enableBg->setChecked(true); + connect(enableBg, &QAction::triggered, [this, i](bool enable) { m_controller->thread()->gba->video.renderer->disableBG[i] = !enable; }); + m_gameActions.append(enableBg); + addControlledAction(videoLayers, enableBg, QString("enableBG%0").arg(i)); + } + + QAction* enableObj = new QAction(tr("OBJ (sprites)"), videoLayers); + enableObj->setCheckable(true); + enableObj->setChecked(true); + connect(enableObj, &QAction::triggered, [this](bool enable) { m_controller->thread()->gba->video.renderer->disableOBJ = !enable; }); + m_gameActions.append(enableObj); + addControlledAction(videoLayers, enableObj, "enableOBJ"); + QMenu* toolsMenu = menubar->addMenu(tr("&Tools")); m_shortcutController->addMenu(toolsMenu); QAction* viewLogs = new QAction(tr("View &logs..."), toolsMenu);