1
0
Fork 0
forked from len0rd/rockbox

puzzles: add formatting to help viewer

The help text is now processed to generate a style array to pass to the
display_text library in addition to the text itself. The help text is still
compressed using LZ4, and still fits on the c200v2.

Change-Id: I7a3a664f90f67a1a018956c72d2b62d92b8ffd17
This commit is contained in:
Franklin Wei 2018-03-17 22:54:07 -04:00
parent 6039eb05ba
commit 77641d59a7
44 changed files with 7768 additions and 6979 deletions

View file

@ -2378,9 +2378,38 @@ static void full_help(const char *name)
char *buf = smalloc(help_text_len);
LZ4_decompress_tiny(help_text, buf, help_text_len);
view_text(name, buf);
/* fill the word_ptrs array to pass to display_text */
char **word_ptrs = smalloc(sizeof(char*) * help_text_words);
char **ptr = word_ptrs;
bool last_was_null = false;
*ptr++ = buf;
for(int i = 1; i < help_text_len; ++i)
{
switch(buf[i])
{
case '\0':
if(last_was_null)
{
/* newline */
*ptr++ = buf + i;
}
else
last_was_null = true;
break;
default:
if(last_was_null)
*ptr++ = buf + i;
last_was_null = false;
break;
}
}
display_text(help_text_words, word_ptrs, help_text_style, NULL, true);
sfree(buf);
sfree(word_ptrs);
rb->lcd_set_background(old_bg);