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
This commit is contained in:
Solomon Peachy 2025-05-17 15:17:03 -04:00
parent 4ab056ab15
commit 622ff574e7
4 changed files with 10 additions and 16 deletions

View file

@ -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)
{

View file

@ -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);

View file

@ -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,

View file

@ -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);