all repos — mgba @ 064d0e992bf6e74e8b4dd206f4f6d52de707ce70

mGBA Game Boy Advance Emulator

GB: Add enum for the layer names
Vicki Pfau vi@endrift.com
Wed, 21 Oct 2020 21:32:08 -0700
commit

064d0e992bf6e74e8b4dd206f4f6d52de707ce70

parent

4ea2a8c6f3fae794d54b35057a4947dddc886502

2 files changed, 15 insertions(+), 9 deletions(-)

jump to
M include/mgba/gb/interface.hinclude/mgba/gb/interface.h

@@ -42,6 +42,12 @@ GB_UNL_BBD = 0x220, // Also used as a mask for MBCs that need special read behavior

GB_UNL_HITEK = 0x221, }; +enum GBVideoLayer { + GB_LAYER_BACKGROUND = 0, + GB_LAYER_WINDOW, + GB_LAYER_OBJ +}; + struct GBSIODriver { struct GBSIO* p;
M src/gb/core.csrc/gb/core.c

@@ -26,9 +26,9 @@ #include <mgba-util/patch.h>

#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 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 _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;