A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

Fix/hack checkwps + add Onda VX747/VX777 targets


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22451 a1c6a512-1295-4272-9138-f99709370657

+221 -41
+1 -1
apps/gui/backdrop.h
··· 27 27 BACKDROP_SKIN_WPS, 28 28 }; 29 29 30 - #if LCD_DEPTH > 1 30 + #if LCD_DEPTH > 1 && !defined(__PCTOOL__) 31 31 32 32 #include "lcd.h" 33 33 #include "bmp.h"
+1
apps/gui/skin_engine/skin_parser.c
··· 32 32 #include "proxy.h" 33 33 #include "sysfont.h" 34 34 #else 35 + #include "action.h" 35 36 #include "checkwps.h" 36 37 #include "audio.h" 37 38 #define DEBUGF printf
+1 -1
apps/gui/statusbar.h
··· 99 99 extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars); 100 100 extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw); 101 101 void gui_statusbar_changed(int enabled); 102 - #ifndef HAVE_REMOTE_LCD 102 + #if !defined(HAVE_REMOTE_LCD) || defined(__PCTOOL__) 103 103 #define statusbar_position(a) (global_settings.statusbar) 104 104 #else 105 105 int statusbar_position(int screen);
+6 -3
tools/checkwps/Makefile
··· 19 19 endif 20 20 endif 21 21 22 - COMMON=$(ROOT)/apps/gui/wps_parser.c \ 23 - $(ROOT)/apps/gui/wps_debug.c \ 22 + COMMON=$(ROOT)/apps/gui/skin_engine/wps_debug.c \ 23 + $(ROOT)/apps/gui/skin_engine/skin_parser.c \ 24 + $(ROOT)/apps/gui/skin_engine/skin_buffer.c \ 24 25 $(ROOT)/apps/misc.c \ 25 - $(ROOT)/apps/recorder/bmp.c 26 + $(ROOT)/apps/recorder/bmp.c \ 27 + $(ROOT)/firmware/common/strlcpy.c 26 28 27 29 INCLUDE=-I $(ROOT)/apps/gui \ 30 + -I $(ROOT)/apps/gui/skin_engine \ 28 31 -I $(ROOT)/firmware/export \ 29 32 -I $(ROOT)/apps \ 30 33 -I $(ROOT)/apps/recorder \
+203 -25
tools/checkwps/checkwps.c
··· 21 21 22 22 #include <stdio.h> 23 23 #include <stdlib.h> 24 - #include <fcntl.h> 25 24 #include "config.h" 26 - #include "gwps.h" 27 25 #include "checkwps.h" 28 26 #include "resize.h" 27 + #include "wps.h" 28 + #include "wps_internals.h" 29 + #include "settings.h" 29 30 30 31 bool debug_wps = true; 31 32 int wps_verbose_level = 0; ··· 96 97 { 97 98 int count = 0; 98 99 int num_read = 0; 99 - 100 + 100 101 errno = 0; 101 102 102 103 while (count < buffer_size) ··· 105 106 106 107 if (1 != read(fd, &c, 1)) 107 108 break; 108 - 109 + 109 110 num_read++; 110 - 111 + 111 112 if ( c == '\n' ) 112 113 break; 113 114 ··· 137 138 return 0; 138 139 } 139 140 140 - int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, 141 - struct rowset *rset, unsigned char *buf, unsigned int len, 142 - const struct custom_format *format, 141 + int resize_on_load(struct bitmap *bm, bool dither, 142 + struct dim *src, struct rowset *tmp_row, 143 + unsigned char *buf, unsigned int len, 144 + const struct custom_format *cformat, 145 + IF_PIX_FMT(int format_index,) 143 146 struct img_part* (*store_part)(void *args), 144 147 void *args) 145 148 { ··· 176 179 *buffer_size = PLUGIN_BUFFER_SIZE; 177 180 return pluginbuf; 178 181 } 182 + 179 183 struct user_settings global_settings = { 180 184 .statusbar = true, 181 185 #ifdef HAVE_LCD_COLOR ··· 183 187 .fg_color = LCD_DEFAULT_FG, 184 188 #endif 185 189 }; 186 - 190 + 187 191 int getwidth(void) { return LCD_WIDTH; } 188 192 int getheight(void) { return LCD_HEIGHT; } 189 193 #ifdef HAVE_REMOTE_LCD ··· 209 213 .get_foreground=dummy_func2, 210 214 .get_background=dummy_func2, 211 215 #endif 216 + .backdrop_load=backdrop_load, 212 217 }, 213 218 #ifdef HAVE_REMOTE_LCD 214 219 { ··· 237 242 } 238 243 #endif 239 244 245 + /* From skin_display.c */ 246 + void skin_data_init(struct wps_data *wps_data) 247 + { 248 + #ifdef HAVE_LCD_BITMAP 249 + wps_data->wps_sb_tag = false; 250 + wps_data->show_sb_on_wps = false; 251 + wps_data->peak_meter_enabled = false; 252 + wps_data->images = NULL; 253 + wps_data->progressbars = NULL; 254 + /* progress bars */ 255 + #else /* HAVE_LCD_CHARCELLS */ 256 + int i; 257 + for (i = 0; i < 8; i++) 258 + { 259 + wps_data->wps_progress_pat[i] = 0; 260 + } 261 + wps_data->full_line_progressbar = false; 262 + #endif 263 + wps_data->button_time_volume = 0; 264 + wps_data->wps_loaded = false; 265 + } 266 + 267 + #ifdef HAVE_LCD_BITMAP 268 + struct gui_img* find_image(char label, struct wps_data *data) 269 + { 270 + struct skin_token_list *list = data->images; 271 + while (list) 272 + { 273 + struct gui_img *img = (struct gui_img *)list->token->value.data; 274 + if (img->label == label) 275 + return img; 276 + list = list->next; 277 + } 278 + return NULL; 279 + } 280 + #endif 281 + 282 + struct skin_viewport* find_viewport(char label, struct wps_data *data) 283 + { 284 + struct skin_token_list *list = data->viewports; 285 + while (list) 286 + { 287 + struct skin_viewport *vp = (struct skin_viewport *)list->token->value.data; 288 + if (vp->label == label) 289 + return vp; 290 + list = list->next; 291 + } 292 + return NULL; 293 + } 294 + 295 + int skin_last_token_index(struct wps_data *data, int line, int subline) 296 + { 297 + int first_subline_idx = data->lines[line].first_subline_idx; 298 + int idx = first_subline_idx + subline; 299 + if (idx < data->num_sublines - 1) 300 + { 301 + /* This subline ends where the next begins */ 302 + return data->sublines[idx+1].first_token_idx - 1; 303 + } 304 + else 305 + { 306 + /* The last subline goes to the end */ 307 + return data->num_tokens - 1; 308 + } 309 + } 310 + 311 + /* From viewport.c & misc.h */ 312 + #define LIST_VALUE_PARSED(setvals, position) ((setvals) & BIT_N(position)) 313 + 314 + /*some short cuts for fg/bg/line selector handling */ 315 + #ifdef HAVE_LCD_COLOR 316 + #define LINE_SEL_FROM_SETTINGS(vp) \ 317 + do { \ 318 + vp->lss_pattern = global_settings.lss_color; \ 319 + vp->lse_pattern = global_settings.lse_color; \ 320 + vp->lst_pattern = global_settings.lst_color; \ 321 + } while (0) 322 + #define FG_FALLBACK global_settings.fg_color 323 + #define BG_FALLBACK global_settings.bg_color 324 + #else 325 + /* mono/greyscale doesn't have most of the above */ 326 + #define LINE_SEL_FROM_SETTINGS(vp) 327 + #define FG_FALLBACK LCD_DEFAULT_FG 328 + #define BG_FALLBACK LCD_DEFAULT_BG 329 + #endif 330 + 331 + #ifdef HAVE_LCD_COLOR 332 + #define ARG_STRING(_depth) ((_depth) == 2 ? "dddddgg":"dddddcc") 333 + #else 334 + #define ARG_STRING(_depth) "dddddgg" 335 + #endif 336 + 337 + extern const char* parse_list(const char *fmt, uint32_t *set_vals, 338 + const char sep, const char* str, ...); 339 + 340 + const char* viewport_parse_viewport(struct viewport *vp, 341 + enum screen_type screen, 342 + const char *bufptr, 343 + const char separator) 344 + { 345 + /* parse the list to the viewport struct */ 346 + const char *ptr = bufptr; 347 + int depth; 348 + uint32_t set = 0; 349 + 350 + enum { 351 + PL_X = 0, 352 + PL_Y, 353 + PL_WIDTH, 354 + PL_HEIGHT, 355 + PL_FONT, 356 + PL_FG, 357 + PL_BG, 358 + }; 359 + 360 + /* Work out the depth of this display */ 361 + depth = screens[screen].depth; 362 + #if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1) 363 + if (depth == 1) 364 + { 365 + if (!(ptr = parse_list("ddddd", &set, separator, ptr, 366 + &vp->x, &vp->y, &vp->width, &vp->height, &vp->font))) 367 + return NULL; 368 + } 369 + else 370 + #endif 371 + #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) 372 + if (depth >= 2) 373 + { 374 + if (!(ptr = parse_list(ARG_STRING(depth), &set, separator, ptr, 375 + &vp->x, &vp->y, &vp->width, &vp->height, &vp->font, 376 + &vp->fg_pattern,&vp->bg_pattern))) 377 + return NULL; 378 + } 379 + else 380 + #endif 381 + {} 382 + #undef ARG_STRING 383 + 384 + /* X and Y *must* be set */ 385 + if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y)) 386 + return NULL; 387 + 388 + /* fix defaults */ 389 + if (!LIST_VALUE_PARSED(set, PL_WIDTH)) 390 + vp->width = screens[screen].lcdwidth - vp->x; 391 + if (!LIST_VALUE_PARSED(set, PL_HEIGHT)) 392 + vp->height = screens[screen].lcdheight - vp->y; 393 + 394 + #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) 395 + if (!LIST_VALUE_PARSED(set, PL_FG)) 396 + vp->fg_pattern = FG_FALLBACK; 397 + if (!LIST_VALUE_PARSED(set, PL_BG)) 398 + vp->bg_pattern = BG_FALLBACK; 399 + #endif /* LCD_DEPTH > 1 || LCD_REMOTE_DEPTH > 1 */ 400 + 401 + LINE_SEL_FROM_SETTINGS(vp); 402 + 403 + /* Validate the viewport dimensions - we know that the numbers are 404 + non-negative integers, ignore bars and assume the viewport takes them 405 + * into account */ 406 + if ((vp->x >= screens[screen].lcdwidth) || 407 + ((vp->x + vp->width) > screens[screen].lcdwidth) || 408 + (vp->y >= screens[screen].lcdheight) || 409 + ((vp->y + vp->height) > screens[screen].lcdheight)) 410 + { 411 + return NULL; 412 + } 413 + 414 + /* Default to using the user font if the font was an invalid number or '-'*/ 415 + if (((vp->font != FONT_SYSFIXED) && (vp->font != FONT_UI)) 416 + || !LIST_VALUE_PARSED(set, PL_FONT) 417 + ) 418 + vp->font = FONT_UI; 419 + 420 + /* Set the defaults for fields not user-specified */ 421 + vp->drawmode = DRMODE_SOLID; 422 + 423 + return ptr; 424 + } 240 425 241 426 int main(int argc, char **argv) 242 427 { 243 428 int res; 244 - int fd; 245 429 int filearg = 1; 246 430 247 431 struct wps_data wps; ··· 270 454 } 271 455 } 272 456 273 - fd = open(argv[filearg], O_RDONLY); 274 - if (fd < 0) { 275 - printf("Failed to open %s\n",argv[1]); 276 - return 2; 277 - } 278 - close(fd); 457 + skin_buffer_init(); 279 458 280 459 /* Go through every wps that was thrown at us, error out at the first 281 460 * flawed wps */ 282 461 while (argv[filearg]) { 283 - printf("Checking %s...\n", argv[filearg]); 284 - res = wps_data_load(&wps, &screens[0], argv[filearg], true); 462 + printf("Checking %s...\n", argv[filearg]); 463 + res = skin_data_load(&wps, &screens[SCREEN_MAIN], argv[filearg], true); 285 464 286 - if (!res) { 287 - printf("WPS parsing failure\n"); 288 - return 3; 289 - } 465 + if (!res) { 466 + printf("WPS parsing failure\n"); 467 + return 3; 468 + } 290 469 291 - printf("WPS parsed OK\n\n"); 292 - filearg++; 470 + printf("WPS parsed OK\n\n"); 471 + filearg++; 293 472 } 294 473 return 0; 295 474 } 296 -
+7 -11
tools/checkwps/checkwps.h
··· 24 24 #include <stdio.h> 25 25 #include <stdlib.h> 26 26 #include <stdbool.h> 27 - #include <fcntl.h> 28 - 29 - /* subset of global_settings needed to build checkwps. */ 30 - struct user_settings { 31 - bool statusbar; 32 - int bg_color; /* background color native format */ 33 - int fg_color; /* foreground color native format */ 34 - }; 35 - 36 - extern struct user_settings global_settings; 37 27 38 28 #define FONT_SYSFIXED 0 39 29 #define FONT_UI 1 40 30 #define SYSFONT_HEIGHT 8 41 31 42 - #define MIN(x,y) ((x) > (y) ? (y) : (x)) 32 + #ifndef MIN 33 + #define MIN(a, b) (((a)<(b))?(a):(b)) 34 + #endif 35 + 36 + #ifndef BIT_N 37 + #define BIT_N(n) (1U << (n)) 38 + #endif 43 39 44 40 #endif
tools/checkwps/system-target.h

This is a binary file and will not be displayed.

+2
tools/checkwps/targets.txt
··· 35 35 SANSA_M200 m200 36 36 SANSA_C100 c100 37 37 ELIO_TPJ1022 tpj1022 38 + ONDA_VX747 ondavx747 39 + ONDA_VX777 ondavx777