summaryrefslogtreecommitdiff
path: root/utils/wpseditor/libwps
diff options
context:
space:
mode:
Diffstat (limited to 'utils/wpseditor/libwps')
-rw-r--r--utils/wpseditor/libwps/Makefile55
-rw-r--r--utils/wpseditor/libwps/buildall.bat4
-rwxr-xr-x[-rw-r--r--]utils/wpseditor/libwps/buildall.sh2
-rw-r--r--utils/wpseditor/libwps/src/api.c36
-rw-r--r--utils/wpseditor/libwps/src/proxy.c9
-rw-r--r--utils/wpseditor/libwps/src/proxy.h6
-rw-r--r--utils/wpseditor/libwps/targets.txt24
7 files changed, 60 insertions, 76 deletions
diff --git a/utils/wpseditor/libwps/Makefile b/utils/wpseditor/libwps/Makefile
index 3779a9ed30..c5d0a39de1 100644
--- a/utils/wpseditor/libwps/Makefile
+++ b/utils/wpseditor/libwps/Makefile
@@ -13,39 +13,40 @@ CC = gcc
13MKDIR = mkdir -p 13MKDIR = mkdir -p
14 14
15ifeq ($(findstring MINGW,$(shell uname)),MINGW) 15ifeq ($(findstring MINGW,$(shell uname)),MINGW)
16OS = w32 16 OS = w32
17CC = mingw32-gcc 17 CC = mingw32-gcc
18COPY = copy 18 COPY = copy
19RM = rm 19 RM = rm
20endif 20endif
21 21
22ifeq ($(findstring Linux,$(shell uname)),Linux) 22ifeq ($(findstring Linux,$(shell uname)),Linux)
23OS = linux 23 OS = linux
24CC = gcc 24 CC = gcc
25COPY = cp 25 COPY = cp
26RM = rm -f 26 RM = rm -f
27endif 27endif
28 28
29 29
30 30
31COMMON= \ 31SOURCES= \
32 src/dummies.c \
33 src/api.c \ 32 src/api.c \
33 src/dummies.c \
34 src/lcd.c \ 34 src/lcd.c \
35 src/proxy.c \
36 $(ROOT)/apps/gui/scrollbar.c \
37 $(ROOT)/apps/gui/gwps-common.c \
35 $(ROOT)/apps/gui/wps_parser.c \ 38 $(ROOT)/apps/gui/wps_parser.c \
36 $(ROOT)/apps/gui/wps_debug.c \ 39 $(ROOT)/apps/gui/wps_debug.c \
37 $(ROOT)/firmware/font.c \
38 $(ROOT)/apps/misc.c \
39 $(ROOT)/apps/gui/gwps-common.c \
40 $(ROOT)/apps/status.c \
41 $(ROOT)/apps/recorder/peakmeter.c \ 40 $(ROOT)/apps/recorder/peakmeter.c \
42 $(ROOT)/apps/recorder/icons.c \ 41 $(ROOT)/apps/recorder/icons.c \
43 $(ROOT)/apps/gui/scrollbar.c \ 42 $(ROOT)/apps/misc.c \
43 $(ROOT)/apps/status.c \
44 $(ROOT)/firmware/common/ctype.c \
44 $(ROOT)/firmware/common/timefuncs.c \ 45 $(ROOT)/firmware/common/timefuncs.c \
45 $(ROOT)/firmware/common/unicode.c \ 46 $(ROOT)/firmware/common/unicode.c \
46 $(ROOT)/firmware/common/ctype.c \ 47 $(ROOT)/firmware/font.c \
47 $(ROOT)/firmware/id3.c \
48 $(ROOT)/firmware/font_cache.c \ 48 $(ROOT)/firmware/font_cache.c \
49 $(ROOT)/firmware/id3.c \
49 $(ROOT)/firmware/lru.c \ 50 $(ROOT)/firmware/lru.c \
50 $(ROOT)/firmware/mp3data.c \ 51 $(ROOT)/firmware/mp3data.c \
51 $(ROOT)/firmware/replaygain.c 52 $(ROOT)/firmware/replaygain.c
@@ -72,13 +73,13 @@ all:
72 73
73build: build-$(OS) 74build: build-$(OS)
74 75
75build-w32: src/proxy.c $(COMMON) 76build-w32: $(SOURCES)
76 @echo CC [$(TARGET)] 77 @echo CC [$(TARGET)]
77 @$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -DBUILD_DLL $(COMMON) -shared src/proxy.c -o libwps_$(MODEL).dll 78 @$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -DBUILD_DLL $(SOURCES) -shared -o libwps_$(MODEL).dll
78 79
79build-linux: src/proxy.c $(COMMON) 80build-linux: $(SOURCES)
80 @echo CC [$(TARGET)] 81 @echo CC [$(TARGET)]
81 @$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -shared -Wl,-soname,libwps_$(MODEL).so,-olibwps_$(MODEL).so -fPIC $(COMMON) src/proxy.c 82 @$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -shared -Wl,-soname,libwps_$(MODEL).so,-olibwps_$(MODEL).so -fPIC $(SOURCES)
82 83
83clean: clean-$(OS) 84clean: clean-$(OS)
84 85
@@ -86,15 +87,15 @@ clean-w32:
86 $(RM) "libwps_$(MODEL).dll" 87 $(RM) "libwps_$(MODEL).dll"
87 88
88clean-linux: 89clean-linux:
89 $(RM) "libwps_$(MODEL).so.1" 90 $(RM) "libwps_$(MODEL).so"
90 91
91shared: shared-$(OS) 92shared: shared-$(OS)
92 93
93shared-w32: src/proxy.c $(COMMON) 94shared-w32: $(SOURCES)
94 @echo CC [IRIVER_H10_5GB] 95 @echo CC [IRIVER_H10_5GB]
95 @$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -DBUILD_DLL $(COMMON) -shared src/proxy.c -o ../gui/bin/libwps.dll 96 @$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -DBUILD_DLL -shared $(SOURCES) -o ../gui/bin/libwps_h10_5gb.dll
96 97
97shared-linux: src/proxy.c $(COMMON) 98shared-linux: $(SOURCES)
98 @echo CC [IRIVER_H10_5GB] 99 @echo CC [IRIVER_H10_5GB]
99 @$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -shared -Wl,-soname,libwps.so,-olibwps.so -fPIC $(COMMON) src/proxy.c 100 @$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -shared -Wl,-soname,libwps_h10_5gb.so,-olibwps_h10_5gb.so -fPIC $(SOURCES)
100 @$(COPY) libwps.so ../gui/bin/libwps.so 101 @$(COPY) libwps_h10_5gb.so ../gui/bin/libwps_h10_5gb.so
diff --git a/utils/wpseditor/libwps/buildall.bat b/utils/wpseditor/libwps/buildall.bat
new file mode 100644
index 0000000000..c545453934
--- /dev/null
+++ b/utils/wpseditor/libwps/buildall.bat
@@ -0,0 +1,4 @@
1@echo off
2FOR /F "tokens=1,2* delims=, " %%i in (targets.txt) do @mingw32-make MODEL=%%j TARGET=%%i build 2>nul
3echo Copying files...
4xcopy /I /Y *.dll ..\gui\bin
diff --git a/utils/wpseditor/libwps/buildall.sh b/utils/wpseditor/libwps/buildall.sh
index 60677d22b6..0f32bb9b9a 100644..100755
--- a/utils/wpseditor/libwps/buildall.sh
+++ b/utils/wpseditor/libwps/buildall.sh
@@ -4,4 +4,6 @@ cat targets.txt | (
4 do 4 do
5 make MODEL=$model TARGET=$target build 5 make MODEL=$model TARGET=$target build
6 done 6 done
7 cp *.dll ../gui/bin
8 cp *.so ../gui/bin
7) 9)
diff --git a/utils/wpseditor/libwps/src/api.c b/utils/wpseditor/libwps/src/api.c
index 485efa8e00..89538423b4 100644
--- a/utils/wpseditor/libwps/src/api.c
+++ b/utils/wpseditor/libwps/src/api.c
@@ -32,8 +32,7 @@ bool load_remote_wps_backdrop(char* filename) {
32} 32}
33 33
34int read_bmp_file(const char* filename,struct bitmap *bm, int maxsize,int format) { 34int read_bmp_file(const char* filename,struct bitmap *bm, int maxsize,int format) {
35 if (!xapi->read_bmp_file) 35 if (!xapi->read_bmp_file) {
36 {
37 DEBUGF1("can't read bmp file! NULL api!\n"); 36 DEBUGF1("can't read bmp file! NULL api!\n");
38 return -1; 37 return -1;
39 } 38 }
@@ -84,7 +83,7 @@ int getstringsize(const unsigned char *str, int *w, int *h) {
84 return 1; 83 return 1;
85} 84}
86 85
87void set_wpsstate(struct wpsstate state){ 86void set_wpsstate(struct wpsstate state) {
88 sysfont.height = state.fontheight; 87 sysfont.height = state.fontheight;
89 sysfont.maxwidth = state.fontwidth; 88 sysfont.maxwidth = state.fontwidth;
90 global_settings.volume = state.volume; 89 global_settings.volume = state.volume;
@@ -92,7 +91,10 @@ void set_wpsstate(struct wpsstate state){
92 _audio_status = state.audio_status; 91 _audio_status = state.audio_status;
93} 92}
94 93
95void set_trackstate(struct trackstate state){ 94void set_trackstate(struct trackstate state) {
95 if (!(gui_wps[0].state) ||
96 !(gui_wps[0].state->id3))
97 return;
96 gui_wps[0].state->id3->title = state.title; 98 gui_wps[0].state->id3->title = state.title;
97 gui_wps[0].state->id3->artist = state.artist; 99 gui_wps[0].state->id3->artist = state.artist;
98 gui_wps[0].state->id3->album = state.album; 100 gui_wps[0].state->id3->album = state.album;
@@ -100,8 +102,7 @@ void set_trackstate(struct trackstate state){
100 gui_wps[0].state->id3->length = state.length; 102 gui_wps[0].state->id3->length = state.length;
101} 103}
102 104
103void set_next_trackstate(struct trackstate state) 105void set_next_trackstate(struct trackstate state) {
104{
105 gui_wps[0].state->nid3->title = state.title; 106 gui_wps[0].state->nid3->title = state.title;
106 gui_wps[0].state->nid3->artist = state.artist; 107 gui_wps[0].state->nid3->artist = state.artist;
107 gui_wps[0].state->nid3->album = state.album; 108 gui_wps[0].state->nid3->album = state.album;
@@ -110,21 +111,21 @@ void set_next_trackstate(struct trackstate state)
110} 111}
111 112
112enum api_playmode playmodes[PLAYMODES_NUM] = { 113enum api_playmode playmodes[PLAYMODES_NUM] = {
113 API_STATUS_PLAY, 114 API_STATUS_PLAY,
114 API_STATUS_STOP, 115 API_STATUS_STOP,
115 API_STATUS_PAUSE, 116 API_STATUS_PAUSE,
116 API_STATUS_FASTFORWARD, 117 API_STATUS_FASTFORWARD,
117 API_STATUS_FASTBACKWARD 118 API_STATUS_FASTBACKWARD
118}; 119 };
119 120
120const char *playmodeNames[] = { 121const char *playmodeNames[] = {
121 "Play", "Stop", "Pause", "FastForward", "FastBackward" 122 "Play", "Stop", "Pause", "FastForward", "FastBackward"
122}; 123 };
123 124
124 125
125void set_audio_status(int status){ 126void set_audio_status(int status) {
126 DEBUGF1("%s",playmodeNames[status]); 127 DEBUGF1("%s",playmodeNames[status]);
127 switch(status){ 128 switch (status) {
128 case API_STATUS_PLAY: 129 case API_STATUS_PLAY:
129 _audio_status = AUDIO_STATUS_PLAY; 130 _audio_status = AUDIO_STATUS_PLAY;
130 status_set_ffmode(STATUS_PLAY); 131 status_set_ffmode(STATUS_PLAY);
@@ -203,8 +204,6 @@ int set_api(struct proxy_api* api) {
203#else 204#else
204 screens[0].is_color=false; 205 screens[0].is_color=false;
205#endif 206#endif
206 if (api->getwidth)
207 screens[0].getwidth = api->getwidth;
208 if (api->stop_scroll) 207 if (api->stop_scroll)
209 screens[0].stop_scroll=api->stop_scroll; 208 screens[0].stop_scroll=api->stop_scroll;
210 screens[0].scroll_stop = lcd_scroll_stop; 209 screens[0].scroll_stop = lcd_scroll_stop;
@@ -266,3 +265,4 @@ int set_api(struct proxy_api* api) {
266 265
267 266
268 267
268
diff --git a/utils/wpseditor/libwps/src/proxy.c b/utils/wpseditor/libwps/src/proxy.c
index 3a3b8ce4d9..8f9218e3ff 100644
--- a/utils/wpseditor/libwps/src/proxy.c
+++ b/utils/wpseditor/libwps/src/proxy.c
@@ -69,7 +69,7 @@ void* plugin_get_buffer(size_t *buffer_size)
69int checkwps(const char *filename, int verbose){ 69int checkwps(const char *filename, int verbose){
70 int res; 70 int res;
71 int fd; 71 int fd;
72 72
73 struct wps_data wps; 73 struct wps_data wps;
74 wps_verbose_level = verbose; 74 wps_verbose_level = verbose;
75 75
@@ -104,9 +104,8 @@ int wps_init(const char* filename,struct proxy_api *api, bool isfile){
104 if (!res) 104 if (!res)
105 { 105 {
106 DEBUGF1("ERR: WPS parsing failure\n"); 106 DEBUGF1("ERR: WPS parsing failure\n");
107 return 3; 107 } else
108 } 108 DEBUGF1("WPS parsed OK\n");
109 DEBUGF1("WPS parsed OK\n");
110 DEBUGF1("\n-------------------------------------------------\n"); 109 DEBUGF1("\n-------------------------------------------------\n");
111 wps_state.paused = true; 110 wps_state.paused = true;
112 gwps.data = &wpsdata; 111 gwps.data = &wpsdata;
@@ -115,7 +114,7 @@ int wps_init(const char* filename,struct proxy_api *api, bool isfile){
115 gwps.state->id3 = &id3; 114 gwps.state->id3 = &id3;
116 gwps.state->nid3 = &nid3; 115 gwps.state->nid3 = &nid3;
117 gui_wps[0] = gwps; 116 gui_wps[0] = gwps;
118 return res; 117 return (res?res:3);
119} 118}
120 119
121int wps_display(){ 120int wps_display(){
diff --git a/utils/wpseditor/libwps/src/proxy.h b/utils/wpseditor/libwps/src/proxy.h
index 3836ecc6d0..df0abd3c3e 100644
--- a/utils/wpseditor/libwps/src/proxy.h
+++ b/utils/wpseditor/libwps/src/proxy.h
@@ -1,6 +1,8 @@
1#ifndef PROXY_H 1#ifndef PROXY_H
2#define PROXY_h 2#define PROXY_h
3 3
4#include <stdio.h>
5
4#include "screen_access.h" 6#include "screen_access.h"
5#include "api.h" 7#include "api.h"
6#include "defs.h" 8#include "defs.h"
@@ -9,13 +11,13 @@
9#define DEBUGF1 dbgf 11#define DEBUGF1 dbgf
10#define DEBUGF2(...) 12#define DEBUGF2(...)
11#define DEBUGF3(...) 13#define DEBUGF3(...)
14#define DEBUGF4(...)
12 15
13EXPORT int checkwps(const char *filename, int verbose); 16EXPORT int checkwps(const char *filename, int verbose);
14EXPORT int wps_init(const char* filename,struct proxy_api *api,bool isfile); 17EXPORT int wps_init(const char* filename,struct proxy_api *api,bool isfile);
15EXPORT int wps_display(); 18EXPORT int wps_display();
16EXPORT int wps_refresh(); 19EXPORT int wps_refresh();
17 20EXPORT const char* get_model_name();
18const char* get_model_name();
19 21
20extern struct screen screens[NB_SCREENS]; 22extern struct screen screens[NB_SCREENS];
21extern bool debug_wps; 23extern bool debug_wps;
diff --git a/utils/wpseditor/libwps/targets.txt b/utils/wpseditor/libwps/targets.txt
index d2c54378d9..547a2ba42c 100644
--- a/utils/wpseditor/libwps/targets.txt
+++ b/utils/wpseditor/libwps/targets.txt
@@ -1,33 +1,9 @@
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 1IRIVER_H10 h10
11IRIVER_H10_5GB h10_5gb 2IRIVER_H10_5GB h10_5gb
12IPOD_COLOR ipodcolor 3IPOD_COLOR ipodcolor
13IPOD_NANO ipodnano 4IPOD_NANO ipodnano
14IPOD_VIDEO ipodvideo 5IPOD_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 6GIGABEAT_F gigabeatf
25GIGABEAT_S gigabeats 7GIGABEAT_S gigabeats
26MROBE_500 mrobe500
27MROBE_100 mrobe100
28LOGIK_DAX logikdax
29CREATIVE_ZVM creativezvm
30SANSA_E200 e200 8SANSA_E200 e200
31SANSA_E200 e200r
32SANSA_C200 c200 9SANSA_C200 c200
33ELIO_TPJ1022 tpj1022