From 3f54121fde834041970ddeda09edd06ba1939850 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Sun, 29 Jun 2003 16:43:15 +0000 Subject: Added plugin loader. Moved games, demos and the text viewer to loadable plugins. Copy your *.rock files to /.rockbox/rocks/ git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3770 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/x11/Makefile | 41 +++++++++++++++-------------------------- uisimulator/x11/dir.h | 9 ++++++++- uisimulator/x11/file.h | 11 +++++++---- uisimulator/x11/io.c | 2 +- uisimulator/x11/kernel.h | 4 ++++ uisimulator/x11/sprintf.h | 2 ++ 6 files changed, 37 insertions(+), 32 deletions(-) (limited to 'uisimulator/x11') diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile index 14b204bb62..4a95046ea0 100644 --- a/uisimulator/x11/Makefile +++ b/uisimulator/x11/Makefile @@ -92,27 +92,34 @@ FIRMSRCS = $(LCDSRSC) id3.c debug.c usb.c mpeg.c power.c\ APPS = main.c tree.c menu.c credits.c main_menu.c language.c\ playlist.c wps.c wps-display.c settings.c status.c icons.c\ - screens.c peakmeter.c viewer.c sleeptimer.c keyboard.c onplay.c\ - misc.c + screens.c peakmeter.c sleeptimer.c keyboard.c onplay.c\ + misc.c plugin.c MENUS = games_menu.c demo_menu.c settings_menu.c sound_menu.c ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP) - APPS += tetris.c sokoban.c bounce.c snow.c bmp.c widgets.c wormlet.c cube.c + APPS += bmp.c widgets.c endif SRCS = screenhack.c uibasic.c resources.c visual.c lcd-x11.c stubs.c \ button-x11.c io.c thread.c sim_icons.c $(APPS) $(MENUS) $(FIRMSRCS) +ROCKSRC := $(wildcard $(APPDIR)/plugins/*.c) +ROCKS := $(ROCKSRC:$(APPDIR)/plugins/%.c=$(OBJDIR)/%.rock) + OBJS := $(OBJDIR)/lang.o $(SRCS:%.c=$(OBJDIR)/%.o) -all: $(TARGET) $(EXTRA_TARGETS) +all: $(TARGET) $(EXTRA_TARGETS) $(ROCKS) clean: $(RM) $(OBJS) *~ core $(TARGET) $(CLIENTS) $(OBJDIR)/lang.[cho] \ - $(OBJDIR)/build.lang $(OBJDIR)/*.o $(OBJDIR)/sysfont.c + $(OBJDIR)/build.lang $(OBJDIR)/*.o $(OBJDIR)/sysfont.c \ + $(ROCKS) $(OBJDIR)/credits.raw $(RM) -r $(DEPS) +$(OBJDIR)/%.rock: $(APPDIR)/plugins/%.c $(APPDIR)/plugin.h + $(CC) $(APPCFLAGS) -DPLUGIN -shared $< -o $@ + distclean: clean $(RM) config.cache @@ -128,6 +135,9 @@ $(OBJDIR)/menu.o: $(APPDIR)/menu.c $(OBJDIR)/main_menu.o: $(APPDIR)/main_menu.c $(CC) $(APPCFLAGS) -c $< -o $@ +$(OBJDIR)/plugin.o: $(APPDIR)/plugin.c + $(CC) $(APPCFLAGS) -c $< -o $@ + $(OBJDIR)/keyboard.o: $(MACHINEDIR)/keyboard.c $(CC) $(APPCFLAGS) -c $< -o $@ @@ -152,24 +162,6 @@ $(OBJDIR)/icons.o: $(MACHINEDIR)/icons.c $(OBJDIR)/widgets.o: $(RECDIR)/widgets.c $(CC) $(APPCFLAGS) -c $< -o $@ -$(OBJDIR)/tetris.o: $(RECDIR)/tetris.c - $(CC) $(APPCFLAGS) -c $< -o $@ - -$(OBJDIR)/wormlet.o: $(RECDIR)/wormlet.c - $(CC) $(APPCFLAGS) -c $< -o $@ - -$(OBJDIR)/sokoban.o: $(RECDIR)/sokoban.c - $(CC) $(APPCFLAGS) -c $< -o $@ - -$(OBJDIR)/bounce.o: $(RECDIR)/bounce.c - $(CC) $(APPCFLAGS) -c $< -o $@ - -$(OBJDIR)/cube.o: $(RECDIR)/cube.c - $(CC) $(APPCFLAGS) -c $< -o $@ - -$(OBJDIR)/snow.o: $(RECDIR)/snow.c - $(CC) $(APPCFLAGS) -c $< -o $@ - $(OBJDIR)/main.o: $(APPDIR)/main.c $(CC) $(APPCFLAGS) -c $< -o $@ @@ -182,9 +174,6 @@ $(OBJDIR)/wps.o: $(APPDIR)/wps.c $(OBJDIR)/sleeptimer.o: $(APPDIR)/sleeptimer.c $(CC) $(APPCFLAGS) -c $< -o $@ -$(OBJDIR)/viewer.o: $(APPDIR)/viewer.c - $(CC) $(APPCFLAGS) -c $< -o $@ - $(OBJDIR)/wps-display.o: $(APPDIR)/wps-display.c $(CC) $(APPCFLAGS) -c $< -o $@ diff --git a/uisimulator/x11/dir.h b/uisimulator/x11/dir.h index 28cfcc8646..6b019c833e 100644 --- a/uisimulator/x11/dir.h +++ b/uisimulator/x11/dir.h @@ -16,6 +16,8 @@ * KIND, either express or implied. * ****************************************************************************/ +#ifndef _X11_DIR_H_ +#define _X11_DIR_H_ #include typedef void DIR; @@ -29,7 +31,9 @@ typedef void * MYDIR; extern MYDIR *x11_opendir(char *name); extern struct x11_dirent* x11_readdir(MYDIR* dir); -extern void x11_closedir(MYDIR *dir); +extern int x11_closedir(MYDIR *dir); + +#ifndef NO_REDEFINES_PLEASE #define DIR MYDIR #define dirent x11_dirent @@ -37,3 +41,6 @@ extern void x11_closedir(MYDIR *dir); #define readdir(x) x11_readdir(x) #define closedir(x) x11_closedir(x) +#endif + +#endif diff --git a/uisimulator/x11/file.h b/uisimulator/x11/file.h index f11f5056c9..7658a1b2f1 100644 --- a/uisimulator/x11/file.h +++ b/uisimulator/x11/file.h @@ -23,25 +23,28 @@ #include #include -int x11_open(char *name, int opts); +int x11_open(const char *name, int opts); int x11_close(int fd); int x11_filesize(int fd); int x11_creat(char *name, int mode); int x11_remove(char *name); int x11_rename(char *oldpath, char *newpath); +#ifndef NO_REDEFINES_PLEASE #define open(x,y) x11_open(x,y) #define close(x) x11_close(x) #define filesize(x) x11_filesize(x) #define creat(x,y) x11_creat(x,y) #define remove(x) x11_remove(x) #define rename(x,y) x11_rename(x,y) +#endif #include "../../firmware/include/file.h" -extern int open(char* pathname, int flags); -extern int close(int fd); -extern int printf(const char *format, ...); +int open(const char* pathname, int flags); +int close(int fd); +int printf(const char *format, ...); +int ftruncate(int fd, off_t length); off_t lseek(int fildes, off_t offset, int whence); ssize_t read(int fd, void *buf, size_t count); diff --git a/uisimulator/x11/io.c b/uisimulator/x11/io.c index c33a42d636..5b3cff7006 100644 --- a/uisimulator/x11/io.c +++ b/uisimulator/x11/io.c @@ -97,7 +97,7 @@ void x11_closedir(MYDIR *dir) } -int x11_open(char *name, int opts) +int x11_open(const char *name, int opts) { char buffer[256]; /* sufficiently big */ diff --git a/uisimulator/x11/kernel.h b/uisimulator/x11/kernel.h index 397a1562a1..7ec2979748 100644 --- a/uisimulator/x11/kernel.h +++ b/uisimulator/x11/kernel.h @@ -19,6 +19,10 @@ #include "../../firmware/export/kernel.h" +#ifndef NO_REDEFINES_PLEASE + #define sleep(x) x11_sleep(x) +#endif + void x11_sleep(int); diff --git a/uisimulator/x11/sprintf.h b/uisimulator/x11/sprintf.h index 1e95459d41..64a22f3c6e 100644 --- a/uisimulator/x11/sprintf.h +++ b/uisimulator/x11/sprintf.h @@ -5,6 +5,8 @@ int rockbox_snprintf (char *buf, size_t size, const char *fmt, ...); int rockbox_vsnprintf (char *buf, int size, const char *fmt, va_list ap); int rockbox_fprintf (int fd, const char *fmt, ...); +#ifndef NO_REDEFINES_PLEASE #define snprintf rockbox_snprintf #define vsnprintf rockbox_vsnprintf #define fprintf rockbox_fprintf +#endif -- cgit v1.2.3