summaryrefslogtreecommitdiff
path: root/uisimulator
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-06-10 13:29:52 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-06-10 13:29:52 +0000
commita6142ab7ab58f69a3f1a034db4bdf1eff24d3dd6 (patch)
treeef00c3ec8074ccb080b221c7d1dd4b3d03c8fd87 /uisimulator
parent5fc1b64ae051e454d2b3bf3a20be5d88937e55e7 (diff)
downloadrockbox-a6142ab7ab58f69a3f1a034db4bdf1eff24d3dd6.zip
rockbox-a6142ab7ab58f69a3f1a034db4bdf1eff24d3dd6.tar.gz
rockbox-a6142ab7ab58f69a3f1a034db4bdf1eff24d3dd6.tar.bz2
rockbox-a6142ab7ab58f69a3f1a034db4bdf1eff24d3dd6.tar.xz
Finally, the archos directory sandbox works in the same way for both X11 and win32 simulators. Unfortunately, this breaks the VC++ compatibility. Also, the plugin API now supports DEBUGF. Last, but not least, we have a new plugin, vbrfix.rock.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4726 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/common/dir.h (renamed from uisimulator/x11/dir.h)33
-rw-r--r--uisimulator/common/file.h (renamed from uisimulator/x11/file.h)45
-rw-r--r--uisimulator/common/io.c (renamed from uisimulator/x11/io.c)51
-rw-r--r--uisimulator/win32/Makefile11
-rw-r--r--uisimulator/win32/dir-win32.c97
-rw-r--r--uisimulator/win32/dir-win32.h26
-rw-r--r--uisimulator/win32/dir.h82
-rw-r--r--uisimulator/win32/file.h43
-rw-r--r--uisimulator/win32/io.c63
-rw-r--r--uisimulator/win32/kernel.c2
-rw-r--r--uisimulator/win32/kernel.h6
-rw-r--r--uisimulator/x11/Makefile9
-rw-r--r--uisimulator/x11/button-x11.c6
-rw-r--r--uisimulator/x11/kernel.h4
-rw-r--r--uisimulator/x11/thread.c2
15 files changed, 103 insertions, 377 deletions
diff --git a/uisimulator/x11/dir.h b/uisimulator/common/dir.h
index 48696c2..15332be 100644
--- a/uisimulator/x11/dir.h
+++ b/uisimulator/common/dir.h
@@ -16,35 +16,30 @@
* KIND, either express or implied.
*
****************************************************************************/
-#ifndef _X11_DIR_H_
-#define _X11_DIR_H_
+#ifndef _SIM_DIR_H_
+#define _SIM_DIR_H_
#include <sys/types.h>
-typedef void DIR;
#define DIRFUNCTIONS_DEFINED /* prevent those prototypes */
-#define dirent x11_dirent
+#define dirent sim_dirent
#include "../../firmware/include/dir.h"
#undef dirent
typedef void * MYDIR;
-extern MYDIR *x11_opendir(const char *name);
-extern struct x11_dirent* x11_readdir(MYDIR* dir);
-extern int x11_closedir(MYDIR *dir);
-extern int x11_mkdir(char *name, int mode);
-extern int x11_rmdir(char *name);
-
-#ifndef NO_REDEFINES_PLEASE
+extern MYDIR *sim_opendir(const char *name);
+extern struct sim_dirent* sim_readdir(MYDIR* dir);
+extern int sim_closedir(MYDIR *dir);
+extern int sim_mkdir(char *name, int mode);
+extern int sim_rmdir(char *name);
#define DIR MYDIR
-#define dirent x11_dirent
-#define opendir(x) x11_opendir(x)
-#define readdir(x) x11_readdir(x)
-#define closedir(x) x11_closedir(x)
-#define mkdir(x, y) x11_mkdir(x, y)
-#define rmdir(x) x11_rmdir(x)
-
-#endif
+#define dirent sim_dirent
+#define opendir(x) sim_opendir(x)
+#define readdir(x) sim_readdir(x)
+#define closedir(x) sim_closedir(x)
+#define mkdir(x, y) sim_mkdir(x, y)
+#define rmdir(x) sim_rmdir(x)
#endif
diff --git a/uisimulator/x11/file.h b/uisimulator/common/file.h
index b30167e..8d91b61 100644
--- a/uisimulator/x11/file.h
+++ b/uisimulator/common/file.h
@@ -17,30 +17,46 @@
*
****************************************************************************/
-#ifndef ROCKBOX_FILE_H
-#define ROCKBOX_FILE_H
+#ifndef _SIM_FILE_H_
+#define _SIM_FILE_H_
+#ifdef WIN32
+#include <io.h>
+#include <fcntl.h>
+#else
#include <stdio.h>
+#endif
+
#include <sys/types.h>
-int x11_open(const char *name, int opts);
-int x11_close(int fd);
-int x11_filesize(int fd);
-int x11_creat(const char *name, mode_t mode);
-int x11_remove(char *name);
-int x11_rename(char *oldpath, char *newpath);
+#ifdef WIN32
+#ifndef _commit
+extern int _commit( int handle );
+#endif
+#endif
+
+int sim_open(const char *name, int opts);
+int sim_close(int fd);
+int sim_rename(const char *oldpath, const char *newpath);
+int sim_filesize(int fd);
+int sim_creat(const char *name, mode_t mode);
+int sim_remove(const char *name);
#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)
+#define open(x,y) sim_open(x,y)
+#define close(x) sim_close(x)
+#define filesize(x) sim_filesize(x)
+#define creat(x,y) sim_creat(x,y)
+#define remove(x) sim_remove(x)
+#define rename(x,y) sim_rename(x,y)
+#ifdef WIN32
+#define fsync _commit
+#endif
#endif
#include "../../firmware/include/file.h"
+#ifndef WIN32
int open(const char* pathname, int flags);
int close(int fd);
int printf(const char *format, ...);
@@ -50,5 +66,6 @@ int fsync(int fd);
off_t lseek(int fildes, off_t offset, int whence);
ssize_t read(int fd, void *buf, size_t count);
ssize_t write(int fd, const void *buf, size_t count);
+#endif
#endif
diff --git a/uisimulator/x11/io.c b/uisimulator/common/io.c
index d4d2714..745e417 100644
--- a/uisimulator/x11/io.c
+++ b/uisimulator/common/io.c
@@ -24,7 +24,7 @@
#ifdef __FreeBSD__
#include <sys/param.h>
#include <sys/mount.h>
-#else
+#elif !defined(WIN32)
#include <sys/vfs.h>
#endif
#include <dirent.h>
@@ -34,9 +34,11 @@
#include "debug.h"
#define DIRFUNCTIONS_DEFINED /* prevent those prototypes */
-#define dirent x11_dirent
+#define dirent sim_dirent
+#define DIR SIMDIR
#include "../../firmware/include/dir.h"
#undef dirent
+#undef DIR
#define SIMULATOR_ARCHOS_ROOT "archos"
@@ -47,7 +49,7 @@ struct mydir {
typedef struct mydir MYDIR;
-MYDIR *x11_opendir(const char *name)
+MYDIR *sim_opendir(const char *name)
{
char buffer[256]; /* sufficiently big */
DIR *dir;
@@ -70,15 +72,15 @@ MYDIR *x11_opendir(const char *name)
return (MYDIR *)0;
}
-struct x11_dirent *x11_readdir(MYDIR *dir)
+struct sim_dirent *sim_readdir(MYDIR *dir)
{
char buffer[512]; /* sufficiently big */
- static struct x11_dirent secret;
+ static struct sim_dirent secret;
struct stat s;
struct dirent *x11 = (readdir)(dir->dir);
if(!x11)
- return (struct x11_dirent *)0;
+ return (struct sim_dirent *)0;
strcpy(secret.d_name, x11->d_name);
@@ -93,7 +95,7 @@ struct x11_dirent *x11_readdir(MYDIR *dir)
return &secret;
}
-void x11_closedir(MYDIR *dir)
+void sim_closedir(MYDIR *dir)
{
free(dir->name);
(closedir)(dir->dir);
@@ -102,7 +104,7 @@ void x11_closedir(MYDIR *dir)
}
-int x11_open(const char *name, int opts)
+int sim_open(const char *name, int opts)
{
char buffer[256]; /* sufficiently big */
@@ -115,12 +117,12 @@ int x11_open(const char *name, int opts)
return (open)(name, opts);
}
-int x11_close(int fd)
+int sim_close(int fd)
{
return (close)(fd);
}
-int x11_creat(const char *name, mode_t mode)
+int sim_creat(const char *name, mode_t mode)
{
char buffer[256]; /* sufficiently big */
(void)mode;
@@ -133,20 +135,22 @@ int x11_creat(const char *name, mode_t mode)
return (creat)(name, 0666);
}
-int x11_mkdir(const char *name, mode_t mode)
+int sim_mkdir(const char *name, mode_t mode)
{
char buffer[256]; /* sufficiently big */
(void)mode;
- if(name[0] == '/') {
- sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
+
+ sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
- debugf("We create the real directory '%s'\n", buffer);
- return (mkdir)(buffer, 0666);
- }
- return (mkdir)(name, 0666);
+ debugf("We create the real directory '%s'\n", buffer);
+#ifdef WIN32
+ return (mkdir)(buffer);
+#else
+ return (mkdir)(buffer, 0666);
+#endif
}
-int x11_rmdir(const char *name)
+int sim_rmdir(const char *name)
{
char buffer[256]; /* sufficiently big */
if(name[0] == '/') {
@@ -158,7 +162,7 @@ int x11_rmdir(const char *name)
return (rmdir)(name);
}
-int x11_remove(char *name)
+int sim_remove(const char *name)
{
char buffer[256]; /* sufficiently big */
@@ -171,7 +175,7 @@ int x11_remove(char *name)
return (remove)(name);
}
-int x11_rename(char *oldpath, char* newpath)
+int sim_rename(const char *oldpath, const char* newpath)
{
char buffer1[256];
char buffer2[256];
@@ -186,7 +190,7 @@ int x11_rename(char *oldpath, char* newpath)
return -1;
}
-int x11_filesize(int fd)
+int sim_filesize(int fd)
{
int old = lseek(fd, 0, SEEK_CUR);
int size = lseek(fd, 0, SEEK_END);
@@ -197,6 +201,10 @@ int x11_filesize(int fd)
void fat_size(unsigned int* size, unsigned int* free)
{
+#ifdef WIN32
+ *size = 2049;
+ *free = 1037;
+#else
struct statfs fs;
if (!statfs(".", &fs)) {
@@ -213,4 +221,5 @@ void fat_size(unsigned int* size, unsigned int* free)
if (free)
*free = 0;
}
+#endif
}
diff --git a/uisimulator/win32/Makefile b/uisimulator/win32/Makefile
index 59ef7f5..402b9ad 100644
--- a/uisimulator/win32/Makefile
+++ b/uisimulator/win32/Makefile
@@ -96,6 +96,8 @@ ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
else
LCDSRSC = lcd-playersim.c lcd-player.c lcd-player-charset.c font-player.c
endif
+COMMONSRCS = io.c
+
FIRMSRCS = $(LCDSRSC) id3.c mp3data.c usb.c mpeg.c mp3_playback.c \
powermgmt.c power.c sprintf.c buffer.c lcd-common.c strtok.c random.c \
timefuncs.c
@@ -111,9 +113,9 @@ ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
APPS += bmp.c widgets.c
endif
-SRCS = button.c dir-win32.c lcd-win32.c panic-win32.c thread-win32.c \
+SRCS = button.c lcd-win32.c panic-win32.c thread-win32.c \
debug-win32.c kernel.c string-win32.c uisw32.c stubs.c \
- $(APPS) $(MENUS) $(FIRMSRCS) sim_icons.c io.c
+ $(APPS) $(MENUS) $(FIRMSRCS) $(COMMONSRCS) sim_icons.c
OBJS := $(OBJDIR)/lang.o $(SRCS:%.c=$(OBJDIR)/%.o) $(OBJDIR)/uisw32-res.o
@@ -303,6 +305,9 @@ $(OBJDIR)/font-player.o: $(SIMCOMMON)/font-player.c
$(OBJDIR)/sim_icons.o: $(SIMCOMMON)/sim_icons.c
$(CC) $(CFLAGS) -c $< -o $@
+$(OBJDIR)/io.o: $(SIMCOMMON)/io.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
$(OBJDIR)/lcd-playersim.o: $(SIMCOMMON)/lcd-playersim.c
$(CC) $(CFLAGS) -c $< -o $@
@@ -315,7 +320,7 @@ $(OBJDIR)/%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.po : $(PLUGINDIR)/%.c
- $(CC) $(APPCFLAGS) -c $< -o $@
+ $(CC) $(APPCFLAGS) -DPLUGIN -c $< -o $@
$(OBJDIR)/%.rock : $(OBJDIR)/%.po
$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $<
diff --git a/uisimulator/win32/dir-win32.c b/uisimulator/win32/dir-win32.c
deleted file mode 100644
index dfdb636..0000000
--- a/uisimulator/win32/dir-win32.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2002 by Felix Arends
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-#include <io.h>
-#include <windows.h>
-#include <malloc.h>
-#include "dir-win32.h"
-
-// Directory operations
-//
-
-// opendir
-// open directory for scanning
-DIR *opendir (
- const char *dirname // directory name
- )
-{
- DIR *p = (DIR*)malloc(sizeof(DIR));
- struct _finddata_t fd;
- unsigned int i;
- char *s = (char*)malloc(strlen(dirname) + 5);
- wsprintf (s, "%s", dirname);
-
- for (i = 0; i < strlen(s); i++)
- if (s[i] == '/')
- s[i] = '\\';
-
- if (s[i - 1] != '\\')
- {
- s[i] = '\\';
- s[++i] = '\0';
- }
-
- OutputDebugString (s);
-
- wsprintf (s, "%s*.*", s);
-
- if ((p->handle = _findfirst (s, &fd)) == -1)
- {
- free (s);
- free (p);
- return 0;
- }
- free (s);
- return p;
-}
-
-// closedir
-// close directory
-int closedir (
- DIR *dir // previously opened dir search
- )
-{
- free(dir);
- return 0;
-}
-
-// read dir
-// read next entry in directory
-struct dirent *readdir (
- DIR *dir
- )
-{
- struct _finddata_t fd;
- if (_findnext (dir->handle, &fd) == -1)
- return 0;
- memcpy (dir->fd.d_name, fd.name, 256);
-
- dir->fd.attribute = fd.attrib & 0x3f;
- dir->fd.size = fd.size;
- dir->fd.startcluster = 0 ;
-
-
- return &dir->fd;
-}
-
-void fat_size(unsigned int* size, unsigned int* free)
-{
- *size = 2049;
- *free = 1037;
-}
diff --git a/uisimulator/win32/dir-win32.h b/uisimulator/win32/dir-win32.h
deleted file mode 100644
index c34a53a..0000000
--- a/uisimulator/win32/dir-win32.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2002 by Felix Arends
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-#ifndef __DIR_WIN32_H__
-#define __DIR_WIN32_H__
-
-#include <io.h>
-#include "../../firmware/include/dir.h"
-
-#endif // #ifndef __DIR_WIN32_H__
diff --git a/uisimulator/win32/dir.h b/uisimulator/win32/dir.h
deleted file mode 100644
index da5064c..0000000
--- a/uisimulator/win32/dir.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2002 by Björn Stenberg
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-#ifndef _DIR_H_
-#define _DIR_H_
-
-#include <stdbool.h>
-#include "file.h"
-
-#ifndef DIRENT_DEFINED
-
-#define ATTR_READ_ONLY 0x01
-#define ATTR_HIDDEN 0x02
-#define ATTR_SYSTEM 0x04
-#define ATTR_VOLUME_ID 0x08
-#define ATTR_DIRECTORY 0x10
-#define ATTR_ARCHIVE 0x20
-
-struct dirent {
- unsigned char d_name[MAX_PATH];
- int attribute;
- int size;
- int startcluster;
-};
-#endif
-
-
-#ifndef SIMULATOR
-
-#include "fat.h"
-
-typedef struct {
- bool busy;
- int startcluster;
- struct fat_dir fatdir;
- struct dirent theent;
-} DIR;
-
-#else // SIMULATOR
-
-#ifdef WIN32
-#ifndef __MINGW32__
-#include <io.h>
-#endif /* __MINGW32__ */
-
-typedef struct DIRtag
-{
- struct dirent fd;
- int handle;
-} DIR;
-
-#endif /* WIN32 */
-
-#endif // SIMULATOR
-
-#ifndef DIRFUNCTIONS_DEFINED
-
-extern DIR* opendir(const char* name);
-extern int closedir(DIR* dir);
-extern int mkdir(const char* name, int mode);
-extern int rmdir(const char* name);
-
-extern struct dirent* readdir(DIR* dir);
-
-#endif /* DIRFUNCTIONS_DEFINED */
-
-#endif
diff --git a/uisimulator/win32/file.h b/uisimulator/win32/file.h
deleted file mode 100644
index 2c94ba3..0000000
--- a/uisimulator/win32/file.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se>
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-#ifndef _FILE_H_
-
-#ifndef __MINGW32__
-#include <io.h>
-#include <fcntl.h>
-#endif
-
-#ifndef _commit
-extern int _commit( int handle );
-#endif
-
-int win32_rename(char *oldpath, char *newpath);
-int win32_filesize(int fd);
-
-#define rename win32_rename
-#define filesize win32_filesize
-#define fsync _commit
-
-#include "../../firmware/include/file.h"
-
-#undef rename
-#define mkdir(x,y) win32_mkdir(x,y)
-
-#endif
diff --git a/uisimulator/win32/io.c b/uisimulator/win32/io.c
deleted file mode 100644
index 023e767..0000000
--- a/uisimulator/win32/io.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2002 Daniel Stenberg
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-#include <stdio.h>
-#include "file.h"
-#include "debug.h"
-
-#define SIMULATOR_ARCHOS_ROOT "archos"
-
-int win32_rename(char *oldpath, char* newpath)
-{
- char buffer1[256];
- char buffer2[256];
-
- if(oldpath[0] == '/') {
- sprintf(buffer1, "%s%s", SIMULATOR_ARCHOS_ROOT, oldpath);
- sprintf(buffer2, "%s%s", SIMULATOR_ARCHOS_ROOT, newpath);
-
- debugf("We rename the real file '%s' to '%s'\n", buffer1, buffer2);
- return rename(buffer1, buffer2);
- }
- return -1;
-}
-
-int win32_filesize(int fd)
-{
- int old = lseek(fd, 0, SEEK_CUR);
- int size = lseek(fd, 0, SEEK_END);
- lseek(fd, old, SEEK_SET);
-
- return(size);
-}
-
-extern int (mkdir)(const char *name);
-
-int win32_mkdir(const char *name, int mode)
-{
- char buffer[256]; /* sufficiently big */
- (void)mode;
- if(name[0] == '/') {
- sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name);
-
- debugf("We create the real directory '%s'\n", buffer);
- return (mkdir)(buffer);
- }
- return (mkdir)(name);
-}
diff --git a/uisimulator/win32/kernel.c b/uisimulator/win32/kernel.c
index 44ac88a..77ae6bf 100644
--- a/uisimulator/win32/kernel.c
+++ b/uisimulator/win32/kernel.c
@@ -34,7 +34,7 @@ int set_irq_level (int level)
return (_lv = level);
}
-void sleep(int ticks)
+void sim_sleep(int ticks)
{
Sleep (1000 / HZ * ticks);
}
diff --git a/uisimulator/win32/kernel.h b/uisimulator/win32/kernel.h
index 7cbdd18..7633ce6 100644
--- a/uisimulator/win32/kernel.h
+++ b/uisimulator/win32/kernel.h
@@ -18,3 +18,9 @@
****************************************************************************/
#include "../../firmware/export/kernel.h"
+
+#ifndef NO_REDEFINES_PLEASE
+#define sleep(x) sim_sleep(x)
+#endif
+
+void sim_sleep(int);
diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile
index 65f0b8d..03b23ac 100644
--- a/uisimulator/x11/Makefile
+++ b/uisimulator/x11/Makefile
@@ -96,6 +96,8 @@ ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
else
LCDSRSC = lcd-playersim.c lcd-player.c font-player.c lcd-player-charset.c
endif
+COMMONSRCS = io.c
+
FIRMSRCS = $(LCDSRSC) id3.c debug.c usb.c mpeg.c mp3_playback.c power.c\
powermgmt.c panic.c mp3data.c sprintf.c buffer.c timefuncs.c
@@ -111,8 +113,8 @@ ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
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) \
- lcd-common.c
+ button-x11.c thread.c sim_icons.c $(APPS) $(MENUS) $(FIRMSRCS) \
+ $(COMMONSRCS) lcd-common.c
ROCKSRC := $(wildcard $(APPDIR)/plugins/*.c)
ROCKS := $(ROCKSRC:$(APPDIR)/plugins/%.c=$(OBJDIR)/%.rock)
@@ -276,6 +278,9 @@ $(OBJDIR)/stubs.o: $(SIMCOMMON)/stubs.c
$(OBJDIR)/sim_icons.o: $(SIMCOMMON)/sim_icons.c
$(CC) $(CFLAGS) -c $< -o $@
+$(OBJDIR)/io.o: $(SIMCOMMON)/io.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
$(OBJDIR)/usb.o: $(FIRMWAREDIR)/usb.c
$(CC) $(CFLAGS) -c $< -o $@
diff --git a/uisimulator/x11/button-x11.c b/uisimulator/x11/button-x11.c
index ae16e2e..eae5531 100644
--- a/uisimulator/x11/button-x11.c
+++ b/uisimulator/x11/button-x11.c
@@ -172,7 +172,7 @@ int button_get_w_tmo(int ticks)
for(i=0; i< ticks; i++) {
bits = get_raw_button();
if(!bits)
- x11_sleep(1);
+ sim_sleep(1);
else
break;
}
@@ -193,14 +193,14 @@ int button_get(bool block)
do {
bits = get_raw_button();
if(block && !bits)
- x11_sleep(HZ/10);
+ sim_sleep(HZ/10);
else
break;
} while(1);
if(!block)
/* delay a bit */
- x11_sleep(1);
+ sim_sleep(1);
return bits;
}
diff --git a/uisimulator/x11/kernel.h b/uisimulator/x11/kernel.h
index a045a3f..f165d92 100644
--- a/uisimulator/x11/kernel.h
+++ b/uisimulator/x11/kernel.h
@@ -21,11 +21,11 @@
#ifndef NO_REDEFINES_PLEASE
-#define sleep(x) x11_sleep(x)
+#define sleep(x) sim_sleep(x)
#define mutex_init(x) (void)x
#define mutex_lock(x) (void)x
#define mutex_unlock(x) (void)x
#endif
-void x11_sleep(int);
+void sim_sleep(int);
diff --git a/uisimulator/x11/thread.c b/uisimulator/x11/thread.c
index 437080a..e37373d 100644
--- a/uisimulator/x11/thread.c
+++ b/uisimulator/x11/thread.c
@@ -85,7 +85,7 @@ int create_thread(void* fp, void* sp, int stk_size)
}
/* ticks is HZ per second */
-void x11_sleep(int ticks)
+void sim_sleep(int ticks)
{
current_tick+=5;
pthread_mutex_unlock(&mp); /* return */