mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 05:32:47 +00:00
fix issue #512
This commit is contained in:
parent
d6c6f56526
commit
524a86e9a4
@ -87,3 +87,19 @@ bool ShowRtcSetterPrompt(void* time, const char *format, ...);
|
|||||||
bool ShowProgress(u64 current, u64 total, const char* opstr);
|
bool ShowProgress(u64 current, u64 total, const char* opstr);
|
||||||
|
|
||||||
int ShowBrightnessConfig(int set_brightness);
|
int ShowBrightnessConfig(int set_brightness);
|
||||||
|
|
||||||
|
static inline u16 rgb888_to_rgb565(u32 rgb) {
|
||||||
|
u8 r, g, b;
|
||||||
|
r = (rgb >> 16) & 0x1F;
|
||||||
|
g = (rgb >> 8) & 0x3F;
|
||||||
|
b = (rgb >> 0) & 0x1F;
|
||||||
|
return (r << 11) | (g << 5) | b;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline u16 rgb888_buf_to_rgb565(u8 *rgb) {
|
||||||
|
u8 r, g, b;
|
||||||
|
r = (rgb[0] >> 3);
|
||||||
|
g = (rgb[1] >> 2);
|
||||||
|
b = (rgb[2] >> 3);
|
||||||
|
return (r << 11) | (g << 5) | b;
|
||||||
|
}
|
||||||
|
@ -342,17 +342,17 @@ void set_preview(const char* name, const char* content) {
|
|||||||
else if (strncasecmp(content, "full", _VAR_CNT_LEN) == 0) preview_mode = 2;
|
else if (strncasecmp(content, "full", _VAR_CNT_LEN) == 0) preview_mode = 2;
|
||||||
else preview_mode = 0xFF; // unknown preview mode
|
else preview_mode = 0xFF; // unknown preview mode
|
||||||
} else if (strncmp(name, "PREVIEW_COLOR_ACTIVE", _VAR_NAME_LEN) == 0) {
|
} else if (strncmp(name, "PREVIEW_COLOR_ACTIVE", _VAR_NAME_LEN) == 0) {
|
||||||
u8 rgb[4] = { 0 };
|
u8 rgb[4];
|
||||||
if (strntohex(content, rgb, 3))
|
if (strntohex(content, rgb, 3))
|
||||||
script_color_active = getle32(rgb);
|
script_color_active = rgb888_buf_to_rgb565(rgb);
|
||||||
} else if (strncmp(name, "PREVIEW_COLOR_COMMENT", _VAR_NAME_LEN) == 0) {
|
} else if (strncmp(name, "PREVIEW_COLOR_COMMENT", _VAR_NAME_LEN) == 0) {
|
||||||
u8 rgb[4] = { 0 };
|
u8 rgb[4];
|
||||||
if (strntohex(content, rgb, 3))
|
if (strntohex(content, rgb, 3))
|
||||||
script_color_comment = getle32(rgb);
|
script_color_comment = rgb888_buf_to_rgb565(rgb);
|
||||||
} else if (strncmp(name, "PREVIEW_COLOR_CODE", _VAR_NAME_LEN) == 0) {
|
} else if (strncmp(name, "PREVIEW_COLOR_CODE", _VAR_NAME_LEN) == 0) {
|
||||||
u8 rgb[4] = { 0 };
|
u8 rgb[4];
|
||||||
if (strntohex(content, rgb, 3))
|
if (strntohex(content, rgb, 3))
|
||||||
script_color_code = getle32(rgb);
|
script_color_code = rgb888_buf_to_rgb565(rgb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user