diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-06-10 13:29:52 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-06-10 13:29:52 +0000 |
commit | a6142ab7ab58f69a3f1a034db4bdf1eff24d3dd6 (patch) | |
tree | ef00c3ec8074ccb080b221c7d1dd4b3d03c8fd87 /uisimulator/win32 | |
parent | 5fc1b64ae051e454d2b3bf3a20be5d88937e55e7 (diff) |
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/win32')
-rw-r--r-- | uisimulator/win32/Makefile | 11 | ||||
-rw-r--r-- | uisimulator/win32/dir-win32.c | 97 | ||||
-rw-r--r-- | uisimulator/win32/dir-win32.h | 26 | ||||
-rw-r--r-- | uisimulator/win32/dir.h | 82 | ||||
-rw-r--r-- | uisimulator/win32/file.h | 43 | ||||
-rw-r--r-- | uisimulator/win32/io.c | 63 | ||||
-rw-r--r-- | uisimulator/win32/kernel.c | 2 | ||||
-rw-r--r-- | uisimulator/win32/kernel.h | 6 |
8 files changed, 15 insertions, 315 deletions
diff --git a/uisimulator/win32/Makefile b/uisimulator/win32/Makefile index 59ef7f5206..402b9addd5 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 dfdb6364f1..0000000000 --- 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 c34a53aa1e..0000000000 --- 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 da5064c1fb..0000000000 --- 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 2c94ba320a..0000000000 --- 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 023e767b6a..0000000000 --- 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 44ac88ae7c..77ae6bffb2 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 7cbdd1889e..7633ce68b4 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); |