From 552a271c6fea8d36390858ca6d12c4c98f663002 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Sat, 3 Jun 2017 13:45:07 -0400 Subject: puzzles: remove redundant help content It used to be that each puzzle had a complete copy of the entire puzzles manual and the "quick help" text for every single puzzle. This was obviously a waste, so now each puzzle only has the sections of the manual that apply to it, saving about 100KB or so per puzzle. This also has the added benefit of shrinking binary size enough to allow full help support on the c200v2, which has been enabled. Change-Id: I76c799635de058e4a48e0c18b79537857af7cf85 --- apps/plugins/puzzles/help.c | 47 ++++----------------------------------------- 1 file changed, 4 insertions(+), 43 deletions(-) (limited to 'apps/plugins/puzzles/help.c') diff --git a/apps/plugins/puzzles/help.c b/apps/plugins/puzzles/help.c index 4a2560e4c4..c45f50e65e 100644 --- a/apps/plugins/puzzles/help.c +++ b/apps/plugins/puzzles/help.c @@ -3,51 +3,12 @@ void full_help(const char *name) { - int ch_num = -1; - - /* dirty hack */ - if(!strcmp(name, "Train Tracks")) - name = "Tracks"; - - /* search the help text for a chapter with this name */ - for(int ch = 0; ch < help_numchapters; ++ch) - { - char *str = help_text + help_chapteroffsets[ch]; - char *ptr = strchr(str, ':') + 1; - const char *namep = name; - if(*ptr++ != ' ') - continue; - - while(*ptr == *namep && *ptr && *namep) - { - ptr++; - namep++; - } - if(*namep == '\0' && (*ptr == '\n' || *ptr == ' ')) /* full match */ - { - ch_num = ch; - break; - } - } - if(ch_num < 0) - { - rb->splashf(HZ * 2, "No topic found for `%s' (REPORT ME!)", name); - return; - } - char *buf = smalloc(help_maxlen + 1); - rb->memset(buf, 0, help_maxlen + 1); - if(ch_num < help_numchapters - 1) - { - /* safe to look ahead */ - memcpy(buf, help_text + help_chapteroffsets[ch_num], help_chapteroffsets[ch_num + 1] - help_chapteroffsets[ch_num]); - } - else - rb->strlcpy(buf, help_text + help_chapteroffsets[ch_num], help_maxlen + 1); + unsigned old_bg = rb->lcd_get_background(); rb->lcd_set_foreground(LCD_WHITE); - unsigned old_bg = rb->lcd_get_background(); rb->lcd_set_background(LCD_BLACK); - view_text(name, buf); + + view_text(name, help_text); + rb->lcd_set_background(old_bg); - sfree(buf); } -- cgit v1.2.3