diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-08-23 17:12:26 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-08-23 17:12:26 +0000 |
commit | 93cb949372630d807615f53a8a6379937ed6819f (patch) | |
tree | 2dcb5001a9247447a1c64fd0129e64b9d8aba4e6 | |
parent | abdc5935beb7dc3fa63bffeec584921ad2a4c8bd (diff) | |
download | rockbox-93cb949372630d807615f53a8a6379937ed6819f.tar.gz rockbox-93cb949372630d807615f53a8a6379937ed6819f.zip |
Revert "Introduce plugin_crt0.c that every plugin links."
Too much errors and no time to fix them now.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27863 a1c6a512-1295-4272-9138-f99709370657
142 files changed, 341 insertions, 372 deletions
diff --git a/apps/plugin.h b/apps/plugin.h index cb6cc83089..624b7039b8 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -155,13 +155,9 @@ void* plugin_get_buffer(size_t *buffer_size); | |||
155 | #define PLUGIN_MIN_API_VERSION 190 | 155 | #define PLUGIN_MIN_API_VERSION 190 |
156 | 156 | ||
157 | /* plugin return codes */ | 157 | /* plugin return codes */ |
158 | /* internal returns start at 0x100 to make exit(1..255) work */ | ||
159 | #define INTERNAL_PLUGIN_RETVAL_START 0x100 | ||
160 | enum plugin_status { | 158 | enum plugin_status { |
161 | PLUGIN_OK = 0, /* PLUGIN_OK == EXIT_SUCCESS */ | 159 | PLUGIN_OK = 0, |
162 | /* 1...255 reserved for exit() */ | 160 | PLUGIN_USB_CONNECTED, |
163 | PLUGIN_USB_CONNECTED = INTERNAL_PLUGIN_RETVAL_START, | ||
164 | PLUGIN_POWEROFF, | ||
165 | PLUGIN_GOTO_WPS, | 161 | PLUGIN_GOTO_WPS, |
166 | PLUGIN_ERROR = -1, | 162 | PLUGIN_ERROR = -1, |
167 | }; | 163 | }; |
@@ -916,14 +912,14 @@ extern unsigned char plugin_end_addr[]; | |||
916 | const struct plugin_header __header \ | 912 | const struct plugin_header __header \ |
917 | __attribute__ ((section (".header")))= { \ | 913 | __attribute__ ((section (".header")))= { \ |
918 | PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ | 914 | PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ |
919 | plugin_start_addr, plugin_end_addr, plugin__start, &rb }; | 915 | plugin_start_addr, plugin_end_addr, plugin_start, &rb }; |
920 | #else /* PLATFORM_HOSTED */ | 916 | #else /* PLATFORM_HOSTED */ |
921 | #define PLUGIN_HEADER \ | 917 | #define PLUGIN_HEADER \ |
922 | const struct plugin_api *rb DATA_ATTR; \ | 918 | const struct plugin_api *rb DATA_ATTR; \ |
923 | const struct plugin_header __header \ | 919 | const struct plugin_header __header \ |
924 | __attribute__((visibility("default"))) = { \ | 920 | __attribute__((visibility("default"))) = { \ |
925 | PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ | 921 | PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ |
926 | NULL, NULL, plugin__start, &rb }; | 922 | NULL, NULL, plugin_start, &rb }; |
927 | #endif /* CONFIG_PLATFORM */ | 923 | #endif /* CONFIG_PLATFORM */ |
928 | 924 | ||
929 | #ifdef PLUGIN_USE_IRAM | 925 | #ifdef PLUGIN_USE_IRAM |
@@ -958,7 +954,7 @@ void plugin_tsr(bool (*exit_callback)(bool reenter)); | |||
958 | 954 | ||
959 | /* defined by the plugin */ | 955 | /* defined by the plugin */ |
960 | extern const struct plugin_api *rb; | 956 | extern const struct plugin_api *rb; |
961 | enum plugin_status plugin__start(const void* parameter) | 957 | enum plugin_status plugin_start(const void* parameter) |
962 | NO_PROF_ATTR; | 958 | NO_PROF_ATTR; |
963 | 959 | ||
964 | #endif /* __PCTOOL__ */ | 960 | #endif /* __PCTOOL__ */ |
diff --git a/apps/plugins/alarmclock.c b/apps/plugins/alarmclock.c index 3ccb0c3ebd..a22a2f29a5 100644 --- a/apps/plugins/alarmclock.c +++ b/apps/plugins/alarmclock.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "lib/pluginlib_actions.h" | 23 | #include "lib/pluginlib_actions.h" |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | const struct button_mapping *plugin_contexts[] = { pla_main_ctx }; | 27 | const struct button_mapping *plugin_contexts[] = { pla_main_ctx }; |
28 | 28 | ||
diff --git a/apps/plugins/alpine_cdc.c b/apps/plugins/alpine_cdc.c index f6b236895d..9357b2e5ab 100644 --- a/apps/plugins/alpine_cdc.c +++ b/apps/plugins/alpine_cdc.c | |||
@@ -36,7 +36,7 @@ | |||
36 | /* Only build for (correct) target */ | 36 | /* Only build for (correct) target */ |
37 | #if CONFIG_CPU==SH7034 && !(CONFIG_STORAGE & STORAGE_MMC) | 37 | #if CONFIG_CPU==SH7034 && !(CONFIG_STORAGE & STORAGE_MMC) |
38 | 38 | ||
39 | 39 | PLUGIN_HEADER | |
40 | 40 | ||
41 | #ifdef HAVE_LCD_CHARCELLS /* player model */ | 41 | #ifdef HAVE_LCD_CHARCELLS /* player model */ |
42 | #define LINES 2 | 42 | #define LINES 2 |
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c index bb0e4f594b..e6efd38d96 100644 --- a/apps/plugins/battery_bench.c +++ b/apps/plugins/battery_bench.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #include "version.h" | 23 | #include "version.h" |
24 | #include "plugin.h" | 24 | #include "plugin.h" |
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | #define BATTERY_LOG "/battery_bench.txt" | 27 | #define BATTERY_LOG "/battery_bench.txt" |
28 | #define BUF_SIZE 16000 | 28 | #define BUF_SIZE 16000 |
diff --git a/apps/plugins/beatbox/beatbox.c b/apps/plugins/beatbox/beatbox.c index 9cb7dd4465..a51f738cd2 100644 --- a/apps/plugins/beatbox/beatbox.c +++ b/apps/plugins/beatbox/beatbox.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "midi/sequencer.h" | 26 | #include "midi/sequencer.h" |
27 | #include "midi/midifile.h" | 27 | #include "midi/midifile.h" |
28 | 28 | ||
29 | 29 | PLUGIN_HEADER | |
30 | PLUGIN_IRAM_DECLARE | 30 | PLUGIN_IRAM_DECLARE |
31 | 31 | ||
32 | /* variable button definitions */ | 32 | /* variable button definitions */ |
diff --git a/apps/plugins/bench_mem_jpeg.c b/apps/plugins/bench_mem_jpeg.c index 4e24f2a405..5169286fe3 100644 --- a/apps/plugins/bench_mem_jpeg.c +++ b/apps/plugins/bench_mem_jpeg.c | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | #include "plugin.h" | 24 | #include "plugin.h" |
25 | #include "lib/jpeg_mem.h" | 25 | #include "lib/jpeg_mem.h" |
26 | 26 | PLUGIN_HEADER | |
27 | 27 | ||
28 | /* a null output plugin to save memory and better isolate decode cost */ | 28 | /* a null output plugin to save memory and better isolate decode cost */ |
29 | static unsigned int get_size_null(struct bitmap *bm) | 29 | static unsigned int get_size_null(struct bitmap *bm) |
diff --git a/apps/plugins/bench_scaler.c b/apps/plugins/bench_scaler.c index 5db2987ec7..246271dcc8 100644 --- a/apps/plugins/bench_scaler.c +++ b/apps/plugins/bench_scaler.c | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | #include "plugin.h" | 24 | #include "plugin.h" |
25 | #include "lib/jpeg_mem.h" | 25 | #include "lib/jpeg_mem.h" |
26 | 26 | PLUGIN_HEADER | |
27 | 27 | ||
28 | static unsigned char output; | 28 | static unsigned char output; |
29 | static int output_y = 0; | 29 | static int output_y = 0; |
diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c index 8b28b815b8..7b3dbef805 100644 --- a/apps/plugins/blackjack.c +++ b/apps/plugins/blackjack.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "lib/highscore.h" | 26 | #include "lib/highscore.h" |
27 | #include "lib/playback_control.h" | 27 | #include "lib/playback_control.h" |
28 | 28 | ||
29 | 29 | PLUGIN_HEADER | |
30 | 30 | ||
31 | /* save files */ | 31 | /* save files */ |
32 | #define SCORE_FILE PLUGIN_GAMES_DIR "/blackjack.score" | 32 | #define SCORE_FILE PLUGIN_GAMES_DIR "/blackjack.score" |
diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c index 1ee5b1eaeb..f193818850 100644 --- a/apps/plugins/bounce.c +++ b/apps/plugins/bounce.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "time.h" | 22 | #include "time.h" |
23 | #include "lib/fixedpoint.h" | 23 | #include "lib/fixedpoint.h" |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | #define SS_TITLE "Bouncer" | 27 | #define SS_TITLE "Bouncer" |
28 | 28 | ||
diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index 50ceaa7557..98de3d439f 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include "pluginbitmaps/brickmania_break.h" | 41 | #include "pluginbitmaps/brickmania_break.h" |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | 44 | PLUGIN_HEADER | |
45 | 45 | ||
46 | 46 | ||
47 | /* | 47 | /* |
diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c index 320fd3e4c6..f169a2ef45 100644 --- a/apps/plugins/bubbles.c +++ b/apps/plugins/bubbles.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include "lib/playback_control.h" | 31 | #include "lib/playback_control.h" |
32 | #include "lib/highscore.h" | 32 | #include "lib/highscore.h" |
33 | 33 | ||
34 | PLUGIN_HEADER | ||
35 | |||
34 | /* files */ | 36 | /* files */ |
35 | #define SCORE_FILE PLUGIN_GAMES_DIR "/bubbles.score" | 37 | #define SCORE_FILE PLUGIN_GAMES_DIR "/bubbles.score" |
36 | #define SAVE_FILE PLUGIN_GAMES_DIR "/bubbles.save" | 38 | #define SAVE_FILE PLUGIN_GAMES_DIR "/bubbles.save" |
diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c index 8068b9c4f3..95b35e903c 100644 --- a/apps/plugins/calculator.c +++ b/apps/plugins/calculator.c | |||
@@ -78,7 +78,7 @@ F3: equal to "=" | |||
78 | #ifdef HAVE_LCD_BITMAP | 78 | #ifdef HAVE_LCD_BITMAP |
79 | #include "math.h" | 79 | #include "math.h" |
80 | 80 | ||
81 | 81 | PLUGIN_HEADER | |
82 | 82 | ||
83 | 83 | ||
84 | #define M_TWOPI (M_PI * 2.0) | 84 | #define M_TWOPI (M_PI * 2.0) |
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 32d4501920..13abdfc29a 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "lib/playback_control.h" | 25 | #include "lib/playback_control.h" |
26 | #include "lib/configfile.h" | 26 | #include "lib/configfile.h" |
27 | 27 | ||
28 | 28 | PLUGIN_HEADER | |
29 | 29 | ||
30 | #if CONFIG_KEYPAD == RECORDER_PAD | 30 | #if CONFIG_KEYPAD == RECORDER_PAD |
31 | #define CALENDAR_QUIT BUTTON_OFF | 31 | #define CALENDAR_QUIT BUTTON_OFF |
diff --git a/apps/plugins/chessbox.c b/apps/plugins/chessbox.c index 14d2936848..a6db7ba949 100644 --- a/apps/plugins/chessbox.c +++ b/apps/plugins/chessbox.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #include "lib/overlay.h" | 25 | #include "lib/overlay.h" |
26 | 26 | ||
27 | 27 | PLUGIN_HEADER | |
28 | 28 | ||
29 | /* this is the plugin entry point */ | 29 | /* this is the plugin entry point */ |
30 | enum plugin_status plugin_start(const void* parameter) | 30 | enum plugin_status plugin_start(const void* parameter) |
diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c index 4e298a8214..45f052d30a 100644 --- a/apps/plugins/chessbox/chessbox.c +++ b/apps/plugins/chessbox/chessbox.c | |||
@@ -49,7 +49,7 @@ struct cb_command { | |||
49 | extern const fb_data chessbox_pieces[]; | 49 | extern const fb_data chessbox_pieces[]; |
50 | 50 | ||
51 | 51 | ||
52 | 52 | PLUGIN_HEADER | |
53 | 53 | ||
54 | /* Tile size defined by the assigned bitmap */ | 54 | /* Tile size defined by the assigned bitmap */ |
55 | #include "pluginbitmaps/chessbox_pieces.h" | 55 | #include "pluginbitmaps/chessbox_pieces.h" |
diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c index 0ddfcb59fc..3afa705bf1 100644 --- a/apps/plugins/chessclock.c +++ b/apps/plugins/chessclock.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include "lib/playback_control.h" | 22 | #include "lib/playback_control.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | /* variable button definitions */ | 26 | /* variable button definitions */ |
27 | #if CONFIG_KEYPAD == RECORDER_PAD | 27 | #if CONFIG_KEYPAD == RECORDER_PAD |
diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c index cca6229a3f..f60bdb36c0 100644 --- a/apps/plugins/chip8.c +++ b/apps/plugins/chip8.c | |||
@@ -21,7 +21,7 @@ | |||
21 | ****************************************************************************/ | 21 | ****************************************************************************/ |
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | #define EXTERN static | 26 | #define EXTERN static |
27 | #define STATIC static | 27 | #define STATIC static |
diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c index 86f1bfba5d..67cb9ee760 100644 --- a/apps/plugins/chopper.c +++ b/apps/plugins/chopper.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "lib/helper.h" | 26 | #include "lib/helper.h" |
27 | #include "lib/playback_control.h" | 27 | #include "lib/playback_control.h" |
28 | 28 | ||
29 | 29 | PLUGIN_HEADER | |
30 | 30 | ||
31 | /* | 31 | /* |
32 | Still To do: | 32 | Still To do: |
diff --git a/apps/plugins/clix.c b/apps/plugins/clix.c index 0bdf693f54..0735656839 100644 --- a/apps/plugins/clix.c +++ b/apps/plugins/clix.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "lib/playback_control.h" | 22 | #include "lib/playback_control.h" |
23 | #include "lib/display_text.h" | 23 | #include "lib/display_text.h" |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | #if (CONFIG_KEYPAD == SANSA_E200_PAD) | 27 | #if (CONFIG_KEYPAD == SANSA_E200_PAD) |
28 | #define CLIX_BUTTON_QUIT BUTTON_POWER | 28 | #define CLIX_BUTTON_QUIT BUTTON_POWER |
diff --git a/apps/plugins/clock/clock.c b/apps/plugins/clock/clock.c index 8a1a55e17f..f06f3e15e4 100644 --- a/apps/plugins/clock/clock.c +++ b/apps/plugins/clock/clock.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "time.h" | 23 | #include "time.h" |
24 | #include "lib/pluginlib_actions.h" | 24 | #include "lib/pluginlib_actions.h" |
25 | #include "lib/pluginlib_exit.h" | ||
26 | #include "lib/xlcd.h" | 25 | #include "lib/xlcd.h" |
27 | 26 | ||
28 | #include "clock.h" | 27 | #include "clock.h" |
@@ -31,7 +30,7 @@ | |||
31 | #include "clock_menu.h" | 30 | #include "clock_menu.h" |
32 | #include "clock_settings.h" | 31 | #include "clock_settings.h" |
33 | 32 | ||
34 | 33 | PLUGIN_HEADER | |
35 | 34 | ||
36 | /* Keymaps */ | 35 | /* Keymaps */ |
37 | const struct button_mapping* plugin_contexts[]={ | 36 | const struct button_mapping* plugin_contexts[]={ |
@@ -57,8 +56,9 @@ const struct button_mapping* plugin_contexts[]={ | |||
57 | /************************** | 56 | /************************** |
58 | * Cleanup on plugin return | 57 | * Cleanup on plugin return |
59 | *************************/ | 58 | *************************/ |
60 | void cleanup(void) | 59 | void cleanup(void *parameter) |
61 | { | 60 | { |
61 | (void)parameter; | ||
62 | clock_draw_restore_colors(); | 62 | clock_draw_restore_colors(); |
63 | if(clock_settings.general.save_settings == 1) | 63 | if(clock_settings.general.save_settings == 1) |
64 | save_settings(); | 64 | save_settings(); |
@@ -115,7 +115,6 @@ enum plugin_status plugin_start(const void* parameter){ | |||
115 | struct counter counter; | 115 | struct counter counter; |
116 | bool exit_clock = false; | 116 | bool exit_clock = false; |
117 | (void)parameter; | 117 | (void)parameter; |
118 | atexit(cleanup); | ||
119 | 118 | ||
120 | #if LCD_DEPTH > 1 | 119 | #if LCD_DEPTH > 1 |
121 | rb->lcd_set_backdrop(NULL); | 120 | rb->lcd_set_backdrop(NULL); |
@@ -175,7 +174,9 @@ enum plugin_status plugin_start(const void* parameter){ | |||
175 | exit_clock=main_menu(); | 174 | exit_clock=main_menu(); |
176 | break; | 175 | break; |
177 | default: | 176 | default: |
178 | exit_on_usb(button); | 177 | if(rb->default_event_handler_ex(button, cleanup, NULL) |
178 | == SYS_USB_CONNECTED) | ||
179 | return PLUGIN_USB_CONNECTED; | ||
179 | if(time.second != last_second){ | 180 | if(time.second != last_second){ |
180 | last_second=time.second; | 181 | last_second=time.second; |
181 | redraw=true; | 182 | redraw=true; |
@@ -192,5 +193,6 @@ enum plugin_status plugin_start(const void* parameter){ | |||
192 | } | 193 | } |
193 | } | 194 | } |
194 | 195 | ||
196 | cleanup(NULL); | ||
195 | return PLUGIN_OK; | 197 | return PLUGIN_OK; |
196 | } | 198 | } |
diff --git a/apps/plugins/codebuster.c b/apps/plugins/codebuster.c index 1169f265c3..810bd0c570 100644 --- a/apps/plugins/codebuster.c +++ b/apps/plugins/codebuster.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "lib/playback_control.h" | 24 | #include "lib/playback_control.h" |
25 | #include "lib/pluginlib_actions.h" | 25 | #include "lib/pluginlib_actions.h" |
26 | 26 | ||
27 | 27 | PLUGIN_HEADER | |
28 | 28 | ||
29 | /* Limits */ | 29 | /* Limits */ |
30 | #define MAX_PIECES_COUNT 5 | 30 | #define MAX_PIECES_COUNT 5 |
diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c index a05b44c20d..0251849c11 100644 --- a/apps/plugins/credits.c +++ b/apps/plugins/credits.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include "lib/helper.h" | 22 | #include "lib/helper.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | static const char* const credits[] = { | 26 | static const char* const credits[] = { |
27 | #include "credits.raw" /* generated list of names from docs/CREDITS */ | 27 | #include "credits.raw" /* generated list of names from docs/CREDITS */ |
diff --git a/apps/plugins/crypt_firmware.c b/apps/plugins/crypt_firmware.c index f9bdd4d031..051a3d1bd9 100644 --- a/apps/plugins/crypt_firmware.c +++ b/apps/plugins/crypt_firmware.c | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | #include "plugin.h" | 38 | #include "plugin.h" |
39 | 39 | ||
40 | 40 | PLUGIN_HEADER | |
41 | 41 | ||
42 | static void aes_encrypt(void* data, uint32_t size) | 42 | static void aes_encrypt(void* data, uint32_t size) |
43 | { | 43 | { |
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c index 7dec822d56..2b1e00d690 100644 --- a/apps/plugins/cube.c +++ b/apps/plugins/cube.c | |||
@@ -22,7 +22,6 @@ | |||
22 | ***************************************************************************/ | 22 | ***************************************************************************/ |
23 | #include "plugin.h" | 23 | #include "plugin.h" |
24 | #include "lib/playergfx.h" | 24 | #include "lib/playergfx.h" |
25 | #include "lib/pluginlib_exit.h" | ||
26 | #if LCD_DEPTH > 1 | 25 | #if LCD_DEPTH > 1 |
27 | #include "lib/mylcd.h" /* MYLCD_CFG_RB_XLCD or MYLCD_CFG_PGFX */ | 26 | #include "lib/mylcd.h" /* MYLCD_CFG_RB_XLCD or MYLCD_CFG_PGFX */ |
28 | #include "lib/grey.h" | 27 | #include "lib/grey.h" |
@@ -33,6 +32,8 @@ | |||
33 | #include "lib/xlcd.h" | 32 | #include "lib/xlcd.h" |
34 | #include "lib/fixedpoint.h" | 33 | #include "lib/fixedpoint.h" |
35 | 34 | ||
35 | PLUGIN_HEADER | ||
36 | |||
36 | /* Loops that the values are displayed */ | 37 | /* Loops that the values are displayed */ |
37 | #define DISP_TIME 30 | 38 | #define DISP_TIME 30 |
38 | 39 | ||
@@ -610,8 +611,10 @@ static void cube_draw(void) | |||
610 | } | 611 | } |
611 | } | 612 | } |
612 | 613 | ||
613 | void cleanup(void) | 614 | void cleanup(void *parameter) |
614 | { | 615 | { |
616 | (void)parameter; | ||
617 | |||
615 | #ifdef USEGSLIB | 618 | #ifdef USEGSLIB |
616 | grey_release(); | 619 | grey_release(); |
617 | #elif defined HAVE_LCD_CHARCELLS | 620 | #elif defined HAVE_LCD_CHARCELLS |
@@ -635,7 +638,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
635 | bool highspeed = false; | 638 | bool highspeed = false; |
636 | bool paused = false; | 639 | bool paused = false; |
637 | bool redraw = true; | 640 | bool redraw = true; |
638 | bool quit = false; | 641 | bool exit = false; |
639 | 642 | ||
640 | (void)(parameter); | 643 | (void)(parameter); |
641 | 644 | ||
@@ -648,7 +651,6 @@ enum plugin_status plugin_start(const void* parameter) | |||
648 | rb->splash(HZ, "Couldn't init greyscale display"); | 651 | rb->splash(HZ, "Couldn't init greyscale display"); |
649 | return PLUGIN_ERROR; | 652 | return PLUGIN_ERROR; |
650 | } | 653 | } |
651 | |||
652 | /* init lcd_ function pointers */ | 654 | /* init lcd_ function pointers */ |
653 | lcdfuncs.update = rb->lcd_update; | 655 | lcdfuncs.update = rb->lcd_update; |
654 | lcdfuncs.clear_display = rb->lcd_clear_display; | 656 | lcdfuncs.clear_display = rb->lcd_clear_display; |
@@ -671,8 +673,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
671 | pgfx_display(0, 0); | 673 | pgfx_display(0, 0); |
672 | #endif | 674 | #endif |
673 | 675 | ||
674 | atexit(cleanup); | 676 | while(!exit) |
675 | while(!quit) | ||
676 | { | 677 | { |
677 | if (redraw) | 678 | if (redraw) |
678 | { | 679 | { |
@@ -829,17 +830,24 @@ enum plugin_status plugin_start(const void* parameter) | |||
829 | case CUBE_RC_QUIT: | 830 | case CUBE_RC_QUIT: |
830 | #endif | 831 | #endif |
831 | case CUBE_QUIT: | 832 | case CUBE_QUIT: |
832 | exit(EXIT_SUCCESS); | 833 | exit = true; |
833 | break; | 834 | break; |
834 | 835 | ||
835 | default: | 836 | default: |
836 | exit_on_usb(button); | 837 | if (rb->default_event_handler_ex(button, cleanup, NULL) |
838 | == SYS_USB_CONNECTED) | ||
839 | return PLUGIN_USB_CONNECTED; | ||
837 | break; | 840 | break; |
838 | } | 841 | } |
839 | if (button != BUTTON_NONE) | 842 | if (button != BUTTON_NONE) |
840 | lastbutton = button; | 843 | lastbutton = button; |
841 | } | 844 | } |
842 | 845 | ||
846 | #ifdef USEGSLIB | ||
847 | grey_release(); | ||
848 | #elif defined(HAVE_LCD_CHARCELLS) | ||
849 | pgfx_release(); | ||
850 | #endif | ||
843 | return PLUGIN_OK; | 851 | return PLUGIN_OK; |
844 | } | 852 | } |
845 | 853 | ||
diff --git a/apps/plugins/demystify.c b/apps/plugins/demystify.c index 6a8f1eb0c1..468f1806ce 100644 --- a/apps/plugins/demystify.c +++ b/apps/plugins/demystify.c | |||
@@ -22,12 +22,11 @@ | |||
22 | ****************************************************************************/ | 22 | ****************************************************************************/ |
23 | 23 | ||
24 | #include "plugin.h" | 24 | #include "plugin.h" |
25 | #include "lib/pluginlib_exit.h" | ||
26 | 25 | ||
27 | #ifdef HAVE_LCD_BITMAP | 26 | #ifdef HAVE_LCD_BITMAP |
28 | #include "lib/pluginlib_actions.h" | 27 | #include "lib/pluginlib_actions.h" |
29 | #include "lib/helper.h" | 28 | #include "lib/helper.h" |
30 | 29 | PLUGIN_HEADER | |
31 | 30 | ||
32 | #define DEFAULT_WAIT_TIME 3 | 31 | #define DEFAULT_WAIT_TIME 3 |
33 | #define DEFAULT_NB_POLYGONS 7 | 32 | #define DEFAULT_NB_POLYGONS 7 |
@@ -260,8 +259,10 @@ void polygons_draw(struct polygon_fifo * polygons, struct screen * display) | |||
260 | } | 259 | } |
261 | } | 260 | } |
262 | 261 | ||
263 | void cleanup(void) | 262 | void cleanup(void *parameter) |
264 | { | 263 | { |
264 | (void)parameter; | ||
265 | |||
265 | backlight_use_settings(); | 266 | backlight_use_settings(); |
266 | #ifdef HAVE_REMOTE_LCD | 267 | #ifdef HAVE_REMOTE_LCD |
267 | remote_backlight_use_settings(); | 268 | remote_backlight_use_settings(); |
@@ -393,6 +394,7 @@ int plugin_main(void) | |||
393 | switch(action) | 394 | switch(action) |
394 | { | 395 | { |
395 | case DEMYSTIFY_QUIT: | 396 | case DEMYSTIFY_QUIT: |
397 | cleanup(NULL); | ||
396 | return PLUGIN_OK; | 398 | return PLUGIN_OK; |
397 | 399 | ||
398 | case DEMYSTIFY_ADD_POLYGON: | 400 | case DEMYSTIFY_ADD_POLYGON: |
@@ -419,7 +421,9 @@ int plugin_main(void) | |||
419 | break; | 421 | break; |
420 | 422 | ||
421 | default: | 423 | default: |
422 | exit_on_usb(action); | 424 | if (rb->default_event_handler_ex(action, cleanup, NULL) |
425 | == SYS_USB_CONNECTED) | ||
426 | return PLUGIN_USB_CONNECTED; | ||
423 | break; | 427 | break; |
424 | } | 428 | } |
425 | } | 429 | } |
@@ -432,8 +436,6 @@ enum plugin_status plugin_start(const void* parameter) | |||
432 | int ret; | 436 | int ret; |
433 | 437 | ||
434 | (void)parameter; | 438 | (void)parameter; |
435 | atexit(cleanup); | ||
436 | |||
437 | #if LCD_DEPTH > 1 | 439 | #if LCD_DEPTH > 1 |
438 | rb->lcd_set_backdrop(NULL); | 440 | rb->lcd_set_backdrop(NULL); |
439 | #endif | 441 | #endif |
diff --git a/apps/plugins/dice.c b/apps/plugins/dice.c index 7acb2e79ca..7bd51122ee 100644 --- a/apps/plugins/dice.c +++ b/apps/plugins/dice.c | |||
@@ -45,7 +45,7 @@ struct dices | |||
45 | }; | 45 | }; |
46 | 46 | ||
47 | #define PRINT_BUFFER_LENGTH MAX_DICES*4 | 47 | #define PRINT_BUFFER_LENGTH MAX_DICES*4 |
48 | 48 | PLUGIN_HEADER | |
49 | 49 | ||
50 | static struct dices dice; | 50 | static struct dices dice; |
51 | static int sides_index; | 51 | static int sides_index; |
diff --git a/apps/plugins/dict.c b/apps/plugins/dict.c index a9c481742d..13fe8e3cc6 100644 --- a/apps/plugins/dict.c +++ b/apps/plugins/dict.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "lib/simple_viewer.h" | 23 | #include "lib/simple_viewer.h" |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | #define MIN_DESC_BUF_SIZE 0x400 /* arbitrary minimum size for description */ | 27 | #define MIN_DESC_BUF_SIZE 0x400 /* arbitrary minimum size for description */ |
28 | 28 | ||
diff --git a/apps/plugins/disktidy.c b/apps/plugins/disktidy.c index d83ecf4312..8d8515e27b 100644 --- a/apps/plugins/disktidy.c +++ b/apps/plugins/disktidy.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include "errno.h" | 22 | #include "errno.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | /* function return values */ | 26 | /* function return values */ |
27 | enum tidy_return | 27 | enum tidy_return |
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c index 324cb24d51..042212812a 100644 --- a/apps/plugins/doom/rockdoom.c +++ b/apps/plugins/doom/rockdoom.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include "st_stuff.h" | 41 | #include "st_stuff.h" |
42 | #include "lib/helper.h" | 42 | #include "lib/helper.h" |
43 | 43 | ||
44 | 44 | PLUGIN_HEADER | |
45 | PLUGIN_IRAM_DECLARE | 45 | PLUGIN_IRAM_DECLARE |
46 | 46 | ||
47 | extern boolean timingdemo, singledemo, demoplayback, fastdemo; // killough | 47 | extern boolean timingdemo, singledemo, demoplayback, fastdemo; // killough |
diff --git a/apps/plugins/euroconverter.c b/apps/plugins/euroconverter.c index 24cebe69d1..f85ee798c4 100644 --- a/apps/plugins/euroconverter.c +++ b/apps/plugins/euroconverter.c | |||
@@ -45,7 +45,7 @@ To do: | |||
45 | - The Irish currency needs 6 digits after the . to have sufficient precision on big number | 45 | - The Irish currency needs 6 digits after the . to have sufficient precision on big number |
46 | */ | 46 | */ |
47 | 47 | ||
48 | 48 | PLUGIN_HEADER | |
49 | 49 | ||
50 | /* Name and path of the config file*/ | 50 | /* Name and path of the config file*/ |
51 | static const char cfg_filename[] = "euroconverter.cfg"; | 51 | static const char cfg_filename[] = "euroconverter.cfg"; |
@@ -387,8 +387,10 @@ static int euro_menu(void) | |||
387 | 387 | ||
388 | 388 | ||
389 | /* Call when the program end */ | 389 | /* Call when the program end */ |
390 | static void euro_exit(void) | 390 | static void euro_exit(void *parameter) |
391 | { | 391 | { |
392 | (void)parameter; | ||
393 | |||
392 | //Restore the old pattern (i don't find another way to do this. An idea?) | 394 | //Restore the old pattern (i don't find another way to do this. An idea?) |
393 | rb->lcd_unlock_pattern(heuro); | 395 | rb->lcd_unlock_pattern(heuro); |
394 | rb->lcd_unlock_pattern(hhome); | 396 | rb->lcd_unlock_pattern(hhome); |
@@ -409,7 +411,6 @@ enum plugin_status plugin_start(const void* parameter) | |||
409 | /* if you don't use the parameter, you can do like | 411 | /* if you don't use the parameter, you can do like |
410 | this to avoid the compiler warning about it */ | 412 | this to avoid the compiler warning about it */ |
411 | (void)parameter; | 413 | (void)parameter; |
412 | atexit(euro_exit); | ||
413 | 414 | ||
414 | /*Get the pattern handle*/ | 415 | /*Get the pattern handle*/ |
415 | heuro=rb->lcd_get_locked_pattern(); | 416 | heuro=rb->lcd_get_locked_pattern(); |
@@ -586,7 +587,9 @@ enum plugin_status plugin_start(const void* parameter) | |||
586 | break; | 587 | break; |
587 | 588 | ||
588 | default: | 589 | default: |
589 | exit_on_usb(button); | 590 | if (rb->default_event_handler_ex(button, euro_exit, NULL) |
591 | == SYS_USB_CONNECTED) | ||
592 | return PLUGIN_USB_CONNECTED; | ||
590 | break; | 593 | break; |
591 | } | 594 | } |
592 | /*Display*/ | 595 | /*Display*/ |
@@ -596,6 +599,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
596 | e=mydiv(h,currency[country]); | 599 | e=mydiv(h,currency[country]); |
597 | display(e,h,pos); | 600 | display(e,h,pos); |
598 | } | 601 | } |
602 | euro_exit(NULL); | ||
599 | return PLUGIN_OK; | 603 | return PLUGIN_OK; |
600 | } | 604 | } |
601 | 605 | ||
diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c index a9724196ac..e352c1c041 100644 --- a/apps/plugins/fft/fft.c +++ b/apps/plugins/fft/fft.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #endif | 29 | #endif |
30 | #include "lib/mylcd.h" | 30 | #include "lib/mylcd.h" |
31 | 31 | ||
32 | 32 | PLUGIN_HEADER | |
33 | 33 | ||
34 | #ifndef HAVE_LCD_COLOR | 34 | #ifndef HAVE_LCD_COLOR |
35 | GREY_INFO_STRUCT | 35 | GREY_INFO_STRUCT |
diff --git a/apps/plugins/fire.c b/apps/plugins/fire.c index 268a934692..e1362dc900 100644 --- a/apps/plugins/fire.c +++ b/apps/plugins/fire.c | |||
@@ -41,6 +41,8 @@ | |||
41 | #define FIRE_XPOS 0 | 41 | #define FIRE_XPOS 0 |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | PLUGIN_HEADER | ||
45 | |||
44 | #ifndef HAVE_LCD_COLOR | 46 | #ifndef HAVE_LCD_COLOR |
45 | GREY_INFO_STRUCT | 47 | GREY_INFO_STRUCT |
46 | static unsigned char draw_buffer[FIRE_WIDTH]; | 48 | static unsigned char draw_buffer[FIRE_WIDTH]; |
diff --git a/apps/plugins/fireworks.c b/apps/plugins/fireworks.c index 1954f19cac..1ad5f9a2ca 100644 --- a/apps/plugins/fireworks.c +++ b/apps/plugins/fireworks.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "lib/helper.h" | 22 | #include "lib/helper.h" |
23 | #include "lib/playback_control.h" | 23 | #include "lib/playback_control.h" |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | /*** | 27 | /*** |
28 | * FIREWORKS.C by ZAKK ROBERTS | 28 | * FIREWORKS.C by ZAKK ROBERTS |
diff --git a/apps/plugins/firmware_flash.c b/apps/plugins/firmware_flash.c index 02c4098ec1..317bc92f04 100644 --- a/apps/plugins/firmware_flash.c +++ b/apps/plugins/firmware_flash.c | |||
@@ -77,7 +77,7 @@ | |||
77 | #error this platform is not (yet) flashable | 77 | #error this platform is not (yet) flashable |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | 80 | PLUGIN_HEADER | |
81 | 81 | ||
82 | #if CONFIG_KEYPAD == ONDIO_PAD /* limited keypad */ | 82 | #if CONFIG_KEYPAD == ONDIO_PAD /* limited keypad */ |
83 | #define KEY1 BUTTON_LEFT | 83 | #define KEY1 BUTTON_LEFT |
diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c index 44ad011a64..d4c5702bc0 100644 --- a/apps/plugins/flipit.c +++ b/apps/plugins/flipit.c | |||
@@ -20,7 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | 22 | ||
23 | 23 | PLUGIN_HEADER | |
24 | 24 | ||
25 | /* variable button definitions */ | 25 | /* variable button definitions */ |
26 | #if CONFIG_KEYPAD == RECORDER_PAD | 26 | #if CONFIG_KEYPAD == RECORDER_PAD |
diff --git a/apps/plugins/fractals/fractal.c b/apps/plugins/fractals/fractal.c index 179bc3e562..971ae506ca 100644 --- a/apps/plugins/fractals/fractal.c +++ b/apps/plugins/fractals/fractal.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include "fractal_rect.h" | 29 | #include "fractal_rect.h" |
30 | #include "fractal_sets.h" | 30 | #include "fractal_sets.h" |
31 | #include "mandelbrot_set.h" | 31 | #include "mandelbrot_set.h" |
32 | #include "lib/pluginlib_exit.h" | ||
33 | 32 | ||
34 | #ifdef USEGSLIB | 33 | #ifdef USEGSLIB |
35 | GREY_INFO_STRUCT | 34 | GREY_INFO_STRUCT |
@@ -42,7 +41,7 @@ static size_t gbuf_size = 0; | |||
42 | #define REDRAW_FULL 2 | 41 | #define REDRAW_FULL 2 |
43 | #define REDRAW_FULL_OVERLAY 3 | 42 | #define REDRAW_FULL_OVERLAY 3 |
44 | 43 | ||
45 | 44 | PLUGIN_HEADER | |
46 | 45 | ||
47 | /* returns 1 if a button has been pressed, 0 otherwise */ | 46 | /* returns 1 if a button has been pressed, 0 otherwise */ |
48 | static int button_yield(void *ctx) | 47 | static int button_yield(void *ctx) |
@@ -86,8 +85,9 @@ static int button_yield(void *ctx) | |||
86 | } | 85 | } |
87 | } | 86 | } |
88 | 87 | ||
89 | static void cleanup(void) | 88 | static void cleanup(void *parameter) |
90 | { | 89 | { |
90 | (void)parameter; | ||
91 | #ifdef USEGSLIB | 91 | #ifdef USEGSLIB |
92 | grey_release(); | 92 | grey_release(); |
93 | #endif | 93 | #endif |
@@ -109,13 +109,11 @@ enum plugin_status plugin_start(const void* parameter) | |||
109 | if (!grey_init(gbuf, gbuf_size, GREY_ON_COP, LCD_WIDTH, LCD_HEIGHT, NULL)) | 109 | if (!grey_init(gbuf, gbuf_size, GREY_ON_COP, LCD_WIDTH, LCD_HEIGHT, NULL)) |
110 | { | 110 | { |
111 | rb->splash(HZ, "Couldn't init greyscale display"); | 111 | rb->splash(HZ, "Couldn't init greyscale display"); |
112 | return PLUGIN_ERROR; | 112 | return 0; |
113 | } | 113 | } |
114 | grey_show(true); /* switch on greyscale overlay */ | 114 | grey_show(true); /* switch on greyscale overlay */ |
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | /* release greylib on exit */ | ||
118 | atexit(cleanup); | ||
119 | #if LCD_DEPTH > 1 | 117 | #if LCD_DEPTH > 1 |
120 | rb->lcd_set_backdrop(NULL); | 118 | rb->lcd_set_backdrop(NULL); |
121 | #endif | 119 | #endif |
@@ -163,6 +161,9 @@ enum plugin_status plugin_start(const void* parameter) | |||
163 | case FRACTAL_RC_QUIT: | 161 | case FRACTAL_RC_QUIT: |
164 | #endif | 162 | #endif |
165 | case FRACTAL_QUIT: | 163 | case FRACTAL_QUIT: |
164 | #ifdef USEGSLIB | ||
165 | grey_release(); | ||
166 | #endif | ||
166 | return PLUGIN_OK; | 167 | return PLUGIN_OK; |
167 | 168 | ||
168 | case FRACTAL_ZOOM_OUT: | 169 | case FRACTAL_ZOOM_OUT: |
@@ -245,13 +246,18 @@ enum plugin_status plugin_start(const void* parameter) | |||
245 | break; | 246 | break; |
246 | 247 | ||
247 | default: | 248 | default: |
248 | exit_on_usb(button); | 249 | if (rb->default_event_handler_ex(button, cleanup, NULL) |
250 | == SYS_USB_CONNECTED) | ||
251 | return PLUGIN_USB_CONNECTED; | ||
249 | break; | 252 | break; |
250 | } | 253 | } |
251 | 254 | ||
252 | if (button != BUTTON_NONE) | 255 | if (button != BUTTON_NONE) |
253 | lastbutton = button; | 256 | lastbutton = button; |
254 | } | 257 | } |
258 | #ifdef USEGSLIB | ||
259 | grey_release(); | ||
260 | #endif | ||
255 | return PLUGIN_OK; | 261 | return PLUGIN_OK; |
256 | } | 262 | } |
257 | 263 | ||
diff --git a/apps/plugins/frotz/frotz.c b/apps/plugins/frotz/frotz.c index 23da650706..aff91002ef 100644 --- a/apps/plugins/frotz/frotz.c +++ b/apps/plugins/frotz/frotz.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "lib/pluginlib_exit.h" | 23 | #include "lib/pluginlib_exit.h" |
24 | #include "lib/pluginlib_actions.h" | 24 | #include "lib/pluginlib_actions.h" |
25 | 25 | ||
26 | 26 | PLUGIN_HEADER | |
27 | 27 | ||
28 | extern int frotz_main(void); | 28 | extern int frotz_main(void); |
29 | extern bool hot_key_quit(void); | 29 | extern bool hot_key_quit(void); |
@@ -41,7 +41,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
41 | int i; | 41 | int i; |
42 | char* ext; | 42 | char* ext; |
43 | 43 | ||
44 | atexit(atexit_cleanup); | 44 | PLUGINLIB_EXIT_INIT_ATEXIT(atexit_cleanup); |
45 | 45 | ||
46 | if (!parameter) | 46 | if (!parameter) |
47 | return PLUGIN_ERROR; | 47 | return PLUGIN_ERROR; |
diff --git a/apps/plugins/goban.c b/apps/plugins/goban.c index 1a121202c6..7bb6744dde 100644 --- a/apps/plugins/goban.c +++ b/apps/plugins/goban.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #include "lib/overlay.h" | 25 | #include "lib/overlay.h" |
26 | 26 | ||
27 | 27 | PLUGIN_HEADER | |
28 | 28 | ||
29 | enum plugin_status plugin_start(const void* parameter) | 29 | enum plugin_status plugin_start(const void* parameter) |
30 | { | 30 | { |
diff --git a/apps/plugins/goban/goban.c b/apps/plugins/goban/goban.c index b2306c00a8..4e20e71a37 100644 --- a/apps/plugins/goban/goban.c +++ b/apps/plugins/goban/goban.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "lib/playback_control.h" | 23 | #include "lib/playback_control.h" |
24 | #include "lib/configfile.h" | 24 | #include "lib/configfile.h" |
25 | 25 | ||
26 | 26 | PLUGIN_HEADER | |
27 | 27 | ||
28 | #include "goban.h" | 28 | #include "goban.h" |
29 | #include "game.h" | 29 | #include "game.h" |
diff --git a/apps/plugins/greyscale.c b/apps/plugins/greyscale.c index 33254439b6..73dd98b216 100644 --- a/apps/plugins/greyscale.c +++ b/apps/plugins/greyscale.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) | 27 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) |
28 | #include "lib/grey.h" | 28 | #include "lib/grey.h" |
29 | 29 | ||
30 | 30 | PLUGIN_HEADER | |
31 | 31 | ||
32 | /* variable button definitions */ | 32 | /* variable button definitions */ |
33 | #if CONFIG_KEYPAD == RECORDER_PAD | 33 | #if CONFIG_KEYPAD == RECORDER_PAD |
@@ -316,7 +316,9 @@ int main(void) | |||
316 | 316 | ||
317 | button = rb->button_get(true); | 317 | button = rb->button_get(true); |
318 | 318 | ||
319 | exit_on_usb(button); | 319 | if (rb->default_event_handler_ex(button, cleanup, NULL) |
320 | == SYS_USB_CONNECTED) | ||
321 | return PLUGIN_USB_CONNECTED; | ||
320 | 322 | ||
321 | if (button & GREYSCALE_SHIFT) | 323 | if (button & GREYSCALE_SHIFT) |
322 | { | 324 | { |
@@ -367,6 +369,8 @@ int main(void) | |||
367 | case GREYSCALE_RC_OFF: | 369 | case GREYSCALE_RC_OFF: |
368 | #endif | 370 | #endif |
369 | case GREYSCALE_OFF: | 371 | case GREYSCALE_OFF: |
372 | |||
373 | cleanup(NULL); | ||
370 | return PLUGIN_OK; | 374 | return PLUGIN_OK; |
371 | } | 375 | } |
372 | } | 376 | } |
@@ -378,7 +382,6 @@ enum plugin_status plugin_start(const void* parameter) | |||
378 | { | 382 | { |
379 | (void)parameter; | 383 | (void)parameter; |
380 | 384 | ||
381 | atexit(cleanup); | ||
382 | return main(); | 385 | return main(); |
383 | } | 386 | } |
384 | 387 | ||
diff --git a/apps/plugins/helloworld.c b/apps/plugins/helloworld.c index f1093f0a8b..e582eb77b3 100644 --- a/apps/plugins/helloworld.c +++ b/apps/plugins/helloworld.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | /* This macros must always be included. Should be placed at the top by | 25 | /* This macros must always be included. Should be placed at the top by |
26 | convention, although the actual position doesn't matter */ | 26 | convention, although the actual position doesn't matter */ |
27 | 27 | PLUGIN_HEADER | |
28 | 28 | ||
29 | /* this is the plugin entry point */ | 29 | /* this is the plugin entry point */ |
30 | enum plugin_status plugin_start(const void* parameter) | 30 | enum plugin_status plugin_start(const void* parameter) |
diff --git a/apps/plugins/imageviewer/imageviewer.c b/apps/plugins/imageviewer/imageviewer.c index e581407290..0fd25e7b29 100644 --- a/apps/plugins/imageviewer/imageviewer.c +++ b/apps/plugins/imageviewer/imageviewer.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <lib/configfile.h> | 25 | #include <lib/configfile.h> |
26 | #include "imageviewer.h" | 26 | #include "imageviewer.h" |
27 | 27 | ||
28 | 28 | PLUGIN_HEADER | |
29 | 29 | ||
30 | #ifdef USEGSLIB | 30 | #ifdef USEGSLIB |
31 | GREY_INFO_STRUCT | 31 | GREY_INFO_STRUCT |
diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c index ea4a0a28e5..851487cf9a 100644 --- a/apps/plugins/invadrox.c +++ b/apps/plugins/invadrox.c | |||
@@ -61,7 +61,7 @@ | |||
61 | #define FIRE_WIDTH BMPWIDTH_invadrox_fire | 61 | #define FIRE_WIDTH BMPWIDTH_invadrox_fire |
62 | #define FIRE_HEIGHT BMPHEIGHT_invadrox_fire | 62 | #define FIRE_HEIGHT BMPHEIGHT_invadrox_fire |
63 | 63 | ||
64 | 64 | PLUGIN_HEADER | |
65 | 65 | ||
66 | /* Original graphics is only 1bpp so it should be portable | 66 | /* Original graphics is only 1bpp so it should be portable |
67 | * to most targets. But for now, only support the simple ones. | 67 | * to most targets. But for now, only support the simple ones. |
diff --git a/apps/plugins/iriver_flash.c b/apps/plugins/iriver_flash.c index a1ce22c83f..24542a9398 100644 --- a/apps/plugins/iriver_flash.c +++ b/apps/plugins/iriver_flash.c | |||
@@ -35,7 +35,7 @@ ssize_t audiobuf_size; | |||
35 | 35 | ||
36 | #ifdef PLATFORM_ID | 36 | #ifdef PLATFORM_ID |
37 | 37 | ||
38 | 38 | PLUGIN_HEADER | |
39 | 39 | ||
40 | #if CONFIG_KEYPAD == IRIVER_H100_PAD | 40 | #if CONFIG_KEYPAD == IRIVER_H100_PAD |
41 | #define KEY1 BUTTON_OFF | 41 | #define KEY1 BUTTON_OFF |
diff --git a/apps/plugins/iriverify.c b/apps/plugins/iriverify.c index 1109cde179..4e8ca5b420 100644 --- a/apps/plugins/iriverify.c +++ b/apps/plugins/iriverify.c | |||
@@ -25,7 +25,7 @@ | |||
25 | ****************************************************************************/ | 25 | ****************************************************************************/ |
26 | #include "plugin.h" | 26 | #include "plugin.h" |
27 | 27 | ||
28 | 28 | PLUGIN_HEADER | |
29 | 29 | ||
30 | ssize_t buf_size; | 30 | ssize_t buf_size; |
31 | static char *filename; | 31 | static char *filename; |
diff --git a/apps/plugins/jackpot.c b/apps/plugins/jackpot.c index abf1cf8fb2..56c2910b70 100644 --- a/apps/plugins/jackpot.c +++ b/apps/plugins/jackpot.c | |||
@@ -22,9 +22,8 @@ | |||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "lib/pluginlib_actions.h" | 23 | #include "lib/pluginlib_actions.h" |
24 | #include "lib/picture.h" | 24 | #include "lib/picture.h" |
25 | #include "lib/pluginlib_exit.h" | ||
26 | |||
27 | 25 | ||
26 | PLUGIN_HEADER | ||
28 | 27 | ||
29 | const struct button_mapping* plugin_contexts[]={pla_main_ctx}; | 28 | const struct button_mapping* plugin_contexts[]={pla_main_ctx}; |
30 | #define NB_PICTURES 9 | 29 | #define NB_PICTURES 9 |
@@ -110,8 +109,9 @@ void patterns_deinit(struct screen* display) | |||
110 | #endif /* HAVE_LCD_CHARCELLS */ | 109 | #endif /* HAVE_LCD_CHARCELLS */ |
111 | 110 | ||
112 | /*Call when the program exit*/ | 111 | /*Call when the program exit*/ |
113 | void jackpot_exit(void) | 112 | void jackpot_exit(void *parameter) |
114 | { | 113 | { |
114 | (void)parameter; | ||
115 | #ifdef HAVE_LCD_CHARCELLS | 115 | #ifdef HAVE_LCD_CHARCELLS |
116 | patterns_deinit(rb->screens[SCREEN_MAIN]); | 116 | patterns_deinit(rb->screens[SCREEN_MAIN]); |
117 | #endif /* HAVE_LCD_CHARCELLS */ | 117 | #endif /* HAVE_LCD_CHARCELLS */ |
@@ -298,7 +298,6 @@ enum plugin_status plugin_start(const void* parameter) | |||
298 | int action, i; | 298 | int action, i; |
299 | struct jackpot game; | 299 | struct jackpot game; |
300 | (void)parameter; | 300 | (void)parameter; |
301 | atexit(jackpot_exit); | ||
302 | rb->srand(*rb->current_tick); | 301 | rb->srand(*rb->current_tick); |
303 | #ifdef HAVE_LCD_CHARCELLS | 302 | #ifdef HAVE_LCD_CHARCELLS |
304 | patterns_init(rb->screens[SCREEN_MAIN]); | 303 | patterns_init(rb->screens[SCREEN_MAIN]); |
@@ -324,9 +323,12 @@ enum plugin_status plugin_start(const void* parameter) | |||
324 | break; | 323 | break; |
325 | 324 | ||
326 | default: | 325 | default: |
327 | exit_on_usb(action); | 326 | if (rb->default_event_handler_ex(action, jackpot_exit, NULL) |
327 | == SYS_USB_CONNECTED) | ||
328 | return PLUGIN_USB_CONNECTED; | ||
328 | break; | 329 | break; |
329 | } | 330 | } |
330 | } | 331 | } |
332 | jackpot_exit(NULL); | ||
331 | return PLUGIN_OK; | 333 | return PLUGIN_OK; |
332 | } | 334 | } |
diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c index fdf4ff70e5..c2340aa557 100644 --- a/apps/plugins/jewels.c +++ b/apps/plugins/jewels.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | #ifdef HAVE_LCD_BITMAP | 30 | #ifdef HAVE_LCD_BITMAP |
31 | 31 | ||
32 | 32 | PLUGIN_HEADER | |
33 | 33 | ||
34 | /* button definitions */ | 34 | /* button definitions */ |
35 | #if CONFIG_KEYPAD == RECORDER_PAD | 35 | #if CONFIG_KEYPAD == RECORDER_PAD |
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c index 8ac4064996..a241e40440 100644 --- a/apps/plugins/keybox.c +++ b/apps/plugins/keybox.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include "lib/playback_control.h" | 22 | #include "lib/playback_control.h" |
23 | #include "lib/md5.h" | 23 | #include "lib/md5.h" |
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | #define KEYBOX_FILE PLUGIN_APPS_DIR "/keybox.dat" | 26 | #define KEYBOX_FILE PLUGIN_APPS_DIR "/keybox.dat" |
27 | #define BLOCK_SIZE 8 | 27 | #define BLOCK_SIZE 8 |
diff --git a/apps/plugins/lamp.c b/apps/plugins/lamp.c index 0074933fd8..8c2dff5254 100644 --- a/apps/plugins/lamp.c +++ b/apps/plugins/lamp.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "plugin.h" | 25 | #include "plugin.h" |
26 | #include "lib/helper.h" | 26 | #include "lib/helper.h" |
27 | 27 | ||
28 | 28 | PLUGIN_HEADER | |
29 | 29 | ||
30 | /* variable button definitions - only targets with a colour display */ | 30 | /* variable button definitions - only targets with a colour display */ |
31 | #if defined(HAVE_LCD_COLOR) | 31 | #if defined(HAVE_LCD_COLOR) |
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index 9b8b2146cc..fa12f94730 100644 --- a/apps/plugins/lib/SOURCES +++ b/apps/plugins/lib/SOURCES | |||
@@ -2,6 +2,7 @@ gcc-support.c | |||
2 | pluginlib_actions.c | 2 | pluginlib_actions.c |
3 | helper.c | 3 | helper.c |
4 | md5.c | 4 | md5.c |
5 | pluginlib_exit.c | ||
5 | jhash.c | 6 | jhash.c |
6 | configfile.c | 7 | configfile.c |
7 | fixedpoint.c | 8 | fixedpoint.c |
diff --git a/apps/plugins/lib/pluginlib_exit.c b/apps/plugins/lib/pluginlib_exit.c new file mode 100644 index 0000000000..82ae11aca0 --- /dev/null +++ b/apps/plugins/lib/pluginlib_exit.c | |||
@@ -0,0 +1,25 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Maurus Cuelenaere | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "pluginlib_exit.h" | ||
23 | |||
24 | jmp_buf __exit_env DATA_ATTR; | ||
25 | |||
diff --git a/apps/plugins/lib/pluginlib_exit.h b/apps/plugins/lib/pluginlib_exit.h index 411d0751d1..00cbc8dc7f 100644 --- a/apps/plugins/lib/pluginlib_exit.h +++ b/apps/plugins/lib/pluginlib_exit.h | |||
@@ -22,33 +22,35 @@ | |||
22 | #ifndef __PLUGINLIB_EXIT_H__ | 22 | #ifndef __PLUGINLIB_EXIT_H__ |
23 | #define __PLUGINLIB_EXIT_H__ | 23 | #define __PLUGINLIB_EXIT_H__ |
24 | 24 | ||
25 | /* make sure we are in sync with the real definitions, especially on | 25 | #include "config.h" |
26 | * hosted systems */ | 26 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
27 | #include <stdlib.h> | 27 | #include "../../codecs/lib/setjmp.h" |
28 | #include "gcc_extensions.h" | 28 | #else |
29 | 29 | #include <setjmp.h> | |
30 | /* these are actually implemented in plugin_crt0.c which all plugins link */ | ||
31 | extern int atexit(void (*func)(void)); | ||
32 | extern void exit(int status) NORETURN_ATTR; | ||
33 | /* these don't call the exit handlers */ | ||
34 | extern void _exit(int status) NORETURN_ATTR; | ||
35 | /* C99 version */ | ||
36 | #define _Exit _exit | ||
37 | |||
38 | #ifndef EXIT_SUCCESS | ||
39 | #define EXIT_SUCCESS 0 | ||
40 | #define EXIT_FAILURE 1 | ||
41 | #endif | 30 | #endif |
42 | 31 | ||
43 | /** | 32 | #define _PLUGINLIB_EXIT_INIT(atexit) switch(setjmp(__exit_env)) \ |
44 | * helper function to handle USB connected events coming from | 33 | { \ |
45 | * button_get() | 34 | case 1: \ |
46 | * | 35 | atexit \ |
47 | * it will exit the plugin if usb is detected, but it will call the atexit func | 36 | return PLUGIN_OK; \ |
48 | * before actually showing the usb screen | 37 | case 2: \ |
49 | * | 38 | atexit \ |
50 | * it additionally handles power off as well, with the same behavior | 39 | return PLUGIN_ERROR; \ |
40 | case 0: \ | ||
41 | default: \ | ||
42 | break; \ | ||
43 | } | ||
44 | |||
45 | /* Either PLUGINLIB_EXIT_INIT or PLUGINLIB_EXIT_INIT_ATEXIT needs to be placed | ||
46 | * as the first line in plugin_start. The _ATEXIT version will call the named | ||
47 | * no-argument function when exit() is called before exiting the plugin, to | ||
48 | * allow for cleanup. | ||
51 | */ | 49 | */ |
52 | extern void exit_on_usb(int button); | 50 | #define PLUGINLIB_EXIT_INIT _PLUGINLIB_EXIT_INIT() |
51 | #define PLUGINLIB_EXIT_INIT_ATEXIT(atexit) _PLUGINLIB_EXIT_INIT(atexit();) | ||
52 | |||
53 | extern jmp_buf __exit_env; | ||
54 | #define exit(status) longjmp(__exit_env, status != 0 ? 2 : 1) | ||
53 | 55 | ||
54 | #endif /* __PLUGINLIB_EXIT_H__ */ | 56 | #endif /* __PLUGINLIB_EXIT_H__ */ |
diff --git a/apps/plugins/logo.c b/apps/plugins/logo.c index 43a7c3fd46..db692840ba 100644 --- a/apps/plugins/logo.c +++ b/apps/plugins/logo.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include "lib/playergfx.h" | 22 | #include "lib/playergfx.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | #ifdef HAVE_LCD_BITMAP | 26 | #ifdef HAVE_LCD_BITMAP |
27 | #define DISPLAY_WIDTH LCD_WIDTH | 27 | #define DISPLAY_WIDTH LCD_WIDTH |
diff --git a/apps/plugins/lrcplayer.c b/apps/plugins/lrcplayer.c index 9f43849d5b..43f3b8e359 100644 --- a/apps/plugins/lrcplayer.c +++ b/apps/plugins/lrcplayer.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "lib/helper.h" | 24 | #include "lib/helper.h" |
25 | #include <ctype.h> | 25 | #include <ctype.h> |
26 | 26 | ||
27 | 27 | PLUGIN_HEADER | |
28 | 28 | ||
29 | #define MAX_LINE_LEN 256 | 29 | #define MAX_LINE_LEN 256 |
30 | #define LRC_BUFFER_SIZE 0x3000 /* 12 kiB */ | 30 | #define LRC_BUFFER_SIZE 0x3000 /* 12 kiB */ |
diff --git a/apps/plugins/lua/rocklua.c b/apps/plugins/lua/rocklua.c index 00bfd8e43e..b92c274fb0 100644 --- a/apps/plugins/lua/rocklua.c +++ b/apps/plugins/lua/rocklua.c | |||
@@ -20,6 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "lib/pluginlib_exit.h" | ||
23 | #include "lua.h" | 24 | #include "lua.h" |
24 | #include "lauxlib.h" | 25 | #include "lauxlib.h" |
25 | #include "lualib.h" | 26 | #include "lualib.h" |
@@ -27,7 +28,7 @@ | |||
27 | #include "rockmalloc.h" | 28 | #include "rockmalloc.h" |
28 | #include "luadir.h" | 29 | #include "luadir.h" |
29 | 30 | ||
30 | 31 | PLUGIN_HEADER | |
31 | 32 | ||
32 | static const luaL_Reg lualibs[] = { | 33 | static const luaL_Reg lualibs[] = { |
33 | {"", luaopen_base}, | 34 | {"", luaopen_base}, |
@@ -147,6 +148,8 @@ enum plugin_status plugin_start(const void* parameter) | |||
147 | const char* filename; | 148 | const char* filename; |
148 | int status; | 149 | int status; |
149 | 150 | ||
151 | PLUGINLIB_EXIT_INIT | ||
152 | |||
150 | if (parameter == NULL) | 153 | if (parameter == NULL) |
151 | { | 154 | { |
152 | rb->splash(HZ, "Play a .lua file!"); | 155 | rb->splash(HZ, "Play a .lua file!"); |
diff --git a/apps/plugins/matrix.c b/apps/plugins/matrix.c index d3429699af..5a13b3aa38 100644 --- a/apps/plugins/matrix.c +++ b/apps/plugins/matrix.c | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | 35 | ||
36 | #include "plugin.h" | 36 | #include "plugin.h" |
37 | 37 | PLUGIN_HEADER | |
38 | 38 | ||
39 | /* Images */ | 39 | /* Images */ |
40 | #include "pluginbitmaps/matrix_bold.h" | 40 | #include "pluginbitmaps/matrix_bold.h" |
diff --git a/apps/plugins/maze.c b/apps/plugins/maze.c index 231b602911..465dfa9e84 100644 --- a/apps/plugins/maze.c +++ b/apps/plugins/maze.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include "plugin.h" | 33 | #include "plugin.h" |
34 | #include "lib/helper.h" | 34 | #include "lib/helper.h" |
35 | 35 | ||
36 | 36 | PLUGIN_HEADER | |
37 | 37 | ||
38 | /* key assignments */ | 38 | /* key assignments */ |
39 | 39 | ||
diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c index bb93825453..f4b76df374 100644 --- a/apps/plugins/mazezam.c +++ b/apps/plugins/mazezam.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "lib/playback_control.h" | 25 | #include "lib/playback_control.h" |
26 | 26 | ||
27 | /* Include standard plugin macro */ | 27 | /* Include standard plugin macro */ |
28 | 28 | PLUGIN_HEADER | |
29 | 29 | ||
30 | #if (CONFIG_KEYPAD == IPOD_3G_PAD) | 30 | #if (CONFIG_KEYPAD == IPOD_3G_PAD) |
31 | # define MAZEZAM_MENU BUTTON_MENU | 31 | # define MAZEZAM_MENU BUTTON_MENU |
diff --git a/apps/plugins/md5sum.c b/apps/plugins/md5sum.c index fe1c65efb0..9dd8f5a8a7 100644 --- a/apps/plugins/md5sum.c +++ b/apps/plugins/md5sum.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "lib/md5.h" | 23 | #include "lib/md5.h" |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | #define BUFFERSIZE 16384 | 27 | #define BUFFERSIZE 16384 |
28 | 28 | ||
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c index b38f0bbf2c..37a7329b22 100644 --- a/apps/plugins/metronome.c +++ b/apps/plugins/metronome.c | |||
@@ -20,9 +20,8 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include "lib/pluginlib_actions.h" | 22 | #include "lib/pluginlib_actions.h" |
23 | #include "lib/pluginlib_exit.h" | ||
24 | |||
25 | 23 | ||
24 | PLUGIN_HEADER | ||
26 | 25 | ||
27 | #if CONFIG_CODEC != SWCODEC | 26 | #if CONFIG_CODEC != SWCODEC |
28 | /* tick sound from a metronome */ | 27 | /* tick sound from a metronome */ |
@@ -847,14 +846,13 @@ void timer_callback(void) | |||
847 | } | 846 | } |
848 | } | 847 | } |
849 | 848 | ||
850 | void cleanup(void) | 849 | void cleanup(void *parameter) |
851 | { | 850 | { |
851 | (void)parameter; | ||
852 | |||
852 | rb->timer_unregister(); | 853 | rb->timer_unregister(); |
853 | MET_PLAY_STOP; /* stop audio ISR */ | 854 | MET_PLAY_STOP; /* stop audio ISR */ |
854 | rb->led(0); | 855 | rb->led(0); |
855 | #if CONFIG_CODEC == SWCODEC | ||
856 | rb->pcm_set_frequency(HW_SAMPR_DEFAULT); | ||
857 | #endif | ||
858 | } | 856 | } |
859 | 857 | ||
860 | void tap(void) | 858 | void tap(void) |
@@ -887,9 +885,9 @@ enum plugin_status plugin_start(const void* parameter) | |||
887 | { | 885 | { |
888 | int button; | 886 | int button; |
889 | static int last_button = BUTTON_NONE; | 887 | static int last_button = BUTTON_NONE; |
888 | enum plugin_status status; | ||
890 | 889 | ||
891 | (void)parameter; | 890 | (void)parameter; |
892 | atexit(cleanup); | ||
893 | 891 | ||
894 | if (MET_IS_PLAYING) | 892 | if (MET_IS_PLAYING) |
895 | MET_PLAY_STOP; /* stop audio IS */ | 893 | MET_PLAY_STOP; /* stop audio IS */ |
@@ -929,7 +927,9 @@ enum plugin_status plugin_start(const void* parameter) | |||
929 | 927 | ||
930 | case METRONOME_QUIT: | 928 | case METRONOME_QUIT: |
931 | /* get out of here */ | 929 | /* get out of here */ |
932 | return PLUGIN_OK; | 930 | cleanup(NULL); |
931 | status = PLUGIN_OK; | ||
932 | goto metronome_exit; | ||
933 | 933 | ||
934 | case METRONOME_PAUSE: | 934 | case METRONOME_PAUSE: |
935 | if(!sound_paused) | 935 | if(!sound_paused) |
@@ -981,7 +981,12 @@ enum plugin_status plugin_start(const void* parameter) | |||
981 | #endif | 981 | #endif |
982 | 982 | ||
983 | default: | 983 | default: |
984 | exit_on_usb(button); | 984 | if (rb->default_event_handler_ex(button, cleanup, NULL) |
985 | == SYS_USB_CONNECTED) | ||
986 | { | ||
987 | status = PLUGIN_USB_CONNECTED; | ||
988 | goto metronome_exit; | ||
989 | } | ||
985 | reset_tap = false; | 990 | reset_tap = false; |
986 | break; | 991 | break; |
987 | 992 | ||
@@ -993,5 +998,11 @@ enum plugin_status plugin_start(const void* parameter) | |||
993 | } | 998 | } |
994 | rb->yield(); | 999 | rb->yield(); |
995 | } | 1000 | } |
1001 | |||
1002 | metronome_exit: | ||
1003 | #if CONFIG_CODEC == SWCODEC | ||
1004 | rb->pcm_set_frequency(HW_SAMPR_DEFAULT); | ||
1005 | #endif | ||
1006 | return status; | ||
996 | } | 1007 | } |
997 | 1008 | ||
diff --git a/apps/plugins/midi/midiplay.c b/apps/plugins/midi/midiplay.c index 442a747d89..d9e215158e 100644 --- a/apps/plugins/midi/midiplay.c +++ b/apps/plugins/midi/midiplay.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "sequencer.h" | 25 | #include "sequencer.h" |
26 | #include "midifile.h" | 26 | #include "midifile.h" |
27 | 27 | ||
28 | 28 | PLUGIN_HEADER | |
29 | PLUGIN_IRAM_DECLARE | 29 | PLUGIN_IRAM_DECLARE |
30 | 30 | ||
31 | /* variable button definitions */ | 31 | /* variable button definitions */ |
@@ -450,6 +450,7 @@ static int midimain(const void * filename) | |||
450 | enum plugin_status plugin_start(const void* parameter) | 450 | enum plugin_status plugin_start(const void* parameter) |
451 | { | 451 | { |
452 | int retval; | 452 | int retval; |
453 | PLUGINLIB_EXIT_INIT; | ||
453 | 454 | ||
454 | PLUGIN_IRAM_INIT(rb) | 455 | PLUGIN_IRAM_INIT(rb) |
455 | 456 | ||
diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c index 5793ddedf8..58e56de159 100644 --- a/apps/plugins/minesweeper.c +++ b/apps/plugins/minesweeper.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #include "lib/playback_control.h" | 26 | #include "lib/playback_control.h" |
27 | 27 | ||
28 | 28 | PLUGIN_HEADER | |
29 | 29 | ||
30 | /* what the minesweeper() function can return */ | 30 | /* what the minesweeper() function can return */ |
31 | enum minesweeper_status { | 31 | enum minesweeper_status { |
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c index 42c9254259..43efc27d77 100644 --- a/apps/plugins/mosaique.c +++ b/apps/plugins/mosaique.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "lib/playergfx.h" | 22 | #include "lib/playergfx.h" |
23 | #include "lib/mylcd.h" | 23 | #include "lib/mylcd.h" |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | #ifdef HAVE_LCD_BITMAP | 27 | #ifdef HAVE_LCD_BITMAP |
28 | #define GFX_X (LCD_WIDTH/2-1) | 28 | #define GFX_X (LCD_WIDTH/2-1) |
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c index 06d28a344a..da749b82c9 100644 --- a/apps/plugins/mp3_encoder.c +++ b/apps/plugins/mp3_encoder.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <inttypes.h> | 14 | #include <inttypes.h> |
15 | #include "plugin.h" | 15 | #include "plugin.h" |
16 | 16 | ||
17 | 17 | PLUGIN_HEADER | |
18 | PLUGIN_IRAM_DECLARE | 18 | PLUGIN_IRAM_DECLARE |
19 | 19 | ||
20 | #define SAMP_PER_FRAME 1152 | 20 | #define SAMP_PER_FRAME 1152 |
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 8142c6f43e..961214f407 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c | |||
@@ -108,7 +108,7 @@ | |||
108 | #include "stream_thread.h" | 108 | #include "stream_thread.h" |
109 | #include "stream_mgr.h" | 109 | #include "stream_mgr.h" |
110 | 110 | ||
111 | 111 | PLUGIN_HEADER | |
112 | PLUGIN_IRAM_DECLARE | 112 | PLUGIN_IRAM_DECLARE |
113 | 113 | ||
114 | /* button definitions */ | 114 | /* button definitions */ |
diff --git a/apps/plugins/nim.c b/apps/plugins/nim.c index 3301277410..460e2751e9 100644 --- a/apps/plugins/nim.c +++ b/apps/plugins/nim.c | |||
@@ -48,7 +48,7 @@ V1.2 : 2003-07-30 | |||
48 | take a match. Later you are obliged to take at least one.) | 48 | take a match. Later you are obliged to take at least one.) |
49 | */ | 49 | */ |
50 | 50 | ||
51 | 51 | PLUGIN_HEADER | |
52 | 52 | ||
53 | /*Pattern for the game*/ | 53 | /*Pattern for the game*/ |
54 | static unsigned char smile[]={0x00, 0x11, 0x04, 0x04, 0x00, 0x11, 0x0E}; /* :-) */ | 54 | static unsigned char smile[]={0x00, 0x11, 0x04, 0x04, 0x00, 0x11, 0x0E}; /* :-) */ |
@@ -144,7 +144,6 @@ enum plugin_status plugin_start(const void* parameter) | |||
144 | int x,v,min; | 144 | int x,v,min; |
145 | bool ok; | 145 | bool ok; |
146 | bool go; | 146 | bool go; |
147 | atexit(nim_exit); | ||
148 | 147 | ||
149 | /* if you don't use the parameter, you can do like | 148 | /* if you don't use the parameter, you can do like |
150 | this to avoid the compiler warning about it */ | 149 | this to avoid the compiler warning about it */ |
@@ -194,6 +193,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
194 | { | 193 | { |
195 | case BUTTON_STOP|BUTTON_REL: | 194 | case BUTTON_STOP|BUTTON_REL: |
196 | go = true; | 195 | go = true; |
196 | nim_exit(NULL); | ||
197 | return PLUGIN_OK; | 197 | return PLUGIN_OK; |
198 | break; | 198 | break; |
199 | 199 | ||
@@ -214,7 +214,9 @@ enum plugin_status plugin_start(const void* parameter) | |||
214 | break; | 214 | break; |
215 | 215 | ||
216 | default: | 216 | default: |
217 | exit_on_usb(button); | 217 | if (rb->default_event_handler_ex(button, nim_exit, |
218 | NULL) == SYS_USB_CONNECTED) | ||
219 | return PLUGIN_USB_CONNECTED; | ||
218 | break; | 220 | break; |
219 | } | 221 | } |
220 | display_first_line(x); | 222 | display_first_line(x); |
@@ -289,6 +291,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
289 | min=1; | 291 | min=1; |
290 | } | 292 | } |
291 | } | 293 | } |
294 | nim_exit(NULL); | ||
292 | return PLUGIN_OK; | 295 | return PLUGIN_OK; |
293 | } | 296 | } |
294 | #endif | 297 | #endif |
diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c index e9c21ff119..4195d96d5f 100644 --- a/apps/plugins/oscilloscope.c +++ b/apps/plugins/oscilloscope.c | |||
@@ -23,13 +23,12 @@ | |||
23 | 23 | ||
24 | #include "plugin.h" | 24 | #include "plugin.h" |
25 | #include "lib/helper.h" | 25 | #include "lib/helper.h" |
26 | #include "lib/pluginlib_exit.h" | ||
27 | 26 | ||
28 | #ifdef HAVE_LCD_BITMAP | 27 | #ifdef HAVE_LCD_BITMAP |
29 | #include "lib/xlcd.h" | 28 | #include "lib/xlcd.h" |
30 | #include "lib/configfile.h" | 29 | #include "lib/configfile.h" |
31 | 30 | ||
32 | 31 | PLUGIN_HEADER | |
33 | 32 | ||
34 | /* variable button definitions */ | 33 | /* variable button definitions */ |
35 | #if CONFIG_KEYPAD == RECORDER_PAD | 34 | #if CONFIG_KEYPAD == RECORDER_PAD |
@@ -752,8 +751,9 @@ void anim_vertical(int cur_left, int cur_right) | |||
752 | last_pos = cur_y; | 751 | last_pos = cur_y; |
753 | } | 752 | } |
754 | 753 | ||
755 | void cleanup(void) | 754 | void cleanup(void *parameter) |
756 | { | 755 | { |
756 | (void)parameter; | ||
757 | #if LCD_DEPTH > 1 | 757 | #if LCD_DEPTH > 1 |
758 | rb->lcd_set_foreground(LCD_DEFAULT_FG); | 758 | rb->lcd_set_foreground(LCD_DEFAULT_FG); |
759 | rb->lcd_set_background(LCD_DEFAULT_BG); | 759 | rb->lcd_set_background(LCD_DEFAULT_BG); |
@@ -772,7 +772,6 @@ enum plugin_status plugin_start(const void* parameter) | |||
772 | 772 | ||
773 | (void)parameter; | 773 | (void)parameter; |
774 | 774 | ||
775 | atexit(cleanup); | ||
776 | configfile_load(cfg_filename, disk_config, | 775 | configfile_load(cfg_filename, disk_config, |
777 | sizeof(disk_config) / sizeof(disk_config[0]), | 776 | sizeof(disk_config) / sizeof(disk_config[0]), |
778 | CFGFILE_MINVERSION); | 777 | CFGFILE_MINVERSION); |
@@ -893,7 +892,9 @@ enum plugin_status plugin_start(const void* parameter) | |||
893 | break; | 892 | break; |
894 | 893 | ||
895 | default: | 894 | default: |
896 | exit_on_usb(button); | 895 | if (rb->default_event_handler_ex(button, cleanup, NULL) |
896 | == SYS_USB_CONNECTED) | ||
897 | return PLUGIN_USB_CONNECTED; | ||
897 | break; | 898 | break; |
898 | } | 899 | } |
899 | if (button != BUTTON_NONE) | 900 | if (button != BUTTON_NONE) |
@@ -907,6 +908,7 @@ enum plugin_status plugin_start(const void* parameter) | |||
907 | displaymsg = true; | 908 | displaymsg = true; |
908 | } | 909 | } |
909 | } | 910 | } |
911 | cleanup(NULL); | ||
910 | if (rb->memcmp(&osc, &osc_disk, sizeof(osc))) /* save settings if changed */ | 912 | if (rb->memcmp(&osc, &osc_disk, sizeof(osc))) /* save settings if changed */ |
911 | { | 913 | { |
912 | rb->memcpy(&osc_disk, &osc, sizeof(osc)); | 914 | rb->memcpy(&osc_disk, &osc, sizeof(osc)); |
diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c index db25b1c0f1..7f40822e0d 100644 --- a/apps/plugins/pacbox/pacbox.c +++ b/apps/plugins/pacbox/pacbox.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include "lib/configfile.h" | 32 | #include "lib/configfile.h" |
33 | #include "lib/playback_control.h" | 33 | #include "lib/playback_control.h" |
34 | 34 | ||
35 | 35 | PLUGIN_HEADER | |
36 | PLUGIN_IRAM_DECLARE | 36 | PLUGIN_IRAM_DECLARE |
37 | 37 | ||
38 | struct pacman_settings { | 38 | struct pacman_settings { |
diff --git a/apps/plugins/pdbox/pdbox.c b/apps/plugins/pdbox/pdbox.c index 7f4a7ac6dc..4fa6978417 100644 --- a/apps/plugins/pdbox/pdbox.c +++ b/apps/plugins/pdbox/pdbox.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "PDa/src/s_stuff.h" | 28 | #include "PDa/src/s_stuff.h" |
29 | 29 | ||
30 | /* Welcome to the PDBox plugin */ | 30 | /* Welcome to the PDBox plugin */ |
31 | 31 | PLUGIN_HEADER | |
32 | PLUGIN_IRAM_DECLARE | 32 | PLUGIN_IRAM_DECLARE |
33 | 33 | ||
34 | /* Name of the file to open. */ | 34 | /* Name of the file to open. */ |
diff --git a/apps/plugins/pegbox.c b/apps/plugins/pegbox.c index a953c6804b..a429b00166 100644 --- a/apps/plugins/pegbox.c +++ b/apps/plugins/pegbox.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "pluginbitmaps/pegbox_header.h" | 26 | #include "pluginbitmaps/pegbox_header.h" |
27 | #include "pluginbitmaps/pegbox_pieces.h" | 27 | #include "pluginbitmaps/pegbox_pieces.h" |
28 | 28 | ||
29 | 29 | PLUGIN_HEADER | |
30 | 30 | ||
31 | #define CONFIG_FILE_NAME "pegbox.cfg" | 31 | #define CONFIG_FILE_NAME "pegbox.cfg" |
32 | 32 | ||
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index 738ca2f672..75dc4052c5 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #include "lib/overlay.h" | 25 | #include "lib/overlay.h" |
26 | 26 | ||
27 | 27 | PLUGIN_HEADER | |
28 | 28 | ||
29 | /* this is the plugin entry point */ | 29 | /* this is the plugin entry point */ |
30 | enum plugin_status plugin_start(const void* parameter) | 30 | enum plugin_status plugin_start(const void* parameter) |
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index 8ad62b0238..546afad217 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <albumart.h> | 27 | #include <albumart.h> |
28 | #include "lib/read_image.h" | 28 | #include "lib/read_image.h" |
29 | #include "lib/pluginlib_actions.h" | 29 | #include "lib/pluginlib_actions.h" |
30 | #include "lib/pluginlib_exit.h" | ||
31 | #include "lib/helper.h" | 30 | #include "lib/helper.h" |
32 | #include "lib/configfile.h" | 31 | #include "lib/configfile.h" |
33 | #include "lib/grey.h" | 32 | #include "lib/grey.h" |
@@ -35,7 +34,7 @@ | |||
35 | #include "lib/feature_wrappers.h" | 34 | #include "lib/feature_wrappers.h" |
36 | #include "lib/buflib.h" | 35 | #include "lib/buflib.h" |
37 | 36 | ||
38 | 37 | PLUGIN_HEADER | |
39 | 38 | ||
40 | /******************************* Globals ***********************************/ | 39 | /******************************* Globals ***********************************/ |
41 | 40 | ||
@@ -2069,8 +2068,9 @@ void update_scroll_animation(void) | |||
2069 | /** | 2068 | /** |
2070 | Cleanup the plugin | 2069 | Cleanup the plugin |
2071 | */ | 2070 | */ |
2072 | void cleanup(void) | 2071 | void cleanup(void *parameter) |
2073 | { | 2072 | { |
2073 | (void) parameter; | ||
2074 | int i; | 2074 | int i; |
2075 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 2075 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
2076 | rb->cpu_boost(false); | 2076 | rb->cpu_boost(false); |
@@ -2610,6 +2610,19 @@ int main(void) | |||
2610 | cache_version = CACHE_VERSION; | 2610 | cache_version = CACHE_VERSION; |
2611 | configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, CONFIG_VERSION); | 2611 | configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, CONFIG_VERSION); |
2612 | 2612 | ||
2613 | |||
2614 | #ifdef USEGSLIB | ||
2615 | long grey_buf_used; | ||
2616 | if (!grey_init(buf, buf_size, GREY_BUFFERED|GREY_ON_COP, | ||
2617 | LCD_WIDTH, LCD_HEIGHT, &grey_buf_used)) | ||
2618 | { | ||
2619 | error_wait("Greylib init failed!"); | ||
2620 | return PLUGIN_ERROR; | ||
2621 | } | ||
2622 | grey_setfont(FONT_UI); | ||
2623 | buf_size -= grey_buf_used; | ||
2624 | buf = (void*)(grey_buf_used + (char*)buf); | ||
2625 | #endif | ||
2613 | buflib_init(&buf_ctx, (void *)buf, buf_size); | 2626 | buflib_init(&buf_ctx, (void *)buf, buf_size); |
2614 | 2627 | ||
2615 | if (!(empty_slide_hid = read_pfraw(EMPTY_SLIDE, 0))) | 2628 | if (!(empty_slide_hid = read_pfraw(EMPTY_SLIDE, 0))) |
@@ -2828,7 +2841,9 @@ int main(void) | |||
2828 | } | 2841 | } |
2829 | break; | 2842 | break; |
2830 | default: | 2843 | default: |
2831 | exit_on_usb(button); | 2844 | if (rb->default_event_handler_ex(button, cleanup, NULL) |
2845 | == SYS_USB_CONNECTED) | ||
2846 | return PLUGIN_USB_CONNECTED; | ||
2832 | break; | 2847 | break; |
2833 | } | 2848 | } |
2834 | } | 2849 | } |
@@ -2840,7 +2855,6 @@ enum plugin_status plugin_start(const void *parameter) | |||
2840 | { | 2855 | { |
2841 | int ret, i; | 2856 | int ret, i; |
2842 | (void) parameter; | 2857 | (void) parameter; |
2843 | atexit(cleanup); | ||
2844 | 2858 | ||
2845 | FOR_NB_SCREENS(i) | 2859 | FOR_NB_SCREENS(i) |
2846 | rb->viewportmanager_theme_enable(i, false, NULL); | 2860 | rb->viewportmanager_theme_enable(i, false, NULL); |
@@ -2859,21 +2873,6 @@ enum plugin_status plugin_start(const void *parameter) | |||
2859 | } | 2873 | } |
2860 | #endif | 2874 | #endif |
2861 | #endif | 2875 | #endif |
2862 | |||
2863 | #ifdef USEGSLIB | ||
2864 | long grey_buf_used; | ||
2865 | if (!grey_init(buf, buf_size, GREY_BUFFERED|GREY_ON_COP, | ||
2866 | LCD_WIDTH, LCD_HEIGHT, &grey_buf_used)) | ||
2867 | { | ||
2868 | error_wait("Greylib init failed!"); | ||
2869 | return PLUGIN_ERROR; | ||
2870 | } | ||
2871 | grey_setfont(FONT_UI); | ||
2872 | buf_size -= grey_buf_used; | ||
2873 | buf = (void*)(grey_buf_used + (char*)buf); | ||
2874 | #endif | ||
2875 | |||
2876 | atexit(cleanup); | ||
2877 | ret = main(); | 2876 | ret = main(); |
2878 | if ( ret == PLUGIN_OK || ret == PLUGIN_GOTO_WPS) { | 2877 | if ( ret == PLUGIN_OK || ret == PLUGIN_GOTO_WPS) { |
2879 | if (configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, | 2878 | if (configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, |
@@ -2883,5 +2882,7 @@ enum plugin_status plugin_start(const void *parameter) | |||
2883 | ret = PLUGIN_ERROR; | 2882 | ret = PLUGIN_ERROR; |
2884 | } | 2883 | } |
2885 | } | 2884 | } |
2885 | |||
2886 | cleanup(NULL); | ||
2886 | return ret; | 2887 | return ret; |
2887 | } | 2888 | } |
diff --git a/apps/plugins/pitch_detector.c b/apps/plugins/pitch_detector.c index b3003cd522..36248a540d 100644 --- a/apps/plugins/pitch_detector.c +++ b/apps/plugins/pitch_detector.c | |||
@@ -68,7 +68,7 @@ | |||
68 | #include "lib/helper.h" | 68 | #include "lib/helper.h" |
69 | #include "pluginbitmaps/pitch_notes.h" | 69 | #include "pluginbitmaps/pitch_notes.h" |
70 | 70 | ||
71 | 71 | PLUGIN_HEADER | |
72 | PLUGIN_IRAM_DECLARE | 72 | PLUGIN_IRAM_DECLARE |
73 | 73 | ||
74 | /* Some fixed point calculation stuff */ | 74 | /* Some fixed point calculation stuff */ |
diff --git a/apps/plugins/plasma.c b/apps/plugins/plasma.c index 35bc03ba1f..637d948f3d 100644 --- a/apps/plugins/plasma.c +++ b/apps/plugins/plasma.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include "plugin.h" | 27 | #include "plugin.h" |
28 | #include "lib/helper.h" | 28 | #include "lib/helper.h" |
29 | #include "lib/pluginlib_actions.h" | 29 | #include "lib/pluginlib_actions.h" |
30 | #include "lib/pluginlib_exit.h" | ||
31 | 30 | ||
32 | #ifdef HAVE_LCD_BITMAP | 31 | #ifdef HAVE_LCD_BITMAP |
33 | 32 | ||
@@ -36,6 +35,7 @@ | |||
36 | #endif | 35 | #endif |
37 | #include "lib/fixedpoint.h" | 36 | #include "lib/fixedpoint.h" |
38 | 37 | ||
38 | PLUGIN_HEADER | ||
39 | 39 | ||
40 | /******************************* Globals ***********************************/ | 40 | /******************************* Globals ***********************************/ |
41 | 41 | ||
@@ -131,8 +131,10 @@ static void shades_generate(void) | |||
131 | } | 131 | } |
132 | #endif | 132 | #endif |
133 | 133 | ||
134 | void cleanup(void) | 134 | void cleanup(void *parameter) |
135 | { | 135 | { |
136 | (void)parameter; | ||
137 | |||
136 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | 138 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
137 | if (boosted) | 139 | if (boosted) |
138 | rb->cpu_boost(false); | 140 | rb->cpu_boost(false); |
@@ -142,9 +144,6 @@ void cleanup(void) | |||
142 | #endif | 144 | #endif |
143 | /* Turn on backlight timeout (revert to settings) */ | 145 | /* Turn on backlight timeout (revert to settings) */ |
144 | backlight_use_settings(); /* backlight control in lib/helper.c */ | 146 | backlight_use_settings(); /* backlight control in lib/helper.c */ |
145 | #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) | ||
146 | rb->lcd_set_mode(LCD_MODE_RGB565); | ||
147 | #endif | ||
148 | } | 147 | } |
149 | 148 | ||
150 | /* | 149 | /* |
@@ -181,15 +180,10 @@ int main(void) | |||
181 | /* get the remainder of the plugin buffer */ | 180 | /* get the remainder of the plugin buffer */ |
182 | gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size); | 181 | gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size); |
183 | 182 | ||
184 | if (!grey_init(gbuf, gbuf_size, GREY_ON_COP, LCD_WIDTH, LCD_HEIGHT, NULL)) | 183 | grey_init(gbuf, gbuf_size, GREY_ON_COP, LCD_WIDTH, LCD_HEIGHT, NULL); |
185 | { | ||
186 | rb->splash(HZ, "Couldn't init greyscale display"); | ||
187 | return PLUGIN_ERROR; | ||
188 | } | ||
189 | /* switch on greyscale overlay */ | 184 | /* switch on greyscale overlay */ |
190 | grey_show(true); | 185 | grey_show(true); |
191 | #endif | 186 | #endif |
192 | atexit(cleanup); | ||
193 | sp1 = 4; | 187 | sp1 = 4; |
194 | sp2 = 2; | 188 | sp2 = 2; |
195 | sp3 = 4; | 189 | sp3 = 4; |
@@ -267,6 +261,7 @@ int main(void) | |||
267 | { | 261 | { |
268 | case PLA_EXIT: | 262 | case PLA_EXIT: |
269 | case PLA_CANCEL: | 263 | case PLA_CANCEL: |
264 | cleanup(NULL); | ||
270 | return PLUGIN_OK; | 265 | return PLUGIN_OK; |
271 | break; | 266 | break; |
272 | 267 | ||
@@ -304,7 +299,9 @@ int main(void) | |||
304 | #endif | 299 | #endif |
305 | 300 | ||
306 | default: | 301 | default: |
307 | exit_on_usb(action); | 302 | if (rb->default_event_handler_ex(action, cleanup, NULL) |
303 | == SYS_USB_CONNECTED) | ||
304 | return PLUGIN_USB_CONNECTED; | ||
308 | break; | 305 | break; |
309 | } | 306 | } |
310 | } | 307 | } |
@@ -314,6 +311,8 @@ int main(void) | |||
314 | 311 | ||
315 | enum plugin_status plugin_start(const void* parameter) | 312 | enum plugin_status plugin_start(const void* parameter) |
316 | { | 313 | { |
314 | int ret; | ||
315 | |||
317 | (void)parameter; | 316 | (void)parameter; |
318 | #if LCD_DEPTH > 1 | 317 | #if LCD_DEPTH > 1 |
319 | rb->lcd_set_backdrop(NULL); | 318 | rb->lcd_set_backdrop(NULL); |
@@ -324,7 +323,14 @@ enum plugin_status plugin_start(const void* parameter) | |||
324 | #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) | 323 | #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) |
325 | rb->lcd_set_mode(LCD_MODE_PAL256); | 324 | rb->lcd_set_mode(LCD_MODE_PAL256); |
326 | #endif | 325 | #endif |
327 | return main(); | 326 | |
327 | ret = main(); | ||
328 | |||
329 | #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) | ||
330 | rb->lcd_set_mode(LCD_MODE_RGB565); | ||
331 | #endif | ||
332 | |||
333 | return ret; | ||
328 | } | 334 | } |
329 | 335 | ||
330 | #endif /* HAVE_LCD_BITMAP */ | 336 | #endif /* HAVE_LCD_BITMAP */ |
diff --git a/apps/plugins/plugin_crt0.c b/apps/plugins/plugin_crt0.c deleted file mode 100755 index e9e2bcb8aa..0000000000 --- a/apps/plugins/plugin_crt0.c +++ /dev/null | |||
@@ -1,116 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 by Thomas Martitz | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | |||
23 | #include "plugin.h" | ||
24 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | ||
25 | #include "../codecs/lib/setjmp.h" | ||
26 | #else | ||
27 | #include <setjmp.h> | ||
28 | #endif | ||
29 | |||
30 | PLUGIN_HEADER | ||
31 | |||
32 | /* | ||
33 | * EXIT_MAGIC magic, because 0 cannot be used due to setjmp() | ||
34 | * must be > 0 | ||
35 | */ | ||
36 | #define EXIT_MAGIC 0x0CDEBABE | ||
37 | |||
38 | extern enum plugin_status plugin_start(const void*); | ||
39 | |||
40 | static jmp_buf __exit_env; | ||
41 | /* only 1 atexit handler for now, chain in the exit handler if you need more */ | ||
42 | static void (*atexit_handler)(void); | ||
43 | |||
44 | int atexit(void (*fn)(void)) | ||
45 | { | ||
46 | if (atexit_handler) | ||
47 | return -1; | ||
48 | atexit_handler = fn; | ||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | void exit(int status) | ||
53 | { /* jump back in time to before starting the plugin */ | ||
54 | longjmp(__exit_env, status != 0 ? status : EXIT_MAGIC); | ||
55 | } | ||
56 | |||
57 | void _exit(int status) | ||
58 | { /* don't call exit handler */ | ||
59 | atexit_handler = NULL; | ||
60 | exit(status); | ||
61 | } | ||
62 | |||
63 | enum plugin_status plugin__start(const void *param) | ||
64 | { | ||
65 | int exit_ret; | ||
66 | enum plugin_status ret; | ||
67 | |||
68 | /* we come back here if exit() was called or the plugin returned normally */ | ||
69 | exit_ret = setjmp(__exit_env); | ||
70 | if (exit_ret == 0) | ||
71 | { /* start the plugin */ | ||
72 | ret = plugin_start(param); | ||
73 | } | ||
74 | else | ||
75 | { /* plugin exit via exit() */ | ||
76 | if (exit_ret == EXIT_MAGIC) | ||
77 | { /* exit(EXIT_SUCCESS) */ | ||
78 | ret = PLUGIN_OK; | ||
79 | } | ||
80 | else if (exit_ret < INTERNAL_PLUGIN_RETVAL_START) | ||
81 | { /* exit(EXIT_FAILURE) */ | ||
82 | ret = PLUGIN_ERROR; | ||
83 | } | ||
84 | else | ||
85 | { /* exit(PLUGIN_XXX) */ | ||
86 | ret = (enum plugin_status)exit_ret; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | /* before finishing, call the exit handler if there was one */ | ||
91 | if (atexit_handler != NULL) | ||
92 | atexit_handler(); | ||
93 | |||
94 | return ret; | ||
95 | } | ||
96 | |||
97 | static void cleanup_wrapper(void *param) | ||
98 | { | ||
99 | (void)param; | ||
100 | if (atexit_handler) | ||
101 | atexit_handler(); | ||
102 | } | ||
103 | |||
104 | void exit_on_usb(int button) | ||
105 | { /* the default handler will call the exit handler before | ||
106 | * showing the usb screen; after that we don't want the exit handler | ||
107 | * to be called a second time, hence _exit() | ||
108 | * | ||
109 | * if not usb, then the handler will only be called if powering off | ||
110 | * if poweroff, the plugin doesn't want to run any further so exit as well*/ | ||
111 | long result = rb->default_event_handler_ex(button, cleanup_wrapper, NULL); | ||
112 | if (result == SYS_USB_CONNECTED) | ||
113 | _exit(PLUGIN_USB_CONNECTED); | ||
114 | else if (result == SYS_POWEROFF) | ||
115 | _exit(PLUGIN_POWEROFF); | ||
116 | } | ||
diff --git a/apps/plugins/plugins.make b/apps/plugins/plugins.make index aa4b2ea713..d3c66c34ca 100644 --- a/apps/plugins/plugins.make +++ b/apps/plugins/plugins.make | |||
@@ -33,7 +33,7 @@ PLUGIN_LDS := $(APPSDIR)/plugins/plugin.lds | |||
33 | PLUGINLINK_LDS := $(BUILDDIR)/apps/plugins/plugin.link | 33 | PLUGINLINK_LDS := $(BUILDDIR)/apps/plugins/plugin.link |
34 | OVERLAYREF_LDS := $(BUILDDIR)/apps/plugins/overlay_ref.link | 34 | OVERLAYREF_LDS := $(BUILDDIR)/apps/plugins/overlay_ref.link |
35 | endif | 35 | endif |
36 | PLUGIN_CRT0 := $(BUILDDIR)/apps/plugins/plugin_crt0.o | 36 | |
37 | # multifile plugins (subdirs): | 37 | # multifile plugins (subdirs): |
38 | PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS) | 38 | PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS) |
39 | 39 | ||
@@ -49,7 +49,7 @@ PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS) | |||
49 | $(ROCKS1): $(BUILDDIR)/%.rock: $(BUILDDIR)/%.o | 49 | $(ROCKS1): $(BUILDDIR)/%.rock: $(BUILDDIR)/%.o |
50 | 50 | ||
51 | # dependency for all plugins | 51 | # dependency for all plugins |
52 | $(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGINLIB) $(PLUGINBITMAPLIB) $(PLUGIN_CRT0) | 52 | $(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGINLIB) $(PLUGINBITMAPLIB) |
53 | 53 | ||
54 | $(PLUGINLIB): $(PLUGINLIB_OBJ) | 54 | $(PLUGINLIB): $(PLUGINLIB_OBJ) |
55 | $(SILENT)$(shell rm -f $@) | 55 | $(SILENT)$(shell rm -f $@) |
diff --git a/apps/plugins/pong.c b/apps/plugins/pong.c index 8a41d9eeb2..08899d767a 100644 --- a/apps/plugins/pong.c +++ b/apps/plugins/pong.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #ifdef HAVE_LCD_BITMAP | 23 | #ifdef HAVE_LCD_BITMAP |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | #define PAD_HEIGHT LCD_HEIGHT / 6 /* Recorder: 10 iRiver: 21 */ | 27 | #define PAD_HEIGHT LCD_HEIGHT / 6 /* Recorder: 10 iRiver: 21 */ |
28 | #define PAD_WIDTH LCD_WIDTH / 50 /* Recorder: 2 iRiver: 2 */ | 28 | #define PAD_WIDTH LCD_WIDTH / 50 /* Recorder: 2 iRiver: 2 */ |
diff --git a/apps/plugins/ppmviewer.c b/apps/plugins/ppmviewer.c index 035fffe92a..c947af10bd 100644 --- a/apps/plugins/ppmviewer.c +++ b/apps/plugins/ppmviewer.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #if defined(HAVE_LCD_COLOR) | 25 | #if defined(HAVE_LCD_COLOR) |
26 | 26 | ||
27 | 27 | PLUGIN_HEADER | |
28 | 28 | ||
29 | /* Magic constants. */ | 29 | /* Magic constants. */ |
30 | #define PPM_MAGIC1 'P' | 30 | #define PPM_MAGIC1 'P' |
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c index 2e34a4e048..9d9020f023 100644 --- a/apps/plugins/properties.c +++ b/apps/plugins/properties.c | |||
@@ -20,7 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | 22 | ||
23 | 23 | PLUGIN_HEADER | |
24 | 24 | ||
25 | bool its_a_dir = false; | 25 | bool its_a_dir = false; |
26 | 26 | ||
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index 55d9bf99ab..9a589dfff6 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include "file.h" | 22 | #include "file.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | static bool cancel; | 26 | static bool cancel; |
27 | static int fd; | 27 | static int fd; |
diff --git a/apps/plugins/remote_control.c b/apps/plugins/remote_control.c index a5ad4423a1..e00d5de54c 100644 --- a/apps/plugins/remote_control.c +++ b/apps/plugins/remote_control.c | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | #include "lib/pluginlib_actions.h" | 24 | #include "lib/pluginlib_actions.h" |
25 | 25 | ||
26 | 26 | PLUGIN_HEADER | |
27 | 27 | ||
28 | #define PLUGIN_CONTINUE 10 | 28 | #define PLUGIN_CONTINUE 10 |
29 | 29 | ||
diff --git a/apps/plugins/reversi/reversi-gui.c b/apps/plugins/reversi/reversi-gui.c index dcdfe5fd35..67ccf19456 100644 --- a/apps/plugins/reversi/reversi-gui.c +++ b/apps/plugins/reversi/reversi-gui.c | |||
@@ -47,7 +47,7 @@ further options: | |||
47 | 47 | ||
48 | #include "lib/playback_control.h" | 48 | #include "lib/playback_control.h" |
49 | 49 | ||
50 | 50 | PLUGIN_HEADER | |
51 | 51 | ||
52 | /* This is initialized at the start of the plugin and used to determine the | 52 | /* This is initialized at the start of the plugin and used to determine the |
53 | * Appropriate game board size/legend spacing if the font is larger than a cell | 53 | * Appropriate game board size/legend spacing if the font is larger than a cell |
diff --git a/apps/plugins/robotfindskitten.c b/apps/plugins/robotfindskitten.c index 003087b5c3..0e5c94ea7e 100644 --- a/apps/plugins/robotfindskitten.c +++ b/apps/plugins/robotfindskitten.c | |||
@@ -34,7 +34,7 @@ | |||
34 | 34 | ||
35 | /* This macros must always be included. Should be placed at the top by | 35 | /* This macros must always be included. Should be placed at the top by |
36 | convention, although the actual position doesn't matter */ | 36 | convention, although the actual position doesn't matter */ |
37 | 37 | PLUGIN_HEADER | |
38 | 38 | ||
39 | /*Be sure to change MESSAGES when you change the array, or bad things | 39 | /*Be sure to change MESSAGES when you change the array, or bad things |
40 | will happen.*/ | 40 | will happen.*/ |
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c index 90df401ef9..084eaa5830 100644 --- a/apps/plugins/rockblox.c +++ b/apps/plugins/rockblox.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "lib/playergfx.h" | 28 | #include "lib/playergfx.h" |
29 | #include "lib/mylcd.h" | 29 | #include "lib/mylcd.h" |
30 | 30 | ||
31 | 31 | PLUGIN_HEADER | |
32 | 32 | ||
33 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | 33 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || \ |
34 | (CONFIG_KEYPAD == IPOD_3G_PAD) || \ | 34 | (CONFIG_KEYPAD == IPOD_3G_PAD) || \ |
diff --git a/apps/plugins/rockblox1d.c b/apps/plugins/rockblox1d.c index 1306cc9932..5006d88a2d 100644 --- a/apps/plugins/rockblox1d.c +++ b/apps/plugins/rockblox1d.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #include "plugin.h" | 23 | #include "plugin.h" |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | 27 | ||
28 | #ifdef HAVE_LCD_BITMAP | 28 | #ifdef HAVE_LCD_BITMAP |
diff --git a/apps/plugins/rockbox_flash.c b/apps/plugins/rockbox_flash.c index f1c4f537da..17c5e51ee2 100644 --- a/apps/plugins/rockbox_flash.c +++ b/apps/plugins/rockbox_flash.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #if (CONFIG_CPU == SH7034) /* Only for SH targets */ | 26 | #if (CONFIG_CPU == SH7034) /* Only for SH targets */ |
27 | 27 | ||
28 | 28 | PLUGIN_HEADER | |
29 | 29 | ||
30 | /* define DUMMY if you only want to "play" with the UI, does no harm */ | 30 | /* define DUMMY if you only want to "play" with the UI, does no harm */ |
31 | /* #define DUMMY */ | 31 | /* #define DUMMY */ |
diff --git a/apps/plugins/rockboy.c b/apps/plugins/rockboy.c index b4520733ae..bd72dea1f8 100644 --- a/apps/plugins/rockboy.c +++ b/apps/plugins/rockboy.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #include "lib/overlay.h" | 25 | #include "lib/overlay.h" |
26 | 26 | ||
27 | 27 | PLUGIN_HEADER | |
28 | 28 | ||
29 | /* this is the plugin entry point */ | 29 | /* this is the plugin entry point */ |
30 | enum plugin_status plugin_start(const void* parameter) | 30 | enum plugin_status plugin_start(const void* parameter) |
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c index 7fc919912e..797971c734 100644 --- a/apps/plugins/rockboy/rockboy.c +++ b/apps/plugins/rockboy/rockboy.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "hw.h" | 26 | #include "hw.h" |
27 | #include "pcm.h" | 27 | #include "pcm.h" |
28 | 28 | ||
29 | 29 | PLUGIN_HEADER | |
30 | PLUGIN_IRAM_DECLARE | 30 | PLUGIN_IRAM_DECLARE |
31 | 31 | ||
32 | int shut,cleanshut; | 32 | int shut,cleanshut; |
diff --git a/apps/plugins/rocklife.c b/apps/plugins/rocklife.c index afe442f989..210cffa78d 100644 --- a/apps/plugins/rocklife.c +++ b/apps/plugins/rocklife.c | |||
@@ -64,7 +64,7 @@ | |||
64 | #include "lib/pluginlib_actions.h" | 64 | #include "lib/pluginlib_actions.h" |
65 | #include "lib/helper.h" | 65 | #include "lib/helper.h" |
66 | 66 | ||
67 | 67 | PLUGIN_HEADER | |
68 | 68 | ||
69 | #define ROCKLIFE_PLAY_PAUSE PLA_SELECT | 69 | #define ROCKLIFE_PLAY_PAUSE PLA_SELECT |
70 | #define ROCKLIFE_INIT PLA_DOWN | 70 | #define ROCKLIFE_INIT PLA_DOWN |
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index 7032a8e793..264e4f6b14 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include "lib/rgb_hsv.h" | 33 | #include "lib/rgb_hsv.h" |
34 | #include "lib/playback_control.h" | 34 | #include "lib/playback_control.h" |
35 | 35 | ||
36 | 36 | PLUGIN_HEADER | |
37 | 37 | ||
38 | /*********************************************************************** | 38 | /*********************************************************************** |
39 | * Buttons | 39 | * Buttons |
diff --git a/apps/plugins/search.c b/apps/plugins/search.c index 76d8711feb..7edb7e229a 100644 --- a/apps/plugins/search.c +++ b/apps/plugins/search.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include <ctype.h> | 23 | #include <ctype.h> |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | #define BUFFER_SIZE 16384 | 27 | #define BUFFER_SIZE 16384 |
28 | 28 | ||
diff --git a/apps/plugins/searchengine/searchengine.c b/apps/plugins/searchengine/searchengine.c index 4e8bc452f1..f737a27621 100644 --- a/apps/plugins/searchengine/searchengine.c +++ b/apps/plugins/searchengine/searchengine.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "token.h" | 23 | #include "token.h" |
24 | #include "dbinterface.h" | 24 | #include "dbinterface.h" |
25 | 25 | ||
26 | 26 | PLUGIN_HEADER | |
27 | 27 | ||
28 | void *audio_bufferbase; | 28 | void *audio_bufferbase; |
29 | void *audio_bufferpointer; | 29 | void *audio_bufferpointer; |
diff --git a/apps/plugins/settings_dumper.c b/apps/plugins/settings_dumper.c index 381cdeebaa..93c4f67657 100644 --- a/apps/plugins/settings_dumper.c +++ b/apps/plugins/settings_dumper.c | |||
@@ -20,7 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | 22 | ||
23 | 23 | PLUGIN_HEADER | |
24 | 24 | ||
25 | #define FILENAME "/settings_dumper.txt" | 25 | #define FILENAME "/settings_dumper.txt" |
26 | static int setting_count = 0; | 26 | static int setting_count = 0; |
diff --git a/apps/plugins/shopper.c b/apps/plugins/shopper.c index 61cf2953af..b05395bec2 100644 --- a/apps/plugins/shopper.c +++ b/apps/plugins/shopper.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include "lib/playback_control.h" | 22 | #include "lib/playback_control.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | #define MAX_LIST_SIZE 400 | 26 | #define MAX_LIST_SIZE 400 |
27 | #define DESC_SIZE 40 | 27 | #define DESC_SIZE 40 |
diff --git a/apps/plugins/shortcuts/shortcuts_append.c b/apps/plugins/shortcuts/shortcuts_append.c index 3eea87e46e..69b2a445f3 100644 --- a/apps/plugins/shortcuts/shortcuts_append.c +++ b/apps/plugins/shortcuts/shortcuts_append.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #include "shortcuts.h" | 23 | #include "shortcuts.h" |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | 27 | ||
28 | bool append_entry_to_file(sc_file_t *file, char *path, bool is_dir) | 28 | bool append_entry_to_file(sc_file_t *file, char *path, bool is_dir) |
diff --git a/apps/plugins/shortcuts/shortcuts_view.c b/apps/plugins/shortcuts/shortcuts_view.c index 469241fd84..a63e26d7c6 100644 --- a/apps/plugins/shortcuts/shortcuts_view.c +++ b/apps/plugins/shortcuts/shortcuts_view.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | #include "shortcuts.h" | 23 | #include "shortcuts.h" |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | enum sc_list_action_type | 27 | enum sc_list_action_type |
28 | { | 28 | { |
diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c index 4d7d2c00ca..7bf49c123d 100644 --- a/apps/plugins/sliding_puzzle.c +++ b/apps/plugins/sliding_puzzle.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | 22 | ||
23 | #ifdef HAVE_LCD_BITMAP | 23 | #ifdef HAVE_LCD_BITMAP |
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | /* variable button definitions */ | 26 | /* variable button definitions */ |
27 | #if CONFIG_KEYPAD == RECORDER_PAD | 27 | #if CONFIG_KEYPAD == RECORDER_PAD |
diff --git a/apps/plugins/snake.c b/apps/plugins/snake.c index 00a43e5cc7..c3fe84e6d0 100644 --- a/apps/plugins/snake.c +++ b/apps/plugins/snake.c | |||
@@ -38,7 +38,7 @@ dir is the current direction of the snake - 0=up, 1=right, 2=down, 3=left; | |||
38 | #include "lib/highscore.h" | 38 | #include "lib/highscore.h" |
39 | #include "lib/playback_control.h" | 39 | #include "lib/playback_control.h" |
40 | 40 | ||
41 | 41 | PLUGIN_HEADER | |
42 | 42 | ||
43 | /* variable button definitions */ | 43 | /* variable button definitions */ |
44 | #if CONFIG_KEYPAD == RECORDER_PAD | 44 | #if CONFIG_KEYPAD == RECORDER_PAD |
diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c index 3fbf40b8f9..414d924c4a 100644 --- a/apps/plugins/snake2.c +++ b/apps/plugins/snake2.c | |||
@@ -34,7 +34,7 @@ Head and Tail are stored | |||
34 | #include "lib/highscore.h" | 34 | #include "lib/highscore.h" |
35 | #include "lib/playback_control.h" | 35 | #include "lib/playback_control.h" |
36 | 36 | ||
37 | 37 | PLUGIN_HEADER | |
38 | 38 | ||
39 | #define WIDTH 28 | 39 | #define WIDTH 28 |
40 | #define HEIGHT 16 | 40 | #define HEIGHT 16 |
diff --git a/apps/plugins/snow.c b/apps/plugins/snow.c index c9abae4b97..c3c9b7458a 100644 --- a/apps/plugins/snow.c +++ b/apps/plugins/snow.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "lib/playergfx.h" | 22 | #include "lib/playergfx.h" |
23 | #include "lib/mylcd.h" | 23 | #include "lib/mylcd.h" |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | #ifdef HAVE_LCD_BITMAP | 27 | #ifdef HAVE_LCD_BITMAP |
28 | #define NUM_PARTICLES (LCD_WIDTH * LCD_HEIGHT / 72) | 28 | #define NUM_PARTICLES (LCD_WIDTH * LCD_HEIGHT / 72) |
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index 6e94519803..b2721c84e9 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "plugin.h" | 24 | #include "plugin.h" |
25 | #include "lib/playback_control.h" | 25 | #include "lib/playback_control.h" |
26 | 26 | ||
27 | 27 | PLUGIN_HEADER | |
28 | 28 | ||
29 | #define SOKOBAN_TITLE "Sokoban" | 29 | #define SOKOBAN_TITLE "Sokoban" |
30 | 30 | ||
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index 1d2535f657..1c7aefb1c3 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #ifdef HAVE_LCD_BITMAP | 29 | #ifdef HAVE_LCD_BITMAP |
30 | 30 | ||
31 | 31 | PLUGIN_HEADER | |
32 | 32 | ||
33 | #define min(a,b) (a<b?a:b) | 33 | #define min(a,b) (a<b?a:b) |
34 | 34 | ||
diff --git a/apps/plugins/sort.c b/apps/plugins/sort.c index f8c3f5c248..1e787b33dd 100644 --- a/apps/plugins/sort.c +++ b/apps/plugins/sort.c | |||
@@ -57,7 +57,7 @@ | |||
57 | * TODO: Implement a merge sort for files larger than the buffer | 57 | * TODO: Implement a merge sort for files larger than the buffer |
58 | ****************************************************************************/ | 58 | ****************************************************************************/ |
59 | 59 | ||
60 | 60 | PLUGIN_HEADER | |
61 | 61 | ||
62 | size_t buf_size; | 62 | size_t buf_size; |
63 | static char *filename; | 63 | static char *filename; |
diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c index 2e7ccc0743..0ade406b59 100644 --- a/apps/plugins/spacerocks.c +++ b/apps/plugins/spacerocks.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "lib/highscore.h" | 25 | #include "lib/highscore.h" |
26 | #include "lib/playback_control.h" | 26 | #include "lib/playback_control.h" |
27 | 27 | ||
28 | 28 | PLUGIN_HEADER | |
29 | 29 | ||
30 | /* variable button definitions */ | 30 | /* variable button definitions */ |
31 | #if CONFIG_KEYPAD == RECORDER_PAD | 31 | #if CONFIG_KEYPAD == RECORDER_PAD |
diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c index c19d4b5e06..3e5161b67f 100644 --- a/apps/plugins/splitedit.c +++ b/apps/plugins/splitedit.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | /* variable button definitions */ | 26 | /* variable button definitions */ |
27 | #if CONFIG_KEYPAD == RECORDER_PAD | 27 | #if CONFIG_KEYPAD == RECORDER_PAD |
diff --git a/apps/plugins/star.c b/apps/plugins/star.c index c0f099775f..d11e3187db 100644 --- a/apps/plugins/star.c +++ b/apps/plugins/star.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "lib/display_text.h" | 23 | #include "lib/display_text.h" |
24 | #include "lib/playback_control.h" | 24 | #include "lib/playback_control.h" |
25 | 25 | ||
26 | 26 | PLUGIN_HEADER | |
27 | 27 | ||
28 | /* size of a level in file */ | 28 | /* size of a level in file */ |
29 | #define STAR_LEVEL_SIZE ((STAR_WIDTH + 1) * STAR_HEIGHT + 1) | 29 | #define STAR_LEVEL_SIZE ((STAR_WIDTH + 1) * STAR_HEIGHT + 1) |
diff --git a/apps/plugins/starfield.c b/apps/plugins/starfield.c index 09f58da1f6..1ae0f289ff 100644 --- a/apps/plugins/starfield.c +++ b/apps/plugins/starfield.c | |||
@@ -19,11 +19,10 @@ | |||
19 | 19 | ||
20 | #include "plugin.h" | 20 | #include "plugin.h" |
21 | #include "lib/helper.h" | 21 | #include "lib/helper.h" |
22 | #include "lib/pluginlib_exit.h" | ||
23 | 22 | ||
24 | #ifdef HAVE_LCD_BITMAP /* and also not for the Player */ | 23 | #ifdef HAVE_LCD_BITMAP /* and also not for the Player */ |
25 | 24 | ||
26 | 25 | PLUGIN_HEADER | |
27 | 26 | ||
28 | /******************************* Globals ***********************************/ | 27 | /******************************* Globals ***********************************/ |
29 | 28 | ||
@@ -498,11 +497,9 @@ int plugin_main(void) | |||
498 | case STARFIELD_RC_QUIT: | 497 | case STARFIELD_RC_QUIT: |
499 | #endif | 498 | #endif |
500 | case(STARFIELD_QUIT): | 499 | case(STARFIELD_QUIT): |
500 | case(SYS_USB_CONNECTED): | ||
501 | return PLUGIN_OK; | 501 | return PLUGIN_OK; |
502 | break; | 502 | break; |
503 | default: | ||
504 | exit_on_usb(button); | ||
505 | break; | ||
506 | } | 503 | } |
507 | } | 504 | } |
508 | } | 505 | } |
diff --git a/apps/plugins/stats.c b/apps/plugins/stats.c index ecf335d3f0..3420579881 100644 --- a/apps/plugins/stats.c +++ b/apps/plugins/stats.c | |||
@@ -20,7 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | 22 | ||
23 | 23 | PLUGIN_HEADER | |
24 | 24 | ||
25 | static int files, dirs, musicfiles, largestdir; | 25 | static int files, dirs, musicfiles, largestdir; |
26 | static int lasttick; | 26 | static int lasttick; |
diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c index 6bac97ea2a..b09dcdb030 100644 --- a/apps/plugins/stopwatch.c +++ b/apps/plugins/stopwatch.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | #ifdef HAVE_LCD_BITMAP | 26 | #ifdef HAVE_LCD_BITMAP |
27 | #define TIMER_Y 1 | 27 | #define TIMER_Y 1 |
diff --git a/apps/plugins/sudoku/sudoku.c b/apps/plugins/sudoku/sudoku.c index 4f87c5f4c8..f3d9b1e75f 100644 --- a/apps/plugins/sudoku/sudoku.c +++ b/apps/plugins/sudoku/sudoku.c | |||
@@ -81,7 +81,7 @@ Example ".ss" file, and one with a saved state: | |||
81 | #define BITMAP_WIDTH BMPWIDTH_sudoku_normal | 81 | #define BITMAP_WIDTH BMPWIDTH_sudoku_normal |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | 84 | PLUGIN_HEADER | |
85 | 85 | ||
86 | /* Default game - used to initialise sudoku.ss if it doesn't exist. */ | 86 | /* Default game - used to initialise sudoku.ss if it doesn't exist. */ |
87 | static const char default_game[9][9] = | 87 | static const char default_game[9][9] = |
diff --git a/apps/plugins/superdom.c b/apps/plugins/superdom.c index 5ded7f9f12..c2a7d8f896 100644 --- a/apps/plugins/superdom.c +++ b/apps/plugins/superdom.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "lib/playback_control.h" | 22 | #include "lib/playback_control.h" |
23 | #include "lib/display_text.h" | 23 | #include "lib/display_text.h" |
24 | #include "pluginbitmaps/superdom_boarditems.h" | 24 | #include "pluginbitmaps/superdom_boarditems.h" |
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | extern const fb_data superdom_boarditems[]; | 27 | extern const fb_data superdom_boarditems[]; |
28 | char buf[255]; | 28 | char buf[255]; |
diff --git a/apps/plugins/test_boost.c b/apps/plugins/test_boost.c index ec91206d1e..2406990269 100644 --- a/apps/plugins/test_boost.c +++ b/apps/plugins/test_boost.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | enum plugin_status plugin_start(const void* parameter) | 26 | enum plugin_status plugin_start(const void* parameter) |
27 | { | 27 | { |
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index 94c510afef..b8aa93d99b 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c | |||
@@ -20,7 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | 22 | ||
23 | 23 | PLUGIN_HEADER | |
24 | 24 | ||
25 | /* All swcodec targets have BUTTON_SELECT apart from the H10 and M3 */ | 25 | /* All swcodec targets have BUTTON_SELECT apart from the H10 and M3 */ |
26 | 26 | ||
diff --git a/apps/plugins/test_core_jpeg.c b/apps/plugins/test_core_jpeg.c index 76dbac847e..9e7ecfd3f8 100644 --- a/apps/plugins/test_core_jpeg.c +++ b/apps/plugins/test_core_jpeg.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "lib/grey.h" | 23 | #include "lib/grey.h" |
24 | #include "lib/mylcd.h" | 24 | #include "lib/mylcd.h" |
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | /* different graphics libraries */ | 27 | /* different graphics libraries */ |
28 | #if LCD_DEPTH < 8 | 28 | #if LCD_DEPTH < 8 |
diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c index 2650f4b28b..08e1a39704 100644 --- a/apps/plugins/test_disk.c +++ b/apps/plugins/test_disk.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | #include "lib/helper.h" | 23 | #include "lib/helper.h" |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | #define TESTBASEDIR "/__TEST__" | 27 | #define TESTBASEDIR "/__TEST__" |
28 | #define TEST_FILE TESTBASEDIR "/test_disk.tmp" | 28 | #define TEST_FILE TESTBASEDIR "/test_disk.tmp" |
diff --git a/apps/plugins/test_fps.c b/apps/plugins/test_fps.c index 80a8d88104..62e7f489b0 100644 --- a/apps/plugins/test_fps.c +++ b/apps/plugins/test_fps.c | |||
@@ -45,7 +45,7 @@ PLUGIN_IRAM_DECLARE | |||
45 | 45 | ||
46 | #define DURATION (2*HZ) /* longer duration gives more precise results */ | 46 | #define DURATION (2*HZ) /* longer duration gives more precise results */ |
47 | 47 | ||
48 | 48 | PLUGIN_HEADER | |
49 | 49 | ||
50 | /* Screen logging */ | 50 | /* Screen logging */ |
51 | static int line; | 51 | static int line; |
diff --git a/apps/plugins/test_gfx.c b/apps/plugins/test_gfx.c index aa898549bb..2c46d16b63 100644 --- a/apps/plugins/test_gfx.c +++ b/apps/plugins/test_gfx.c | |||
@@ -35,7 +35,7 @@ static size_t gbuf_size = 0; | |||
35 | #define DURATION (HZ) /* longer duration gives more precise results */ | 35 | #define DURATION (HZ) /* longer duration gives more precise results */ |
36 | #define RND_SEED 0x43A678C3 /* arbirary */ | 36 | #define RND_SEED 0x43A678C3 /* arbirary */ |
37 | 37 | ||
38 | 38 | PLUGIN_HEADER | |
39 | 39 | ||
40 | static uint16_t rand_table[0x400]; | 40 | static uint16_t rand_table[0x400]; |
41 | static int log_fd; | 41 | static int log_fd; |
diff --git a/apps/plugins/test_grey.c b/apps/plugins/test_grey.c index 5931d96bd3..31f63100aa 100644 --- a/apps/plugins/test_grey.c +++ b/apps/plugins/test_grey.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "lib/grey.h" | 22 | #include "lib/grey.h" |
23 | #include "lib/helper.h" | 23 | #include "lib/helper.h" |
24 | 24 | ||
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) \ | 27 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) \ |
28 | || (CONFIG_KEYPAD == IPOD_1G2G_PAD) | 28 | || (CONFIG_KEYPAD == IPOD_1G2G_PAD) |
diff --git a/apps/plugins/test_greylib_bitmap_scale.c b/apps/plugins/test_greylib_bitmap_scale.c index d096d0240b..892f3dc622 100644 --- a/apps/plugins/test_greylib_bitmap_scale.c +++ b/apps/plugins/test_greylib_bitmap_scale.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #define BMP_LOAD rb->read_bmp_file | 44 | #define BMP_LOAD rb->read_bmp_file |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | 47 | PLUGIN_HEADER | |
48 | GREY_INFO_STRUCT | 48 | GREY_INFO_STRUCT |
49 | static unsigned char grey_bm_buf[LCD_WIDTH * LCD_HEIGHT + | 49 | static unsigned char grey_bm_buf[LCD_WIDTH * LCD_HEIGHT + |
50 | BM_SCALED_SIZE(LCD_WIDTH,0,FORMAT_NATIVE,0)]; | 50 | BM_SCALED_SIZE(LCD_WIDTH,0,FORMAT_NATIVE,0)]; |
diff --git a/apps/plugins/test_mem.c b/apps/plugins/test_mem.c index 7758e35b98..f648c0073a 100644 --- a/apps/plugins/test_mem.c +++ b/apps/plugins/test_mem.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | #if PLUGIN_BUFFER_SIZE <= 0x8000 | 26 | #if PLUGIN_BUFFER_SIZE <= 0x8000 |
27 | #define BUF_SIZE (1<<12) /* 16 KB = (1<<12)*sizeof(int) */ | 27 | #define BUF_SIZE (1<<12) /* 16 KB = (1<<12)*sizeof(int) */ |
diff --git a/apps/plugins/test_mem_jpeg.c b/apps/plugins/test_mem_jpeg.c index 72f613135a..6e7d381a2d 100644 --- a/apps/plugins/test_mem_jpeg.c +++ b/apps/plugins/test_mem_jpeg.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "lib/grey.h" | 25 | #include "lib/grey.h" |
26 | #include "lib/jpeg_mem.h" | 26 | #include "lib/jpeg_mem.h" |
27 | #include "lib/mylcd.h" | 27 | #include "lib/mylcd.h" |
28 | 28 | PLUGIN_HEADER | |
29 | 29 | ||
30 | /* different graphics libraries */ | 30 | /* different graphics libraries */ |
31 | #if LCD_DEPTH < 8 | 31 | #if LCD_DEPTH < 8 |
diff --git a/apps/plugins/test_resize.c b/apps/plugins/test_resize.c index 2ab10eb7ee..8ee4989bcf 100644 --- a/apps/plugins/test_resize.c +++ b/apps/plugins/test_resize.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "lib/pluginlib_actions.h" | 28 | #include "lib/pluginlib_actions.h" |
29 | #include "lib/pluginlib_bmp.h" | 29 | #include "lib/pluginlib_bmp.h" |
30 | 30 | ||
31 | 31 | PLUGIN_HEADER | |
32 | 32 | ||
33 | const struct button_mapping *plugin_contexts[] | 33 | const struct button_mapping *plugin_contexts[] |
34 | = {pla_main_ctx}; | 34 | = {pla_main_ctx}; |
diff --git a/apps/plugins/test_sampr.c b/apps/plugins/test_sampr.c index 85525c543b..1f6ee351e1 100644 --- a/apps/plugins/test_sampr.c +++ b/apps/plugins/test_sampr.c | |||
@@ -28,7 +28,7 @@ | |||
28 | * with sample rate. | 28 | * with sample rate. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | 31 | PLUGIN_HEADER | |
32 | PLUGIN_IRAM_DECLARE; | 32 | PLUGIN_IRAM_DECLARE; |
33 | 33 | ||
34 | static int hw_freq IDATA_ATTR = HW_FREQ_DEFAULT; | 34 | static int hw_freq IDATA_ATTR = HW_FREQ_DEFAULT; |
diff --git a/apps/plugins/test_scanrate.c b/apps/plugins/test_scanrate.c index 81d8248013..1aa9febf30 100644 --- a/apps/plugins/test_scanrate.c +++ b/apps/plugins/test_scanrate.c | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && !defined(SIMULATOR) | 24 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && !defined(SIMULATOR) |
25 | 25 | ||
26 | 26 | PLUGIN_HEADER | |
27 | 27 | ||
28 | #if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == ONDIO_PAD) \ | 28 | #if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == ONDIO_PAD) \ |
29 | || (CONFIG_KEYPAD == IRIVER_H100_PAD) | 29 | || (CONFIG_KEYPAD == IRIVER_H100_PAD) |
diff --git a/apps/plugins/test_touchscreen.c b/apps/plugins/test_touchscreen.c index 0c9cdc7302..902a2bd089 100644 --- a/apps/plugins/test_touchscreen.c +++ b/apps/plugins/test_touchscreen.c | |||
@@ -20,7 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | 22 | ||
23 | 23 | PLUGIN_HEADER | |
24 | 24 | ||
25 | #if (CONFIG_KEYPAD == COWON_D2_PAD) | 25 | #if (CONFIG_KEYPAD == COWON_D2_PAD) |
26 | #define TOUCHSCREEN_QUIT BUTTON_POWER | 26 | #define TOUCHSCREEN_QUIT BUTTON_POWER |
diff --git a/apps/plugins/test_viewports.c b/apps/plugins/test_viewports.c index be61c7792e..08c23a91c8 100644 --- a/apps/plugins/test_viewports.c +++ b/apps/plugins/test_viewports.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include "plugin.h" | 22 | #include "plugin.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | #ifdef HAVE_LCD_BITMAP | 26 | #ifdef HAVE_LCD_BITMAP |
27 | 27 | ||
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c index ceb71e4495..acd82b8794 100644 --- a/apps/plugins/text_editor.c +++ b/apps/plugins/text_editor.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "lib/playback_control.h" | 22 | #include "lib/playback_control.h" |
23 | 23 | ||
24 | #define MAX_LINE_LEN 2048 | 24 | #define MAX_LINE_LEN 2048 |
25 | 25 | PLUGIN_HEADER | |
26 | 26 | ||
27 | static unsigned char *buffer; | 27 | static unsigned char *buffer; |
28 | static size_t buffer_size; | 28 | static size_t buffer_size; |
diff --git a/apps/plugins/text_viewer/text_viewer.c b/apps/plugins/text_viewer/text_viewer.c index 5d06d4b477..eae85213ac 100644 --- a/apps/plugins/text_viewer/text_viewer.c +++ b/apps/plugins/text_viewer/text_viewer.c | |||
@@ -21,12 +21,11 @@ | |||
21 | * | 21 | * |
22 | ****************************************************************************/ | 22 | ****************************************************************************/ |
23 | #include "plugin.h" | 23 | #include "plugin.h" |
24 | #include "lib/pluginlib_exit.h" | ||
25 | #include "tv_action.h" | 24 | #include "tv_action.h" |
26 | #include "tv_button.h" | 25 | #include "tv_button.h" |
27 | #include "tv_preferences.h" | 26 | #include "tv_preferences.h" |
28 | 27 | ||
29 | 28 | PLUGIN_HEADER | |
30 | 29 | ||
31 | enum plugin_status plugin_start(const void* file) | 30 | enum plugin_status plugin_start(const void* file) |
32 | { | 31 | { |
@@ -57,7 +56,6 @@ enum plugin_status plugin_start(const void* file) | |||
57 | return PLUGIN_ERROR; | 56 | return PLUGIN_ERROR; |
58 | } | 57 | } |
59 | 58 | ||
60 | atexit(tv_exit); | ||
61 | while (!done) { | 59 | while (!done) { |
62 | #ifdef HAVE_LCD_BITMAP | 60 | #ifdef HAVE_LCD_BITMAP |
63 | if (rb->global_settings->statusbar != STATUSBAR_OFF && preferences->statusbar) | 61 | if (rb->global_settings->statusbar != STATUSBAR_OFF && preferences->statusbar) |
@@ -81,12 +79,12 @@ enum plugin_status plugin_start(const void* file) | |||
81 | 79 | ||
82 | if (res != TV_MENU_RESULT_EXIT_MENU) | 80 | if (res != TV_MENU_RESULT_EXIT_MENU) |
83 | { | 81 | { |
82 | tv_exit(NULL); | ||
83 | done = true; | ||
84 | if (res == TV_MENU_RESULT_ATTACHED_USB) | 84 | if (res == TV_MENU_RESULT_ATTACHED_USB) |
85 | return PLUGIN_USB_CONNECTED; | 85 | return PLUGIN_USB_CONNECTED; |
86 | else if (res == TV_MENU_RESULT_ERROR) | 86 | else if (res == TV_MENU_RESULT_ERROR) |
87 | return PLUGIN_ERROR; | 87 | return PLUGIN_ERROR; |
88 | else | ||
89 | done = true; | ||
90 | } | 88 | } |
91 | } | 89 | } |
92 | break; | 90 | break; |
@@ -197,6 +195,7 @@ enum plugin_status plugin_start(const void* file) | |||
197 | #ifdef TV_QUIT2 | 195 | #ifdef TV_QUIT2 |
198 | case TV_QUIT2: | 196 | case TV_QUIT2: |
199 | #endif | 197 | #endif |
198 | tv_exit(NULL); | ||
200 | done = true; | 199 | done = true; |
201 | break; | 200 | break; |
202 | 201 | ||
@@ -205,7 +204,9 @@ enum plugin_status plugin_start(const void* file) | |||
205 | break; | 204 | break; |
206 | 205 | ||
207 | default: | 206 | default: |
208 | exit_on_usb(button); | 207 | if (rb->default_event_handler_ex(button, tv_exit, NULL) |
208 | == SYS_USB_CONNECTED) | ||
209 | return PLUGIN_USB_CONNECTED; | ||
209 | display_update = false; | 210 | display_update = false; |
210 | break; | 211 | break; |
211 | } | 212 | } |
diff --git a/apps/plugins/text_viewer/tv_action.c b/apps/plugins/text_viewer/tv_action.c index 1e5473b438..c95ece0649 100644 --- a/apps/plugins/text_viewer/tv_action.c +++ b/apps/plugins/text_viewer/tv_action.c | |||
@@ -47,8 +47,10 @@ static void tv_finalize_action(void) | |||
47 | tv_finalize_window(); | 47 | tv_finalize_window(); |
48 | } | 48 | } |
49 | 49 | ||
50 | void tv_exit(void) | 50 | void tv_exit(void *parameter) |
51 | { | 51 | { |
52 | (void)parameter; | ||
53 | |||
52 | /* save preference and bookmarks */ | 54 | /* save preference and bookmarks */ |
53 | if (!tv_save_settings()) | 55 | if (!tv_save_settings()) |
54 | rb->splash(HZ, "Can't save preferences and bookmarks"); | 56 | rb->splash(HZ, "Can't save preferences and bookmarks"); |
diff --git a/apps/plugins/text_viewer/tv_action.h b/apps/plugins/text_viewer/tv_action.h index 5b3571db30..fba008dbe9 100644 --- a/apps/plugins/text_viewer/tv_action.h +++ b/apps/plugins/text_viewer/tv_action.h | |||
@@ -58,8 +58,11 @@ bool tv_init_action(unsigned char **buf, size_t *bufsize); | |||
58 | 58 | ||
59 | /* | 59 | /* |
60 | * finalize modules | 60 | * finalize modules |
61 | * | ||
62 | * [In] parameter | ||
63 | * this argument does not use | ||
61 | */ | 64 | */ |
62 | void tv_exit(void); | 65 | void tv_exit(void *parameter); |
63 | 66 | ||
64 | /* | 67 | /* |
65 | * load the file | 68 | * load the file |
diff --git a/apps/plugins/theme_remove.c b/apps/plugins/theme_remove.c index d679338ff8..f818ac4afe 100644 --- a/apps/plugins/theme_remove.c +++ b/apps/plugins/theme_remove.c | |||
@@ -20,7 +20,7 @@ | |||
20 | #include "plugin.h" | 20 | #include "plugin.h" |
21 | #include "lib/configfile.h" | 21 | #include "lib/configfile.h" |
22 | 22 | ||
23 | 23 | PLUGIN_HEADER | |
24 | 24 | ||
25 | /* taken from apps/gui/wps_parser.c */ | 25 | /* taken from apps/gui/wps_parser.c */ |
26 | #define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" | 26 | #define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" |
diff --git a/apps/plugins/vbrfix.c b/apps/plugins/vbrfix.c index 71c502bc67..ba13dc53f9 100644 --- a/apps/plugins/vbrfix.c +++ b/apps/plugins/vbrfix.c | |||
@@ -20,7 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | 22 | ||
23 | 23 | PLUGIN_HEADER | |
24 | 24 | ||
25 | static char *audiobuf; | 25 | static char *audiobuf; |
26 | static size_t audiobuflen; | 26 | static size_t audiobuflen; |
diff --git a/apps/plugins/video.c b/apps/plugins/video.c index 869a053886..6b0a47c7c6 100644 --- a/apps/plugins/video.c +++ b/apps/plugins/video.c | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | #ifdef HAVE_LCD_BITMAP /* and definitely not for the Player, haha */ | 34 | #ifdef HAVE_LCD_BITMAP /* and definitely not for the Player, haha */ |
35 | 35 | ||
36 | 36 | PLUGIN_HEADER | |
37 | 37 | ||
38 | /* variable button definitions */ | 38 | /* variable button definitions */ |
39 | #if CONFIG_KEYPAD == RECORDER_PAD | 39 | #if CONFIG_KEYPAD == RECORDER_PAD |
diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c index 6dc69d1d4e..fc04bc7842 100644 --- a/apps/plugins/vu_meter.c +++ b/apps/plugins/vu_meter.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "lib/fixedpoint.h" | 21 | #include "lib/fixedpoint.h" |
22 | #include "lib/playback_control.h" | 22 | #include "lib/playback_control.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | /* variable button definitions */ | 26 | /* variable button definitions */ |
27 | #if CONFIG_KEYPAD == RECORDER_PAD | 27 | #if CONFIG_KEYPAD == RECORDER_PAD |
diff --git a/apps/plugins/wav2wv.c b/apps/plugins/wav2wv.c index 98b4c0fe4f..3211203db9 100644 --- a/apps/plugins/wav2wv.c +++ b/apps/plugins/wav2wv.c | |||
@@ -25,7 +25,7 @@ | |||
25 | 25 | ||
26 | #include <codecs/libwavpack/wavpack.h> | 26 | #include <codecs/libwavpack/wavpack.h> |
27 | 27 | ||
28 | 28 | PLUGIN_HEADER | |
29 | 29 | ||
30 | #define SAMPLES_PER_BLOCK 22050 | 30 | #define SAMPLES_PER_BLOCK 22050 |
31 | 31 | ||
diff --git a/apps/plugins/wavplay.c b/apps/plugins/wavplay.c index cbd4dfbeda..94fef9faa0 100644 --- a/apps/plugins/wavplay.c +++ b/apps/plugins/wavplay.c | |||
@@ -20,7 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | 22 | ||
23 | 23 | PLUGIN_HEADER | |
24 | 24 | ||
25 | /************ Start of MAS pcm codec, raw i2c blocks ************/ | 25 | /************ Start of MAS pcm codec, raw i2c blocks ************/ |
26 | 26 | ||
diff --git a/apps/plugins/wavrecord.c b/apps/plugins/wavrecord.c index 375642ec4b..83b63e9805 100644 --- a/apps/plugins/wavrecord.c +++ b/apps/plugins/wavrecord.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | #include "lib/configfile.h" | 22 | #include "lib/configfile.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | /************ Start of MAS pcm codec, raw i2c blocks ************/ | 26 | /************ Start of MAS pcm codec, raw i2c blocks ************/ |
27 | 27 | ||
diff --git a/apps/plugins/wavview.c b/apps/plugins/wavview.c index ddf72e10af..2b19d3d18a 100644 --- a/apps/plugins/wavview.c +++ b/apps/plugins/wavview.c | |||
@@ -20,7 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "plugin.h" | 21 | #include "plugin.h" |
22 | 22 | ||
23 | 23 | PLUGIN_HEADER | |
24 | 24 | ||
25 | /* temp byte buffer */ | 25 | /* temp byte buffer */ |
26 | uint8_t samples[10 * 1024]; /* read 10KB at the time */ | 26 | uint8_t samples[10 * 1024]; /* read 10KB at the time */ |
diff --git a/apps/plugins/wormlet.c b/apps/plugins/wormlet.c index 191c995ad6..037f4005a2 100644 --- a/apps/plugins/wormlet.c +++ b/apps/plugins/wormlet.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "lib/helper.h" | 23 | #include "lib/helper.h" |
24 | #include "lib/playback_control.h" | 24 | #include "lib/playback_control.h" |
25 | 25 | ||
26 | 26 | PLUGIN_HEADER | |
27 | 27 | ||
28 | /* size of the field the worm lives in */ | 28 | /* size of the field the worm lives in */ |
29 | #define FIELD_RECT_X 1 | 29 | #define FIELD_RECT_X 1 |
diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c index 871cb2bdf5..4dd673c370 100644 --- a/apps/plugins/xobox.c +++ b/apps/plugins/xobox.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "lib/helper.h" | 24 | #include "lib/helper.h" |
25 | #include "lib/playback_control.h" | 25 | #include "lib/playback_control.h" |
26 | 26 | ||
27 | 27 | PLUGIN_HEADER | |
28 | 28 | ||
29 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) | 29 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) |
30 | 30 | ||
diff --git a/apps/plugins/zxbox.c b/apps/plugins/zxbox.c index 08e07d582a..94f7807bad 100644 --- a/apps/plugins/zxbox.c +++ b/apps/plugins/zxbox.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include "lib/overlay.h" | 22 | #include "lib/overlay.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | 25 | ||
26 | /* this is the plugin entry point */ | 26 | /* this is the plugin entry point */ |
27 | enum plugin_status plugin_start(const void* parameter) | 27 | enum plugin_status plugin_start(const void* parameter) |
diff --git a/apps/plugins/zxbox/zxbox.c b/apps/plugins/zxbox/zxbox.c index 459e0625b9..f33b51b9f6 100644 --- a/apps/plugins/zxbox/zxbox.c +++ b/apps/plugins/zxbox/zxbox.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include "zxconfig.h" | 22 | #include "zxconfig.h" |
23 | 23 | ||
24 | 24 | PLUGIN_HEADER | |
25 | PLUGIN_IRAM_DECLARE | 25 | PLUGIN_IRAM_DECLARE |
26 | 26 | ||
27 | #include "spkey_p.h" | 27 | #include "spkey_p.h" |