diff options
author | Daniel Stenberg <daniel@haxx.se> | 2005-11-17 22:39:26 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2005-11-17 22:39:26 +0000 |
commit | 2bace6a37569044b38dc7de79b4cbebc33513c93 (patch) | |
tree | 85ddc7ed6bb10eef842a3cf256d66636cfdb6ac8 /wps | |
parent | bec94c9e2a99f420ab2e3598a538a072d68a6f49 (diff) | |
download | rockbox-2bace6a37569044b38dc7de79b4cbebc33513c93.tar.gz rockbox-2bace6a37569044b38dc7de79b4cbebc33513c93.zip |
.rwps support and support for a rwps: field within the WPSLIST file, which
really is more like a list of themes now...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7940 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'wps')
-rwxr-xr-x | wps/wpsbuild.pl | 72 |
1 files changed, 58 insertions, 14 deletions
diff --git a/wps/wpsbuild.pl b/wps/wpsbuild.pl index a8e325fde7..74aad42417 100755 --- a/wps/wpsbuild.pl +++ b/wps/wpsbuild.pl @@ -38,13 +38,28 @@ if(!$wpslist) { } sub getlcdsizes { + my ($remote) = @_; + open(GCC, ">gcctemp"); + if($remote) { + # Get the remote LCD screen size + print GCC <<STOP +\#include "config.h" +#ifdef HAVE_REMOTE_LCD +Height: LCD_REMOTE_HEIGHT +Width: LCD_REMOTE_WIDTH +#endif +STOP +; + } + else { print GCC <<STOP \#include "config.h" Height: LCD_HEIGHT Width: LCD_WIDTH STOP ; +} close(gcc); my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -"; @@ -73,9 +88,15 @@ STOP sub mkdirs { my $wpsdir = $wps; - $wpsdir =~ s/\.wps//; + $wpsdir =~ s/\.(r|)wps//; mkdir ".rockbox/wps", 0777; - mkdir ".rockbox/wps/$wpsdir", 0777; + + if( -d ".rockbox/wps/$wpsdir") { + print STDERR "wpsbuild warning: directory wps/$wpsdir already exists!\n"; + } + else { + mkdir ".rockbox/wps/$wpsdir", 0777; + } } sub copywps { @@ -86,7 +107,7 @@ sub copywps { if($wpslist =~ /(.*)WPSLIST/) { $dir = $1; my $wpsdir = $wps; - $wpsdir =~ s/\.wps//; + $wpsdir =~ s/\.(r|)wps//; system("cp $dir/$wps .rockbox/wps/"); if (-e "$dir/$wpsdir") { system("cp $dir/$wpsdir/*.bmp .rockbox/wps/$wpsdir/"); @@ -101,7 +122,7 @@ sub buildcfg { my $cfg = $wps; my @out; - $cfg =~ s/\.wps/.cfg/; + $cfg =~ s/\.(r|)wps/.cfg/; push @out, <<MOO \# @@ -117,12 +138,24 @@ MOO if($statusbar) { push @out, "statusbar: $statusbar\n"; } + if($rwps) { + push @out, "rwps: /.rockbox/wps/$rwps\n"; + } - open(CFG, ">.rockbox/wps/$cfg"); - print CFG @out; - close(CFG); + if(-f ".rockbox/wps/$cfg") { + print STDERR "wpsbuild warning: wps/$cfg already exists!\n"; + } + else { + open(CFG, ">.rockbox/wps/$cfg"); + print CFG @out; + close(CFG); + } } +# Get the LCD sizes first +my ($main_height, $main_width) = getlcdsizes(); +my ($remote_height, $remote_width) = getlcdsizes(1); + open(WPS, "<$wpslist"); while(<WPS>) { my $l = $_; @@ -130,18 +163,26 @@ while(<WPS>) { # skip comment next; } - if($l =~ /^ *<wps>/i) { + if($l =~ /^ *<(r|)wps>/i) { + $isrwps = $1; $within = 1; next; } if($within) { - if($l =~ /^ *<\/wps>/i) { - - my ($rheight, $rwidth) = getlcdsizes(); + if($l =~ /^ *<\/${isrwps}wps>/i) { + # Get the required width and height + my ($rheight, $rwidth); + if($isrwps) { + ($rheight, $rwidth) = ($remote_height, $remote_width); + } + else { + ($rheight, $rwidth) = ($main_height, $main_width); + } if(!$rheight || !$rwidth) { - print STDER "Failed to get LCD sizes!\n"; - exit; + printf STDERR "wpsbuild notice: No %sLCD size, skipping $wps\n", + $isrwps?"remote ":""; + next; } #print "LCD: $wps wants $height x $width\n"; @@ -163,11 +204,14 @@ while(<WPS>) { } $within = 0; - undef $wps, $width, $height, $font, $statusbar, $author; + undef $wps, $rwps, $width, $height, $font, $statusbar, $author; } elsif($l =~ /^Name: (.*)/i) { $wps = $1; } + elsif($l =~ /^RWPS: (.*)/i) { + $rwps = $1; + } elsif($l =~ /^Author: (.*)/i) { $author = $1; } |