summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2009-02-09 00:32:59 +0000
committerJens Arnold <amiconn@rockbox.org>2009-02-09 00:32:59 +0000
commit0d935ce75e1408dfd9832ae7dbb7d84df50a645d (patch)
tree9ddcc5d21dcd0e576d0fa824e74c58755fa9d1a0
parent94537f954e67d44fdd9703c062c4ee53599e0e74 (diff)
downloadrockbox-0d935ce75e1408dfd9832ae7dbb7d84df50a645d.tar.gz
rockbox-0d935ce75e1408dfd9832ae7dbb7d84df50a645d.zip
Put the display colours for monochrome and greyscale targets into the target config files, and use them both for the simulator UI and screendumps. The Clip now shows the split display properly in screendumps and simulator. A side effect is that screendumps of ordinary monochrome targets are now 4-bit BMP files (saves an alternate code path, and might be more compatible with some gfx programs). * Simplify the simulation of split display, and also simplify greylib simulation. The simulator now always calculates 129 shades (2*128 for a Clip sim), and just uses 2 (or 4) of those for native display simulation. * Centralised the simulator LCD dimension definition.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19950 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/misc.c84
-rw-r--r--apps/misc.h12
-rw-r--r--apps/plugin.c2
-rw-r--r--apps/plugin.h6
-rw-r--r--apps/plugins/lib/grey_core.c153
-rw-r--r--firmware/export/config-clip.h17
-rw-r--r--firmware/export/config-fmrecorder.h6
-rw-r--r--firmware/export/config-h100.h12
-rw-r--r--firmware/export/config-h120.h12
-rw-r--r--firmware/export/config-h300.h6
-rw-r--r--firmware/export/config-iaudiom3.h6
-rw-r--r--firmware/export/config-iaudiom5.h12
-rw-r--r--firmware/export/config-iaudiox5.h6
-rw-r--r--firmware/export/config-ifp7xx.h6
-rw-r--r--firmware/export/config-ipod1g2g.h6
-rw-r--r--firmware/export/config-ipod3g.h6
-rw-r--r--firmware/export/config-ipod4g.h6
-rw-r--r--firmware/export/config-ipodmini.h6
-rw-r--r--firmware/export/config-ipodmini2g.h6
-rw-r--r--firmware/export/config-logikdax.h6
-rw-r--r--firmware/export/config-m200.h6
-rw-r--r--firmware/export/config-m200v4.h6
-rw-r--r--firmware/export/config-mrobe100.h10
-rw-r--r--firmware/export/config-ondiofm.h6
-rw-r--r--firmware/export/config-ondiosp.h6
-rw-r--r--firmware/export/config-player.h6
-rw-r--r--firmware/export/config-recorder.h6
-rw-r--r--firmware/export/config-recorderv2.h6
-rw-r--r--firmware/export/config.h22
-rw-r--r--uisimulator/sdl/button.c2
-rw-r--r--uisimulator/sdl/lcd-bitmap.c230
-rw-r--r--uisimulator/sdl/lcd-bitmap.h2
-rw-r--r--uisimulator/sdl/lcd-charcells.c34
-rw-r--r--uisimulator/sdl/lcd-remote-bitmap.c47
-rw-r--r--uisimulator/sdl/lcd-sdl.c90
-rw-r--r--uisimulator/sdl/lcd-sdl.h13
-rw-r--r--uisimulator/sdl/uisdl.c12
-rw-r--r--uisimulator/sdl/uisdl.h218
38 files changed, 522 insertions, 576 deletions
diff --git a/apps/misc.c b/apps/misc.c
index 6e871acd3b..43dfd45e51 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -344,19 +344,20 @@ int fast_readline(int fd, char *buf, int buf_size, void *parameters,
344#if LCD_DEPTH == 16 344#if LCD_DEPTH == 16
345#define BMP_COMPRESSION 3 /* BI_BITFIELDS */ 345#define BMP_COMPRESSION 3 /* BI_BITFIELDS */
346#define BMP_NUMCOLORS 3 346#define BMP_NUMCOLORS 3
347#else 347#else /* LCD_DEPTH != 16 */
348#define BMP_COMPRESSION 0 /* BI_RGB */ 348#define BMP_COMPRESSION 0 /* BI_RGB */
349#if LCD_DEPTH <= 8 349#if LCD_DEPTH <= 8
350#define BMP_NUMCOLORS (1 << LCD_DEPTH) 350#ifdef HAVE_LCD_SPLIT
351#define BMP_NUMCOLORS (2 << LCD_DEPTH)
351#else 352#else
352#define BMP_NUMCOLORS 0 353#define BMP_NUMCOLORS (1 << LCD_DEPTH)
353#endif
354#endif 354#endif
355#else /* LCD_DEPTH > 8 */
356#define BMP_NUMCOLORS 0
357#endif /* LCD_DEPTH > 8 */
358#endif /* LCD_DEPTH != 16 */
355 359
356#if LCD_DEPTH == 1 360#if LCD_DEPTH <= 4
357#define BMP_BPP 1
358#define BMP_LINESIZE ((LCD_WIDTH/8 + 3) & ~3)
359#elif LCD_DEPTH <= 4
360#define BMP_BPP 4 361#define BMP_BPP 4
361#define BMP_LINESIZE ((LCD_WIDTH/2 + 3) & ~3) 362#define BMP_LINESIZE ((LCD_WIDTH/2 + 3) & ~3)
362#elif LCD_DEPTH <= 8 363#elif LCD_DEPTH <= 8
@@ -386,7 +387,7 @@ static const unsigned char bmpheader[] =
386 387
387 0x28, 0x00, 0x00, 0x00, /* Size of (2nd) header */ 388 0x28, 0x00, 0x00, 0x00, /* Size of (2nd) header */
388 LE32_CONST(LCD_WIDTH), /* Width in pixels */ 389 LE32_CONST(LCD_WIDTH), /* Width in pixels */
389 LE32_CONST(LCD_HEIGHT), /* Height in pixels */ 390 LE32_CONST(LCD_HEIGHT+LCD_SPLIT_LINES), /* Height in pixels */
390 0x01, 0x00, /* Number of planes (always 1) */ 391 0x01, 0x00, /* Number of planes (always 1) */
391 LE16_CONST(BMP_BPP), /* Bits per pixel 1/4/8/16/24 */ 392 LE16_CONST(BMP_BPP), /* Bits per pixel 1/4/8/16/24 */
392 LE32_CONST(BMP_COMPRESSION),/* Compression mode */ 393 LE32_CONST(BMP_COMPRESSION),/* Compression mode */
@@ -397,22 +398,26 @@ static const unsigned char bmpheader[] =
397 LE32_CONST(BMP_NUMCOLORS), /* Number of important colours */ 398 LE32_CONST(BMP_NUMCOLORS), /* Number of important colours */
398 399
399#if LCD_DEPTH == 1 400#if LCD_DEPTH == 1
400#ifdef MROBE_100 401#ifdef HAVE_NEGATIVE_LCD
401 2, 2, 94, 0x00, /* Colour #0 */ 402 BMP_COLOR(LCD_BL_DARKCOLOR),
402 3, 6, 241, 0x00 /* Colour #1 */ 403 BMP_COLOR(LCD_BL_BRIGHTCOLOR),
403#else 404#ifdef HAVE_LCD_SPLIT
404 0x90, 0xee, 0x90, 0x00, /* Colour #0 */ 405 BMP_COLOR(LCD_BL_DARKCOLOR_2),
405 0x00, 0x00, 0x00, 0x00 /* Colour #1 */ 406 BMP_COLOR(LCD_BL_BRIGHTCOLOR_2),
406#endif 407#endif
408#else /* positive display */
409 BMP_COLOR(LCD_BL_BRIGHTCOLOR),
410 BMP_COLOR(LCD_BL_DARKCOLOR),
411#endif /* positive display */
407#elif LCD_DEPTH == 2 412#elif LCD_DEPTH == 2
408 0xe6, 0xd8, 0xad, 0x00, /* Colour #0 */ 413 BMP_COLOR(LCD_BL_BRIGHTCOLOR),
409 0x99, 0x90, 0x73, 0x00, /* Colour #1 */ 414 BMP_COLOR_MIX(LCD_BL_BRIGHTCOLOR, LCD_BL_DARKCOLOR, 1, 3),
410 0x4c, 0x48, 0x39, 0x00, /* Colour #2 */ 415 BMP_COLOR_MIX(LCD_BL_BRIGHTCOLOR, LCD_BL_DARKCOLOR, 2, 3),
411 0x00, 0x00, 0x00, 0x00 /* Colour #3 */ 416 BMP_COLOR(LCD_BL_DARKCOLOR),
412#elif LCD_DEPTH == 16 417#elif LCD_DEPTH == 16
413 0x00, 0xf8, 0x00, 0x00, /* red bitfield mask */ 418 0x00, 0xf8, 0x00, 0x00, /* red bitfield mask */
414 0xe0, 0x07, 0x00, 0x00, /* green bitfield mask */ 419 0xe0, 0x07, 0x00, 0x00, /* green bitfield mask */
415 0x1f, 0x00, 0x00, 0x00 /* blue bitfield mask */ 420 0x1f, 0x00, 0x00, 0x00, /* blue bitfield mask */
416#endif 421#endif
417}; 422};
418 423
@@ -461,30 +466,33 @@ void screen_dump(void)
461 for (by = LCD_FBHEIGHT - 1; by >= 0; by--) 466 for (by = LCD_FBHEIGHT - 1; by >= 0; by--)
462 { 467 {
463 unsigned char *src = &lcd_framebuffer[by][0]; 468 unsigned char *src = &lcd_framebuffer[by][0];
464 unsigned char *dst = &line_block[0][0]; 469 unsigned char *dst = &line_block[7][0];
465 470
466 memset(line_block, 0, sizeof(line_block)); 471 memset(line_block, 0, sizeof(line_block));
467 for (bx = LCD_WIDTH/8; bx > 0; bx--) 472
473#ifdef HAVE_LCD_SPLIT
474 if (by == (LCD_SPLIT_POS/8 - 1))
475 write(fh, line_block, LCD_SPLIT_LINES * sizeof(line_block[0]));
476#endif
477 for (bx = LCD_WIDTH/2; bx > 0; bx--)
468 { 478 {
469 unsigned dst_mask = 0x80; 479 unsigned char *dst_blk = dst++;
470 int ix; 480 unsigned src_byte0 = *src++ << 4;
481 unsigned src_byte1 = *src++;
482 int iy;
471 483
472 for (ix = 8; ix > 0; ix--) 484 for (iy = 8; iy > 0; iy--)
473 { 485 {
474 unsigned char *dst_blk = dst; 486 *dst_blk = (src_byte0 & 0x10)
475 unsigned src_byte = *src++; 487 | (src_byte1 & 0x01)
476 int iy; 488#ifdef HAVE_LCD_SPLIT
477 489 | (by < (LCD_SPLIT_POS/8) ? 0x22 : 0)
478 for (iy = 8; iy > 0; iy--) 490#endif
479 { 491 ;
480 if (src_byte & 0x80) 492 src_byte0 >>= 1;
481 *dst_blk |= dst_mask; 493 src_byte1 >>= 1;
482 src_byte <<= 1; 494 dst_blk -= BMP_LINESIZE;
483 dst_blk += BMP_LINESIZE;
484 }
485 dst_mask >>= 1;
486 } 495 }
487 dst++;
488 } 496 }
489 497
490 write(fh, line_block, sizeof(line_block)); 498 write(fh, line_block, sizeof(line_block));
diff --git a/apps/misc.h b/apps/misc.h
index 22ae4849a4..99e709c2c8 100644
--- a/apps/misc.h
+++ b/apps/misc.h
@@ -93,6 +93,18 @@ void screen_dump(void);
93void screen_dump_set_hook(void (*hook)(int fh)); 93void screen_dump_set_hook(void (*hook)(int fh));
94#endif 94#endif
95 95
96/* Make BMP colour map entries from R, G, B triples, without and with blending.
97 * Not within HAVE_LCD_BITMAP because it is also used for the Player sim */
98#define RED_CMP(c) (((c) >> 16) & 0xff)
99#define GREEN_CMP(c) (((c) >> 8) & 0xff)
100#define BLUE_CMP(c) ((c) & 0xff)
101
102#define BMP_COLOR(c) BLUE_CMP(c), GREEN_CMP(c), RED_CMP(c), 0
103#define BMP_COLOR_MIX(c1, c2, num, den) \
104 (BLUE_CMP(c2) - BLUE_CMP(c1)) * (num) / (den) + BLUE_CMP(c1), \
105 (GREEN_CMP(c2) - GREEN_CMP(c1)) * (num) / (den) + GREEN_CMP(c1), \
106 (RED_CMP(c2) - RED_CMP(c1)) * (num) / (den) + RED_CMP(c1), 0
107
96bool settings_parseline(char* line, char** name, char** value); 108bool settings_parseline(char* line, char** name, char** value);
97long default_event_handler_ex(long event, void (*callback)(void *), void *parameter); 109long default_event_handler_ex(long event, void (*callback)(void *), void *parameter);
98long default_event_handler(long event); 110long default_event_handler(long event);
diff --git a/apps/plugin.c b/apps/plugin.c
index 8828d10aa7..3b14b0032f 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -61,7 +61,7 @@
61static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE]; 61static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE];
62void *sim_plugin_load(char *plugin, void **pd); 62void *sim_plugin_load(char *plugin, void **pd);
63void sim_plugin_close(void *pd); 63void sim_plugin_close(void *pd);
64void sim_lcd_ex_init(int shades, unsigned long (*getpixel)(int, int)); 64void sim_lcd_ex_init(unsigned long (*getpixel)(int, int));
65void sim_lcd_ex_update_rect(int x, int y, int width, int height); 65void sim_lcd_ex_update_rect(int x, int y, int width, int height);
66#else 66#else
67#define sim_plugin_close(x) 67#define sim_plugin_close(x)
diff --git a/apps/plugin.h b/apps/plugin.h
index 2017bf3e5b..82ce0d6ddf 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -126,12 +126,12 @@ void* plugin_get_buffer(size_t *buffer_size);
126#define PLUGIN_MAGIC 0x526F634B /* RocK */ 126#define PLUGIN_MAGIC 0x526F634B /* RocK */
127 127
128/* increase this every time the api struct changes */ 128/* increase this every time the api struct changes */
129#define PLUGIN_API_VERSION 141 129#define PLUGIN_API_VERSION 142
130 130
131/* update this to latest version if a change to the api struct breaks 131/* update this to latest version if a change to the api struct breaks
132 backwards compatibility (and please take the opportunity to sort in any 132 backwards compatibility (and please take the opportunity to sort in any
133 new function which are "waiting" at the end of the function table) */ 133 new function which are "waiting" at the end of the function table) */
134#define PLUGIN_MIN_API_VERSION 141 134#define PLUGIN_MIN_API_VERSION 142
135 135
136/* plugin return codes */ 136/* plugin return codes */
137enum plugin_status { 137enum plugin_status {
@@ -474,7 +474,7 @@ struct plugin_api {
474#ifdef SIMULATOR 474#ifdef SIMULATOR
475 /* special simulator hooks */ 475 /* special simulator hooks */
476#if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8 476#if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8
477 void (*sim_lcd_ex_init)(int shades, unsigned long (*getpixel)(int, int)); 477 void (*sim_lcd_ex_init)(unsigned long (*getpixel)(int, int));
478 void (*sim_lcd_ex_update_rect)(int x, int y, int width, int height); 478 void (*sim_lcd_ex_update_rect)(int x, int y, int width, int height);
479#endif 479#endif
480#endif 480#endif
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c
index c73f0cdf52..a7e8f2a08b 100644
--- a/apps/plugins/lib/grey_core.c
+++ b/apps/plugins/lib/grey_core.c
@@ -355,6 +355,7 @@ static inline void _deferred_update(void)
355 * coordinates! */ 355 * coordinates! */
356static unsigned long _grey_get_pixel(int x, int y) 356static unsigned long _grey_get_pixel(int x, int y)
357{ 357{
358 long val;
358 int xg = x - _grey_info.x; 359 int xg = x - _grey_info.x;
359 int yg = y - _grey_info.y; 360 int yg = y - _grey_info.y;
360#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 361#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
@@ -364,7 +365,11 @@ static unsigned long _grey_get_pixel(int x, int y)
364 + (xg << _GREY_BSHIFT) + (~yg & _GREY_BMASK); 365 + (xg << _GREY_BSHIFT) + (~yg & _GREY_BMASK);
365#endif 366#endif
366 367
367 return _grey_info.values[idx] + (1 << LCD_DEPTH); 368 val = _grey_info.values[idx];
369#ifdef HAVE_LCD_SPLIT
370 val -= val >> 7;
371#endif
372 return val;
368} 373}
369 374
370#else /* !SIMULATOR */ 375#else /* !SIMULATOR */
@@ -634,9 +639,9 @@ void grey_show(bool enable)
634 { 639 {
635 _grey_info.flags |= _GREY_RUNNING; 640 _grey_info.flags |= _GREY_RUNNING;
636#ifdef SIMULATOR 641#ifdef SIMULATOR
637 rb->sim_lcd_ex_init(129, _grey_get_pixel); 642 rb->sim_lcd_ex_init(_grey_get_pixel);
638 rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y, 643 rb->sim_lcd_ex_update_rect(_grey_info.x, _grey_info.y,
639 _grey_info.width, _grey_info.height); 644 _grey_info.width, _grey_info.height);
640#else /* !SIMULATOR */ 645#else /* !SIMULATOR */
641#ifdef NEED_BOOST 646#ifdef NEED_BOOST
642 rb->cpu_boost(true); 647 rb->cpu_boost(true);
@@ -655,7 +660,7 @@ void grey_show(bool enable)
655 else if (!enable && (_grey_info.flags & _GREY_RUNNING)) 660 else if (!enable && (_grey_info.flags & _GREY_RUNNING))
656 { 661 {
657#ifdef SIMULATOR 662#ifdef SIMULATOR
658 rb->sim_lcd_ex_init(0, NULL); 663 rb->sim_lcd_ex_init(NULL);
659#else /* !SIMULATOR */ 664#else /* !SIMULATOR */
660 rb->timer_unregister(); 665 rb->timer_unregister();
661#if NUM_CORES > 1 /* Make sure the ISR has finished before calling lcd_update() */ 666#if NUM_CORES > 1 /* Make sure the ISR has finished before calling lcd_update() */
@@ -702,9 +707,14 @@ void grey_deferred_lcd_update(void)
702 707
703/*** Screenshot ***/ 708/*** Screenshot ***/
704 709
705#define BMP_FIXEDCOLORS (1 << LCD_DEPTH) 710#ifdef HAVE_LCD_SPLIT
706#define BMP_VARCOLORS 129 711#define GRADIENT_MAX 127
707#define BMP_NUMCOLORS (BMP_FIXEDCOLORS + BMP_VARCOLORS) 712#define BMP_NUMCOLORS 256
713#else
714#define GRADIENT_MAX 128
715#define BMP_NUMCOLORS 129
716#endif
717
708#define BMP_BPP 8 718#define BMP_BPP 8
709#define BMP_LINESIZE ((LCD_WIDTH + 3) & ~3) 719#define BMP_LINESIZE ((LCD_WIDTH + 3) & ~3)
710#define BMP_HEADERSIZE (54 + 4 * BMP_NUMCOLORS) 720#define BMP_HEADERSIZE (54 + 4 * BMP_NUMCOLORS)
@@ -723,7 +733,7 @@ static const unsigned char bmpheader[] =
723 733
724 0x28, 0x00, 0x00, 0x00, /* Size of (2nd) header */ 734 0x28, 0x00, 0x00, 0x00, /* Size of (2nd) header */
725 LE32_CONST(LCD_WIDTH), /* Width in pixels */ 735 LE32_CONST(LCD_WIDTH), /* Width in pixels */
726 LE32_CONST(LCD_HEIGHT), /* Height in pixels */ 736 LE32_CONST(LCD_HEIGHT+LCD_SPLIT_LINES), /* Height in pixels */
727 0x01, 0x00, /* Number of planes (always 1) */ 737 0x01, 0x00, /* Number of planes (always 1) */
728 LE16_CONST(BMP_BPP), /* Bits per pixel 1/4/8/16/24 */ 738 LE16_CONST(BMP_BPP), /* Bits per pixel 1/4/8/16/24 */
729 0x00, 0x00, 0x00, 0x00, /* Compression mode, 0 = none */ 739 0x00, 0x00, 0x00, 0x00, /* Compression mode, 0 = none */
@@ -732,36 +742,11 @@ static const unsigned char bmpheader[] =
732 0xc4, 0x0e, 0x00, 0x00, /* Vertical resolution (pixels/meter) */ 742 0xc4, 0x0e, 0x00, 0x00, /* Vertical resolution (pixels/meter) */
733 LE32_CONST(BMP_NUMCOLORS), /* Number of used colours */ 743 LE32_CONST(BMP_NUMCOLORS), /* Number of used colours */
734 LE32_CONST(BMP_NUMCOLORS), /* Number of important colours */ 744 LE32_CONST(BMP_NUMCOLORS), /* Number of important colours */
735
736 /* Fixed colours */
737#if LCD_DEPTH == 1
738 0x90, 0xee, 0x90, 0x00, /* Colour #0 */
739 0x00, 0x00, 0x00, 0x00 /* Colour #1 */
740#elif LCD_DEPTH == 2
741 0xe6, 0xd8, 0xad, 0x00, /* Colour #0 */
742 0x99, 0x90, 0x73, 0x00, /* Colour #1 */
743 0x4c, 0x48, 0x39, 0x00, /* Colour #2 */
744 0x00, 0x00, 0x00, 0x00 /* Colour #3 */
745#endif
746}; 745};
747 746
748#if LCD_DEPTH == 1 747#if LCD_DEPTH == 2
749#ifdef MROBE_100 748/* Only defined for positive, non-split LCD for now */
750#define BMP_RED 241 749static const unsigned char colorindex[4] = {128, 85, 43, 0};
751#define BMP_GREEN 6
752#define BMP_BLUE 3
753#define BMP_RED_BASE 94
754#define BMP_GREEN_BASE 2
755#define BMP_BLUE_BASE 2
756#else
757#define BMP_RED 0x90
758#define BMP_GREEN 0xee
759#define BMP_BLUE 0x90
760#endif
761#elif LCD_DEPTH == 2
762#define BMP_RED 0xad
763#define BMP_GREEN 0xd8
764#define BMP_BLUE 0xe6
765#endif 750#endif
766 751
767/* Hook function for core screen_dump() to save the current display 752/* Hook function for core screen_dump() to save the current display
@@ -772,6 +757,7 @@ static void grey_screendump_hook(int fd)
772 int x, y, gx, gy; 757 int x, y, gx, gy;
773#if LCD_PIXELFORMAT == VERTICAL_PACKING 758#if LCD_PIXELFORMAT == VERTICAL_PACKING
774#if LCD_DEPTH == 1 759#if LCD_DEPTH == 1
760 unsigned val;
775 unsigned mask; 761 unsigned mask;
776#elif LCD_DEPTH == 2 762#elif LCD_DEPTH == 2
777 int shift; 763 int shift;
@@ -782,37 +768,57 @@ static void grey_screendump_hook(int fd)
782#endif /* LCD_PIXELFORMAT */ 768#endif /* LCD_PIXELFORMAT */
783 fb_data *lcdptr; 769 fb_data *lcdptr;
784 unsigned char *clut_entry; 770 unsigned char *clut_entry;
785 unsigned char linebuf[MAX(4*BMP_VARCOLORS,BMP_LINESIZE)]; 771 unsigned char linebuf[MAX(4*BMP_NUMCOLORS,BMP_LINESIZE)];
786 772
787 rb->write(fd, bmpheader, sizeof(bmpheader)); /* write header */ 773 rb->write(fd, bmpheader, sizeof(bmpheader)); /* write header */
788 774
789 /* build clut */ 775 /* build clut */
790 rb->memset(linebuf, 0, 4*BMP_VARCOLORS); 776 rb->memset(linebuf, 0, 4*BMP_NUMCOLORS);
791 clut_entry = linebuf; 777 clut_entry = linebuf;
792 778
793 for (i = 0; i <= 128; i++) 779 for (i = 0; i <= GRADIENT_MAX; i++)
794 { 780 {
795#ifdef MROBE_100 781 *clut_entry++ = (_GREY_MULUQ(BLUE_CMP(LCD_BL_BRIGHTCOLOR)
796 *clut_entry++ = (_GREY_MULUQ(BMP_BLUE-BMP_BLUE_BASE, i) >> 7) + 782 -BLUE_CMP(LCD_BL_DARKCOLOR), i) >> 7)
797 BMP_BLUE_BASE; 783 + BLUE_CMP(LCD_BL_DARKCOLOR);
798 *clut_entry++ = (_GREY_MULUQ(BMP_GREEN-BMP_GREEN_BASE, i) >> 7) + 784 *clut_entry++ = (_GREY_MULUQ(GREEN_CMP(LCD_BL_BRIGHTCOLOR)
799 BMP_GREEN_BASE; 785 -GREEN_CMP(LCD_BL_DARKCOLOR), i) >> 7)
800 *clut_entry++ = (_GREY_MULUQ(BMP_RED-BMP_RED_BASE, i) >> 7) + 786 + GREEN_CMP(LCD_BL_DARKCOLOR);
801 BMP_RED_BASE; 787 *clut_entry++ = (_GREY_MULUQ(RED_CMP(LCD_BL_BRIGHTCOLOR)
802#else 788 -RED_CMP(LCD_BL_DARKCOLOR), i) >> 7)
803 *clut_entry++ = _GREY_MULUQ(BMP_BLUE, i) >> 7; 789 + RED_CMP(LCD_BL_DARKCOLOR);
804 *clut_entry++ = _GREY_MULUQ(BMP_GREEN, i) >> 7;
805 *clut_entry++ = _GREY_MULUQ(BMP_RED, i) >> 7;
806#endif
807 clut_entry++; 790 clut_entry++;
808 } 791 }
809 rb->write(fd, linebuf, 4*BMP_VARCOLORS); 792#ifdef HAVE_LCD_SPLIT
793 for (i = 0; i <= GRADIENT_MAX; i++)
794 {
795 *clut_entry++ = (_GREY_MULUQ(BLUE_CMP(LCD_BL_BRIGHTCOLOR_2)
796 -BLUE_CMP(LCD_BL_DARKCOLOR_2), i) >> 7)
797 + BLUE_CMP(LCD_BL_DARKCOLOR_2);
798 *clut_entry++ = (_GREY_MULUQ(GREEN_CMP(LCD_BL_BRIGHTCOLOR_2)
799 -GREEN_CMP(LCD_BL_DARKCOLOR_2), i) >> 7)
800 + GREEN_CMP(LCD_BL_DARKCOLOR_2);
801 *clut_entry++ = (_GREY_MULUQ(RED_CMP(LCD_BL_BRIGHTCOLOR_2)
802 -RED_CMP(LCD_BL_DARKCOLOR_2), i) >> 7)
803 + RED_CMP(LCD_BL_DARKCOLOR_2);
804 clut_entry++;
805 }
806#endif
807 rb->write(fd, linebuf, 4*BMP_NUMCOLORS);
810 808
811 /* BMP image goes bottom -> top */ 809 /* BMP image goes bottom -> top */
812 for (y = LCD_HEIGHT - 1; y >= 0; y--) 810 for (y = LCD_HEIGHT - 1; y >= 0; y--)
813 { 811 {
814 rb->memset(linebuf, 0, BMP_LINESIZE); 812 rb->memset(linebuf, 0, BMP_LINESIZE);
815 813
814#if defined(HAVE_LCD_SPLIT) && (LCD_SPLIT_LINES == 2)
815 if (y == LCD_SPLIT_POS - 1)
816 {
817 rb->write(fd, linebuf, BMP_LINESIZE);
818 rb->write(fd, linebuf, BMP_LINESIZE);
819 }
820#endif
821
816 gy = y - _grey_info.y; 822 gy = y - _grey_info.y;
817#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 823#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
818#if LCD_DEPTH == 2 824#if LCD_DEPTH == 2
@@ -828,15 +834,15 @@ static void grey_screendump_hook(int fd)
828 unsigned char *src = _grey_info.values 834 unsigned char *src = _grey_info.values
829 + _GREY_MULUQ(_grey_info.width, gy) + gx; 835 + _GREY_MULUQ(_grey_info.width, gy) + gx;
830 for (i = 0; i < 4; i++) 836 for (i = 0; i < 4; i++)
831 linebuf[x + i] = BMP_FIXEDCOLORS + *src++; 837 linebuf[x + i] = *src++;
832 } 838 }
833 else 839 else
834 { 840 {
835 unsigned data = *lcdptr; 841 unsigned data = *lcdptr;
836 linebuf[x] = (data >> 6) & 3; 842 linebuf[x] = colorindex[(data >> 6) & 3];
837 linebuf[x + 1] = (data >> 4) & 3; 843 linebuf[x + 1] = colorindex[(data >> 4) & 3];
838 linebuf[x + 2] = (data >> 2) & 3; 844 linebuf[x + 2] = colorindex[(data >> 2) & 3];
839 linebuf[x + 3] = data & 3; 845 linebuf[x + 3] = colorindex[data & 3];
840 } 846 }
841 lcdptr++; 847 lcdptr++;
842 } 848 }
@@ -853,16 +859,27 @@ static void grey_screendump_hook(int fd)
853 if (((unsigned)gy < (unsigned)_grey_info.height) 859 if (((unsigned)gy < (unsigned)_grey_info.height)
854 && ((unsigned)gx < (unsigned)_grey_info.width)) 860 && ((unsigned)gx < (unsigned)_grey_info.width))
855 { 861 {
856 linebuf[x] = BMP_FIXEDCOLORS 862 val = _grey_info.values[_GREY_MULUQ(_grey_info.width,
857 + _grey_info.values[_GREY_MULUQ(_grey_info.width, 863 gy & ~_GREY_BMASK)
858 gy & ~_GREY_BMASK) 864 + (gx << _GREY_BSHIFT)
859 + (gx << _GREY_BSHIFT) 865 + (~gy & _GREY_BMASK)];
860 + (~gy & _GREY_BMASK)]; 866#ifdef HAVE_LCD_SPLIT
867 val -= val >> 7;
868#endif
861 } 869 }
862 else 870 else
863 { 871 {
864 linebuf[x] = (*lcdptr & mask) ? 1 : 0; 872#ifdef HAVE_NEGATIVE_LCD
873 val = (*lcdptr & mask) ? GRADIENT_MAX : 0;
874#else
875 val = (*lcdptr & mask) ? 0 : GRADIENT_MAX;
876#endif
865 } 877 }
878#ifdef HAVE_LCD_SPLIT
879 if (y < LCD_SPLIT_POS)
880 val |= 0x80;
881#endif
882 linebuf[x] = val;
866 lcdptr++; 883 lcdptr++;
867 } 884 }
868#elif LCD_DEPTH == 2 885#elif LCD_DEPTH == 2
@@ -876,15 +893,14 @@ static void grey_screendump_hook(int fd)
876 if (((unsigned)gy < (unsigned)_grey_info.height) 893 if (((unsigned)gy < (unsigned)_grey_info.height)
877 && ((unsigned)gx < (unsigned)_grey_info.width)) 894 && ((unsigned)gx < (unsigned)_grey_info.width))
878 { 895 {
879 linebuf[x] = BMP_FIXEDCOLORS 896 linebuf[x] = _grey_info.values[_GREY_MULUQ(_grey_info.width,
880 + _grey_info.values[_GREY_MULUQ(_grey_info.width,
881 gy & ~_GREY_BMASK) 897 gy & ~_GREY_BMASK)
882 + (gx << _GREY_BSHIFT) 898 + (gx << _GREY_BSHIFT)
883 + (~gy & _GREY_BMASK)]; 899 + (~gy & _GREY_BMASK)];
884 } 900 }
885 else 901 else
886 { 902 {
887 linebuf[x] = (*lcdptr >> shift) & 3; 903 linebuf[x] = colorindex[(*lcdptr >> shift) & 3];
888 } 904 }
889 lcdptr++; 905 lcdptr++;
890 } 906 }
@@ -901,8 +917,7 @@ static void grey_screendump_hook(int fd)
901 if (((unsigned)gy < (unsigned)_grey_info.height) 917 if (((unsigned)gy < (unsigned)_grey_info.height)
902 && ((unsigned)gx < (unsigned)_grey_info.width)) 918 && ((unsigned)gx < (unsigned)_grey_info.width))
903 { 919 {
904 linebuf[x] = BMP_FIXEDCOLORS 920 linebuf[x] = _grey_info.values[_GREY_MULUQ(_grey_info.width,
905 + _grey_info.values[_GREY_MULUQ(_grey_info.width,
906 gy & ~_GREY_BMASK) 921 gy & ~_GREY_BMASK)
907 + (gx << _GREY_BSHIFT) 922 + (gx << _GREY_BSHIFT)
908 + (~gy & _GREY_BMASK)]; 923 + (~gy & _GREY_BMASK)];
@@ -910,7 +925,7 @@ static void grey_screendump_hook(int fd)
910 else 925 else
911 { 926 {
912 data = (*lcdptr >> shift) & 0x0101; 927 data = (*lcdptr >> shift) & 0x0101;
913 linebuf[x] = ((data >> 7) | data) & 3; 928 linebuf[x] = colorindex[((data >> 7) | data) & 3];
914 } 929 }
915 lcdptr++; 930 lcdptr++;
916 } 931 }
diff --git a/firmware/export/config-clip.h b/firmware/export/config-clip.h
index da8acf2fdf..95ed715276 100644
--- a/firmware/export/config-clip.h
+++ b/firmware/export/config-clip.h
@@ -45,7 +45,24 @@
45#define LCD_WIDTH 128 45#define LCD_WIDTH 128
46#define LCD_HEIGHT 64 46#define LCD_HEIGHT 64
47#define LCD_DEPTH 1 47#define LCD_DEPTH 1
48
48#define LCD_PIXELFORMAT VERTICAL_PACKING 49#define LCD_PIXELFORMAT VERTICAL_PACKING
50#define HAVE_NEGATIVE_LCD /* bright on dark */
51#define HAVE_LCD_SPLIT /* split display */
52
53/* Display colours, for screenshots and sim (0xRRGGBB) */
54#define LCD_DARKCOLOR 0x000000
55#define LCD_BRIGHTCOLOR 0x000000
56#define LCD_BL_DARKCOLOR 0x000000
57#define LCD_BL_BRIGHTCOLOR 0x0de2e5
58
59#define LCD_DARKCOLOR_2 0x000000
60#define LCD_BRIGHTCOLOR_2 0x000000
61#define LCD_BL_DARKCOLOR_2 0x000000
62#define LCD_BL_BRIGHTCOLOR_2 0xffe60f
63
64#define LCD_SPLIT_POS 16
65#define LCD_SPLIT_LINES 2
49 66
50/* define this if you have LCD enable function */ 67/* define this if you have LCD enable function */
51#define HAVE_LCD_ENABLE 68#define HAVE_LCD_ENABLE
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h
index da281bd033..bc859df67a 100644
--- a/firmware/export/config-fmrecorder.h
+++ b/firmware/export/config-fmrecorder.h
@@ -39,6 +39,12 @@
39 39
40#define LCD_PIXELFORMAT VERTICAL_PACKING 40#define LCD_PIXELFORMAT VERTICAL_PACKING
41 41
42/* Display colours, for screenshots and sim (0xRRGGBB) */
43#define LCD_DARKCOLOR 0x000000
44#define LCD_BRIGHTCOLOR 0x5a915a
45#define LCD_BL_DARKCOLOR 0x000000
46#define LCD_BL_BRIGHTCOLOR 0x7ee57e
47
42/* define this if you have a Recorder style 10-key keyboard */ 48/* define this if you have a Recorder style 10-key keyboard */
43#define CONFIG_KEYPAD RECORDER_PAD 49#define CONFIG_KEYPAD RECORDER_PAD
44 50
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index 6ca2a0701e..34ba3e5ad9 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -44,6 +44,12 @@
44 44
45#define LCD_PIXELFORMAT VERTICAL_PACKING 45#define LCD_PIXELFORMAT VERTICAL_PACKING
46 46
47/* Display colours, for screenshots and sim (0xRRGGBB) */
48#define LCD_DARKCOLOR 0x000000
49#define LCD_BRIGHTCOLOR 0x7e917e
50#define LCD_BL_DARKCOLOR 0x000000
51#define LCD_BL_BRIGHTCOLOR 0xadd8e6
52
47/* remote LCD */ 53/* remote LCD */
48#define LCD_REMOTE_WIDTH 128 54#define LCD_REMOTE_WIDTH 128
49#define LCD_REMOTE_HEIGHT 64 55#define LCD_REMOTE_HEIGHT 64
@@ -51,6 +57,12 @@
51 57
52#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING 58#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING
53 59
60/* Remote display colours, for screenshots and sim (0xRRGGBB) */
61#define LCD_REMOTE_DARKCOLOR 0x000000
62#define LCD_REMOTE_BRIGHTCOLOR 0x5a915a
63#define LCD_REMOTE_BL_DARKCOLOR 0x000000
64#define LCD_REMOTE_BL_BRIGHTCOLOR 0x82b4fa
65
54#define CONFIG_KEYPAD IRIVER_H100_PAD 66#define CONFIG_KEYPAD IRIVER_H100_PAD
55 67
56#define CONFIG_REMOTE_KEYPAD H100_REMOTE 68#define CONFIG_REMOTE_KEYPAD H100_REMOTE
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index 74074e83e0..37c1872335 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -39,6 +39,12 @@
39 39
40#define LCD_PIXELFORMAT VERTICAL_PACKING 40#define LCD_PIXELFORMAT VERTICAL_PACKING
41 41
42/* Display colours, for screenshots and sim (0xRRGGBB) */
43#define LCD_DARKCOLOR 0x000000
44#define LCD_BRIGHTCOLOR 0x7e917e
45#define LCD_BL_DARKCOLOR 0x000000
46#define LCD_BL_BRIGHTCOLOR 0xadd8e6
47
42/* remote LCD */ 48/* remote LCD */
43#define LCD_REMOTE_WIDTH 128 49#define LCD_REMOTE_WIDTH 128
44#define LCD_REMOTE_HEIGHT 64 50#define LCD_REMOTE_HEIGHT 64
@@ -46,6 +52,12 @@
46 52
47#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING 53#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING
48 54
55/* Remote display colours, for screenshots and sim (0xRRGGBB) */
56#define LCD_REMOTE_DARKCOLOR 0x000000
57#define LCD_REMOTE_BRIGHTCOLOR 0x5a915a
58#define LCD_REMOTE_BL_DARKCOLOR 0x000000
59#define LCD_REMOTE_BL_BRIGHTCOLOR 0x82b4fa
60
49#define CONFIG_KEYPAD IRIVER_H100_PAD 61#define CONFIG_KEYPAD IRIVER_H100_PAD
50 62
51#define CONFIG_REMOTE_KEYPAD H100_REMOTE 63#define CONFIG_REMOTE_KEYPAD H100_REMOTE
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h
index 037bb26b2d..ba09884957 100644
--- a/firmware/export/config-h300.h
+++ b/firmware/export/config-h300.h
@@ -45,6 +45,12 @@
45 45
46#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING 46#define LCD_REMOTE_PIXELFORMAT VERTICAL_PACKING
47 47
48/* Remote display colours, for screenshots and sim (0xRRGGBB) */
49#define LCD_REMOTE_DARKCOLOR 0x000000
50#define LCD_REMOTE_BRIGHTCOLOR 0x5a915a
51#define LCD_REMOTE_BL_DARKCOLOR 0x000000
52#define LCD_REMOTE_BL_BRIGHTCOLOR 0x82b4fa
53
48#define CONFIG_KEYPAD IRIVER_H300_PAD 54#define CONFIG_KEYPAD IRIVER_H300_PAD
49 55
50#define CONFIG_REMOTE_KEYPAD H300_REMOTE 56#define CONFIG_REMOTE_KEYPAD H300_REMOTE
diff --git a/firmware/export/config-iaudiom3.h b/firmware/export/config-iaudiom3.h
index a6e1028897..e72813c853 100644
--- a/firmware/export/config-iaudiom3.h
+++ b/firmware/export/config-iaudiom3.h
@@ -52,6 +52,12 @@
52 52
53#define LCD_PIXELFORMAT VERTICAL_INTERLEAVED 53#define LCD_PIXELFORMAT VERTICAL_INTERLEAVED
54 54
55/* Display colours, for screenshots and sim (0xRRGGBB) */
56#define LCD_DARKCOLOR 0x000000
57#define LCD_BRIGHTCOLOR 0x7e917e
58#define LCD_BL_DARKCOLOR 0x000000
59#define LCD_BL_BRIGHTCOLOR 0x82b4fa
60
55/* define this if only the remote has an LCD */ 61/* define this if only the remote has an LCD */
56#define HAVE_REMOTE_LCD_AS_MAIN 62#define HAVE_REMOTE_LCD_AS_MAIN
57 63
diff --git a/firmware/export/config-iaudiom5.h b/firmware/export/config-iaudiom5.h
index 26cc9c5da6..d186895b45 100644
--- a/firmware/export/config-iaudiom5.h
+++ b/firmware/export/config-iaudiom5.h
@@ -52,6 +52,12 @@
52 52
53#define LCD_PIXELFORMAT VERTICAL_PACKING 53#define LCD_PIXELFORMAT VERTICAL_PACKING
54 54
55/* Display colours, for screenshots and sim (0xRRGGBB) */
56#define LCD_DARKCOLOR 0x000000
57#define LCD_BRIGHTCOLOR 0x648764
58#define LCD_BL_DARKCOLOR 0x000000
59#define LCD_BL_BRIGHTCOLOR 0xdfd8ff
60
55/* remote LCD */ 61/* remote LCD */
56#define LCD_REMOTE_WIDTH 128 62#define LCD_REMOTE_WIDTH 128
57#define LCD_REMOTE_HEIGHT 96 63#define LCD_REMOTE_HEIGHT 96
@@ -59,6 +65,12 @@
59 65
60#define LCD_REMOTE_PIXELFORMAT VERTICAL_INTERLEAVED 66#define LCD_REMOTE_PIXELFORMAT VERTICAL_INTERLEAVED
61 67
68/* Remote display colours, for screenshots and sim (0xRRGGBB) */
69#define LCD_REMOTE_DARKCOLOR 0x000000
70#define LCD_REMOTE_BRIGHTCOLOR 0x5a915a
71#define LCD_REMOTE_BL_DARKCOLOR 0x000000
72#define LCD_REMOTE_BL_BRIGHTCOLOR 0x82b4fa
73
62#define CONFIG_KEYPAD IAUDIO_X5M5_PAD 74#define CONFIG_KEYPAD IAUDIO_X5M5_PAD
63 75
64#define AB_REPEAT_ENABLE 1 76#define AB_REPEAT_ENABLE 1
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h
index 27bd2c523b..218e1657dd 100644
--- a/firmware/export/config-iaudiox5.h
+++ b/firmware/export/config-iaudiox5.h
@@ -61,6 +61,12 @@
61 61
62#define LCD_REMOTE_PIXELFORMAT VERTICAL_INTERLEAVED 62#define LCD_REMOTE_PIXELFORMAT VERTICAL_INTERLEAVED
63 63
64/* Remote display colours, for screenshots and sim (0xRRGGBB) */
65#define LCD_REMOTE_DARKCOLOR 0x000000
66#define LCD_REMOTE_BRIGHTCOLOR 0x5a915a
67#define LCD_REMOTE_BL_DARKCOLOR 0x000000
68#define LCD_REMOTE_BL_BRIGHTCOLOR 0x82b4fa
69
64#ifndef BOOTLOADER 70#ifndef BOOTLOADER
65/* Define this if your LCD can be enabled/disabled */ 71/* Define this if your LCD can be enabled/disabled */
66#define HAVE_LCD_ENABLE 72#define HAVE_LCD_ENABLE
diff --git a/firmware/export/config-ifp7xx.h b/firmware/export/config-ifp7xx.h
index 6a26a93da2..96faf46e91 100644
--- a/firmware/export/config-ifp7xx.h
+++ b/firmware/export/config-ifp7xx.h
@@ -29,6 +29,12 @@
29 29
30#define LCD_PIXELFORMAT VERTICAL_PACKING 30#define LCD_PIXELFORMAT VERTICAL_PACKING
31 31
32/* Display colours, for screenshots and sim (0xRRGGBB) */
33#define LCD_DARKCOLOR 0x000000
34#define LCD_BRIGHTCOLOR 0x5e6854
35#define LCD_BL_DARKCOLOR 0x000000
36#define LCD_BL_BRIGHTCOLOR 0x3ca0e6
37
32#define CONFIG_KEYPAD IRIVER_IFP7XX_PAD 38#define CONFIG_KEYPAD IRIVER_IFP7XX_PAD
33 39
34#define CONFIG_STORAGE STORAGE_NAND 40#define CONFIG_STORAGE STORAGE_NAND
diff --git a/firmware/export/config-ipod1g2g.h b/firmware/export/config-ipod1g2g.h
index 4308d9c66c..a06cb65828 100644
--- a/firmware/export/config-ipod1g2g.h
+++ b/firmware/export/config-ipod1g2g.h
@@ -51,6 +51,12 @@
51 51
52#define LCD_PIXELFORMAT HORIZONTAL_PACKING 52#define LCD_PIXELFORMAT HORIZONTAL_PACKING
53 53
54/* Display colours, for screenshots and sim (0xRRGGBB) */
55#define LCD_DARKCOLOR 0x000000
56#define LCD_BRIGHTCOLOR 0x648764
57#define LCD_BL_DARKCOLOR 0x000000
58#define LCD_BL_BRIGHTCOLOR 0xdfd8ff
59
54/* define this if you can flip your LCD */ 60/* define this if you can flip your LCD */
55#define HAVE_LCD_FLIP 61#define HAVE_LCD_FLIP
56 62
diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h
index f1550576d2..fad3d3d0fb 100644
--- a/firmware/export/config-ipod3g.h
+++ b/firmware/export/config-ipod3g.h
@@ -52,6 +52,12 @@
52 52
53#define LCD_PIXELFORMAT HORIZONTAL_PACKING 53#define LCD_PIXELFORMAT HORIZONTAL_PACKING
54 54
55/* Display colours, for screenshots and sim (0xRRGGBB) */
56#define LCD_DARKCOLOR 0x000000
57#define LCD_BRIGHTCOLOR 0x5a915a
58#define LCD_BL_DARKCOLOR 0x000000
59#define LCD_BL_BRIGHTCOLOR 0xadd8e6
60
55/* define this if you can flip your LCD */ 61/* define this if you can flip your LCD */
56#define HAVE_LCD_FLIP 62#define HAVE_LCD_FLIP
57 63
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h
index e2aaa96ded..5bc0a18a98 100644
--- a/firmware/export/config-ipod4g.h
+++ b/firmware/export/config-ipod4g.h
@@ -52,6 +52,12 @@
52#define LCD_DEPTH 2 /* 4 colours - 2bpp */ 52#define LCD_DEPTH 2 /* 4 colours - 2bpp */
53#define LCD_PIXELFORMAT HORIZONTAL_PACKING 53#define LCD_PIXELFORMAT HORIZONTAL_PACKING
54 54
55/* Display colours, for screenshots and sim (0xRRGGBB) */
56#define LCD_DARKCOLOR 0x000000
57#define LCD_BRIGHTCOLOR 0x5a915a
58#define LCD_BL_DARKCOLOR 0x000000
59#define LCD_BL_BRIGHTCOLOR 0xadd8e6
60
55#define HAVE_LCD_CONTRAST 61#define HAVE_LCD_CONTRAST
56 62
57/* LCD contrast */ 63/* LCD contrast */
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h
index bc59ededfe..0e87d02ee8 100644
--- a/firmware/export/config-ipodmini.h
+++ b/firmware/export/config-ipodmini.h
@@ -51,6 +51,12 @@
51 51
52#define LCD_PIXELFORMAT HORIZONTAL_PACKING 52#define LCD_PIXELFORMAT HORIZONTAL_PACKING
53 53
54/* Display colours, for screenshots and sim (0xRRGGBB) */
55#define LCD_DARKCOLOR 0x000000
56#define LCD_BRIGHTCOLOR 0x648764
57#define LCD_BL_DARKCOLOR 0x000000
58#define LCD_BL_BRIGHTCOLOR 0xdfd8ff
59
54#define HAVE_LCD_CONTRAST 60#define HAVE_LCD_CONTRAST
55 61
56/* LCD contrast */ 62/* LCD contrast */
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h
index 4775350712..a44087f897 100644
--- a/firmware/export/config-ipodmini2g.h
+++ b/firmware/export/config-ipodmini2g.h
@@ -51,6 +51,12 @@
51 51
52#define LCD_PIXELFORMAT HORIZONTAL_PACKING 52#define LCD_PIXELFORMAT HORIZONTAL_PACKING
53 53
54/* Display colours, for screenshots and sim (0xRRGGBB) */
55#define LCD_DARKCOLOR 0x000000
56#define LCD_BRIGHTCOLOR 0x648764
57#define LCD_BL_DARKCOLOR 0x000000
58#define LCD_BL_BRIGHTCOLOR 0xdfd8ff
59
54#define HAVE_LCD_CONTRAST 60#define HAVE_LCD_CONTRAST
55 61
56/* LCD contrast */ 62/* LCD contrast */
diff --git a/firmware/export/config-logikdax.h b/firmware/export/config-logikdax.h
index 78a39d32b7..800688b01d 100644
--- a/firmware/export/config-logikdax.h
+++ b/firmware/export/config-logikdax.h
@@ -55,6 +55,12 @@
55 55
56#define LCD_PIXELFORMAT VERTICAL_PACKING 56#define LCD_PIXELFORMAT VERTICAL_PACKING
57 57
58/* Display colours, for screenshots and sim (0xRRGGBB) */
59#define LCD_DARKCOLOR 0x000000
60#define LCD_BRIGHTCOLOR 0x5a915a
61#define LCD_BL_DARKCOLOR 0x000000
62#define LCD_BL_BRIGHTCOLOR 0x82b4fa
63
58/* define this to indicate your device's keypad */ 64/* define this to indicate your device's keypad */
59#define CONFIG_KEYPAD LOGIK_DAX_PAD 65#define CONFIG_KEYPAD LOGIK_DAX_PAD
60 66
diff --git a/firmware/export/config-m200.h b/firmware/export/config-m200.h
index cab1c9927b..38d59cbcbe 100644
--- a/firmware/export/config-m200.h
+++ b/firmware/export/config-m200.h
@@ -49,6 +49,12 @@
49 49
50#define LCD_PIXELFORMAT VERTICAL_PACKING 50#define LCD_PIXELFORMAT VERTICAL_PACKING
51 51
52/* Display colours, for screenshots and sim (0xRRGGBB) */
53#define LCD_BARKCOLOR 0x000000
54#define LCD_BRIGHTCOLOR 0x5e6854
55#define LCD_BL_DARKCOLOR 0x000000
56#define LCD_BL_BRIGHTCOLOR 0x3ca0e6
57
52/* define this to indicate your device's keypad */ 58/* define this to indicate your device's keypad */
53#define CONFIG_KEYPAD SANSA_M200_PAD 59#define CONFIG_KEYPAD SANSA_M200_PAD
54 60
diff --git a/firmware/export/config-m200v4.h b/firmware/export/config-m200v4.h
index 3c601a77cb..c34f33c306 100644
--- a/firmware/export/config-m200v4.h
+++ b/firmware/export/config-m200v4.h
@@ -58,6 +58,12 @@
58 58
59#define LCD_PIXELFORMAT VERTICAL_PACKING 59#define LCD_PIXELFORMAT VERTICAL_PACKING
60 60
61/* Display colours, for screenshots and sim (0xRRGGBB) */
62#define LCD_BARKCOLOR 0x000000
63#define LCD_BRIGHTCOLOR 0x5e6854
64#define LCD_BL_DARKCOLOR 0x000000
65#define LCD_BL_BRIGHTCOLOR 0x3ca0e6
66
61/* define this to indicate your device's keypad */ 67/* define this to indicate your device's keypad */
62#define CONFIG_KEYPAD SANSA_M200_PAD 68#define CONFIG_KEYPAD SANSA_M200_PAD
63 69
diff --git a/firmware/export/config-mrobe100.h b/firmware/export/config-mrobe100.h
index f2fc5cb37a..817c7640b2 100644
--- a/firmware/export/config-mrobe100.h
+++ b/firmware/export/config-mrobe100.h
@@ -27,7 +27,15 @@
27#define LCD_WIDTH 160 27#define LCD_WIDTH 160
28#define LCD_HEIGHT 128 28#define LCD_HEIGHT 128
29#define LCD_DEPTH 1 29#define LCD_DEPTH 1
30#define LCD_PIXELFORMAT VERTICAL_PACKING 30
31#define LCD_PIXELFORMAT VERTICAL_PACKING
32#define HAVE_NEGATIVE_LCD /* bright on dark */
33
34/* Display colours, for screenshots and sim (0xRRGGBB) */
35#define LCD_DARKCOLOR 0x000000
36#define LCD_BRIGHTCOLOR 0x323232
37#define LCD_BL_DARKCOLOR 0x5e0202
38#define LCD_BL_BRIGHTCOLOR 0xf10603
31 39
32/* define this if you can flip your LCD */ 40/* define this if you can flip your LCD */
33#define HAVE_LCD_FLIP 41#define HAVE_LCD_FLIP
diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h
index 1b3b266191..32e67cac09 100644
--- a/firmware/export/config-ondiofm.h
+++ b/firmware/export/config-ondiofm.h
@@ -29,6 +29,12 @@
29 29
30#define LCD_PIXELFORMAT VERTICAL_PACKING 30#define LCD_PIXELFORMAT VERTICAL_PACKING
31 31
32/* Display colours, for screenshots and sim (0xRRGGBB) */
33#define LCD_DARKCOLOR 0x000000
34#define LCD_BRIGHTCOLOR 0x5a915a
35#define LCD_BL_DARKCOLOR 0x000000
36#define LCD_BL_BRIGHTCOLOR 0x82b4fa
37
32/* define this if you have an Ondio style 6-key keyboard */ 38/* define this if you have an Ondio style 6-key keyboard */
33#define CONFIG_KEYPAD ONDIO_PAD 39#define CONFIG_KEYPAD ONDIO_PAD
34 40
diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h
index 85065f40bb..baa54011ae 100644
--- a/firmware/export/config-ondiosp.h
+++ b/firmware/export/config-ondiosp.h
@@ -22,6 +22,12 @@
22 22
23#define LCD_PIXELFORMAT VERTICAL_PACKING 23#define LCD_PIXELFORMAT VERTICAL_PACKING
24 24
25/* Display colours, for screenshots and sim (0xRRGGBB) */
26#define LCD_DARKCOLOR 0x000000
27#define LCD_BRIGHTCOLOR 0x5a915a
28#define LCD_BL_DARKCOLOR 0x000000
29#define LCD_BL_BRIGHTCOLOR 0x82b4fa
30
25/* define this if you have an Ondio style 6-key keyboard */ 31/* define this if you have an Ondio style 6-key keyboard */
26#define CONFIG_KEYPAD ONDIO_PAD 32#define CONFIG_KEYPAD ONDIO_PAD
27 33
diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h
index 91d97abd97..3071a09be8 100644
--- a/firmware/export/config-player.h
+++ b/firmware/export/config-player.h
@@ -15,6 +15,12 @@
15#define SIM_LCD_WIDTH 132 /* pixels */ 15#define SIM_LCD_WIDTH 132 /* pixels */
16#define SIM_LCD_HEIGHT 64 /* pixels */ 16#define SIM_LCD_HEIGHT 64 /* pixels */
17 17
18/* Display colours, for screenshots and sim (0xRRGGBB) */
19#define LCD_DARKCOLOR 0x000000
20#define LCD_BRIGHTCOLOR 0x5a915a
21#define LCD_BL_DARKCOLOR 0x000000
22#define LCD_BL_BRIGHTCOLOR 0x7ee57e
23
18/* define this if you have the Player's keyboard */ 24/* define this if you have the Player's keyboard */
19#define CONFIG_KEYPAD PLAYER_PAD 25#define CONFIG_KEYPAD PLAYER_PAD
20 26
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h
index f0a513851f..44006b4196 100644
--- a/firmware/export/config-recorder.h
+++ b/firmware/export/config-recorder.h
@@ -39,6 +39,12 @@
39 39
40#define LCD_PIXELFORMAT VERTICAL_PACKING 40#define LCD_PIXELFORMAT VERTICAL_PACKING
41 41
42/* Display colours, for screenshots and sim (0xRRGGBB) */
43#define LCD_DARKCOLOR 0x000000
44#define LCD_BRIGHTCOLOR 0x5a915a
45#define LCD_BL_DARKCOLOR 0x000000
46#define LCD_BL_BRIGHTCOLOR 0x7ee57e
47
42/* define this if you have the Recorder's 10-key keyboard */ 48/* define this if you have the Recorder's 10-key keyboard */
43#define CONFIG_KEYPAD RECORDER_PAD 49#define CONFIG_KEYPAD RECORDER_PAD
44 50
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h
index 4e77e3d4ed..5e404a9873 100644
--- a/firmware/export/config-recorderv2.h
+++ b/firmware/export/config-recorderv2.h
@@ -39,6 +39,12 @@
39 39
40#define LCD_PIXELFORMAT VERTICAL_PACKING 40#define LCD_PIXELFORMAT VERTICAL_PACKING
41 41
42/* Display colours, for screenshots and sim (0xRRGGBB) */
43#define LCD_DARKCOLOR 0x000000
44#define LCD_BRIGHTCOLOR 0x5a915a
45#define LCD_BL_DARKCOLOR 0x000000
46#define LCD_BL_BRIGHTCOLOR 0x7ee57e
47
42/* define this if you have a Recorder style 10-key keyboard */ 48/* define this if you have a Recorder style 10-key keyboard */
43#define CONFIG_KEYPAD RECORDER_PAD 49#define CONFIG_KEYPAD RECORDER_PAD
44 50
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 58ae66d1cd..2c299491f9 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -412,6 +412,28 @@
412#define LCD_PIXEL_ASPECT_WIDTH 1 412#define LCD_PIXEL_ASPECT_WIDTH 1
413#endif 413#endif
414 414
415/* Used for split displays (Sansa Clip). Set to 0 otherwise */
416#ifndef LCD_SPLIT_LINES
417#define LCD_SPLIT_LINES 0
418#endif
419
420/* Simulator LCD dimensions. Set to standard dimensions if undefined */
421#ifndef SIM_LCD_WIDTH
422#define SIM_LCD_WIDTH LCD_WIDTH
423#endif
424#ifndef SIM_LCD_HEIGHT
425#define SIM_LCD_HEIGHT (LCD_HEIGHT + LCD_SPLIT_LINES)
426#endif
427
428#ifdef HAVE_REMOTE_LCD
429#ifndef SIM_REMOTE_WIDTH
430#define SIM_REMOTE_WIDTH LCD_REMOTE_WIDTH
431#endif
432#ifndef SIM_REMOTE_HEIGHT
433#define SIM_REMOTE_HEIGHT LCD_REMOTE_HEIGHT
434#endif
435#endif /* HAVE_REMOTE_LCD */
436
415/* define this in the target config.h to use a different size */ 437/* define this in the target config.h to use a different size */
416#ifndef CONFIG_DEFAULT_ICON_HEIGHT 438#ifndef CONFIG_DEFAULT_ICON_HEIGHT
417#define CONFIG_DEFAULT_ICON_HEIGHT 8 439#define CONFIG_DEFAULT_ICON_HEIGHT 8
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c
index 0405ef0d1e..765bc0608e 100644
--- a/uisimulator/sdl/button.c
+++ b/uisimulator/sdl/button.c
@@ -1295,7 +1295,7 @@ void mouse_tick_task(void)
1295 x -= UI_LCD_POSX; 1295 x -= UI_LCD_POSX;
1296 y -= UI_LCD_POSY; 1296 y -= UI_LCD_POSY;
1297 1297
1298 if(x<0 || y<0 || x>UI_LCD_WIDTH || y>UI_LCD_HEIGHT) 1298 if(x<0 || y<0 || x>SIM_LCD_WIDTH || y>SIM_LCD_HEIGHT)
1299 return; 1299 return;
1300 } 1300 }
1301 1301
diff --git a/uisimulator/sdl/lcd-bitmap.c b/uisimulator/sdl/lcd-bitmap.c
index bc2a4c46f4..6faa5eb0b2 100644
--- a/uisimulator/sdl/lcd-bitmap.c
+++ b/uisimulator/sdl/lcd-bitmap.c
@@ -22,45 +22,74 @@
22#include "debug.h" 22#include "debug.h"
23#include "uisdl.h" 23#include "uisdl.h"
24#include "lcd-sdl.h" 24#include "lcd-sdl.h"
25#include "misc.h"
25 26
26SDL_Surface* lcd_surface; 27SDL_Surface* lcd_surface;
27#ifdef UI_LCD_SPLIT
28SDL_Surface* lcd_real_surface; /* the surface which represents the real screen */
29#endif
30int lcd_backlight_val;
31 28
32#if LCD_DEPTH <= 8 29#if LCD_DEPTH <= 8
33#ifdef HAVE_BACKLIGHT 30#ifdef HAVE_BACKLIGHT
34SDL_Color lcd_backlight_color_zero = {UI_LCD_BGCOLORLIGHT, 0}; 31SDL_Color lcd_bl_color_dark = {RED_CMP(LCD_BL_DARKCOLOR),
35SDL_Color lcd_backlight_color_max = {UI_LCD_FGCOLORLIGHT, 0}; 32 GREEN_CMP(LCD_BL_DARKCOLOR),
36#ifdef UI_LCD_SPLIT 33 BLUE_CMP(LCD_BL_DARKCOLOR), 0};
37SDL_Color lcd_backlight_color_split= {UI_LCD_SPLIT_FGCOLORLIGHT, 0}; 34SDL_Color lcd_bl_color_bright = {RED_CMP(LCD_BL_BRIGHTCOLOR),
38#endif 35 GREEN_CMP(LCD_BL_BRIGHTCOLOR),
39#endif 36 BLUE_CMP(LCD_BL_BRIGHTCOLOR), 0};
40SDL_Color lcd_color_zero = {UI_LCD_BGCOLOR, 0}; 37#ifdef HAVE_LCD_SPLIT
41SDL_Color lcd_color_max = {UI_LCD_FGCOLOR, 0}; 38SDL_Color lcd_bl_color2_dark = {RED_CMP(LCD_BL_DARKCOLOR_2),
42#ifdef UI_LCD_SPLIT 39 GREEN_CMP(LCD_BL_DARKCOLOR_2),
43SDL_Color lcd_color_split= {UI_LCD_SPLIT_FGCOLOR, 0}; 40 BLUE_CMP(LCD_BL_DARKCOLOR_2), 0};
44#endif 41SDL_Color lcd_bl_color2_bright = {RED_CMP(LCD_BL_BRIGHTCOLOR_2),
42 GREEN_CMP(LCD_BL_BRIGHTCOLOR_2),
43 BLUE_CMP(LCD_BL_BRIGHTCOLOR_2), 0};
44#endif
45#endif /* HAVE_BACKLIGHT */
46SDL_Color lcd_color_dark = {RED_CMP(LCD_DARKCOLOR),
47 GREEN_CMP(LCD_DARKCOLOR),
48 BLUE_CMP(LCD_DARKCOLOR), 0};
49SDL_Color lcd_color_bright = {RED_CMP(LCD_BRIGHTCOLOR),
50 GREEN_CMP(LCD_BRIGHTCOLOR),
51 BLUE_CMP(LCD_BRIGHTCOLOR), 0};
52#ifdef HAVE_LCD_SPLIT
53SDL_Color lcd_color2_dark = {RED_CMP(LCD_DARKCOLOR_2),
54 GREEN_CMP(LCD_DARKCOLOR_2),
55 BLUE_CMP(LCD_DARKCOLOR_2), 0};
56SDL_Color lcd_color2_bright = {RED_CMP(LCD_BRIGHTCOLOR_2),
57 GREEN_CMP(LCD_BRIGHTCOLOR_2),
58 BLUE_CMP(LCD_BRIGHTCOLOR_2), 0};
59#endif
60
61#ifdef HAVE_LCD_SPLIT
62#define GRADIENT_MAX 127
63#else
64#define GRADIENT_MAX 128
45#endif 65#endif
66#endif /* LCD_DEPTH <= 8 */
46 67
47#if LCD_DEPTH < 8 68#if LCD_DEPTH < 8
48int lcd_ex_shades = 0;
49unsigned long (*lcd_ex_getpixel)(int, int) = NULL; 69unsigned long (*lcd_ex_getpixel)(int, int) = NULL;
70#endif /* LCD_DEPTH < 8 */
71
72#if LCD_DEPTH == 2
73/* Only defined for positive, non-split LCD for now */
74static const unsigned char colorindex[4] = {128, 85, 43, 0};
50#endif 75#endif
51 76
52static unsigned long get_lcd_pixel(int x, int y) 77static unsigned long get_lcd_pixel(int x, int y)
53{ 78{
54#if LCD_DEPTH == 1 79#if LCD_DEPTH == 1
55 return ((lcd_framebuffer[y/8][x] >> (y & 7)) & 1); 80#ifdef HAVE_NEGATIVE_LCD
81 return (lcd_framebuffer[y/8][x] & (1 << (y & 7))) ? GRADIENT_MAX : 0;
82#else
83 return (lcd_framebuffer[y/8][x] & (1 << (y & 7))) ? 0 : GRADIENT_MAX;
84#endif
56#elif LCD_DEPTH == 2 85#elif LCD_DEPTH == 2
57#if LCD_PIXELFORMAT == HORIZONTAL_PACKING 86#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
58 return ((lcd_framebuffer[y][x/4] >> (2 * (~x & 3))) & 3); 87 return colorindex[(lcd_framebuffer[y][x/4] >> (2 * (~x & 3))) & 3];
59#elif LCD_PIXELFORMAT == VERTICAL_PACKING 88#elif LCD_PIXELFORMAT == VERTICAL_PACKING
60 return ((lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3); 89 return colorindex[(lcd_framebuffer[y/4][x] >> (2 * (y & 3))) & 3];
61#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED 90#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
62 unsigned bits = (lcd_framebuffer[y/8][x] >> (y & 7)) & 0x0101; 91 unsigned bits = (lcd_framebuffer[y/8][x] >> (y & 7)) & 0x0101;
63 return (bits | (bits >> 7)) & 3; 92 return colorindex[(bits | (bits >> 7)) & 3];
64#endif 93#endif
65#elif LCD_DEPTH == 16 94#elif LCD_DEPTH == 16
66#if LCD_PIXELFORMAT == RGB565SWAPPED 95#if LCD_PIXELFORMAT == RGB565SWAPPED
@@ -80,148 +109,77 @@ void lcd_update(void)
80 109
81void lcd_update_rect(int x_start, int y_start, int width, int height) 110void lcd_update_rect(int x_start, int y_start, int width, int height)
82{ 111{
83 sdl_update_rect(lcd_surface, x_start, y_start, width, height, LCD_WIDTH, 112 sdl_update_rect(lcd_surface, x_start, y_start, width, height,
84 LCD_HEIGHT, get_lcd_pixel); 113 LCD_WIDTH, LCD_HEIGHT, get_lcd_pixel);
85 sdl_gui_update(lcd_surface, IFSPLIT(lcd_real_surface,) x_start, y_start, 114 sdl_gui_update(lcd_surface, x_start, y_start, width,
86 width, height, LCD_WIDTH, LCD_HEIGHT, 115 height + LCD_SPLIT_LINES, SIM_LCD_WIDTH, SIM_LCD_HEIGHT,
87 background ? UI_LCD_POSX : 0, background? UI_LCD_POSY : 0); 116 background ? UI_LCD_POSX : 0, background? UI_LCD_POSY : 0);
88} 117}
89 118
90#ifdef HAVE_BACKLIGHT 119#ifdef HAVE_BACKLIGHT
91void sim_backlight(int value) 120void sim_backlight(int value)
92{ 121{
93 lcd_backlight_val = value;
94
95#if LCD_DEPTH <= 8 122#if LCD_DEPTH <= 8
96 if (value > 0) { 123 if (value > 0) {
97#ifdef UI_LCD_SPLIT 124 sdl_set_gradient(lcd_surface, &lcd_bl_color_dark,
98 sdl_set_gradient(lcd_real_surface, &lcd_backlight_color_zero, 125 &lcd_bl_color_bright, 0, GRADIENT_MAX+1);
99 &lcd_backlight_color_max, &lcd_backlight_color_zero, 126#ifdef HAVE_LCD_SPLIT
100 &lcd_backlight_color_split, 0, (1<<LCD_DEPTH)); 127 sdl_set_gradient(lcd_surface, &lcd_bl_color2_dark,
101#else 128 &lcd_bl_color2_bright, GRADIENT_MAX+1, GRADIENT_MAX+1);
102 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero,
103 &lcd_backlight_color_max, 0, (1<<LCD_DEPTH));
104#endif 129#endif
105 } else { 130 } else {
106#ifdef UI_LCD_SPLIT 131 sdl_set_gradient(lcd_surface, &lcd_color_dark,
107 sdl_set_gradient(lcd_real_surface, &lcd_color_zero, &lcd_color_max, 132 &lcd_color_bright, 0, GRADIENT_MAX+1);
108 &lcd_color_zero, &lcd_color_split, 0, (1<<LCD_DEPTH)); 133#ifdef HAVE_LCD_SPLIT
109#else 134 sdl_set_gradient(lcd_surface, &lcd_color2_dark,
110 sdl_set_gradient(lcd_surface, &lcd_color_zero, &lcd_color_max, 0, 135 &lcd_color2_bright, GRADIENT_MAX+1, GRADIENT_MAX+1);
111 (1<<LCD_DEPTH));
112#endif
113 }
114#if LCD_DEPTH < 8
115 if (lcd_ex_shades) {
116 if (value > 0) {
117#ifdef UI_LCD_SPLIT
118 sdl_set_gradient(lcd_real_surface, &lcd_backlight_color_max,
119 &lcd_backlight_color_zero, &lcd_backlight_color_split,
120 &lcd_backlight_color_zero,
121 (1<<LCD_DEPTH), lcd_ex_shades);
122#elif defined MROBE_100
123 /* quick fix, a proper fix needs to compare brightnesses */
124 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero,
125 &lcd_backlight_color_max, (1<<LCD_DEPTH), lcd_ex_shades);
126#else
127 sdl_set_gradient(lcd_surface, &lcd_backlight_color_max,
128 &lcd_backlight_color_zero, (1<<LCD_DEPTH), lcd_ex_shades);
129#endif 136#endif
130 } else {
131#ifdef UI_LCD_SPLIT
132 sdl_set_gradient(lcd_real_surface, &lcd_color_max, &lcd_color_zero,
133 &lcd_color_split, &lcd_color_zero, (1<<LCD_DEPTH),
134 lcd_ex_shades);
135#elif defined MROBE_100
136 /* quick fix, a proper fix needs to compare brightnesses */
137 sdl_set_gradient(lcd_surface, &lcd_color_zero, &lcd_color_max,
138 (1<<LCD_DEPTH), lcd_ex_shades);
139#else
140 sdl_set_gradient(lcd_surface, &lcd_color_max, &lcd_color_zero,
141 (1<<LCD_DEPTH), lcd_ex_shades);
142#endif
143 }
144 } 137 }
145#endif 138 sdl_gui_update(lcd_surface, 0, 0, SIM_LCD_WIDTH, SIM_LCD_HEIGHT,
146 139 SIM_LCD_WIDTH, SIM_LCD_HEIGHT,
147 sdl_gui_update(lcd_surface, IFSPLIT(lcd_real_surface,) 0, 0, LCD_WIDTH,
148 LCD_HEIGHT, LCD_WIDTH, LCD_HEIGHT,
149 background ? UI_LCD_POSX : 0, background? UI_LCD_POSY : 0); 140 background ? UI_LCD_POSX : 0, background? UI_LCD_POSY : 0);
150 141#endif /* LCD_DEPTH <= 8 */
151#endif
152} 142}
153#endif 143#endif /* HAVE_BACKLIGHT */
154 144
155/* initialise simulator lcd driver */ 145/* initialise simulator lcd driver */
156void sim_lcd_init(void) 146void sim_lcd_init(void)
157{ 147{
158#if LCD_DEPTH == 16 148#if LCD_DEPTH == 16
159 lcd_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, LCD_WIDTH * display_zoom, 149 lcd_surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
160 LCD_HEIGHT * display_zoom, LCD_DEPTH, 0, 0, 0, 0); 150 SIM_LCD_WIDTH * display_zoom,
151 SIM_LCD_HEIGHT * display_zoom,
152 LCD_DEPTH, 0, 0, 0, 0);
161#else 153#else
162 lcd_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, LCD_WIDTH * display_zoom, 154 lcd_surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
163 LCD_HEIGHT * display_zoom, 8, 0, 0, 0, 0); 155 SIM_LCD_WIDTH * display_zoom,
164#ifdef UI_LCD_SPLIT 156 SIM_LCD_HEIGHT * display_zoom,
165 lcd_real_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, 157 8, 0, 0, 0, 0);
166 LCD_WIDTH * display_zoom,
167 (LCD_HEIGHT+UI_LCD_SPLIT_BLACK_LINES) * display_zoom, 8, 0, 0, 0, 0);
168#endif
169#endif 158#endif
170 159
171#if LCD_DEPTH <= 8 160#if LCD_DEPTH <= 8
172#ifdef HAVE_BACKLIGHT 161#ifdef HAVE_BACKLIGHT
173#ifdef UI_LCD_SPLIT 162 sdl_set_gradient(lcd_surface, &lcd_bl_color_dark,
174 sdl_set_gradient(lcd_real_surface, &lcd_backlight_color_zero, 163 &lcd_bl_color_bright, 0, GRADIENT_MAX+1);
175 &lcd_backlight_color_max, &lcd_backlight_color_zero, 164#ifdef HAVE_LCD_SPLIT
176 &lcd_backlight_color_split, 0, (1<<LCD_DEPTH)); 165 sdl_set_gradient(lcd_surface, &lcd_bl_color2_dark,
177#else 166 &lcd_bl_color2_bright, GRADIENT_MAX+1, GRADIENT_MAX+1);
178 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, 167#endif
179 &lcd_backlight_color_max, 0, (1<<LCD_DEPTH)); 168#else /* !HAVE_BACKLIGHT */
180#endif 169 sdl_set_gradient(lcd_surface, &lcd_color_dark,
181#else 170 &lcd_color_bright, 0, GRADIENT_MAX+1);
182 sdl_set_gradient(lcd_surface, &lcd_color_zero, &lcd_color_max, 0, 171#ifdef HAVE_LCD_SPLIT
183 (1<<LCD_DEPTH)); 172 sdl_set_gradient(lcd_surface, &lcd_color2_dark,
184#endif 173 &lcd_color2_bright, GRADIENT_MAX+1, GRADIENT_MAX+1);
185#endif 174#endif
175#endif /* !HAVE_BACKLIGHT */
176#endif /* LCD_DEPTH < 8 */
186} 177}
187 178
188#if LCD_DEPTH < 8 179#if LCD_DEPTH < 8
189void sim_lcd_ex_init(int shades, unsigned long (*getpixel)(int, int)) 180void sim_lcd_ex_init(unsigned long (*getpixel)(int, int))
190{ 181{
191 lcd_ex_shades = shades;
192 lcd_ex_getpixel = getpixel; 182 lcd_ex_getpixel = getpixel;
193 if (shades) {
194#ifdef HAVE_BACKLIGHT
195 if (lcd_backlight_val > 0) {
196#ifdef UI_LCD_SPLIT
197 sdl_set_gradient(lcd_real_surface, &lcd_backlight_color_max,
198 &lcd_backlight_color_zero, &lcd_backlight_color_split,
199 &lcd_backlight_color_zero, (1<<LCD_DEPTH), shades);
200#elif defined MROBE_100
201 /* quick fix, a proper fix needs to compare brightnesses */
202 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero,
203 &lcd_backlight_color_max, (1<<LCD_DEPTH), shades);
204#else
205 sdl_set_gradient(lcd_surface, &lcd_backlight_color_max,
206 &lcd_backlight_color_zero, (1<<LCD_DEPTH), shades);
207#endif
208 }
209 else
210#endif
211 {
212#ifdef UI_LCD_SPLIT
213 sdl_set_gradient(lcd_real_surface, &lcd_color_max, &lcd_color_zero,
214 &lcd_color_split, &lcd_color_zero, (1<<LCD_DEPTH), shades);
215#elif defined MROBE_100
216 /* quick fix, a proper fix needs to compare brightnesses */
217 sdl_set_gradient(lcd_surface, &lcd_color_zero, &lcd_color_max,
218 (1<<LCD_DEPTH), shades);
219#else
220 sdl_set_gradient(lcd_surface, &lcd_color_max, &lcd_color_zero,
221 (1<<LCD_DEPTH), shades);
222#endif
223 }
224 }
225} 183}
226 184
227void sim_lcd_ex_update_rect(int x_start, int y_start, int width, int height) 185void sim_lcd_ex_update_rect(int x_start, int y_start, int width, int height)
@@ -229,10 +187,10 @@ void sim_lcd_ex_update_rect(int x_start, int y_start, int width, int height)
229 if (lcd_ex_getpixel) { 187 if (lcd_ex_getpixel) {
230 sdl_update_rect(lcd_surface, x_start, y_start, width, height, 188 sdl_update_rect(lcd_surface, x_start, y_start, width, height,
231 LCD_WIDTH, LCD_HEIGHT, lcd_ex_getpixel); 189 LCD_WIDTH, LCD_HEIGHT, lcd_ex_getpixel);
232 sdl_gui_update(lcd_surface, IFSPLIT(lcd_real_surface,) x_start, y_start, 190 sdl_gui_update(lcd_surface, x_start, y_start, width,
233 width, height, LCD_WIDTH, LCD_HEIGHT, 191 height + LCD_SPLIT_LINES, SIM_LCD_WIDTH, SIM_LCD_HEIGHT,
234 background ? UI_LCD_POSX : 0, 192 background ? UI_LCD_POSX : 0,
235 background? UI_LCD_POSY : 0); 193 background ? UI_LCD_POSY : 0);
236 } 194 }
237} 195}
238#endif 196#endif
diff --git a/uisimulator/sdl/lcd-bitmap.h b/uisimulator/sdl/lcd-bitmap.h
index 74aafa8cd1..a898744b41 100644
--- a/uisimulator/sdl/lcd-bitmap.h
+++ b/uisimulator/sdl/lcd-bitmap.h
@@ -27,7 +27,7 @@
27 27
28void sim_lcd_init(void); 28void sim_lcd_init(void);
29#if LCD_DEPTH < 8 29#if LCD_DEPTH < 8
30void sim_lcd_ex_init(int shades, unsigned long (*getpixel)(int, int)); 30void sim_lcd_ex_init(unsigned long (*getpixel)(int, int));
31void sim_lcd_ex_update_rect(int x, int y, int width, int height); 31void sim_lcd_ex_update_rect(int x, int y, int width, int height);
32#endif 32#endif
33 33
diff --git a/uisimulator/sdl/lcd-charcells.c b/uisimulator/sdl/lcd-charcells.c
index 6f09858717..19d27d5152 100644
--- a/uisimulator/sdl/lcd-charcells.c
+++ b/uisimulator/sdl/lcd-charcells.c
@@ -35,10 +35,19 @@
35extern int sim_creat(const char *name); 35extern int sim_creat(const char *name);
36 36
37SDL_Surface* lcd_surface; 37SDL_Surface* lcd_surface;
38SDL_Color lcd_color_zero = {UI_LCD_BGCOLOR, 0}; 38
39SDL_Color lcd_backlight_color_zero = {UI_LCD_BGCOLORLIGHT, 0}; 39SDL_Color lcd_bl_color_dark = {RED_CMP(LCD_BL_DARKCOLOR),
40SDL_Color lcd_color_max = {UI_LCD_FGCOLOR, 0}; 40 GREEN_CMP(LCD_BL_DARKCOLOR),
41SDL_Color lcd_backlight_color_max = {UI_LCD_FGCOLORLIGHT, 0}; 41 BLUE_CMP(LCD_BL_DARKCOLOR), 0};
42SDL_Color lcd_bl_color_bright = {RED_CMP(LCD_BL_BRIGHTCOLOR),
43 GREEN_CMP(LCD_BL_BRIGHTCOLOR),
44 BLUE_CMP(LCD_BL_BRIGHTCOLOR), 0};
45SDL_Color lcd_color_dark = {RED_CMP(LCD_DARKCOLOR),
46 GREEN_CMP(LCD_DARKCOLOR),
47 BLUE_CMP(LCD_DARKCOLOR), 0};
48SDL_Color lcd_color_bright = {RED_CMP(LCD_BRIGHTCOLOR),
49 GREEN_CMP(LCD_BRIGHTCOLOR),
50 BLUE_CMP(LCD_BRIGHTCOLOR), 0};
42 51
43 52
44static unsigned long get_lcd_pixel(int x, int y) 53static unsigned long get_lcd_pixel(int x, int y)
@@ -78,12 +87,11 @@ void lcd_update(void)
78void sim_backlight(int value) 87void sim_backlight(int value)
79{ 88{
80 if (value > 0) { 89 if (value > 0) {
81 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, 90 sdl_set_gradient(lcd_surface, &lcd_bl_color_bright,
82 &lcd_backlight_color_max, 91 &lcd_bl_color_dark, 0, (1<<LCD_DEPTH));
83 0, (1<<LCD_DEPTH));
84 } else { 92 } else {
85 sdl_set_gradient(lcd_surface, &lcd_color_zero, &lcd_color_max, 93 sdl_set_gradient(lcd_surface, &lcd_color_bright,
86 0, (1<<LCD_DEPTH)); 94 &lcd_color_dark, 0, (1<<LCD_DEPTH));
87 } 95 }
88 96
89 sim_lcd_update_rect(0, 0, SIM_LCD_WIDTH, SIM_LCD_HEIGHT); 97 sim_lcd_update_rect(0, 0, SIM_LCD_WIDTH, SIM_LCD_HEIGHT);
@@ -98,8 +106,8 @@ void sim_lcd_init(void)
98 SIM_LCD_HEIGHT * display_zoom, 106 SIM_LCD_HEIGHT * display_zoom,
99 8, 0, 0, 0, 0); 107 8, 0, 0, 0, 0);
100 108
101 sdl_set_gradient(lcd_surface, &lcd_backlight_color_zero, &lcd_color_max, 109 sdl_set_gradient(lcd_surface, &lcd_bl_color_bright,
102 0, (1<<LCD_DEPTH)); 110 &lcd_bl_color_dark, 0, (1<<LCD_DEPTH));
103} 111}
104 112
105#define BMP_COMPRESSION 0 /* BI_RGB */ 113#define BMP_COMPRESSION 0 /* BI_RGB */
@@ -133,8 +141,8 @@ static const unsigned char bmpheader[] =
133 LE32_CONST(BMP_NUMCOLORS), /* Number of used colours */ 141 LE32_CONST(BMP_NUMCOLORS), /* Number of used colours */
134 LE32_CONST(BMP_NUMCOLORS), /* Number of important colours */ 142 LE32_CONST(BMP_NUMCOLORS), /* Number of important colours */
135 143
136 0x90, 0xee, 0x90, 0x00, /* Colour #0 */ 144 BMP_COLOR(LCD_BL_BRIGHTCOLOR),
137 0x00, 0x00, 0x00, 0x00 /* Colour #1 */ 145 BMP_COLOR(LCD_BL_DARKCOLOR)
138}; 146};
139 147
140void screen_dump(void) 148void screen_dump(void)
diff --git a/uisimulator/sdl/lcd-remote-bitmap.c b/uisimulator/sdl/lcd-remote-bitmap.c
index d165534e00..f5c2225ab2 100644
--- a/uisimulator/sdl/lcd-remote-bitmap.c
+++ b/uisimulator/sdl/lcd-remote-bitmap.c
@@ -22,20 +22,38 @@
22#include "uisdl.h" 22#include "uisdl.h"
23#include "lcd-sdl.h" 23#include "lcd-sdl.h"
24#include "lcd-remote-bitmap.h" 24#include "lcd-remote-bitmap.h"
25#include "misc.h"
25 26
26SDL_Surface *remote_surface; 27SDL_Surface *remote_surface;
27 28
28SDL_Color remote_color_zero = {UI_REMOTE_BGCOLOR, 0}; 29SDL_Color remote_bl_color_dark = {RED_CMP(LCD_REMOTE_BL_DARKCOLOR),
29SDL_Color remote_backlight_color_zero = {UI_REMOTE_BGCOLORLIGHT, 0}; 30 GREEN_CMP(LCD_REMOTE_BL_DARKCOLOR),
30SDL_Color remote_color_max = {0, 0, 0, 0}; 31 BLUE_CMP(LCD_REMOTE_BL_DARKCOLOR), 0};
32SDL_Color remote_bl_color_bright = {RED_CMP(LCD_REMOTE_BL_BRIGHTCOLOR),
33 GREEN_CMP(LCD_REMOTE_BL_BRIGHTCOLOR),
34 BLUE_CMP(LCD_REMOTE_BL_BRIGHTCOLOR), 0};
35SDL_Color remote_color_dark = {RED_CMP(LCD_REMOTE_DARKCOLOR),
36 GREEN_CMP(LCD_REMOTE_DARKCOLOR),
37 BLUE_CMP(LCD_REMOTE_DARKCOLOR), 0};
38SDL_Color remote_color_bright = {RED_CMP(LCD_REMOTE_BRIGHTCOLOR),
39 GREEN_CMP(LCD_REMOTE_BRIGHTCOLOR),
40 BLUE_CMP(LCD_REMOTE_BRIGHTCOLOR), 0};
31 41
32static unsigned long get_lcd_remote_pixel(int x, int y) { 42#define GRADIENT_MAX 128
43
44#if LCD_REMOTE_DEPTH == 2
45/* Only defined for positive, non-split LCD for now */
46static const unsigned char colorindex[4] = {128, 85, 43, 0};
47#endif
48
49static unsigned long get_lcd_remote_pixel(int x, int y)
50{
33#if LCD_REMOTE_DEPTH == 1 51#if LCD_REMOTE_DEPTH == 1
34 return (lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 1; 52 return lcd_remote_framebuffer[y/8][x] & (1 << (y & 7)) ? 0 : GRADIENT_MAX;
35#elif LCD_REMOTE_DEPTH == 2 53#elif LCD_REMOTE_DEPTH == 2
36#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED 54#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
37 unsigned bits = (lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 0x0101; 55 unsigned bits = (lcd_remote_framebuffer[y/8][x] >> (y & 7)) & 0x0101;
38 return (bits | (bits >> 7)) & 3; 56 return colorindex[(bits | (bits >> 7)) & 3];
39#endif 57#endif
40#endif 58#endif
41} 59}
@@ -57,11 +75,11 @@ void lcd_remote_update_rect(int x_start, int y_start, int width, int height)
57void sim_remote_backlight(int value) 75void sim_remote_backlight(int value)
58{ 76{
59 if (value > 0) { 77 if (value > 0) {
60 sdl_set_gradient(remote_surface, &remote_backlight_color_zero, 78 sdl_set_gradient(remote_surface, &remote_bl_color_dark,
61 &remote_color_max, 0, (1<<LCD_REMOTE_DEPTH)); 79 &remote_bl_color_bright, 0, GRADIENT_MAX+1);
62 } else { 80 } else {
63 sdl_set_gradient(remote_surface, &remote_color_zero, &remote_color_max, 81 sdl_set_gradient(remote_surface, &remote_color_dark,
64 0, (1<<LCD_REMOTE_DEPTH)); 82 &remote_color_bright, 0, GRADIENT_MAX+1);
65 } 83 }
66 84
67 sdl_gui_update(remote_surface, 0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, 85 sdl_gui_update(remote_surface, 0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT,
@@ -74,10 +92,11 @@ void sim_remote_backlight(int value)
74void sim_lcd_remote_init(void) 92void sim_lcd_remote_init(void)
75{ 93{
76 remote_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, 94 remote_surface = SDL_CreateRGBSurface(SDL_SWSURFACE,
77 LCD_REMOTE_WIDTH * display_zoom, LCD_REMOTE_HEIGHT * display_zoom, 95 LCD_REMOTE_WIDTH * display_zoom,
78 8, 0, 0, 0, 0); 96 LCD_REMOTE_HEIGHT * display_zoom,
97 8, 0, 0, 0, 0);
79 98
80 sdl_set_gradient(remote_surface, &remote_backlight_color_zero, 99 sdl_set_gradient(remote_surface, &remote_bl_color_dark,
81 &remote_color_max, 0, (1<<LCD_REMOTE_DEPTH)); 100 &remote_bl_color_bright, 0, GRADIENT_MAX+1);
82} 101}
83 102
diff --git a/uisimulator/sdl/lcd-sdl.c b/uisimulator/sdl/lcd-sdl.c
index 6431c5f39d..373e07ffc0 100644
--- a/uisimulator/sdl/lcd-sdl.c
+++ b/uisimulator/sdl/lcd-sdl.c
@@ -21,11 +21,9 @@
21 21
22#include "lcd-sdl.h" 22#include "lcd-sdl.h"
23#include "uisdl.h" 23#include "uisdl.h"
24#include "system.h" /* for MIN() and MAX() */
24 25
25int display_zoom = 1; 26int display_zoom = 1;
26#ifdef UI_LCD_SPLIT
27static int gradient_steps = 0;
28#endif
29 27
30void sdl_update_rect(SDL_Surface *surface, int x_start, int y_start, int width, 28void sdl_update_rect(SDL_Surface *surface, int x_start, int y_start, int width,
31 int height, int max_x, int max_y, 29 int height, int max_x, int max_y,
@@ -51,18 +49,30 @@ void sdl_update_rect(SDL_Surface *surface, int x_start, int y_start, int width,
51 for (x = x_start; x < xmax; x++) { 49 for (x = x_start; x < xmax; x++) {
52 dest.x = x * display_zoom; 50 dest.x = x * display_zoom;
53 51
52#ifdef HAVE_LCD_SPLIT
53 for (y = y_start; y < MIN(ymax, LCD_SPLIT_POS); y++) {
54 dest.y = y * display_zoom;
55
56 SDL_FillRect(surface, &dest, (Uint32)(getpixel(x, y) | 0x80));
57 }
58 for (y = MAX(y_start, LCD_SPLIT_POS); y < ymax; y++) {
59 dest.y = (y + LCD_SPLIT_LINES) * display_zoom ;
60
61 SDL_FillRect(surface, &dest, (Uint32)getpixel(x, y));
62 }
63#else
54 for (y = y_start; y < ymax; y++) { 64 for (y = y_start; y < ymax; y++) {
55 dest.y = y * display_zoom; 65 dest.y = y * display_zoom;
56 66
57 SDL_FillRect(surface, &dest, (Uint32)getpixel(x, y)); 67 SDL_FillRect(surface, &dest, (Uint32)getpixel(x, y));
58 } 68 }
69#endif
59 } 70 }
60 71
61 SDL_UnlockSurface(surface); 72 SDL_UnlockSurface(surface);
62} 73}
63 74
64void sdl_gui_update(SDL_Surface *surface, IFSPLIT(SDL_Surface *real_surface,) 75void sdl_gui_update(SDL_Surface *surface, int x_start, int y_start, int width,
65 int x_start, int y_start, int width,
66 int height, int max_x, int max_y, int ui_x, int ui_y) 76 int height, int max_x, int max_y, int ui_x, int ui_y)
67{ 77{
68 int xmax, ymax; 78 int xmax, ymax;
@@ -80,73 +90,17 @@ void sdl_gui_update(SDL_Surface *surface, IFSPLIT(SDL_Surface *real_surface,)
80 SDL_Rect dest= {(ui_x + x_start) * display_zoom, (ui_y + y_start) * display_zoom, 90 SDL_Rect dest= {(ui_x + x_start) * display_zoom, (ui_y + y_start) * display_zoom,
81 xmax * display_zoom, ymax * display_zoom}; 91 xmax * display_zoom, ymax * display_zoom};
82 92
83#ifdef UI_LCD_SPLIT
84 /* fix real screen coordinates */
85 if(ymax >= UI_LCD_SPLIT_LINES)
86 src.h += UI_LCD_SPLIT_BLACK_LINES * display_zoom;
87
88 SDL_LockSurface(surface);
89 SDL_LockSurface(real_surface);
90
91 int pixel, npixels;
92
93#if LCD_DEPTH != 1
94#error "Split screen only works for monochrome displays !"
95#endif
96
97 npixels = display_zoom * display_zoom * UI_LCD_SPLIT_LINES * surface->pitch;
98 const unsigned char * pixels_src = (const unsigned char*)surface->pixels;
99 unsigned char * pixels_dst = (unsigned char*)real_surface->pixels;
100 const int start_pixel = UI_LCD_SPLIT_LINES * surface->pitch * display_zoom;
101 const int stop_pixel = (UI_LCD_SPLIT_LINES+UI_LCD_SPLIT_BLACK_LINES)
102 * surface->pitch * display_zoom;
103
104 /* draw top pixels, change the color */
105 for (pixel = 0; pixel < npixels ; pixel++)
106 {
107 int pix = pixels_src[pixel] + gradient_steps;
108 if(pix > 255) pix = 255;
109
110 pixels_dst[pixel] = pix;
111 }
112
113 /* copy bottom pixels */
114 memcpy(&pixels_dst[stop_pixel], &pixels_src[start_pixel],
115 (UI_LCD_HEIGHT - UI_LCD_SPLIT_LINES) * surface->pitch * display_zoom);
116
117 /* separation lines are off */
118 for (pixel = start_pixel; pixel < stop_pixel ; pixel++)
119 pixels_dst[pixel] = 0;
120
121 SDL_UnlockSurface(surface);
122 SDL_UnlockSurface(real_surface);
123
124 SDL_BlitSurface(real_surface, &src, gui_surface, &dest);
125#else
126 SDL_BlitSurface(surface, &src, gui_surface, &dest); 93 SDL_BlitSurface(surface, &src, gui_surface, &dest);
127#endif
128 94
129 SDL_Flip(gui_surface); 95 SDL_Flip(gui_surface);
130} 96}
131 97
132/* set a range of bitmap indices to a gradient from startcolour to endcolour */ 98/* set a range of bitmap indices to a gradient from startcolour to endcolour */
133void sdl_set_gradient(SDL_Surface *surface, SDL_Color *start, SDL_Color *end, 99void sdl_set_gradient(SDL_Surface *surface, SDL_Color *start, SDL_Color *end,
134 IFSPLIT(SDL_Color *split_start,) 100 int first, int steps)
135 IFSPLIT(SDL_Color *split_end ,) int first, int steps)
136{ 101{
137 int i; 102 int i;
138 103 SDL_Color palette[steps];
139#ifdef UI_LCD_SPLIT
140 int tot_steps = steps * 2;
141 if (tot_steps > 256)
142 tot_steps = 256;
143
144 gradient_steps = steps;
145#else
146#define tot_steps steps
147#endif
148
149 SDL_Color palette[tot_steps];
150 104
151 for (i = 0; i < steps; i++) { 105 for (i = 0; i < steps; i++) {
152 palette[i].r = start->r + (end->r - start->r) * i / (steps - 1); 106 palette[i].r = start->r + (end->r - start->r) * i / (steps - 1);
@@ -154,14 +108,6 @@ void sdl_set_gradient(SDL_Surface *surface, SDL_Color *start, SDL_Color *end,
154 palette[i].b = start->b + (end->b - start->b) * i / (steps - 1); 108 palette[i].b = start->b + (end->b - start->b) * i / (steps - 1);
155 } 109 }
156 110
157#ifdef UI_LCD_SPLIT /* extra color */ 111 SDL_SetPalette(surface, SDL_LOGPAL|SDL_PHYSPAL, palette, first, steps);
158 for (i = steps ; i < tot_steps; i++) {
159 palette[i].r = split_start->r + (split_end->r - split_start->r) * (i - steps) / (tot_steps - steps - 1);
160 palette[i].g = split_start->g + (split_end->g - split_start->g) * (i - steps) / (tot_steps - steps - 1);
161 palette[i].b = split_start->b + (split_end->b - split_start->b) * (i - steps) / (tot_steps - steps - 1);
162 }
163#endif
164
165 SDL_SetPalette(surface, SDL_LOGPAL|SDL_PHYSPAL, palette, first, tot_steps);
166} 112}
167 113
diff --git a/uisimulator/sdl/lcd-sdl.h b/uisimulator/sdl/lcd-sdl.h
index b177eb14c9..9ffa5246cf 100644
--- a/uisimulator/sdl/lcd-sdl.h
+++ b/uisimulator/sdl/lcd-sdl.h
@@ -25,13 +25,6 @@
25#include "lcd.h" 25#include "lcd.h"
26#include "SDL.h" 26#include "SDL.h"
27 27
28#include "uisdl.h"
29#ifdef UI_LCD_SPLIT
30#define IFSPLIT(x,y) x,y
31#else
32#define IFSPLIT(x,y)
33#endif
34
35/* Default display zoom level */ 28/* Default display zoom level */
36extern int display_zoom; 29extern int display_zoom;
37 30
@@ -39,13 +32,11 @@ void sdl_update_rect(SDL_Surface *surface, int x_start, int y_start, int width,
39 int height, int max_x, int max_y, 32 int height, int max_x, int max_y,
40 unsigned long (*getpixel)(int, int)); 33 unsigned long (*getpixel)(int, int));
41 34
42void sdl_gui_update(SDL_Surface *surface, IFSPLIT(SDL_Surface *real_surface,) 35void sdl_gui_update(SDL_Surface *surface, int x_start, int y_start, int width,
43 int x_start, int y_start, int width,
44 int height, int max_x, int max_y, int ui_x, int ui_y); 36 int height, int max_x, int max_y, int ui_x, int ui_y);
45 37
46void sdl_set_gradient(SDL_Surface *surface, SDL_Color *start, SDL_Color *end, 38void sdl_set_gradient(SDL_Surface *surface, SDL_Color *start, SDL_Color *end,
47 IFSPLIT( SDL_Color *split_start ,) 39 int first, int steps);
48 IFSPLIT( SDL_Color *split_end ,) int first, int steps);
49 40
50#endif /* #ifndef __LCDSDL_H__ */ 41#endif /* #ifndef __LCDSDL_H__ */
51 42
diff --git a/uisimulator/sdl/uisdl.c b/uisimulator/sdl/uisdl.c
index 81f9722a68..d6a49d3a60 100644
--- a/uisimulator/sdl/uisdl.c
+++ b/uisimulator/sdl/uisdl.c
@@ -130,15 +130,11 @@ bool gui_startup(void)
130 height = UI_HEIGHT; 130 height = UI_HEIGHT;
131 } else { 131 } else {
132#ifdef HAVE_REMOTE_LCD 132#ifdef HAVE_REMOTE_LCD
133 width = UI_LCD_WIDTH > UI_REMOTE_WIDTH ? UI_LCD_WIDTH : UI_REMOTE_WIDTH; 133 width = SIM_LCD_WIDTH > SIM_REMOTE_WIDTH ? SIM_LCD_WIDTH : SIM_REMOTE_WIDTH;
134 height = UI_LCD_HEIGHT + UI_REMOTE_HEIGHT; 134 height = SIM_LCD_HEIGHT + SIM_REMOTE_HEIGHT;
135#else 135#else
136 width = UI_LCD_WIDTH; 136 width = SIM_LCD_WIDTH;
137 height = UI_LCD_HEIGHT 137 height = SIM_LCD_HEIGHT;
138#ifdef UI_LCD_SPLIT
139 + UI_LCD_SPLIT_BLACK_LINES
140#endif
141 ;
142#endif 138#endif
143 } 139 }
144 140
diff --git a/uisimulator/sdl/uisdl.h b/uisimulator/sdl/uisdl.h
index e33be01948..6cb382ce8b 100644
--- a/uisimulator/sdl/uisdl.h
+++ b/uisimulator/sdl/uisdl.h
@@ -31,208 +31,114 @@
31#define UI_TITLE "Jukebox Recorder" 31#define UI_TITLE "Jukebox Recorder"
32#define UI_WIDTH 270 /* width of GUI window */ 32#define UI_WIDTH 270 /* width of GUI window */
33#define UI_HEIGHT 406 /* height of GUI window */ 33#define UI_HEIGHT 406 /* height of GUI window */
34#define UI_LCD_BGCOLOR 90, 145, 90 /* bkgnd color of LCD (no backlight) */
35#define UI_LCD_BGCOLORLIGHT 126, 229, 126 /* bkgnd color of LCD (backlight) */
36#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
37#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
38#define UI_LCD_POSX 80 /* x position of lcd */ 34#define UI_LCD_POSX 80 /* x position of lcd */
39#define UI_LCD_POSY 104 /* y position of lcd (96 for real aspect) */ 35#define UI_LCD_POSY 104 /* y position of lcd */
40#define UI_LCD_WIDTH 112
41#define UI_LCD_HEIGHT 64 /* (80 for real aspect) */
42 36
43#elif defined(ARCHOS_PLAYER) 37#elif defined(ARCHOS_PLAYER)
44#define UI_TITLE "Jukebox Player" 38#define UI_TITLE "Jukebox Player"
45#define UI_WIDTH 284 /* width of GUI window */ 39#define UI_WIDTH 284 /* width of GUI window */
46#define UI_HEIGHT 420 /* height of GUI window */ 40#define UI_HEIGHT 420 /* height of GUI window */
47#define UI_LCD_BGCOLOR 90, 145, 90 /* bkgnd color of LCD (no backlight) */
48#define UI_LCD_BGCOLORLIGHT 126, 229, 126 /* bkgnd color of LCD (backlight) */
49#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
50#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
51#define UI_LCD_POSX 75 /* x position of lcd */ 41#define UI_LCD_POSX 75 /* x position of lcd */
52#define UI_LCD_POSY 116 /* y position of lcd */ 42#define UI_LCD_POSY 116 /* y position of lcd */
53#define UI_LCD_WIDTH 132
54#define UI_LCD_HEIGHT 64
55 43
56#elif defined(ARCHOS_FMRECORDER) || defined(ARCHOS_RECORDERV2) 44#elif defined(ARCHOS_FMRECORDER) || defined(ARCHOS_RECORDERV2)
57#define UI_TITLE "Jukebox FM Recorder" 45#define UI_TITLE "Jukebox FM Recorder"
58#define UI_WIDTH 285 /* width of GUI window */ 46#define UI_WIDTH 285 /* width of GUI window */
59#define UI_HEIGHT 414 /* height of GUI window */ 47#define UI_HEIGHT 414 /* height of GUI window */
60#define UI_LCD_BGCOLOR 90, 145, 90 /* bkgnd color of LCD (no backlight) */
61#define UI_LCD_BGCOLORLIGHT 126, 229, 126 /* bkgnd color of LCD (backlight) */
62#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
63#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
64#define UI_LCD_POSX 87 /* x position of lcd */ 48#define UI_LCD_POSX 87 /* x position of lcd */
65#define UI_LCD_POSY 77 /* y position of lcd (69 for real aspect) */ 49#define UI_LCD_POSY 77 /* y position of lcd */
66#define UI_LCD_WIDTH 112
67#define UI_LCD_HEIGHT 64 /* (80 for real aspect) */
68 50
69#elif defined(ARCHOS_ONDIOSP) || defined(ARCHOS_ONDIOFM) 51#elif defined(ARCHOS_ONDIOSP) || defined(ARCHOS_ONDIOFM)
70#define UI_TITLE "Ondio" 52#define UI_TITLE "Ondio"
71#define UI_WIDTH 155 /* width of GUI window */ 53#define UI_WIDTH 155 /* width of GUI window */
72#define UI_HEIGHT 334 /* height of GUI window */ 54#define UI_HEIGHT 334 /* height of GUI window */
73#define UI_LCD_BGCOLOR 90, 145, 90 /* bkgnd color of LCD (no backlight) */
74#define UI_LCD_BGCOLORLIGHT 130, 180, 250 /* bkgnd color of LCD (backlight mod) */
75#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
76#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
77#define UI_LCD_POSX 21 /* x position of lcd */ 55#define UI_LCD_POSX 21 /* x position of lcd */
78#define UI_LCD_POSY 82 /* y position of lcd (74 for real aspect) */ 56#define UI_LCD_POSY 82 /* y position of lcd */
79#define UI_LCD_WIDTH 112
80#define UI_LCD_HEIGHT 64 /* (80 for real aspect) */
81 57
82#elif defined(IRIVER_H120) || defined(IRIVER_H100) 58#elif defined(IRIVER_H120) || defined(IRIVER_H100)
83#define UI_TITLE "iriver H1x0" 59#define UI_TITLE "iriver H1x0"
84#define UI_WIDTH 379 /* width of GUI window */ 60#define UI_WIDTH 379 /* width of GUI window */
85#define UI_HEIGHT 508 /* height of GUI window */ 61#define UI_HEIGHT 508 /* height of GUI window */
86#define UI_LCD_BGCOLOR 90, 145, 90 /* bkgnd color of LCD (no backlight) */
87#define UI_LCD_BGCOLORLIGHT 173, 216, 230 /* bkgnd color of LCD (backlight) */
88#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
89#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
90#define UI_LCD_POSX 109 /* x position of lcd */ 62#define UI_LCD_POSX 109 /* x position of lcd */
91#define UI_LCD_POSY 23 /* y position of lcd */ 63#define UI_LCD_POSY 23 /* y position of lcd */
92#define UI_LCD_WIDTH 160
93#define UI_LCD_HEIGHT 128
94#define UI_REMOTE_BGCOLOR 90, 145, 90 /* bkgnd of remote lcd (no bklight) */
95#define UI_REMOTE_BGCOLORLIGHT 130, 180, 250 /* bkgnd of remote lcd (bklight) */
96#define UI_REMOTE_FGCOLOR 0, 0, 0 /* foreground color of remote LCD (no backlight) */
97#define UI_REMOTE_FGCOLORLIGHT 0, 0, 0 /* foreground color of remote LCD (backlight) */
98#define UI_REMOTE_POSX 50 /* x position of remote lcd */ 64#define UI_REMOTE_POSX 50 /* x position of remote lcd */
99#define UI_REMOTE_POSY 403 /* y position of remote lcd */ 65#define UI_REMOTE_POSY 403 /* y position of remote lcd */
100#define UI_REMOTE_WIDTH 128
101#define UI_REMOTE_HEIGHT 64
102 66
103#elif defined(IRIVER_H300) 67#elif defined(IRIVER_H300)
104#define UI_TITLE "iriver H300" 68#define UI_TITLE "iriver H300"
105#define UI_WIDTH 288 /* width of GUI window */ 69#define UI_WIDTH 288 /* width of GUI window */
106#define UI_HEIGHT 581 /* height of GUI window */ 70#define UI_HEIGHT 581 /* height of GUI window */
107/* high-colour */
108#define UI_LCD_POSX 26 /* x position of lcd */ 71#define UI_LCD_POSX 26 /* x position of lcd */
109#define UI_LCD_POSY 36 /* y position of lcd */ 72#define UI_LCD_POSY 36 /* y position of lcd */
110#define UI_LCD_WIDTH 220
111#define UI_LCD_HEIGHT 176
112#define UI_REMOTE_BGCOLOR 90, 145, 90 /* bkgnd of remote lcd (no bklight) */
113#define UI_REMOTE_BGCOLORLIGHT 130, 180, 250 /* bkgnd of remote lcd (bklight) */
114#define UI_REMOTE_POSX 12 /* x position of remote lcd */ 73#define UI_REMOTE_POSX 12 /* x position of remote lcd */
115#define UI_REMOTE_POSY 478 /* y position of remote lcd */ 74#define UI_REMOTE_POSY 478 /* y position of remote lcd */
116#define UI_REMOTE_WIDTH 128
117#define UI_REMOTE_HEIGHT 64
118 75
119#elif defined(IPOD_1G2G) 76#elif defined(IPOD_1G2G)
120#define UI_TITLE "iPod 1G/2G" 77#define UI_TITLE "iPod 1G/2G"
121#define UI_WIDTH 224 /* width of GUI window */ 78#define UI_WIDTH 224 /* width of GUI window */
122#define UI_HEIGHT 382 /* height of GUI window */ 79#define UI_HEIGHT 382 /* height of GUI window */
123#define UI_LCD_BGCOLOR 100, 135, 100 /* bkgnd color of LCD (no backlight) */
124#define UI_LCD_BGCOLORLIGHT 223, 216, 255 /* bkgnd color of LCD (backlight) */
125#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
126#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
127#define UI_LCD_POSX 32 /* x position of lcd */ 80#define UI_LCD_POSX 32 /* x position of lcd */
128#define UI_LCD_POSY 12 /* y position of lcd */ 81#define UI_LCD_POSY 12 /* y position of lcd */
129#define UI_LCD_WIDTH 160
130#define UI_LCD_HEIGHT 128
131 82
132#elif defined(IPOD_3G) 83#elif defined(IPOD_3G)
133#define UI_TITLE "iPod 3G" 84#define UI_TITLE "iPod 3G"
134#define UI_WIDTH 218 /* width of GUI window */ 85#define UI_WIDTH 218 /* width of GUI window */
135#define UI_HEIGHT 389 /* height of GUI window */ 86#define UI_HEIGHT 389 /* height of GUI window */
136#define UI_LCD_BGCOLOR 90, 145, 90 /* bkgnd color of LCD (no backlight) */
137#define UI_LCD_BGCOLORLIGHT 173, 216, 230 /* bkgnd color of LCD (backlight) */
138#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
139#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
140#define UI_LCD_POSX 29 /* x position of lcd */ 87#define UI_LCD_POSX 29 /* x position of lcd */
141#define UI_LCD_POSY 16 /* y position of lcd */ 88#define UI_LCD_POSY 16 /* y position of lcd */
142#define UI_LCD_WIDTH 160
143#define UI_LCD_HEIGHT 128
144 89
145#elif defined(IPOD_4G) 90#elif defined(IPOD_4G)
146#define UI_TITLE "iPod 4G" 91#define UI_TITLE "iPod 4G"
147#define UI_WIDTH 196 /* width of GUI window */ 92#define UI_WIDTH 196 /* width of GUI window */
148#define UI_HEIGHT 370 /* height of GUI window */ 93#define UI_HEIGHT 370 /* height of GUI window */
149#define UI_LCD_BGCOLOR 90, 145, 90 /* bkgnd color of LCD (no backlight) */
150#define UI_LCD_BGCOLORLIGHT 173, 216, 230 /* bkgnd color of LCD (backlight) */
151#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
152#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
153#define UI_LCD_POSX 19 /* x position of lcd */ 94#define UI_LCD_POSX 19 /* x position of lcd */
154#define UI_LCD_POSY 14 /* y position of lcd */ 95#define UI_LCD_POSY 14 /* y position of lcd */
155#define UI_LCD_WIDTH 160
156#define UI_LCD_HEIGHT 128
157 96
158#elif defined(IPOD_MINI) || defined(IPOD_MINI2G) 97#elif defined(IPOD_MINI) || defined(IPOD_MINI2G)
159#define UI_TITLE "iPod mini" 98#define UI_TITLE "iPod mini"
160#define UI_WIDTH 191 /* width of GUI window */ 99#define UI_WIDTH 191 /* width of GUI window */
161#define UI_HEIGHT 365 /* height of GUI window */ 100#define UI_HEIGHT 365 /* height of GUI window */
162#define UI_LCD_BGCOLOR 100, 135, 100 /* bkgnd color of LCD (no backlight) */
163#define UI_LCD_BGCOLORLIGHT 223, 216, 255 /* bkgnd color of LCD (backlight) */
164#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
165#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
166#define UI_LCD_POSX 24 /* x position of lcd */ 101#define UI_LCD_POSX 24 /* x position of lcd */
167#define UI_LCD_POSY 17 /* y position of lcd */ 102#define UI_LCD_POSY 17 /* y position of lcd */
168#define UI_LCD_WIDTH 138
169#define UI_LCD_HEIGHT 110
170 103
171#elif defined(IPOD_COLOR) 104#elif defined(IPOD_COLOR)
172#define UI_TITLE "iPod Color" 105#define UI_TITLE "iPod Color"
173#define UI_WIDTH 261 /* width of GUI window */ 106#define UI_WIDTH 261 /* width of GUI window */
174#define UI_HEIGHT 493 /* height of GUI window */ 107#define UI_HEIGHT 493 /* height of GUI window */
175/* high-colour */
176#define UI_LCD_POSX 21 /* x position of lcd */ 108#define UI_LCD_POSX 21 /* x position of lcd */
177#define UI_LCD_POSY 16 /* y position of lcd */ 109#define UI_LCD_POSY 16 /* y position of lcd */
178#define UI_LCD_WIDTH 220
179#define UI_LCD_HEIGHT 176
180 110
181#elif defined(IPOD_NANO) 111#elif defined(IPOD_NANO)
182#define UI_TITLE "iPod Nano" 112#define UI_TITLE "iPod Nano"
183#define UI_WIDTH 199 /* width of GUI window */ 113#define UI_WIDTH 199 /* width of GUI window */
184#define UI_HEIGHT 421 /* height of GUI window */ 114#define UI_HEIGHT 421 /* height of GUI window */
185/* high-colour */
186#define UI_LCD_POSX 13 /* x position of lcd */ 115#define UI_LCD_POSX 13 /* x position of lcd */
187#define UI_LCD_POSY 14 /* y position of lcd */ 116#define UI_LCD_POSY 14 /* y position of lcd */
188#define UI_LCD_WIDTH 176
189#define UI_LCD_HEIGHT 132
190 117
191#elif defined(IPOD_VIDEO) 118#elif defined(IPOD_VIDEO)
192#define UI_TITLE "iPod Video" 119#define UI_TITLE "iPod Video"
193#define UI_WIDTH 350 /* width of GUI window */ 120#define UI_WIDTH 350 /* width of GUI window */
194#define UI_HEIGHT 591 /* height of GUI window */ 121#define UI_HEIGHT 591 /* height of GUI window */
195/* high-colour */
196#define UI_LCD_POSX 14 /* x position of lcd */ 122#define UI_LCD_POSX 14 /* x position of lcd */
197#define UI_LCD_POSY 12 /* y position of lcd */ 123#define UI_LCD_POSY 12 /* y position of lcd */
198#define UI_LCD_WIDTH 320
199#define UI_LCD_HEIGHT 240
200 124
201#elif defined(IAUDIO_X5) 125#elif defined(IAUDIO_X5)
202#define UI_TITLE "iAudio X5" 126#define UI_TITLE "iAudio X5"
203#define UI_WIDTH 300 /* width of GUI window */ 127#define UI_WIDTH 300 /* width of GUI window */
204#define UI_HEIGHT 558 /* height of GUI window */ 128#define UI_HEIGHT 558 /* height of GUI window */
205/* high-colour */
206#define UI_LCD_POSX 55 /* x position of lcd */ 129#define UI_LCD_POSX 55 /* x position of lcd */
207#define UI_LCD_POSY 61 /* y position of lcd (74 for real aspect) */ 130#define UI_LCD_POSY 61 /* y position of lcd */
208#define UI_LCD_WIDTH LCD_WIDTH /* * 1.5 */
209#define UI_LCD_HEIGHT LCD_HEIGHT /* * 1.5 */
210#define UI_REMOTE_BGCOLOR 90, 145, 90 /* bkgnd of remote lcd (no bklight) */
211#define UI_REMOTE_BGCOLORLIGHT 130, 180, 250 /* bkgnd of remote lcd (bklight) */
212#define UI_REMOTE_POSX 12 /* x position of remote lcd */ 131#define UI_REMOTE_POSX 12 /* x position of remote lcd */
213#define UI_REMOTE_POSY 462 /* y position of remote lcd */ 132#define UI_REMOTE_POSY 462 /* y position of remote lcd */
214#define UI_REMOTE_WIDTH 128
215#define UI_REMOTE_HEIGHT 96
216 133
217#elif defined(IAUDIO_M5) 134#elif defined(IAUDIO_M5)
218#define UI_TITLE "iAudio M5" 135#define UI_TITLE "iAudio M5"
219#define UI_WIDTH 374 /* width of GUI window */ 136#define UI_WIDTH 374 /* width of GUI window */
220#define UI_HEIGHT 650 /* height of GUI window */ 137#define UI_HEIGHT 650 /* height of GUI window */
221/* high-colour */
222#define UI_LCD_POSX 82 /* x position of lcd */ 138#define UI_LCD_POSX 82 /* x position of lcd */
223#define UI_LCD_POSY 74 /* y position of lcd (74 for real aspect) */ 139#define UI_LCD_POSY 74 /* y position of lcd */
224#define UI_LCD_BGCOLOR 100, 135, 100 /* bkgnd color of LCD (no backlight) */
225#define UI_LCD_BGCOLORLIGHT 223, 216, 255 /* bkgnd color of LCD (backlight) */
226#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
227#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
228#define UI_LCD_WIDTH LCD_WIDTH /* * 1.5 */
229#define UI_LCD_HEIGHT LCD_HEIGHT /* * 1.5 */
230#define UI_REMOTE_BGCOLOR 90, 145, 90 /* bkgnd of remote lcd (no bklight) */
231#define UI_REMOTE_BGCOLORLIGHT 130, 180, 250 /* bkgnd of remote lcd (bklight) */
232#define UI_REMOTE_POSX 59 /* x position of remote lcd */ 140#define UI_REMOTE_POSX 59 /* x position of remote lcd */
233#define UI_REMOTE_POSY 509 /* y position of remote lcd */ 141#define UI_REMOTE_POSY 509 /* y position of remote lcd */
234#define UI_REMOTE_WIDTH 128
235#define UI_REMOTE_HEIGHT 96
236 142
237#elif defined(IAUDIO_M3) 143#elif defined(IAUDIO_M3)
238#define UI_TITLE "iAudio M3" 144#define UI_TITLE "iAudio M3"
@@ -240,68 +146,43 @@
240#define UI_HEIGHT 501 /* height of GUI window */ 146#define UI_HEIGHT 501 /* height of GUI window */
241#define UI_LCD_POSX 92 /* x position of lcd */ 147#define UI_LCD_POSX 92 /* x position of lcd */
242#define UI_LCD_POSY 348 /* y position of lcd */ 148#define UI_LCD_POSY 348 /* y position of lcd */
243#define UI_LCD_BGCOLOR 90, 145, 90 /* bkgnd color of LCD (no bklight) */
244#define UI_LCD_BGCOLORLIGHT 130, 180, 250 /* bkgnd color of LCD (bklight) */
245#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
246#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
247#define UI_LCD_WIDTH LCD_WIDTH /* * 1.5 */
248#define UI_LCD_HEIGHT LCD_HEIGHT /* * 1.5 */
249 149
250#elif defined(GIGABEAT_F) 150#elif defined(GIGABEAT_F)
251#define UI_TITLE "Toshiba Gigabeat" 151#define UI_TITLE "Toshiba Gigabeat"
252#define UI_WIDTH 401 /* width of GUI window */ 152#define UI_WIDTH 401 /* width of GUI window */
253#define UI_HEIGHT 655 /* height of GUI window */ 153#define UI_HEIGHT 655 /* height of GUI window */
254/* high-colour */
255#define UI_LCD_POSX 48 /* x position of lcd */ 154#define UI_LCD_POSX 48 /* x position of lcd */
256#define UI_LCD_POSY 60 /* y position of lcd */ 155#define UI_LCD_POSY 60 /* y position of lcd */
257#define UI_LCD_WIDTH 240
258#define UI_LCD_HEIGHT 320
259 156
260#elif defined(GIGABEAT_S) 157#elif defined(GIGABEAT_S)
261#define UI_TITLE "Toshiba Gigabeat" 158#define UI_TITLE "Toshiba Gigabeat"
262#define UI_WIDTH 450 /* width of GUI window */ 159#define UI_WIDTH 450 /* width of GUI window */
263#define UI_HEIGHT 688 /* height of GUI window */ 160#define UI_HEIGHT 688 /* height of GUI window */
264/* high-colour */
265#define UI_LCD_POSX 96 /* x position of lcd */ 161#define UI_LCD_POSX 96 /* x position of lcd */
266#define UI_LCD_POSY 90 /* y position of lcd */ 162#define UI_LCD_POSY 90 /* y position of lcd */
267#define UI_LCD_WIDTH 240
268#define UI_LCD_HEIGHT 320
269 163
270#elif defined(MROBE_500) 164#elif defined(MROBE_500)
271#define UI_TITLE "Olympus M:Robe 500" 165#define UI_TITLE "Olympus M:Robe 500"
272#define UI_WIDTH 401 /* width of GUI window */ 166#define UI_WIDTH 401 /* width of GUI window */
273#define UI_HEIGHT 655 /* height of GUI window */ 167#define UI_HEIGHT 655 /* height of GUI window */
274/* high-colour */
275#define UI_LCD_POSX 48 /* x position of lcd */ 168#define UI_LCD_POSX 48 /* x position of lcd */
276#define UI_LCD_POSY 60 /* y position of lcd */ 169#define UI_LCD_POSY 60 /* y position of lcd */
277#define UI_LCD_WIDTH LCD_WIDTH
278#define UI_LCD_HEIGHT LCD_HEIGHT
279#define UI_REMOTE_BGCOLOR 90, 145, 90 /* bkgnd of remote lcd (no bklight) */
280#define UI_REMOTE_BGCOLORLIGHT 130, 180, 250 /* bkgnd of remote lcd (bklight) */
281#define UI_REMOTE_POSX 50 /* x position of remote lcd */ 170#define UI_REMOTE_POSX 50 /* x position of remote lcd */
282#define UI_REMOTE_POSY 403 /* y position of remote lcd */ 171#define UI_REMOTE_POSY 403 /* y position of remote lcd */
283#define UI_REMOTE_WIDTH 79
284#define UI_REMOTE_HEIGHT 16
285 172
286#elif defined(IRIVER_H10) 173#elif defined(IRIVER_H10)
287#define UI_TITLE "iriver H10 20Gb" 174#define UI_TITLE "iriver H10 20Gb"
288#define UI_WIDTH 392 /* width of GUI window */ 175#define UI_WIDTH 392 /* width of GUI window */
289#define UI_HEIGHT 391 /* height of GUI window */ 176#define UI_HEIGHT 391 /* height of GUI window */
290/* high-colour */
291#define UI_LCD_POSX 111 /* x position of lcd */ 177#define UI_LCD_POSX 111 /* x position of lcd */
292#define UI_LCD_POSY 30 /* y position of lcd (74 for real aspect) */ 178#define UI_LCD_POSY 30 /* y position of lcd */
293#define UI_LCD_WIDTH LCD_WIDTH /* * 1.5 */
294#define UI_LCD_HEIGHT LCD_HEIGHT /* * 1.5 */
295 179
296#elif defined(IRIVER_H10_5GB) 180#elif defined(IRIVER_H10_5GB)
297#define UI_TITLE "iriver H10 5/6Gb" 181#define UI_TITLE "iriver H10 5/6Gb"
298#define UI_WIDTH 353 /* width of GUI window */ 182#define UI_WIDTH 353 /* width of GUI window */
299#define UI_HEIGHT 460 /* height of GUI window */ 183#define UI_HEIGHT 460 /* height of GUI window */
300/* high-colour */
301#define UI_LCD_POSX 112 /* x position of lcd */ 184#define UI_LCD_POSX 112 /* x position of lcd */
302#define UI_LCD_POSY 45 /* y position of lcd (74 for real aspect) */ 185#define UI_LCD_POSY 45 /* y position of lcd */
303#define UI_LCD_WIDTH LCD_WIDTH /* * 1.5 */
304#define UI_LCD_HEIGHT LCD_HEIGHT /* * 1.5 */
305 186
306#elif defined(SANSA_E200) || defined(SANSA_E200V2) 187#elif defined(SANSA_E200) || defined(SANSA_E200V2)
307#ifdef SANSA_E200 188#ifdef SANSA_E200
@@ -311,35 +192,23 @@
311#endif 192#endif
312#define UI_WIDTH 260 /* width of GUI window */ 193#define UI_WIDTH 260 /* width of GUI window */
313#define UI_HEIGHT 502 /* height of GUI window */ 194#define UI_HEIGHT 502 /* height of GUI window */
314/* high-colour */
315#define UI_LCD_POSX 42 /* x position of lcd */ 195#define UI_LCD_POSX 42 /* x position of lcd */
316#define UI_LCD_POSY 37 /* y position of lcd (74 for real aspect) */ 196#define UI_LCD_POSY 37 /* y position of lcd */
317#define UI_LCD_WIDTH LCD_WIDTH /* * 1.5 */
318#define UI_LCD_HEIGHT LCD_HEIGHT /* * 1.5 */
319 197
320#elif defined(SANSA_C200) 198#elif defined(SANSA_C200)
321#define UI_TITLE "Sansa c200" 199#define UI_TITLE "Sansa c200"
322#define UI_WIDTH 350 /* width of GUI window */ 200#define UI_WIDTH 350 /* width of GUI window */
323#define UI_HEIGHT 152 /* height of GUI window */ 201#define UI_HEIGHT 152 /* height of GUI window */
324/* high-colour */
325#define UI_LCD_POSX 42 /* x position of lcd */ 202#define UI_LCD_POSX 42 /* x position of lcd */
326#define UI_LCD_POSY 35 /* y position of lcd (74 for real aspect) */ 203#define UI_LCD_POSY 35 /* y position of lcd */
327#define UI_LCD_WIDTH LCD_WIDTH /* * 1.5 */
328#define UI_LCD_HEIGHT LCD_HEIGHT /* * 1.5 */
329 204
330#elif defined(IRIVER_IFP7XX) 205#elif defined(IRIVER_IFP7XX)
331#define UI_TITLE "iriver iFP7xx" 206#define UI_TITLE "iriver iFP7xx"
332#define UI_WIDTH 425 /* width of GUI window */ 207#define UI_WIDTH 425 /* width of GUI window */
333#define UI_HEIGHT 183 /* height of GUI window */ 208#define UI_HEIGHT 183 /* height of GUI window */
334#define UI_LCD_BGCOLOR 94, 104, 84 /* bkgnd color of LCD (no backlight) */
335#define UI_LCD_BGCOLORLIGHT 60, 160, 230 /* bkgnd color of LCD (backlight) */
336#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
337#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
338#define UI_LCD_POSX 115 /* x position of lcd */ 209#define UI_LCD_POSX 115 /* x position of lcd */
339#define UI_LCD_POSY 54 /* y position of lcd */ 210#define UI_LCD_POSY 54 /* y position of lcd */
340#define UI_LCD_WIDTH LCD_WIDTH /* * 1.5 */ 211
341#define UI_LCD_HEIGHT LCD_HEIGHT /* * 1.5 */
342
343#elif defined(ARCHOS_AV300) 212#elif defined(ARCHOS_AV300)
344#define UI_TITLE "Archos AV300" 213#define UI_TITLE "Archos AV300"
345/* We are temporarily using a 2bpp LCD driver and dummy bitmap */ 214/* We are temporarily using a 2bpp LCD driver and dummy bitmap */
@@ -347,25 +216,13 @@
347#define UI_HEIGHT 340 /* height of GUI window */ 216#define UI_HEIGHT 340 /* height of GUI window */
348#define UI_LCD_POSX 50 /* x position of lcd */ 217#define UI_LCD_POSX 50 /* x position of lcd */
349#define UI_LCD_POSY 50 /* y position of lcd */ 218#define UI_LCD_POSY 50 /* y position of lcd */
350#define UI_LCD_WIDTH 320
351#define UI_LCD_HEIGHT 240
352#define UI_LCD_BGCOLOR 90, 145, 90 /* bkgnd color of LCD (no backlight) */
353#define UI_LCD_BGCOLORLIGHT 173, 216, 230 /* bkgnd color of LCD (backlight) */
354#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
355#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
356 219
357#elif defined(MROBE_100) 220#elif defined(MROBE_100)
358#define UI_TITLE "Olympus M:Robe 100" 221#define UI_TITLE "Olympus M:Robe 100"
359#define UI_WIDTH 247 /* width of GUI window */ 222#define UI_WIDTH 247 /* width of GUI window */
360#define UI_HEIGHT 416 /* height of GUI window */ 223#define UI_HEIGHT 416 /* height of GUI window */
361#define UI_LCD_BGCOLOR 0, 0, 0 /* bkgnd color of LCD (no backlight) */
362#define UI_LCD_BGCOLORLIGHT 94, 2, 2 /* bkgnd color of LCD (backlight) */
363#define UI_LCD_FGCOLOR 50, 50, 50 /* foreground color of LCD (no backlight) */
364#define UI_LCD_FGCOLORLIGHT 241, 6, 3 /* foreground color of LCD (backlight) */
365#define UI_LCD_POSX 43 /* x position of lcd */ 224#define UI_LCD_POSX 43 /* x position of lcd */
366#define UI_LCD_POSY 25 /* y position of lcd */ 225#define UI_LCD_POSY 25 /* y position of lcd */
367#define UI_LCD_WIDTH 160
368#define UI_LCD_HEIGHT 128
369 226
370#elif defined(COWON_D2) 227#elif defined(COWON_D2)
371#define UI_TITLE "Cowon D2" 228#define UI_TITLE "Cowon D2"
@@ -373,25 +230,13 @@
373#define UI_HEIGHT 368 /* height of GUI window */ 230#define UI_HEIGHT 368 /* height of GUI window */
374#define UI_LCD_POSX 58 /* x position of lcd */ 231#define UI_LCD_POSX 58 /* x position of lcd */
375#define UI_LCD_POSY 67 /* y position of lcd */ 232#define UI_LCD_POSY 67 /* y position of lcd */
376#define UI_LCD_WIDTH 320
377#define UI_LCD_HEIGHT 240
378#define UI_LCD_BGCOLOR 32, 32, 32 /* bkgnd color of LCD (no backlight) */
379#define UI_LCD_BGCOLORLIGHT 192, 192, 192 /* bkgnd color of LCD (backlight) */
380#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
381#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
382 233
383#elif defined(IAUDIO_7) 234#elif defined(IAUDIO_7)
384#define UI_TITLE "iAudio7" 235#define UI_TITLE "iAudio7"
385#define UI_WIDTH 494 /* width of GUI window */ 236#define UI_WIDTH 494 /* width of GUI window */
386#define UI_HEIGHT 214 /* height of GUI window */ 237#define UI_HEIGHT 214 /* height of GUI window */
387#define UI_LCD_BGCOLOR 90, 145, 90 /* bkgnd color of LCD (no backlight) */
388#define UI_LCD_BGCOLORLIGHT 173, 216, 230 /* bkgnd color of LCD (backlight) */
389#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
390#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
391#define UI_LCD_POSX 131 /* x position of lcd */ 238#define UI_LCD_POSX 131 /* x position of lcd */
392#define UI_LCD_POSY 38 /* y position of lcd */ 239#define UI_LCD_POSY 38 /* y position of lcd */
393#define UI_LCD_WIDTH 160
394#define UI_LCD_HEIGHT 128
395 240
396#elif defined(CREATIVE_ZVM) || defined(CREATIVE_ZVM60GB) 241#elif defined(CREATIVE_ZVM) || defined(CREATIVE_ZVM60GB)
397#ifdef CREATIVE_ZVM 242#ifdef CREATIVE_ZVM
@@ -403,12 +248,6 @@
403#define UI_HEIGHT 643 /* height of GUI window */ 248#define UI_HEIGHT 643 /* height of GUI window */
404#define UI_LCD_POSX 31 /* x position of lcd */ 249#define UI_LCD_POSX 31 /* x position of lcd */
405#define UI_LCD_POSY 62 /* y position of lcd */ 250#define UI_LCD_POSY 62 /* y position of lcd */
406#define UI_LCD_WIDTH 320
407#define UI_LCD_HEIGHT 240
408#define UI_LCD_BGCOLOR 32, 32, 32 /* bkgnd color of LCD (no backlight) */
409#define UI_LCD_BGCOLORLIGHT 192, 192, 192 /* bkgnd color of LCD (backlight) */
410#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
411#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
412 251
413#elif defined(CREATIVE_ZV) 252#elif defined(CREATIVE_ZV)
414#define UI_TITLE "Creative Zen Vision" 253#define UI_TITLE "Creative Zen Vision"
@@ -416,12 +255,6 @@
416#define UI_HEIGHT 643 /* height of GUI window */ 255#define UI_HEIGHT 643 /* height of GUI window */
417#define UI_LCD_POSX 129 /* x position of lcd */ 256#define UI_LCD_POSX 129 /* x position of lcd */
418#define UI_LCD_POSY 85 /* y position of lcd */ 257#define UI_LCD_POSY 85 /* y position of lcd */
419#define UI_LCD_WIDTH 640
420#define UI_LCD_HEIGHT 480
421#define UI_LCD_BGCOLOR 32, 32, 32 /* bkgnd color of LCD (no backlight) */
422#define UI_LCD_BGCOLORLIGHT 192, 192, 192 /* bkgnd color of LCD (backlight) */
423#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
424#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
425 258
426#elif defined(MEIZU_M6SL) 259#elif defined(MEIZU_M6SL)
427#define UI_TITLE "Meizu M6" 260#define UI_TITLE "Meizu M6"
@@ -429,22 +262,13 @@
429#define UI_HEIGHT 322 /* height of GUI window */ 262#define UI_HEIGHT 322 /* height of GUI window */
430#define UI_LCD_POSX 39 /* x position of lcd */ 263#define UI_LCD_POSX 39 /* x position of lcd */
431#define UI_LCD_POSY 38 /* y position of lcd */ 264#define UI_LCD_POSY 38 /* y position of lcd */
432#define UI_LCD_WIDTH 320
433#define UI_LCD_HEIGHT 240
434#define UI_LCD_BGCOLOR 32, 32, 32 /* bkgnd color of LCD (no backlight) */
435#define UI_LCD_BGCOLORLIGHT 192, 192, 192 /* bkgnd color of LCD (backlight) */
436#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
437#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
438 265
439#elif defined(SANSA_FUZE) 266#elif defined(SANSA_FUZE)
440#define UI_TITLE "Sansa Fuze" 267#define UI_TITLE "Sansa Fuze"
441#define UI_WIDTH 279 /* width of GUI window */ 268#define UI_WIDTH 279 /* width of GUI window */
442#define UI_HEIGHT 449 /* height of GUI window */ 269#define UI_HEIGHT 449 /* height of GUI window */
443/* high-colour */
444#define UI_LCD_POSX 30 /* x position of lcd */ 270#define UI_LCD_POSX 30 /* x position of lcd */
445#define UI_LCD_POSY 31 /* y position of lcd */ 271#define UI_LCD_POSY 31 /* y position of lcd */
446#define UI_LCD_WIDTH LCD_WIDTH
447#define UI_LCD_HEIGHT LCD_HEIGHT
448 272
449#elif defined(SANSA_CLIP) 273#elif defined(SANSA_CLIP)
450#define UI_TITLE "Sansa Clip" 274#define UI_TITLE "Sansa Clip"
@@ -452,42 +276,20 @@
452#define UI_HEIGHT 325 /* height of GUI window */ 276#define UI_HEIGHT 325 /* height of GUI window */
453#define UI_LCD_POSX 38 /* x position of lcd */ 277#define UI_LCD_POSX 38 /* x position of lcd */
454#define UI_LCD_POSY 38 /* y position of lcd */ 278#define UI_LCD_POSY 38 /* y position of lcd */
455#define UI_LCD_WIDTH 128
456#define UI_LCD_HEIGHT 64
457#define UI_LCD_BGCOLOR 0, 0, 0 /* bkgnd color of LCD (no backlight) */
458#define UI_LCD_BGCOLORLIGHT 0, 0, 0 /* bkgnd color of LCD (backlight) */
459#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
460#define UI_LCD_FGCOLORLIGHT 13, 226, 229 /* foreground color of LCD (backlight) */
461
462#define UI_LCD_SPLIT /* The screen is split in 2 areas */
463#define UI_LCD_SPLIT_LINES 16 /* the top 16 lines have a different color */
464#define UI_LCD_SPLIT_BLACK_LINES 2 /* The 2 areas are separated by 2 empty lines */
465/* Colors for the top part of the screen */
466#define UI_LCD_SPLIT_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
467#define UI_LCD_SPLIT_FGCOLORLIGHT 255, 230, 15 /* foreground color of LCD (backlight) */
468 279
469#elif defined(PHILIPS_HDD1630) 280#elif defined(PHILIPS_HDD1630)
470#define UI_TITLE "Philips GoGear HDD1630" 281#define UI_TITLE "Philips GoGear HDD1630"
471#define UI_WIDTH 407 /* width of GUI window */ 282#define UI_WIDTH 407 /* width of GUI window */
472#define UI_HEIGHT 391 /* height of GUI window */ 283#define UI_HEIGHT 391 /* height of GUI window */
473/* high-colour */
474#define UI_LCD_POSX 143 /* x position of lcd */ 284#define UI_LCD_POSX 143 /* x position of lcd */
475#define UI_LCD_POSY 27 /* y position of lcd */ 285#define UI_LCD_POSY 27 /* y position of lcd */
476#define UI_LCD_WIDTH LCD_WIDTH
477#define UI_LCD_HEIGHT LCD_HEIGHT
478 286
479#elif defined(SANSA_M200V4) 287#elif defined(SANSA_M200V4)
480#define UI_TITLE "sansa m200v4" 288#define UI_TITLE "sansa m200v4"
481#define UI_WIDTH 350 /* width of GUI window */ 289#define UI_WIDTH 350 /* width of GUI window */
482#define UI_HEIGHT 168 /* height of GUI window */ 290#define UI_HEIGHT 168 /* height of GUI window */
483#define UI_LCD_BGCOLOR 94, 104, 84 /* bkgnd color of LCD (no backlight) */
484#define UI_LCD_BGCOLORLIGHT 60, 160, 230 /* bkgnd color of LCD (backlight) */
485#define UI_LCD_FGCOLOR 0, 0, 0 /* foreground color of LCD (no backlight) */
486#define UI_LCD_FGCOLORLIGHT 0, 0, 0 /* foreground color of LCD (backlight) */
487#define UI_LCD_POSX 42 /* x position of lcd */ 291#define UI_LCD_POSX 42 /* x position of lcd */
488#define UI_LCD_POSY 55 /* y position of lcd */ 292#define UI_LCD_POSY 55 /* y position of lcd */
489#define UI_LCD_WIDTH LCD_WIDTH /* * 1.5 */
490#define UI_LCD_HEIGHT LCD_HEIGHT /* * 1.5 */
491 293
492 294
493#else 295#else