mirror of https://github.com/mgba-emu/mgba.git
GBA Video: Ability to hide individual background layers, or OBJs
This commit is contained in:
parent
db2659962b
commit
8533f01be5
2
CHANGES
2
CHANGES
|
@ -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
|
||||
|
|
|
@ -87,6 +87,12 @@ void GBAVideoSoftwareRendererCreate(struct GBAVideoSoftwareRenderer* renderer) {
|
|||
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 @@ static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* render
|
|||
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 GBAVideoSoftwareRendererPutPixels(struct GBAVideoRenderer* renderer,
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -167,6 +167,9 @@ struct GBAVideoRenderer {
|
|||
uint16_t* palette;
|
||||
uint16_t* vram;
|
||||
union GBAOAM* oam;
|
||||
|
||||
bool disableBG[4];
|
||||
bool disableOBJ;
|
||||
};
|
||||
|
||||
struct GBAVideo {
|
||||
|
|
|
@ -799,6 +799,25 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue