diff --git a/menu/drivers/glui.c b/menu/drivers/glui.c index cb7f96d79d..d375521572 100644 --- a/menu/drivers/glui.c +++ b/menu/drivers/glui.c @@ -68,7 +68,7 @@ static int glui_entry_iterate(unsigned action) return -1; } -static void glui_blit_line(gl_t *gl, float x, float y, const char *message, bool green) +static void glui_blit_line(gl_t *gl, float x, float y, const char *message, uint32_t color) { struct font_params params = {0}; @@ -77,12 +77,9 @@ static void glui_blit_line(gl_t *gl, float x, float y, const char *message, bool params.x = x / gl->win_width; params.y = 1.0f - y / gl->win_height; params.scale = 1.0; - params.color = g_settings.menu.entry_normal_color; + params.color = color; params.full_screen = true; - if (green) - params.color = g_settings.menu.entry_hover_color; - if (!driver.video_data) return; if (!driver.video_poke) @@ -256,7 +253,7 @@ static void glui_render_messagebox(const char *message) { const char *msg = list->elems[i].data; if (msg) - glui_blit_line(gl, x, y + i * glui->line_height, msg, false); + glui_blit_line(gl, x, y + i * glui->line_height, msg, g_settings.menu.entry_normal_color); } end: @@ -361,7 +358,7 @@ static void glui_frame(void) menu_animation_ticker_line(title_buf, glui->term_width - 3, g_runloop.frames.video.count / glui->margin, title, true); glui_blit_line(gl, glui->margin * 2, glui->margin + glui->line_height, - title_buf, true); + title_buf, g_settings.menu.title_color); core_name = g_extern.menu.info.library_name; if (!core_name) @@ -383,7 +380,7 @@ static void glui_frame(void) glui_blit_line(gl, glui->margin * 2, glui->margin + glui->term_height * glui->line_height - + glui->line_height * 2, title_msg, true); + + glui->line_height * 2, title_msg, g_settings.menu.entry_hover_color); } @@ -393,7 +390,7 @@ static void glui_frame(void) glui_blit_line(gl, glui->margin * 14, glui->margin + glui->term_height * glui->line_height - + glui->line_height * 2, timedate, true); + + glui->line_height * 2, timedate, g_settings.menu.entry_hover_color); } x = glui->margin; @@ -432,10 +429,10 @@ static void glui_frame(void) strlcpy(message, entry_title_buf, sizeof(message)); - glui_blit_line(gl, x, y, message, selected); + glui_blit_line(gl, x, y, message, selected ? g_settings.menu.entry_hover_color : g_settings.menu.entry_normal_color); glui_blit_line(gl, gl->win_width - glui->glyph_width * w - glui->margin , - y, type_str_buf, selected); + y, type_str_buf, selected ? g_settings.menu.entry_hover_color : g_settings.menu.entry_normal_color); } if (menu->keyboard.display) diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 2837cc470a..5b26bfea84 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -34,9 +34,17 @@ #define RGUI_TERM_WIDTH (((menu->frame_buf.width - RGUI_TERM_START_X - RGUI_TERM_START_X) / (FONT_WIDTH_STRIDE))) #define RGUI_TERM_HEIGHT (((menu->frame_buf.height - RGUI_TERM_START_Y - RGUI_TERM_START_X) / (FONT_HEIGHT_STRIDE)) - 1) +#if defined(GEKKO)|| defined(PSP) +#define HOVER_COLOR ((3 << 0) | (10 << 4) | (3 << 8) | (7 << 12)) +#define NORMAL_COLOR 0x7FFF +#define TITLE_COLOR HOVER_COLOR +#else +#define HOVER_COLOR (argb32_to_argb4444(g_settings.menu.entry_hover_color)) +#define NORMAL_COLOR (argb32_to_argb4444(g_settings.menu.entry_normal_color)) +#define TITLE_COLOR (argb32_to_argb4444(g_settings.menu.title_color)) +#endif - -static inline uint16_t argb32_to_rgb565(uint32_t col) +static inline uint16_t argb32_to_argb4444(uint32_t col) { unsigned r = (col & 0xff) >> 4; unsigned g = ((col >> 8) & 0xff) >> 4; @@ -160,15 +168,9 @@ static void color_rect(menu_handle_t *menu, menu->frame_buf.data[j * (menu->frame_buf.pitch >> 1) + i] = color; } -static void blit_line(menu_handle_t *menu, int x, int y, const char *message, bool green) +static void blit_line(menu_handle_t *menu, int x, int y, const char *message, uint16_t color) { unsigned i, j; -#if defined(GEKKO)|| defined(PSP) - const uint16_t color = green ? (3 << 0) | (10 << 4) | (3 << 8) | (7 << 12) : 0x7FFF; -#else - const uint16_t color = green ? argb32_to_rgb565(g_settings.menu.entry_hover_color) : - argb32_to_rgb565(g_settings.menu.entry_normal_color); -#endif while (*message) { @@ -315,12 +317,14 @@ static void rgui_render_messagebox(const char *message) fill_rect(&menu->frame_buf, x + 5, y + height - 5, width - 5, 5, green_filler); fill_rect(&menu->frame_buf, x, y + 5, 5, height - 5, green_filler); + uint16_t color = NORMAL_COLOR; + for (i = 0; i < list->size; i++) { const char *msg = list->elems[i].data; int offset_x = FONT_WIDTH_STRIDE * (glyphs_width - strlen(msg)) / 2; int offset_y = FONT_HEIGHT_STRIDE * i; - blit_line(menu, x + 8 + offset_x, y + 8 + offset_y, msg, false); + blit_line(menu, x + 8 + offset_x, y + 8 + offset_y, msg, color); } end: @@ -397,7 +401,11 @@ static void rgui_render(void) menu_animation_ticker_line(title_buf, RGUI_TERM_WIDTH - 3, g_runloop.frames.video.count / RGUI_TERM_START_X, title, true); - blit_line(menu, RGUI_TERM_START_X + RGUI_TERM_START_X, RGUI_TERM_START_X, title_buf, true); + + uint16_t hover_color = HOVER_COLOR; + uint16_t normal_color = NORMAL_COLOR; + + blit_line(menu, RGUI_TERM_START_X + RGUI_TERM_START_X, RGUI_TERM_START_X, title_buf, TITLE_COLOR); core_name = g_extern.menu.info.library_name; if (!core_name) @@ -419,7 +427,7 @@ static void rgui_render(void) blit_line(menu, RGUI_TERM_START_X + RGUI_TERM_START_X, (RGUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) + - RGUI_TERM_START_Y + 2, title_msg, true); + RGUI_TERM_START_Y + 2, title_msg, hover_color); } if (g_settings.menu.timedate_enable) @@ -429,7 +437,7 @@ static void rgui_render(void) blit_line(menu, (RGUI_TERM_WIDTH * FONT_HEIGHT_STRIDE) + (60), (RGUI_TERM_HEIGHT * FONT_HEIGHT_STRIDE) + - RGUI_TERM_START_Y + 2, timedate, true); + RGUI_TERM_START_Y + 2, timedate, hover_color); } @@ -478,7 +486,7 @@ static void rgui_render(void) w, type_str_buf); - blit_line(menu, x, y, message, selected); + blit_line(menu, x, y, message, selected ? hover_color : normal_color); } #ifdef GEKKO diff --git a/settings_data.c b/settings_data.c index 1c14619aae..57f60377b9 100644 --- a/settings_data.c +++ b/settings_data.c @@ -5250,6 +5250,7 @@ static bool setting_data_append_list_menu_options( general_write_handler, general_read_handler); + /* These colors are hints. The menu driver is not required to use them. */ CONFIG_HEX( g_settings.menu.entry_normal_color, "menu_entry_normal_color",