Adds support for reverting to the Rockbox default WPS. Note that the rockbox_default.wps is a placeholder file and is never actually loaded - selecting it just causes Rockbox to clear its memory of any installed custom WPS. This means that it works cross platform. Also, small fix to boxes.wps (curse vi) and wpsbuild.pl - support for pure text WPS files.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7899 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Christi Scarborough 2005-11-16 01:24:52 +00:00
parent 3be6cf1574
commit a7db52ca89
6 changed files with 51 additions and 35 deletions

View file

@ -78,7 +78,7 @@ struct {
#endif
#define WPS_CONFIG ROCKBOX_DIR "/default.wps"
#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
#ifdef HAVE_LCD_BITMAP
#define MAX_LINES (LCD_HEIGHT/5+1)
@ -336,15 +336,36 @@ static void wps_format(const char* fmt, char *bmpdir, size_t bmpdirlen)
}
}
/* Clear the WPS image cache */
static void wps_clear(void)
{
#ifdef HAVE_LCD_BITMAP
int i;
/* reset image buffer */
img_buf_ptr = img_buf;
img_buf_free = IMG_BUFSIZE;
/* set images to unloaded and not displayed */
for (i = 0; i < MAX_IMAGES; i++) {
img[i].loaded = false;
img[i].display = false;
img[i].always_display = false;
}
#endif
}
void wps_reset(void)
{
wps_loaded = false;
memset(&format_buffer, 0, sizeof format_buffer);
wps_clear();
}
bool wps_load(const char* file, bool display)
{
int i, s;
int i,s;
char buffer[FORMAT_BUFFER_SIZE];
int fd;
size_t bmpdirlen;
@ -352,6 +373,16 @@ bool wps_load(const char* file, bool display)
char *bmpdir = strrchr(file, '.');
bmpdirlen = bmpdir - file;
/*
* Hardcode loading WPS_DEFAULTCFG to cause a reset ideally this
* wants to be a virtual file. Feel free to modify dirbrowse()
* if you're feeling brave.
*/
if (! strcmp(file, WPS_DEFAULTCFG) ) {
wps_reset();
return(false);
}
fd = open(file, O_RDONLY);
if (fd >= 0)
@ -360,18 +391,7 @@ bool wps_load(const char* file, bool display)
if (numread > 0)
{
#ifdef HAVE_LCD_BITMAP
/* reset image buffer */
img_buf_ptr = img_buf;
img_buf_free = IMG_BUFSIZE;
/* set images to unloaded and not displayed */
for (i = 0; i < MAX_IMAGES; i++) {
img[i].loaded = false;
img[i].display = false;
img[i].always_display = false;
}
#endif
wps_clear();
buffer[numread] = 0;
wps_format(buffer, (char *)file, bmpdirlen);
}

View file

@ -1,4 +1,4 @@
<wps>ZZ
<wps>
# Name of the WPS _including_ extension
Name: ipodVOL.wps
# Name of the creator of the WPS
@ -13,6 +13,15 @@ Height: 128
Width: 160
</wps>
<wps>
Name: rockbox_default.wps
Author: Rockbox team
Font: rockbox_default.fnt
Statusbar: on
Height: 2
Width: 8
</wps>
<wps>
Name: boxes.wps
Author: Christi Scarborough (after the_engineer)
@ -21,12 +30,3 @@ Statusbar: off
Height: 128
Width: 160
</wps>
<wps>
Name: default.wps
Author: Rockbox team
Font: rockbox_default.fnt
Statusbar: on
Height: 64
Width: 112
</wps>

View file

@ -1,4 +1,4 @@
x%x|a|bg.bmp|0|0|
%x|a|bg.bmp|0|0|
%xl|b|cdc-mp1.bmp|40|70|
%xl|c|cdc-mp2.bmp|40|70|
%xl|d|cdc-mp3.bmp|40|70|
@ -74,4 +74,4 @@ x%x|a|bg.bmp|0|0|
%?ps<%xdu|>
%?mh<%xdv|>
%?mr<%xdx|>
%?rr<%xdA|%xdM|%xdN|%xdU|%xdV|%xdW|%xdX|%xdY|%xdZ|%xdw|%xdy>
%?rr<%xdA|%xdM|%xdN|%xdU|%xdV|%xdW|%xdX|%xdY|%xdZ|%xdw|%xdy>

View file

@ -1,8 +0,0 @@
%s%?it<%?in<%in. |>%it|%fn>
%s%?ia<%ia|%?d2<%d2|(root)>>
%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>
%al%pc/%pt%ar[%pp:%pe]
%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>
%pb
%pm

2
wps/rockbox_default.wps Normal file
View file

@ -0,0 +1,2 @@
# Dummy file to allow Rockbox to reset to the default WPS config.
# Do not edit this file. It's never actually loaded by Rockbox.

View file

@ -88,7 +88,9 @@ sub copywps {
my $wpsdir = $wps;
$wpsdir =~ s/\.wps//;
system("cp $dir/$wps .rockbox/wps/");
system("cp $dir/$wpsdir/*.bmp .rockbox/wps/$wpsdir/");
if (-e "$dir/$wpsdir") {
system("cp $dir/$wpsdir/*.bmp .rockbox/wps/$wpsdir/");
}
}
else {
print STDERR "beep, no dir to copy WPS from!\n";