From 254fa65c7b75f61147186d9f9146b89ee11b2b26 Mon Sep 17 00:00:00 2001 From: Dominik Wenger Date: Wed, 3 Sep 2008 19:24:50 +0000 Subject: WpsEditor: commit FS#9344 by Rostislav Chekan - multitarget support (only colour targets for now) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18399 a1c6a512-1295-4272-9138-f99709370657 --- utils/wpseditor/libwps/Makefile | 55 +++++++++++++++++++------------------ utils/wpseditor/libwps/buildall.bat | 4 +++ utils/wpseditor/libwps/buildall.sh | 2 ++ utils/wpseditor/libwps/src/api.c | 36 ++++++++++++------------ utils/wpseditor/libwps/src/proxy.c | 9 +++--- utils/wpseditor/libwps/src/proxy.h | 6 ++-- utils/wpseditor/libwps/targets.txt | 24 ---------------- 7 files changed, 60 insertions(+), 76 deletions(-) create mode 100644 utils/wpseditor/libwps/buildall.bat mode change 100644 => 100755 utils/wpseditor/libwps/buildall.sh (limited to 'utils/wpseditor/libwps') 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 MKDIR = mkdir -p ifeq ($(findstring MINGW,$(shell uname)),MINGW) -OS = w32 -CC = mingw32-gcc -COPY = copy -RM = rm + OS = w32 + CC = mingw32-gcc + COPY = copy + RM = rm endif ifeq ($(findstring Linux,$(shell uname)),Linux) -OS = linux -CC = gcc -COPY = cp -RM = rm -f + OS = linux + CC = gcc + COPY = cp + RM = rm -f endif -COMMON= \ - src/dummies.c \ +SOURCES= \ src/api.c \ + src/dummies.c \ src/lcd.c \ + src/proxy.c \ + $(ROOT)/apps/gui/scrollbar.c \ + $(ROOT)/apps/gui/gwps-common.c \ $(ROOT)/apps/gui/wps_parser.c \ $(ROOT)/apps/gui/wps_debug.c \ - $(ROOT)/firmware/font.c \ - $(ROOT)/apps/misc.c \ - $(ROOT)/apps/gui/gwps-common.c \ - $(ROOT)/apps/status.c \ $(ROOT)/apps/recorder/peakmeter.c \ $(ROOT)/apps/recorder/icons.c \ - $(ROOT)/apps/gui/scrollbar.c \ + $(ROOT)/apps/misc.c \ + $(ROOT)/apps/status.c \ + $(ROOT)/firmware/common/ctype.c \ $(ROOT)/firmware/common/timefuncs.c \ $(ROOT)/firmware/common/unicode.c \ - $(ROOT)/firmware/common/ctype.c \ - $(ROOT)/firmware/id3.c \ + $(ROOT)/firmware/font.c \ $(ROOT)/firmware/font_cache.c \ + $(ROOT)/firmware/id3.c \ $(ROOT)/firmware/lru.c \ $(ROOT)/firmware/mp3data.c \ $(ROOT)/firmware/replaygain.c @@ -72,13 +73,13 @@ all: build: build-$(OS) -build-w32: src/proxy.c $(COMMON) +build-w32: $(SOURCES) @echo CC [$(TARGET)] - @$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -DBUILD_DLL $(COMMON) -shared src/proxy.c -o libwps_$(MODEL).dll + @$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -DBUILD_DLL $(SOURCES) -shared -o libwps_$(MODEL).dll -build-linux: src/proxy.c $(COMMON) +build-linux: $(SOURCES) @echo CC [$(TARGET)] - @$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -shared -Wl,-soname,libwps_$(MODEL).so,-olibwps_$(MODEL).so -fPIC $(COMMON) src/proxy.c + @$(CC) $(INCLUDE) $(CFLAGS) -D$(TARGET) -DTARGET_MODEL=\"$(MODEL)\" -shared -Wl,-soname,libwps_$(MODEL).so,-olibwps_$(MODEL).so -fPIC $(SOURCES) clean: clean-$(OS) @@ -86,15 +87,15 @@ clean-w32: $(RM) "libwps_$(MODEL).dll" clean-linux: - $(RM) "libwps_$(MODEL).so.1" + $(RM) "libwps_$(MODEL).so" shared: shared-$(OS) -shared-w32: src/proxy.c $(COMMON) +shared-w32: $(SOURCES) @echo CC [IRIVER_H10_5GB] - @$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -DBUILD_DLL $(COMMON) -shared src/proxy.c -o ../gui/bin/libwps.dll + @$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -DBUILD_DLL -shared $(SOURCES) -o ../gui/bin/libwps_h10_5gb.dll -shared-linux: src/proxy.c $(COMMON) +shared-linux: $(SOURCES) @echo CC [IRIVER_H10_5GB] - @$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -shared -Wl,-soname,libwps.so,-olibwps.so -fPIC $(COMMON) src/proxy.c - @$(COPY) libwps.so ../gui/bin/libwps.so + @$(CC) $(INCLUDE) $(CFLAGS) -DIRIVER_H10_5GB -DTARGET_MODEL=\"h10_5gb\" -shared -Wl,-soname,libwps_h10_5gb.so,-olibwps_h10_5gb.so -fPIC $(SOURCES) + @$(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 @@ +@echo off +FOR /F "tokens=1,2* delims=, " %%i in (targets.txt) do @mingw32-make MODEL=%%j TARGET=%%i build 2>nul +echo Copying files... +xcopy /I /Y *.dll ..\gui\bin diff --git a/utils/wpseditor/libwps/buildall.sh b/utils/wpseditor/libwps/buildall.sh old mode 100644 new mode 100755 index 60677d22b6..0f32bb9b9a --- a/utils/wpseditor/libwps/buildall.sh +++ b/utils/wpseditor/libwps/buildall.sh @@ -4,4 +4,6 @@ cat targets.txt | ( do make MODEL=$model TARGET=$target build done + cp *.dll ../gui/bin + cp *.so ../gui/bin ) 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) { } int read_bmp_file(const char* filename,struct bitmap *bm, int maxsize,int format) { - if (!xapi->read_bmp_file) - { + if (!xapi->read_bmp_file) { DEBUGF1("can't read bmp file! NULL api!\n"); return -1; } @@ -84,7 +83,7 @@ int getstringsize(const unsigned char *str, int *w, int *h) { return 1; } -void set_wpsstate(struct wpsstate state){ +void set_wpsstate(struct wpsstate state) { sysfont.height = state.fontheight; sysfont.maxwidth = state.fontwidth; global_settings.volume = state.volume; @@ -92,7 +91,10 @@ void set_wpsstate(struct wpsstate state){ _audio_status = state.audio_status; } -void set_trackstate(struct trackstate state){ +void set_trackstate(struct trackstate state) { + if (!(gui_wps[0].state) || + !(gui_wps[0].state->id3)) + return; gui_wps[0].state->id3->title = state.title; gui_wps[0].state->id3->artist = state.artist; gui_wps[0].state->id3->album = state.album; @@ -100,8 +102,7 @@ void set_trackstate(struct trackstate state){ gui_wps[0].state->id3->length = state.length; } -void set_next_trackstate(struct trackstate state) -{ +void set_next_trackstate(struct trackstate state) { gui_wps[0].state->nid3->title = state.title; gui_wps[0].state->nid3->artist = state.artist; gui_wps[0].state->nid3->album = state.album; @@ -110,21 +111,21 @@ void set_next_trackstate(struct trackstate state) } enum api_playmode playmodes[PLAYMODES_NUM] = { - API_STATUS_PLAY, - API_STATUS_STOP, - API_STATUS_PAUSE, - API_STATUS_FASTFORWARD, - API_STATUS_FASTBACKWARD -}; + API_STATUS_PLAY, + API_STATUS_STOP, + API_STATUS_PAUSE, + API_STATUS_FASTFORWARD, + API_STATUS_FASTBACKWARD + }; const char *playmodeNames[] = { - "Play", "Stop", "Pause", "FastForward", "FastBackward" -}; + "Play", "Stop", "Pause", "FastForward", "FastBackward" + }; -void set_audio_status(int status){ +void set_audio_status(int status) { DEBUGF1("%s",playmodeNames[status]); - switch(status){ + switch (status) { case API_STATUS_PLAY: _audio_status = AUDIO_STATUS_PLAY; status_set_ffmode(STATUS_PLAY); @@ -203,8 +204,6 @@ int set_api(struct proxy_api* api) { #else screens[0].is_color=false; #endif - if (api->getwidth) - screens[0].getwidth = api->getwidth; if (api->stop_scroll) screens[0].stop_scroll=api->stop_scroll; screens[0].scroll_stop = lcd_scroll_stop; @@ -266,3 +265,4 @@ int set_api(struct proxy_api* api) { + 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) int checkwps(const char *filename, int verbose){ int res; int fd; - + struct wps_data wps; wps_verbose_level = verbose; @@ -104,9 +104,8 @@ int wps_init(const char* filename,struct proxy_api *api, bool isfile){ if (!res) { DEBUGF1("ERR: WPS parsing failure\n"); - return 3; - } - DEBUGF1("WPS parsed OK\n"); + } else + DEBUGF1("WPS parsed OK\n"); DEBUGF1("\n-------------------------------------------------\n"); wps_state.paused = true; gwps.data = &wpsdata; @@ -115,7 +114,7 @@ int wps_init(const char* filename,struct proxy_api *api, bool isfile){ gwps.state->id3 = &id3; gwps.state->nid3 = &nid3; gui_wps[0] = gwps; - return res; + return (res?res:3); } int 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 @@ #ifndef PROXY_H #define PROXY_h +#include + #include "screen_access.h" #include "api.h" #include "defs.h" @@ -9,13 +11,13 @@ #define DEBUGF1 dbgf #define DEBUGF2(...) #define DEBUGF3(...) +#define DEBUGF4(...) EXPORT int checkwps(const char *filename, int verbose); EXPORT int wps_init(const char* filename,struct proxy_api *api,bool isfile); EXPORT int wps_display(); EXPORT int wps_refresh(); - -const char* get_model_name(); +EXPORT const char* get_model_name(); extern struct screen screens[NB_SCREENS]; extern 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 @@ -ARCHOS_RECORDER recorder -ARCHOS_FMRECORDER fmrecorder -ARCHOS_RECORDERV2 recorderv2 -ARCHOS_ONDIOSP ondiosp -ARCHOS_ONDIOFM ondiofm -IRIVER_H120 h120 -IRIVER_H300 h300 -IRIVER_H100 h100 -IRIVER_IFP7XX ifp7xx IRIVER_H10 h10 IRIVER_H10_5GB h10_5gb IPOD_COLOR ipodcolor IPOD_NANO ipodnano IPOD_VIDEO ipodvideo -IPOD_3G ipod3g -IPOD_4G ipod4g -IPOD_MINI ipodmini -IPOD_MINI2G ipodmini2g -IPOD_1G2G ipod1g2g -IAUDIO_X5 x5 -IAUDIO_M5 m5 -COWON_D2 cowond2 -IAUDIO_M3 m3 GIGABEAT_F gigabeatf GIGABEAT_S gigabeats -MROBE_500 mrobe500 -MROBE_100 mrobe100 -LOGIK_DAX logikdax -CREATIVE_ZVM creativezvm SANSA_E200 e200 -SANSA_E200 e200r SANSA_C200 c200 -ELIO_TPJ1022 tpj1022 -- cgit v1.2.3