diff --git a/apps/action.c b/apps/action.c index 7cde1b14ba..b1dd98df08 100644 --- a/apps/action.c +++ b/apps/action.c @@ -172,7 +172,7 @@ static int get_action_worker(int context, int timeout, { last_button = BUTTON_NONE; keys_locked = false; - gui_syncsplash(HZ/2, str(LANG_KEYLOCK_OFF)); + splash(HZ/2, str(LANG_KEYLOCK_OFF)); return ACTION_REDRAW; } else @@ -181,7 +181,7 @@ static int get_action_worker(int context, int timeout, #endif { if ((button & BUTTON_REL)) - gui_syncsplash(HZ/2, str(LANG_KEYLOCK_ON)); + splash(HZ/2, str(LANG_KEYLOCK_ON)); return ACTION_REDRAW; } } @@ -220,7 +220,7 @@ static int get_action_worker(int context, int timeout, { unlock_combo = button; keys_locked = true; - gui_syncsplash(HZ/2, str(LANG_KEYLOCK_ON)); + splash(HZ/2, str(LANG_KEYLOCK_ON)); button_clear_queue(); return ACTION_REDRAW; diff --git a/apps/alarm_menu.c b/apps/alarm_menu.c index 3866a99bc1..bc058b7251 100644 --- a/apps/alarm_menu.c +++ b/apps/alarm_menu.c @@ -129,11 +129,11 @@ bool alarm_screen(void) talk_value(togo % 60, UNIT_MIN, true); talk_force_enqueue_next(); } - gui_syncsplash(HZ*2, str(LANG_ALARM_MOD_TIME_TO_GO), + splashf(HZ*2, str(LANG_ALARM_MOD_TIME_TO_GO), togo / 60, togo % 60); done = true; } else { - gui_syncsplash(HZ, ID2P(LANG_ALARM_MOD_ERROR)); + splash(HZ, ID2P(LANG_ALARM_MOD_ERROR)); update = true; } break; @@ -188,7 +188,7 @@ bool alarm_screen(void) case ACTION_STD_CANCEL: rtc_enable_alarm(false); - gui_syncsplash(HZ*2, ID2P(LANG_ALARM_MOD_DISABLE)); + splash(HZ*2, ID2P(LANG_ALARM_MOD_DISABLE)); done = true; break; diff --git a/apps/bookmark.c b/apps/bookmark.c index 0c3da641cb..524de5aff4 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c @@ -237,8 +237,8 @@ static bool write_bookmark(bool create_bookmark_file, const char *bookmark) } } - gui_syncsplash(HZ, success ? ID2P(LANG_BOOKMARK_CREATE_SUCCESS) - : ID2P(LANG_BOOKMARK_CREATE_FAILURE)); + splash(HZ, success ? ID2P(LANG_BOOKMARK_CREATE_SUCCESS) + : ID2P(LANG_BOOKMARK_CREATE_FAILURE)); return true; } @@ -400,7 +400,7 @@ bool bookmark_autoload(const char* file) if (!play_bookmark(bookmark)) { /* Selected bookmark not found. */ - gui_syncsplash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME)); + splash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME)); } /* Act as if autoload was done even if it failed, since the @@ -445,7 +445,7 @@ bool bookmark_load(const char* file, bool autoload) /* Selected bookmark not found. */ if (!autoload) { - gui_syncsplash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME)); + splash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME)); } return false; @@ -694,7 +694,7 @@ static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resu if (bookmarks->total_count < 1) { /* No more bookmarks, delete file and exit */ - gui_syncsplash(HZ, ID2P(LANG_BOOKMARK_LOAD_EMPTY)); + splash(HZ, ID2P(LANG_BOOKMARK_LOAD_EMPTY)); remove(bookmark_file_name); return NULL; } diff --git a/apps/codecs.c b/apps/codecs.c index 9df8ac58b7..417b546391 100644 --- a/apps/codecs.c +++ b/apps/codecs.c @@ -248,7 +248,7 @@ int codec_load_file(const char *plugin, struct codec_api *api) fd = open(path, O_RDONLY); if (fd < 0) { logf("Codec load error:%d", fd); - gui_syncsplash(HZ*2, "Couldn't load codec: %s", path); + splashf(HZ*2, "Couldn't load codec: %s", path); return fd; } diff --git a/apps/debug_menu.c b/apps/debug_menu.c index b2144e2169..72379f4104 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -2136,7 +2136,7 @@ static bool dbg_save_roms(void) restore_irq(old_irq_level); if (err) - gui_syncsplash(HZ*3, "Eeprom read failure (%d)",err); + splashf(HZ*3, "Eeprom read failure (%d)", err); else { write(fd, buf, sizeof buf); @@ -2233,7 +2233,7 @@ extern bool do_screendump_instead_of_usb; static bool dbg_screendump(void) { do_screendump_instead_of_usb = !do_screendump_instead_of_usb; - gui_syncsplash(HZ, "Screendump %s", + splashf(HZ, "Screendump %s", do_screendump_instead_of_usb?"enabled":"disabled"); return false; } @@ -2277,21 +2277,21 @@ static bool dbg_write_eeprom(void) err = eeprom_24cxx_write(0, buf, sizeof buf); if (err) - gui_syncsplash(HZ*3, "Eeprom write failure (%d)",err); + splashf(HZ*3, "Eeprom write failure (%d)", err); else - gui_syncsplash(HZ*3, "Eeprom written successfully"); + splash(HZ*3, "Eeprom written successfully"); restore_irq(old_irq_level); } else { - gui_syncsplash(HZ*3, "File read error (%d)",rc); + splashf(HZ*3, "File read error (%d)",rc); } close(fd); } else { - gui_syncsplash(HZ*3, "Failed to open 'internal_eeprom.bin'"); + splash(HZ*3, "Failed to open 'internal_eeprom.bin'"); } return false; @@ -2396,7 +2396,7 @@ static bool logf_usb_serial(void) { bool serial_enabled = !usb_core_driver_enabled(USB_DRIVER_SERIAL); usb_core_enable_driver(USB_DRIVER_SERIAL,serial_enabled); - gui_syncsplash(HZ, "USB logf %s", + splashf(HZ, "USB logf %s", serial_enabled?"enabled":"disabled"); return false; } @@ -2405,7 +2405,7 @@ static bool logf_usb_serial(void) #if defined(HAVE_USBSTACK) && defined(USB_STORAGE) static bool usb_reconnect(void) { - gui_syncsplash(HZ, "Reconnect mass storage"); + splash(HZ, "Reconnect mass storage"); usb_storage_reconnect(); return false; } diff --git a/apps/enc_config.c b/apps/enc_config.c index 9c5cd7d784..2368c9e065 100644 --- a/apps/enc_config.c +++ b/apps/enc_config.c @@ -403,7 +403,7 @@ bool enc_config_menu(struct encoder_config *cfg) } else { - gui_syncsplash(HZ, str(LANG_NO_SETTINGS)); + splash(HZ, str(LANG_NO_SETTINGS)); return false; } } /* enc_config_menu */ @@ -461,7 +461,7 @@ bool enc_global_config_menu(void) } else { - gui_syncsplash(HZ, str(LANG_NO_SETTINGS)); + splash(HZ, str(LANG_NO_SETTINGS)); return false; } } /* enc_global_config_menu */ diff --git a/apps/filetree.c b/apps/filetree.c index dd3cb5452d..2b883db8ea 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -92,7 +92,7 @@ bool ft_play_playlist(char* pathname, char* dirname, char* filename) { if (global_settings.party_mode) { - gui_syncsplash(HZ, ID2P(LANG_PARTY_MODE)); + splash(HZ, ID2P(LANG_PARTY_MODE)); return false; } @@ -101,7 +101,7 @@ bool ft_play_playlist(char* pathname, char* dirname, char* filename) return false; } - gui_syncsplash(0, ID2P(LANG_WAIT)); + splash(0, ID2P(LANG_WAIT)); /* about to create a new current playlist... allow user to cancel the operation */ @@ -397,7 +397,7 @@ int ft_enter(struct tree_context* c) if (bookmark_autoload(c->currdir)) break; - gui_syncsplash(0, ID2P(LANG_WAIT)); + splash(0, ID2P(LANG_WAIT)); /* about to create a new current playlist... allow user to cancel the operation */ @@ -408,7 +408,7 @@ int ft_enter(struct tree_context* c) { playlist_insert_track(NULL, buf, PLAYLIST_INSERT_LAST, true, true); - gui_syncsplash(HZ, ID2P(LANG_QUEUE_LAST)); + splash(HZ, ID2P(LANG_QUEUE_LAST)); } else if (playlist_create(c->currdir, NULL) != -1) { @@ -432,8 +432,7 @@ int ft_enter(struct tree_context* c) #if CONFIG_TUNER /* fmr preset file */ case FILE_ATTR_FMR: - - gui_syncsplash(0, ID2P(LANG_WAIT)); + splash(0, ID2P(LANG_WAIT)); /* Preset inside the default folder. */ if(!strncasecmp(FMPRESET_PATH, buf, strlen(FMPRESET_PATH))) @@ -460,7 +459,7 @@ int ft_enter(struct tree_context* c) /* wps config file */ case FILE_ATTR_WPS: - gui_syncsplash(0, ID2P(LANG_WAIT)); + splash(0, ID2P(LANG_WAIT)); #if LCD_DEPTH > 1 unload_wps_backdrop(); #endif @@ -472,7 +471,7 @@ int ft_enter(struct tree_context* c) #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) /* remote-wps config file */ case FILE_ATTR_RWPS: - gui_syncsplash(0, ID2P(LANG_WAIT)); + splash(0, ID2P(LANG_WAIT)); #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 unload_remote_wps_backdrop(); #endif @@ -483,39 +482,39 @@ int ft_enter(struct tree_context* c) #endif case FILE_ATTR_CFG: - gui_syncsplash(0, ID2P(LANG_WAIT)); + splash(0, ID2P(LANG_WAIT)); if (!settings_load_config(buf,true)) break; - gui_syncsplash(HZ, ID2P(LANG_SETTINGS_LOADED)); + splash(HZ, ID2P(LANG_SETTINGS_LOADED)); break; case FILE_ATTR_BMARK: - gui_syncsplash(0, ID2P(LANG_WAIT)); + splash(0, ID2P(LANG_WAIT)); bookmark_load(buf, false); reload_dir = true; break; case FILE_ATTR_LNG: - gui_syncsplash(0, ID2P(LANG_WAIT)); + splash(0, ID2P(LANG_WAIT)); if(!lang_load(buf)) { set_file(buf, (char *)global_settings.lang_file, MAX_FILENAME); talk_init(); /* use voice of same language */ - gui_syncsplash(HZ, ID2P(LANG_LANGUAGE_LOADED)); + splash(HZ, ID2P(LANG_LANGUAGE_LOADED)); } break; #ifdef HAVE_LCD_BITMAP case FILE_ATTR_FONT: - gui_syncsplash(0, ID2P(LANG_WAIT)); + splash(0, ID2P(LANG_WAIT)); font_load(buf); set_file(buf, (char *)global_settings.font_file, MAX_FILENAME); break; case FILE_ATTR_KBD: - gui_syncsplash(0, ID2P(LANG_WAIT)); + splash(0, ID2P(LANG_WAIT)); if (!load_kbd(buf)) - gui_syncsplash(HZ, ID2P(LANG_KEYBOARD_LOADED)); + splash(HZ, ID2P(LANG_KEYBOARD_LOADED)); set_file(buf, (char *)global_settings.kbd_file, MAX_FILENAME); break; #endif @@ -523,7 +522,7 @@ int ft_enter(struct tree_context* c) #ifndef SIMULATOR /* firmware file */ case FILE_ATTR_MOD: - gui_syncsplash(0, ID2P(LANG_WAIT)); + splash(0, ID2P(LANG_WAIT)); rolo_load(buf); break; #endif @@ -531,7 +530,7 @@ int ft_enter(struct tree_context* c) /* plugin file */ case FILE_ATTR_ROCK: if (global_settings.party_mode) { - gui_syncsplash(HZ, ID2P(LANG_PARTY_MODE)); + splash(HZ, ID2P(LANG_PARTY_MODE)); break; } @@ -555,7 +554,7 @@ int ft_enter(struct tree_context* c) const char* plugin; if (global_settings.party_mode) { - gui_syncsplash(HZ, ID2P(LANG_PARTY_MODE)); + splash(HZ, ID2P(LANG_PARTY_MODE)); break; } diff --git a/apps/filetypes.c b/apps/filetypes.c index b05942f324..b50814f7f2 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c @@ -106,7 +106,7 @@ static const struct filetype inbuilt_filetypes[] = { { "cue", FILE_ATTR_CUE, Icon_Bookmark, VOICE_EXT_CUESHEET }, #ifdef BOOTFILE_EXT { BOOTFILE_EXT, FILE_ATTR_MOD, Icon_Firmware, VOICE_EXT_AJZ }, -#endif /* #ifndef SIMULATOR */ +#endif }; void tree_get_filetypes(const struct filetype** types, int* count) @@ -300,7 +300,7 @@ static void read_config(char* config_file) { if (filetype_count >= MAX_FILETYPES) { - gui_syncsplash(HZ, ID2P(LANG_FILETYPES_FULL)); + splash(HZ, ID2P(LANG_FILETYPES_FULL)); break; } rm_whitespaces(line); @@ -485,7 +485,7 @@ int filetype_list_viewers(const char* current_file) if (count == 0) { /* FIX: translation! */ - gui_syncsplash(HZ*2, (unsigned char *)"No viewers found"); + splash(HZ*2, "No viewers found"); return PLUGIN_OK; } #endif diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c index 8db9ba92f5..87af8ae3ed 100644 --- a/apps/gui/color_picker.c +++ b/apps/gui/color_picker.c @@ -461,7 +461,7 @@ bool set_color(struct screen *display, char *title, unsigned *color, if (banned_color != (unsigned)-1 && banned_color == rgb.color) { - gui_syncsplash(HZ*2, ID2P(LANG_COLOR_UNACCEPTABLE)); + splash(HZ*2, ID2P(LANG_COLOR_UNACCEPTABLE)); break; } *color = rgb.color; diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 8c349ea35c..26c5c5d637 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -152,7 +152,7 @@ bool update_onvol_change(struct gui_wps * gwps) gui_wps_refresh(gwps, 0, WPS_REFRESH_NON_STATIC); #ifdef HAVE_LCD_CHARCELLS - gui_splash(gwps->display, 0, "Vol: %3d dB", + splashf(0, "Vol: %3d dB", sound_val2phys(SOUND_VOLUME, global_settings.volume)); return true; #endif @@ -329,7 +329,7 @@ bool gui_wps_display(void) #ifdef HAVE_LCD_BITMAP gui_syncstatusbar_draw(&statusbars, true); #endif - gui_syncsplash(HZ, ID2P(LANG_END_PLAYLIST)); + splash(HZ, ID2P(LANG_END_PLAYLIST)); return true; } else @@ -485,16 +485,11 @@ bool update(struct gui_wps *gwps) void display_keylock_text(bool locked) { - char* s; int i; FOR_NB_SCREENS(i) gui_wps[i].display->stop_scroll(); - if(locked) - s = str(LANG_KEYLOCK_ON); - else - s = str(LANG_KEYLOCK_OFF); - gui_syncsplash(HZ, s); + splash(HZ, locked ? ID2P(LANG_KEYLOCK_ON) : ID2P(LANG_KEYLOCK_OFF)); } #ifdef HAVE_LCD_BITMAP diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index c68a8b0f39..bbad56bf47 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -530,7 +530,7 @@ bool option_screen(const struct settings_list *setting, *variable = oldvalue; if (var_type == F_T_BOOL && !use_temp_var) *(bool*)setting->setting = (oldvalue==1); - gui_syncsplash(HZ/2, ID2P(LANG_CANCEL)); + splash(HZ/2, ID2P(LANG_CANCEL)); } done = true; } diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c index e0a7416ac6..2a568afc0a 100644 --- a/apps/gui/pitchscreen.c +++ b/apps/gui/pitchscreen.c @@ -109,7 +109,7 @@ static void pitch_screen_draw(struct screen *display, int pitch, int pitch_mode) w+1, (display->lcdheight-h)/2, 7, 8); /* "Pitch" */ - snprintf((char *)buf, sizeof(buf), str(LANG_PITCH)); + snprintf((char *)buf, sizeof(buf), "%s", str(LANG_PITCH)); display->getstringsize(buf,&w,&h); display->putsxy((display->lcdwidth-w)/2, (display->lcdheight/2)-h, buf); /* "XX.X%" */ diff --git a/apps/gui/splash.c b/apps/gui/splash.c index b4b451eed6..034e4a5912 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c @@ -45,7 +45,7 @@ #endif -static void splash(struct screen * screen, const char *fmt, va_list ap) +static void splash_internal(struct screen * screen, const char *fmt, va_list ap) { char splash_buf[MAXBUFFER]; short widths[MAXLINES]; @@ -187,41 +187,35 @@ static void splash(struct screen * screen, const char *fmt, va_list ap) screen->update(); } -void gui_splash(struct screen * screen, int ticks, - const char *fmt, ...) +void splashf(int ticks, const char *fmt, ...) { va_list ap; - va_start( ap, fmt ); - splash(screen, fmt, ap); - va_end( ap ); + int i; + + /* If fmt is a lang ID then get the corresponding string (which + still might contain % place holders). */ + fmt = P2STR((unsigned char *)fmt); + FOR_NB_SCREENS(i) + { + va_start(ap, fmt); + screens[i].set_viewport(NULL); + splash_internal(&(screens[i]), fmt, ap); + va_end(ap); + } if(ticks) sleep(ticks); } -void gui_syncsplash(int ticks, const char *fmt, ...) +void splash(int ticks, const char *str) { - va_list ap; - int i; #if !defined(SIMULATOR) || CONFIG_CODEC == SWCODEC long id; /* fmt may be a so called virtual pointer. See settings.h. */ - if((id = P2ID((unsigned char *)fmt)) >= 0) + if((id = P2ID((const unsigned char*)str)) >= 0) /* If fmt specifies a voicefont ID, and voice menus are enabled, then speak it. */ cond_talk_ids_fq(id); #endif - /* If fmt is a lang ID then get the corresponding string (which - still might contain % place holders). */ - fmt = P2STR((unsigned char *)fmt); - va_start( ap, fmt ); - FOR_NB_SCREENS(i) - { - screens[i].set_viewport(NULL); - splash(&(screens[i]), fmt, ap); - } - va_end( ap ); - - if(ticks) - sleep(ticks); + splashf(ticks, "%s", P2STR((const unsigned char*)str)); } diff --git a/apps/gui/splash.h b/apps/gui/splash.h index bb3c8727d1..1bbb9e9e49 100644 --- a/apps/gui/splash.h +++ b/apps/gui/splash.h @@ -24,21 +24,18 @@ #include <_ansi.h> #include "screen_access.h" -/* - * Puts a splash message centered on the given screen for a given period - * - screen : the screen to put the splash on - * - ticks : how long the splash is displayed (in rb ticks) - * - fmt : what to say *printf style - */ -extern void gui_splash(struct screen * screen, int ticks, - const char *fmt, ...) ATTRIBUTE_PRINTF(3, 4); - /* * Puts a splash message centered on all the screens for a given period * - ticks : how long the splash is displayed (in rb ticks) * - fmt : what to say *printf style */ -extern void gui_syncsplash(int ticks, const char *fmt, ...) - ATTRIBUTE_PRINTF(2, 3); +extern void splashf(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); +/* + * Puts a splash message centered on all the screens for a given period + * - ticks : how long the splash is displayed (in rb ticks) + * - str : what to say, if this is a LANG_* string (from ID2P) + * it will be voiced + */ +extern void splash(int ticks, const char *str); #endif /* _GUI_ICON_H_ */ diff --git a/apps/main.c b/apps/main.c index ecc80710a1..1f2625df6c 100644 --- a/apps/main.c +++ b/apps/main.c @@ -162,7 +162,7 @@ static int init_dircache(bool preinit) { /* This will be in default language, settings are not applied yet. Not really any easy way to fix that. */ - gui_syncsplash(0, str(LANG_SCANNING_DISK)); + splash(0, str(LANG_SCANNING_DISK)); clear = true; } @@ -180,7 +180,7 @@ static int init_dircache(bool preinit) { if (global_status.dircache_size <= 0) { - gui_syncsplash(0, str(LANG_SCANNING_DISK)); + splash(0, str(LANG_SCANNING_DISK)); clear = true; } result = dircache_build(global_status.dircache_size); @@ -191,7 +191,7 @@ static int init_dircache(bool preinit) /* Initialization of dircache failed. Manual action is * necessary to enable dircache again. */ - gui_syncsplash(0, "Dircache failed, disabled. Result: %d", result); + splashf(0, "Dircache failed, disabled. Result: %d", result); global_settings.dircache = false; } @@ -244,7 +244,7 @@ static void init_tagcache(void) } #endif #ifdef HAVE_LCD_BITMAP - gui_syncsplash(0, "%s [%d/%d]", + splashf(0, "%s [%d/%d]", str(LANG_TAGCACHE_INIT), ret, tagcache_get_max_commit_step()); #else @@ -504,7 +504,7 @@ static void init(void) if (button_hold()) #endif { - gui_syncsplash(HZ*2, str(LANG_RESET_DONE_CLEAR)); + splash(HZ*2, str(LANG_RESET_DONE_CLEAR)); settings_reset(); } else diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 2f3b63fd6c..35fd100b5b 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c @@ -406,7 +406,7 @@ static int info_action_callback(int action, struct gui_synclist *lists) #ifndef SIMULATOR struct info_data *info = (struct info_data *)lists->data; info->new_data = true; - gui_syncsplash(0, ID2P(LANG_SCANNING_DISK)); + splash(0, ID2P(LANG_SCANNING_DISK)); fat_recalc_free(IF_MV(0)); #ifdef HAVE_MULTIVOLUME if (fat_ismounted(1)) diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c index 0d5a85483c..eb1597948b 100644 --- a/apps/menus/playback_menu.c +++ b/apps/menus/playback_menu.c @@ -1,4 +1,3 @@ - /*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ @@ -143,7 +142,7 @@ static int audioscrobbler_callback(int action,const struct menu_item_ex *this_it { case ACTION_EXIT_MENUITEM: /* on exit */ if (!scrobbler_is_enabled() && global_settings.audioscrobbler) - gui_syncsplash(HZ*2, "%s", ID2P(LANG_PLEASE_REBOOT)); + splash(HZ*2, ID2P(LANG_PLEASE_REBOOT)); if(scrobbler_is_enabled() && !global_settings.audioscrobbler) scrobbler_shutdown(); @@ -161,7 +160,7 @@ static int cuesheet_callback(int action,const struct menu_item_ex *this_item) { case ACTION_EXIT_MENUITEM: /* on exit */ if (!cuesheet_is_enabled() && global_settings.cuesheet) - gui_syncsplash(HZ*2, "%s", ID2P(LANG_PLEASE_REBOOT)); + splash(HZ*2, ID2P(LANG_PLEASE_REBOOT)); break; } return action; diff --git a/apps/menus/recording_menu.c b/apps/menus/recording_menu.c index b55cba8061..4705afa2ff 100644 --- a/apps/menus/recording_menu.c +++ b/apps/menus/recording_menu.c @@ -325,7 +325,7 @@ MENUITEM_SETTING(rec_prerecord_time, &global_settings.rec_prerecord_time, NULL); static int clear_rec_directory(void) { strcpy(global_settings.rec_directory, REC_BASE_DIR); - gui_syncsplash(HZ, ID2P(LANG_RESET_DONE_CLEAR)); + splash(HZ, ID2P(LANG_RESET_DONE_CLEAR)); return false; } MENUITEM_FUNCTION(clear_rec_directory_item, 0, ID2P(LANG_CLEAR_REC_DIR), @@ -531,7 +531,7 @@ int rectrigger(void) switch (action) { case ACTION_STD_CANCEL: - gui_syncsplash(HZ/2, ID2P(LANG_CANCEL)); + splash(HZ/2, ID2P(LANG_CANCEL)); global_settings.rec_start_thres_db = old_start_thres_db; global_settings.rec_start_thres_linear = old_start_thres_linear; global_settings.rec_start_duration = old_start_duration; diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 93178e6af4..d5ddc168a0 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -57,13 +57,13 @@ static void tagcache_rebuild_with_splash(void) { tagcache_rebuild(); - gui_syncsplash(HZ*2, ID2P(LANG_TAGCACHE_FORCE_UPDATE_SPLASH)); + splash(HZ*2, ID2P(LANG_TAGCACHE_FORCE_UPDATE_SPLASH)); } static void tagcache_update_with_splash(void) { tagcache_update(); - gui_syncsplash(HZ*2, ID2P(LANG_TAGCACHE_FORCE_UPDATE_SPLASH)); + splash(HZ*2, ID2P(LANG_TAGCACHE_FORCE_UPDATE_SPLASH)); } #ifdef HAVE_TC_RAMCACHE @@ -187,7 +187,7 @@ static int dircache_callback(int action,const struct menu_item_ex *this_item) { case true: if (!dircache_is_enabled()) - gui_syncsplash(HZ*2, ID2P(LANG_PLEASE_REBOOT)); + splash(HZ*2, ID2P(LANG_PLEASE_REBOOT)); break; case false: if (dircache_is_enabled()) diff --git a/apps/misc.c b/apps/misc.c index f1f5c4aa12..401360d914 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -675,26 +675,24 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) if (!tagcache_prepare_shutdown()) { cancel_shutdown(); - gui_syncsplash(HZ, ID2P(LANG_TAGCACHE_BUSY)); + splash(HZ, ID2P(LANG_TAGCACHE_BUSY)); return false; } #endif if (battery_level() > 10) - gui_syncsplash(0, str(LANG_SHUTTINGDOWN)); + splash(0, str(LANG_SHUTTINGDOWN)); else { msg_id = LANG_WARNING_BATTERY_LOW; - gui_syncsplash(0, "%s %s", - str(LANG_WARNING_BATTERY_LOW), - str(LANG_SHUTTINGDOWN)); + splashf(0, "%s %s", str(LANG_WARNING_BATTERY_LOW), + str(LANG_SHUTTINGDOWN)); } } else { msg_id = LANG_WARNING_BATTERY_EMPTY; - gui_syncsplash(0, "%s %s", - str(LANG_WARNING_BATTERY_EMPTY), - str(LANG_SHUTTINGDOWN)); + splashf(0, "%s %s", str(LANG_WARNING_BATTERY_EMPTY), + str(LANG_SHUTTINGDOWN)); } if (global_settings.fade_on_stop diff --git a/apps/onplay.c b/apps/onplay.c index 2a70415b51..9ca0c6743e 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -166,7 +166,7 @@ static bool add_to_playlist(int position, bool queue) }; const struct text_message message={lines, 2}; - gui_syncsplash(0, ID2P(LANG_WAIT)); + splash(0, ID2P(LANG_WAIT)); if (new_playlist) playlist_create(NULL, NULL); @@ -476,7 +476,7 @@ static int remove_dir(char* dirname, int len) break; dirname[dirlen] ='\0'; - gui_syncsplash(0, dirname); + splash(0, dirname); /* append name to current directory */ snprintf(dirname+dirlen, len-dirlen, "/%s", entry->d_name); @@ -499,7 +499,7 @@ static int remove_dir(char* dirname, int len) } if(ACTION_STD_CANCEL == get_action(CONTEXT_STD,TIMEOUT_NOBLOCK)) { - gui_syncsplash(HZ, ID2P(LANG_CANCEL)); + splash(HZ, ID2P(LANG_CANCEL)); result = -1; break; } @@ -538,7 +538,7 @@ static bool delete_handler(bool is_dir) if(gui_syncyesno_run(&message, &yes_message, NULL)!=YESNO_YES) return false; - gui_syncsplash(0, str(LANG_DELETING)); + splash(0, str(LANG_DELETING)); int res; if (is_dir) @@ -574,13 +574,13 @@ static bool set_backdrop(void) { /* load the image */ if(load_main_backdrop(selected_file)) { - gui_syncsplash(HZ, str(LANG_BACKDROP_LOADED)); + splash(HZ, str(LANG_BACKDROP_LOADED)); set_file(selected_file, (char *)global_settings.backdrop_file, MAX_FILENAME); show_main_backdrop(); return true; } else { - gui_syncsplash(HZ, str(LANG_BACKDROP_FAILED)); + splash(HZ, str(LANG_BACKDROP_FAILED)); return false; } } @@ -630,8 +630,8 @@ static bool create_dir(void) rc = mkdir(dirname); if (rc < 0) { cond_talk_ids_fq(LANG_CREATE_DIR, LANG_FAILED); - gui_syncsplash(HZ, (unsigned char *)"%s %s", - str(LANG_CREATE_DIR), str(LANG_FAILED)); + splashf(HZ, (unsigned char *)"%s %s", str(LANG_CREATE_DIR), + str(LANG_FAILED)); } else { onplay_result = ONPLAY_RELOAD_DIR; } @@ -886,11 +886,11 @@ static bool clipboard_paste(void) } if (clipboard_is_copy) { - gui_syncsplash(0, ID2P(LANG_COPYING)); + splash(0, ID2P(LANG_COPYING)); } else { - gui_syncsplash(0, ID2P(LANG_MOVING)); + splash(0, ID2P(LANG_MOVING)); } /* Now figure out what we're doing */ @@ -930,8 +930,8 @@ static bool clipboard_paste(void) onplay_result = ONPLAY_RELOAD_DIR; } else { cond_talk_ids_fq(LANG_PASTE, LANG_FAILED); - gui_syncsplash(HZ, (unsigned char *)"%s %s", - str(LANG_PASTE), str(LANG_FAILED)); + splashf(HZ, (unsigned char *)"%s %s", str(LANG_PASTE), + str(LANG_FAILED)); } return true; @@ -949,7 +949,7 @@ static int set_rating_inline(void) tagcache_update_numeric(id3->tagcache_idx-1, tag_rating, id3->rating); } else - gui_syncsplash(HZ*2, ID2P(LANG_ID3_NO_INFO)); + splash(HZ*2, ID2P(LANG_ID3_NO_INFO)); return 0; } static int ratingitem_callback(int action,const struct menu_item_ex *this_item) diff --git a/apps/playback.c b/apps/playback.c index daa9ab3f2e..ee1993a2da 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -822,7 +822,7 @@ void audio_set_crossfade(int enable) { /* Store the track resume position */ offset = curtrack_id3.offset; - gui_syncsplash(0, str(LANG_RESTARTING_PLAYBACK)); + splash(0, str(LANG_RESTARTING_PLAYBACK)); } /* Blast it - audio buffer will have to be setup again next time @@ -1334,7 +1334,7 @@ static void codec_thread(void) if (!ci.new_track) { logf("Codec failure"); - gui_syncsplash(HZ*2, "Codec failure"); + splash(HZ*2, "Codec failure"); } if (!codec_load_next_track()) @@ -1395,7 +1395,7 @@ static void codec_thread(void) break; logf("Encoder failure"); - gui_syncsplash(HZ*2, "Encoder failure"); + splash(HZ*2, "Encoder failure"); if (ci.enc_codec_loaded < 0) break; @@ -1717,7 +1717,6 @@ static bool audio_load_track(size_t offset, bool start_play) buffering_handle_finished_callback callback. */ static void audio_finish_load_track(void) { - char msgbuf[80]; size_t file_offset = 0; size_t offset = 0; bool start_play = start_play_g; @@ -1791,9 +1790,8 @@ static void audio_finish_load_track(void) /* This is an error condition, either no codec was found, or reading * the codec file failed part way through, either way, skip the track */ - snprintf(msgbuf, sizeof(msgbuf)-1, "No codec for: %s", track_id3->path); - /* We should not use gui_syncplash from audio thread! */ - gui_syncsplash(HZ*2, msgbuf); + /* FIXME: We should not use splashf from audio thread! */ + splashf(HZ*2, "No codec for: %s", track_id3->path); /* Skip invalid entry from playlist. */ playlist_skip_entry(NULL, last_peek_offset); return; diff --git a/apps/playlist.c b/apps/playlist.c index 4457de853a..9c494778a3 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -347,7 +347,7 @@ static void create_control(struct playlist_info* playlist) if (check_rockboxdir()) { cond_talk_ids_fq(LANG_PLAYLIST_CONTROL_ACCESS_ERROR); - gui_syncsplash(HZ*2, (unsigned char *)"%s (%d)", + splashf(HZ*2, (unsigned char *)"%s (%d)", str(LANG_PLAYLIST_CONTROL_ACCESS_ERROR), playlist->control_fd); } @@ -536,7 +536,7 @@ static int add_indices_to_playlist(struct playlist_info* playlist, if((i = lseek(playlist->fd, 0, SEEK_CUR)) > 0) playlist->utf8 = true; /* Override any earlier indication. */ - gui_syncsplash(0, ID2P(LANG_WAIT)); + splash(0, ID2P(LANG_WAIT)); if (!buffer) { @@ -1426,9 +1426,9 @@ static int get_filename(struct playlist_info* playlist, int index, int seek, if (max < 0) { if (control_file) - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); else - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); return max; } @@ -1523,7 +1523,7 @@ static int get_next_dir(char *dir, bool is_forward, bool recursion) if (ft_load(tc, (dir[0]=='\0')?"/":dir) < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); exit = true; result = -1; break; @@ -1604,7 +1604,7 @@ static int check_subdir_for_music(char *dir, char *subdir, bool recurse) if (ft_load(tc, dir) < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); return -2; } @@ -1657,8 +1657,7 @@ static int check_subdir_for_music(char *dir, char *subdir, bool recurse) /* we now need to reload our current directory */ if(ft_load(tc, dir) < 0) - gui_syncsplash(HZ*2, - ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); } return result; } @@ -1747,7 +1746,7 @@ static void display_playlist_count(int count, const unsigned char *fmt, } fmt = P2STR(fmt); - gui_syncsplash(0, fmt, count, str(LANG_OFF_ABORT)); + splashf(0, fmt, count, str(LANG_OFF_ABORT)); } /* @@ -1755,7 +1754,7 @@ static void display_playlist_count(int count, const unsigned char *fmt, */ static void display_buffer_full(void) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_BUFFER_FULL)); + splash(HZ*2, ID2P(LANG_PLAYLIST_BUFFER_FULL)); } /* @@ -1834,7 +1833,7 @@ static int flush_cached_control(struct playlist_info* playlist) else { result = -1; - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); } return result; @@ -2021,11 +2020,11 @@ int playlist_resume(void) empty_playlist(playlist, true); - gui_syncsplash(0, ID2P(LANG_WAIT)); + splash(0, ID2P(LANG_WAIT)); playlist->control_fd = open(playlist->control_filename, O_RDWR); if (playlist->control_fd < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } playlist->control_created = true; @@ -2033,7 +2032,7 @@ int playlist_resume(void) control_file_size = filesize(playlist->control_fd); if (control_file_size <= 0) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } @@ -2042,7 +2041,7 @@ int playlist_resume(void) PLAYLIST_COMMAND_SIZE HZ/4) { - gui_syncsplash(0, str(LANG_LOADING_PERCENT), - (total_read+count)*100/control_file_size, - str(LANG_OFF_ABORT)); + splashf(0, str(LANG_LOADING_PERCENT), + (total_read+count)*100/control_file_size, + str(LANG_OFF_ABORT)); if (action_userabort(TIMEOUT_NOBLOCK)) { useraborted = true; @@ -2337,13 +2336,13 @@ int playlist_resume(void) if (result < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_INVALID)); + splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_INVALID)); return result; } if (useraborted) { - gui_syncsplash(HZ*2, ID2P(LANG_CANCEL)); + splash(HZ*2, ID2P(LANG_CANCEL)); return -1; } if (!newline || (exit_loop && count= control_file_size) { /* no newline at end of control file */ - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_INVALID)); + splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_INVALID)); return -1; } @@ -2861,7 +2860,7 @@ int playlist_insert_track(struct playlist_info* playlist, const char *filename, if (check_control(playlist) < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } @@ -2892,7 +2891,7 @@ int playlist_insert_directory(struct playlist_info* playlist, if (check_control(playlist) < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } @@ -2959,14 +2958,14 @@ int playlist_insert_playlist(struct playlist_info* playlist, const char *filenam if (check_control(playlist) < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } fd = open_utf8(filename, O_RDONLY); if (fd < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); return -1; } @@ -3087,7 +3086,7 @@ int playlist_delete(struct playlist_info* playlist, int index) if (check_control(playlist) < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } @@ -3122,7 +3121,7 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index) if (check_control(playlist) < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_CONTROL_ACCESS_ERROR)); return -1; } @@ -3385,7 +3384,7 @@ int playlist_save(struct playlist_info* playlist, char *filename) if (playlist->buffer_size < (int)(playlist->amount * sizeof(int))) { /* not enough buffer space to store updated indices */ - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); return -1; } @@ -3409,7 +3408,7 @@ int playlist_save(struct playlist_info* playlist, char *filename) } if (fd < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); return -1; } @@ -3450,7 +3449,7 @@ int playlist_save(struct playlist_info* playlist, char *filename) if (fdprintf(fd, "%s\n", tmp_buf) < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_ACCESS_ERROR)); result = -1; break; } @@ -3538,7 +3537,7 @@ int playlist_directory_tracksearch(const char* dirname, bool recurse, if (ft_load(tc, dirname) < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); + splash(HZ*2, ID2P(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR)); *(tc->dirfilter) = old_dirfilter; return -1; } diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index cadad9f464..ef2c1d13d5 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c @@ -96,8 +96,7 @@ static int initialize_catalog(void) if (!playlist_dir_exists) { if (mkdir(playlist_dir) < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_CATALOG_NO_DIRECTORY), - playlist_dir); + splashf(HZ*2, ID2P(LANG_CATALOG_NO_DIRECTORY), playlist_dir); return -1; } else { @@ -130,8 +129,7 @@ static int create_playlist_list(char** playlists, int num_items, if (ft_load(tc, playlist_dir) < 0) { - gui_syncsplash(HZ*2, ID2P(LANG_CATALOG_NO_DIRECTORY), - playlist_dir); + splashf(HZ*2, ID2P(LANG_CATALOG_NO_DIRECTORY), playlist_dir); goto exit; } @@ -234,7 +232,7 @@ static int display_playlists(char* playlist, bool view) if (num_playlists <= 0) { - gui_syncsplash(HZ*2, ID2P(LANG_CATALOG_NO_PLAYLISTS)); + splash(HZ*2, ID2P(LANG_CATALOG_NO_PLAYLISTS)); return -1; } @@ -327,8 +325,7 @@ static void display_insert_count(int count) talk_id(LANG_PLAYLIST_INSERT_COUNT, true); } - gui_syncsplash(0, str(LANG_PLAYLIST_INSERT_COUNT), count, - str(LANG_OFF_ABORT)); + splashf(0, str(LANG_PLAYLIST_INSERT_COUNT), count, str(LANG_OFF_ABORT)); } /* Add specified track into playlist. Callback from directory insert */ diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index 0d59354804..62e755a53a 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c @@ -293,7 +293,7 @@ static bool playlist_viewer_init(struct playlist_viewer * viewer, if (!have_list) { /* Nothing to view, exit */ - gui_syncsplash(HZ, str(LANG_CATALOG_NO_PLAYLISTS)); + splash(HZ, str(LANG_CATALOG_NO_PLAYLISTS)); return false; } @@ -680,8 +680,8 @@ bool playlist_viewer_ex(const char* filename) ret_val = playlist_move(viewer.playlist, viewer.move_track, current_track->index); if (ret_val < 0) - gui_syncsplash(HZ, (unsigned char *)"%s %s", - str(LANG_MOVE), str(LANG_FAILED)); + splashf(HZ, (unsigned char *)"%s %s", str(LANG_MOVE), + str(LANG_FAILED)); update_playlist(true); viewer.move_track = -1; } @@ -795,7 +795,7 @@ bool search_playlist(void) playlist_count = playlist_amount_ex(viewer.playlist); for (i=0;(imagic != PLUGIN_MAGIC || hdr->target_id != TARGET_ID) { sim_plugin_close(pd); - gui_syncsplash(HZ*2, str(LANG_PLUGIN_WRONG_MODEL)); + splash(HZ*2, str(LANG_PLUGIN_WRONG_MODEL)); return -1; } if (hdr->api_version > PLUGIN_API_VERSION || hdr->api_version < PLUGIN_MIN_API_VERSION) { sim_plugin_close(pd); - gui_syncsplash(HZ*2, str(LANG_PLUGIN_WRONG_VERSION)); + splash(HZ*2, str(LANG_PLUGIN_WRONG_VERSION)); return -1; } #else fd = open(plugin, O_RDONLY); if (fd < 0) { - gui_syncsplash(HZ*2, str(LANG_PLUGIN_CANT_OPEN), plugin); + splashf(HZ*2, str(LANG_PLUGIN_CANT_OPEN), plugin); return fd; } #if NUM_CORES > 1 @@ -678,7 +679,7 @@ int plugin_load(const char* plugin, const void* parameter) close(fd); if (readsize < 0) { - gui_syncsplash(HZ*2, str(LANG_READ_FAILED), plugin); + splashf(HZ*2, str(LANG_READ_FAILED), plugin); return -1; } hdr = (struct plugin_header *)pluginbuf; @@ -688,12 +689,12 @@ int plugin_load(const char* plugin, const void* parameter) || hdr->target_id != TARGET_ID || hdr->load_addr != pluginbuf || hdr->end_addr > pluginbuf + PLUGIN_BUFFER_SIZE) { - gui_syncsplash(HZ*2, str(LANG_PLUGIN_WRONG_MODEL)); + splash(HZ*2, str(LANG_PLUGIN_WRONG_MODEL)); return -1; } if (hdr->api_version > PLUGIN_API_VERSION || hdr->api_version < PLUGIN_MIN_API_VERSION) { - gui_syncsplash(HZ*2, str(LANG_PLUGIN_WRONG_VERSION)); + splash(HZ*2, str(LANG_PLUGIN_WRONG_VERSION)); return -1; } plugin_size = hdr->end_addr - pluginbuf; @@ -768,7 +769,7 @@ int plugin_load(const char* plugin, const void* parameter) return PLUGIN_USB_CONNECTED; default: - gui_syncsplash(HZ*2, str(LANG_PLUGIN_ERROR)); + splash(HZ*2, str(LANG_PLUGIN_ERROR)); break; } return PLUGIN_OK; diff --git a/apps/plugin.h b/apps/plugin.h index 373795b145..fa5993d97f 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -130,12 +130,12 @@ void* plugin_get_buffer(size_t *buffer_size); #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 121 +#define PLUGIN_API_VERSION 122 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define PLUGIN_MIN_API_VERSION 121 +#define PLUGIN_MIN_API_VERSION 122 /* plugin return codes */ enum plugin_status { @@ -256,7 +256,8 @@ struct plugin_api { void (*backlight_set_timeout_plugged)(int index); #endif bool (*is_backlight_on)(bool ignore_always_off); - void (*splash)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); + void (*splash)(int ticks, const char *str); + void (*splashf)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); #ifdef HAVE_REMOTE_LCD /* remote lcd */ diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c index 97aef29b57..be94036f4e 100644 --- a/apps/plugins/bubbles.c +++ b/apps/plugins/bubbles.c @@ -2319,7 +2319,7 @@ static int bubbles_handlebuttons(struct game_context* bb, bool animblock, case BUBBLES_START: /* pause the game */ start = *rb->current_tick; - rb->splash(1, "Paused"); + rb->splash(0, "Paused"); while(pluginlib_getaction(rb,TIMEOUT_BLOCK,plugin_contexts,2) != (BUBBLES_START)); bb->startedshot += *rb->current_tick-start; diff --git a/apps/plugins/iriverify.c b/apps/plugins/iriverify.c index c88ddc7b09..7e77ae3e69 100644 --- a/apps/plugins/iriverify.c +++ b/apps/plugins/iriverify.c @@ -159,13 +159,13 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame FOR_NB_SCREENS(i) rb->screens[i]->clear_display(); if(rc < 0) { - rb->splash(HZ, "Can't write file: %d", rc); + rb->splashf(HZ, "Can't write file: %d", rc); } else { rb->splash(HZ, "Done"); } } else { if(rc < 0) { - rb->splash(HZ, "Can't read file: %d", rc); + rb->splashf(HZ, "Can't read file: %d", rc); } else { rb->splash(HZ, "The file is too big"); } diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c index 48735a2b44..7f4cd4bd41 100644 --- a/apps/plugins/jewels.c +++ b/apps/plugins/jewels.c @@ -1261,7 +1261,7 @@ static void jewels_nextlevel(struct game_context* bj) { while(bj->score >= LEVEL_PTS) { bj->score -= LEVEL_PTS; bj->level++; - rb->splash(HZ*2, "Level %d", bj->level); + rb->splashf(HZ*2, "Level %d", bj->level); jewels_drawboard(bj); } @@ -1283,7 +1283,7 @@ static void jewels_nextlevel(struct game_context* bj) { rb->splash(HZ*2, "You win!"); bj->level = 1; } else { - rb->splash(HZ*2, "Level %d", bj->level); + rb->splashf(HZ*2, "Level %d", bj->level); } break; } diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c index a17c6d7729..ffc9d49a98 100644 --- a/apps/plugins/jpeg.c +++ b/apps/plugins/jpeg.c @@ -3026,7 +3026,7 @@ struct t_disp* get_image(struct jpeg* p_jpg, int ds) #endif if (status) { - rb->splash(HZ, "decode error %d", status); + rb->splashf(HZ, "decode error %d", status); file_pt[curfile] = '\0'; return NULL; } @@ -3212,7 +3212,7 @@ int load_and_show(char* filename) if (status < 0 || (status & (DQT | SOF0)) != (DQT | SOF0)) { /* bad format or minimum components not contained */ - rb->splash(HZ, "unsupported %d", status); + rb->splashf(HZ, "unsupported %d", status); file_pt[curfile] = '\0'; return change_filename(direction); } diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c index 389299d580..fef3d4f23a 100644 --- a/apps/plugins/keybox.c +++ b/apps/plugins/keybox.c @@ -312,9 +312,9 @@ static void splash_pw(int selected_item) entry = entry->next; } if (entry->name != '\0') - rb->splash(0, "%s %s", entry->name, entry->password); + rb->splashf(0, "%s %s", entry->name, entry->password); else - rb->splash(0, "%s", entry->password); + rb->splashf(0, "%s", entry->password); rb->get_action(CONTEXT_STD, TIMEOUT_BLOCK); } diff --git a/apps/plugins/lib/overlay.c b/apps/plugins/lib/overlay.c index a779722d88..706d6c14a7 100644 --- a/apps/plugins/lib/overlay.c +++ b/apps/plugins/lib/overlay.c @@ -57,7 +57,7 @@ enum plugin_status run_overlay(const struct plugin_api* rb, const void* paramete fd = rb->open(filename, O_RDONLY); if (fd < 0) { - rb->splash(2*HZ, "Can't open %s", filename); + rb->splashf(2*HZ, "Can't open %s", filename); return PLUGIN_ERROR; } readsize = rb->read(fd, &header, sizeof(header)); @@ -67,17 +67,17 @@ enum plugin_status run_overlay(const struct plugin_api* rb, const void* paramete if (readsize != sizeof(header)) { - rb->splash(2*HZ, "Reading %s overlay failed.", name); + rb->splashf(2*HZ, "Reading %s overlay failed.", name); return PLUGIN_ERROR; } if (header.magic != PLUGIN_MAGIC || header.target_id != TARGET_ID) { - rb->splash(2*HZ, "%s overlay: Incompatible model.", name); + rb->splashf(2*HZ, "%s overlay: Incompatible model.", name); return PLUGIN_ERROR; } if (header.api_version != PLUGIN_API_VERSION) { - rb->splash(2*HZ, "%s overlay: Incompatible version.", name); + rb->splashf(2*HZ, "%s overlay: Incompatible version.", name); return PLUGIN_ERROR; } @@ -85,14 +85,14 @@ enum plugin_status run_overlay(const struct plugin_api* rb, const void* paramete if (header.load_addr < audiobuf || header.end_addr > audiobuf + audiobuf_size) { - rb->splash(2*HZ, "%s overlay doesn't fit into memory.", name); + rb->splashf(2*HZ, "%s overlay doesn't fit into memory.", name); return PLUGIN_ERROR; } fd = rb->open(filename, O_RDONLY); if (fd < 0) { - rb->splash(2*HZ, "Can't open %s", filename); + rb->splashf(2*HZ, "Can't open %s", filename); return PLUGIN_ERROR; } readsize = rb->read(fd, header.load_addr, header.end_addr - header.load_addr); @@ -100,7 +100,7 @@ enum plugin_status run_overlay(const struct plugin_api* rb, const void* paramete if (readsize < 0) { - rb->splash(2*HZ, "Reading %s overlay failed.", name); + rb->splashf(2*HZ, "Reading %s overlay failed.", name); return PLUGIN_ERROR; } /* Zero out bss area */ diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c index 1868601cd9..c1726a5e95 100644 --- a/apps/plugins/mazezam.c +++ b/apps/plugins/mazezam.c @@ -715,7 +715,7 @@ static void play_level(short level, short lives, bool new_level) */ rb->lcd_remote_clear_display(); #endif - rb->splash(MAZEZAM_DELAY_LIVES, MAZEZAM_TEXT_LIVES, + rb->splashf(MAZEZAM_DELAY_LIVES, MAZEZAM_TEXT_LIVES, level+1, lives); /* ensure keys pressed during the splash screen are ignored */ diff --git a/apps/plugins/md5sum.c b/apps/plugins/md5sum.c index 084256badf..f95cd20f20 100644 --- a/apps/plugins/md5sum.c +++ b/apps/plugins/md5sum.c @@ -58,7 +58,7 @@ static void hash_file( int out, const char *path ) { char string[MD5_STRING_LENGTH+1]; done++; - rb->splash( 0, "%d / %d : %s", done, count, path ); + rb->splashf( 0, "%d / %d : %s", done, count, path ); if( hash( string, path ) ) rb->write( out, "error", 5 ); else @@ -140,7 +140,7 @@ static void hash_check( int out, const char *path ) { const char *filename = rb->strchr( line, ' ' ); done++; - rb->splash( 0, "%d / %d : %s", done, count, filename ); + rb->splashf( 0, "%d / %d : %s", done, count, filename ); if( !filename || len < MD5_STRING_LENGTH + 2 ) { const char error[] = "Malformed input line ... skipping"; diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c index 16cc0fcd87..266d12fc8d 100644 --- a/apps/plugins/minesweeper.c +++ b/apps/plugins/minesweeper.c @@ -749,12 +749,12 @@ enum minesweeper_status minesweeper( void ) break; flags_used = count_flags(); if (flags_used == 1) { - rb->splash( HZ*2, "You marked 1 field. There are %d mines.", + rb->splashf( HZ*2, "You marked 1 field. There are %d mines.", mine_num ); } else { - rb->splash( HZ*2, "You marked %d fields. There are %d mines.", + rb->splashf( HZ*2, "You marked %d fields. There are %d mines.", flags_used, mine_num ); } break; diff --git a/apps/plugins/mpegplayer/disk_buf.c b/apps/plugins/mpegplayer/disk_buf.c index f37797bc9e..7ba4025f1e 100644 --- a/apps/plugins/mpegplayer/disk_buf.c +++ b/apps/plugins/mpegplayer/disk_buf.c @@ -151,7 +151,7 @@ static inline void disk_buf_buffer(void) wm : AVERAGE(disk_buf.low_wm, wm, 16); #if 0 - rb->splash(0, "*%10ld %10ld", disk_buf.low_wm, + rb->splashf(0, "*%10ld %10ld", disk_buf.low_wm, disk_buf.win_right - sw.right); #endif diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index c775a14f65..c58a2f6d0f 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c @@ -1674,7 +1674,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame errstring = "Error opening file: %d"; } - rb->splash(HZ*2, errstring, err); + rb->splashf(HZ*2, errstring, err); } } diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c index 16860f9d25..c4ee037b5a 100644 --- a/apps/plugins/pacbox/pacbox.c +++ b/apps/plugins/pacbox/pacbox.c @@ -421,7 +421,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame SETTINGS_VERSION); } } else { - rb->splash(HZ*2, "No ROMs in %s/pacman/", ROCKBOX_DIR); + rb->splashf(HZ*2, "No ROMs in %s/pacman/", ROCKBOX_DIR); } #ifdef HAVE_ADJUSTABLE_CPU_FREQ diff --git a/apps/plugins/ppmviewer.c b/apps/plugins/ppmviewer.c index 4c24a5d5f4..01513c4877 100644 --- a/apps/plugins/ppmviewer.c +++ b/apps/plugins/ppmviewer.c @@ -36,7 +36,7 @@ PLUGIN_HEADER #define PPM_OVERALLMAXVAL 65535 #define PPM_MAXSIZE (300*1024)/sizeof(fb_data) -#define ppm_error(...) rb->splash(HZ*2, __VA_ARGS__ ) +#define ppm_error(...) rb->splashf(HZ*2, __VA_ARGS__ ) static fb_data buffer[PPM_MAXSIZE]; static fb_data lcd_buf[LCD_WIDTH * LCD_HEIGHT]; diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c index 86955a7b57..22288d406f 100644 --- a/apps/plugins/properties.c +++ b/apps/plugins/properties.c @@ -292,7 +292,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame if(!found) { /* weird: we couldn't find the entry. This Should Never Happen (TM) */ - rb->splash(0, "File/Dir not found: %s", file); + rb->splashf(0, "File/Dir not found: %s", file); rb->action_userabort(TIMEOUT_BLOCK); return PLUGIN_OK; } diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index c03a794e73..3df38082ba 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c @@ -219,7 +219,7 @@ void generate(void) rb->write(fd,&dirs_count,sizeof(int)); if (fd < 0) { - rb->splash(HZ, "Couldnt open %s", RFA_FILE); + rb->splashf(HZ, "Couldnt open %s", RFA_FILE); return; } #ifndef HAVE_LCD_CHARCELLS @@ -295,7 +295,7 @@ int edit_list(void) /* load the dat file if not already done */ if ((list == NULL || list->count == 0) && (i = load_list()) != 0) { - rb->splash(HZ*2, "Could not load %s, rv = %d", RFA_FILE, i); + rb->splashf(HZ*2, "Could not load %s, rv = %d", RFA_FILE, i); return -1; } @@ -387,13 +387,13 @@ int export_list_to_file_text(void) /* load the dat file if not already done */ if ((list == NULL || list->count == 0) && (i = load_list()) != 0) { - rb->splash(HZ*2, "Could not load %s, rv = %d", RFA_FILE, i); + rb->splashf(HZ*2, "Could not load %s, rv = %d", RFA_FILE, i); return 0; } if (list->count <= 0) { - rb->splash(HZ*2, "no dirs in list file: %s", RFA_FILE); + rb->splashf(HZ*2, "no dirs in list file: %s", RFA_FILE); return 0; } @@ -401,7 +401,7 @@ int export_list_to_file_text(void) int myfd = rb->creat(RFA_FILE_TEXT); if (myfd < 0) { - rb->splash(HZ*4, "failed to open: fd = %d, file = %s", + rb->splashf(HZ*4, "failed to open: fd = %d, file = %s", myfd, RFA_FILE_TEXT); return -1; } @@ -434,7 +434,7 @@ int import_list_from_file_text(void) int myfd = rb->open(RFA_FILE_TEXT, O_RDONLY); if (myfd < 0) { - rb->splash(HZ*2, "failed to open: %s", RFA_FILE_TEXT); + rb->splashf(HZ*2, "failed to open: %s", RFA_FILE_TEXT); return -1; } diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index c4e6328923..6436d9baa5 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c @@ -2520,12 +2520,12 @@ static void goto_menu(void) { if( load_bitmap( filename ) <= 0 ) { - rb->splash( 1*HZ, "Error while loading %s", + rb->splashf( 1*HZ, "Error while loading %s", filename ); } else { - rb->splash( 1*HZ, "Image loaded (%s)", filename ); + rb->splashf( 1*HZ, "Image loaded (%s)", filename ); restore_screen(); inv_cursor(true); return; @@ -2542,7 +2542,7 @@ static void goto_menu(void) rb->strcasecmp(&filename[rb->strlen(filename)-4], ".bmp")) rb->strcat(filename, ".bmp"); save_bitmap( filename ); - rb->splash( 1*HZ, "File saved (%s)", filename ); + rb->splashf( 1*HZ, "File saved (%s)", filename ); } break; @@ -3011,7 +3011,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame } else { - rb->splash( 1*HZ, "Image loaded (%s)", (char *)parameter ); + rb->splashf( 1*HZ, "Image loaded (%s)", (char *)parameter ); restore_screen(); rb->strcpy( filename, parameter ); } diff --git a/apps/plugins/shortcuts/shortcuts_append.c b/apps/plugins/shortcuts/shortcuts_append.c index 0e73d2caa1..0d74767a87 100644 --- a/apps/plugins/shortcuts/shortcuts_append.c +++ b/apps/plugins/shortcuts/shortcuts_append.c @@ -85,7 +85,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* void_p if (!found) { /* Something's gone properly pear shaped - * we couldn't even find the entry */ - rb->splash(HZ*2, "File/Dir not found: %s", parameter); + rb->splashf(HZ*2, "File/Dir not found: %s", parameter); return PLUGIN_ERROR; } diff --git a/apps/plugins/shortcuts/shortcuts_common.c b/apps/plugins/shortcuts/shortcuts_common.c index 231c72df09..0ea18c06a2 100644 --- a/apps/plugins/shortcuts/shortcuts_common.c +++ b/apps/plugins/shortcuts/shortcuts_common.c @@ -90,7 +90,7 @@ bool load_sc_file(sc_file_t *file, char *filename, bool must_exist, if (fd < 0){ /* For some reason we couldn't create the file, * so return an error message and exit */ - rb->splash(HZ*2, "Couldn't create the shortcuts file %s", + rb->splashf(HZ*2, "Couldn't create the shortcuts file %s", filename); goto end_of_proc; } @@ -98,7 +98,7 @@ bool load_sc_file(sc_file_t *file, char *filename, bool must_exist, ret_val = true; goto end_of_proc; } else { - rb->splash(HZ, "Couldn't open %s", filename); + rb->splashf(HZ, "Couldn't open %s", filename); goto end_of_proc; } } @@ -108,7 +108,7 @@ bool load_sc_file(sc_file_t *file, char *filename, bool must_exist, continue; } if (file->entry_cnt >= file->max_entries) { - rb->splash(HZ*2, "Too many entries in the file, max allowed: %d", + rb->splashf(HZ*2, "Too many entries in the file, max allowed: %d", file->max_entries); goto end_of_proc; } @@ -320,7 +320,7 @@ bool dump_sc_file(sc_file_t *file, char *filename) * thing. */ fd = rb->open(filename, O_WRONLY|O_TRUNC); if (fd < 0) { - rb->splash(HZ*2, "Could not open shortcuts file %s for writing", + rb->splashf(HZ*2, "Could not open shortcuts file %s for writing", filename); return false; } diff --git a/apps/plugins/shortcuts/shortcuts_view.c b/apps/plugins/shortcuts/shortcuts_view.c index e6b89b7641..09b25480e8 100644 --- a/apps/plugins/shortcuts/shortcuts_view.c +++ b/apps/plugins/shortcuts/shortcuts_view.c @@ -149,7 +149,7 @@ bool list_sc(bool is_editable) case SCLA_SELECT: return goto_entry(sc_file.entries[selected_item].path); case SCLA_DELETE: - rb->splash(HZ, "Deleting %s", sc_file.entries[selected_item].disp); + rb->splashf(HZ, "Deleting %s", sc_file.entries[selected_item].disp); remove_entry(&sc_file, selected_item); dump_sc_file(&sc_file, link_filename); return (sc_file.entry_cnt == 0); @@ -175,7 +175,7 @@ bool goto_entry(char *file_or_dir) } if (!exists) { - rb->splash(HZ*2, "%s %s no longer exists on disk", what, file_or_dir); + rb->splashf(HZ*2, "%s %s no longer exists on disk", what, file_or_dir); return false; } /* Set the browsers dirfilter to the global setting diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index 77813a5104..4e8263aadf 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c @@ -618,7 +618,7 @@ static bool read_levels(bool initialize) buffered_boards.start = 0; if ((fd = rb->open(buffered_boards.filename, O_RDONLY)) < 0) { - rb->splash(HZ*2, "Unable to open %s", buffered_boards.filename); + rb->splashf(HZ*2, "Unable to open %s", buffered_boards.filename); return false; } @@ -930,7 +930,7 @@ static bool save(char *filename, bool solution) if (filename[0] == '\0' || (fd = rb->open(filename, O_WRONLY|O_CREAT|O_TRUNC)) < 0) { - rb->splash(HZ*2, "Unable to open %s", filename); + rb->splashf(HZ*2, "Unable to open %s", filename); return false; } @@ -965,7 +965,7 @@ static bool load(char *filename, bool silent) if (filename[0] == '\0' || (fd = rb->open(filename, O_RDONLY)) < 0) { if (!silent) - rb->splash(HZ*2, "Unable to open %s", filename); + rb->splashf(HZ*2, "Unable to open %s", filename); return false; } diff --git a/apps/plugins/sort.c b/apps/plugins/sort.c index a313bb1bd6..5292400b0f 100644 --- a/apps/plugins/sort.c +++ b/apps/plugins/sort.c @@ -207,7 +207,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame rc = write_file(); if(rc < 0) { rb->lcd_clear_display(); - rb->splash(HZ, "Can't write file: %d", rc); + rb->splashf(HZ, "Can't write file: %d", rc); } else { rb->lcd_clear_display(); rb->splash(HZ, "Done"); @@ -215,7 +215,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame } else { if(rc < 0) { rb->lcd_clear_display(); - rb->splash(HZ, "Can't read file: %d", rc); + rb->splashf(HZ, "Can't read file: %d", rc); } else { rb->lcd_clear_display(); rb->splash(HZ, "The file is too big"); diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c index 4f319b4bef..8de6a746ab 100644 --- a/apps/plugins/splitedit.c +++ b/apps/plugins/splitedit.c @@ -690,7 +690,7 @@ static int save( if (close_stat != 0) { - rb->splash(0, "failed closing file1: error %d", close_stat); + rb->splashf(0, "failed closing file1: error %d", close_stat); rb->button_get(true); rb->button_get(true); } else { @@ -702,7 +702,7 @@ static int save( } else { - rb->splash(0, "Can't write File1: error %d", file1); + rb->splashf(0, "Can't write File1: error %d", file1); rb->button_get(true); rb->button_get(true); retval = -1; @@ -713,7 +713,7 @@ static int save( { if (rb->lseek(src_file, end, SEEK_SET) < (off_t)end) { - rb->splash(0, "Src file to short: error %d", src_file); + rb->splashf(0, "Src file to short: error %d", src_file); rb->button_get(true); rb->button_get(true); } @@ -731,7 +731,7 @@ static int save( if (close_stat != 0) { - rb->splash(0, "failed: closing file2: error %d", + rb->splashf(0, "failed: closing file2: error %d", close_stat); rb->button_get(true); rb->button_get(true); @@ -744,7 +744,7 @@ static int save( } else { - rb->splash(0, "Can't write File2: error %d", file2); + rb->splashf(0, "Can't write File2: error %d", file2); rb->button_get(true); rb->button_get(true); retval = -2; @@ -754,7 +754,7 @@ static int save( close_stat = rb->close(src_file); if (close_stat != 0) { - rb->splash(0, "failed: closing src: error %d", close_stat); + rb->splashf(0, "failed: closing src: error %d", close_stat); rb->button_get(true); rb->button_get(true); } diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c index e00328d148..6910c6c7e2 100644 --- a/apps/plugins/text_editor.c +++ b/apps/plugins/text_editor.c @@ -350,7 +350,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame fd = rb->open(filename,O_RDONLY); if (fd<0) { - rb->splash(HZ*2,"Couldnt open file: %s",(char*)parameter); + rb->splashf(HZ*2,"Couldnt open file: %s",(char*)parameter); return PLUGIN_ERROR; } #ifdef HAVE_LCD_COLOR @@ -363,7 +363,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame { if (!do_action(ACTION_INSERT,temp_line,line_count)) { - rb->splash(HZ*2,"Error reading file: %s",(char*)parameter); + rb->splashf(HZ*2,"Error reading file: %s",(char*)parameter); rb->close(fd); return PLUGIN_ERROR; } diff --git a/apps/plugins/vbrfix.c b/apps/plugins/vbrfix.c index fa05463d13..8313994e29 100644 --- a/apps/plugins/vbrfix.c +++ b/apps/plugins/vbrfix.c @@ -119,7 +119,7 @@ static int insert_data_in_file(const char *fname, int fpos, char *buf, int num_b static void fileerror(int rc) { - rb->splash(HZ*2, "File error: %d", rc); + rb->splashf(HZ*2, "File error: %d", rc); } static const unsigned char empty_id3_header[] = diff --git a/apps/plugins/wavplay.c b/apps/plugins/wavplay.c index 0a1136a6c2..333d16135c 100644 --- a/apps/plugins/wavplay.c +++ b/apps/plugins/wavplay.c @@ -3500,7 +3500,7 @@ int play_file(char* filename) format = letoh16(*(uint16_t *)(aud_buf + 20)); if (format != 1) { - rb->splash(2*HZ, "Unsupported format: %d", format); + rb->splashf(2*HZ, "Unsupported format: %d", format); rb->close(fd); return PLAY_ERROR; } @@ -3508,7 +3508,7 @@ int play_file(char* filename) channels = letoh16(*(uint16_t *)(aud_buf + 22)); if (channels > 2) { - rb->splash(2*HZ, "Too many channels: %d", channels); + rb->splashf(2*HZ, "Too many channels: %d", channels); rb->close(fd); return PLAY_ERROR; } @@ -3516,7 +3516,7 @@ int play_file(char* filename) samplebits = letoh16(*(uint16_t *)(aud_buf + 34)); if (samplebits != 16) { - rb->splash(2*HZ, "Unsupported sample depth: %dbit", samplebits); + rb->splashf(2*HZ, "Unsupported sample depth: %dbit", samplebits); rb->close(fd); return PLAY_ERROR; } @@ -3534,7 +3534,7 @@ int play_file(char* filename) case 44100: rate = 9; break; case 48000: rate = 10; break; default: - rb->splash(2*HZ, "Unsupported samplerate: %dHz", samplerate); + rb->splashf(2*HZ, "Unsupported samplerate: %dHz", samplerate); rb->close(fd); return PLAY_ERROR; } diff --git a/apps/plugins/wavrecord.c b/apps/plugins/wavrecord.c index 5c7a987171..d57a61a6a2 100644 --- a/apps/plugins/wavrecord.c +++ b/apps/plugins/wavrecord.c @@ -3772,7 +3772,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame rc = rb->mkdir(recbasedir); if (rc < 0) { - rb->splash(HZ*2, "Can't create directory %s. Error %d.", + rb->splashf(HZ*2, "Can't create directory %s. Error %d.", recbasedir, rc); return PLUGIN_ERROR; } diff --git a/apps/plugins/wavview.c b/apps/plugins/wavview.c index 0d7b6f6476..7a26a3911f 100644 --- a/apps/plugins/wavview.c +++ b/apps/plugins/wavview.c @@ -203,7 +203,7 @@ static int readwavpeaks(const char *filename) } if(((bytes_read/4)*4) != bytes_read) { - rb->splash(HZ*2, "bytes_read/*4 err: %ld",(long int)bytes_read); + rb->splashf(HZ*2, "bytes_read/*4 err: %ld",(long int)bytes_read); rb->close (file); return -1; } @@ -438,12 +438,12 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void *parame /* zoom out */ if(zoomlevel > 1) zoomlevel /= 2; - rb->splash(HZ/2, "ZOOM: %dx",(int)zoomlevel); + rb->splashf(HZ/2, "ZOOM: %dx",(int)zoomlevel); break; case ACTION_KBD_DOWN: if(zoomlevel < (mempeakcount / LCD_WIDTH / 2)) zoomlevel *= 2; - rb->splash(HZ/2, "ZOOM: %dx",(int)zoomlevel); + rb->splashf(HZ/2, "ZOOM: %dx",(int)zoomlevel); break; case ACTION_KBD_LEFT: center -= 10 * (mempeakcount / LCD_WIDTH) / zoomlevel; diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c index dc730292de..0faf8a27be 100644 --- a/apps/plugins/xobox.c +++ b/apps/plugins/xobox.c @@ -845,7 +845,7 @@ static inline void move_board (void) player.j = newj; } if (percentage_cache >= difficulty) { /* finished level */ - rb->splash (HZ * 2, "Level %d finished", player.level+1); + rb->splashf (HZ * 2, "Level %d finished", player.level+1); player.score += percentage_cache; if (player.level < MAX_LEVEL) player.level++; diff --git a/apps/plugins/zxbox/snapshot.c b/apps/plugins/zxbox/snapshot.c index 0010550392..d078ec78b1 100644 --- a/apps/plugins/zxbox/snapshot.c +++ b/apps/plugins/zxbox/snapshot.c @@ -651,7 +651,7 @@ void load_snapshot_file_type(char *name, int type) snsh = rb->open(filenamebuf, O_RDONLY); if(snsh < 0) { #ifndef USE_GRAY - rb->splash(HZ, "Could not open snapshot file `%s'",filenamebuf); + rb->splashf(HZ, "Could not open snapshot file `%s'",filenamebuf); #endif return; } diff --git a/apps/plugins/zxbox/spmain.c b/apps/plugins/zxbox/spmain.c index 136dcf0f24..6c586566f9 100644 --- a/apps/plugins/zxbox/spmain.c +++ b/apps/plugins/zxbox/spmain.c @@ -532,7 +532,7 @@ static void init_load(const void *parameter) check_params(parameter); if(spcf_init_snapshot != NULL) { #ifndef USE_GREY - rb->splash(HZ, "Loading snapshot '%s'", spcf_init_snapshot); + rb->splashf(HZ, "Loading snapshot '%s'", spcf_init_snapshot); #endif load_snapshot_file_type(spcf_init_snapshot, spcf_init_snapshot_type); diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 8d85af9937..27a98c6dc4 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c @@ -742,7 +742,7 @@ int radio_screen(void) case ACTION_FM_PRESET: if(num_presets < 1) { - gui_syncsplash(HZ, ID2P(LANG_FM_NO_PRESETS)); + splash(HZ, ID2P(LANG_FM_NO_PRESETS)); update_screen = true; FOR_NB_SCREENS(i) { @@ -776,7 +776,7 @@ int radio_screen(void) case ACTION_FM_FREEZE: if(!screen_freeze) { - gui_syncsplash(HZ, str(LANG_FM_FREEZE)); + splash(HZ, str(LANG_FM_FREEZE)); screen_freeze = true; } else @@ -917,8 +917,8 @@ int radio_screen(void) FOR_NB_SCREENS(i) screens[i].puts_scroll(0, top_of_screen + 1, buf); - snprintf(buf, 128, stereo?str(LANG_CHANNEL_STEREO): - str(LANG_CHANNEL_MONO)); + snprintf(buf, 128, "%s", stereo?str(LANG_CHANNEL_STEREO): + str(LANG_CHANNEL_MONO)); FOR_NB_SCREENS(i) screens[i].puts_scroll(0, top_of_screen + 2, buf); @@ -1001,7 +1001,7 @@ int radio_screen(void) #if CONFIG_CODEC != SWCODEC if(audio_status() & AUDIO_STATUS_ERROR) { - gui_syncsplash(0, str(LANG_DISK_FULL)); + splash(0, str(LANG_DISK_FULL)); gui_syncstatusbar_draw(&statusbars,true); FOR_NB_SCREENS(i) { @@ -1083,7 +1083,7 @@ static void radio_save_presets(void) } else { - gui_syncsplash(HZ, ID2P(LANG_FM_PRESET_SAVE_FAILED)); + splash(HZ, ID2P(LANG_FM_PRESET_SAVE_FAILED)); } } @@ -1169,7 +1169,7 @@ static int radio_add_preset(void) } else { - gui_syncsplash(HZ, ID2P(LANG_FM_NO_FREE_PRESETS)); + splash(HZ, ID2P(LANG_FM_NO_FREE_PRESETS)); } return true; } @@ -1257,7 +1257,7 @@ static int save_preset_list(void) if((!p1) || (len > MAX_FILENAME) || (len == 0)) { /* no slash, too long or too short */ - gui_syncsplash(HZ, ID2P(LANG_INVALID_FILENAME)); + splash(HZ, ID2P(LANG_INVALID_FILENAME)); } else { @@ -1277,7 +1277,7 @@ static int save_preset_list(void) } } else - gui_syncsplash(HZ, ID2P(LANG_FM_NO_PRESETS)); + splash(HZ, ID2P(LANG_FM_NO_PRESETS)); return true; } @@ -1456,8 +1456,6 @@ static int scan_presets(void *viewports) const struct fm_region_data * const fmr = &fm_region_data[global_settings.fm_region]; - char buf[MAX_FMPRESET_LEN + 1]; - curr_freq = fmr->freq_min; num_presets = 0; memset(presets, 0, sizeof(presets)); @@ -1473,8 +1471,7 @@ static int scan_presets(void *viewports) frac = freq % 100; freq /= 100; - snprintf(buf, MAX_FMPRESET_LEN, str(LANG_FM_SCANNING), freq, frac); - gui_syncsplash(0, buf); + splashf(0, str(LANG_FM_SCANNING), freq, frac); if(tuner_set(RADIO_SCAN_FREQUENCY, curr_freq)) { diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 81f6581ffc..5b51cc161d 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -606,9 +606,9 @@ int rec_create_directory(void) { while (action_userabort(HZ) == false) { - gui_syncsplash(0, "%s %s", - str(LANG_REC_DIR_NOT_WRITABLE), - str(LANG_OFF_ABORT)); + splashf(0, "%s %s", + str(LANG_REC_DIR_NOT_WRITABLE), + str(LANG_OFF_ABORT)); } } else @@ -1442,7 +1442,6 @@ bool recording_screen(bool no_source) screens[1].puts(0, 0, str(LANG_REMOTE_LCD_OFF)); screens[1].puts(0, 1, str(LANG_REMOTE_LCD_ON)); screens[1].update_viewport(); - gui_splash(&screens[0], 0, str(LANG_REMOTE_LCD_OFF)); } else { @@ -1789,7 +1788,7 @@ bool recording_screen(bool no_source) audio_stat = audio_status(); if (audio_stat & AUDIO_STATUS_ERROR) { - gui_syncsplash(0, str(LANG_DISK_FULL)); + splash(0, str(LANG_DISK_FULL)); gui_syncstatusbar_draw(&statusbars, true); FOR_NB_SCREENS(i) diff --git a/apps/root_menu.c b/apps/root_menu.c index bee17f183e..7322cbd9f6 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -127,14 +127,14 @@ static int browser(void* param) /* Maybe just needs to reboot due to delayed commit */ if (stat->commit_delayed) { - gui_syncsplash(HZ*2, ID2P(LANG_PLEASE_REBOOT)); + splash(HZ*2, ID2P(LANG_PLEASE_REBOOT)); break; } /* Check if ready status is known */ if (!stat->readyvalid) { - gui_syncsplash(0, str(LANG_TAGCACHE_BUSY)); + splash(0, str(LANG_TAGCACHE_BUSY)); continue; } @@ -178,14 +178,14 @@ static int browser(void* param) } if (stat->commit_step > 0) { - gui_syncsplash(0, "%s [%d/%d]", + splashf(0, "%s [%d/%d]", str(LANG_TAGCACHE_INIT), stat->commit_step, tagcache_get_max_commit_step()); } else { - gui_syncsplash(0, str(LANG_BUILDING_DATABASE), - stat->processed_entries); + splashf(0, str(LANG_BUILDING_DATABASE), + stat->processed_entries); } } } @@ -254,7 +254,7 @@ static int wpsscrn(void* param) } else { - gui_syncsplash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME)); + splash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME)); } #if LCD_DEPTH > 1 show_main_backdrop(); diff --git a/apps/screens.c b/apps/screens.c index af81e5a907..33c54abddc 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -168,9 +168,7 @@ int mmc_remove_request(void) int i; FOR_NB_SCREENS(i) screens[i].clear_display(); - gui_syncsplash(1, str(LANG_REMOVE_MMC)); - if (global_settings.talk_menu) - talk_id(LANG_REMOVE_MMC, false); + splash(0, ID2P(LANG_REMOVE_MMC)); while (1) { @@ -389,7 +387,7 @@ int charging_screen(void) #if CONFIG_CHARGING void charging_splash(void) { - gui_syncsplash(2*HZ, (unsigned char *)str(LANG_BATTERY_CHARGE)); + splash(2*HZ, str(LANG_BATTERY_CHARGE)); button_clear_queue(); } #endif @@ -669,7 +667,7 @@ bool shutdown_screen(void) lcd_stop_scroll(); - gui_syncsplash(0, str(LANG_CONFIRM_SHUTDOWN)); + splash(0, str(LANG_CONFIRM_SHUTDOWN)); while(!done && TIME_BEFORE(current_tick,time_entered+HZ*2)) { diff --git a/apps/settings.c b/apps/settings.c index a9257aaf53..b681471ef1 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -634,15 +634,15 @@ bool settings_save_config(int options) break; } else { - gui_syncsplash(HZ, ID2P(LANG_CANCEL)); + splash(HZ, ID2P(LANG_CANCEL)); return false; } } if (settings_write_config(filename, options)) - gui_syncsplash(HZ, ID2P(LANG_SETTINGS_SAVED)); + splash(HZ, ID2P(LANG_SETTINGS_SAVED)); else - gui_syncsplash(HZ, ID2P(LANG_FAILED)); + splash(HZ, ID2P(LANG_FAILED)); return true; } diff --git a/apps/settings.h b/apps/settings.h index a1e5cb119c..e90b1a83bf 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -187,10 +187,10 @@ extern unsigned char vp_dummy[VIRT_SIZE]; #define ID2P(id) (VIRT_PTR + id) /* resolve a pointer which could be a virtualized ID or a literal */ -#define P2STR(p) (char *)((p>=VIRT_PTR && p<=VIRT_PTR+VIRT_SIZE) ? str(p-VIRT_PTR) : p) +#define P2STR(p) (char *)((p>=VIRT_PTR && p=VIRT_PTR && p<=VIRT_PTR+VIRT_SIZE) ? p-VIRT_PTR : -1) +#define P2ID(p) ((p>=VIRT_PTR && p HZ/10) { - gui_syncsplash(0, str(LANG_PLAYLIST_SEARCH_MSG), count, - str(LANG_OFF_ABORT)); + splashf(0, str(LANG_PLAYLIST_SEARCH_MSG), count, str(LANG_OFF_ABORT)); if (action_userabort(TIMEOUT_NOBLOCK)) return false; last_tick = current_tick; @@ -1266,7 +1265,7 @@ static int retrieve_entries(struct tree_context *c, struct tagcache_search *tcs, if (!sort && (sort_inverse || sort_limit)) { - gui_syncsplash(HZ*4, ID2P(LANG_SHOWDIR_BUFFER_FULL), total_count); + splashf(HZ*4, ID2P(LANG_SHOWDIR_BUFFER_FULL), total_count); logf("Too small dir buffer"); return 0; } @@ -1369,7 +1368,7 @@ int tagtree_load(struct tree_context* c) { c->dirlevel = 0; count = load_root(c); - gui_syncsplash(HZ, str(LANG_TAGCACHE_BUSY)); + splash(HZ, str(LANG_TAGCACHE_BUSY)); } /* The _total_ numer of entries available. */ @@ -1566,7 +1565,7 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue cpu_boost(true); if (!tagcache_search(&tcs, tag_filename)) { - gui_syncsplash(HZ, ID2P(LANG_TAGCACHE_BUSY)); + splash(HZ, ID2P(LANG_TAGCACHE_BUSY)); cpu_boost(false); return false; } @@ -1674,12 +1673,12 @@ bool tagtree_insert_selection_playlist(int position, bool queue) } if (tc->filesindir <= 0) - gui_syncsplash(HZ, ID2P(LANG_END_PLAYLIST)); + splash(HZ, ID2P(LANG_END_PLAYLIST)); else { logf("insert_all_playlist"); if (!insert_all_playlist(tc, position, queue)) - gui_syncsplash(HZ*2, ID2P(LANG_FAILED)); + splash(HZ*2, ID2P(LANG_FAILED)); } /* Finally return the dirlevel to its original value. */ diff --git a/apps/tree.c b/apps/tree.c index 19a0a22bc3..98cb88ffb1 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -276,10 +276,10 @@ bool check_rockboxdir(void) int i; FOR_NB_SCREENS(i) screens[i].clear_display(); - gui_syncsplash(HZ*2, "No .rockbox directory"); + splash(HZ*2, "No .rockbox directory"); FOR_NB_SCREENS(i) screens[i].clear_display(); - gui_syncsplash(HZ*2, "Installation incomplete"); + splash(HZ*2, "Installation incomplete"); return false; } return true; @@ -394,7 +394,7 @@ static int update_dir(void) #endif (tc.dirfull || tc.filesindir == global_settings.max_files_in_dir) ) { - gui_syncsplash(HZ, ID2P(LANG_SHOWDIR_BUFFER_FULL)); + splash(HZ, ID2P(LANG_SHOWDIR_BUFFER_FULL)); } } #ifdef HAVE_TAGCACHE @@ -635,7 +635,7 @@ static int dirbrowse() if (*tc.dirfilter > NUM_FILTER_MODES && numentries==0) { - gui_syncsplash(HZ*2, ID2P(LANG_NO_FILES)); + splash(HZ*2, ID2P(LANG_NO_FILES)); return GO_TO_PREVIOUS; /* No files found for rockbox_browser() */ } @@ -889,7 +889,7 @@ bool create_playlist(void) snprintf(filename, sizeof filename, "%s.m3u8", tc.currdir[1] ? tc.currdir : "/root"); - gui_syncsplash(0, "%s %s", str(LANG_CREATING), filename); + splashf(0, "%s %s", str(LANG_CREATING), filename); trigger_cpu_boost(); catalog_add_to_a_playlist(tc.currdir, ATTR_DIRECTORY, true, filename); @@ -1134,7 +1134,7 @@ void tree_restore(void) if (global_settings.dircache) { /* Print "Scanning disk..." to the display. */ - gui_syncsplash(0, str(LANG_SCANNING_DISK)); + splash(0, str(LANG_SCANNING_DISK)); dircache_build(global_status.dircache_size); }