summaryrefslogtreecommitdiff
path: root/utils/wpseditor/libwps/src/dummies.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/wpseditor/libwps/src/dummies.c')
-rw-r--r--utils/wpseditor/libwps/src/dummies.c363
1 files changed, 363 insertions, 0 deletions
diff --git a/utils/wpseditor/libwps/src/dummies.c b/utils/wpseditor/libwps/src/dummies.c
new file mode 100644
index 0000000000..8592610701
--- /dev/null
+++ b/utils/wpseditor/libwps/src/dummies.c
@@ -0,0 +1,363 @@
1#include <string.h>
2#include <stdio.h>
3#include "dummies.h"
4#include "proxy.h"
5
6struct user_settings global_settings;
7
8struct wps_state wps_state;
9struct gui_wps gui_wps[NB_SCREENS];
10struct wps_data wps_datas[NB_SCREENS];
11struct cuesheet *curr_cue;
12struct cuesheet *temp_cue;
13struct system_status global_status;
14struct gui_syncstatusbar statusbars;
15struct playlist_info current_playlist;
16struct font sysfont;
17int battery_percent = 100;
18struct mp3entry current_song, next_song;
19int _audio_status;
20
21charger_input_state_type charger_input_state;
22#if CONFIG_CHARGING >= CHARGING_MONITOR
23charge_state_type charge_state;
24#endif
25
26#if defined(CPU_PP) && defined(BOOTLOADER)
27/* We don't enable interrupts in the iPod bootloader, so we need to fake
28the current_tick variable */
29#define current_tick (signed)(USEC_TIMER/10000)
30#else
31volatile long current_tick;
32#endif
33
34
35void dummies_init(){
36 sysfont.height = 9;
37 sysfont.maxwidth = 6;
38 global_settings.statusbar=true;
39}
40
41int playlist_amount_ex(const struct playlist_info* playlist);
42void sound_set_volume(int value)
43{
44 DEBUGF3("sound_set_volume(int value=%d)",value);
45 global_settings.volume = value;
46}
47int sound_get_pitch(void)
48{
49 return 0;
50}
51int sound_min(int setting)
52{
53 DEBUGF3("sound_min(int setting=%d)",setting);
54 return -78; //audiohw_settings[setting].minval;
55}
56
57void sleep(int hz)
58{
59}
60
61void audio_init(void){}
62void audio_wait_for_init(void){}
63void audio_play(long offset){}
64void audio_stop(void){}
65void audio_pause(void){}
66void audio_resume(void){}
67void audio_next(void){}
68void audio_prev(void){}
69int audio_status(void)
70{
71 return _audio_status;
72}
73
74#if CONFIG_CODEC == SWCODEC
75int audio_track_count(void){return 0;} /* SWCODEC only */
76long audio_filebufused(void){return 0;} /* SWCODEC only */
77void audio_pre_ff_rewind(void){} /* SWCODEC only */
78#endif /* CONFIG_CODEC == SWCODEC */
79void audio_ff_rewind(long newtime){}
80void audio_flush_and_reload_tracks(void){}
81#ifdef HAVE_ALBUMART
82int audio_current_aa_hid(void){return -1;}
83#endif
84struct mp3entry* audio_current_track(void){return 0;}
85struct mp3entry* audio_next_track(void){return 0;}
86bool audio_has_changed_track(void)
87{
88 return false;
89}
90
91int get_sleep_timer(void){return 0;}
92
93
94int battery_level(void){return battery_percent;} /* percent */
95int battery_time(void){return 0;} /* minutes */
96unsigned int battery_adc_voltage(void){return 0;} /* voltage from ADC in millivolts */
97unsigned int battery_voltage(void){return 0;} /* filtered batt. voltage in millivolts */
98int get_radio_status(void){return 0;}
99
100
101/* returns full path of playlist (minus extension) */
102char *playlist_name(const struct playlist_info* playlist, char *buf,
103int buf_size)
104{
105 char *sep;
106
107 if (!playlist)
108 return "no";
109
110 snprintf(buf, buf_size, "%s", playlist->filename+playlist->dirlen);
111
112 if (!buf[0])
113 return NULL;
114
115 /* Remove extension */
116 sep = strrchr(buf, '.');
117 if(sep)
118 *sep = 0;
119
120 return buf;
121}
122int playlist_get_display_index(void)
123{
124 return 1;
125}
126
127void gui_syncsplash(int ticks, const unsigned char *fmt, ...)
128{
129
130}
131
132void splash(int ticks, const unsigned char *fmt, ...)
133{
134
135}
136
137void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw){
138 DEBUGF3("gui_statusbar_draw");
139}
140
141void yield(void){}
142
143
144/* returns true if cuesheet support is initialised */
145bool cuesheet_is_enabled(void){return false;}
146
147/* allocates the cuesheet buffer */
148void cuesheet_init(void){}
149
150/* looks if there is a cuesheet file that has a name matching "trackpath" */
151bool look_for_cuesheet_file(const char *trackpath, char *found_cue_path){return false;}
152
153/* parse cuesheet "file" and store the information in "cue" */
154bool parse_cuesheet(char *file, struct cuesheet *cue){return false;}
155
156/* reads a cuesheet to find the audio track associated to it */
157bool get_trackname_from_cuesheet(char *filename, char *buf){return false;}
158
159/* display a cuesheet struct */
160void browse_cuesheet(struct cuesheet *cue){}
161
162/* display a cuesheet file after parsing and loading it to the plugin buffer */
163bool display_cuesheet_content(char* filename){return false;}
164
165/* finds the index of the current track played within a cuesheet */
166int cue_find_current_track(struct cuesheet *cue, unsigned long curpos){return 0;}
167
168/* update the id3 info to that of the currently playing track in the cuesheet */
169void cue_spoof_id3(struct cuesheet *cue, struct mp3entry *id3){}
170
171/* skip to next track in the cuesheet towards "direction" (which is 1 or -1) */
172bool curr_cuesheet_skip(int direction, unsigned long curr_pos){return false;}
173
174#ifdef HAVE_LCD_BITMAP
175/* draw track markers on the progressbar */
176void cue_draw_markers(struct screen *screen, unsigned long tracklen,
177int x1, int x2, int y, int h){}
178#endif
179
180
181void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear)
182{
183 if (!gwps || !gwps->data || !gwps->display || handle_id < 0)
184 return;
185
186 struct wps_data *data = gwps->data;
187
188#ifdef HAVE_REMOTE_LCD
189 /* No album art on RWPS */
190 if (data->remote_wps)
191 return;
192#endif
193
194 struct bitmap *bmp;
195 /* if (bufgetdata(handle_id, 0, (void *)&bmp) <= 0)
196 return;*/
197
198 short x = data->albumart_x;
199 short y = data->albumart_y;
200 short width = bmp->width;
201 short height = bmp->height;
202
203 if (data->albumart_max_width > 0)
204 {
205 /* Crop if the bitmap is too wide */
206 width = MIN(bmp->width, data->albumart_max_width);
207
208 /* Align */
209 if (data->albumart_xalign & WPS_ALBUMART_ALIGN_RIGHT)
210 x += data->albumart_max_width - width;
211 else if (data->albumart_xalign & WPS_ALBUMART_ALIGN_CENTER)
212 x += (data->albumart_max_width - width) / 2;
213 }
214
215 if (data->albumart_max_height > 0)
216 {
217 /* Crop if the bitmap is too high */
218 height = MIN(bmp->height, data->albumart_max_height);
219
220 /* Align */
221 if (data->albumart_yalign & WPS_ALBUMART_ALIGN_BOTTOM)
222 y += data->albumart_max_height - height;
223 else if (data->albumart_yalign & WPS_ALBUMART_ALIGN_CENTER)
224 y += (data->albumart_max_height - height) / 2;
225 }
226
227 if (!clear)
228 {
229 /* Draw the bitmap */
230 gwps->display->set_drawmode(DRMODE_FG);
231 gwps->display->bitmap_part((fb_data*)bmp->data, 0, 0, bmp->width,
232 x, y, width, height);
233 gwps->display->set_drawmode(DRMODE_SOLID);
234 }
235 else
236 {
237 /* Clear the bitmap */
238 gwps->display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
239 gwps->display->fillrect(x, y, width, height);
240 gwps->display->set_drawmode(DRMODE_SOLID);
241 }
242}
243
244/* Update the "data" pointer to make the handle's data available to the caller.
245Return the length of the available linear data or < 0 for failure (handle
246not found).
247The caller is blocked until the requested amount of data is available.
248size is the amount of linear data requested. it can be 0 to get as
249much as possible.
250The guard buffer may be used to provide the requested size. This means it's
251unsafe to request more than the size of the guard buffer.
252*/
253size_t bufgetdata(int handle_id, size_t size, void **data)
254{
255
256
257 return size;
258}
259
260
261void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars,
262bool force_redraw)
263{
264#ifdef HAVE_LCD_BITMAP
265 if(!global_settings.statusbar)
266 return;
267#endif /* HAVE_LCD_BITMAP */
268 int i;
269 FOR_NB_SCREENS(i) {
270 gui_statusbar_draw( &(bars->statusbars[i]), force_redraw );
271 }
272}
273void unload_wps_backdrop(void)
274{
275
276}
277
278#if CONFIG_CODEC == SWCODEC
279int get_replaygain_mode(bool have_track_gain, bool have_album_gain)
280{
281 int type;
282
283 bool track = ((global_settings.replaygain_type == REPLAYGAIN_TRACK)
284 || ((global_settings.replaygain_type == REPLAYGAIN_SHUFFLE)
285 && global_settings.playlist_shuffle));
286
287 type = (!track && have_album_gain) ? REPLAYGAIN_ALBUM
288 : have_track_gain ? REPLAYGAIN_TRACK : -1;
289
290 return type;
291}
292#endif
293
294/* Common functions for all targets */
295void rtc_init(void){}
296int rtc_read_datetime(unsigned char* buf){return 0;}
297int rtc_write_datetime(unsigned char* buf){return 0;}
298
299void backlight_on(void){}
300void backlight_off(void){}
301
302
303void debugf(const char *fmt, ...)
304{}
305void panicf( const char *fmt, ...)
306{
307}
308
309off_t filesize(int fd){return 0;}
310
311int playlist_amount(void)
312{
313 return playlist_amount_ex(NULL);
314}
315int playlist_amount_ex(const struct playlist_info* playlist)
316{
317 if (!playlist)
318 playlist = &current_playlist;
319
320 return playlist->amount;
321}
322
323int get_action(int context, int timeout)
324{
325 return 0;
326}
327
328void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width,
329 int height){}
330
331void pcm_calculate_rec_peaks(int *left, int *right)
332{
333}
334void pcm_calculate_peaks(int *left, int *right)
335{
336}
337bool led_read(int delayticks) /* read by status bar update */
338{
339 return false;
340}
341
342#ifndef HAS_BUTTON_HOLD
343bool is_keys_locked(void)
344{
345 return false;
346}
347#endif
348
349long default_event_handler_ex(long event, void (*callback)(void *), void *parameter)
350{
351 return 0;
352}
353
354long default_event_handler(long event)
355{
356 return default_event_handler_ex(event, NULL, NULL);
357}
358
359void ab_draw_markers(struct screen * screen, int capacity,
360 int x0, int x1, int y, int h)
361 {
362 }
363void pcmbuf_beep(unsigned int frequency, size_t duration, int amplitude){}