summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/battery_bench.c2
-rw-r--r--apps/plugins/blackjack.c5
-rw-r--r--apps/plugins/chessclock.c3
-rw-r--r--apps/plugins/chip8.c2
-rw-r--r--apps/plugins/jpeg.c2
-rw-r--r--apps/plugins/lib/mem_function_wrappers.h44
-rw-r--r--apps/plugins/lib/playback_control.c10
-rw-r--r--apps/plugins/mazezam.c3
-rw-r--r--apps/plugins/metronome.c5
-rw-r--r--apps/plugins/mp3_encoder.c3
-rw-r--r--apps/plugins/properties.c4
-rw-r--r--apps/plugins/rockpaint.c3
-rw-r--r--apps/plugins/video.c2
-rw-r--r--apps/plugins/xobox.c5
14 files changed, 82 insertions, 11 deletions
diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c
index 13ce172f67..fef3f36db2 100644
--- a/apps/plugins/battery_bench.c
+++ b/apps/plugins/battery_bench.c
@@ -20,6 +20,7 @@
20#ifndef SIMULATOR /* not for the simulator */ 20#ifndef SIMULATOR /* not for the simulator */
21 21
22#include "plugin.h" 22#include "plugin.h"
23#include "mem_function_wrappers.h"
23PLUGIN_HEADER 24PLUGIN_HEADER
24 25
25#define BATTERY_LOG "/battery_bench.txt" 26#define BATTERY_LOG "/battery_bench.txt"
@@ -98,6 +99,7 @@ PLUGIN_HEADER
98 99
99/****************************** Plugin Entry Point ****************************/ 100/****************************** Plugin Entry Point ****************************/
100static struct plugin_api* rb; 101static struct plugin_api* rb;
102MEM_FUNCTION_WRAPPERS(rb);
101int main(void); 103int main(void);
102bool exit_tsr(bool); 104bool exit_tsr(bool);
103void thread(void); 105void thread(void);
diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c
index f987eeb3b5..07af984a80 100644
--- a/apps/plugins/blackjack.c
+++ b/apps/plugins/blackjack.c
@@ -20,6 +20,7 @@
20#include "plugin.h" 20#include "plugin.h"
21#include "card_deck.h" 21#include "card_deck.h"
22#include "card_back.h" 22#include "card_back.h"
23#include "mem_function_wrappers.h"
23 24
24PLUGIN_HEADER 25PLUGIN_HEADER
25 26
@@ -213,6 +214,8 @@ extern const fb_data card_back[];
213/* global rockbox api */ 214/* global rockbox api */
214static struct plugin_api* rb; 215static struct plugin_api* rb;
215 216
217MEM_FUNCTION_WRAPPERS(rb);
218
216/* dealer and player card positions */ 219/* dealer and player card positions */
217unsigned int dealer_x, dealer_y, player_x, player_y; 220unsigned int dealer_x, dealer_y, player_x, player_y;
218 221
@@ -1399,7 +1402,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
1399 1402
1400 (void)parameter; 1403 (void)parameter;
1401 rb = api; 1404 rb = api;
1402 1405
1403#if LCD_DEPTH > 1 1406#if LCD_DEPTH > 1
1404 rb->lcd_set_backdrop(NULL); 1407 rb->lcd_set_backdrop(NULL);
1405#endif 1408#endif
diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c
index f1482df990..3dfb0fef6c 100644
--- a/apps/plugins/chessclock.c
+++ b/apps/plugins/chessclock.c
@@ -17,6 +17,7 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "plugin.h" 19#include "plugin.h"
20#include "mem_function_wrappers.h"
20 21
21PLUGIN_HEADER 22PLUGIN_HEADER
22 23
@@ -153,6 +154,7 @@ PLUGIN_HEADER
153 it's nice not to have to pass the api pointer in all function calls 154 it's nice not to have to pass the api pointer in all function calls
154 in the plugin */ 155 in the plugin */
155static struct plugin_api* rb; 156static struct plugin_api* rb;
157MEM_FUNCTION_WRAPPERS(rb);
156#define MAX_PLAYERS 10 158#define MAX_PLAYERS 10
157 159
158static struct { 160static struct {
@@ -192,7 +194,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
192 194
193 (void)parameter; 195 (void)parameter;
194 rb=api; 196 rb=api;
195
196 rb->memset(&settings, 0, sizeof(settings)); 197 rb->memset(&settings, 0, sizeof(settings));
197 198
198 /* now go ahead and have fun! */ 199 /* now go ahead and have fun! */
diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c
index c38a5fd0bb..f76379e5f4 100644
--- a/apps/plugins/chip8.c
+++ b/apps/plugins/chip8.c
@@ -1062,7 +1062,7 @@ static unsigned char beep[]={255,
1062111,181,184,144, 17,148, 21,101,166,227,100, 86, 85, 85, 85}; 1062111,181,184,144, 17,148, 21,101,166,227,100, 86, 85, 85, 85};
1063 1063
1064/* callback to request more mp3 data */ 1064/* callback to request more mp3 data */
1065void callback(unsigned char** start, int* size) 1065void callback(unsigned char** start, size_t* size)
1066{ 1066{
1067 *start = beep; /* give it the same frame again */ 1067 *start = beep; /* give it the same frame again */
1068 *size = sizeof(beep); 1068 *size = sizeof(beep);
diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c
index ff6df6d4e3..cd364f4d51 100644
--- a/apps/plugins/jpeg.c
+++ b/apps/plugins/jpeg.c
@@ -27,6 +27,7 @@
27#include "plugin.h" 27#include "plugin.h"
28#include "playback_control.h" 28#include "playback_control.h"
29#include "oldmenuapi.h" 29#include "oldmenuapi.h"
30#include "mem_function_wrappers.h"
30 31
31#ifdef HAVE_LCD_BITMAP 32#ifdef HAVE_LCD_BITMAP
32#include "gray.h" 33#include "gray.h"
@@ -186,6 +187,7 @@ PLUGIN_HEADER
186/******************************* Globals ***********************************/ 187/******************************* Globals ***********************************/
187 188
188static struct plugin_api* rb; 189static struct plugin_api* rb;
190MEM_FUNCTION_WRAPPERS(rb);
189 191
190/* for portability of below JPEG code */ 192/* for portability of below JPEG code */
191#define MEMSET(p,v,c) rb->memset(p,v,c) 193#define MEMSET(p,v,c) rb->memset(p,v,c)
diff --git a/apps/plugins/lib/mem_function_wrappers.h b/apps/plugins/lib/mem_function_wrappers.h
new file mode 100644
index 0000000000..ec3872c4c1
--- /dev/null
+++ b/apps/plugins/lib/mem_function_wrappers.h
@@ -0,0 +1,44 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Nils Wallménius
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19#ifndef __MEM_FUNCTION_WRAPPERS_H__
20#define __MEM_FUNCTION_WRAPPERS_H__
21
22/* Use this macro in plugins where gcc tries to optimize by calling
23 * these functions directly */
24
25#define MEM_FUNCTION_WRAPPERS(api) \
26 void *memcpy(void *dest, const void *src, size_t n) \
27 { \
28 return (api)->memcpy(dest, src, n); \
29 } \
30 void *memset(void *dest, int c, size_t n) \
31 { \
32 return (api)->memset(dest, c, n); \
33 } \
34 void *memmove(void *dest, const void *src, size_t n) \
35 { \
36 return (api)->memmove(dest, src, n); \
37 } \
38 int memcmp(const void *s1, const void *s2, size_t n) \
39 { \
40 return (api)->memcmp(s1, s2, n); \
41 }
42
43#endif /* __MEM_FUNCTION_WRAPPERS_H__ */
44
diff --git a/apps/plugins/lib/playback_control.c b/apps/plugins/lib/playback_control.c
index 34401e1d4f..177f26a417 100644
--- a/apps/plugins/lib/playback_control.c
+++ b/apps/plugins/lib/playback_control.c
@@ -65,10 +65,12 @@ static bool volume(void)
65 65
66static bool shuffle(void) 66static bool shuffle(void)
67{ 67{
68 struct opt_items names[] = { 68 struct opt_items names[2];
69 { "No", -1 }, 69 names[0].string = "No";
70 { "Yes", -1 } 70 names[0].voice_id = -1;
71 }; 71 names[1].string = "Yes";
72 names[1].voice_id = -1;
73
72 return api->set_option("Shuffle", &api->global_settings->playlist_shuffle, 74 return api->set_option("Shuffle", &api->global_settings->playlist_shuffle,
73 BOOL, names, 2,NULL); 75 BOOL, names, 2,NULL);
74} 76}
diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c
index 607348e91c..ee93d10024 100644
--- a/apps/plugins/mazezam.c
+++ b/apps/plugins/mazezam.c
@@ -20,12 +20,15 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "plugin.h" 21#include "plugin.h"
22#include "configfile.h" 22#include "configfile.h"
23#include "mem_function_wrappers.h"
23 24
24/* Include standard plugin macro */ 25/* Include standard plugin macro */
25PLUGIN_HEADER 26PLUGIN_HEADER
26 27
27static struct plugin_api* rb; 28static struct plugin_api* rb;
28 29
30MEM_FUNCTION_WRAPPERS(rb);
31
29#if CONFIG_KEYPAD == RECORDER_PAD 32#if CONFIG_KEYPAD == RECORDER_PAD
30#define MAZEZAM_UP BUTTON_UP 33#define MAZEZAM_UP BUTTON_UP
31#define MAZEZAM_DOWN BUTTON_DOWN 34#define MAZEZAM_DOWN BUTTON_DOWN
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c
index 19a37a580a..daf3294b75 100644
--- a/apps/plugins/metronome.c
+++ b/apps/plugins/metronome.c
@@ -18,6 +18,7 @@
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "plugin.h" 19#include "plugin.h"
20#include "pluginlib_actions.h" 20#include "pluginlib_actions.h"
21#include "mem_function_wrappers.h"
21 22
22PLUGIN_HEADER 23PLUGIN_HEADER
23 24
@@ -70,6 +71,8 @@ static const struct button_mapping iriver_syncaction[] =
70 71
71static struct plugin_api* rb; 72static struct plugin_api* rb;
72 73
74MEM_FUNCTION_WRAPPERS(rb);
75
73static int bpm = 120; 76static int bpm = 120;
74static int period = 0; 77static int period = 0;
75static int minitick = 0; 78static int minitick = 0;
@@ -159,7 +162,7 @@ static unsigned char sound[] = {
159 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 162 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
160 85, 85, 85}; 163 85, 85, 85};
161 164
162void callback(unsigned char** start, int* size){ 165void callback(unsigned char** start, size_t* size){
163 (void)start; /* unused parameter, avoid warning */ 166 (void)start; /* unused parameter, avoid warning */
164 *size = NULL; /* end of data */ 167 *size = NULL; /* end of data */
165 sound_active = false; 168 sound_active = false;
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c
index 70372933e0..d1ef2e0a7c 100644
--- a/apps/plugins/mp3_encoder.c
+++ b/apps/plugins/mp3_encoder.c
@@ -12,12 +12,15 @@
12 * Library General Public License for more details. */ 12 * Library General Public License for more details. */
13 13
14#include "plugin.h" 14#include "plugin.h"
15#include "mem_function_wrappers.h"
15 16
16PLUGIN_HEADER 17PLUGIN_HEADER
17PLUGIN_IRAM_DECLARE 18PLUGIN_IRAM_DECLARE
18 19
19static struct plugin_api* rb; 20static struct plugin_api* rb;
20 21
22MEM_FUNCTION_WRAPPERS(rb);
23
21#define SAMP_PER_FRAME 1152 24#define SAMP_PER_FRAME 1152
22#define SAMPL2 576 25#define SAMPL2 576
23#define SBLIMIT 32 26#define SBLIMIT 32
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c
index ee7ff86cb7..2e2e057b64 100644
--- a/apps/plugins/properties.c
+++ b/apps/plugins/properties.c
@@ -17,11 +17,14 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "plugin.h" 19#include "plugin.h"
20#include "mem_function_wrappers.h"
20 21
21PLUGIN_HEADER 22PLUGIN_HEADER
22 23
23static struct plugin_api* rb; 24static struct plugin_api* rb;
24 25
26MEM_FUNCTION_WRAPPERS(rb);
27
25bool its_a_dir = false; 28bool its_a_dir = false;
26 29
27char str_filename[MAX_PATH]; 30char str_filename[MAX_PATH];
@@ -247,7 +250,6 @@ char * get_props(int selected_item, void* data, char *buffer)
247enum plugin_status plugin_start(struct plugin_api* api, void* file) 250enum plugin_status plugin_start(struct plugin_api* api, void* file)
248{ 251{
249 rb = api; 252 rb = api;
250
251 struct gui_synclist properties_lists; 253 struct gui_synclist properties_lists;
252 int button; 254 int button;
253 bool prev_show_statusbar; 255 bool prev_show_statusbar;
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c
index da8f8052cb..29296ac1b6 100644
--- a/apps/plugins/rockpaint.c
+++ b/apps/plugins/rockpaint.c
@@ -30,6 +30,7 @@
30#include "errno.h" 30#include "errno.h"
31#include "lib/bmp.h" 31#include "lib/bmp.h"
32#include "lib/rgb_hsv.h" 32#include "lib/rgb_hsv.h"
33#include "mem_function_wrappers.h"
33 34
34PLUGIN_HEADER 35PLUGIN_HEADER
35 36
@@ -224,6 +225,8 @@ int errno;
224 225
225static struct plugin_api* rb; 226static struct plugin_api* rb;
226 227
228MEM_FUNCTION_WRAPPERS(rb);
229
227static int drawcolor=0; /* Current color (in palette) */ 230static int drawcolor=0; /* Current color (in palette) */
228static int bgdrawcolor=9; /* Current background color (in palette) */ 231static int bgdrawcolor=9; /* Current background color (in palette) */
229bool isbg = false; /* gruik ugly hack alert */ 232bool isbg = false; /* gruik ugly hack alert */
diff --git a/apps/plugins/video.c b/apps/plugins/video.c
index f049974023..b56a9d0612 100644
--- a/apps/plugins/video.c
+++ b/apps/plugins/video.c
@@ -423,7 +423,7 @@ void timer4_isr(void)
423 423
424 424
425/* ISR function to get more mp3 data */ 425/* ISR function to get more mp3 data */
426void GetMoreMp3(unsigned char** start, int* size) 426void GetMoreMp3(unsigned char** start, size_t* size)
427{ 427{
428 int available; 428 int available;
429 int advance; 429 int advance;
diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c
index 33ef4d04e9..0d1bdc4f72 100644
--- a/apps/plugins/xobox.c
+++ b/apps/plugins/xobox.c
@@ -19,6 +19,7 @@
19 ****************************************************************************/ 19 ****************************************************************************/
20 20
21#include "plugin.h" 21#include "plugin.h"
22#include "mem_function_wrappers.h"
22 23
23PLUGIN_HEADER 24PLUGIN_HEADER
24 25
@@ -204,6 +205,9 @@ static int difficulty = 75; /* Percentage of screen that needs to be filled
204 * in order to win the game */ 205 * in order to win the game */
205 206
206static struct plugin_api *rb; 207static struct plugin_api *rb;
208
209MEM_FUNCTION_WRAPPERS(rb);
210
207static bool quit = false; 211static bool quit = false;
208 212
209static unsigned int board[BOARD_H][BOARD_W]; 213static unsigned int board[BOARD_H][BOARD_W];
@@ -295,7 +299,6 @@ static inline void emptyStack (void)
295 299
296/*********************** END OF STACK STUFF *********************/ 300/*********************** END OF STACK STUFF *********************/
297 301
298
299/* calculate the new x coordinate of the ball according to angle and speed */ 302/* calculate the new x coordinate of the ball according to angle and speed */
300static inline int get_newx (int x, int len, int deg) 303static inline int get_newx (int x, int len, int deg)
301{ 304{