summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugin.c1
-rw-r--r--apps/plugin.h3
-rw-r--r--apps/plugins/credits.c9
3 files changed, 8 insertions, 5 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 0b09d07ad6..4f56e2d5da 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -438,6 +438,7 @@ static const struct plugin_api rockbox_api = {
438#ifdef HAVE_LCD_BITMAP 438#ifdef HAVE_LCD_BITMAP
439 lcd_setmargins, 439 lcd_setmargins,
440#endif 440#endif
441 utf8seek,
441}; 442};
442 443
443int plugin_load(const char* plugin, void* parameter) 444int plugin_load(const char* plugin, void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 52732c5ff7..8d451d8f6f 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -103,7 +103,7 @@
103#define PLUGIN_MAGIC 0x526F634B /* RocK */ 103#define PLUGIN_MAGIC 0x526F634B /* RocK */
104 104
105/* increase this every time the api struct changes */ 105/* increase this every time the api struct changes */
106#define PLUGIN_API_VERSION 19 106#define PLUGIN_API_VERSION 20
107 107
108/* update this to latest version if a change to the api struct breaks 108/* update this to latest version if a change to the api struct breaks
109 backwards compatibility (and please take the opportunity to sort in any 109 backwards compatibility (and please take the opportunity to sort in any
@@ -514,6 +514,7 @@ struct plugin_api {
514#ifdef HAVE_LCD_BITMAP 514#ifdef HAVE_LCD_BITMAP
515 void (*lcd_setmargins)(int x, int y); 515 void (*lcd_setmargins)(int x, int y);
516#endif 516#endif
517 int (*utf8seek)(const unsigned char* utf8, int offset);
517}; 518};
518 519
519/* plugin header */ 520/* plugin header */
diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c
index 12bfa60a8f..b726771edc 100644
--- a/apps/plugins/credits.c
+++ b/apps/plugins/credits.c
@@ -58,7 +58,7 @@ void roll_credits(void)
58{ 58{
59 int numnames = sizeof(credits)/sizeof(char*); 59 int numnames = sizeof(credits)/sizeof(char*);
60 int curr_name = 0; 60 int curr_name = 0;
61 int curr_len = rb->strlen(credits[0]); 61 int curr_len = rb->utf8length(credits[0]);
62 int curr_index = 0; 62 int curr_index = 0;
63 int curr_line = 0; 63 int curr_line = 0;
64 int name, len, new_len, line, x; 64 int name, len, new_len, line, x;
@@ -77,19 +77,20 @@ void roll_credits(void)
77 int x2; 77 int x2;
78 78
79 if (x < 0) 79 if (x < 0)
80 rb->lcd_puts(0, line, credits[name] - x); 80 rb->lcd_puts(0, line, credits[name] + rb->utf8seek(credits[name], -x));
81 else 81 else
82 rb->lcd_puts(x, line, credits[name]); 82 rb->lcd_puts(x, line, credits[name]);
83 83
84 if (++name >= numnames) 84 if (++name >= numnames)
85 break; 85 break;
86
86 line ^= 1; 87 line ^= 1;
87 88
88 x2 = x + len/2; 89 x2 = x + len/2;
89 if ((unsigned)x2 < 11) 90 if ((unsigned)x2 < 11)
90 rb->lcd_putc(x2, line, '*'); 91 rb->lcd_putc(x2, line, '*');
91 92
92 new_len = rb->strlen(credits[name]); 93 new_len = rb->utf8length(credits[name]);
93 x += MAX(len/2 + 2, len - new_len/2 + 1); 94 x += MAX(len/2 + 2, len - new_len/2 + 1);
94 len = new_len; 95 len = new_len;
95 } 96 }
@@ -101,7 +102,7 @@ void roll_credits(void)
101 { 102 {
102 if (++curr_name >= numnames) 103 if (++curr_name >= numnames)
103 break; 104 break;
104 new_len = rb->strlen(credits[curr_name]); 105 new_len = rb->utf8length(credits[curr_name]);
105 curr_index -= MAX(curr_len/2 + 2, curr_len - new_len/2 + 1); 106 curr_index -= MAX(curr_len/2 + 2, curr_len - new_len/2 + 1);
106 curr_len = new_len; 107 curr_len = new_len;
107 curr_line ^= 1; 108 curr_line ^= 1;