diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/SOURCES | 2 | ||||
-rw-r--r-- | apps/plugins/blackjack.c | 2 | ||||
-rw-r--r-- | apps/plugins/mosaique.c | 12 | ||||
-rw-r--r-- | apps/plugins/robotfindskitten.c | 2 | ||||
-rw-r--r-- | apps/plugins/rocklife.c | 23 | ||||
-rw-r--r-- | apps/plugins/starfield.c | 5 | ||||
-rw-r--r-- | apps/plugins/text_editor.c | 4 | ||||
-rw-r--r-- | apps/plugins/viewer.c | 24 |
8 files changed, 38 insertions, 36 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 76a0b575b7..a3ce60fbf8 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -64,7 +64,7 @@ rockblox1d.c | |||
64 | brickmania.c | 64 | brickmania.c |
65 | calendar.c | 65 | calendar.c |
66 | maze.c | 66 | maze.c |
67 | mazezam.c | 67 | mazezam.c |
68 | text_editor.c | 68 | text_editor.c |
69 | wavview.c | 69 | wavview.c |
70 | robotfindskitten.c | 70 | robotfindskitten.c |
diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c index 3854799fc3..315f21f27b 100644 --- a/apps/plugins/blackjack.c +++ b/apps/plugins/blackjack.c | |||
@@ -136,7 +136,7 @@ enum { | |||
136 | #define BJACK_LEFT BUTTON_LEFT | 136 | #define BJACK_LEFT BUTTON_LEFT |
137 | 137 | ||
138 | #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD | 138 | #elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD |
139 | #define BJACK_SELECT_NAME "PLAY" | 139 | #define BJACK_SELECT_NAME "SELECT" |
140 | #define BJACK_STAY_NAME "REC" | 140 | #define BJACK_STAY_NAME "REC" |
141 | #define BJACK_RESUME_NAME "DOWN" | 141 | #define BJACK_RESUME_NAME "DOWN" |
142 | #define BJACK_QUIT_NAME "POWER" | 142 | #define BJACK_QUIT_NAME "POWER" |
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c index 51005fdabd..0f3e9ffc08 100644 --- a/apps/plugins/mosaique.c +++ b/apps/plugins/mosaique.c | |||
@@ -208,20 +208,20 @@ enum plugin_status plugin_start(const void* parameter) | |||
208 | x = 2*GFX_WIDTH-x; | 208 | x = 2*GFX_WIDTH-x; |
209 | sx=-sx; | 209 | sx=-sx; |
210 | } | 210 | } |
211 | 211 | ||
212 | if (x<0) | 212 | if (x<0) |
213 | { | 213 | { |
214 | x = -x; | 214 | x = -x; |
215 | sx = -sx; | 215 | sx = -sx; |
216 | } | 216 | } |
217 | 217 | ||
218 | y+=sy; | 218 | y+=sy; |
219 | if (y>GFX_HEIGHT) | 219 | if (y>GFX_HEIGHT) |
220 | { | 220 | { |
221 | y = 2*GFX_HEIGHT-y; | 221 | y = 2*GFX_HEIGHT-y; |
222 | sy=-sy; | 222 | sy=-sy; |
223 | } | 223 | } |
224 | 224 | ||
225 | if (y<0) | 225 | if (y<0) |
226 | { | 226 | { |
227 | y = -y; | 227 | y = -y; |
@@ -235,7 +235,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
235 | MYLCD(update)(); | 235 | MYLCD(update)(); |
236 | 236 | ||
237 | rb->sleep(HZ/timer); | 237 | rb->sleep(HZ/timer); |
238 | 238 | ||
239 | button = rb->button_get(false); | 239 | button = rb->button_get(false); |
240 | switch (button) | 240 | switch (button) |
241 | { | 241 | { |
@@ -254,7 +254,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
254 | if (timer>20) | 254 | if (timer>20) |
255 | timer=5; | 255 | timer=5; |
256 | break; | 256 | break; |
257 | 257 | ||
258 | case MOSAIQUE_RESTART: | 258 | case MOSAIQUE_RESTART: |
259 | 259 | ||
260 | sx = rb->rand() % (GFX_HEIGHT/2) + 1; | 260 | sx = rb->rand() % (GFX_HEIGHT/2) + 1; |
@@ -278,5 +278,3 @@ enum plugin_status plugin_start(const void* parameter) | |||
278 | } | 278 | } |
279 | } | 279 | } |
280 | } | 280 | } |
281 | |||
282 | |||
diff --git a/apps/plugins/robotfindskitten.c b/apps/plugins/robotfindskitten.c index a2bff3bfbe..5cd0e465f8 100644 --- a/apps/plugins/robotfindskitten.c +++ b/apps/plugins/robotfindskitten.c | |||
@@ -676,7 +676,7 @@ static void play_game() | |||
676 | { | 676 | { |
677 | int old_x = robot.x; | 677 | int old_x = robot.x; |
678 | int old_y = robot.y; | 678 | int old_y = robot.y; |
679 | int input = 0; /* Not sure what a reasonable initial value is */ | 679 | int input = BUTTON_NONE; |
680 | #ifdef __PLUGINLIB_ACTIONS_H__ | 680 | #ifdef __PLUGINLIB_ACTIONS_H__ |
681 | const struct button_mapping *plugin_contexts[] = {generic_directions, generic_actions}; | 681 | const struct button_mapping *plugin_contexts[] = {generic_directions, generic_actions}; |
682 | #endif | 682 | #endif |
diff --git a/apps/plugins/rocklife.c b/apps/plugins/rocklife.c index 5258121ea3..35c848de1d 100644 --- a/apps/plugins/rocklife.c +++ b/apps/plugins/rocklife.c | |||
@@ -131,7 +131,7 @@ static bool load_cellfile(const char *file, char *pgrid){ | |||
131 | fd = rb->open(file, O_RDONLY); | 131 | fd = rb->open(file, O_RDONLY); |
132 | if (fd<0) | 132 | if (fd<0) |
133 | return false; | 133 | return false; |
134 | 134 | ||
135 | init_grid(pgrid); | 135 | init_grid(pgrid); |
136 | 136 | ||
137 | char c; | 137 | char c; |
@@ -143,7 +143,7 @@ static bool load_cellfile(const char *file, char *pgrid){ | |||
143 | ymid = (GRID_H>>1) - 2; | 143 | ymid = (GRID_H>>1) - 2; |
144 | comment = false; | 144 | comment = false; |
145 | 145 | ||
146 | while (true) { | 146 | while (true) { |
147 | nc = rb->read(fd, &c, 1); | 147 | nc = rb->read(fd, &c, 1); |
148 | if (nc <= 0) | 148 | if (nc <= 0) |
149 | break; | 149 | break; |
@@ -343,7 +343,7 @@ static inline bool check_cell(unsigned char *n) | |||
343 | 343 | ||
344 | /* now we build the number of non-zero neighbours :-P */ | 344 | /* now we build the number of non-zero neighbours :-P */ |
345 | alive_cells = 8 - empty_cells; | 345 | alive_cells = 8 - empty_cells; |
346 | 346 | ||
347 | if (n[4]) { | 347 | if (n[4]) { |
348 | /* If the cell is alive, it stays alive iff it has 2 or 3 alive neighbours */ | 348 | /* If the cell is alive, it stays alive iff it has 2 or 3 alive neighbours */ |
349 | result = (alive_cells==2 || alive_cells==3); | 349 | result = (alive_cells==2 || alive_cells==3); |
@@ -468,6 +468,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
468 | int button = 0; | 468 | int button = 0; |
469 | int quit = 0; | 469 | int quit = 0; |
470 | int stop = 0; | 470 | int stop = 0; |
471 | int usb = 0; | ||
471 | int pattern = 0; | 472 | int pattern = 0; |
472 | char *pgrid; | 473 | char *pgrid; |
473 | char *pnext_grid; | 474 | char *pnext_grid; |
@@ -488,8 +489,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
488 | pgrid = (char *)grid_a; | 489 | pgrid = (char *)grid_a; |
489 | pnext_grid = (char *)grid_b; | 490 | pnext_grid = (char *)grid_b; |
490 | 491 | ||
491 | init_grid(pgrid); | 492 | init_grid(pgrid); |
492 | |||
493 | 493 | ||
494 | if( parameter == NULL ) | 494 | if( parameter == NULL ) |
495 | { | 495 | { |
@@ -544,6 +544,11 @@ enum plugin_status plugin_start(const void* parameter) | |||
544 | stop = 1; | 544 | stop = 1; |
545 | break; | 545 | break; |
546 | default: | 546 | default: |
547 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) { | ||
548 | stop = 1; | ||
549 | quit = 1; | ||
550 | usb = 1; | ||
551 | } | ||
547 | break; | 552 | break; |
548 | } | 553 | } |
549 | rb->yield(); | 554 | rb->yield(); |
@@ -562,12 +567,12 @@ enum plugin_status plugin_start(const void* parameter) | |||
562 | break; | 567 | break; |
563 | case ROCKLIFE_QUIT: | 568 | case ROCKLIFE_QUIT: |
564 | /* quit plugin */ | 569 | /* quit plugin */ |
565 | quit=true; | 570 | quit = 1; |
566 | return PLUGIN_OK; | ||
567 | break; | 571 | break; |
568 | default: | 572 | default: |
569 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) { | 573 | if (rb->default_event_handler(button) == SYS_USB_CONNECTED) { |
570 | return PLUGIN_USB_CONNECTED; | 574 | quit = 1; |
575 | usb = 1; | ||
571 | } | 576 | } |
572 | break; | 577 | break; |
573 | } | 578 | } |
@@ -575,5 +580,5 @@ enum plugin_status plugin_start(const void* parameter) | |||
575 | } | 580 | } |
576 | 581 | ||
577 | backlight_use_settings(); /* backlight control in lib/helper.c */ | 582 | backlight_use_settings(); /* backlight control in lib/helper.c */ |
578 | return PLUGIN_OK; | 583 | return usb? PLUGIN_USB_CONNECTED: PLUGIN_OK; |
579 | } | 584 | } |
diff --git a/apps/plugins/starfield.c b/apps/plugins/starfield.c index 4a680ee91b..0da3305a6f 100644 --- a/apps/plugins/starfield.c +++ b/apps/plugins/starfield.c | |||
@@ -482,8 +482,6 @@ int plugin_main(void) | |||
482 | #endif | 482 | #endif |
483 | case(STARFIELD_QUIT): | 483 | case(STARFIELD_QUIT): |
484 | case(SYS_USB_CONNECTED): | 484 | case(SYS_USB_CONNECTED): |
485 | /* Turn on backlight timeout (revert to settings) */ | ||
486 | backlight_use_settings(); /* backlight control in lib/helper.c*/ | ||
487 | return PLUGIN_OK; | 485 | return PLUGIN_OK; |
488 | break; | 486 | break; |
489 | } | 487 | } |
@@ -502,6 +500,9 @@ enum plugin_status plugin_start(const void* parameter) | |||
502 | 500 | ||
503 | ret = plugin_main(); | 501 | ret = plugin_main(); |
504 | 502 | ||
503 | /* Turn on backlight timeout (revert to settings) */ | ||
504 | backlight_use_settings(); /* backlight control in lib/helper.c*/ | ||
505 | |||
505 | return ret; | 506 | return ret; |
506 | } | 507 | } |
507 | 508 | ||
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c index a8c8c2d836..4d5812ba2c 100644 --- a/apps/plugins/text_editor.c +++ b/apps/plugins/text_editor.c | |||
@@ -86,7 +86,7 @@ char* _do_action(int action, char* str, int line) | |||
86 | break; | 86 | break; |
87 | case ACTION_REMOVE: | 87 | case ACTION_REMOVE: |
88 | if (line > line_count) | 88 | if (line > line_count) |
89 | return 0; | 89 | return NULL; |
90 | len = rb->strlen(&buffer[c])+1; | 90 | len = rb->strlen(&buffer[c])+1; |
91 | rb->memmove(&buffer[c],&buffer[c+len],char_count-c-len); | 91 | rb->memmove(&buffer[c],&buffer[c+len],char_count-c-len); |
92 | char_count -= len; | 92 | char_count -= len; |
@@ -225,7 +225,7 @@ enum { | |||
225 | }; | 225 | }; |
226 | int do_item_menu(int cur_sel, char* copy_buffer) | 226 | int do_item_menu(int cur_sel, char* copy_buffer) |
227 | { | 227 | { |
228 | int ret = 0; | 228 | int ret = MENU_RET_NO_UPDATE; |
229 | MENUITEM_STRINGLIST(menu, "Line Options", NULL, | 229 | MENUITEM_STRINGLIST(menu, "Line Options", NULL, |
230 | "Cut/Delete", "Copy", | 230 | "Cut/Delete", "Copy", |
231 | "Insert Above", "Insert Below", | 231 | "Insert Above", "Insert Below", |
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index a212885540..88b43c30b3 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c | |||
@@ -1,12 +1,11 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * | ||
3 | * __________ __ ___. | 2 | * __________ __ ___. |
4 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
5 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
6 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
7 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
8 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
9 | * | 8 | * $Id$ |
10 | * | 9 | * |
11 | * Copyright (C) 2002 Gilles Roux, 2003 Garrett Derner | 10 | * Copyright (C) 2002 Gilles Roux, 2003 Garrett Derner |
12 | * | 11 | * |
@@ -432,7 +431,6 @@ struct preferences { | |||
432 | } scroll_mode; | 431 | } scroll_mode; |
433 | 432 | ||
434 | int autoscroll_speed; | 433 | int autoscroll_speed; |
435 | |||
436 | }; | 434 | }; |
437 | 435 | ||
438 | struct preferences prefs; | 436 | struct preferences prefs; |
@@ -1226,7 +1224,7 @@ static void viewer_load_settings(void) /* same name as global, but not the same | |||
1226 | int settings_fd, i; | 1224 | int settings_fd, i; |
1227 | struct bookmark_file_data *data; | 1225 | struct bookmark_file_data *data; |
1228 | struct bookmarked_file_info this_bookmark; | 1226 | struct bookmarked_file_info this_bookmark; |
1229 | 1227 | ||
1230 | /* read settings file */ | 1228 | /* read settings file */ |
1231 | settings_fd=rb->open(SETTINGS_FILE, O_RDONLY); | 1229 | settings_fd=rb->open(SETTINGS_FILE, O_RDONLY); |
1232 | if ((settings_fd >= 0) && (rb->filesize(settings_fd) == sizeof(struct preferences))) | 1230 | if ((settings_fd >= 0) && (rb->filesize(settings_fd) == sizeof(struct preferences))) |
@@ -1271,7 +1269,7 @@ static void viewer_load_settings(void) /* same name as global, but not the same | |||
1271 | file_pos = screen_pos - screen_top; | 1269 | file_pos = screen_pos - screen_top; |
1272 | screen_top_ptr = buffer + screen_top; | 1270 | screen_top_ptr = buffer + screen_top; |
1273 | break; | 1271 | break; |
1274 | } | 1272 | } |
1275 | } | 1273 | } |
1276 | 1274 | ||
1277 | this_bookmark.file_position = file_pos; | 1275 | this_bookmark.file_position = file_pos; |
@@ -1284,16 +1282,16 @@ static void viewer_load_settings(void) /* same name as global, but not the same | |||
1284 | if (i >= data->bookmarked_files_count) | 1282 | if (i >= data->bookmarked_files_count) |
1285 | { | 1283 | { |
1286 | if (i < MAX_BOOKMARKED_FILES) | 1284 | if (i < MAX_BOOKMARKED_FILES) |
1287 | data->bookmarked_files_count++; | 1285 | data->bookmarked_files_count++; |
1288 | else | 1286 | else |
1289 | i = MAX_BOOKMARKED_FILES-1; | 1287 | i = MAX_BOOKMARKED_FILES-1; |
1290 | } | 1288 | } |
1291 | 1289 | ||
1292 | /* write bookmark file with spare slot in first position | 1290 | /* write bookmark file with spare slot in first position |
1293 | to be filled in by viewer_save_settings */ | 1291 | to be filled in by viewer_save_settings */ |
1294 | settings_fd = rb->open(BOOKMARKS_FILE, O_WRONLY|O_CREAT); | 1292 | settings_fd = rb->open(BOOKMARKS_FILE, O_WRONLY|O_CREAT); |
1295 | if (settings_fd >=0 ) | 1293 | if (settings_fd >=0 ) |
1296 | { | 1294 | { |
1297 | /* write count */ | 1295 | /* write count */ |
1298 | rb->write (settings_fd, &data->bookmarked_files_count, sizeof(signed int)); | 1296 | rb->write (settings_fd, &data->bookmarked_files_count, sizeof(signed int)); |
1299 | 1297 | ||
@@ -1336,7 +1334,7 @@ static void viewer_save_settings(void)/* same name as global, but not the same f | |||
1336 | rb->close(settings_fd); | 1334 | rb->close(settings_fd); |
1337 | } | 1335 | } |
1338 | } | 1336 | } |
1339 | 1337 | ||
1340 | /* save the bookmark if the position has changed */ | 1338 | /* save the bookmark if the position has changed */ |
1341 | if (file_pos + screen_top_ptr - buffer != start_position) | 1339 | if (file_pos + screen_top_ptr - buffer != start_position) |
1342 | { | 1340 | { |
@@ -1559,11 +1557,11 @@ enum plugin_status plugin_start(const void* file) | |||
1559 | } | 1557 | } |
1560 | 1558 | ||
1561 | viewer_load_settings(); /* load the preferences and bookmark */ | 1559 | viewer_load_settings(); /* load the preferences and bookmark */ |
1562 | 1560 | ||
1563 | #if LCD_DEPTH > 1 | 1561 | #if LCD_DEPTH > 1 |
1564 | rb->lcd_set_backdrop(NULL); | 1562 | rb->lcd_set_backdrop(NULL); |
1565 | #endif | 1563 | #endif |
1566 | 1564 | ||
1567 | viewer_draw(col); | 1565 | viewer_draw(col); |
1568 | 1566 | ||
1569 | while (!done) { | 1567 | while (!done) { |
@@ -1577,7 +1575,7 @@ enum plugin_status plugin_start(const void* file) | |||
1577 | old_tick = *rb->current_tick; | 1575 | old_tick = *rb->current_tick; |
1578 | } | 1576 | } |
1579 | } | 1577 | } |
1580 | 1578 | ||
1581 | button = rb->button_get_w_tmo(HZ/10); | 1579 | button = rb->button_get_w_tmo(HZ/10); |
1582 | switch (button) { | 1580 | switch (button) { |
1583 | case VIEWER_MENU: | 1581 | case VIEWER_MENU: |