2005-11-14 14:24:17 +00:00
|
|
|
#!/usr/bin/perl
|
2005-11-14 15:05:53 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
2008-11-24 22:16:07 +00:00
|
|
|
use strict;
|
|
|
|
use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DTYPE_STUFF
|
2005-11-14 15:05:53 +00:00
|
|
|
|
2008-11-24 22:16:07 +00:00
|
|
|
my $ROOT="..";
|
2012-06-10 18:28:36 +00:00
|
|
|
my $wpsdir;
|
2005-11-14 15:05:53 +00:00
|
|
|
my $verbose;
|
2008-11-24 22:16:07 +00:00
|
|
|
my $rbdir=".rockbox";
|
2010-08-01 16:15:27 +00:00
|
|
|
my $tempdir=".rockbox";
|
2008-11-24 22:16:07 +00:00
|
|
|
my $wpslist;
|
|
|
|
my $target;
|
2009-01-31 12:23:35 +00:00
|
|
|
my $modelname;
|
2005-11-14 14:24:17 +00:00
|
|
|
|
2008-11-24 22:16:07 +00:00
|
|
|
# Get options
|
|
|
|
GetOptions ( 'r|root=s' => \$ROOT,
|
2009-01-31 12:23:35 +00:00
|
|
|
'm|modelname=s' => \$modelname,
|
2008-11-24 22:16:07 +00:00
|
|
|
'v|verbose' => \$verbose,
|
|
|
|
'rbdir=s' => \$rbdir, # If we want to put in a different directory
|
2010-08-01 16:15:27 +00:00
|
|
|
'tempdir=s' => \$tempdir, # override .rockbox temporary dir
|
2008-11-24 22:16:07 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
($wpslist, $target) = @ARGV;
|
2005-11-14 14:24:17 +00:00
|
|
|
|
2008-11-26 09:36:34 +00:00
|
|
|
my $firmdir="$ROOT/firmware";
|
2008-02-23 10:03:51 +00:00
|
|
|
my $cppdef = $target;
|
2005-11-14 15:05:53 +00:00
|
|
|
|
2008-11-24 22:16:07 +00:00
|
|
|
# These parameters are filled in as we parse wpslist
|
2009-10-19 15:28:15 +00:00
|
|
|
my $req_t;
|
2012-06-10 18:28:36 +00:00
|
|
|
my $theme;
|
|
|
|
my $has_wps;
|
2008-11-24 22:16:07 +00:00
|
|
|
my $wps;
|
2012-06-10 18:28:36 +00:00
|
|
|
my $has_rwps;
|
2008-11-24 22:16:07 +00:00
|
|
|
my $rwps;
|
2012-06-10 18:28:36 +00:00
|
|
|
my $has_sbs;
|
2009-10-19 15:28:15 +00:00
|
|
|
my $sbs;
|
2012-06-10 18:28:36 +00:00
|
|
|
my $has_rsbs;
|
2009-10-19 15:28:15 +00:00
|
|
|
my $rsbs;
|
2012-06-10 18:28:36 +00:00
|
|
|
my $has_fms;
|
|
|
|
my $fms;
|
|
|
|
my $has_rfms;
|
|
|
|
my $rfms;
|
2008-11-24 22:16:07 +00:00
|
|
|
my $width;
|
|
|
|
my $height;
|
|
|
|
my $font;
|
2010-06-03 07:30:01 +00:00
|
|
|
my $remotefont;
|
2008-11-24 22:16:07 +00:00
|
|
|
my $fgcolor;
|
|
|
|
my $bgcolor;
|
|
|
|
my $statusbar;
|
2012-06-10 18:28:36 +00:00
|
|
|
my $remotestatusbar;
|
2008-11-24 22:16:07 +00:00
|
|
|
my $author;
|
|
|
|
my $backdrop;
|
|
|
|
my $lineselectstart;
|
|
|
|
my $lineselectend;
|
|
|
|
my $selecttype;
|
|
|
|
my $iconset;
|
2012-06-10 18:28:36 +00:00
|
|
|
my $remoteiconset;
|
2008-11-24 22:16:07 +00:00
|
|
|
my $viewericon;
|
2012-06-10 18:28:36 +00:00
|
|
|
my $remoteviewericon;
|
2008-11-24 22:16:07 +00:00
|
|
|
my $lineselecttextcolor;
|
|
|
|
my $filetylecolor;
|
2009-08-16 22:20:11 +00:00
|
|
|
my $listviewport;
|
|
|
|
my $remotelistviewport;
|
2008-11-24 22:16:07 +00:00
|
|
|
|
|
|
|
# LCD sizes
|
|
|
|
my ($main_height, $main_width, $main_depth);
|
|
|
|
my ($remote_height, $remote_width, $remote_depth);
|
|
|
|
my $has_remote;
|
|
|
|
|
|
|
|
|
2005-11-14 14:24:17 +00:00
|
|
|
if(!$wpslist) {
|
2005-11-14 15:05:53 +00:00
|
|
|
print "Usage: wpsbuilds.pl <WPSLIST> <target>\n",
|
|
|
|
"Run this script in the root of the target build, and it will put all the\n",
|
2010-08-01 16:15:27 +00:00
|
|
|
"stuff in $tempdir/wps/\n and build the cfg according to $rbdir";
|
2005-11-14 14:24:17 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2008-02-23 10:03:51 +00:00
|
|
|
sub getlcdsizes
|
|
|
|
{
|
2005-11-17 22:39:26 +00:00
|
|
|
my ($remote) = @_;
|
|
|
|
|
2005-11-14 15:05:53 +00:00
|
|
|
open(GCC, ">gcctemp");
|
2005-11-17 22:39:26 +00:00
|
|
|
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
|
2006-05-11 14:27:12 +00:00
|
|
|
Depth: LCD_REMOTE_DEPTH
|
2005-11-17 22:39:26 +00:00
|
|
|
#endif
|
|
|
|
STOP
|
|
|
|
;
|
|
|
|
}
|
|
|
|
else {
|
2005-11-14 15:05:53 +00:00
|
|
|
print GCC <<STOP
|
|
|
|
\#include "config.h"
|
|
|
|
Height: LCD_HEIGHT
|
|
|
|
Width: LCD_WIDTH
|
2006-05-11 14:27:12 +00:00
|
|
|
Depth: LCD_DEPTH
|
2005-11-14 15:05:53 +00:00
|
|
|
STOP
|
|
|
|
;
|
2005-11-17 22:39:26 +00:00
|
|
|
}
|
2007-03-12 12:57:31 +00:00
|
|
|
close(GCC);
|
2005-11-14 15:05:53 +00:00
|
|
|
|
|
|
|
my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -";
|
2008-02-23 10:03:51 +00:00
|
|
|
|
2005-11-14 15:05:53 +00:00
|
|
|
#print "CMD $c\n";
|
|
|
|
|
|
|
|
open(GETSIZE, "$c|");
|
|
|
|
|
2008-11-24 22:16:07 +00:00
|
|
|
my ($height, $width, $depth);
|
2005-11-14 15:05:53 +00:00
|
|
|
while(<GETSIZE>) {
|
|
|
|
if($_ =~ /^Height: (\d*)/) {
|
|
|
|
$height = $1;
|
|
|
|
}
|
|
|
|
elsif($_ =~ /^Width: (\d*)/) {
|
|
|
|
$width = $1;
|
|
|
|
}
|
2006-05-11 14:27:12 +00:00
|
|
|
elsif($_ =~ /^Depth: (\d*)/) {
|
|
|
|
$depth = $1;
|
|
|
|
}
|
|
|
|
if($height && $width && $depth) {
|
2005-11-14 15:05:53 +00:00
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close(GETSIZE);
|
|
|
|
unlink("gcctemp");
|
|
|
|
|
2006-05-11 14:27:12 +00:00
|
|
|
return ($height, $width, $depth);
|
2005-11-14 15:05:53 +00:00
|
|
|
}
|
|
|
|
|
2008-02-23 10:03:51 +00:00
|
|
|
sub mkdirs
|
|
|
|
{
|
2010-08-01 16:15:27 +00:00
|
|
|
mkdir "$tempdir/wps", 0777;
|
|
|
|
mkdir "$tempdir/themes", 0777;
|
2012-06-10 18:28:36 +00:00
|
|
|
mkdir "$tempdir/icons", 0777;
|
2005-11-17 22:39:26 +00:00
|
|
|
|
2012-06-10 18:28:36 +00:00
|
|
|
if( -d "$tempdir/wps/$theme") {
|
|
|
|
#print STDERR "wpsbuild warning: directory wps/$theme already exists!\n";
|
2005-11-17 22:39:26 +00:00
|
|
|
}
|
2006-05-11 14:27:12 +00:00
|
|
|
else
|
|
|
|
{
|
2012-06-10 18:28:36 +00:00
|
|
|
mkdir "$tempdir/wps/$theme", 0777;
|
2005-11-17 22:39:26 +00:00
|
|
|
}
|
2005-11-14 15:05:53 +00:00
|
|
|
}
|
|
|
|
|
2012-06-10 18:28:36 +00:00
|
|
|
sub normalize
|
|
|
|
{
|
|
|
|
my $in = $_[0];
|
|
|
|
# strip resolution
|
|
|
|
$in =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//;
|
|
|
|
return $in;
|
|
|
|
}
|
|
|
|
|
2008-02-23 10:03:51 +00:00
|
|
|
sub copybackdrop
|
|
|
|
{
|
|
|
|
#copy the backdrop file into the build dir
|
2008-02-23 10:22:06 +00:00
|
|
|
if ($backdrop ne '') {
|
2012-06-10 18:28:36 +00:00
|
|
|
my $dst = normalize($backdrop);
|
|
|
|
system("cp $ROOT/$backdrop $tempdir/$dst");
|
2008-02-23 10:22:06 +00:00
|
|
|
}
|
2008-01-18 04:00:12 +00:00
|
|
|
}
|
|
|
|
|
2008-02-23 10:03:51 +00:00
|
|
|
sub copythemefont
|
|
|
|
{
|
|
|
|
#copy the font specified by the theme
|
2010-06-03 07:30:01 +00:00
|
|
|
my $o = $_[0];
|
2008-01-21 00:21:40 +00:00
|
|
|
|
2008-02-23 10:03:51 +00:00
|
|
|
$o =~ s/\.fnt/\.bdf/;
|
2010-08-01 16:15:27 +00:00
|
|
|
mkdir "$tempdir/fonts";
|
2012-06-10 18:28:36 +00:00
|
|
|
system("$ROOT/tools/convbdf -f -o \"$tempdir/fonts/$_[0]\" \"$ROOT/fonts/$o\" ");
|
2008-01-21 01:48:38 +00:00
|
|
|
}
|
|
|
|
|
2008-02-23 10:03:51 +00:00
|
|
|
sub copythemeicon
|
|
|
|
{
|
2012-06-10 18:28:36 +00:00
|
|
|
my $i = $_[0];
|
2008-02-23 10:03:51 +00:00
|
|
|
#copy the icon specified by the theme
|
2012-06-10 18:28:36 +00:00
|
|
|
if ($i ne "-") {
|
|
|
|
my $tempicon = $tempdir . "/" . $i;
|
2010-08-01 16:15:27 +00:00
|
|
|
$tempicon =~ /\/.*icons\/(.*)/i;
|
2012-06-10 18:28:36 +00:00
|
|
|
system("cp $ROOT/icons/$1 $tempicon");
|
2008-02-23 10:22:06 +00:00
|
|
|
}
|
2008-01-21 01:48:38 +00:00
|
|
|
}
|
|
|
|
|
2012-06-10 18:28:36 +00:00
|
|
|
sub uniq {
|
|
|
|
my %seen = ();
|
|
|
|
my @r = ();
|
|
|
|
foreach my $a (@_) {
|
|
|
|
unless ($seen{$a}) {
|
|
|
|
push @r, $a;
|
|
|
|
$seen{$a} = 1;
|
|
|
|
}
|
2008-02-23 22:54:33 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
return @r;
|
2008-02-23 10:03:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub copywps
|
|
|
|
{
|
2005-11-14 15:05:53 +00:00
|
|
|
# we assume that we copy the WPS files from the same dir the WPSLIST
|
|
|
|
# file is located in
|
|
|
|
my $dir;
|
2012-06-10 18:28:36 +00:00
|
|
|
my %skinfiles = ("wps", $wps,
|
|
|
|
"sbs", $sbs,
|
|
|
|
"fms", $fms,
|
|
|
|
"rwps", $rwps,
|
|
|
|
"rsbs", $rsbs,
|
|
|
|
"rfms", $rfms);
|
2006-05-11 14:27:12 +00:00
|
|
|
my @filelist;
|
|
|
|
my $file;
|
2005-11-14 15:05:53 +00:00
|
|
|
|
2012-06-10 18:28:36 +00:00
|
|
|
if($wpslist =~ /(.*)\/WPSLIST/) {
|
2005-11-14 15:05:53 +00:00
|
|
|
$dir = $1;
|
2012-06-10 18:28:36 +00:00
|
|
|
|
|
|
|
# copy fully-fledged wps, sbs, etc. including graphics
|
|
|
|
foreach my $ext (keys %skinfiles) {
|
|
|
|
next unless ($skinfiles{$ext});
|
|
|
|
$file = $skinfiles{$ext};
|
|
|
|
system("cp $dir/$file $tempdir/wps/$theme.$ext");
|
|
|
|
open(SKIN, "$dir/$file");
|
|
|
|
while (<SKIN>) {
|
|
|
|
$filelist[$#filelist + 1] = $1 if (/[\(,]([^,]*?.bmp)[\),]/);
|
|
|
|
}
|
|
|
|
close(SKIN);
|
2009-10-19 15:28:15 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
|
|
|
|
if ($#filelist >= 0) {
|
|
|
|
if (-e "$dir/$theme") {
|
|
|
|
foreach $file (uniq(@filelist)) {
|
|
|
|
system("cp $dir/$theme/$file $tempdir/wps/$theme/");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
print STDERR "beep, no dir to copy WPS from!\n";
|
|
|
|
}
|
2009-10-19 15:28:15 +00:00
|
|
|
}
|
2006-05-11 14:27:12 +00:00
|
|
|
} else {
|
|
|
|
print STDERR "No source directory!\n";
|
2005-11-14 15:05:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-14 14:24:17 +00:00
|
|
|
sub buildcfg {
|
2012-06-10 18:28:36 +00:00
|
|
|
my $cfg = $theme . ".cfg";
|
|
|
|
my @out;
|
2005-11-14 14:24:17 +00:00
|
|
|
|
2005-11-14 15:05:53 +00:00
|
|
|
push @out, <<MOO
|
|
|
|
\#
|
2005-11-14 14:24:17 +00:00
|
|
|
\# $cfg generated by wpsbuild.pl
|
2005-11-14 15:05:53 +00:00
|
|
|
\# $wps is made by $author
|
2005-11-14 14:24:17 +00:00
|
|
|
\#
|
|
|
|
MOO
|
|
|
|
;
|
2012-06-10 18:28:36 +00:00
|
|
|
|
|
|
|
my %skinfiles = ("wps" => $wps,
|
|
|
|
"sbs" => $sbs,
|
|
|
|
"fms" => $fms,
|
|
|
|
"rwps" => $rwps,
|
|
|
|
"rsbs" => $rsbs,
|
|
|
|
"rfms" => $rfms);
|
|
|
|
for my $skin (keys %skinfiles) {
|
|
|
|
my $val = $skinfiles{$skin};
|
|
|
|
if (!defined($val)) {
|
|
|
|
# dont put value if not defined (e.g. rwps when there's no remote)
|
|
|
|
next;
|
|
|
|
} elsif ($val eq '') {
|
|
|
|
# empty resets to built-in
|
|
|
|
push @out, "$skin: -\n";
|
2010-02-21 19:10:57 +00:00
|
|
|
} else {
|
2012-06-10 18:28:36 +00:00
|
|
|
# file name is always <theme>.{wps,rwps,...} (see copywps())
|
|
|
|
push @out, "$skin: $rbdir/wps/$theme.$skin\n";
|
2010-02-21 19:10:57 +00:00
|
|
|
}
|
2005-11-17 22:39:26 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
|
|
|
|
push @out, "selector type: $selecttype\n" if (defined($selecttype));
|
|
|
|
push @out, "backdrop: $backdrop\n" if (defined($backdrop));
|
|
|
|
push @out, "filetype colours: $filetylecolor\n" if (defined($filetylecolor));
|
|
|
|
|
|
|
|
if ($main_depth > 2) {
|
|
|
|
push @out, "foreground color: $fgcolor\n" if($fgcolor);
|
|
|
|
push @out, "background color: $bgcolor\n" if($bgcolor);
|
|
|
|
push @out, "line selector start color: $lineselectstart\n" if($lineselectstart);
|
|
|
|
push @out, "line selector end color: $lineselectend\n" if($lineselectend);;
|
|
|
|
push @out, "line selector text color: $lineselecttextcolor\n" if($lineselecttextcolor);
|
2009-08-16 22:20:11 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
|
|
|
|
push @out, "font: $font\n" if (defined($font));
|
|
|
|
push @out, "statusbar: $statusbar\n" if (defined($statusbar));
|
|
|
|
push @out, "iconset: $iconset\n" if (defined($iconset));
|
|
|
|
push @out, "viewers iconset: $viewericon\n" if (defined($viewericon));
|
|
|
|
push @out, "ui viewport: $listviewport\n" if (defined($listviewport));
|
|
|
|
|
|
|
|
if ($has_remote) {
|
|
|
|
push @out, "remote font: $remotefont\n" if (defined($remotefont));
|
|
|
|
push @out, "remote statusbar: $remotestatusbar\n" if (defined($remotestatusbar));
|
|
|
|
push @out, "remote iconset: $remoteiconset\n" if (defined($remoteiconset));
|
|
|
|
push @out, "remote viewers iconset: $remoteviewericon\n" if (defined($remoteviewericon));
|
|
|
|
push @out, "remote ui viewport: $remotelistviewport\n" if (defined($remotelistviewport));
|
2009-08-16 22:20:11 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
|
2010-08-01 16:15:27 +00:00
|
|
|
if(-f "$tempdir/wps/$cfg") {
|
2005-11-17 22:39:26 +00:00
|
|
|
print STDERR "wpsbuild warning: wps/$cfg already exists!\n";
|
|
|
|
}
|
|
|
|
else {
|
2010-08-01 16:15:27 +00:00
|
|
|
open(CFG, ">$tempdir/themes/$cfg");
|
2005-11-17 22:39:26 +00:00
|
|
|
print CFG @out;
|
|
|
|
close(CFG);
|
|
|
|
}
|
2005-11-14 14:24:17 +00:00
|
|
|
}
|
|
|
|
|
2005-11-17 22:39:26 +00:00
|
|
|
# Get the LCD sizes first
|
2008-02-23 09:18:09 +00:00
|
|
|
($main_height, $main_width, $main_depth) = getlcdsizes();
|
|
|
|
($remote_height, $remote_width, $remote_depth) = getlcdsizes(1);
|
2005-11-17 22:39:26 +00:00
|
|
|
|
2009-01-23 20:46:49 +00:00
|
|
|
#print "LCD: ${main_width}x${main_height}x${main_depth}\n";
|
2008-11-24 22:16:07 +00:00
|
|
|
$has_remote = 1 if ($remote_height && $remote_width && $remote_depth);
|
|
|
|
|
2012-06-10 18:28:36 +00:00
|
|
|
|
|
|
|
# check if line matches the setting string or if it contains a regex
|
|
|
|
# that contains the targets resolution
|
|
|
|
sub check_res {
|
|
|
|
my ($line, $string, $remote) = @_;
|
|
|
|
if ($line =~ /^${string}: *(.*)/i) {
|
|
|
|
return $1;
|
|
|
|
}
|
|
|
|
elsif($line =~ /^${string}.(.*): *(.*)/i) {
|
|
|
|
# $1 is a resolution regex, $2 the filename incl. resolution
|
|
|
|
my $fn = $2;
|
|
|
|
my $size_str = "${main_width}x${main_height}x${main_depth}";
|
|
|
|
if ($remote) {
|
|
|
|
$size_str = "${remote_width}x${remote_height}x${remote_depth}";
|
|
|
|
}
|
|
|
|
if ($size_str =~ /$1$/) {
|
|
|
|
return $fn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
# check if <theme>.<model>.<ext> exists. If not, check if <theme>.<ext> exists
|
|
|
|
sub check_skinfile {
|
|
|
|
my $ext = $_[0];
|
|
|
|
my $req_skin = $theme . "." . $modelname . ".$ext";
|
|
|
|
if (-e "$wpsdir/$req_skin") {
|
|
|
|
return $req_skin;
|
|
|
|
} else {
|
|
|
|
$req_skin = $theme . ".$ext";
|
|
|
|
if (-e "$wpsdir/$req_skin") {
|
|
|
|
return $req_skin;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Infer WPS (etc.) filename from the the if it wasnt given
|
|
|
|
$wpslist =~ /(.*)WPSLIST/;
|
|
|
|
$wpsdir = $1;
|
2005-11-18 15:33:05 +00:00
|
|
|
|
2005-11-14 14:24:17 +00:00
|
|
|
open(WPS, "<$wpslist");
|
|
|
|
while(<WPS>) {
|
|
|
|
my $l = $_;
|
2008-11-24 22:16:07 +00:00
|
|
|
|
2008-03-10 17:47:58 +00:00
|
|
|
# remove CR
|
|
|
|
$l =~ s/\r//g;
|
2005-11-14 14:24:17 +00:00
|
|
|
if($l =~ /^ *\#/) {
|
|
|
|
# skip comment
|
|
|
|
next;
|
|
|
|
}
|
2010-08-01 16:15:27 +00:00
|
|
|
|
|
|
|
# prefix $rbdir with / if needed (needed for the theme.cfg)
|
2010-08-05 14:31:07 +00:00
|
|
|
unless ($rbdir =~ m/^\/.*/) {
|
2010-08-01 16:15:27 +00:00
|
|
|
$rbdir = "/" . $rbdir;
|
|
|
|
}
|
|
|
|
|
2012-06-10 18:28:36 +00:00
|
|
|
if($l =~ /^ *<theme>/i) {
|
2005-11-18 15:33:05 +00:00
|
|
|
# undef is a unary operator (!)
|
2012-06-10 18:28:36 +00:00
|
|
|
undef $theme;
|
|
|
|
undef $has_wps;
|
|
|
|
undef $has_rwps;
|
|
|
|
undef $has_sbs;
|
|
|
|
undef $has_rsbs;
|
|
|
|
undef $has_fms;
|
|
|
|
undef $has_rfms;
|
2005-11-18 15:33:05 +00:00
|
|
|
undef $wps;
|
|
|
|
undef $rwps;
|
2009-10-19 15:28:15 +00:00
|
|
|
undef $sbs;
|
|
|
|
undef $rsbs;
|
2012-06-10 18:28:36 +00:00
|
|
|
undef $fms;
|
|
|
|
undef $rfms;
|
2008-02-23 10:03:51 +00:00
|
|
|
undef $width;
|
2005-11-18 15:33:05 +00:00
|
|
|
undef $height;
|
|
|
|
undef $font;
|
2010-06-03 07:30:01 +00:00
|
|
|
undef $remotefont;
|
2007-02-11 20:49:48 +00:00
|
|
|
undef $fgcolor;
|
|
|
|
undef $bgcolor;
|
2005-11-18 15:33:05 +00:00
|
|
|
undef $statusbar;
|
2012-06-10 18:28:36 +00:00
|
|
|
undef $remotestatusbar;
|
2005-11-18 15:33:05 +00:00
|
|
|
undef $author;
|
2008-01-18 04:00:12 +00:00
|
|
|
undef $backdrop;
|
|
|
|
undef $lineselectstart;
|
|
|
|
undef $lineselectend;
|
|
|
|
undef $selecttype;
|
|
|
|
undef $iconset;
|
2012-06-10 18:28:36 +00:00
|
|
|
undef $remoteiconset;
|
2008-01-18 04:00:12 +00:00
|
|
|
undef $viewericon;
|
2012-06-10 18:28:36 +00:00
|
|
|
undef $remoteviewericon;
|
2008-01-18 04:00:12 +00:00
|
|
|
undef $lineselecttextcolor;
|
|
|
|
undef $filetylecolor;
|
2009-08-16 22:20:11 +00:00
|
|
|
undef $listviewport;
|
|
|
|
undef $remotelistviewport;
|
2005-11-14 14:24:17 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
elsif($l =~ /^Name: *(.*)/i) {
|
|
|
|
$theme = $1;
|
|
|
|
}
|
|
|
|
elsif($l =~ /^Authors: *(.*)/i) {
|
|
|
|
$author = $1;
|
|
|
|
}
|
|
|
|
elsif ($l =~ /^WPS: *(yes|no)/i) {
|
|
|
|
$has_wps = $1;
|
|
|
|
}
|
|
|
|
elsif ($l =~ /^RWPS: *(yes|no)/i) {
|
|
|
|
$has_rwps = $1;
|
|
|
|
}
|
|
|
|
elsif ($l =~ /^SBS: *(yes|no)/i) {
|
|
|
|
$has_sbs = $1;
|
|
|
|
}
|
|
|
|
elsif ($l =~ /^RSBS: *(yes|no)/i) {
|
|
|
|
$has_rsbs = $1;
|
|
|
|
}
|
|
|
|
elsif ($l =~ /^FMS: *(yes|no)/i) {
|
|
|
|
$has_fms = $1;
|
|
|
|
}
|
|
|
|
elsif ($l =~ /^RFMS: *(yes|no)/i) {
|
|
|
|
$has_rfms = $1;
|
|
|
|
}
|
|
|
|
elsif($l =~ /^ *<main>/i) {
|
|
|
|
# parse main unit settings
|
|
|
|
while(<WPS>) {
|
|
|
|
my $l = $_;
|
|
|
|
if ($l =~ /^ *<\/main>/i) {
|
|
|
|
last;
|
2005-11-17 22:39:26 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
elsif($_ = check_res($l, "wps")) {
|
|
|
|
$wps = $_;
|
2005-11-17 22:39:26 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
elsif($_ = check_res($l, "sbs")) {
|
|
|
|
$sbs = $_;
|
2005-11-14 15:05:53 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
elsif($_ = check_res($l, "fms")) {
|
|
|
|
$fms = $_;
|
2008-02-23 10:03:51 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
elsif($_ = check_res($l, "Font")) {
|
|
|
|
$font = $_;
|
2005-11-14 15:05:53 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
elsif($_ = check_res($l, "Statusbar")) {
|
|
|
|
$statusbar = $_;
|
|
|
|
}
|
|
|
|
elsif($_ = check_res($l, "Backdrop")) {
|
|
|
|
$backdrop = $_;
|
|
|
|
}
|
|
|
|
elsif($l =~ /^Foreground Color: *(.*)/i) {
|
|
|
|
$fgcolor = $1;
|
|
|
|
}
|
|
|
|
elsif($l =~ /^Background Color: *(.*)/i) {
|
|
|
|
$bgcolor = $1;
|
|
|
|
}
|
|
|
|
elsif($l =~ /^line selector start color: *(.*)/i) {
|
|
|
|
$lineselectstart = $1;
|
|
|
|
}
|
|
|
|
elsif($l =~ /^line selector end color: *(.*)/i) {
|
|
|
|
$lineselectend = $1;
|
|
|
|
}
|
|
|
|
elsif($_ = check_res($l, "selector type")) {
|
|
|
|
$selecttype = $_;
|
|
|
|
}
|
|
|
|
elsif($_ = check_res($l, "iconset")) {
|
|
|
|
$iconset = $_;
|
|
|
|
}
|
|
|
|
elsif($_ = check_res($l, "viewers iconset")) {
|
|
|
|
$viewericon = $_;
|
|
|
|
}
|
|
|
|
elsif($l =~ /^line selector text color: *(.*)/i) {
|
|
|
|
$lineselecttextcolor = $1;
|
|
|
|
}
|
|
|
|
elsif($l =~ /^filetype colours: *(.*)/i) {
|
|
|
|
$filetylecolor = $1;
|
|
|
|
}
|
|
|
|
elsif($_ = check_res($l, "ui viewport")) {
|
|
|
|
$listviewport = $_;
|
2005-11-14 15:10:40 +00:00
|
|
|
}
|
2008-02-23 10:03:51 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
}
|
|
|
|
elsif($l =~ /^ *<remote>/i) {
|
|
|
|
while(<WPS>) {
|
|
|
|
# parse remote settings
|
|
|
|
my $l = $_;
|
|
|
|
if ($l =~ /^ *<\/remote>/i) {
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
elsif(!$has_remote) {
|
|
|
|
next; # dont parse <remote> section
|
|
|
|
}
|
|
|
|
elsif($_ = check_res($l, "rwps", 1)) {
|
|
|
|
$rwps = $_;
|
|
|
|
}
|
|
|
|
elsif($_ = check_res($l, "rsbs", 1)) {
|
|
|
|
$rsbs = $_;
|
|
|
|
}
|
|
|
|
elsif($_ = check_res($l, "rfms", 1)) {
|
|
|
|
$rfms = $_;
|
|
|
|
}
|
|
|
|
elsif($_ = check_res($l, "Font", 1)) {
|
|
|
|
$remotefont = $_;
|
|
|
|
}
|
|
|
|
elsif($_ = check_res($l, "iconset", 1)) {
|
|
|
|
$remoteiconset = $_;
|
|
|
|
}
|
|
|
|
elsif($_ = check_res($l, "viewers iconset", 1)) {
|
|
|
|
$remoteviewericon = $_;
|
|
|
|
}
|
|
|
|
elsif($_ = check_res($l, "statusbar", 1)) {
|
|
|
|
$remotestatusbar = $_;
|
|
|
|
}
|
|
|
|
elsif($_ = check_res($l, "ui viewport", 1)) {
|
|
|
|
$remotelistviewport = $_;
|
|
|
|
}
|
2008-02-23 10:03:51 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
}
|
|
|
|
elsif($l =~ /^ *<\/theme>/i) {
|
|
|
|
# for each wps,sbs,fms (+ remote variants) check if <theme>[.<model>].wps
|
|
|
|
# exists if no filename was specified in WPSLIST
|
|
|
|
my $req_skin;
|
|
|
|
|
|
|
|
if ($has_wps eq "yes" && !$wps) {
|
|
|
|
$wps = check_skinfile("wps");
|
|
|
|
} elsif ($has_wps eq "no") {
|
|
|
|
$wps = '';
|
2008-02-23 10:03:51 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
|
|
|
|
if ($has_sbs eq "yes" && !$sbs) {
|
|
|
|
$sbs = check_skinfile("sbs");
|
|
|
|
} elsif ($has_sbs eq "no") {
|
|
|
|
$sbs = '';
|
2008-02-23 10:03:51 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
|
|
|
|
if ($has_fms eq "yes" && !$fms) {
|
|
|
|
$fms = check_skinfile("fms");
|
|
|
|
} elsif ($has_fms eq "no") {
|
|
|
|
$fms = '';
|
2009-08-16 22:20:11 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
|
|
|
|
# now check for remote skin files (use main screen's extension)
|
|
|
|
if ($has_remote) {
|
|
|
|
if ($has_rwps eq "yes" && !$rwps) {
|
|
|
|
$rwps = check_skinfile("wps");
|
|
|
|
} elsif ($has_rwps eq "no") {
|
|
|
|
$rwps = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($has_rsbs eq "yes" && !$rsbs) {
|
|
|
|
$rsbs = check_skinfile("sbs");
|
|
|
|
} elsif ($has_rsbs eq "no") {
|
|
|
|
$rsbs = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($has_rfms eq "yes" && !$rfms) {
|
|
|
|
$rfms = check_skinfile("fms");
|
|
|
|
} elsif ($has_rfms eq "no") {
|
|
|
|
$rfms = '';
|
|
|
|
}
|
2009-10-19 15:28:15 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
#print "LCD: $wps wants $width x $height\n";
|
|
|
|
|
|
|
|
#
|
|
|
|
# The target model has an LCD that is suitable for this
|
|
|
|
# WPS
|
|
|
|
#
|
|
|
|
#print "Size requirement is fine!\n";
|
|
|
|
mkdirs() if (-e "$wpsdir/$theme");
|
|
|
|
# Do the copying before building the .cfg - buildcfg()
|
|
|
|
# mangles some filenames
|
|
|
|
if (defined($backdrop) && $backdrop ne "-") {
|
|
|
|
copybackdrop();
|
2012-06-25 06:54:21 +00:00
|
|
|
$backdrop = "$rbdir/" . normalize($backdrop);
|
2012-06-10 18:28:36 +00:00
|
|
|
}
|
|
|
|
foreach my $i ($iconset, $viewericon, $remoteiconset, $remoteviewericon) {
|
|
|
|
if (defined($i) && $i ne "-") {
|
|
|
|
copythemeicon($i);
|
2012-06-25 06:54:21 +00:00
|
|
|
$i = "$rbdir/$i";
|
2012-06-10 18:28:36 +00:00
|
|
|
}
|
2009-08-16 22:20:11 +00:00
|
|
|
}
|
2012-06-25 06:54:21 +00:00
|
|
|
foreach my $i ($font, $remotefont) {
|
|
|
|
if (defined($i) && $i ne "-") {
|
|
|
|
copythemefont($font);
|
|
|
|
$i = "$rbdir/fonts/$font";
|
|
|
|
}
|
2008-02-23 10:03:51 +00:00
|
|
|
}
|
2012-06-10 18:28:36 +00:00
|
|
|
buildcfg();
|
|
|
|
copywps();
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
#print "Unknown line: $l!\n";
|
2005-11-14 14:24:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-11 14:27:12 +00:00
|
|
|
close(WPS);
|