diff options
Diffstat (limited to 'utils/wpseditor/libwps/src/dummies.c')
-rw-r--r-- | utils/wpseditor/libwps/src/dummies.c | 363 |
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 | |||
6 | struct user_settings global_settings; | ||
7 | |||
8 | struct wps_state wps_state; | ||
9 | struct gui_wps gui_wps[NB_SCREENS]; | ||
10 | struct wps_data wps_datas[NB_SCREENS]; | ||
11 | struct cuesheet *curr_cue; | ||
12 | struct cuesheet *temp_cue; | ||
13 | struct system_status global_status; | ||
14 | struct gui_syncstatusbar statusbars; | ||
15 | struct playlist_info current_playlist; | ||
16 | struct font sysfont; | ||
17 | int battery_percent = 100; | ||
18 | struct mp3entry current_song, next_song; | ||
19 | int _audio_status; | ||
20 | |||
21 | charger_input_state_type charger_input_state; | ||
22 | #if CONFIG_CHARGING >= CHARGING_MONITOR | ||
23 | charge_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 | ||
28 | the current_tick variable */ | ||
29 | #define current_tick (signed)(USEC_TIMER/10000) | ||
30 | #else | ||
31 | volatile long current_tick; | ||
32 | #endif | ||
33 | |||
34 | |||
35 | void dummies_init(){ | ||
36 | sysfont.height = 9; | ||
37 | sysfont.maxwidth = 6; | ||
38 | global_settings.statusbar=true; | ||
39 | } | ||
40 | |||
41 | int playlist_amount_ex(const struct playlist_info* playlist); | ||
42 | void sound_set_volume(int value) | ||
43 | { | ||
44 | DEBUGF3("sound_set_volume(int value=%d)",value); | ||
45 | global_settings.volume = value; | ||
46 | } | ||
47 | int sound_get_pitch(void) | ||
48 | { | ||
49 | return 0; | ||
50 | } | ||
51 | int sound_min(int setting) | ||
52 | { | ||
53 | DEBUGF3("sound_min(int setting=%d)",setting); | ||
54 | return -78; //audiohw_settings[setting].minval; | ||
55 | } | ||
56 | |||
57 | void sleep(int hz) | ||
58 | { | ||
59 | } | ||
60 | |||
61 | void audio_init(void){} | ||
62 | void audio_wait_for_init(void){} | ||
63 | void audio_play(long offset){} | ||
64 | void audio_stop(void){} | ||
65 | void audio_pause(void){} | ||
66 | void audio_resume(void){} | ||
67 | void audio_next(void){} | ||
68 | void audio_prev(void){} | ||
69 | int audio_status(void) | ||
70 | { | ||
71 | return _audio_status; | ||
72 | } | ||
73 | |||
74 | #if CONFIG_CODEC == SWCODEC | ||
75 | int audio_track_count(void){return 0;} /* SWCODEC only */ | ||
76 | long audio_filebufused(void){return 0;} /* SWCODEC only */ | ||
77 | void audio_pre_ff_rewind(void){} /* SWCODEC only */ | ||
78 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
79 | void audio_ff_rewind(long newtime){} | ||
80 | void audio_flush_and_reload_tracks(void){} | ||
81 | #ifdef HAVE_ALBUMART | ||
82 | int audio_current_aa_hid(void){return -1;} | ||
83 | #endif | ||
84 | struct mp3entry* audio_current_track(void){return 0;} | ||
85 | struct mp3entry* audio_next_track(void){return 0;} | ||
86 | bool audio_has_changed_track(void) | ||
87 | { | ||
88 | return false; | ||
89 | } | ||
90 | |||
91 | int get_sleep_timer(void){return 0;} | ||
92 | |||
93 | |||
94 | int battery_level(void){return battery_percent;} /* percent */ | ||
95 | int battery_time(void){return 0;} /* minutes */ | ||
96 | unsigned int battery_adc_voltage(void){return 0;} /* voltage from ADC in millivolts */ | ||
97 | unsigned int battery_voltage(void){return 0;} /* filtered batt. voltage in millivolts */ | ||
98 | int get_radio_status(void){return 0;} | ||
99 | |||
100 | |||
101 | /* returns full path of playlist (minus extension) */ | ||
102 | char *playlist_name(const struct playlist_info* playlist, char *buf, | ||
103 | int 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 | } | ||
122 | int playlist_get_display_index(void) | ||
123 | { | ||
124 | return 1; | ||
125 | } | ||
126 | |||
127 | void gui_syncsplash(int ticks, const unsigned char *fmt, ...) | ||
128 | { | ||
129 | |||
130 | } | ||
131 | |||
132 | void splash(int ticks, const unsigned char *fmt, ...) | ||
133 | { | ||
134 | |||
135 | } | ||
136 | |||
137 | void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw){ | ||
138 | DEBUGF3("gui_statusbar_draw"); | ||
139 | } | ||
140 | |||
141 | void yield(void){} | ||
142 | |||
143 | |||
144 | /* returns true if cuesheet support is initialised */ | ||
145 | bool cuesheet_is_enabled(void){return false;} | ||
146 | |||
147 | /* allocates the cuesheet buffer */ | ||
148 | void cuesheet_init(void){} | ||
149 | |||
150 | /* looks if there is a cuesheet file that has a name matching "trackpath" */ | ||
151 | bool look_for_cuesheet_file(const char *trackpath, char *found_cue_path){return false;} | ||
152 | |||
153 | /* parse cuesheet "file" and store the information in "cue" */ | ||
154 | bool parse_cuesheet(char *file, struct cuesheet *cue){return false;} | ||
155 | |||
156 | /* reads a cuesheet to find the audio track associated to it */ | ||
157 | bool get_trackname_from_cuesheet(char *filename, char *buf){return false;} | ||
158 | |||
159 | /* display a cuesheet struct */ | ||
160 | void browse_cuesheet(struct cuesheet *cue){} | ||
161 | |||
162 | /* display a cuesheet file after parsing and loading it to the plugin buffer */ | ||
163 | bool display_cuesheet_content(char* filename){return false;} | ||
164 | |||
165 | /* finds the index of the current track played within a cuesheet */ | ||
166 | int 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 */ | ||
169 | void 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) */ | ||
172 | bool curr_cuesheet_skip(int direction, unsigned long curr_pos){return false;} | ||
173 | |||
174 | #ifdef HAVE_LCD_BITMAP | ||
175 | /* draw track markers on the progressbar */ | ||
176 | void cue_draw_markers(struct screen *screen, unsigned long tracklen, | ||
177 | int x1, int x2, int y, int h){} | ||
178 | #endif | ||
179 | |||
180 | |||
181 | void 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. | ||
245 | Return the length of the available linear data or < 0 for failure (handle | ||
246 | not found). | ||
247 | The caller is blocked until the requested amount of data is available. | ||
248 | size is the amount of linear data requested. it can be 0 to get as | ||
249 | much as possible. | ||
250 | The guard buffer may be used to provide the requested size. This means it's | ||
251 | unsafe to request more than the size of the guard buffer. | ||
252 | */ | ||
253 | size_t bufgetdata(int handle_id, size_t size, void **data) | ||
254 | { | ||
255 | |||
256 | |||
257 | return size; | ||
258 | } | ||
259 | |||
260 | |||
261 | void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, | ||
262 | bool 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 | } | ||
273 | void unload_wps_backdrop(void) | ||
274 | { | ||
275 | |||
276 | } | ||
277 | |||
278 | #if CONFIG_CODEC == SWCODEC | ||
279 | int 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 */ | ||
295 | void rtc_init(void){} | ||
296 | int rtc_read_datetime(unsigned char* buf){return 0;} | ||
297 | int rtc_write_datetime(unsigned char* buf){return 0;} | ||
298 | |||
299 | void backlight_on(void){} | ||
300 | void backlight_off(void){} | ||
301 | |||
302 | |||
303 | void debugf(const char *fmt, ...) | ||
304 | {} | ||
305 | void panicf( const char *fmt, ...) | ||
306 | { | ||
307 | } | ||
308 | |||
309 | off_t filesize(int fd){return 0;} | ||
310 | |||
311 | int playlist_amount(void) | ||
312 | { | ||
313 | return playlist_amount_ex(NULL); | ||
314 | } | ||
315 | int playlist_amount_ex(const struct playlist_info* playlist) | ||
316 | { | ||
317 | if (!playlist) | ||
318 | playlist = ¤t_playlist; | ||
319 | |||
320 | return playlist->amount; | ||
321 | } | ||
322 | |||
323 | int get_action(int context, int timeout) | ||
324 | { | ||
325 | return 0; | ||
326 | } | ||
327 | |||
328 | void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, | ||
329 | int height){} | ||
330 | |||
331 | void pcm_calculate_rec_peaks(int *left, int *right) | ||
332 | { | ||
333 | } | ||
334 | void pcm_calculate_peaks(int *left, int *right) | ||
335 | { | ||
336 | } | ||
337 | bool led_read(int delayticks) /* read by status bar update */ | ||
338 | { | ||
339 | return false; | ||
340 | } | ||
341 | |||
342 | #ifndef HAS_BUTTON_HOLD | ||
343 | bool is_keys_locked(void) | ||
344 | { | ||
345 | return false; | ||
346 | } | ||
347 | #endif | ||
348 | |||
349 | long default_event_handler_ex(long event, void (*callback)(void *), void *parameter) | ||
350 | { | ||
351 | return 0; | ||
352 | } | ||
353 | |||
354 | long default_event_handler(long event) | ||
355 | { | ||
356 | return default_event_handler_ex(event, NULL, NULL); | ||
357 | } | ||
358 | |||
359 | void ab_draw_markers(struct screen * screen, int capacity, | ||
360 | int x0, int x1, int y, int h) | ||
361 | { | ||
362 | } | ||
363 | void pcmbuf_beep(unsigned int frequency, size_t duration, int amplitude){} | ||