diff --git a/src/core/core.h b/src/core/core.h index 148d92faa..2401ed50d 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -11,6 +11,14 @@ struct VFile; struct mRTCSource; +#ifdef COLOR_16_BIT +typedef uint16_t color_t; +#define BYTES_PER_PIXEL 2 +#else +typedef uint32_t color_t; +#define BYTES_PER_PIXEL 4 +#endif + struct mCore { void* cpu; void* board; @@ -19,7 +27,7 @@ struct mCore { void (*deinit)(struct mCore*); void (*desiredVideoDimensions)(struct mCore*, unsigned* width, unsigned* height); - void (*setVideoBuffer)(struct mCore*, void* buffer, size_t stride); + void (*setVideoBuffer)(struct mCore*, color_t* buffer, size_t stride); bool (*isROM)(struct mCore*, struct VFile* vf); bool (*loadROM)(struct mCore*, struct VFile* vf, struct VFile* save, const char* fname); diff --git a/src/gb/core.c b/src/gb/core.c index b20dc1bf6..f242a0186 100644 --- a/src/gb/core.c +++ b/src/gb/core.c @@ -54,7 +54,7 @@ static void _GBCoreDesiredVideoDimensions(struct mCore* core, unsigned* width, u *height = GB_VIDEO_VERTICAL_PIXELS; } -static void _GBCoreSetVideoBuffer(struct mCore* core, void* buffer, size_t stride) { +static void _GBCoreSetVideoBuffer(struct mCore* core, color_t* buffer, size_t stride) { struct GBCore* gbcore = (struct GBCore*) core; gbcore->renderer.outputBuffer = buffer; gbcore->renderer.outputBufferStride = stride; diff --git a/src/gb/renderers/software.h b/src/gb/renderers/software.h index 4f34aa248..6ee910ead 100644 --- a/src/gb/renderers/software.h +++ b/src/gb/renderers/software.h @@ -8,14 +8,9 @@ #include "util/common.h" +#include "core/core.h" #include "gb/video.h" -#ifdef COLOR_16_BIT -typedef uint16_t color_t; -#else -typedef uint32_t color_t; -#endif - struct GBVideoSoftwareRenderer { struct GBVideoRenderer d; diff --git a/src/gba/renderers/video-software.h b/src/gba/renderers/video-software.h index e1ebc25b3..0b19bd849 100644 --- a/src/gba/renderers/video-software.h +++ b/src/gba/renderers/video-software.h @@ -8,14 +8,9 @@ #include "util/common.h" +#include "core/core.h" #include "gba/video.h" -#ifdef COLOR_16_BIT -typedef uint16_t color_t; -#else -typedef uint32_t color_t; -#endif - struct GBAVideoSoftwareSprite { struct GBAObj obj; int y;