1
0
Fork 0
forked from len0rd/rockbox

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; 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 /* If fmt is a lang ID then get the corresponding string (which
still might contain % place holders). */ still might contain % place holders). */
fmt = P2STR((unsigned char *)fmt); fmt = P2STR((unsigned char *)fmt);
@ -236,19 +243,6 @@ void splashf(int ticks, const char *fmt, ...)
sleep(ticks); 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 */ /* set delay before progress meter is shown */
void splash_progress_set_delay(long delay_ticks) 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) * - str : what to say, if this is a LANG_* string (from ID2P)
* it will be voiced * 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 */ /* set a delay before displaying the progress meter the first time */
extern void splash_progress_set_delay(long delay_ticks); extern void splash_progress_set_delay(long delay_ticks);

View file

@ -184,7 +184,6 @@ static const struct plugin_api rockbox_api = {
language_strings, language_strings,
&core_bitmaps[0], &core_bitmaps[0],
/* lcd */ /* lcd */
splash,
splashf, splashf,
splash_progress, splash_progress,
splash_progress_set_delay, splash_progress_set_delay,

View file

@ -58,6 +58,8 @@
#undef vsprintf #undef vsprintf
#endif #endif
#define splash(__ticks, __str) splashf(__ticks, __str)
char* strncpy(char *, const char *, size_t); char* strncpy(char *, const char *, size_t);
void* plugin_get_buffer(size_t *buffer_size); void* plugin_get_buffer(size_t *buffer_size);
size_t plugin_reserve_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; const struct cbmp_bitmap_info_entry *core_bitmaps;
/* lcd */ /* lcd */
void (*splash)(int ticks, const char *str);
void (*splashf)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); 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)(int current, int total, const char *fmt, ...) ATTRIBUTE_PRINTF(3, 4);
void (*splash_progress_set_delay)(long delay_ticks); void (*splash_progress_set_delay)(long delay_ticks);