GB: Add enum for the layer names

This commit is contained in:
Vicki Pfau 2020-10-21 21:32:08 -07:00
parent 4ea2a8c6f3
commit 064d0e992b
2 changed files with 15 additions and 9 deletions

View File

@ -42,6 +42,12 @@ enum GBMemoryBankControllerType {
GB_UNL_HITEK = 0x221,
};
enum GBVideoLayer {
GB_LAYER_BACKGROUND = 0,
GB_LAYER_WINDOW,
GB_LAYER_OBJ
};
struct GBSIODriver {
struct GBSIO* p;

View File

@ -26,9 +26,9 @@
#include <mgba-util/vfs.h>
static const struct mCoreChannelInfo _GBVideoLayers[] = {
{ 0, "bg", "Background", NULL },
{ 1, "bgwin", "Window", NULL },
{ 2, "obj", "Objects", NULL },
{ GB_LAYER_BACKGROUND, "bg", "Background", NULL },
{ GB_LAYER_WINDOW, "bgwin", "Window", NULL },
{ GB_LAYER_OBJ, "obj", "Objects", NULL },
};
static const struct mCoreChannelInfo _GBAudioChannels[] = {
@ -916,13 +916,13 @@ 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;
switch (id) {
case 0:
case GB_LAYER_BACKGROUND:
gb->video.renderer->disableBG = !enable;
break;
case 1:
case GB_LAYER_WINDOW:
gb->video.renderer->disableWIN = !enable;
break;
case 2:
case GB_LAYER_OBJ:
gb->video.renderer->disableOBJ = !enable;
break;
default:
@ -947,15 +947,15 @@ static void _GBCoreEnableAudioChannel(struct mCore* core, size_t id, bool enable
static void _GBCoreAdjustVideoLayer(struct mCore* core, size_t id, int32_t x, int32_t y) {
struct GBCore* gbcore = (struct GBCore*) core;
switch (id) {
case 0:
case GB_LAYER_BACKGROUND:
gbcore->renderer.offsetScx = x;
gbcore->renderer.offsetScy = y;
break;
case 1:
case GB_LAYER_WINDOW:
gbcore->renderer.offsetWx = x;
gbcore->renderer.offsetWy = y;
break;
case 2:
case GB_LAYER_OBJ:
gbcore->renderer.objOffsetX = x;
gbcore->renderer.objOffsetY = y;
break;