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

wpsbuild: Rewrite to fix various issues and support .fms

wpsbuild.pl is enhanced to produce fallback themes that were previously
hardcoded in buildzip.pl. It also recognizes resolution strings as
regular expressions now so you can specify resolution dependant settings
as <setting>.<regex>: <value> (needed to support single themes on multiple
resolutions). The WPSBUILD syntax completely changed as
well and it includes the fallback themes as well. Ultimately wpsbuild is
also able to install .fms files.

Change-Id: Idf5994f17b9750983d7bc3ef583540a8cdae1dde

+488 -557
apps/plugins/bitmaps/viewer_defaults/remote_viewers.6x8x1.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/viewer_defaults/remote_viewers.6x8x2.bmp

This is a binary file and will not be displayed.

apps/plugins/bitmaps/viewer_defaults/viewers.6x8x1.bmp icons/viewers.6x8x1.bmp
apps/plugins/bitmaps/viewer_defaults/viewers.6x8x16.bmp icons/viewers.6x8x16.bmp
apps/plugins/bitmaps/viewer_defaults/viewers.6x8x2.bmp icons/viewers.6x8x2.bmp
+1 -77
tools/buildzip.pl
··· 333 333 return $size; 334 334 } 335 335 336 - sub create_failsafefiles { 337 - my ($dir, $remote_depth) = @_; 338 - my $text = "# Dummy file to allow Rockbox to reset to the default skin config. 339 - # Do not edit this file. It's never actually loaded by Rockbox."; 340 - open (FOO, ">$dir/wps/rockbox_failsafe.wps"); 341 - print FOO $text; 342 - close(FOO); 343 - open (FOO, ">$dir/wps/rockbox_failsafe.sbs"); 344 - print FOO $text; 345 - close(FOO); 346 - open (FOO, ">$dir/wps/rockbox_failsafe.fms"); 347 - print FOO $text; 348 - close(FOO); 349 - if ($remote_depth) { 350 - open (FOO, ">$dir/wps/rockbox_failsafe.rwps"); 351 - print FOO $text; 352 - close(FOO); 353 - open (FOO, ">$dir/wps/rockbox_failsafe.rsbs"); 354 - print FOO $text; 355 - close(FOO); 356 - open (FOO, ">$dir/wps/rockbox_failsafe.rfms"); 357 - print FOO $text; 358 - close(FOO); 359 - } 360 - open (FOO, ">$dir/themes/rockbox_failsafe.cfg"); 361 - print FOO <<STOP 362 - # This config has been autogenerated to reload the failsafe setup 363 - wps: $dir/wps/rockbox_failsafe.wps 364 - sbs: $dir/wps/rockbox_failsafe.sbs 365 - fms: $dir/wps/rockbox_failsafe.fms 366 - STOP 367 - ; 368 - if ($remote_depth) { 369 - print FOO <<STOP 370 - rwps: $dir/wps/rockbox_failsafe.rwps 371 - rsbs: $dir/wps/rockbox_failsafe.rsbs 372 - rfms: $dir/wps/rockbox_failsafe.rfms 373 - STOP 374 - ; 375 - } 376 - print FOO <<STOP 377 - statusbar: top 378 - font: 08-Schumacher-Clean.fnt 379 - foreground color: 000000 380 - background color: B6C6E5 381 - selector type: bar (inverse) 382 - backdrop: - 383 - STOP 384 - ; 385 - close(FOO); 386 - } 387 336 388 337 sub buildzip { 389 338 my ($image, $fonts)=@_; ··· 454 403 } 455 404 456 405 glob_mkdir("$temp_dir/wps"); 406 + glob_mkdir("$temp_dir/icons"); 457 407 glob_mkdir("$temp_dir/themes"); 458 - if ($bitmap) { 459 - open(THEME, ">$temp_dir/themes/rockbox_default_icons.cfg"); 460 - print THEME <<STOP 461 - # this config file was auto-generated to make it 462 - # easy to reset the icons back to default 463 - iconset: - 464 - # taken from apps/gui/icon.c 465 - viewers iconset: /$rbdir/icons/viewers.bmp 466 - remote iconset: - 467 - # taken from apps/gui/icon.c 468 - remote viewers iconset: /$rbdir/icons/remote_viewers.bmp 469 - 470 - STOP 471 - ; 472 - close(THEME); 473 - } 474 - 475 408 glob_mkdir("$temp_dir/codepages"); 476 409 477 410 if($bitmap) { ··· 576 509 577 510 glob_unlink("$temp_dir/rocks/*.lua"); # Clean up unwanted *.lua files (e.g. actions.lua, buttons.lua) 578 511 579 - if ($bitmap) { 580 - glob_mkdir("$temp_dir/icons"); 581 - copy("$viewer_bmpdir/viewers.${icon_w}x${icon_h}x$depth.bmp", "$temp_dir/icons/viewers.bmp"); 582 - if ($remote_depth) { 583 - copy("$viewer_bmpdir/remote_viewers.${remote_icon_w}x${remote_icon_h}x$remote_depth.bmp", "$temp_dir/icons/remote_viewers.bmp"); 584 - } 585 - } 586 - 587 512 copy("$ROOT/apps/tagnavi.config", "$temp_dir/"); 588 513 copy("$ROOT/apps/plugins/disktidy.config", "$temp_dir/rocks/apps/"); 589 514 ··· 606 531 "$temp_dir/rocks/demos/pictureflow_splash.bmp"); 607 532 608 533 } 609 - create_failsafefiles($temp_dir, $remote_depth); 610 534 611 535 if($image) { 612 536 # image is blank when this is a simulator
+138 -101
wps/WPSLIST
··· 11 11 # This should list all WPS and RWPS files we have and what their requirements 12 12 # and preferences are. 13 13 # 14 - # Each <wps> section will also cause a "theme" .cfg to be made, which the 14 + # Each <theme> section will also cause a "theme" .cfg to be made, which the 15 15 # <rwps> sections will not cause. 16 16 # 17 17 # A <wps> section can thus mention a "preferred" rwps file to load when that ··· 19 19 # 20 20 # All sections should list what font and status bar setting they "like". 21 21 22 + <theme> 23 + Name: rockbox_default_icons 24 + Author: Rockbox team 22 25 23 - <rwps> 24 - Name: rockbox_default.rwps 26 + <main> 27 + iconset: - 28 + viewers iconset..+x16: icons/viewers.6x8x16.bmp 29 + viewers iconset..+x1: icons/viewers.6x8x1.bmp 30 + viewers iconset..+x2: icons/viewers.6x8x2.bmp 31 + </main> 32 + 33 + <remote> 34 + iconset: - 35 + viewers iconset..+x1: icons/viewers.6x8x1.bmp 36 + viewers iconset..+x2: icons/viewers.6x8x2.bmp 37 + </remote> 38 + 39 + </theme> 40 + 41 + <theme> 42 + Name: rockbox_failsafe 25 43 Author: Rockbox team 26 - Font: 08-Schumacher-Clean.fnt 27 - Statusbar: top 28 - </rwps> 29 44 30 - <wps> 31 - Name: cabbiev2.wps 32 - RWPS: cabbiev2.rwps 33 - SBS: 34 - RSBS: 45 + WPS: yes 46 + RWPS: yes 47 + SBS: yes 48 + RSBS: yes 49 + FMS: yes 50 + RFMS: yes 51 + 52 + <main> 53 + backdrop: - 54 + font: - 55 + statusbar: top 56 + foreground color: 000000 57 + background color: B6C6E5 58 + selector type: bar (inverse) 59 + ui viewport: - 60 + </main> 61 + 62 + <remote> 63 + font: - 64 + statusbar: top 65 + ui viewport: - 66 + </remote> 67 + </theme> 68 + 69 + <theme> 70 + Name: cabbiev2 35 71 # Real name of the creator of the WPS 36 - Author: Johannes Voggenthaler, Apoo Maha, Marc Guay, Alex Vanderpol, Jerry Lange, Keith Perri, Mark Fawcus, and Marianne Arnold with support from Rockbox developers and forums. Based on Cabbie by Yohann Misquitta. 72 + Authors: Johannes Voggenthaler, Apoo Maha, Marc Guay, Alex Vanderpol, Jerry Lange, Keith Perri, Mark Fawcus, and Marianne Arnold with support from Rockbox developers and forums. Based on Cabbie by Yohann Misquitta. 73 + WPS: yes 74 + RWPS: yes 75 + SBS: no 76 + RSBS: no 77 + 78 + <main> 79 + 80 + # override implicit .wps filename 81 + wps.800x480x16: cabbiev2.800x480x16.wps 82 + wps.480x800x16: cabbiev2.480x800x16.wps 83 + wps.320x480x16: cabbiev2.320x480x16.wps 84 + wps.320x240x16: cabbiev2.320x240x16.wps 85 + wps.128x128x16: cabbiev2.128x128x16.wps 86 + wps.128x160x16: cabbiev2.128x160x16.wps 87 + wps.132x80x16: cabbiev2.132x80x16.wps 88 + wps.138x110x2: cabbiev2.138x110x2.wps 89 + wps.160x128x16: cabbiev2.160x128x16.wps 90 + wps.160x128x2: cabbiev2.160x128x2.wps 91 + wps.176x132x16: cabbiev2.176x132x16.wps 92 + wps.176x220x16: cabbiev2.176x220x16.wps 93 + wps.220x176x16: cabbiev2.220x176x16.wps 94 + wps.240x320x16: cabbiev2.240x320x16.wps 95 + wps.240x400x16: cabbiev2.240x400x16.wps 37 96 38 97 # Preferred font (including .fnt extension - leave blank for player): 39 98 Font.800x480x16: 35-Adobe-Helvetica.fnt ··· 46 105 Font.176x220x16: 12-Adobe-Helvetica.fnt 47 106 Font.176x132x16: 12-Adobe-Helvetica.fnt 48 107 Font.160x128x16: 12-Adobe-Helvetica.fnt 49 - Font.160x128x2: 12-Adobe-Helvetica.fnt 50 - Font.160x128x1: 12-Adobe-Helvetica.fnt 51 - Font.138x110x2: 12-Adobe-Helvetica.fnt 108 + Font.160x128x2: 12-Adobe-Helvetica.fnt 109 + Font.160x128x1: 12-Adobe-Helvetica.fnt 110 + Font.138x110x2: 12-Adobe-Helvetica.fnt 52 111 Font.128x128x16: 12-Adobe-Helvetica.fnt 53 112 Font.128x160x16: 12-Adobe-Helvetica.fnt 54 - Font.128x128x2: 12-Adobe-Helvetica.fnt 55 - Font.132x80x16: 11-Sazanami-Mincho.fnt 56 - Font.128x64x1: 08-Rockfont.fnt 57 - Font.112x64x1: 08-Rockfont.fnt 58 - Font.96x96x16: 08-Rockfont.fnt 59 - 60 - # Remote font for iriver 61 - Remote Font.128x64x1: 08-Rockfont.fnt 113 + Font.128x128x2: 12-Adobe-Helvetica.fnt 114 + Font.132x80x16: 11-Sazanami-Mincho.fnt 115 + Font.128x64x1: 08-Rockfont.fnt 116 + Font.112x64x1: 08-Rockfont.fnt 117 + Font.96x96x16: 08-Rockfont.fnt 62 118 63 119 #misc settings that should be ignored on grayscale targets 64 120 foreground color: CCCCCC ··· 66 122 line selector start color: fde89e 67 123 line selector end color: b58c00 68 124 line selector text color: 000000 69 - filetype colours: 125 + filetype colours: - 70 126 71 127 #backdrop - remember this is the source file name in your SVN folder, not dest name! 72 - backdrop.800x480x16: backdrops/cabbiev2.800x480x16.bmp 73 - backdrop.480x800x16: backdrops/cabbiev2.480x800x16.bmp 74 - backdrop.320x480x16: backdrops/cabbiev2.320x480x16.bmp 75 - backdrop.320x240x16: backdrops/cabbiev2.320x240x16.bmp 76 - backdrop.128x128x16: backdrops/cabbiev2.128x128x16.bmp 77 - backdrop.128x160x16: backdrops/cabbiev2.128x160x16.bmp 78 - backdrop.132x80x16: backdrops/cabbiev2.132x80x16.bmp 79 - backdrop.138x110x2: backdrops/cabbiev2.138x110x2.bmp 80 - backdrop.160x128x16: backdrops/cabbiev2.160x128x16.bmp 81 - backdrop.160x128x2: backdrops/cabbiev2.160x128x2.bmp 82 - backdrop.176x132x16: backdrops/cabbiev2.176x132x16.bmp 83 - backdrop.176x220x16: backdrops/cabbiev2.176x220x16.bmp 84 - backdrop.220x176x16: backdrops/cabbiev2.220x176x16.bmp 85 - backdrop.240x320x16: backdrops/cabbiev2.240x320x16.bmp 86 - backdrop.240x400x16: backdrops/cabbiev2.240x400x16.bmp 87 - backdrop.96x96x16: backdrops/cabbiev2.96x96x16.bmp 128 + backdrop.800x480x16: backdrops/cabbiev2.800x480x16.bmp 129 + backdrop.480x800x16: backdrops/cabbiev2.480x800x16.bmp 130 + backdrop.320x480x16: backdrops/cabbiev2.320x480x16.bmp 131 + backdrop.320x240x16: backdrops/cabbiev2.320x240x16.bmp 132 + backdrop.128x128x16: backdrops/cabbiev2.128x128x16.bmp 133 + backdrop.128x160x16: backdrops/cabbiev2.128x160x16.bmp 134 + backdrop.132x80x16: backdrops/cabbiev2.132x80x16.bmp 135 + backdrop.138x110x2: backdrops/cabbiev2.138x110x2.bmp 136 + backdrop.160x128x16: backdrops/cabbiev2.160x128x16.bmp 137 + backdrop.160x128x2: backdrops/cabbiev2.160x128x2.bmp 138 + backdrop.176x132x16: backdrops/cabbiev2.176x132x16.bmp 139 + backdrop.176x220x16: backdrops/cabbiev2.176x220x16.bmp 140 + backdrop.220x176x16: backdrops/cabbiev2.220x176x16.bmp 141 + backdrop.240x320x16: backdrops/cabbiev2.240x320x16.bmp 142 + backdrop.240x400x16: backdrops/cabbiev2.240x400x16.bmp 143 + backdrop.96x96x16: backdrops/cabbiev2.96x96x16.bmp 88 144 89 145 #selection bar settings for color targets 90 - selector type.800x480x16: bar (gradient) 91 - selector type.480x800x16: bar (gradient) 92 - selector type.320x480x16: bar (gradient) 93 - selector type.320x240x16: bar (gradient) 94 - selector type.128x128x16: bar (gradient) 95 - selector type.128x160x16: bar (gradient) 96 - selector type.132x80x16: bar (gradient) 97 - selector type.220x176x16: bar (gradient) 98 - selector type.160x128x16: bar (gradient) 99 - selector type.240x400x16: bar (gradient) 100 - selector type.240x320x16: bar (gradient) 101 - selector type.176x132x16: bar (gradient) 102 - selector type.176x220x16: bar (gradient) 103 - selector type.160x128x2: bar (inverse) 104 - selector type.138x110x2: bar (inverse) 105 - selector type.96x96x16: bar (gradient) 146 + selector type..+x16: bar (gradient) 147 + selector type..+x2: bar (inverse) 106 148 107 149 #icons 108 - iconset.800x480x16: icons/tango_icons.32x32.bmp 109 - iconset.480x800x16: icons/tango_icons.32x32.bmp 110 - iconset.320x480x16: icons/tango_icons.24x24.bmp 111 - iconset.320x240x16: icons/tango_icons.16x16.bmp 112 - iconset.128x128x16: icons/tango_icons.12x12.bmp 113 - iconset.128x160x16: icons/tango_icons.12x12.bmp 114 - iconset.132x80x16: icons/tango_icons.12x12.bmp 115 - iconset.138x110x2: icons/tango_small_mono.bmp 116 - iconset.160x128x16: icons/tango_icons.12x12.bmp 117 - iconset.160x128x2: icons/tango_small_mono.bmp 118 - iconset.176x132x16: icons/tango_icons.12x12.bmp 119 - iconset.176x220x16: icons/tango_icons.12x12.bmp 120 - iconset.220x176x16: icons/tango_icons.12x12.bmp 121 - iconset.240x320x16: icons/tango_icons.16x16.bmp 122 - iconset.240x400x16: icons/tango_icons.16x16.bmp 123 - iconset.96x96x16: icons/tango_icons.8x8.bmp 150 + iconset.800x480x16: icons/tango_icons.32x32.bmp 151 + iconset.480x800x16: icons/tango_icons.32x32.bmp 152 + iconset.320x480x16: icons/tango_icons.24x24.bmp 153 + iconset.320x240x16: icons/tango_icons.16x16.bmp 154 + iconset.128x128x16: icons/tango_icons.12x12.bmp 155 + iconset.128x160x16: icons/tango_icons.12x12.bmp 156 + iconset.132x80x16: icons/tango_icons.12x12.bmp 157 + iconset.160x128x16: icons/tango_icons.12x12.bmp 158 + iconset.176x132x16: icons/tango_icons.12x12.bmp 159 + iconset.176x220x16: icons/tango_icons.12x12.bmp 160 + iconset.220x176x16: icons/tango_icons.12x12.bmp 161 + iconset.240x320x16: icons/tango_icons.16x16.bmp 162 + iconset.240x400x16: icons/tango_icons.16x16.bmp 163 + iconset.96x96x16: icons/tango_icons.8x8.bmp 164 + iconset..+x2: icons/tango_small_mono.bmp 124 165 125 166 #viewer icons 126 - viewers iconset.800x480x16: icons/tango_icons_viewers.32x32.bmp 127 - viewers iconset.480x800x16: icons/tango_icons_viewers.32x32.bmp 128 - viewers iconset.320x480x16: icons/tango_icons_viewers.24x24.bmp 129 - viewers iconset.320x240x16: icons/tango_icons_viewers.16x16.bmp 130 - viewers iconset.128x128x16: icons/tango_icons_viewers.12x12.bmp 131 - viewers iconset.128x160x16: icons/tango_icons_viewers.12x12.bmp 132 - viewers iconset.132x80x16: icons/tango_icons_viewers.12x12.bmp 133 - viewers iconset.138x110x2: icons/tango_small_viewers_mono.bmp 134 - viewers iconset.160x128x16: icons/tango_icons_viewers.12x12.bmp 135 - viewers iconset.160x128x2: icons/tango_small_viewers_mono.bmp 136 - viewers iconset.176x132x16: icons/tango_icons_viewers.12x12.bmp 137 - viewers iconset.176x220x16: icons/tango_icons_viewers.12x12.bmp 138 - viewers iconset.220x176x16: icons/tango_icons_viewers.12x12.bmp 139 - viewers iconset.240x320x16: icons/tango_icons_viewers.16x16.bmp 140 - viewers iconset.240x400x16: icons/tango_icons_viewers.16x16.bmp 141 - viewers iconset.96x96x16: icons/tango_icons_viewers.8x8.bmp 167 + viewers iconset.800x480x16: icons/tango_icons_viewers.32x32.bmp 168 + viewers iconset.480x800x16: icons/tango_icons_viewers.32x32.bmp 169 + viewers iconset.320x480x16: icons/tango_icons_viewers.24x24.bmp 170 + viewers iconset.320x240x16: icons/tango_icons_viewers.16x16.bmp 171 + viewers iconset.128x128x16: icons/tango_icons_viewers.12x12.bmp 172 + viewers iconset.128x160x16: icons/tango_icons_viewers.12x12.bmp 173 + viewers iconset.132x80x16: icons/tango_icons_viewers.12x12.bmp 174 + viewers iconset.160x128x16: icons/tango_icons_viewers.12x12.bmp 175 + viewers iconset.176x132x16: icons/tango_icons_viewers.12x12.bmp 176 + viewers iconset.176x220x16: icons/tango_icons_viewers.12x12.bmp 177 + viewers iconset.220x176x16: icons/tango_icons_viewers.12x12.bmp 178 + viewers iconset.240x320x16: icons/tango_icons_viewers.16x16.bmp 179 + viewers iconset.240x400x16: icons/tango_icons_viewers.16x16.bmp 180 + viewers iconset.96x96x16: icons/tango_icons_viewers.8x8.bmp 181 + viewers iconset..+x2: icons/tango_small_viewers_mono.bmp 142 182 143 - # Whether the WPS is designed to have the statusbar on or off 144 - Statusbar: top 145 - remote statusbar: top 183 + statusbar: top 184 + ui viewport: - 185 + </main> 146 186 147 - # list & remote ui viewports 148 - ui viewport: 149 - remote ui viewport: 150 - </wps> 187 + <remote> 188 + rwps.128x64x1: cabbiev2.128x64x1.wps 189 + Font.128x64x1: 08-Rockfont.fnt 190 + statusbar: top 191 + ui viewport: - 192 + </remote> 151 193 152 - <rwps> 153 - Name: cabbiev2.rwps 154 - Author: Johannes Voggenthaler, Apoo Maha, Marc Guay, Alex Vanderpol, Jerry Lange, Keith Perri, Mark Fawcus, and Marianne Arnold with support from Rockbox developers and forums. Based on Cabbie by Yohann Misquitta. 155 - Font: 12-Adobe-Helvetica.fnt 156 - Statusbar: top 157 - </rwps> 194 + </theme>
-2
wps/rockbox_default.txt.wps
··· 1 - # Dummy file to allow Rockbox to reset to the default WPS config. 2 - # Do not edit this file. It's never actually loaded by Rockbox.
+2
wps/rockbox_failsafe.fms
··· 1 + # Dummy file to allow Rockbox to reset to the default skin config. 2 + # Do not edit this file. It's never actually loaded by Rockbox.
+2
wps/rockbox_failsafe.sbs
··· 1 + # Dummy file to allow Rockbox to reset to the default skin config. 2 + # Do not edit this file. It's never actually loaded by Rockbox.
+2
wps/rockbox_failsafe.wps
··· 1 + # Dummy file to allow Rockbox to reset to the default skin config. 2 + # Do not edit this file. It's never actually loaded by Rockbox.
+343 -377
wps/wpsbuild.pl
··· 12 12 use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DTYPE_STUFF 13 13 14 14 my $ROOT=".."; 15 + my $wpsdir; 15 16 my $verbose; 16 17 my $rbdir=".rockbox"; 17 18 my $tempdir=".rockbox"; ··· 31 32 32 33 my $firmdir="$ROOT/firmware"; 33 34 my $cppdef = $target; 34 - my @depthlist = ( 16, 8, 4, 2, 1 ); 35 35 36 36 # These parameters are filled in as we parse wpslist 37 - my $req_size; 38 - my $req_g_wps; 39 37 my $req_t; 40 - my $req_t_wps; 38 + my $theme; 39 + my $has_wps; 41 40 my $wps; 42 - my $wps_prefix; 43 - my $sbs_prefix; 41 + my $has_rwps; 44 42 my $rwps; 43 + my $has_sbs; 45 44 my $sbs; 46 - my $sbs_w_size; 45 + my $has_rsbs; 47 46 my $rsbs; 48 - my $rsbs_w_size; 47 + my $has_fms; 48 + my $fms; 49 + my $has_rfms; 50 + my $rfms; 49 51 my $width; 50 52 my $height; 51 53 my $font; ··· 53 55 my $fgcolor; 54 56 my $bgcolor; 55 57 my $statusbar; 58 + my $remotestatusbar; 56 59 my $author; 57 60 my $backdrop; 58 61 my $lineselectstart; 59 62 my $lineselectend; 60 63 my $selecttype; 61 64 my $iconset; 65 + my $remoteiconset; 62 66 my $viewericon; 67 + my $remoteviewericon; 63 68 my $lineselecttextcolor; 64 69 my $filetylecolor; 65 70 my $listviewport; ··· 135 140 136 141 sub mkdirs 137 142 { 138 - my $wpsdir = $wps; 139 - $wpsdir =~ s/\.(r|)wps//; 140 143 mkdir "$tempdir/wps", 0777; 141 144 mkdir "$tempdir/themes", 0777; 145 + mkdir "$tempdir/icons", 0777; 142 146 143 - if( -d "$tempdir/wps/$wpsdir") { 144 - #print STDERR "wpsbuild warning: directory wps/$wpsdir already exists!\n"; 147 + if( -d "$tempdir/wps/$theme") { 148 + #print STDERR "wpsbuild warning: directory wps/$theme already exists!\n"; 145 149 } 146 150 else 147 151 { 148 - mkdir "$tempdir/wps/$wpsdir", 0777; 152 + mkdir "$tempdir/wps/$theme", 0777; 149 153 } 150 154 } 151 155 156 + sub normalize 157 + { 158 + my $in = $_[0]; 159 + # strip resolution 160 + $in =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//; 161 + return $in; 162 + } 163 + 152 164 sub copybackdrop 153 165 { 154 166 #copy the backdrop file into the build dir 155 167 if ($backdrop ne '') { 156 - my $dst = $backdrop; 157 - $dst =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//; 158 - my $cmd = "cp $ROOT/$backdrop $tempdir/$dst"; 159 - `$cmd`; 168 + my $dst = normalize($backdrop); 169 + system("cp $ROOT/$backdrop $tempdir/$dst"); 160 170 } 161 171 } 162 172 ··· 167 177 168 178 $o =~ s/\.fnt/\.bdf/; 169 179 mkdir "$tempdir/fonts"; 170 - my $cmd ="$ROOT/tools/convbdf -f -o \"$tempdir/fonts/$_[0]\" \"$ROOT/fonts/$o\" "; 171 - `$cmd`; 180 + system("$ROOT/tools/convbdf -f -o \"$tempdir/fonts/$_[0]\" \"$ROOT/fonts/$o\" "); 172 181 } 173 182 174 183 sub copythemeicon 175 184 { 185 + my $i = $_[0]; 176 186 #copy the icon specified by the theme 177 - if ($iconset ne '') { 178 - my $tempicon = $tempdir . "/" . $iconset; 179 - $iconset = $rbdir . "/" . $iconset; 187 + if ($i ne "-") { 188 + my $tempicon = $tempdir . "/" . $i; 180 189 $tempicon =~ /\/.*icons\/(.*)/i; 181 - `cp $ROOT/icons/$1 $tempicon`; 190 + system("cp $ROOT/icons/$1 $tempicon"); 182 191 } 183 192 } 184 193 185 - sub copythemeviewericon 186 - { 187 - #copy the viewer icon specified by the theme 188 - 189 - if ($viewericon ne '') { 190 - my $tempviewericon = $tempdir . "/" . $viewericon; 191 - $viewericon = $rbdir . "/" . $viewericon; 192 - $tempviewericon =~ /\/.*icons\/(.*)/i; 193 - `cp $ROOT/icons/$1 $tempviewericon`; 194 + sub uniq { 195 + my %seen = (); 196 + my @r = (); 197 + foreach my $a (@_) { 198 + unless ($seen{$a}) { 199 + push @r, $a; 200 + $seen{$a} = 1; 201 + } 194 202 } 203 + return @r; 195 204 } 196 205 197 206 sub copywps ··· 199 208 # we assume that we copy the WPS files from the same dir the WPSLIST 200 209 # file is located in 201 210 my $dir; 211 + my %skinfiles = ("wps", $wps, 212 + "sbs", $sbs, 213 + "fms", $fms, 214 + "rwps", $rwps, 215 + "rsbs", $rsbs, 216 + "rfms", $rfms); 202 217 my @filelist; 203 218 my $file; 204 - my $__sb; 205 219 206 - if($wpslist =~ /(.*)WPSLIST/) { 220 + if($wpslist =~ /(.*)\/WPSLIST/) { 207 221 $dir = $1; 208 - $__sb = $sbs_prefix . "." . $req_size . ".sbs"; 209 - #print "$req_t_wps $req_g_wps $sbs_prefix\n"; 210 - #print "$dir/$__sb\n"; 211 222 212 - # system("cp $dir/$wps .rockbox/wps/"); 213 - # check for <name>.WIDTHxHEIGHTxDEPTH.sbs 214 - if (-e "$dir/$__sb") { 215 - system("cp $dir/$__sb $tempdir/wps/$sbs"); 216 - } 217 - # check for <name>.WIDTHxHEIGHTxDEPTH.<model>.sbs and overwrite the 218 - # previous sb if needed 219 - $__sb = $sbs_prefix . "." . $req_size . "." . $modelname . ".sbs"; 220 - if (-e "$dir/$__sb") { 221 - system("cp $dir/$__sb $tempdir/wps/$sbs"); 223 + # copy fully-fledged wps, sbs, etc. including graphics 224 + foreach my $ext (keys %skinfiles) { 225 + next unless ($skinfiles{$ext}); 226 + $file = $skinfiles{$ext}; 227 + system("cp $dir/$file $tempdir/wps/$theme.$ext"); 228 + open(SKIN, "$dir/$file"); 229 + while (<SKIN>) { 230 + $filelist[$#filelist + 1] = $1 if (/[\(,]([^,]*?.bmp)[\),]/); 231 + } 232 + close(SKIN); 222 233 } 223 - 224 - if (-e "$dir/$req_t_wps" ) { 225 - system("cp $dir/$req_t_wps $tempdir/wps/$wps"); 226 234 227 - } elsif (-e "$dir/$req_g_wps") { 228 - system("cp $dir/$req_g_wps $tempdir/wps/$wps"); 229 - 230 - open(WPSFILE, "$dir/$req_g_wps"); 231 - while (<WPSFILE>) { 232 - $filelist[$#filelist + 1] = $1 if (/[\(,]([^,]*?.bmp)[\),]/); 233 - } 234 - close(WPSFILE); 235 - 236 - if ($#filelist >= 0) { 237 - if (-e "$dir/$wps_prefix/$req_size") { 238 - foreach $file (@filelist) { 239 - system("cp $dir/$wps_prefix/$req_size/$file $tempdir/wps/$wps_prefix/"); 240 - } 241 - } 242 - elsif (-e "$dir/$wps_prefix") { 243 - foreach $file (@filelist) { 244 - system("cp $dir/$wps_prefix/$file $tempdir/wps/$wps_prefix/"); 245 - } 246 - } 247 - else { 248 - print STDERR "beep, no dir to copy WPS from!\n"; 249 - } 250 - } 251 - 252 - } else { 253 - print STDERR "Skipping $wps - no matching resolution.\n"; 254 - } 235 + if ($#filelist >= 0) { 236 + if (-e "$dir/$theme") { 237 + foreach $file (uniq(@filelist)) { 238 + system("cp $dir/$theme/$file $tempdir/wps/$theme/"); 239 + } 240 + } 241 + else { 242 + print STDERR "beep, no dir to copy WPS from!\n"; 243 + } 244 + } 255 245 } else { 256 246 print STDERR "No source directory!\n"; 257 247 } 258 248 } 259 249 260 250 sub buildcfg { 261 - my $cfg = $wps; 262 - my @out; 263 - 264 - $cfg =~ s/\.(r|)wps/.cfg/; 251 + my $cfg = $theme . ".cfg"; 252 + my @out; 265 253 266 254 push @out, <<MOO 267 255 \# 268 256 \# $cfg generated by wpsbuild.pl 269 257 \# $wps is made by $author 270 258 \# 271 - wps: $rbdir/wps/$wps 272 259 MOO 273 260 ; 274 - if(defined($sbs)) { 275 - if ($sbs eq '') { 276 - push @out, "sbs: -\n"; 277 - } else { 278 - push @out, "sbs: $rbdir/wps/$sbs\n"; 279 - } 280 - } 281 - if(defined($rsbs) && $has_remote) { 282 - if ($rsbs eq '') { 283 - push @out, "rsbs: -\n"; 284 - } else { 285 - push @out, "rsbs: $rbdir/wps/$rsbs\n"; 286 - } 287 - } 288 - if($font) { 289 - if ($font eq '') { 290 - push @out, "font: -\n"; 291 - } else { 292 - push @out, "font: $rbdir/fonts/$font\n"; 293 - } 294 - } 295 - if(defined($remotefont) && $has_remote) { 296 - if ($remotefont eq '') { 297 - push @out, "remote font: -\n"; 298 - } else { 299 - push @out, "remote font: $rbdir/fonts/$remotefont\n"; 300 - } 301 - } 302 - if($fgcolor && $main_depth > 2) { 303 - push @out, "foreground color: $fgcolor\n"; 304 - } 305 - if($bgcolor && $main_depth > 2) { 306 - push @out, "background color: $bgcolor\n"; 307 - } 308 - if($statusbar) { 309 - if($rwps && $has_remote ) { 310 - push @out, "remote statusbar: $statusbar\n"; 311 - } 312 - push @out, "statusbar: $statusbar\n"; 313 - } 314 - if(defined($backdrop)) { 315 - if ($backdrop eq '') { 316 - push @out, "backdrop: -\n"; 317 - } else { 318 - # clip resolution from filename 319 - $backdrop =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//; 320 - push @out, "backdrop: $rbdir/$backdrop\n"; 321 - } 322 - } 323 - if($lineselectstart && $main_depth > 2) { 324 - push @out, "line selector start color: $lineselectstart\n"; 325 - } 326 - if($lineselectend && $main_depth > 2) { 327 - push @out, "line selector end color: $lineselectend\n"; 328 - } 329 - if($selecttype) { 330 - push @out, "selector type: $selecttype\n"; 331 - } 332 - if(defined($iconset)) { 333 - if ($iconset eq '') { 334 - push @out, "iconset: -\n"; 335 - } else { 336 - push @out, "iconset: $iconset\n"; 337 - } 338 - } 339 - if(defined($viewericon)) { 340 - if ($viewericon eq '') { 341 - push @out, "viewers iconset: -\n"; 342 - } else { 343 - push @out, "viewers iconset: $viewericon\n"; 344 - } 345 - } 346 - if($lineselecttextcolor && $main_depth > 2 ) { 347 - push @out, "line selector text color: $lineselecttextcolor\n"; 348 - } 349 - if($filetylecolor && $main_depth > 2) { 350 - if ($filetylecolor eq '') { 351 - push @out, "filetype colours: -\n"; 261 + 262 + my %skinfiles = ("wps" => $wps, 263 + "sbs" => $sbs, 264 + "fms" => $fms, 265 + "rwps" => $rwps, 266 + "rsbs" => $rsbs, 267 + "rfms" => $rfms); 268 + for my $skin (keys %skinfiles) { 269 + my $val = $skinfiles{$skin}; 270 + print "$skin: $val\n"; 271 + if (!defined($val)) { 272 + # dont put value if not defined (e.g. rwps when there's no remote) 273 + next; 274 + } elsif ($val eq '') { 275 + # empty resets to built-in 276 + push @out, "$skin: -\n"; 352 277 } else { 353 - push @out, "filetype colours: $filetylecolor\n"; 278 + # file name is always <theme>.{wps,rwps,...} (see copywps()) 279 + push @out, "$skin: $rbdir/wps/$theme.$skin\n"; 354 280 } 355 281 } 356 - if($rwps && $has_remote ) { 357 - if ($rwps eq '') { 358 - push @out, "rwps: -\n"; 359 - } else { 360 - push @out, "rwps: $rbdir/wps/$rwps\n"; 361 - } 362 - } 363 - if(defined($listviewport)) { 364 - if ($listviewport eq '') { 365 - push @out, "ui viewport: -\n"; 366 - } else { 367 - push @out, "ui viewport: $listviewport\n"; 368 - } 282 + 283 + push @out, "selector type: $selecttype\n" if (defined($selecttype)); 284 + push @out, "backdrop: $backdrop\n" if (defined($backdrop)); 285 + push @out, "filetype colours: $filetylecolor\n" if (defined($filetylecolor)); 286 + 287 + if ($main_depth > 2) { 288 + push @out, "foreground color: $fgcolor\n" if($fgcolor); 289 + push @out, "background color: $bgcolor\n" if($bgcolor); 290 + push @out, "line selector start color: $lineselectstart\n" if($lineselectstart); 291 + push @out, "line selector end color: $lineselectend\n" if($lineselectend);; 292 + push @out, "line selector text color: $lineselecttextcolor\n" if($lineselecttextcolor); 369 293 } 370 - if(defined($remotelistviewport) && $has_remote) { 371 - if ($remotelistviewport eq '') { 372 - push @out, "remote ui viewport: -\n"; 373 - } else { 374 - push @out, "remote ui viewport: $listviewport\n"; 375 - } 294 + 295 + push @out, "font: $font\n" if (defined($font)); 296 + push @out, "statusbar: $statusbar\n" if (defined($statusbar)); 297 + push @out, "iconset: $iconset\n" if (defined($iconset)); 298 + push @out, "viewers iconset: $viewericon\n" if (defined($viewericon)); 299 + push @out, "ui viewport: $listviewport\n" if (defined($listviewport)); 300 + 301 + if ($has_remote) { 302 + push @out, "remote font: $remotefont\n" if (defined($remotefont)); 303 + push @out, "remote statusbar: $remotestatusbar\n" if (defined($remotestatusbar)); 304 + push @out, "remote iconset: $remoteiconset\n" if (defined($remoteiconset)); 305 + push @out, "remote viewers iconset: $remoteviewericon\n" if (defined($remoteviewericon)); 306 + push @out, "remote ui viewport: $remotelistviewport\n" if (defined($remotelistviewport)); 376 307 } 308 + 377 309 if(-f "$tempdir/wps/$cfg") { 378 310 print STDERR "wpsbuild warning: wps/$cfg already exists!\n"; 379 311 } ··· 391 323 #print "LCD: ${main_width}x${main_height}x${main_depth}\n"; 392 324 $has_remote = 1 if ($remote_height && $remote_width && $remote_depth); 393 325 394 - my $isrwps; 395 - my $within; 326 + 327 + # check if line matches the setting string or if it contains a regex 328 + # that contains the targets resolution 329 + sub check_res { 330 + my ($line, $string, $remote) = @_; 331 + if ($line =~ /^${string}: *(.*)/i) { 332 + return $1; 333 + } 334 + elsif($line =~ /^${string}.(.*): *(.*)/i) { 335 + # $1 is a resolution regex, $2 the filename incl. resolution 336 + my $fn = $2; 337 + my $size_str = "${main_width}x${main_height}x${main_depth}"; 338 + if ($remote) { 339 + $size_str = "${remote_width}x${remote_height}x${remote_depth}"; 340 + } 341 + if ($size_str =~ /$1$/) { 342 + return $fn; 343 + } 344 + } 345 + return ""; 346 + } 347 + 348 + # check if <theme>.<model>.<ext> exists. If not, check if <theme>.<ext> exists 349 + sub check_skinfile { 350 + my $ext = $_[0]; 351 + my $req_skin = $theme . "." . $modelname . ".$ext"; 352 + if (-e "$wpsdir/$req_skin") { 353 + return $req_skin; 354 + } else { 355 + $req_skin = $theme . ".$ext"; 356 + if (-e "$wpsdir/$req_skin") { 357 + return $req_skin; 358 + } 359 + } 360 + return ''; 361 + } 362 + 363 + 364 + # Infer WPS (etc.) filename from the the if it wasnt given 365 + $wpslist =~ /(.*)WPSLIST/; 366 + $wpsdir = $1; 396 367 397 368 open(WPS, "<$wpslist"); 398 369 while(<WPS>) { ··· 410 381 $rbdir = "/" . $rbdir; 411 382 } 412 383 413 - if($l =~ /^ *<(r|)wps>/i) { 414 - $isrwps = $1; 415 - $within = 1; 384 + if($l =~ /^ *<theme>/i) { 416 385 # undef is a unary operator (!) 386 + undef $theme; 387 + undef $has_wps; 388 + undef $has_rwps; 389 + undef $has_sbs; 390 + undef $has_rsbs; 391 + undef $has_fms; 392 + undef $has_rfms; 417 393 undef $wps; 418 - undef $wps_prefix; 419 394 undef $rwps; 420 395 undef $sbs; 421 396 undef $rsbs; 397 + undef $fms; 398 + undef $rfms; 422 399 undef $width; 423 400 undef $height; 424 401 undef $font; ··· 426 403 undef $fgcolor; 427 404 undef $bgcolor; 428 405 undef $statusbar; 406 + undef $remotestatusbar; 429 407 undef $author; 430 - undef $req_g_wps; 431 - undef $req_t_wps; 432 408 undef $backdrop; 433 409 undef $lineselectstart; 434 410 undef $lineselectend; 435 411 undef $selecttype; 436 412 undef $iconset; 413 + undef $remoteiconset; 437 414 undef $viewericon; 415 + undef $remoteviewericon; 438 416 undef $lineselecttextcolor; 439 417 undef $filetylecolor; 440 418 undef $listviewport; 441 419 undef $remotelistviewport; 442 - 443 - next; 444 420 } 445 - if($within) { 446 - if($l =~ /^ *<\/${isrwps}wps>/i) { 447 - # Get the required width and height 448 - my ($rheight, $rwidth, $rdepth); 449 - if($isrwps) { 450 - ($rheight, $rwidth, $rdepth) = 451 - ($remote_height, $remote_width, $remote_depth); 421 + elsif($l =~ /^Name: *(.*)/i) { 422 + $theme = $1; 423 + } 424 + elsif($l =~ /^Authors: *(.*)/i) { 425 + $author = $1; 426 + } 427 + elsif ($l =~ /^WPS: *(yes|no)/i) { 428 + $has_wps = $1; 429 + } 430 + elsif ($l =~ /^RWPS: *(yes|no)/i) { 431 + $has_rwps = $1; 432 + } 433 + elsif ($l =~ /^SBS: *(yes|no)/i) { 434 + $has_sbs = $1; 435 + } 436 + elsif ($l =~ /^RSBS: *(yes|no)/i) { 437 + $has_rsbs = $1; 438 + } 439 + elsif ($l =~ /^FMS: *(yes|no)/i) { 440 + $has_fms = $1; 441 + } 442 + elsif ($l =~ /^RFMS: *(yes|no)/i) { 443 + $has_rfms = $1; 444 + } 445 + elsif($l =~ /^ *<main>/i) { 446 + # parse main unit settings 447 + while(<WPS>) { 448 + my $l = $_; 449 + if ($l =~ /^ *<\/main>/i) { 450 + last; 452 451 } 453 - else { 454 - ($rheight, $rwidth, $rdepth) = 455 - ($main_height, $main_width, $main_depth); 452 + elsif($_ = check_res($l, "wps")) { 453 + $wps = $_; 456 454 } 457 - 458 - if(!$rheight || !$rwidth) { 459 - #printf STDERR "wpsbuild notice: No %sLCD size, skipping $wps\n", 460 - #$isrwps?"remote ":""; 461 - $within = 0; 462 - next; 455 + elsif($_ = check_res($l, "sbs")) { 456 + $sbs = $_; 463 457 } 464 - $wpslist =~ /(.*)WPSLIST/; 465 - my $wpsdir = $1; 466 - # If this WPS installable on this platform, one of the following 467 - # two files will be present 468 - foreach my $d (@depthlist) { 469 - next if ($d > $rdepth); 470 - 471 - $req_size = $rwidth . "x" . $rheight . "x" . $d; 472 - 473 - # check for model specific wps 474 - $req_g_wps = $wps_prefix . "." . $req_size . "." . $modelname . ".wps"; 475 - last if (-e "$wpsdir/$req_g_wps"); 476 - 477 - # check for normal wps (with WIDTHxHEIGHTxDEPTH) 478 - $req_g_wps = $wps_prefix . "." . $req_size . ".wps"; 479 - last if (-e "$wpsdir/$req_g_wps"); 480 - 481 - if ($isrwps) { 482 - $req_size = $req_size . "." . $main_width . "x" . $main_height . "x" . "$main_depth"; 483 - 484 - $req_g_wps = $wps_prefix . "." . $req_size . ".wps"; 485 - last if (-e "$wpsdir/$req_g_wps"); 486 - } 458 + elsif($_ = check_res($l, "fms")) { 459 + $fms = $_; 487 460 } 488 - $req_t_wps = $wps_prefix . ".txt" . ".wps"; 489 - 490 - #print "LCD: $wps wants $width x $height\n"; 491 - #print "LCD: is $rwidth x $rheight\n"; 492 - 493 - #print "gwps: $wpsdir/$req_g_wps" . "\n"; 494 - if (-e "$wpsdir/$req_g_wps" || -e "$wpsdir/$req_t_wps" ) { 495 - # 496 - # The target model has an LCD that is suitable for this 497 - # WPS 498 - # 499 - #print "Size requirement is fine!\n"; 500 - mkdirs() if (-e "$wpsdir/$req_g_wps"); 501 - # Do the copying before building the .cfg - buildcfg() 502 - # mangles some filenames 503 - if ($backdrop) { 504 - copybackdrop(); 505 - } 506 - if ($iconset) { 507 - copythemeicon(); 508 - } 509 - if ($viewericon) { 510 - copythemeviewericon(); 511 - } 512 - if ($font) { 513 - copythemefont($font); 514 - } 515 - if ($remotefont) { 516 - copythemefont($remotefont); 517 - } 518 - if(!$isrwps) { 519 - # We only make .cfg files for <wps> sections: 520 - buildcfg(); 521 - } 522 - copywps(); 461 + elsif($_ = check_res($l, "Font")) { 462 + $font = $_; 523 463 } 524 - else { 525 - #print "(${wps_prefix}-${rwidth}x${rheight}x$rdepth) "; 526 - #print "Skip $wps due to size restraints\n"; 464 + elsif($_ = check_res($l, "Statusbar")) { 465 + $statusbar = $_; 527 466 } 528 - $within = 0; 529 - } 530 - elsif($l =~ /^Name: *(.*)/i) { 531 - # Note that in the case this is within <rwps>, $wps will contain the 532 - # name of the rwps. Use $isrwps to figure out what type it is. 533 - $wps = $wps_prefix = $1; 534 - $wps_prefix =~ s/\.(r|)wps//; 535 - #print $wps_prefix . "\n"; 536 - } 537 - elsif($l =~ /^RWPS: *(.*)/i) { 538 - $rwps = $1; 539 - } 540 - elsif($l =~ /^RWPS\.${main_width}x${main_height}x$main_depth: *(.*)/i) { 541 - $rwps = $1; 542 - } 543 - elsif($l =~ /^SBS: *(.*)/i) { 544 - $sbs = $sbs_prefix = $1; 545 - $sbs_prefix =~ s/\.(r|)sbs//; 546 - } 547 - elsif($l =~ /^SBS\.${main_width}x${main_height}x$main_depth: *(.*)/i) { 548 - $sbs = $sbs_prefix = $1; 549 - $sbs_prefix =~ s/\.(r|)sbs//; 550 - } 551 - elsif($l =~ /^RSBS: *(.*)/i) { 552 - $rsbs = $1; 553 - } 554 - elsif($l =~ /^RSBS\.${main_width}x${main_height}x$main_depth: *(.*)/i) { 555 - $rsbs = $1; 556 - } 557 - elsif($l =~ /^Author: *(.*)/i) { 558 - $author = $1; 559 - } 560 - elsif($l =~ /^Width: *(.*)/i) { 561 - $width = $1; 562 - } 563 - elsif($l =~ /^Width\.${main_width}x${main_height}x$main_depth: *(.*)/i) { 564 - $width = $1; 565 - } 566 - elsif($l =~ /^Height: *(.*)/i) { 567 - $height = $1; 568 - } 569 - elsif($l =~ /^Height\.${main_width}x${main_height}x$main_depth: *(.*)/i) { 570 - $height = $1; 571 - } 572 - elsif($l =~ /^Font: *(.*)/i) { 573 - $font = $1; 574 - } 575 - elsif($l =~ /^Font\.${main_width}x${main_height}x$main_depth: *(.*)/i) { 576 - $font = $1; 577 - } 578 - elsif($l =~ /^Remote Font\.${remote_width}x${remote_height}x$remote_depth: *(.*)/i) { 579 - $remotefont = $1; 580 - } 581 - elsif($l =~ /^Remote Font: *(.*)/i) { 582 - $remotefont = $1; 583 - } 584 - elsif($l =~ /^Foreground Color: *(.*)/i) { 585 - $fgcolor = $1; 586 - } 587 - elsif($l =~ /^Background Color: *(.*)/i) { 588 - $bgcolor = $1; 589 - } 590 - elsif($l =~ /^Statusbar: *(.*)/i) { 591 - $statusbar = $1; 592 - } 593 - elsif($l =~ /^Statusbar\.${main_width}x${main_height}x$main_depth: *(.*)/i) { 594 - $statusbar = $1; 595 - } 596 - elsif($l =~ /^Backdrop: *(.*)/i) { 597 - $backdrop = $1; 598 - } 599 - elsif($l =~ /^Backdrop\.${main_width}x${main_height}x$main_depth: *(.*)/i) { 600 - $backdrop = $1; 601 - } 602 - elsif($l =~ /^line selector start color: *(.*)/i) { 603 - $lineselectstart = $1; 604 - } 605 - elsif($l =~ /^line selector end color: *(.*)/i) { 606 - $lineselectend = $1; 607 - } 608 - elsif($l =~ /^selector type: *(.*)/i) { 609 - $selecttype = $1; 610 - } 611 - elsif($l =~ /^selector type\.${main_width}x${main_height}x$main_depth: *(.*)/i) { 612 - $selecttype = $1; 613 - } 614 - elsif($l =~ /^iconset: *(.*)/i) { 615 - $iconset = $1; 616 - } 617 - elsif($l =~ /^iconset\.${main_width}x${main_height}x$main_depth: *(.*)/i) { 618 - $iconset = $1; 467 + elsif($_ = check_res($l, "Backdrop")) { 468 + $backdrop = $_; 469 + } 470 + elsif($l =~ /^Foreground Color: *(.*)/i) { 471 + $fgcolor = $1; 472 + } 473 + elsif($l =~ /^Background Color: *(.*)/i) { 474 + $bgcolor = $1; 475 + } 476 + elsif($l =~ /^line selector start color: *(.*)/i) { 477 + $lineselectstart = $1; 478 + } 479 + elsif($l =~ /^line selector end color: *(.*)/i) { 480 + $lineselectend = $1; 481 + } 482 + elsif($_ = check_res($l, "selector type")) { 483 + $selecttype = $_; 484 + } 485 + elsif($_ = check_res($l, "iconset")) { 486 + $iconset = $_; 487 + } 488 + elsif($_ = check_res($l, "viewers iconset")) { 489 + $viewericon = $_; 490 + } 491 + elsif($l =~ /^line selector text color: *(.*)/i) { 492 + $lineselecttextcolor = $1; 493 + } 494 + elsif($l =~ /^filetype colours: *(.*)/i) { 495 + $filetylecolor = $1; 496 + } 497 + elsif($_ = check_res($l, "ui viewport")) { 498 + $listviewport = $_; 499 + } 619 500 } 620 - elsif($l =~ /^viewers iconset: *(.*)/i) { 621 - $viewericon = $1; 501 + } 502 + elsif($l =~ /^ *<remote>/i) { 503 + while(<WPS>) { 504 + # parse remote settings 505 + my $l = $_; 506 + if ($l =~ /^ *<\/remote>/i) { 507 + last; 508 + } 509 + elsif(!$has_remote) { 510 + next; # dont parse <remote> section 511 + } 512 + elsif($_ = check_res($l, "rwps", 1)) { 513 + $rwps = $_; 514 + } 515 + elsif($_ = check_res($l, "rsbs", 1)) { 516 + $rsbs = $_; 517 + } 518 + elsif($_ = check_res($l, "rfms", 1)) { 519 + $rfms = $_; 520 + } 521 + elsif($_ = check_res($l, "Font", 1)) { 522 + $remotefont = $_; 523 + } 524 + elsif($_ = check_res($l, "iconset", 1)) { 525 + $remoteiconset = $_; 526 + } 527 + elsif($_ = check_res($l, "viewers iconset", 1)) { 528 + $remoteviewericon = $_; 529 + } 530 + elsif($_ = check_res($l, "statusbar", 1)) { 531 + $remotestatusbar = $_; 532 + } 533 + elsif($_ = check_res($l, "ui viewport", 1)) { 534 + $remotelistviewport = $_; 535 + } 622 536 } 623 - elsif($l =~ /^viewers iconset\.${main_width}x${main_height}x$main_depth: *(.*)/i) { 624 - $viewericon = $1; 537 + } 538 + elsif($l =~ /^ *<\/theme>/i) { 539 + # for each wps,sbs,fms (+ remote variants) check if <theme>[.<model>].wps 540 + # exists if no filename was specified in WPSLIST 541 + my $req_skin; 542 + 543 + if ($has_wps eq "yes" && !$wps) { 544 + $wps = check_skinfile("wps"); 545 + } elsif ($has_wps eq "no") { 546 + $wps = ''; 625 547 } 626 - elsif($l =~ /^line selector text color: *(.*)/i) { 627 - $lineselecttextcolor = $1; 548 + 549 + if ($has_sbs eq "yes" && !$sbs) { 550 + $sbs = check_skinfile("sbs"); 551 + } elsif ($has_sbs eq "no") { 552 + $sbs = ''; 628 553 } 629 - elsif($l =~ /^filetype colours: *(.*)/i) { 630 - $filetylecolor = $1; 554 + 555 + if ($has_fms eq "yes" && !$fms) { 556 + $fms = check_skinfile("fms"); 557 + } elsif ($has_fms eq "no") { 558 + $fms = ''; 631 559 } 632 - elsif($l =~ /^ui viewport: *(.*)/i) { 633 - $listviewport = $1; 560 + 561 + # now check for remote skin files (use main screen's extension) 562 + if ($has_remote) { 563 + if ($has_rwps eq "yes" && !$rwps) { 564 + $rwps = check_skinfile("wps"); 565 + } elsif ($has_rwps eq "no") { 566 + $rwps = ''; 567 + } 568 + 569 + if ($has_rsbs eq "yes" && !$rsbs) { 570 + $rsbs = check_skinfile("sbs"); 571 + } elsif ($has_rsbs eq "no") { 572 + $rsbs = ''; 573 + } 574 + 575 + if ($has_rfms eq "yes" && !$rfms) { 576 + $rfms = check_skinfile("fms"); 577 + } elsif ($has_rfms eq "no") { 578 + $rfms = ''; 579 + } 634 580 } 635 - elsif($l =~ /^ui viewport\.${main_width}x${main_height}x$main_depth: *(.*)/i) { 636 - $listviewport = $1; 581 + #print "LCD: $wps wants $width x $height\n"; 582 + 583 + # 584 + # The target model has an LCD that is suitable for this 585 + # WPS 586 + # 587 + #print "Size requirement is fine!\n"; 588 + mkdirs() if (-e "$wpsdir/$theme"); 589 + # Do the copying before building the .cfg - buildcfg() 590 + # mangles some filenames 591 + if (defined($backdrop) && $backdrop ne "-") { 592 + copybackdrop(); 593 + $backdrop = normalize($backdrop); 637 594 } 638 - elsif($l =~ /^remote ui viewport: *(.*)/i) { 639 - $remotelistviewport = $1; 595 + foreach my $i ($iconset, $viewericon, $remoteiconset, $remoteviewericon) { 596 + if (defined($i) && $i ne "-") { 597 + copythemeicon($i); 598 + } 640 599 } 641 - elsif($l =~ /^remote ui viewport\.${main_width}x${main_height}x$main_depth: *(.*)/i) { 642 - $remotelistviewport = $1; 600 + if (defined($font) && $font ne "-") { 601 + copythemefont($font); 602 + $font = "$rbdir/fonts/$font"; 643 603 } 644 - else{ 645 - #print "Unknown line: $l!\n"; 604 + if (defined($remotefont) && $remotefont ne "-") { 605 + copythemefont($remotefont); 606 + $remotefont = "$rbdir/fonts/$remotefont"; 646 607 } 608 + buildcfg(); 609 + copywps(); 610 + } 611 + else{ 612 + #print "Unknown line: $l!\n"; 647 613 } 648 614 } 649 615