From b341f5d594c10ff541764a506dc8a2d5c6a8752a Mon Sep 17 00:00:00 2001 From: Steve Bavin Date: Mon, 26 Oct 2009 09:58:39 +0000 Subject: FS#10700 - Add --noremote option to simulator. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23358 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/sdl/lcd-remote-bitmap.c | 42 ++++++++++++++++++++++--------------- uisimulator/sdl/uisdl.c | 40 +++++++++++++++++++++++++++-------- 2 files changed, 56 insertions(+), 26 deletions(-) diff --git a/uisimulator/sdl/lcd-remote-bitmap.c b/uisimulator/sdl/lcd-remote-bitmap.c index ecb9904a40..c44e476288 100644 --- a/uisimulator/sdl/lcd-remote-bitmap.c +++ b/uisimulator/sdl/lcd-remote-bitmap.c @@ -24,7 +24,7 @@ #include "lcd-remote-bitmap.h" #include "screendump.h" -SDL_Surface *remote_surface; +SDL_Surface *remote_surface = 0; SDL_Color remote_bl_color_dark = {RED_CMP(LCD_REMOTE_BL_DARKCOLOR), GREEN_CMP(LCD_REMOTE_BL_DARKCOLOR), @@ -65,27 +65,35 @@ void lcd_remote_update (void) void lcd_remote_update_rect(int x_start, int y_start, int width, int height) { - sdl_update_rect(remote_surface, x_start, y_start, width, height, - LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, get_lcd_remote_pixel); - sdl_gui_update(remote_surface, x_start, y_start, width, height, - LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, background ? UI_REMOTE_POSX : 0, - background ? UI_REMOTE_POSY : LCD_HEIGHT); + if (remote_surface) + { + sdl_update_rect(remote_surface, x_start, y_start, width, height, + LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, get_lcd_remote_pixel); + sdl_gui_update(remote_surface, x_start, y_start, width, height, + LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, background ? UI_REMOTE_POSX : 0, + background ? UI_REMOTE_POSY : LCD_HEIGHT); + } } void sim_remote_backlight(int value) { - if (value > 0) { - sdl_set_gradient(remote_surface, &remote_bl_color_dark, - &remote_bl_color_bright, 0, NUM_SHADES); - } else { - sdl_set_gradient(remote_surface, &remote_color_dark, - &remote_color_bright, 0, NUM_SHADES); + if (remote_surface) + { + if (value > 0) + { + sdl_set_gradient(remote_surface, &remote_bl_color_dark, + &remote_bl_color_bright, 0, NUM_SHADES); + } + else + { + sdl_set_gradient(remote_surface, &remote_color_dark, + &remote_color_bright, 0, NUM_SHADES); + } + sdl_gui_update(remote_surface, 0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, + LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, + background ? UI_REMOTE_POSX : 0, + background? UI_REMOTE_POSY : LCD_HEIGHT); } - - sdl_gui_update(remote_surface, 0, 0, LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, - LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT, - background ? UI_REMOTE_POSX : 0, - background? UI_REMOTE_POSY : LCD_HEIGHT); } /* initialise simulator lcd remote driver */ diff --git a/uisimulator/sdl/uisdl.c b/uisimulator/sdl/uisdl.c index d6a49d3a60..3ab098e5ba 100644 --- a/uisimulator/sdl/uisdl.c +++ b/uisimulator/sdl/uisdl.c @@ -48,6 +48,9 @@ void button_event(int key, bool pressed); SDL_Surface *gui_surface; bool background = true; /* use backgrounds by default */ +#ifdef HAVE_REMOTE_LCD +static bool showremote = true; /* include remote by default */ +#endif bool lcd_display_redraw = true; /* Used for player simulator */ char having_new_lcd = true; /* Used for player simulator */ @@ -124,18 +127,25 @@ bool gui_startup(void) } /* Set things up */ - - if (background) { + if (background) + { width = UI_WIDTH; height = UI_HEIGHT; - } else { + } + else + { #ifdef HAVE_REMOTE_LCD - width = SIM_LCD_WIDTH > SIM_REMOTE_WIDTH ? SIM_LCD_WIDTH : SIM_REMOTE_WIDTH; - height = SIM_LCD_HEIGHT + SIM_REMOTE_HEIGHT; -#else - width = SIM_LCD_WIDTH; - height = SIM_LCD_HEIGHT; + if (showremote) + { + width = SIM_LCD_WIDTH > SIM_REMOTE_WIDTH ? SIM_LCD_WIDTH : SIM_REMOTE_WIDTH; + height = SIM_LCD_HEIGHT + SIM_REMOTE_HEIGHT; + } + else #endif + { + width = SIM_LCD_WIDTH; + height = SIM_LCD_HEIGHT; + } } @@ -148,7 +158,8 @@ bool gui_startup(void) sim_lcd_init(); #ifdef HAVE_REMOTE_LCD - sim_lcd_remote_init(); + if (showremote) + sim_lcd_remote_init(); #endif SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); @@ -197,6 +208,14 @@ int main(int argc, char *argv[]) background = false; printf("Disabling background image.\n"); } +#ifdef HAVE_REMOTE_LCD + else if (!strcmp("--noremote", argv[x])) + { + showremote = false; + background = false; + printf("Disabling remote image.\n"); + } +#endif else if (!strcmp("--old_lcd", argv[x])) { having_new_lcd = false; @@ -232,6 +251,9 @@ int main(int argc, char *argv[]) printf(" --debugaudio \t Write raw PCM data to audiodebug.raw\n"); printf(" --debugwps \t Print advanced WPS debug info\n"); printf(" --nobackground \t Disable the background image\n"); +#ifdef HAVE_REMOTE_LCD + printf(" --noremote \t Disable the remote image (will disable backgrounds)\n"); +#endif printf(" --old_lcd \t [Player] simulate old playermodel (ROM version<4.51)\n"); printf(" --zoom [VAL]\t Window zoom (will disable backgrounds)\n"); printf(" --alarm \t Simulate a wake-up on alarm\n"); -- cgit v1.2.3