From d9a6895cca3540e0ffac17a3fa75443f69db81bb Mon Sep 17 00:00:00 2001 From: Staacks Date: Tue, 4 Jul 2023 23:41:35 +0200 Subject: [PATCH] Bring back green mode. --- firmware/jpeg/jpeg.h | 1 + firmware/main.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/firmware/jpeg/jpeg.h b/firmware/jpeg/jpeg.h index c0a3886..268c1cb 100644 --- a/firmware/jpeg/jpeg.h +++ b/firmware/jpeg/jpeg.h @@ -7,6 +7,7 @@ #define JPEG_DATA_SIZE (SCREEN_SIZE * 5 / 8) //5bit per pixel, see https://github.com/Staacks/gbinterceptor/issues/17 #define JPEG_HEADER_SIZE 188 #define JPEG_END_SIZE 2895 +#define JPEG_CHROMA_OFFSET (JPEG_HEADER_SIZE + JPEG_DATA_SIZE + 12) void prepareJpegEncoding(); void startBackbufferToJPEG(bool allowFrameBlend); diff --git a/firmware/main.c b/firmware/main.c index 08df36d..d1cf4ff 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -33,6 +33,8 @@ enum FallbackScreenType {FST_NONE = 0, FST_DEFAULT, FST_OFF, FST_ERROR} fallback int dmaChannel; dma_channel_config dmaConfig; +bool dmgColorMode = false; + void setupGPIO() { gpio_init(GBSENSE_PIN); gpio_init(LED_SWITCH_PIN); @@ -58,6 +60,11 @@ void checkModeSwitch() { modeButtonDebounce = true; //Button pressed, switch mode frameBlending = !frameBlending; + if (frameBlending) { + dmgColorMode = !dmgColorMode; + frontBuffer[JPEG_CHROMA_OFFSET] = dmgColorMode ? 0b10001000 : 0x00; + readyBuffer[JPEG_CHROMA_OFFSET] = dmgColorMode ? 0b10001000 : 0x00; + } renderOSD(frameBlending ? "Blending ON" : "Blending OFF", 0x03, 0x00, MODE_INFO_DURATION); } } else if (modeButtonDebounce) {