summaryrefslogtreecommitdiff
path: root/tools/checkwps
diff options
context:
space:
mode:
Diffstat (limited to 'tools/checkwps')
-rw-r--r--tools/checkwps/Makefile25
-rw-r--r--tools/checkwps/README23
-rwxr-xr-xtools/checkwps/buildall.sh8
-rw-r--r--tools/checkwps/checkwps.c28
-rwxr-xr-xtools/checkwps/cleanall.sh7
-rw-r--r--tools/checkwps/file.h7
-rw-r--r--tools/checkwps/targets.txt33
7 files changed, 118 insertions, 13 deletions
diff --git a/tools/checkwps/Makefile b/tools/checkwps/Makefile
index 70b6e0a963..069b1e4334 100644
--- a/tools/checkwps/Makefile
+++ b/tools/checkwps/Makefile
@@ -7,12 +7,25 @@
7# $Id$ 7# $Id$
8# 8#
9 9
10all: checkwps 10ROOT=../..
11 11
12checkwps: checkwps.c ../../apps/gui/wps_parser.c ../../apps/gui/wps_debug.c ../../firmware/common/ctype.c ../../apps/misc.c ../../apps/recorder/bmp.c 12COMMON=$(ROOT)/apps/gui/wps_parser.c \
13 $(SILENT)$(CC) -g -I ../../apps/gui -I../../firmware/export \ 13 $(ROOT)/apps/gui/wps_debug.c \
14-D__PCTOOL__ -DDEBUG -DROCKBOX_HAS_LOGF -DIPOD_COLOR -D ROCKBOX_DIR_LEN -D WPS_DIR=\".\" \ 14 $(ROOT)/apps/misc.c \
15-I../../apps -I../../firmware/target/arm/ipod -I../../firmware/include $+ -o $@ 15 $(ROOT)/apps/recorder/bmp.c
16
17INCLUDE=-I $(ROOT)/apps/gui \
18 -I $(ROOT)/firmware/export \
19 -I $(ROOT)/apps \
20 -I .
21
22CFLAGS = -g -D__PCTOOL__ -DDEBUG -DROCKBOX_DIR_LEN=9 -DWPS_DIR=\".\"
23
24all: checkwps.$(MODEL)
25
26checkwps.$(MODEL): checkwps.c $(COMMON)
27 @echo CC [$(TARGET)]
28 @$(CC) $(INCLUDE) $(CFLAGS) $(COMMON) -D$(TARGET) checkwps.c -o $@
16 29
17clean: 30clean:
18 rm -f cleanwps 31 rm -f checkwps.$(MODEL)
diff --git a/tools/checkwps/README b/tools/checkwps/README
new file mode 100644
index 0000000000..a94882fdff
--- /dev/null
+++ b/tools/checkwps/README
@@ -0,0 +1,23 @@
1This directory contains the checkwps tool which can be used to
2validate wps files outside of Rockbox.
3
4checkwps uses the Rockbox WPS parser and is therefore built in
5target-specific versions (to avoid making lots of changes to the core
6code).
7
8To compile
9----------
10
11Just run the ./buildall.sh script
12
13
14To remove all compiled files
15----------------------------
16
17./cleanall.sh
18
19
20To add a new target
21-------------------
22
23Add $target and $modelname from tools/configure to targets.txt
diff --git a/tools/checkwps/buildall.sh b/tools/checkwps/buildall.sh
new file mode 100755
index 0000000000..faec663ab8
--- /dev/null
+++ b/tools/checkwps/buildall.sh
@@ -0,0 +1,8 @@
1#!/bin/sh
2cat targets.txt | (
3 while read target model
4 do
5 rm -f checkwps.$model
6 make MODEL=$model TARGET=$target
7 done
8)
diff --git a/tools/checkwps/checkwps.c b/tools/checkwps/checkwps.c
index ddaaf49b73..1051244538 100644
--- a/tools/checkwps/checkwps.c
+++ b/tools/checkwps/checkwps.c
@@ -1,5 +1,7 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <stdlib.h> 2#include <stdlib.h>
3#include <fcntl.h>
4#include "config.h"
3#include "gwps.h" 5#include "gwps.h"
4 6
5#define MIN(x,y) ((x) > (y) ? (y) : (x)) 7#define MIN(x,y) ((x) > (y) ? (y) : (x))
@@ -20,7 +22,7 @@ int errno;
20unsigned short letoh16(unsigned short x) 22unsigned short letoh16(unsigned short x)
21{ 23{
22 unsigned short n = 0x1234; 24 unsigned short n = 0x1234;
23 unsigned char* ch = &n; 25 unsigned char* ch = (unsigned char*)&n;
24 26
25 if (*ch == 0x34) 27 if (*ch == 0x34)
26 { 28 {
@@ -34,7 +36,7 @@ unsigned short letoh16(unsigned short x)
34unsigned int htole32(unsigned int x) 36unsigned int htole32(unsigned int x)
35{ 37{
36 unsigned short n = 0x1234; 38 unsigned short n = 0x1234;
37 unsigned char* ch = &n; 39 unsigned char* ch = (unsigned char*)&n;
38 40
39 if (*ch == 0x34) 41 if (*ch == 0x34)
40 { 42 {
@@ -80,6 +82,11 @@ bool load_wps_backdrop(char* filename)
80 return true; 82 return true;
81} 83}
82 84
85bool load_remote_wps_backdrop(char* filename)
86{
87 return true;
88}
89
83static char pluginbuf[PLUGIN_BUFFER_SIZE]; 90static char pluginbuf[PLUGIN_BUFFER_SIZE];
84 91
85static int dummy_func1(void) 92static int dummy_func1(void)
@@ -105,12 +112,17 @@ struct screen screens[NB_SCREENS] =
105 .width=LCD_WIDTH, 112 .width=LCD_WIDTH,
106 .height=LCD_HEIGHT, 113 .height=LCD_HEIGHT,
107 .depth=LCD_DEPTH, 114 .depth=LCD_DEPTH,
115#ifdef HAVE_LCD_COLOR
108 .is_color=true, 116 .is_color=true,
109 .has_disk_led=false, 117#else
118 .is_color=false,
119#endif
110 .getxmargin=dummy_func1, 120 .getxmargin=dummy_func1,
111 .getymargin=dummy_func1, 121 .getymargin=dummy_func1,
122#if LCD_DEPTH > 1
112 .get_foreground=dummy_func2, 123 .get_foreground=dummy_func2,
113 .get_background=dummy_func2, 124 .get_background=dummy_func2,
125#endif
114 }, 126 },
115#ifdef HAVE_REMOTE_LCD 127#ifdef HAVE_REMOTE_LCD
116 { 128 {
@@ -119,10 +131,12 @@ struct screen screens[NB_SCREENS] =
119 .height=LCD_REMOTE_HEIGHT, 131 .height=LCD_REMOTE_HEIGHT,
120 .depth=LCD_REMOTE_DEPTH, 132 .depth=LCD_REMOTE_DEPTH,
121 .is_color=false,/* No color remotes yet */ 133 .is_color=false,/* No color remotes yet */
122 .getxmargin=dummy_func, 134 .getxmargin=dummy_func1,
123 .getymargin=dummy_func, 135 .getymargin=dummy_func1,
124 .get_foreground=dummy_func, 136#if LCD_REMOTE_DEPTH > 1
125 .get_background=dummy_func, 137 .get_foreground=dummy_func2,
138 .get_background=dummy_func2,
139#endif
126 } 140 }
127#endif 141#endif
128}; 142};
diff --git a/tools/checkwps/cleanall.sh b/tools/checkwps/cleanall.sh
new file mode 100755
index 0000000000..6cd1a90676
--- /dev/null
+++ b/tools/checkwps/cleanall.sh
@@ -0,0 +1,7 @@
1#!/bin/sh
2cat targets.txt | (
3 while read target model
4 do
5 rm -f checkwps.$model
6 done
7)
diff --git a/tools/checkwps/file.h b/tools/checkwps/file.h
new file mode 100644
index 0000000000..4256c1ee37
--- /dev/null
+++ b/tools/checkwps/file.h
@@ -0,0 +1,7 @@
1#ifndef MAX_PATH
2#define MAX_PATH 260
3#endif
4
5/* Wrapper - required for O_RDONLY */
6
7#include <fcntl.h>
diff --git a/tools/checkwps/targets.txt b/tools/checkwps/targets.txt
new file mode 100644
index 0000000000..d2c54378d9
--- /dev/null
+++ b/tools/checkwps/targets.txt
@@ -0,0 +1,33 @@
1ARCHOS_RECORDER recorder
2ARCHOS_FMRECORDER fmrecorder
3ARCHOS_RECORDERV2 recorderv2
4ARCHOS_ONDIOSP ondiosp
5ARCHOS_ONDIOFM ondiofm
6IRIVER_H120 h120
7IRIVER_H300 h300
8IRIVER_H100 h100
9IRIVER_IFP7XX ifp7xx
10IRIVER_H10 h10
11IRIVER_H10_5GB h10_5gb
12IPOD_COLOR ipodcolor
13IPOD_NANO ipodnano
14IPOD_VIDEO ipodvideo
15IPOD_3G ipod3g
16IPOD_4G ipod4g
17IPOD_MINI ipodmini
18IPOD_MINI2G ipodmini2g
19IPOD_1G2G ipod1g2g
20IAUDIO_X5 x5
21IAUDIO_M5 m5
22COWON_D2 cowond2
23IAUDIO_M3 m3
24GIGABEAT_F gigabeatf
25GIGABEAT_S gigabeats
26MROBE_500 mrobe500
27MROBE_100 mrobe100
28LOGIK_DAX logikdax
29CREATIVE_ZVM creativezvm
30SANSA_E200 e200
31SANSA_E200 e200r
32SANSA_C200 c200
33ELIO_TPJ1022 tpj1022