summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-08-23 17:12:26 +0000
committerThomas Martitz <kugel@rockbox.org>2010-08-23 17:12:26 +0000
commit93cb949372630d807615f53a8a6379937ed6819f (patch)
tree2dcb5001a9247447a1c64fd0129e64b9d8aba4e6 /apps
parentabdc5935beb7dc3fa63bffeec584921ad2a4c8bd (diff)
downloadrockbox-93cb949372630d807615f53a8a6379937ed6819f.tar.gz
rockbox-93cb949372630d807615f53a8a6379937ed6819f.tar.bz2
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
Diffstat (limited to 'apps')
-rw-r--r--apps/plugin.h14
-rw-r--r--apps/plugins/alarmclock.c2
-rw-r--r--apps/plugins/alpine_cdc.c2
-rw-r--r--apps/plugins/battery_bench.c2
-rw-r--r--apps/plugins/beatbox/beatbox.c2
-rw-r--r--apps/plugins/bench_mem_jpeg.c2
-rw-r--r--apps/plugins/bench_scaler.c2
-rw-r--r--apps/plugins/blackjack.c2
-rw-r--r--apps/plugins/bounce.c2
-rw-r--r--apps/plugins/brickmania.c2
-rw-r--r--apps/plugins/bubbles.c2
-rw-r--r--apps/plugins/calculator.c2
-rw-r--r--apps/plugins/calendar.c2
-rw-r--r--apps/plugins/chessbox.c2
-rw-r--r--apps/plugins/chessbox/chessbox.c2
-rw-r--r--apps/plugins/chessclock.c2
-rw-r--r--apps/plugins/chip8.c2
-rw-r--r--apps/plugins/chopper.c2
-rw-r--r--apps/plugins/clix.c2
-rw-r--r--apps/plugins/clock/clock.c12
-rw-r--r--apps/plugins/codebuster.c2
-rw-r--r--apps/plugins/credits.c2
-rw-r--r--apps/plugins/crypt_firmware.c2
-rw-r--r--apps/plugins/cube.c24
-rw-r--r--apps/plugins/demystify.c14
-rw-r--r--apps/plugins/dice.c2
-rw-r--r--apps/plugins/dict.c2
-rw-r--r--apps/plugins/disktidy.c2
-rw-r--r--apps/plugins/doom/rockdoom.c2
-rw-r--r--apps/plugins/euroconverter.c12
-rw-r--r--apps/plugins/fft/fft.c2
-rw-r--r--apps/plugins/fire.c2
-rw-r--r--apps/plugins/fireworks.c2
-rw-r--r--apps/plugins/firmware_flash.c2
-rw-r--r--apps/plugins/flipit.c2
-rw-r--r--apps/plugins/fractals/fractal.c20
-rw-r--r--apps/plugins/frotz/frotz.c4
-rw-r--r--apps/plugins/goban.c2
-rw-r--r--apps/plugins/goban/goban.c2
-rw-r--r--apps/plugins/greyscale.c9
-rw-r--r--apps/plugins/helloworld.c2
-rw-r--r--apps/plugins/imageviewer/imageviewer.c2
-rw-r--r--apps/plugins/invadrox.c2
-rw-r--r--apps/plugins/iriver_flash.c2
-rw-r--r--apps/plugins/iriverify.c2
-rw-r--r--apps/plugins/jackpot.c12
-rw-r--r--apps/plugins/jewels.c2
-rw-r--r--apps/plugins/keybox.c2
-rw-r--r--apps/plugins/lamp.c2
-rw-r--r--apps/plugins/lib/SOURCES1
-rw-r--r--apps/plugins/lib/pluginlib_exit.c25
-rw-r--r--apps/plugins/lib/pluginlib_exit.h52
-rw-r--r--apps/plugins/logo.c2
-rw-r--r--apps/plugins/lrcplayer.c2
-rw-r--r--apps/plugins/lua/rocklua.c5
-rw-r--r--apps/plugins/matrix.c2
-rw-r--r--apps/plugins/maze.c2
-rw-r--r--apps/plugins/mazezam.c2
-rw-r--r--apps/plugins/md5sum.c2
-rw-r--r--apps/plugins/metronome.c29
-rw-r--r--apps/plugins/midi/midiplay.c3
-rw-r--r--apps/plugins/minesweeper.c2
-rw-r--r--apps/plugins/mosaique.c2
-rw-r--r--apps/plugins/mp3_encoder.c2
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c2
-rw-r--r--apps/plugins/nim.c9
-rw-r--r--apps/plugins/oscilloscope.c12
-rw-r--r--apps/plugins/pacbox/pacbox.c2
-rw-r--r--apps/plugins/pdbox/pdbox.c2
-rw-r--r--apps/plugins/pegbox.c2
-rw-r--r--apps/plugins/pictureflow.c2
-rw-r--r--apps/plugins/pictureflow/pictureflow.c41
-rw-r--r--apps/plugins/pitch_detector.c2
-rw-r--r--apps/plugins/plasma.c32
-rwxr-xr-xapps/plugins/plugin_crt0.c116
-rw-r--r--apps/plugins/plugins.make4
-rw-r--r--apps/plugins/pong.c2
-rw-r--r--apps/plugins/ppmviewer.c2
-rw-r--r--apps/plugins/properties.c2
-rw-r--r--apps/plugins/random_folder_advance_config.c2
-rw-r--r--apps/plugins/remote_control.c2
-rw-r--r--apps/plugins/reversi/reversi-gui.c2
-rw-r--r--apps/plugins/robotfindskitten.c2
-rw-r--r--apps/plugins/rockblox.c2
-rw-r--r--apps/plugins/rockblox1d.c2
-rw-r--r--apps/plugins/rockbox_flash.c2
-rw-r--r--apps/plugins/rockboy.c2
-rw-r--r--apps/plugins/rockboy/rockboy.c2
-rw-r--r--apps/plugins/rocklife.c2
-rw-r--r--apps/plugins/rockpaint.c2
-rw-r--r--apps/plugins/search.c2
-rw-r--r--apps/plugins/searchengine/searchengine.c2
-rw-r--r--apps/plugins/settings_dumper.c2
-rw-r--r--apps/plugins/shopper.c2
-rw-r--r--apps/plugins/shortcuts/shortcuts_append.c2
-rw-r--r--apps/plugins/shortcuts/shortcuts_view.c2
-rw-r--r--apps/plugins/sliding_puzzle.c2
-rw-r--r--apps/plugins/snake.c2
-rw-r--r--apps/plugins/snake2.c2
-rw-r--r--apps/plugins/snow.c2
-rw-r--r--apps/plugins/sokoban.c2
-rw-r--r--apps/plugins/solitaire.c2
-rw-r--r--apps/plugins/sort.c2
-rw-r--r--apps/plugins/spacerocks.c2
-rw-r--r--apps/plugins/splitedit.c2
-rw-r--r--apps/plugins/star.c2
-rw-r--r--apps/plugins/starfield.c7
-rw-r--r--apps/plugins/stats.c2
-rw-r--r--apps/plugins/stopwatch.c2
-rw-r--r--apps/plugins/sudoku/sudoku.c2
-rw-r--r--apps/plugins/superdom.c2
-rw-r--r--apps/plugins/test_boost.c2
-rw-r--r--apps/plugins/test_codec.c2
-rw-r--r--apps/plugins/test_core_jpeg.c2
-rw-r--r--apps/plugins/test_disk.c2
-rw-r--r--apps/plugins/test_fps.c2
-rw-r--r--apps/plugins/test_gfx.c2
-rw-r--r--apps/plugins/test_grey.c2
-rw-r--r--apps/plugins/test_greylib_bitmap_scale.c2
-rw-r--r--apps/plugins/test_mem.c2
-rw-r--r--apps/plugins/test_mem_jpeg.c2
-rw-r--r--apps/plugins/test_resize.c2
-rw-r--r--apps/plugins/test_sampr.c2
-rw-r--r--apps/plugins/test_scanrate.c2
-rw-r--r--apps/plugins/test_touchscreen.c2
-rw-r--r--apps/plugins/test_viewports.c2
-rw-r--r--apps/plugins/text_editor.c2
-rw-r--r--apps/plugins/text_viewer/text_viewer.c13
-rw-r--r--apps/plugins/text_viewer/tv_action.c4
-rw-r--r--apps/plugins/text_viewer/tv_action.h5
-rw-r--r--apps/plugins/theme_remove.c2
-rw-r--r--apps/plugins/vbrfix.c2
-rw-r--r--apps/plugins/video.c2
-rw-r--r--apps/plugins/vu_meter.c2
-rw-r--r--apps/plugins/wav2wv.c2
-rw-r--r--apps/plugins/wavplay.c2
-rw-r--r--apps/plugins/wavrecord.c2
-rw-r--r--apps/plugins/wavview.c2
-rw-r--r--apps/plugins/wormlet.c2
-rw-r--r--apps/plugins/xobox.c2
-rw-r--r--apps/plugins/zxbox.c2
-rw-r--r--apps/plugins/zxbox/zxbox.c2
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);
#define PLUGIN_MIN_API_VERSION 190
/* plugin return codes */
-/* internal returns start at 0x100 to make exit(1..255) work */
-#define INTERNAL_PLUGIN_RETVAL_START 0x100
enum plugin_status {
- PLUGIN_OK = 0, /* PLUGIN_OK == EXIT_SUCCESS */
- /* 1...255 reserved for exit() */
- PLUGIN_USB_CONNECTED = INTERNAL_PLUGIN_RETVAL_START,
- PLUGIN_POWEROFF,
+ PLUGIN_OK = 0,
+ PLUGIN_USB_CONNECTED,
PLUGIN_GOTO_WPS,
PLUGIN_ERROR = -1,
};
@@ -916,14 +912,14 @@ extern unsigned char plugin_end_addr[];
const struct plugin_header __header \
__attribute__ ((section (".header")))= { \
PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
- plugin_start_addr, plugin_end_addr, plugin__start, &rb };
+ plugin_start_addr, plugin_end_addr, plugin_start, &rb };
#else /* PLATFORM_HOSTED */
#define PLUGIN_HEADER \
const struct plugin_api *rb DATA_ATTR; \
const struct plugin_header __header \
__attribute__((visibility("default"))) = { \
PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
- NULL, NULL, plugin__start, &rb };
+ NULL, NULL, plugin_start, &rb };
#endif /* CONFIG_PLATFORM */
#ifdef PLUGIN_USE_IRAM
@@ -958,7 +954,7 @@ void plugin_tsr(bool (*exit_callback)(bool reenter));
/* defined by the plugin */
extern const struct plugin_api *rb;
-enum plugin_status plugin__start(const void* parameter)
+enum plugin_status plugin_start(const void* parameter)
NO_PROF_ATTR;
#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 @@
#include "plugin.h"
#include "lib/pluginlib_actions.h"
-
+PLUGIN_HEADER
const struct button_mapping *plugin_contexts[] = { pla_main_ctx };
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 @@
/* Only build for (correct) target */
#if CONFIG_CPU==SH7034 && !(CONFIG_STORAGE & STORAGE_MMC)
-
+PLUGIN_HEADER
#ifdef HAVE_LCD_CHARCELLS /* player model */
#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 @@
#include "version.h"
#include "plugin.h"
-
+PLUGIN_HEADER
#define BATTERY_LOG "/battery_bench.txt"
#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 @@
#include "midi/sequencer.h"
#include "midi/midifile.h"
-
+PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
/* 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 @@
#include "plugin.h"
#include "lib/jpeg_mem.h"
-
+PLUGIN_HEADER
/* a null output plugin to save memory and better isolate decode cost */
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 @@
#include "plugin.h"
#include "lib/jpeg_mem.h"
-
+PLUGIN_HEADER
static unsigned char output;
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 @@
#include "lib/highscore.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
/* save files */
#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 @@
#include "time.h"
#include "lib/fixedpoint.h"
-
+PLUGIN_HEADER
#define SS_TITLE "Bouncer"
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 @@
#include "pluginbitmaps/brickmania_break.h"
#endif
-
+PLUGIN_HEADER
/*
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 @@
#include "lib/playback_control.h"
#include "lib/highscore.h"
+PLUGIN_HEADER
+
/* files */
#define SCORE_FILE PLUGIN_GAMES_DIR "/bubbles.score"
#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 "="
#ifdef HAVE_LCD_BITMAP
#include "math.h"
-
+PLUGIN_HEADER
#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 @@
#include "lib/playback_control.h"
#include "lib/configfile.h"
-
+PLUGIN_HEADER
#if CONFIG_KEYPAD == RECORDER_PAD
#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 @@
#include "lib/overlay.h"
-
+PLUGIN_HEADER
/* this is the plugin entry point */
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 {
extern const fb_data chessbox_pieces[];
-
+PLUGIN_HEADER
/* Tile size defined by the assigned bitmap */
#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 @@
#include "plugin.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
/* variable button definitions */
#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 @@
****************************************************************************/
#include "plugin.h"
-
+PLUGIN_HEADER
#define EXTERN static
#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 @@
#include "lib/helper.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
/*
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 @@
#include "lib/playback_control.h"
#include "lib/display_text.h"
-
+PLUGIN_HEADER
#if (CONFIG_KEYPAD == SANSA_E200_PAD)
#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 @@
#include "plugin.h"
#include "time.h"
#include "lib/pluginlib_actions.h"
-#include "lib/pluginlib_exit.h"
#include "lib/xlcd.h"
#include "clock.h"
@@ -31,7 +30,7 @@
#include "clock_menu.h"
#include "clock_settings.h"
-
+PLUGIN_HEADER
/* Keymaps */
const struct button_mapping* plugin_contexts[]={
@@ -57,8 +56,9 @@ const struct button_mapping* plugin_contexts[]={
/**************************
* Cleanup on plugin return
*************************/
-void cleanup(void)
+void cleanup(void *parameter)
{
+ (void)parameter;
clock_draw_restore_colors();
if(clock_settings.general.save_settings == 1)
save_settings();
@@ -115,7 +115,6 @@ enum plugin_status plugin_start(const void* parameter){
struct counter counter;
bool exit_clock = false;
(void)parameter;
- atexit(cleanup);
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
@@ -175,7 +174,9 @@ enum plugin_status plugin_start(const void* parameter){
exit_clock=main_menu();
break;
default:
- exit_on_usb(button);
+ if(rb->default_event_handler_ex(button, cleanup, NULL)
+ == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
if(time.second != last_second){
last_second=time.second;
redraw=true;
@@ -192,5 +193,6 @@ enum plugin_status plugin_start(const void* parameter){
}
}
+ cleanup(NULL);
return PLUGIN_OK;
}
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 @@
#include "lib/playback_control.h"
#include "lib/pluginlib_actions.h"
-
+PLUGIN_HEADER
/* Limits */
#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 @@
#include "plugin.h"
#include "lib/helper.h"
-
+PLUGIN_HEADER
static const char* const credits[] = {
#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 @@
#include "plugin.h"
-
+PLUGIN_HEADER
static void aes_encrypt(void* data, uint32_t size)
{
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 @@
***************************************************************************/
#include "plugin.h"
#include "lib/playergfx.h"
-#include "lib/pluginlib_exit.h"
#if LCD_DEPTH > 1
#include "lib/mylcd.h" /* MYLCD_CFG_RB_XLCD or MYLCD_CFG_PGFX */
#include "lib/grey.h"
@@ -33,6 +32,8 @@
#include "lib/xlcd.h"
#include "lib/fixedpoint.h"
+PLUGIN_HEADER
+
/* Loops that the values are displayed */
#define DISP_TIME 30
@@ -610,8 +611,10 @@ static void cube_draw(void)
}
}
-void cleanup(void)
+void cleanup(void *parameter)
{
+ (void)parameter;
+
#ifdef USEGSLIB
grey_release();
#elif defined HAVE_LCD_CHARCELLS
@@ -635,7 +638,7 @@ enum plugin_status plugin_start(const void* parameter)
bool highspeed = false;
bool paused = false;
bool redraw = true;
- bool quit = false;
+ bool exit = false;
(void)(parameter);
@@ -648,7 +651,6 @@ enum plugin_status plugin_start(const void* parameter)
rb->splash(HZ, "Couldn't init greyscale display");
return PLUGIN_ERROR;
}
-
/* init lcd_ function pointers */
lcdfuncs.update = rb->lcd_update;
lcdfuncs.clear_display = rb->lcd_clear_display;
@@ -671,8 +673,7 @@ enum plugin_status plugin_start(const void* parameter)
pgfx_display(0, 0);
#endif
- atexit(cleanup);
- while(!quit)
+ while(!exit)
{
if (redraw)
{
@@ -829,17 +830,24 @@ enum plugin_status plugin_start(const void* parameter)
case CUBE_RC_QUIT:
#endif
case CUBE_QUIT:
- exit(EXIT_SUCCESS);
+ exit = true;
break;
default:
- exit_on_usb(button);
+ if (rb->default_event_handler_ex(button, cleanup, NULL)
+ == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
break;
}
if (button != BUTTON_NONE)
lastbutton = button;
}
+#ifdef USEGSLIB
+ grey_release();
+#elif defined(HAVE_LCD_CHARCELLS)
+ pgfx_release();
+#endif
return PLUGIN_OK;
}
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 @@
****************************************************************************/
#include "plugin.h"
-#include "lib/pluginlib_exit.h"
#ifdef HAVE_LCD_BITMAP
#include "lib/pluginlib_actions.h"
#include "lib/helper.h"
-
+PLUGIN_HEADER
#define DEFAULT_WAIT_TIME 3
#define DEFAULT_NB_POLYGONS 7
@@ -260,8 +259,10 @@ void polygons_draw(struct polygon_fifo * polygons, struct screen * display)
}
}
-void cleanup(void)
+void cleanup(void *parameter)
{
+ (void)parameter;
+
backlight_use_settings();
#ifdef HAVE_REMOTE_LCD
remote_backlight_use_settings();
@@ -393,6 +394,7 @@ int plugin_main(void)
switch(action)
{
case DEMYSTIFY_QUIT:
+ cleanup(NULL);
return PLUGIN_OK;
case DEMYSTIFY_ADD_POLYGON:
@@ -419,7 +421,9 @@ int plugin_main(void)
break;
default:
- exit_on_usb(action);
+ if (rb->default_event_handler_ex(action, cleanup, NULL)
+ == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
break;
}
}
@@ -432,8 +436,6 @@ enum plugin_status plugin_start(const void* parameter)
int ret;
(void)parameter;
- atexit(cleanup);
-
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#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
};
#define PRINT_BUFFER_LENGTH MAX_DICES*4
-
+PLUGIN_HEADER
static struct dices dice;
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 @@
#include "plugin.h"
#include "lib/simple_viewer.h"
-
+PLUGIN_HEADER
#define MIN_DESC_BUF_SIZE 0x400 /* arbitrary minimum size for description */
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 @@
#include "plugin.h"
#include "errno.h"
-
+PLUGIN_HEADER
/* function return values */
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 @@
#include "st_stuff.h"
#include "lib/helper.h"
-
+PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
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:
- The Irish currency needs 6 digits after the . to have sufficient precision on big number
*/
-
+PLUGIN_HEADER
/* Name and path of the config file*/
static const char cfg_filename[] = "euroconverter.cfg";
@@ -387,8 +387,10 @@ static int euro_menu(void)
/* Call when the program end */
-static void euro_exit(void)
+static void euro_exit(void *parameter)
{
+ (void)parameter;
+
//Restore the old pattern (i don't find another way to do this. An idea?)
rb->lcd_unlock_pattern(heuro);
rb->lcd_unlock_pattern(hhome);
@@ -409,7 +411,6 @@ enum plugin_status plugin_start(const void* parameter)
/* if you don't use the parameter, you can do like
this to avoid the compiler warning about it */
(void)parameter;
- atexit(euro_exit);
/*Get the pattern handle*/
heuro=rb->lcd_get_locked_pattern();
@@ -586,7 +587,9 @@ enum plugin_status plugin_start(const void* parameter)
break;
default:
- exit_on_usb(button);
+ if (rb->default_event_handler_ex(button, euro_exit, NULL)
+ == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
break;
}
/*Display*/
@@ -596,6 +599,7 @@ enum plugin_status plugin_start(const void* parameter)
e=mydiv(h,currency[country]);
display(e,h,pos);
}
+ euro_exit(NULL);
return PLUGIN_OK;
}
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 @@
#endif
#include "lib/mylcd.h"
-
+PLUGIN_HEADER
#ifndef HAVE_LCD_COLOR
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 @@
#define FIRE_XPOS 0
#endif
+PLUGIN_HEADER
+
#ifndef HAVE_LCD_COLOR
GREY_INFO_STRUCT
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 @@
#include "lib/helper.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
/***
* 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 @@
#error this platform is not (yet) flashable
#endif
-
+PLUGIN_HEADER
#if CONFIG_KEYPAD == ONDIO_PAD /* limited keypad */
#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 @@
****************************************************************************/
#include "plugin.h"
-
+PLUGIN_HEADER
/* variable button definitions */
#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 @@
#include "fractal_rect.h"
#include "fractal_sets.h"
#include "mandelbrot_set.h"
-#include "lib/pluginlib_exit.h"
#ifdef USEGSLIB
GREY_INFO_STRUCT
@@ -42,7 +41,7 @@ static size_t gbuf_size = 0;
#define REDRAW_FULL 2
#define REDRAW_FULL_OVERLAY 3
-
+PLUGIN_HEADER
/* returns 1 if a button has been pressed, 0 otherwise */
static int button_yield(void *ctx)
@@ -86,8 +85,9 @@ static int button_yield(void *ctx)
}
}
-static void cleanup(void)
+static void cleanup(void *parameter)
{
+ (void)parameter;
#ifdef USEGSLIB
grey_release();
#endif
@@ -109,13 +109,11 @@ enum plugin_status plugin_start(const void* parameter)
if (!grey_init(gbuf, gbuf_size, GREY_ON_COP, LCD_WIDTH, LCD_HEIGHT, NULL))
{
rb->splash(HZ, "Couldn't init greyscale display");
- return PLUGIN_ERROR;
+ return 0;
}
grey_show(true); /* switch on greyscale overlay */
#endif
- /* release greylib on exit */
- atexit(cleanup);
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
#endif
@@ -163,6 +161,9 @@ enum plugin_status plugin_start(const void* parameter)
case FRACTAL_RC_QUIT:
#endif
case FRACTAL_QUIT:
+#ifdef USEGSLIB
+ grey_release();
+#endif
return PLUGIN_OK;
case FRACTAL_ZOOM_OUT:
@@ -245,13 +246,18 @@ enum plugin_status plugin_start(const void* parameter)
break;
default:
- exit_on_usb(button);
+ if (rb->default_event_handler_ex(button, cleanup, NULL)
+ == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
break;
}
if (button != BUTTON_NONE)
lastbutton = button;
}
+#ifdef USEGSLIB
+ grey_release();
+#endif
return PLUGIN_OK;
}
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 @@
#include "lib/pluginlib_exit.h"
#include "lib/pluginlib_actions.h"
-
+PLUGIN_HEADER
extern int frotz_main(void);
extern bool hot_key_quit(void);
@@ -41,7 +41,7 @@ enum plugin_status plugin_start(const void* parameter)
int i;
char* ext;
- atexit(atexit_cleanup);
+ PLUGINLIB_EXIT_INIT_ATEXIT(atexit_cleanup);
if (!parameter)
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 @@
#include "lib/overlay.h"
-
+PLUGIN_HEADER
enum plugin_status plugin_start(const void* parameter)
{
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 @@
#include "lib/playback_control.h"
#include "lib/configfile.h"
-
+PLUGIN_HEADER
#include "goban.h"
#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 @@
#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4)
#include "lib/grey.h"
-
+PLUGIN_HEADER
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
@@ -316,7 +316,9 @@ int main(void)
button = rb->button_get(true);
- exit_on_usb(button);
+ if (rb->default_event_handler_ex(button, cleanup, NULL)
+ == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
if (button & GREYSCALE_SHIFT)
{
@@ -367,6 +369,8 @@ int main(void)
case GREYSCALE_RC_OFF:
#endif
case GREYSCALE_OFF:
+
+ cleanup(NULL);
return PLUGIN_OK;
}
}
@@ -378,7 +382,6 @@ enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
- atexit(cleanup);
return main();
}
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 @@
/* This macros must always be included. Should be placed at the top by
convention, although the actual position doesn't matter */
-
+PLUGIN_HEADER
/* this is the plugin entry point */
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 @@
#include <lib/configfile.h>
#include "imageviewer.h"
-
+PLUGIN_HEADER
#ifdef USEGSLIB
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 @@
#define FIRE_WIDTH BMPWIDTH_invadrox_fire
#define FIRE_HEIGHT BMPHEIGHT_invadrox_fire
-
+PLUGIN_HEADER
/* Original graphics is only 1bpp so it should be portable
* 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;
#ifdef PLATFORM_ID
-
+PLUGIN_HEADER
#if CONFIG_KEYPAD == IRIVER_H100_PAD
#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 @@
****************************************************************************/
#include "plugin.h"
-
+PLUGIN_HEADER
ssize_t buf_size;
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 @@
#include "plugin.h"
#include "lib/pluginlib_actions.h"
#include "lib/picture.h"
-#include "lib/pluginlib_exit.h"
-
+PLUGIN_HEADER
const struct button_mapping* plugin_contexts[]={pla_main_ctx};
#define NB_PICTURES 9
@@ -110,8 +109,9 @@ void patterns_deinit(struct screen* display)
#endif /* HAVE_LCD_CHARCELLS */
/*Call when the program exit*/
-void jackpot_exit(void)
+void jackpot_exit(void *parameter)
{
+ (void)parameter;
#ifdef HAVE_LCD_CHARCELLS
patterns_deinit(rb->screens[SCREEN_MAIN]);
#endif /* HAVE_LCD_CHARCELLS */
@@ -298,7 +298,6 @@ enum plugin_status plugin_start(const void* parameter)
int action, i;
struct jackpot game;
(void)parameter;
- atexit(jackpot_exit);
rb->srand(*rb->current_tick);
#ifdef HAVE_LCD_CHARCELLS
patterns_init(rb->screens[SCREEN_MAIN]);
@@ -324,9 +323,12 @@ enum plugin_status plugin_start(const void* parameter)
break;
default:
- exit_on_usb(action);
+ if (rb->default_event_handler_ex(action, jackpot_exit, NULL)
+ == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
break;
}
}
+ jackpot_exit(NULL);
return PLUGIN_OK;
}
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 @@
#ifdef HAVE_LCD_BITMAP
-
+PLUGIN_HEADER
/* button definitions */
#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 @@
#include "plugin.h"
#include "lib/playback_control.h"
#include "lib/md5.h"
-
+PLUGIN_HEADER
#define KEYBOX_FILE PLUGIN_APPS_DIR "/keybox.dat"
#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 @@
#include "plugin.h"
#include "lib/helper.h"
-
+PLUGIN_HEADER
/* variable button definitions - only targets with a colour display */
#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
pluginlib_actions.c
helper.c
md5.c
+pluginlib_exit.c
jhash.c
configfile.c
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 @@
+/***************************************************************************
+* __________ __ ___.
+* Open \______ \ ____ ____ | | _\_ |__ _______ ___
+* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+* \/ \/ \/ \/ \/
+* $Id$
+*
+* Copyright (C) 2009 by Maurus Cuelenaere
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+*
+* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+* KIND, either express or implied.
+*
+****************************************************************************/
+
+#include "pluginlib_exit.h"
+
+jmp_buf __exit_env DATA_ATTR;
+
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 @@
#ifndef __PLUGINLIB_EXIT_H__
#define __PLUGINLIB_EXIT_H__
-/* make sure we are in sync with the real definitions, especially on
- * hosted systems */
-#include <stdlib.h>
-#include "gcc_extensions.h"
-
-/* these are actually implemented in plugin_crt0.c which all plugins link */
-extern int atexit(void (*func)(void));
-extern void exit(int status) NORETURN_ATTR;
-/* these don't call the exit handlers */
-extern void _exit(int status) NORETURN_ATTR;
-/* C99 version */
-#define _Exit _exit
-
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS 0
-#define EXIT_FAILURE 1
+#include "config.h"
+#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
+#include "../../codecs/lib/setjmp.h"
+#else
+#include <setjmp.h>
#endif
-/**
- * helper function to handle USB connected events coming from
- * button_get()
- *
- * it will exit the plugin if usb is detected, but it will call the atexit func
- * before actually showing the usb screen
- *
- * it additionally handles power off as well, with the same behavior
+#define _PLUGINLIB_EXIT_INIT(atexit) switch(setjmp(__exit_env)) \
+ { \
+ case 1: \
+ atexit \
+ return PLUGIN_OK; \
+ case 2: \
+ atexit \
+ return PLUGIN_ERROR; \
+ case 0: \
+ default: \
+ break; \
+ }
+
+/* Either PLUGINLIB_EXIT_INIT or PLUGINLIB_EXIT_INIT_ATEXIT needs to be placed
+ * as the first line in plugin_start. The _ATEXIT version will call the named
+ * no-argument function when exit() is called before exiting the plugin, to
+ * allow for cleanup.
*/
-extern void exit_on_usb(int button);
+#define PLUGINLIB_EXIT_INIT _PLUGINLIB_EXIT_INIT()
+#define PLUGINLIB_EXIT_INIT_ATEXIT(atexit) _PLUGINLIB_EXIT_INIT(atexit();)
+
+extern jmp_buf __exit_env;
+#define exit(status) longjmp(__exit_env, status != 0 ? 2 : 1)
#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 @@
#include "plugin.h"
#include "lib/playergfx.h"
-
+PLUGIN_HEADER
#ifdef HAVE_LCD_BITMAP
#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 @@
#include "lib/helper.h"
#include <ctype.h>
-
+PLUGIN_HEADER
#define MAX_LINE_LEN 256
#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 @@
****************************************************************************/
#include "plugin.h"
+#include "lib/pluginlib_exit.h"
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
@@ -27,7 +28,7 @@
#include "rockmalloc.h"
#include "luadir.h"
-
+PLUGIN_HEADER
static const luaL_Reg lualibs[] = {
{"", luaopen_base},
@@ -147,6 +148,8 @@ enum plugin_status plugin_start(const void* parameter)
const char* filename;
int status;
+ PLUGINLIB_EXIT_INIT
+
if (parameter == NULL)
{
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 @@
#include "plugin.h"
-
+PLUGIN_HEADER
/* Images */
#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 @@
#include "plugin.h"
#include "lib/helper.h"
-
+PLUGIN_HEADER
/* key assignments */
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 @@
#include "lib/playback_control.h"
/* Include standard plugin macro */
-
+PLUGIN_HEADER
#if (CONFIG_KEYPAD == IPOD_3G_PAD)
# 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 @@
#include "plugin.h"
#include "lib/md5.h"
-
+PLUGIN_HEADER
#define BUFFERSIZE 16384
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 @@
****************************************************************************/
#include "plugin.h"
#include "lib/pluginlib_actions.h"
-#include "lib/pluginlib_exit.h"
-
+PLUGIN_HEADER
#if CONFIG_CODEC != SWCODEC
/* tick sound from a metronome */
@@ -847,14 +846,13 @@ void timer_callback(void)
}
}
-void cleanup(void)
+void cleanup(void *parameter)
{
+ (void)parameter;
+
rb->timer_unregister();
MET_PLAY_STOP; /* stop audio ISR */
rb->led(0);
-#if CONFIG_CODEC == SWCODEC
- rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
-#endif
}
void tap(void)
@@ -887,9 +885,9 @@ enum plugin_status plugin_start(const void* parameter)
{
int button;
static int last_button = BUTTON_NONE;
+ enum plugin_status status;
(void)parameter;
- atexit(cleanup);
if (MET_IS_PLAYING)
MET_PLAY_STOP; /* stop audio IS */
@@ -929,7 +927,9 @@ enum plugin_status plugin_start(const void* parameter)
case METRONOME_QUIT:
/* get out of here */
- return PLUGIN_OK;
+ cleanup(NULL);
+ status = PLUGIN_OK;
+ goto metronome_exit;
case METRONOME_PAUSE:
if(!sound_paused)
@@ -981,7 +981,12 @@ enum plugin_status plugin_start(const void* parameter)
#endif
default:
- exit_on_usb(button);
+ if (rb->default_event_handler_ex(button, cleanup, NULL)
+ == SYS_USB_CONNECTED)
+ {
+ status = PLUGIN_USB_CONNECTED;
+ goto metronome_exit;
+ }
reset_tap = false;
break;
@@ -993,5 +998,11 @@ enum plugin_status plugin_start(const void* parameter)
}
rb->yield();
}
+
+metronome_exit:
+#if CONFIG_CODEC == SWCODEC
+ rb->pcm_set_frequency(HW_SAMPR_DEFAULT);
+#endif
+ return status;
}
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 @@
#include "sequencer.h"
#include "midifile.h"
-
+PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
/* variable button definitions */
@@ -450,6 +450,7 @@ static int midimain(const void * filename)
enum plugin_status plugin_start(const void* parameter)
{
int retval;
+ PLUGINLIB_EXIT_INIT;
PLUGIN_IRAM_INIT(rb)
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 @@
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
/* what the minesweeper() function can return */
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 @@
#include "lib/playergfx.h"
#include "lib/mylcd.h"
-
+PLUGIN_HEADER
#ifdef HAVE_LCD_BITMAP
#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 @@
#include <inttypes.h>
#include "plugin.h"
-
+PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
#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 @@
#include "stream_thread.h"
#include "stream_mgr.h"
-
+PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
/* 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
take a match. Later you are obliged to take at least one.)
*/
-
+PLUGIN_HEADER
/*Pattern for the game*/
static unsigned char smile[]={0x00, 0x11, 0x04, 0x04, 0x00, 0x11, 0x0E}; /* :-) */
@@ -144,7 +144,6 @@ enum plugin_status plugin_start(const void* parameter)
int x,v,min;
bool ok;
bool go;
- atexit(nim_exit);
/* if you don't use the parameter, you can do like
this to avoid the compiler warning about it */
@@ -194,6 +193,7 @@ enum plugin_status plugin_start(const void* parameter)
{
case BUTTON_STOP|BUTTON_REL:
go = true;
+ nim_exit(NULL);
return PLUGIN_OK;
break;
@@ -214,7 +214,9 @@ enum plugin_status plugin_start(const void* parameter)
break;
default:
- exit_on_usb(button);
+ if (rb->default_event_handler_ex(button, nim_exit,
+ NULL) == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
break;
}
display_first_line(x);
@@ -289,6 +291,7 @@ enum plugin_status plugin_start(const void* parameter)
min=1;
}
}
+ nim_exit(NULL);
return PLUGIN_OK;
}
#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 @@
#include "plugin.h"
#include "lib/helper.h"
-#include "lib/pluginlib_exit.h"
#ifdef HAVE_LCD_BITMAP
#include "lib/xlcd.h"
#include "lib/configfile.h"
-
+PLUGIN_HEADER
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
@@ -752,8 +751,9 @@ void anim_vertical(int cur_left, int cur_right)
last_pos = cur_y;
}
-void cleanup(void)
+void cleanup(void *parameter)
{
+ (void)parameter;
#if LCD_DEPTH > 1
rb->lcd_set_foreground(LCD_DEFAULT_FG);
rb->lcd_set_background(LCD_DEFAULT_BG);
@@ -772,7 +772,6 @@ enum plugin_status plugin_start(const void* parameter)
(void)parameter;
- atexit(cleanup);
configfile_load(cfg_filename, disk_config,
sizeof(disk_config) / sizeof(disk_config[0]),
CFGFILE_MINVERSION);
@@ -893,7 +892,9 @@ enum plugin_status plugin_start(const void* parameter)
break;
default:
- exit_on_usb(button);
+ if (rb->default_event_handler_ex(button, cleanup, NULL)
+ == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
break;
}
if (button != BUTTON_NONE)
@@ -907,6 +908,7 @@ enum plugin_status plugin_start(const void* parameter)
displaymsg = true;
}
}
+ cleanup(NULL);
if (rb->memcmp(&osc, &osc_disk, sizeof(osc))) /* save settings if changed */
{
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 @@
#include "lib/configfile.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
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 @@
#include "PDa/src/s_stuff.h"
/* Welcome to the PDBox plugin */
-
+PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
/* 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 @@
#include "pluginbitmaps/pegbox_header.h"
#include "pluginbitmaps/pegbox_pieces.h"
-
+PLUGIN_HEADER
#define CONFIG_FILE_NAME "pegbox.cfg"
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 @@
#include "lib/overlay.h"
-
+PLUGIN_HEADER
/* this is the plugin entry point */
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 @@
#include <albumart.h>
#include "lib/read_image.h"
#include "lib/pluginlib_actions.h"
-#include "lib/pluginlib_exit.h"
#include "lib/helper.h"
#include "lib/configfile.h"
#include "lib/grey.h"
@@ -35,7 +34,7 @@
#include "lib/feature_wrappers.h"
#include "lib/buflib.h"
-
+PLUGIN_HEADER
/******************************* Globals ***********************************/
@@ -2069,8 +2068,9 @@ void update_scroll_animation(void)
/**
Cleanup the plugin
*/
-void cleanup(void)
+void cleanup(void *parameter)
{
+ (void) parameter;
int i;
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(false);
@@ -2610,6 +2610,19 @@ int main(void)
cache_version = CACHE_VERSION;
configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS, CONFIG_VERSION);
+
+#ifdef USEGSLIB
+ long grey_buf_used;
+ if (!grey_init(buf, buf_size, GREY_BUFFERED|GREY_ON_COP,
+ LCD_WIDTH, LCD_HEIGHT, &grey_buf_used))
+ {
+ error_wait("Greylib init failed!");
+ return PLUGIN_ERROR;
+ }
+ grey_setfont(FONT_UI);
+ buf_size -= grey_buf_used;
+ buf = (void*)(grey_buf_used + (char*)buf);
+#endif
buflib_init(&buf_ctx, (void *)buf, buf_size);
if (!(empty_slide_hid = read_pfraw(EMPTY_SLIDE, 0)))
@@ -2828,7 +2841,9 @@ int main(void)
}
break;
default:
- exit_on_usb(button);
+ if (rb->default_event_handler_ex(button, cleanup, NULL)
+ == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
break;
}
}
@@ -2840,7 +2855,6 @@ enum plugin_status plugin_start(const void *parameter)
{
int ret, i;
(void) parameter;
- atexit(cleanup);
FOR_NB_SCREENS(i)
rb->viewportmanager_theme_enable(i, false, NULL);
@@ -2859,21 +2873,6 @@ enum plugin_status plugin_start(const void *parameter)
}
#endif
#endif
-
-#ifdef USEGSLIB
- long grey_buf_used;
- if (!grey_init(buf, buf_size, GREY_BUFFERED|GREY_ON_COP,
- LCD_WIDTH, LCD_HEIGHT, &grey_buf_used))
- {
- error_wait("Greylib init failed!");
- return PLUGIN_ERROR;
- }
- grey_setfont(FONT_UI);
- buf_size -= grey_buf_used;
- buf = (void*)(grey_buf_used + (char*)buf);
-#endif
-
- atexit(cleanup);
ret = main();
if ( ret == PLUGIN_OK || ret == PLUGIN_GOTO_WPS) {
if (configfile_save(CONFIG_FILE, config, CONFIG_NUM_ITEMS,
@@ -2883,5 +2882,7 @@ enum plugin_status plugin_start(const void *parameter)
ret = PLUGIN_ERROR;
}
}
+
+ cleanup(NULL);
return ret;
}
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 @@
#include "lib/helper.h"
#include "pluginbitmaps/pitch_notes.h"
-
+PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
/* 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 @@
#include "plugin.h"
#include "lib/helper.h"
#include "lib/pluginlib_actions.h"
-#include "lib/pluginlib_exit.h"
#ifdef HAVE_LCD_BITMAP
@@ -36,6 +35,7 @@
#endif
#include "lib/fixedpoint.h"
+PLUGIN_HEADER
/******************************* Globals ***********************************/
@@ -131,8 +131,10 @@ static void shades_generate(void)
}
#endif
-void cleanup(void)
+void cleanup(void *parameter)
{
+ (void)parameter;
+
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
if (boosted)
rb->cpu_boost(false);
@@ -142,9 +144,6 @@ void cleanup(void)
#endif
/* Turn on backlight timeout (revert to settings) */
backlight_use_settings(); /* backlight control in lib/helper.c */
-#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
- rb->lcd_set_mode(LCD_MODE_RGB565);
-#endif
}
/*
@@ -181,15 +180,10 @@ int main(void)
/* get the remainder of the plugin buffer */
gbuf = (unsigned char *) rb->plugin_get_buffer(&gbuf_size);
- if (!grey_init(gbuf, gbuf_size, GREY_ON_COP, LCD_WIDTH, LCD_HEIGHT, NULL))
- {
- rb->splash(HZ, "Couldn't init greyscale display");
- return PLUGIN_ERROR;
- }
+ grey_init(gbuf, gbuf_size, GREY_ON_COP, LCD_WIDTH, LCD_HEIGHT, NULL);
/* switch on greyscale overlay */
grey_show(true);
#endif
- atexit(cleanup);
sp1 = 4;
sp2 = 2;
sp3 = 4;
@@ -267,6 +261,7 @@ int main(void)
{
case PLA_EXIT:
case PLA_CANCEL:
+ cleanup(NULL);
return PLUGIN_OK;
break;
@@ -304,7 +299,9 @@ int main(void)
#endif
default:
- exit_on_usb(action);
+ if (rb->default_event_handler_ex(action, cleanup, NULL)
+ == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
break;
}
}
@@ -314,6 +311,8 @@ int main(void)
enum plugin_status plugin_start(const void* parameter)
{
+ int ret;
+
(void)parameter;
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
@@ -324,7 +323,14 @@ enum plugin_status plugin_start(const void* parameter)
#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
rb->lcd_set_mode(LCD_MODE_PAL256);
#endif
- return main();
+
+ ret = main();
+
+#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
+ rb->lcd_set_mode(LCD_MODE_RGB565);
+#endif
+
+ return ret;
}
#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 @@
-/***************************************************************************
-* __________ __ ___.
-* Open \______ \ ____ ____ | | _\_ |__ _______ ___
-* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
-* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
-* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
-* \/ \/ \/ \/ \/
-* $Id$
-*
-* Copyright (C) 2010 by Thomas Martitz
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
-* KIND, either express or implied.
-*
-****************************************************************************/
-
-
-#include "plugin.h"
-#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
-#include "../codecs/lib/setjmp.h"
-#else
-#include <setjmp.h>
-#endif
-
-PLUGIN_HEADER
-
-/*
- * EXIT_MAGIC magic, because 0 cannot be used due to setjmp()
- * must be > 0
- */
-#define EXIT_MAGIC 0x0CDEBABE
-
-extern enum plugin_status plugin_start(const void*);
-
-static jmp_buf __exit_env;
-/* only 1 atexit handler for now, chain in the exit handler if you need more */
-static void (*atexit_handler)(void);
-
-int atexit(void (*fn)(void))
-{
- if (atexit_handler)
- return -1;
- atexit_handler = fn;
- return 0;
-}
-
-void exit(int status)
-{ /* jump back in time to before starting the plugin */
- longjmp(__exit_env, status != 0 ? status : EXIT_MAGIC);
-}
-
-void _exit(int status)
-{ /* don't call exit handler */
- atexit_handler = NULL;
- exit(status);
-}
-
-enum plugin_status plugin__start(const void *param)
-{
- int exit_ret;
- enum plugin_status ret;
-
- /* we come back here if exit() was called or the plugin returned normally */
- exit_ret = setjmp(__exit_env);
- if (exit_ret == 0)
- { /* start the plugin */
- ret = plugin_start(param);
- }
- else
- { /* plugin exit via exit() */
- if (exit_ret == EXIT_MAGIC)
- { /* exit(EXIT_SUCCESS) */
- ret = PLUGIN_OK;
- }
- else if (exit_ret < INTERNAL_PLUGIN_RETVAL_START)
- { /* exit(EXIT_FAILURE) */
- ret = PLUGIN_ERROR;
- }
- else
- { /* exit(PLUGIN_XXX) */
- ret = (enum plugin_status)exit_ret;
- }
- }
-
- /* before finishing, call the exit handler if there was one */
- if (atexit_handler != NULL)
- atexit_handler();
-
- return ret;
-}
-
-static void cleanup_wrapper(void *param)
-{
- (void)param;
- if (atexit_handler)
- atexit_handler();
-}
-
-void exit_on_usb(int button)
-{ /* the default handler will call the exit handler before
- * showing the usb screen; after that we don't want the exit handler
- * to be called a second time, hence _exit()
- *
- * if not usb, then the handler will only be called if powering off
- * if poweroff, the plugin doesn't want to run any further so exit as well*/
- long result = rb->default_event_handler_ex(button, cleanup_wrapper, NULL);
- if (result == SYS_USB_CONNECTED)
- _exit(PLUGIN_USB_CONNECTED);
- else if (result == SYS_POWEROFF)
- _exit(PLUGIN_POWEROFF);
-}
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
PLUGINLINK_LDS := $(BUILDDIR)/apps/plugins/plugin.link
OVERLAYREF_LDS := $(BUILDDIR)/apps/plugins/overlay_ref.link
endif
-PLUGIN_CRT0 := $(BUILDDIR)/apps/plugins/plugin_crt0.o
+
# multifile plugins (subdirs):
PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS)
@@ -49,7 +49,7 @@ PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS)
$(ROCKS1): $(BUILDDIR)/%.rock: $(BUILDDIR)/%.o
# dependency for all plugins
-$(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGINLIB) $(PLUGINBITMAPLIB) $(PLUGIN_CRT0)
+$(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGINLIB) $(PLUGINBITMAPLIB)
$(PLUGINLIB): $(PLUGINLIB_OBJ)
$(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 @@
#ifdef HAVE_LCD_BITMAP
-
+PLUGIN_HEADER
#define PAD_HEIGHT LCD_HEIGHT / 6 /* Recorder: 10 iRiver: 21 */
#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 @@
#if defined(HAVE_LCD_COLOR)
-
+PLUGIN_HEADER
/* Magic constants. */
#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 @@
****************************************************************************/
#include "plugin.h"
-
+PLUGIN_HEADER
bool its_a_dir = false;
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 @@
#include "plugin.h"
#include "file.h"
-
+PLUGIN_HEADER
static bool cancel;
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 @@
#include "lib/pluginlib_actions.h"
-
+PLUGIN_HEADER
#define PLUGIN_CONTINUE 10
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:
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
/* This is initialized at the start of the plugin and used to determine the
* 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 @@
/* This macros must always be included. Should be placed at the top by
convention, although the actual position doesn't matter */
-
+PLUGIN_HEADER
/*Be sure to change MESSAGES when you change the array, or bad things
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 @@
#include "lib/playergfx.h"
#include "lib/mylcd.h"
-
+PLUGIN_HEADER
#if (CONFIG_KEYPAD == IPOD_4G_PAD) || \
(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 @@
#include "plugin.h"
-
+PLUGIN_HEADER
#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 @@
#if (CONFIG_CPU == SH7034) /* Only for SH targets */
-
+PLUGIN_HEADER
/* define DUMMY if you only want to "play" with the UI, does no harm */
/* #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 @@
#include "lib/overlay.h"
-
+PLUGIN_HEADER
/* this is the plugin entry point */
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 @@
#include "hw.h"
#include "pcm.h"
-
+PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
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 @@
#include "lib/pluginlib_actions.h"
#include "lib/helper.h"
-
+PLUGIN_HEADER
#define ROCKLIFE_PLAY_PAUSE PLA_SELECT
#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 @@
#include "lib/rgb_hsv.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
/***********************************************************************
* 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 @@
#include "plugin.h"
#include <ctype.h>
-
+PLUGIN_HEADER
#define BUFFER_SIZE 16384
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 @@
#include "token.h"
#include "dbinterface.h"
-
+PLUGIN_HEADER
void *audio_bufferbase;
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 @@
****************************************************************************/
#include "plugin.h"
-
+PLUGIN_HEADER
#define FILENAME "/settings_dumper.txt"
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 @@
#include "plugin.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
#define MAX_LIST_SIZE 400
#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 @@
#include "shortcuts.h"
-
+PLUGIN_HEADER
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 @@
#include "shortcuts.h"
-
+PLUGIN_HEADER
enum sc_list_action_type
{
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 @@
#include "plugin.h"
#ifdef HAVE_LCD_BITMAP
-
+PLUGIN_HEADER
/* variable button definitions */
#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;
#include "lib/highscore.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
/* variable button definitions */
#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
#include "lib/highscore.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
#define WIDTH 28
#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 @@
#include "lib/playergfx.h"
#include "lib/mylcd.h"
-
+PLUGIN_HEADER
#ifdef HAVE_LCD_BITMAP
#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 @@
#include "plugin.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
#define SOKOBAN_TITLE "Sokoban"
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 @@
#ifdef HAVE_LCD_BITMAP
-
+PLUGIN_HEADER
#define min(a,b) (a<b?a:b)
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 @@
* TODO: Implement a merge sort for files larger than the buffer
****************************************************************************/
-
+PLUGIN_HEADER
size_t buf_size;
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 @@
#include "lib/highscore.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
/* variable button definitions */
#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 @@
#include "plugin.h"
-
+PLUGIN_HEADER
/* variable button definitions */
#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 @@
#include "lib/display_text.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
/* size of a level in file */
#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 @@
#include "plugin.h"
#include "lib/helper.h"
-#include "lib/pluginlib_exit.h"
#ifdef HAVE_LCD_BITMAP /* and also not for the Player */
-
+PLUGIN_HEADER
/******************************* Globals ***********************************/
@@ -498,11 +497,9 @@ int plugin_main(void)
case STARFIELD_RC_QUIT:
#endif
case(STARFIELD_QUIT):
+ case(SYS_USB_CONNECTED):
return PLUGIN_OK;
break;
- default:
- exit_on_usb(button);
- break;
}
}
}
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 @@
****************************************************************************/
#include "plugin.h"
-
+PLUGIN_HEADER
static int files, dirs, musicfiles, largestdir;
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 @@
#include "plugin.h"
-
+PLUGIN_HEADER
#ifdef HAVE_LCD_BITMAP
#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:
#define BITMAP_WIDTH BMPWIDTH_sudoku_normal
#endif
-
+PLUGIN_HEADER
/* Default game - used to initialise sudoku.ss if it doesn't exist. */
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 @@
#include "lib/playback_control.h"
#include "lib/display_text.h"
#include "pluginbitmaps/superdom_boarditems.h"
-
+PLUGIN_HEADER
extern const fb_data superdom_boarditems[];
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 @@
#include "plugin.h"
-
+PLUGIN_HEADER
enum plugin_status plugin_start(const void* parameter)
{
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 @@
****************************************************************************/
#include "plugin.h"
-
+PLUGIN_HEADER
/* All swcodec targets have BUTTON_SELECT apart from the H10 and M3 */
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 @@
#include "plugin.h"
#include "lib/grey.h"
#include "lib/mylcd.h"
-
+PLUGIN_HEADER
/* different graphics libraries */
#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 @@
#include "plugin.h"
#include "lib/helper.h"
-
+PLUGIN_HEADER
#define TESTBASEDIR "/__TEST__"
#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
#define DURATION (2*HZ) /* longer duration gives more precise results */
-
+PLUGIN_HEADER
/* Screen logging */
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;
#define DURATION (HZ) /* longer duration gives more precise results */
#define RND_SEED 0x43A678C3 /* arbirary */
-
+PLUGIN_HEADER
static uint16_t rand_table[0x400];
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 @@
#include "lib/grey.h"
#include "lib/helper.h"
-
+PLUGIN_HEADER
#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) \
|| (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 @@
#define BMP_LOAD rb->read_bmp_file
#endif
-
+PLUGIN_HEADER
GREY_INFO_STRUCT
static unsigned char grey_bm_buf[LCD_WIDTH * LCD_HEIGHT +
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 @@
#include "plugin.h"
-
+PLUGIN_HEADER
#if PLUGIN_BUFFER_SIZE <= 0x8000
#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 @@
#include "lib/grey.h"
#include "lib/jpeg_mem.h"
#include "lib/mylcd.h"
-
+PLUGIN_HEADER
/* different graphics libraries */
#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 @@
#include "lib/pluginlib_actions.h"
#include "lib/pluginlib_bmp.h"
-
+PLUGIN_HEADER
const struct button_mapping *plugin_contexts[]
= {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 @@
* with sample rate.
*/
-
+PLUGIN_HEADER
PLUGIN_IRAM_DECLARE;
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 @@
#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && !defined(SIMULATOR)
-
+PLUGIN_HEADER
#if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == ONDIO_PAD) \
|| (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 @@
****************************************************************************/
#include "plugin.h"
-
+PLUGIN_HEADER
#if (CONFIG_KEYPAD == COWON_D2_PAD)
#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 @@
#include "plugin.h"
-
+PLUGIN_HEADER
#ifdef HAVE_LCD_BITMAP
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 @@
#include "lib/playback_control.h"
#define MAX_LINE_LEN 2048
-
+PLUGIN_HEADER
static unsigned char *buffer;
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 @@
*
****************************************************************************/
#include "plugin.h"
-#include "lib/pluginlib_exit.h"
#include "tv_action.h"
#include "tv_button.h"
#include "tv_preferences.h"
-
+PLUGIN_HEADER
enum plugin_status plugin_start(const void* file)
{
@@ -57,7 +56,6 @@ enum plugin_status plugin_start(const void* file)
return PLUGIN_ERROR;
}
- atexit(tv_exit);
while (!done) {
#ifdef HAVE_LCD_BITMAP
if (rb->global_settings->statusbar != STATUSBAR_OFF && preferences->statusbar)
@@ -81,12 +79,12 @@ enum plugin_status plugin_start(const void* file)
if (res != TV_MENU_RESULT_EXIT_MENU)
{
+ tv_exit(NULL);
+ done = true;
if (res == TV_MENU_RESULT_ATTACHED_USB)
return PLUGIN_USB_CONNECTED;
else if (res == TV_MENU_RESULT_ERROR)
return PLUGIN_ERROR;
- else
- done = true;
}
}
break;
@@ -197,6 +195,7 @@ enum plugin_status plugin_start(const void* file)
#ifdef TV_QUIT2
case TV_QUIT2:
#endif
+ tv_exit(NULL);
done = true;
break;
@@ -205,7 +204,9 @@ enum plugin_status plugin_start(const void* file)
break;
default:
- exit_on_usb(button);
+ if (rb->default_event_handler_ex(button, tv_exit, NULL)
+ == SYS_USB_CONNECTED)
+ return PLUGIN_USB_CONNECTED;
display_update = false;
break;
}
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)
tv_finalize_window();
}
-void tv_exit(void)
+void tv_exit(void *parameter)
{
+ (void)parameter;
+
/* save preference and bookmarks */
if (!tv_save_settings())
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);
/*
* finalize modules
+ *
+ * [In] parameter
+ * this argument does not use
*/
-void tv_exit(void);
+void tv_exit(void *parameter);
/*
* 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 @@
#include "plugin.h"
#include "lib/configfile.h"
-
+PLUGIN_HEADER
/* taken from apps/gui/wps_parser.c */
#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 @@
****************************************************************************/
#include "plugin.h"
-
+PLUGIN_HEADER
static char *audiobuf;
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 @@
#ifdef HAVE_LCD_BITMAP /* and definitely not for the Player, haha */
-
+PLUGIN_HEADER
/* variable button definitions */
#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 @@
#include "lib/fixedpoint.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
/* variable button definitions */
#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 @@
#include <codecs/libwavpack/wavpack.h>
-
+PLUGIN_HEADER
#define SAMPLES_PER_BLOCK 22050
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 @@
****************************************************************************/
#include "plugin.h"
-
+PLUGIN_HEADER
/************ Start of MAS pcm codec, raw i2c blocks ************/
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 @@
#include "plugin.h"
#include "lib/configfile.h"
-
+PLUGIN_HEADER
/************ Start of MAS pcm codec, raw i2c blocks ************/
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 @@
****************************************************************************/
#include "plugin.h"
-
+PLUGIN_HEADER
/* temp byte buffer */
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 @@
#include "lib/helper.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
/* size of the field the worm lives in */
#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 @@
#include "lib/helper.h"
#include "lib/playback_control.h"
-
+PLUGIN_HEADER
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
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 @@
#include "lib/overlay.h"
-
+PLUGIN_HEADER
/* this is the plugin entry point */
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 @@
#include "zxconfig.h"
-
+PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
#include "spkey_p.h"