summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/calendar.c8
-rw-r--r--apps/plugins/chessclock.c20
-rw-r--r--apps/plugins/dice.c15
-rw-r--r--apps/plugins/keybox.c25
-rw-r--r--apps/plugins/mazezam.c13
-rw-r--r--apps/plugins/pacbox/pacbox.c21
-rw-r--r--apps/plugins/rockpaint.c9
-rw-r--r--apps/plugins/snake.c22
-rw-r--r--apps/plugins/star.c30
9 files changed, 106 insertions, 57 deletions
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c
index e938af873e..e00afe19b6 100644
--- a/apps/plugins/calendar.c
+++ b/apps/plugins/calendar.c
@@ -24,6 +24,7 @@
24#if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) 24#if defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0)
25 25
26#include <timefuncs.h> 26#include <timefuncs.h>
27#include "lib/playback_control.h"
27 28
28PLUGIN_HEADER 29PLUGIN_HEADER
29 30
@@ -620,7 +621,8 @@ static bool edit_memo(int change, struct shown *shown)
620 MENUITEM_STRINGLIST(edit_menu, "Edit menu", edit_menu_cb, 621 MENUITEM_STRINGLIST(edit_menu, "Edit menu", edit_menu_cb,
621 "Remove", "Edit", 622 "Remove", "Edit",
622 "New Weekly", "New Monthly", 623 "New Weekly", "New Monthly",
623 "New Yearly", "New One off"); 624 "New Yearly", "New One off",
625 "Playback Control");
624 626
625 while (!exit) 627 while (!exit)
626 { 628 {
@@ -652,6 +654,10 @@ static bool edit_memo(int change, struct shown *shown)
652 add_memo(shown,3); 654 add_memo(shown,3);
653 return false; 655 return false;
654 656
657 case 6: /* playback control */
658 playback_control(NULL);
659 break;
660
655 case GO_TO_PREVIOUS: 661 case GO_TO_PREVIOUS:
656 return false; 662 return false;
657 663
diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c
index 28b1d95df3..337e2cc5b0 100644
--- a/apps/plugins/chessclock.c
+++ b/apps/plugins/chessclock.c
@@ -19,6 +19,7 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "plugin.h" 21#include "plugin.h"
22#include "lib/playback_control.h"
22 23
23PLUGIN_HEADER 24PLUGIN_HEADER
24 25
@@ -327,13 +328,13 @@ enum plugin_status plugin_start(const void* parameter)
327 int i; 328 int i;
328 bool done; 329 bool done;
329 int nr; 330 int nr;
330 331
331 (void)parameter; 332 (void)parameter;
332 333
333 settings.nr_timers = 1; 334 settings.nr_timers = 1;
334 settings.total_time = 10; 335 settings.total_time = 10;
335 settings.round_time = 10; 336 settings.round_time = 10;
336 337
337 /* now go ahead and have fun! */ 338 /* now go ahead and have fun! */
338 rb->splash(HZ, "Chess Clock"); 339 rb->splash(HZ, "Chess Clock");
339 340
@@ -380,7 +381,7 @@ enum plugin_status plugin_start(const void* parameter)
380 timer_holder[i].used_time=0; 381 timer_holder[i].used_time=0;
381 timer_holder[i].hidden=false; 382 timer_holder[i].hidden=false;
382 } 383 }
383 384
384 pause=true; /* We start paused */ 385 pause=true; /* We start paused */
385 386
386 nr=0; 387 nr=0;
@@ -431,7 +432,7 @@ enum plugin_status plugin_start(const void* parameter)
431static void show_pause_mode(bool enabled) 432static void show_pause_mode(bool enabled)
432{ 433{
433 static const char pause_icon[] = {0x00,0x7f,0x7f,0x00,0x7f,0x7f,0x00}; 434 static const char pause_icon[] = {0x00,0x7f,0x7f,0x00,0x7f,0x7f,0x00};
434 435
435 if (enabled) 436 if (enabled)
436 rb->lcd_mono_bitmap((unsigned char *)pause_icon, 52, 0, 7, 8); 437 rb->lcd_mono_bitmap((unsigned char *)pause_icon, 52, 0, 7, 8);
437 else 438 else
@@ -524,13 +525,14 @@ static int run_timer(int nr)
524 { 525 {
525 MENUITEM_STRINGLIST(menu, "Menu", NULL, 526 MENUITEM_STRINGLIST(menu, "Menu", NULL,
526 "Delete player", "Restart round", 527 "Delete player", "Restart round",
527 "Set round time", "Set total time"); 528 "Set round time", "Set total time",
529 "Playback Control");
528 530
529 int val, res; 531 int val, res;
530 switch(rb->do_menu(&menu, NULL, NULL, false)) 532 switch(rb->do_menu(&menu, NULL, NULL, false))
531 { 533 {
532 case 0: 534 case 0:
533 /* delete player */ 535 /* delete player */
534 timer_holder[nr].hidden=true; 536 timer_holder[nr].hidden=true;
535 retval = CHCL_NEXT; 537 retval = CHCL_NEXT;
536 done=true; 538 done=true;
@@ -544,8 +546,7 @@ static int run_timer(int nr)
544 /* set round time */ 546 /* set round time */
545 val=(max_ticks-ticks)/HZ; 547 val=(max_ticks-ticks)/HZ;
546 res=chessclock_set_int("Round time", 548 res=chessclock_set_int("Round time",
547 &val, 549 &val, 10, 0, MAX_TIME,
548 10, 0, MAX_TIME,
549 FLAGS_SET_INT_SECONDS); 550 FLAGS_SET_INT_SECONDS);
550 if (res==CHCL_USB) { 551 if (res==CHCL_USB) {
551 retval = CHCL_USB; 552 retval = CHCL_USB;
@@ -569,6 +570,9 @@ static int run_timer(int nr)
569 timer_holder[nr].total_time=val; 570 timer_holder[nr].total_time=val;
570 } 571 }
571 break; 572 break;
573 case 4:
574 playback_control(NULL);
575 break;
572 case MENU_ATTACHED_USB: 576 case MENU_ATTACHED_USB:
573 retval = CHCL_USB; 577 retval = CHCL_USB;
574 done=true; 578 done=true;
diff --git a/apps/plugins/dice.c b/apps/plugins/dice.c
index 5ef5d5099d..ddbc0cc60e 100644
--- a/apps/plugins/dice.c
+++ b/apps/plugins/dice.c
@@ -22,6 +22,7 @@
22#include "plugin.h" 22#include "plugin.h"
23#include "lib/pluginlib_actions.h" 23#include "lib/pluginlib_actions.h"
24#include "lib/configfile.h" 24#include "lib/configfile.h"
25#include "lib/playback_control.h"
25 26
26#define MAX_DICES 12 27#define MAX_DICES 12
27#define INITIAL_NB_DICES 1 28#define INITIAL_NB_DICES 1
@@ -79,7 +80,7 @@ enum plugin_status plugin_start(const void* parameter) {
79 80
80 dice_init(&dice); 81 dice_init(&dice);
81 rb->srand(*rb->current_tick); 82 rb->srand(*rb->current_tick);
82 83
83 configfile_load(CFG_FILE, config, 2, 0); 84 configfile_load(CFG_FILE, config, 2, 0);
84 dice.nb_sides = nb_sides_values[sides_index]; 85 dice.nb_sides = nb_sides_values[sides_index];
85 if(!dice_menu(&dice)) 86 if(!dice_menu(&dice))
@@ -171,8 +172,10 @@ bool dice_menu(struct dices * dice) {
171 int selection; 172 int selection;
172 bool menu_quit = false, result = false; 173 bool menu_quit = false, result = false;
173 174
174 MENUITEM_STRINGLIST(menu,"Dice Menu",NULL,"Roll Dice","Number of Dice", 175 MENUITEM_STRINGLIST(menu, "Dice Menu", NULL,
175 "Number of Sides","Quit"); 176 "Roll Dice",
177 "Number of Dice", "Number of Sides",
178 "Playback Control", "Quit");
176 179
177 180
178 while (!menu_quit) { 181 while (!menu_quit) {
@@ -194,11 +197,15 @@ bool dice_menu(struct dices * dice) {
194 dice->nb_sides=nb_sides_values[sides_index]; 197 dice->nb_sides=nb_sides_values[sides_index];
195 break; 198 break;
196 199
200 case 3:
201 playback_control(NULL);
202 break;
203
197 default: 204 default:
198 menu_quit = true; 205 menu_quit = true;
199 result = false; 206 result = false;
200 break; 207 break;
201 } 208 }
202 } 209 }
203 return result; 210 return result;
204} 211}
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c
index 73fd138f09..448050938f 100644
--- a/apps/plugins/keybox.c
+++ b/apps/plugins/keybox.c
@@ -19,6 +19,7 @@
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "plugin.h" 21#include "plugin.h"
22#include "lib/playback_control.h"
22#include "lib/md5.h" 23#include "lib/md5.h"
23PLUGIN_HEADER 24PLUGIN_HEADER
24 25
@@ -29,7 +30,6 @@ PLUGIN_HEADER
29 30
30/* The header begins with the unencrypted salt (4 bytes) padded with 4 bytes of 31/* The header begins with the unencrypted salt (4 bytes) padded with 4 bytes of
31 zeroes. After that comes the encrypted hash of the master password (16 bytes) */ 32 zeroes. After that comes the encrypted hash of the master password (16 bytes) */
32
33 33
34#define HEADER_LEN 24 34#define HEADER_LEN 24
35 35
@@ -106,9 +106,10 @@ static void decrypt(uint32_t* v, uint32_t* k)
106 106
107static int context_item_cb(int action, const struct menu_item_ex *this_item) 107static int context_item_cb(int action, const struct menu_item_ex *this_item)
108{ 108{
109 int i = (intptr_t)this_item;
109 if (action == ACTION_REQUEST_MENUITEM 110 if (action == ACTION_REQUEST_MENUITEM
110 && pw_list.num_entries == 0 111 && pw_list.num_entries == 0
111 && ((intptr_t)this_item) != 0) 112 && (i != 0 && i != 5))
112 { 113 {
113 return ACTION_EXIT_MENUITEM; 114 return ACTION_EXIT_MENUITEM;
114 } 115 }
@@ -117,8 +118,9 @@ static int context_item_cb(int action, const struct menu_item_ex *this_item)
117 118
118MENUITEM_STRINGLIST(context_m, "Context menu", context_item_cb, 119MENUITEM_STRINGLIST(context_m, "Context menu", context_item_cb,
119 "Add entry", 120 "Add entry",
120 "Edit title", "Edit user name", "Edit password", 121 "Edit title", "Edit user name", "Edit password",
121 "Delete entry") 122 "Delete entry",
123 "Playback Control");
122 124
123static char * kb_list_cb(int selected_item, void *data, 125static char * kb_list_cb(int selected_item, void *data,
124 char *buffer, size_t buffer_len) 126 char *buffer, size_t buffer_len)
@@ -133,7 +135,7 @@ static char * kb_list_cb(int selected_item, void *data,
133 } 135 }
134 if (!entry) 136 if (!entry)
135 return NULL; 137 return NULL;
136 138
137 rb->snprintf(buffer, buffer_len, "%s", entry->title); 139 rb->snprintf(buffer, buffer_len, "%s", entry->title);
138 140
139 return buffer; 141 return buffer;
@@ -161,7 +163,7 @@ static void delete_entry(int selected_item)
161 entry2 = entry->next; 163 entry2 = entry->next;
162 if (!entry2) 164 if (!entry2)
163 return; 165 return;
164 166
165 entry->next = entry2->next; 167 entry->next = entry2->next;
166 168
167 entry2->used = false; 169 entry2->used = false;
@@ -289,6 +291,9 @@ static void context_menu(int selected_item)
289 case 4: 291 case 4:
290 delete_entry(selected_item); 292 delete_entry(selected_item);
291 return; 293 return;
294 case 5:
295 playback_control(NULL);
296 return;
292 default: 297 default:
293 exit = true; 298 exit = true;
294 break; 299 break;
@@ -610,8 +615,9 @@ static int main_menu(void)
610 int selection, result, ret; 615 int selection, result, ret;
611 bool exit = false; 616 bool exit = false;
612 617
613 MENUITEM_STRINGLIST(menu,"Keybox", NULL, "Enter Keybox", 618 MENUITEM_STRINGLIST(menu, "Keybox", NULL,
614 "Reset Keybox", "Exit"); 619 "Enter Keybox", "Reset Keybox",
620 "Playback Control", "Exit");
615 621
616 do { 622 do {
617 result = rb->do_menu(&menu, &selection, NULL, false); 623 result = rb->do_menu(&menu, &selection, NULL, false);
@@ -625,6 +631,9 @@ static int main_menu(void)
625 reset(); 631 reset();
626 break; 632 break;
627 case 2: 633 case 2:
634 playback_control(NULL);
635 break;
636 case 3:
628 exit = true; 637 exit = true;
629 break; 638 break;
630 } 639 }
diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c
index a19c8a027e..ad5e5437af 100644
--- a/apps/plugins/mazezam.c
+++ b/apps/plugins/mazezam.c
@@ -224,7 +224,7 @@ static enum {
224 224
225 STATE_FAILED, /* The player wants to retry the level */ 225 STATE_FAILED, /* The player wants to retry the level */
226 STATE_GAME_MENU, /* The player wan't to access the in-game menu */ 226 STATE_GAME_MENU, /* The player wan't to access the in-game menu */
227 227
228 STATE_IN_LEVEL, 228 STATE_IN_LEVEL,
229} state; 229} state;
230 230
@@ -519,7 +519,7 @@ static void draw_level(
519 short xOff = (LCD_WIDTH - (size*li->width))/2; 519 short xOff = (LCD_WIDTH - (size*li->width))/2;
520 short yOff = (LCD_HEIGHT - (size*li->height))/2; 520 short yOff = (LCD_HEIGHT - (size*li->height))/2;
521 short i; 521 short i;
522 522
523 rb->lcd_clear_display(); 523 rb->lcd_clear_display();
524 524
525 draw_walls(size,xOff,yOff,li->width, li->height, li->entrance, li->exit); 525 draw_walls(size,xOff,yOff,li->width, li->height, li->entrance, li->exit);
@@ -658,7 +658,7 @@ static void in_game_menu(void)
658 MAZEZAM_TEXT_RETRY_LEVEL, 658 MAZEZAM_TEXT_RETRY_LEVEL,
659 MAZEZAM_TEXT_AUDIO_PLAYBACK, 659 MAZEZAM_TEXT_AUDIO_PLAYBACK,
660 MAZEZAM_TEXT_QUIT); 660 MAZEZAM_TEXT_QUIT);
661 661
662 /* Don't show the status bar */ 662 /* Don't show the status bar */
663 switch(rb->do_menu(&menu, &start_selection, NULL, false)){ 663 switch(rb->do_menu(&menu, &start_selection, NULL, false)){
664 case 1: /* retry */ 664 case 1: /* retry */
@@ -888,6 +888,7 @@ static void main_menu(void)
888 MENUITEM_STRINGLIST(menu,MAZEZAM_TEXT_MAIN_MENU,main_menu_cb, 888 MENUITEM_STRINGLIST(menu,MAZEZAM_TEXT_MAIN_MENU,main_menu_cb,
889 MAZEZAM_TEXT_CONTINUE, 889 MAZEZAM_TEXT_CONTINUE,
890 MAZEZAM_TEXT_PLAY_NEW_GAME, 890 MAZEZAM_TEXT_PLAY_NEW_GAME,
891 MAZEZAM_TEXT_AUDIO_PLAYBACK,
891 MAZEZAM_TEXT_QUIT); 892 MAZEZAM_TEXT_QUIT);
892 893
893 while (state >= STATE_IN_APPLICATION) { 894 while (state >= STATE_IN_APPLICATION) {
@@ -906,6 +907,10 @@ static void main_menu(void)
906 game_loop(&r_data); 907 game_loop(&r_data);
907 break; 908 break;
908 909
910 case 2: /* Audio playback */
911 playback_control(NULL);
912 break;
913
909 case MENU_ATTACHED_USB: 914 case MENU_ATTACHED_USB:
910 state = STATE_USB_CONNECTED; 915 state = STATE_USB_CONNECTED;
911 break; 916 break;
@@ -935,7 +940,7 @@ enum plugin_status plugin_start(const void* parameter)
935 store_lcd_settings(); 940 store_lcd_settings();
936 941
937 state = STATE_MAIN_MENU; 942 state = STATE_MAIN_MENU;
938 main_menu(); 943 main_menu();
939 944
940 switch (state) { 945 switch (state) {
941 case STATE_USB_CONNECTED: 946 case STATE_USB_CONNECTED:
diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c
index e7b92c38cf..0e3343252f 100644
--- a/apps/plugins/pacbox/pacbox.c
+++ b/apps/plugins/pacbox/pacbox.c
@@ -29,6 +29,7 @@
29#include "pacbox.h" 29#include "pacbox.h"
30#include "pacbox_lcd.h" 30#include "pacbox_lcd.h"
31#include "lib/configfile.h" 31#include "lib/configfile.h"
32#include "lib/playback_control.h"
32 33
33PLUGIN_HEADER 34PLUGIN_HEADER
34PLUGIN_IRAM_DECLARE 35PLUGIN_IRAM_DECLARE
@@ -78,9 +79,9 @@ static bool loadFile( const char * name, unsigned char * buf, int len )
78 if( fd < 0 ) { 79 if( fd < 0 ) {
79 return false; 80 return false;
80 } 81 }
81 82
82 int n = rb->read( fd, buf, len); 83 int n = rb->read( fd, buf, len);
83 84
84 rb->close( fd ); 85 rb->close( fd );
85 86
86 if( n != len ) { 87 if( n != len ) {
@@ -174,7 +175,8 @@ static bool pacbox_menu(void)
174 175
175 MENUITEM_STRINGLIST(menu, "Pacbox Menu", NULL, 176 MENUITEM_STRINGLIST(menu, "Pacbox Menu", NULL,
176 "Difficulty", "Pacmen Per Game", "Bonus Life", 177 "Difficulty", "Pacmen Per Game", "Bonus Life",
177 "Ghost Names", "Display FPS", "Restart", "Quit"); 178 "Ghost Names", "Display FPS",
179 "Playback Control", "Restart", "Quit");
178 180
179 rb->button_clear_queue(); 181 rb->button_clear_queue();
180 182
@@ -220,10 +222,13 @@ static bool pacbox_menu(void)
220 } 222 }
221 break; 223 break;
222 case 4: /* Show FPS */ 224 case 4: /* Show FPS */
223 rb->set_option("Display FPS",&settings.showfps,INT, 225 rb->set_option("Display FPS",&settings.showfps,INT,
224 noyes, 2, NULL); 226 noyes, 2, NULL);
225 break; 227 break;
226 case 5: /* Restart */ 228 case 5: /* playback control */
229 playback_control(NULL);
230 break;
231 case 6: /* Restart */
227 need_restart=true; 232 need_restart=true;
228 menu_quit=1; 233 menu_quit=1;
229 break; 234 break;
@@ -323,7 +328,7 @@ static int gameProc( void )
323 yield_counter = 0; 328 yield_counter = 0;
324 rb->yield (); 329 rb->yield ();
325 } 330 }
326 331
327 /* The following functions render the Pacman screen from the 332 /* The following functions render the Pacman screen from the
328 contents of the video and color ram. We first update the 333 contents of the video and color ram. We first update the
329 background, and then draw the Sprites on top. 334 background, and then draw the Sprites on top.
@@ -343,10 +348,10 @@ static int gameProc( void )
343 348
344 rb->lcd_update(); 349 rb->lcd_update();
345 350
346 /* Keep the framerate at Pacman's 60fps */ 351 /* Keep the framerate at Pacman's 60fps */
347 end_time = start_time + (video_frames*HZ)/FPS; 352 end_time = start_time + (video_frames*HZ)/FPS;
348 while (TIME_BEFORE(*rb->current_tick,end_time)) { 353 while (TIME_BEFORE(*rb->current_tick,end_time)) {
349 rb->sleep(1); 354 rb->sleep(1);
350 } 355 }
351 } 356 }
352 } 357 }
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c
index 5388aceed5..458f6b552a 100644
--- a/apps/plugins/rockpaint.c
+++ b/apps/plugins/rockpaint.c
@@ -31,6 +31,7 @@
31#include "plugin.h" 31#include "plugin.h"
32#include "lib/pluginlib_bmp.h" 32#include "lib/pluginlib_bmp.h"
33#include "lib/rgb_hsv.h" 33#include "lib/rgb_hsv.h"
34#include "lib/playback_control.h"
34 35
35PLUGIN_HEADER 36PLUGIN_HEADER
36 37
@@ -533,6 +534,7 @@ enum {
533 MAIN_MENU_NEW, MAIN_MENU_LOAD, MAIN_MENU_SAVE, 534 MAIN_MENU_NEW, MAIN_MENU_LOAD, MAIN_MENU_SAVE,
534 MAIN_MENU_BRUSH_SIZE, MAIN_MENU_BRUSH_SPEED, MAIN_MENU_COLOR, 535 MAIN_MENU_BRUSH_SIZE, MAIN_MENU_BRUSH_SPEED, MAIN_MENU_COLOR,
535 MAIN_MENU_GRID_SIZE, 536 MAIN_MENU_GRID_SIZE,
537 MAIN_MENU_PLAYBACK_CONTROL,
536 MAIN_MENU_EXIT, 538 MAIN_MENU_EXIT,
537 }; 539 };
538enum { 540enum {
@@ -551,7 +553,8 @@ enum {
551MENUITEM_STRINGLIST(main_menu, "RockPaint", NULL, 553MENUITEM_STRINGLIST(main_menu, "RockPaint", NULL,
552 "Resume", "New", "Load", "Save", 554 "Resume", "New", "Load", "Save",
553 "Brush Size", "Brush Speed", 555 "Brush Size", "Brush Speed",
554 "Choose Color", "Grid Size", "Exit"); 556 "Choose Color", "Grid Size",
557 "Playback Control", "Exit");
555MENUITEM_STRINGLIST(size_menu, "Choose Size", NULL, 558MENUITEM_STRINGLIST(size_menu, "Choose Size", NULL,
556 "1x", "2x","4x", "8x"); 559 "1x", "2x","4x", "8x");
557MENUITEM_STRINGLIST(speed_menu, "Choose Speed", NULL, 560MENUITEM_STRINGLIST(speed_menu, "Choose Speed", NULL,
@@ -2527,6 +2530,10 @@ static void goto_menu(void)
2527 gridsize = gridsize_list[multi]; 2530 gridsize = gridsize_list[multi];
2528 break; 2531 break;
2529 2532
2533 case MAIN_MENU_PLAYBACK_CONTROL:
2534 playback_control( NULL );
2535 break;
2536
2530 case MAIN_MENU_EXIT: 2537 case MAIN_MENU_EXIT:
2531 restore_screen(); 2538 restore_screen();
2532 quit=true; 2539 quit=true;
diff --git a/apps/plugins/snake.c b/apps/plugins/snake.c
index 739fce9a3e..8cba920840 100644
--- a/apps/plugins/snake.c
+++ b/apps/plugins/snake.c
@@ -34,6 +34,7 @@ dir is the current direction of the snake - 0=up, 1=right, 2=down, 3=left;
34 34
35#include "plugin.h" 35#include "plugin.h"
36#ifdef HAVE_LCD_BITMAP 36#ifdef HAVE_LCD_BITMAP
37#include "lib/playback_control.h"
37 38
38PLUGIN_HEADER 39PLUGIN_HEADER
39 40
@@ -393,7 +394,7 @@ void game (void) {
393 rb->sleep(HZ/level); 394 rb->sleep(HZ/level);
394 395
395 button=rb->button_get(false); 396 button=rb->button_get(false);
396 397
397#ifdef HAS_BUTTON_HOLD 398#ifdef HAS_BUTTON_HOLD
398 if (rb->button_hold()) 399 if (rb->button_hold())
399 button = SNAKE_PLAYPAUSE; 400 button = SNAKE_PLAYPAUSE;
@@ -445,23 +446,28 @@ void game_init(void) {
445 apple=false; 446 apple=false;
446 snakelength=4; 447 snakelength=4;
447 score=0; 448 score=0;
448 board[11][7]=1; 449 board[11][7]=1;
449 450
450 MENUITEM_STRINGLIST(menu,"Snake Menu",NULL,"Start New Game","Starting Level", 451 MENUITEM_STRINGLIST(menu, "Snake Menu", NULL,
451 "Quit"); 452 "Start New Game", "Starting Level",
452 453 "Playback Control", "Quit");
454
453 while (!menu_quit) { 455 while (!menu_quit) {
454 switch(rb->do_menu(&menu, &selection, NULL, false)) 456 switch(rb->do_menu(&menu, &selection, NULL, false))
455 { 457 {
456 case 0: 458 case 0:
457 menu_quit = true; /* start playing */ 459 menu_quit = true; /* start playing */
458 break; 460 break;
459 461
460 case 1: 462 case 1:
461 rb->set_int("Starting Level", "", UNIT_INT, &level, NULL, 463 rb->set_int("Starting Level", "", UNIT_INT, &level, NULL,
462 1, 1, 9, NULL ); 464 1, 1, 9, NULL );
463 break; 465 break;
464 466
467 case 2:
468 playback_control(NULL);
469 break;
470
465 default: 471 default:
466 dead=1; /* quit program */ 472 dead=1; /* quit program */
467 menu_quit = true; 473 menu_quit = true;
diff --git a/apps/plugins/star.c b/apps/plugins/star.c
index 1a27f51f54..118a18227c 100644
--- a/apps/plugins/star.c
+++ b/apps/plugins/star.c
@@ -21,6 +21,7 @@
21#include "plugin.h" 21#include "plugin.h"
22#ifdef HAVE_LCD_BITMAP 22#ifdef HAVE_LCD_BITMAP
23#include "lib/display_text.h" 23#include "lib/display_text.h"
24#include "lib/playback_control.h"
24 25
25PLUGIN_HEADER 26PLUGIN_HEADER
26 27
@@ -424,8 +425,6 @@ static char board[STAR_HEIGHT][STAR_WIDTH];
424#define STAR 3 425#define STAR 3
425#define BALL 4 426#define BALL 4
426 427
427#define MENU_START 0
428
429/* char font size */ 428/* char font size */
430static int char_width = -1; 429static int char_width = -1;
431static int char_height = -1; 430static int char_height = -1;
@@ -1051,18 +1050,21 @@ static int star_menu(void)
1051{ 1050{
1052 int selection, level=1; 1051 int selection, level=1;
1053 bool menu_quit = false; 1052 bool menu_quit = false;
1054 /* get the size of char */
1055 rb->lcd_getstringsize("a", &char_width, &char_height);
1056 1053
1057 MENUITEM_STRINGLIST(menu,"Star Menu",NULL,"Start Game","Choose Level", 1054 MENUITEM_STRINGLIST(menu, "Star Menu", NULL,
1058 "Help", "Quit"); 1055 "Start Game","Choose Level",
1056 "Help", "Playback Control", "Quit");
1059 1057
1060 while(!menu_quit) 1058 while(!menu_quit)
1061 { 1059 {
1062 switch(rb->do_menu(&menu, &selection, NULL, false)) 1060 switch(rb->do_menu(&menu, &selection, NULL, false))
1063 { 1061 {
1064 case 0: 1062 case 0:
1065 menu_quit = true; 1063 /* use system font and get the size of char */
1064 rb->lcd_setfont(FONT_SYSFIXED);
1065 rb->lcd_getstringsize("a", &char_width, &char_height);
1066 star_run_game(level-1);
1067 rb->lcd_setfont(FONT_UI);
1066 break; 1068 break;
1067 case 1: 1069 case 1:
1068 rb->set_int("Level", "", UNIT_INT, &level, 1070 rb->set_int("Level", "", UNIT_INT, &level,
@@ -1072,19 +1074,17 @@ static int star_menu(void)
1072 if(star_help()) 1074 if(star_help())
1073 usb_detected = true; 1075 usb_detected = true;
1074 break; 1076 break;
1075 default: 1077 case 3:
1078 playback_control(NULL);
1079 break;
1080 case 4:
1076 menu_quit = true; 1081 menu_quit = true;
1077 break; 1082 break;
1078 } 1083 }
1084 if(usb_detected)
1085 return PLUGIN_USB_CONNECTED;
1079 } 1086 }
1080 1087
1081 if (selection == MENU_START)
1082 {
1083 rb->lcd_setfont(FONT_SYSFIXED);
1084 rb->lcd_getstringsize("a", &char_width, &char_height);
1085 level--;
1086 star_run_game(level);
1087 }
1088 return PLUGIN_OK; 1088 return PLUGIN_OK;
1089} 1089}
1090 1090