mirror of https://github.com/mgba-emu/mgba.git
GB: Video/audio channel enabling/disabling
This commit is contained in:
parent
2a7f642d4c
commit
3a8c5c4bf1
1
CHANGES
1
CHANGES
|
@ -14,6 +14,7 @@ Features:
|
|||
- Savestates now contain any RTC override data
|
||||
- Command line ability to override configuration values
|
||||
- Add option to allow preloading the entire ROM before running
|
||||
- GB: Video/audio channel enabling/disabling
|
||||
Bugfixes:
|
||||
- LR35902: Fix core never exiting with certain event patterns
|
||||
- GB Timer: Improve DIV reset behavior
|
||||
|
|
|
@ -71,6 +71,10 @@ struct GBVideoRenderer {
|
|||
uint8_t* vram;
|
||||
union GBOAM* oam;
|
||||
struct mTileCache* cache;
|
||||
|
||||
bool disableBG;
|
||||
bool disableOBJ;
|
||||
bool disableWIN;
|
||||
};
|
||||
|
||||
DECL_BITFIELD(GBRegisterLCDC, uint8_t);
|
||||
|
|
|
@ -606,7 +606,19 @@ static size_t _GBCoreListAudioChannels(const struct mCore* core, const struct mC
|
|||
|
||||
static void _GBCoreEnableVideoLayer(struct mCore* core, size_t id, bool enable) {
|
||||
struct GB* gb = core->board;
|
||||
// TODO
|
||||
switch (id) {
|
||||
case 0:
|
||||
gb->video.renderer->disableBG = !enable;
|
||||
break;
|
||||
case 1:
|
||||
gb->video.renderer->disableOBJ = !enable;
|
||||
break;
|
||||
case 2:
|
||||
gb->video.renderer->disableWIN = !enable;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void _GBCoreEnableAudioChannel(struct mCore* core, size_t id, bool enable) {
|
||||
|
|
|
@ -49,6 +49,10 @@ void GBVideoSoftwareRendererCreate(struct GBVideoSoftwareRenderer* renderer) {
|
|||
renderer->d.getPixels = GBVideoSoftwareRendererGetPixels;
|
||||
renderer->d.putPixels = GBVideoSoftwareRendererPutPixels;
|
||||
|
||||
renderer->d.disableBG = false;
|
||||
renderer->d.disableOBJ = false;
|
||||
renderer->d.disableWIN = false;
|
||||
|
||||
renderer->temporaryBuffer = 0;
|
||||
}
|
||||
|
||||
|
@ -128,9 +132,12 @@ static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, i
|
|||
if (GBRegisterLCDCIsTileMap(softwareRenderer->lcdc)) {
|
||||
maps += GB_SIZE_MAP;
|
||||
}
|
||||
if (softwareRenderer->d.disableBG) {
|
||||
memset(&softwareRenderer->row[startX], 0, endX - startX);
|
||||
}
|
||||
if (GBRegisterLCDCIsBgEnable(softwareRenderer->lcdc) || softwareRenderer->model >= GB_MODEL_CGB) {
|
||||
if (GBRegisterLCDCIsWindow(softwareRenderer->lcdc) && softwareRenderer->wy <= y && endX >= softwareRenderer->wx - 7) {
|
||||
if (softwareRenderer->wx - 7 > 0) {
|
||||
if (softwareRenderer->wx - 7 > 0 && !softwareRenderer->d.disableBG) {
|
||||
GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, startX, softwareRenderer->wx - 7, softwareRenderer->scx, softwareRenderer->scy + y);
|
||||
}
|
||||
|
||||
|
@ -138,15 +145,17 @@ static void GBVideoSoftwareRendererDrawRange(struct GBVideoRenderer* renderer, i
|
|||
if (GBRegisterLCDCIsWindowTileMap(softwareRenderer->lcdc)) {
|
||||
maps += GB_SIZE_MAP;
|
||||
}
|
||||
GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, softwareRenderer->wx - 7, endX, 7 - softwareRenderer->wx, softwareRenderer->currentWy);
|
||||
} else {
|
||||
if (!softwareRenderer->d.disableWIN) {
|
||||
GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, softwareRenderer->wx - 7, endX, 7 - softwareRenderer->wx, softwareRenderer->currentWy);
|
||||
}
|
||||
} else if (!softwareRenderer->d.disableBG) {
|
||||
GBVideoSoftwareRendererDrawBackground(softwareRenderer, maps, startX, endX, softwareRenderer->scx, softwareRenderer->scy + y);
|
||||
}
|
||||
} else {
|
||||
} else if (!softwareRenderer->d.disableBG) {
|
||||
memset(&softwareRenderer->row[startX], 0, endX - startX);
|
||||
}
|
||||
|
||||
if (GBRegisterLCDCIsObjEnable(softwareRenderer->lcdc)) {
|
||||
if (GBRegisterLCDCIsObjEnable(softwareRenderer->lcdc) && !softwareRenderer->d.disableOBJ) {
|
||||
size_t i;
|
||||
for (i = 0; i < oamMax; ++i) {
|
||||
GBVideoSoftwareRendererDrawObj(softwareRenderer, &obj[i], startX, endX, y);
|
||||
|
|
Loading…
Reference in New Issue