all repos — mgba @ 6174858d0d6a8de2e153dd39ae323bfce8c0c921

mGBA Game Boy Advance Emulator

Core: Add RGB8 to native color function
Vicki Pfau vi@endrift.com
Sat, 21 Nov 2020 20:17:11 -0800
commit

6174858d0d6a8de2e153dd39ae323bfce8c0c921

parent

0b0a70d9b725c294034f2f2d9fdbaa4a3a6b5729

2 files changed, 7 insertions(+), 1 deletions(-)

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

@@ -42,18 +42,24 @@ #define M_COLOR_GREEN 0x0000FF00

#define M_COLOR_BLUE 0x00FF0000 #define M_COLOR_ALPHA 0xFF000000 #define M_COLOR_WHITE 0x00FFFFFF + +#define M_RGB8_TO_NATIVE(X) (((X) & 0x00FF00) | (((X) & 0x0000FF) << 16) | (((X) & 0xFF0000) >> 16)) #elif defined(COLOR_5_6_5) #define M_COLOR_RED 0x001F #define M_COLOR_GREEN 0x07E0 #define M_COLOR_BLUE 0xF800 #define M_COLOR_ALPHA 0x0000 #define M_COLOR_WHITE 0xFFDF + +#define M_RGB8_TO_NATIVE(X) ((((X) & 0xF8) << 8) | (((X) & 0xFC00) >> 5) | (((X) & 0xF80000) >> 19)) #else #define M_COLOR_RED 0x001F #define M_COLOR_GREEN 0x03E0 #define M_COLOR_BLUE 0x7C00 #define M_COLOR_ALPHA 0x1000 #define M_COLOR_WHITE 0x7FFF + +#define M_RGB8_TO_NATIVE(X) M_RGB8_TO_BGR5(X) #endif #ifndef PYCPARSE
M src/platform/qt/FrameView.cppsrc/platform/qt/FrameView.cpp

@@ -275,7 +275,7 @@ for (int i = 0; i < 128; ++i) {

gba->video.renderer->highlightOBJ[i] = false; } QPalette palette; - gba->video.renderer->highlightColor = palette.color(QPalette::HighlightedText).rgb(); + gba->video.renderer->highlightColor = M_RGB8_TO_NATIVE(palette.color(QPalette::Highlight).rgb()); gba->video.renderer->highlightAmount = sin(m_glowFrame * M_PI / 30) * 48 + 64; if (!m_overrideBackdrop.isValid()) { QRgb backdrop = M_RGB5_TO_RGB8(gba->video.palette[0]) | 0xFF000000;