summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 {
78 78
79#endif 79#endif
80 80
81#define WPS_CONFIG ROCKBOX_DIR "/default.wps" 81#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
82 82
83#ifdef HAVE_LCD_BITMAP 83#ifdef HAVE_LCD_BITMAP
84#define MAX_LINES (LCD_HEIGHT/5+1) 84#define MAX_LINES (LCD_HEIGHT/5+1)
@@ -336,15 +336,36 @@ static void wps_format(const char* fmt, char *bmpdir, size_t bmpdirlen)
336 } 336 }
337} 337}
338 338
339/* Clear the WPS image cache */
340static void wps_clear(void)
341{
342#ifdef HAVE_LCD_BITMAP
343 int i;
344
345 /* reset image buffer */
346 img_buf_ptr = img_buf;
347 img_buf_free = IMG_BUFSIZE;
348
349 /* set images to unloaded and not displayed */
350 for (i = 0; i < MAX_IMAGES; i++) {
351 img[i].loaded = false;
352 img[i].display = false;
353 img[i].always_display = false;
354 }
355#endif
356
357}
358
339void wps_reset(void) 359void wps_reset(void)
340{ 360{
341 wps_loaded = false; 361 wps_loaded = false;
342 memset(&format_buffer, 0, sizeof format_buffer); 362 memset(&format_buffer, 0, sizeof format_buffer);
363 wps_clear();
343} 364}
344 365
345bool wps_load(const char* file, bool display) 366bool wps_load(const char* file, bool display)
346{ 367{
347 int i, s; 368 int i,s;
348 char buffer[FORMAT_BUFFER_SIZE]; 369 char buffer[FORMAT_BUFFER_SIZE];
349 int fd; 370 int fd;
350 size_t bmpdirlen; 371 size_t bmpdirlen;
@@ -352,6 +373,16 @@ bool wps_load(const char* file, bool display)
352 char *bmpdir = strrchr(file, '.'); 373 char *bmpdir = strrchr(file, '.');
353 bmpdirlen = bmpdir - file; 374 bmpdirlen = bmpdir - file;
354 375
376 /*
377 * Hardcode loading WPS_DEFAULTCFG to cause a reset ideally this
378 * wants to be a virtual file. Feel free to modify dirbrowse()
379 * if you're feeling brave.
380 */
381 if (! strcmp(file, WPS_DEFAULTCFG) ) {
382 wps_reset();
383 return(false);
384 }
385
355 fd = open(file, O_RDONLY); 386 fd = open(file, O_RDONLY);
356 387
357 if (fd >= 0) 388 if (fd >= 0)
@@ -360,18 +391,7 @@ bool wps_load(const char* file, bool display)
360 391
361 if (numread > 0) 392 if (numread > 0)
362 { 393 {
363#ifdef HAVE_LCD_BITMAP 394 wps_clear();
364 /* reset image buffer */
365 img_buf_ptr = img_buf;
366 img_buf_free = IMG_BUFSIZE;
367
368 /* set images to unloaded and not displayed */
369 for (i = 0; i < MAX_IMAGES; i++) {
370 img[i].loaded = false;
371 img[i].display = false;
372 img[i].always_display = false;
373 }
374#endif
375 buffer[numread] = 0; 395 buffer[numread] = 0;
376 wps_format(buffer, (char *)file, bmpdirlen); 396 wps_format(buffer, (char *)file, bmpdirlen);
377 } 397 }
diff --git a/wps/WPSLIST b/wps/WPSLIST
index 2752719b35..91d38c1ae3 100644
--- a/wps/WPSLIST
+++ b/wps/WPSLIST
@@ -1,4 +1,4 @@
1<wps>ZZ 1<wps>
2# Name of the WPS _including_ extension 2# Name of the WPS _including_ extension
3Name: ipodVOL.wps 3Name: ipodVOL.wps
4# Name of the creator of the WPS 4# Name of the creator of the WPS
@@ -14,6 +14,15 @@ Width: 160
14</wps> 14</wps>
15 15
16<wps> 16<wps>
17Name: rockbox_default.wps
18Author: Rockbox team
19Font: rockbox_default.fnt
20Statusbar: on
21Height: 2
22Width: 8
23</wps>
24
25<wps>
17Name: boxes.wps 26Name: boxes.wps
18Author: Christi Scarborough (after the_engineer) 27Author: Christi Scarborough (after the_engineer)
19Font: rockbox_default.fnt 28Font: rockbox_default.fnt
@@ -21,12 +30,3 @@ Statusbar: off
21Height: 128 30Height: 128
22Width: 160 31Width: 160
23</wps> 32</wps>
24
25<wps>
26Name: default.wps
27Author: Rockbox team
28Font: rockbox_default.fnt
29Statusbar: on
30Height: 64
31Width: 112
32</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 @@
1x%x|a|bg.bmp|0|0| 1%x|a|bg.bmp|0|0|
2%xl|b|cdc-mp1.bmp|40|70| 2%xl|b|cdc-mp1.bmp|40|70|
3%xl|c|cdc-mp2.bmp|40|70| 3%xl|c|cdc-mp2.bmp|40|70|
4%xl|d|cdc-mp3.bmp|40|70| 4%xl|d|cdc-mp3.bmp|40|70|
@@ -74,4 +74,4 @@ x%x|a|bg.bmp|0|0|
74%?ps<%xdu|> 74%?ps<%xdu|>
75%?mh<%xdv|> 75%?mh<%xdv|>
76%?mr<%xdx|> 76%?mr<%xdx|>
77%?rr<%xdA|%xdM|%xdN|%xdU|%xdV|%xdW|%xdX|%xdY|%xdZ|%xdw|%xdy> \ No newline at end of file 77%?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 @@
1%s%?it<%?in<%in. |>%it|%fn>
2%s%?ia<%ia|%?d2<%d2|(root)>>
3%s%?id<%id|%?d1<%d1|(root)>> %?iy<(%iy)|>
4
5%al%pc/%pt%ar[%pp:%pe]
6%fbkBit %?fv<avg|> %?iv<(id3v%iv)|(no id3)>
7%pb
8%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 @@
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.
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 {
88 my $wpsdir = $wps; 88 my $wpsdir = $wps;
89 $wpsdir =~ s/\.wps//; 89 $wpsdir =~ s/\.wps//;
90 system("cp $dir/$wps .rockbox/wps/"); 90 system("cp $dir/$wps .rockbox/wps/");
91 system("cp $dir/$wpsdir/*.bmp .rockbox/wps/$wpsdir/"); 91 if (-e "$dir/$wpsdir") {
92 system("cp $dir/$wpsdir/*.bmp .rockbox/wps/$wpsdir/");
93 }
92 } 94 }
93 else { 95 else {
94 print STDERR "beep, no dir to copy WPS from!\n"; 96 print STDERR "beep, no dir to copy WPS from!\n";