From 622ff574e780232ff4c7c9cba2ec9ecc6adb3588 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sat, 17 May 2025 15:17:03 -0400 Subject: [PATCH] splash: splashf() should be voiced if given an IDPTR Most calls to splashf() use str(IDNUM), those can be safely moved to ID2P(IDNUM) now. Those will follow. This change effectively makes splash() a simple wrapper around splashf() so just make it into a #define instead.. Change-Id: I820e74e34cb4be3f523b25ce3f5dcc341bdba3e4 --- apps/gui/splash.c | 20 +++++++------------- apps/gui/splash.h | 2 +- apps/plugin.c | 1 - apps/plugin.h | 3 ++- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/apps/gui/splash.c b/apps/gui/splash.c index c970056375..7082f28b48 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c @@ -215,6 +215,13 @@ void splashf(int ticks, const char *fmt, ...) { va_list ap; + /* fmt may be a so called virtual pointer. See settings.h. */ + long id; + if((id = P2ID((const unsigned char*)fmt)) >= 0) + /* If fmt specifies a voicefont ID, and voice menus are + enabled, then speak it. */ + cond_talk_ids_fq(id); + /* If fmt is a lang ID then get the corresponding string (which still might contain % place holders). */ fmt = P2STR((unsigned char *)fmt); @@ -236,19 +243,6 @@ void splashf(int ticks, const char *fmt, ...) sleep(ticks); } -void splash(int ticks, const char *str) -{ -#if !defined(SIMULATOR) - long id; - /* fmt may be a so called virtual pointer. See settings.h. */ - 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 - splashf(ticks, "%s", P2STR((const unsigned char*)str)); -} - /* set delay before progress meter is shown */ void splash_progress_set_delay(long delay_ticks) { diff --git a/apps/gui/splash.h b/apps/gui/splash.h index f7ff44e00b..a42ad29140 100644 --- a/apps/gui/splash.h +++ b/apps/gui/splash.h @@ -38,7 +38,7 @@ extern void splashf(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); * - str : what to say, if this is a LANG_* string (from ID2P) * it will be voiced */ -extern void splash(int ticks, const char *str); +#define splash(__ticks, __str) splashf(__ticks, __str) /* set a delay before displaying the progress meter the first time */ extern void splash_progress_set_delay(long delay_ticks); diff --git a/apps/plugin.c b/apps/plugin.c index 35e56c7fb5..87c4f1eab7 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -184,7 +184,6 @@ static const struct plugin_api rockbox_api = { language_strings, &core_bitmaps[0], /* lcd */ - splash, splashf, splash_progress, splash_progress_set_delay, diff --git a/apps/plugin.h b/apps/plugin.h index e8fe95b5a6..9739533a0a 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -58,6 +58,8 @@ #undef vsprintf #endif +#define splash(__ticks, __str) splashf(__ticks, __str) + char* strncpy(char *, const char *, size_t); void* plugin_get_buffer(size_t *buffer_size); size_t plugin_reserve_buffer(size_t buffer_size); @@ -211,7 +213,6 @@ struct plugin_api { const struct cbmp_bitmap_info_entry *core_bitmaps; /* lcd */ - void (*splash)(int ticks, const char *str); void (*splashf)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); void (*splash_progress)(int current, int total, const char *fmt, ...) ATTRIBUTE_PRINTF(3, 4); void (*splash_progress_set_delay)(long delay_ticks);