diff options
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) | |||
96 | else | 96 | else |
97 | LCDSRSC = lcd-playersim.c lcd-player.c lcd-player-charset.c font-player.c | 97 | LCDSRSC = lcd-playersim.c lcd-player.c lcd-player-charset.c font-player.c |
98 | endif | 98 | endif |
99 | COMMONSRCS = io.c | ||
100 | |||
99 | FIRMSRCS = $(LCDSRSC) id3.c mp3data.c usb.c mpeg.c mp3_playback.c \ | 101 | FIRMSRCS = $(LCDSRSC) id3.c mp3data.c usb.c mpeg.c mp3_playback.c \ |
100 | powermgmt.c power.c sprintf.c buffer.c lcd-common.c strtok.c random.c \ | 102 | powermgmt.c power.c sprintf.c buffer.c lcd-common.c strtok.c random.c \ |
101 | timefuncs.c | 103 | timefuncs.c |
@@ -111,9 +113,9 @@ ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP) | |||
111 | APPS += bmp.c widgets.c | 113 | APPS += bmp.c widgets.c |
112 | endif | 114 | endif |
113 | 115 | ||
114 | SRCS = button.c dir-win32.c lcd-win32.c panic-win32.c thread-win32.c \ | 116 | SRCS = button.c lcd-win32.c panic-win32.c thread-win32.c \ |
115 | debug-win32.c kernel.c string-win32.c uisw32.c stubs.c \ | 117 | debug-win32.c kernel.c string-win32.c uisw32.c stubs.c \ |
116 | $(APPS) $(MENUS) $(FIRMSRCS) sim_icons.c io.c | 118 | $(APPS) $(MENUS) $(FIRMSRCS) $(COMMONSRCS) sim_icons.c |
117 | 119 | ||
118 | OBJS := $(OBJDIR)/lang.o $(SRCS:%.c=$(OBJDIR)/%.o) $(OBJDIR)/uisw32-res.o | 120 | OBJS := $(OBJDIR)/lang.o $(SRCS:%.c=$(OBJDIR)/%.o) $(OBJDIR)/uisw32-res.o |
119 | 121 | ||
@@ -303,6 +305,9 @@ $(OBJDIR)/font-player.o: $(SIMCOMMON)/font-player.c | |||
303 | $(OBJDIR)/sim_icons.o: $(SIMCOMMON)/sim_icons.c | 305 | $(OBJDIR)/sim_icons.o: $(SIMCOMMON)/sim_icons.c |
304 | $(CC) $(CFLAGS) -c $< -o $@ | 306 | $(CC) $(CFLAGS) -c $< -o $@ |
305 | 307 | ||
308 | $(OBJDIR)/io.o: $(SIMCOMMON)/io.c | ||
309 | $(CC) $(CFLAGS) -c $< -o $@ | ||
310 | |||
306 | $(OBJDIR)/lcd-playersim.o: $(SIMCOMMON)/lcd-playersim.c | 311 | $(OBJDIR)/lcd-playersim.o: $(SIMCOMMON)/lcd-playersim.c |
307 | $(CC) $(CFLAGS) -c $< -o $@ | 312 | $(CC) $(CFLAGS) -c $< -o $@ |
308 | 313 | ||
@@ -315,7 +320,7 @@ $(OBJDIR)/%.o: %.c | |||
315 | $(CC) $(CFLAGS) -c $< -o $@ | 320 | $(CC) $(CFLAGS) -c $< -o $@ |
316 | 321 | ||
317 | $(OBJDIR)/%.po : $(PLUGINDIR)/%.c | 322 | $(OBJDIR)/%.po : $(PLUGINDIR)/%.c |
318 | $(CC) $(APPCFLAGS) -c $< -o $@ | 323 | $(CC) $(APPCFLAGS) -DPLUGIN -c $< -o $@ |
319 | 324 | ||
320 | $(OBJDIR)/%.rock : $(OBJDIR)/%.po | 325 | $(OBJDIR)/%.rock : $(OBJDIR)/%.po |
321 | $(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $< | 326 | $(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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Felix Arends | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include <io.h> | ||
21 | #include <windows.h> | ||
22 | #include <malloc.h> | ||
23 | #include "dir-win32.h" | ||
24 | |||
25 | // Directory operations | ||
26 | // | ||
27 | |||
28 | // opendir | ||
29 | // open directory for scanning | ||
30 | DIR *opendir ( | ||
31 | const char *dirname // directory name | ||
32 | ) | ||
33 | { | ||
34 | DIR *p = (DIR*)malloc(sizeof(DIR)); | ||
35 | struct _finddata_t fd; | ||
36 | unsigned int i; | ||
37 | char *s = (char*)malloc(strlen(dirname) + 5); | ||
38 | wsprintf (s, "%s", dirname); | ||
39 | |||
40 | for (i = 0; i < strlen(s); i++) | ||
41 | if (s[i] == '/') | ||
42 | s[i] = '\\'; | ||
43 | |||
44 | if (s[i - 1] != '\\') | ||
45 | { | ||
46 | s[i] = '\\'; | ||
47 | s[++i] = '\0'; | ||
48 | } | ||
49 | |||
50 | OutputDebugString (s); | ||
51 | |||
52 | wsprintf (s, "%s*.*", s); | ||
53 | |||
54 | if ((p->handle = _findfirst (s, &fd)) == -1) | ||
55 | { | ||
56 | free (s); | ||
57 | free (p); | ||
58 | return 0; | ||
59 | } | ||
60 | free (s); | ||
61 | return p; | ||
62 | } | ||
63 | |||
64 | // closedir | ||
65 | // close directory | ||
66 | int closedir ( | ||
67 | DIR *dir // previously opened dir search | ||
68 | ) | ||
69 | { | ||
70 | free(dir); | ||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | // read dir | ||
75 | // read next entry in directory | ||
76 | struct dirent *readdir ( | ||
77 | DIR *dir | ||
78 | ) | ||
79 | { | ||
80 | struct _finddata_t fd; | ||
81 | if (_findnext (dir->handle, &fd) == -1) | ||
82 | return 0; | ||
83 | memcpy (dir->fd.d_name, fd.name, 256); | ||
84 | |||
85 | dir->fd.attribute = fd.attrib & 0x3f; | ||
86 | dir->fd.size = fd.size; | ||
87 | dir->fd.startcluster = 0 ; | ||
88 | |||
89 | |||
90 | return &dir->fd; | ||
91 | } | ||
92 | |||
93 | void fat_size(unsigned int* size, unsigned int* free) | ||
94 | { | ||
95 | *size = 2049; | ||
96 | *free = 1037; | ||
97 | } | ||
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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Felix Arends | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef __DIR_WIN32_H__ | ||
21 | #define __DIR_WIN32_H__ | ||
22 | |||
23 | #include <io.h> | ||
24 | #include "../../firmware/include/dir.h" | ||
25 | |||
26 | #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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Björn Stenberg | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef _DIR_H_ | ||
20 | #define _DIR_H_ | ||
21 | |||
22 | #include <stdbool.h> | ||
23 | #include "file.h" | ||
24 | |||
25 | #ifndef DIRENT_DEFINED | ||
26 | |||
27 | #define ATTR_READ_ONLY 0x01 | ||
28 | #define ATTR_HIDDEN 0x02 | ||
29 | #define ATTR_SYSTEM 0x04 | ||
30 | #define ATTR_VOLUME_ID 0x08 | ||
31 | #define ATTR_DIRECTORY 0x10 | ||
32 | #define ATTR_ARCHIVE 0x20 | ||
33 | |||
34 | struct dirent { | ||
35 | unsigned char d_name[MAX_PATH]; | ||
36 | int attribute; | ||
37 | int size; | ||
38 | int startcluster; | ||
39 | }; | ||
40 | #endif | ||
41 | |||
42 | |||
43 | #ifndef SIMULATOR | ||
44 | |||
45 | #include "fat.h" | ||
46 | |||
47 | typedef struct { | ||
48 | bool busy; | ||
49 | int startcluster; | ||
50 | struct fat_dir fatdir; | ||
51 | struct dirent theent; | ||
52 | } DIR; | ||
53 | |||
54 | #else // SIMULATOR | ||
55 | |||
56 | #ifdef WIN32 | ||
57 | #ifndef __MINGW32__ | ||
58 | #include <io.h> | ||
59 | #endif /* __MINGW32__ */ | ||
60 | |||
61 | typedef struct DIRtag | ||
62 | { | ||
63 | struct dirent fd; | ||
64 | int handle; | ||
65 | } DIR; | ||
66 | |||
67 | #endif /* WIN32 */ | ||
68 | |||
69 | #endif // SIMULATOR | ||
70 | |||
71 | #ifndef DIRFUNCTIONS_DEFINED | ||
72 | |||
73 | extern DIR* opendir(const char* name); | ||
74 | extern int closedir(DIR* dir); | ||
75 | extern int mkdir(const char* name, int mode); | ||
76 | extern int rmdir(const char* name); | ||
77 | |||
78 | extern struct dirent* readdir(DIR* dir); | ||
79 | |||
80 | #endif /* DIRFUNCTIONS_DEFINED */ | ||
81 | |||
82 | #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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se> | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef _FILE_H_ | ||
21 | |||
22 | #ifndef __MINGW32__ | ||
23 | #include <io.h> | ||
24 | #include <fcntl.h> | ||
25 | #endif | ||
26 | |||
27 | #ifndef _commit | ||
28 | extern int _commit( int handle ); | ||
29 | #endif | ||
30 | |||
31 | int win32_rename(char *oldpath, char *newpath); | ||
32 | int win32_filesize(int fd); | ||
33 | |||
34 | #define rename win32_rename | ||
35 | #define filesize win32_filesize | ||
36 | #define fsync _commit | ||
37 | |||
38 | #include "../../firmware/include/file.h" | ||
39 | |||
40 | #undef rename | ||
41 | #define mkdir(x,y) win32_mkdir(x,y) | ||
42 | |||
43 | #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 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Daniel Stenberg | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include <stdio.h> | ||
21 | #include "file.h" | ||
22 | #include "debug.h" | ||
23 | |||
24 | #define SIMULATOR_ARCHOS_ROOT "archos" | ||
25 | |||
26 | int win32_rename(char *oldpath, char* newpath) | ||
27 | { | ||
28 | char buffer1[256]; | ||
29 | char buffer2[256]; | ||
30 | |||
31 | if(oldpath[0] == '/') { | ||
32 | sprintf(buffer1, "%s%s", SIMULATOR_ARCHOS_ROOT, oldpath); | ||
33 | sprintf(buffer2, "%s%s", SIMULATOR_ARCHOS_ROOT, newpath); | ||
34 | |||
35 | debugf("We rename the real file '%s' to '%s'\n", buffer1, buffer2); | ||
36 | return rename(buffer1, buffer2); | ||
37 | } | ||
38 | return -1; | ||
39 | } | ||
40 | |||
41 | int win32_filesize(int fd) | ||
42 | { | ||
43 | int old = lseek(fd, 0, SEEK_CUR); | ||
44 | int size = lseek(fd, 0, SEEK_END); | ||
45 | lseek(fd, old, SEEK_SET); | ||
46 | |||
47 | return(size); | ||
48 | } | ||
49 | |||
50 | extern int (mkdir)(const char *name); | ||
51 | |||
52 | int win32_mkdir(const char *name, int mode) | ||
53 | { | ||
54 | char buffer[256]; /* sufficiently big */ | ||
55 | (void)mode; | ||
56 | if(name[0] == '/') { | ||
57 | sprintf(buffer, "%s%s", SIMULATOR_ARCHOS_ROOT, name); | ||
58 | |||
59 | debugf("We create the real directory '%s'\n", buffer); | ||
60 | return (mkdir)(buffer); | ||
61 | } | ||
62 | return (mkdir)(name); | ||
63 | } | ||
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) | |||
34 | return (_lv = level); | 34 | return (_lv = level); |
35 | } | 35 | } |
36 | 36 | ||
37 | void sleep(int ticks) | 37 | void sim_sleep(int ticks) |
38 | { | 38 | { |
39 | Sleep (1000 / HZ * ticks); | 39 | Sleep (1000 / HZ * ticks); |
40 | } | 40 | } |
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 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | #include "../../firmware/export/kernel.h" | 20 | #include "../../firmware/export/kernel.h" |
21 | |||
22 | #ifndef NO_REDEFINES_PLEASE | ||
23 | #define sleep(x) sim_sleep(x) | ||
24 | #endif | ||
25 | |||
26 | void sim_sleep(int); | ||