summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristi Scarborough <christi@coraline.org>2005-11-16 01:24:52 +0000
committerChristi Scarborough <christi@coraline.org>2005-11-16 01:24:52 +0000
commita7db52ca894f9d80845267f743ae56663b37f605 (patch)
tree0db798177b03ef55317467f85ea75312a76a6944
parent3be6cf15742083b9786fba52d40f61e5803db840 (diff)
downloadrockbox-a7db52ca894f9d80845267f743ae56663b37f605.tar.gz
rockbox-a7db52ca894f9d80845267f743ae56663b37f605.tar.bz2
rockbox-a7db52ca894f9d80845267f743ae56663b37f605.zip
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
-rw-r--r--apps/wps-display.c48
-rw-r--r--wps/WPSLIST20
-rwxr-xr-xwps/boxes.wps4
-rw-r--r--wps/default.wps8
-rw-r--r--wps/rockbox_default.wps2
-rwxr-xr-xwps/wpsbuild.pl4
6 files changed, 51 insertions, 35 deletions
diff --git a/apps/wps-display.c b/apps/wps-display.c
index eba36b1a8f..4647ce9b60 100644
--- a/apps/wps-display.c
+++ b/apps/wps-display.c
@@ -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);
}
diff --git a/wps/WPSLIST b/wps/WPSLIST
index 2752719b35..91d38c1ae3 100644
--- a/wps/WPSLIST
+++ b/wps/WPSLIST
@@ -1,4 +1,4 @@
-<wps>ZZ
+<wps>
# Name of the WPS _including_ extension
Name: ipodVOL.wps
# Name of the creator of the WPS
@@ -14,6 +14,15 @@ 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)
Font: rockbox_default.fnt
@@ -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>
diff --git a/wps/boxes.wps b/wps/boxes.wps
index 14734dced5..158d028e81 100755
--- a/wps/boxes.wps
+++ b/wps/boxes.wps
@@ -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> \ No newline at end of file
+%?rr<%xdA|%xdM|%xdN|%xdU|%xdV|%xdW|%xdX|%xdY|%xdZ|%xdw|%xdy>
diff --git a/wps/default.wps b/wps/default.wps
deleted file mode 100644
index 07018eea9d..0000000000
--- a/wps/default.wps
+++ /dev/null
@@ -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
diff --git a/wps/rockbox_default.wps b/wps/rockbox_default.wps
new file mode 100644
index 0000000000..b1427cab84
--- /dev/null
+++ b/wps/rockbox_default.wps
@@ -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.
diff --git a/wps/wpsbuild.pl b/wps/wpsbuild.pl
index 11856436cc..a8e325fde7 100755
--- a/wps/wpsbuild.pl
+++ b/wps/wpsbuild.pl
@@ -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";