diff options
33 files changed, 325 insertions, 337 deletions
diff --git a/apps/Makefile b/apps/Makefile index bcdc1ef265..4f80e045b7 100644 --- a/apps/Makefile +++ b/apps/Makefile | |||
@@ -43,6 +43,8 @@ MAXOUTFILE = $(OBJDIR)/romstart | |||
43 | ifdef SIMVER | 43 | ifdef SIMVER |
44 | # this is a sim build | 44 | # this is a sim build |
45 | all: $(OBJDIR)/$(BINARY) $(CODECS) $(ROCKS) | 45 | all: $(OBJDIR)/$(BINARY) $(CODECS) $(ROCKS) |
46 | @$(MAKE) -C $(SIMDIR) | ||
47 | @$(MAKE) -C $(ROOTDIR)/uisimulator/common | ||
46 | else | 48 | else |
47 | # regular target build | 49 | # regular target build |
48 | all: $(OBJDIR)/$(BINARY) $(FLASHFILE) $(CODECS) $(ROCKS) $(ARCHOSROM) | 50 | all: $(OBJDIR)/$(BINARY) $(FLASHFILE) $(CODECS) $(ROCKS) $(ARCHOSROM) |
@@ -101,12 +103,22 @@ $(OBJDIR)/$(BINARY) : $(OBJDIR)/rockbox.bin | |||
101 | 103 | ||
102 | else | 104 | else |
103 | # this is a simulator build | 105 | # this is a simulator build |
104 | $(OBJDIR)/$(BINARY) : $(OBJS) $(OBJDIR)/librockbox.a $(DEPFILE) $(OBJDIR)/libsim.a | 106 | |
107 | ifeq ($(SIMVER), win32) | ||
108 | # OK, this is ugly but we need it on the link line to make it do right | ||
109 | EXTRAOBJ = $(OBJDIR)/uisw32-res.o | ||
110 | endif | ||
111 | |||
112 | |||
113 | $(OBJDIR)/$(BINARY) : $(OBJS) $(OBJDIR)/librockbox.a $(DEPFILE) $(OBJDIR)/libsim.a $(OBJDIR)/libcomsim.a | ||
105 | @echo "LD $(BINARY)" | 114 | @echo "LD $(BINARY)" |
106 | $(CC) $(GCCOPTS) -o $@ $(OBJS) $(LDOPTS) -L$(OBJDIR) -lrockbox -lsim -Wl,-Map,$(OBJDIR)/rockbox.map | 115 | $(CC) $(GCCOPTS) -o $@ $(OBJS) -L$(OBJDIR) -lrockbox -lsim -lcomsim $(LDOPTS) $(EXTRAOBJ) -Wl,-Map,$(OBJDIR)/rockbox.map |
107 | 116 | ||
108 | $(OBJDIR)/libsim.a: | 117 | $(OBJDIR)/libsim.a: |
109 | @$(MAKE) -C $(SIMDIR) | 118 | @$(MAKE) -C $(SIMDIR) |
119 | |||
120 | $(OBJDIR)/libcomsim.a: | ||
121 | @$(MAKE) -C $(ROOTDIR)/uisimulator/common | ||
110 | endif | 122 | endif |
111 | 123 | ||
112 | $(OBJDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin | 124 | $(OBJDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin |
diff --git a/apps/playlist.c b/apps/playlist.c index 5e7f679800..cb9d2ba3ea 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -231,7 +231,7 @@ static void new_playlist(struct playlist_info* playlist, const char *dir, | |||
231 | 231 | ||
232 | if (playlist->control_fd >= 0) | 232 | if (playlist->control_fd >= 0) |
233 | { | 233 | { |
234 | if (fprintf(playlist->control_fd, "P:%d:%s:%s\n", | 234 | if (fdprintf(playlist->control_fd, "P:%d:%s:%s\n", |
235 | PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) | 235 | PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) |
236 | fsync(playlist->control_fd); | 236 | fsync(playlist->control_fd); |
237 | else | 237 | else |
@@ -279,7 +279,7 @@ static int check_control(struct playlist_info* playlist) | |||
279 | 279 | ||
280 | playlist->filename[playlist->dirlen-1] = '\0'; | 280 | playlist->filename[playlist->dirlen-1] = '\0'; |
281 | 281 | ||
282 | if (fprintf(playlist->control_fd, "P:%d:%s:%s\n", | 282 | if (fdprintf(playlist->control_fd, "P:%d:%s:%s\n", |
283 | PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) | 283 | PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) |
284 | fsync(playlist->control_fd); | 284 | fsync(playlist->control_fd); |
285 | else | 285 | else |
@@ -499,13 +499,13 @@ static int add_track_to_playlist(struct playlist_info* playlist, | |||
499 | 499 | ||
500 | if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) | 500 | if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) |
501 | { | 501 | { |
502 | if (fprintf(playlist->control_fd, "%c:%d:%d:", (queue?'Q':'A'), | 502 | if (fdprintf(playlist->control_fd, "%c:%d:%d:", (queue?'Q':'A'), |
503 | position, playlist->last_insert_pos) > 0) | 503 | position, playlist->last_insert_pos) > 0) |
504 | { | 504 | { |
505 | /* save the position in file where track name is written */ | 505 | /* save the position in file where track name is written */ |
506 | seek_pos = lseek(playlist->control_fd, 0, SEEK_CUR); | 506 | seek_pos = lseek(playlist->control_fd, 0, SEEK_CUR); |
507 | 507 | ||
508 | if (fprintf(playlist->control_fd, "%s\n", filename) > 0) | 508 | if (fdprintf(playlist->control_fd, "%s\n", filename) > 0) |
509 | result = 0; | 509 | result = 0; |
510 | } | 510 | } |
511 | } | 511 | } |
@@ -697,7 +697,7 @@ static int remove_track_from_playlist(struct playlist_info* playlist, | |||
697 | 697 | ||
698 | if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) | 698 | if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) |
699 | { | 699 | { |
700 | if (fprintf(playlist->control_fd, "D:%d\n", position) > 0) | 700 | if (fdprintf(playlist->control_fd, "D:%d\n", position) > 0) |
701 | { | 701 | { |
702 | fsync(playlist->control_fd); | 702 | fsync(playlist->control_fd); |
703 | result = 0; | 703 | result = 0; |
@@ -1098,10 +1098,10 @@ static int flush_pending_control(struct playlist_info* playlist) | |||
1098 | if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) | 1098 | if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) |
1099 | { | 1099 | { |
1100 | if (global_settings.resume_seed == 0) | 1100 | if (global_settings.resume_seed == 0) |
1101 | result = fprintf(playlist->control_fd, "U:%d\n", | 1101 | result = fdprintf(playlist->control_fd, "U:%d\n", |
1102 | playlist->first_index); | 1102 | playlist->first_index); |
1103 | else | 1103 | else |
1104 | result = fprintf(playlist->control_fd, "S:%d:%d\n", | 1104 | result = fdprintf(playlist->control_fd, "S:%d:%d\n", |
1105 | global_settings.resume_seed, playlist->first_index); | 1105 | global_settings.resume_seed, playlist->first_index); |
1106 | 1106 | ||
1107 | if (result > 0) | 1107 | if (result > 0) |
@@ -1737,7 +1737,7 @@ int playlist_next(int steps) | |||
1737 | 1737 | ||
1738 | if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) | 1738 | if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) |
1739 | { | 1739 | { |
1740 | if (fprintf(playlist->control_fd, "R\n") > 0) | 1740 | if (fdprintf(playlist->control_fd, "R\n") > 0) |
1741 | { | 1741 | { |
1742 | fsync(playlist->control_fd); | 1742 | fsync(playlist->control_fd); |
1743 | result = 0; | 1743 | result = 0; |
@@ -2407,7 +2407,7 @@ int playlist_save(struct playlist_info* playlist, char *filename) | |||
2407 | break; | 2407 | break; |
2408 | } | 2408 | } |
2409 | 2409 | ||
2410 | if (fprintf(fd, "%s\n", tmp_buf) < 0) | 2410 | if (fdprintf(fd, "%s\n", tmp_buf) < 0) |
2411 | { | 2411 | { |
2412 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); | 2412 | splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); |
2413 | result = -1; | 2413 | result = -1; |
diff --git a/apps/plugin.c b/apps/plugin.c index 10daeaf325..194ec34484 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -50,18 +50,6 @@ | |||
50 | #include "widgets.h" | 50 | #include "widgets.h" |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #ifdef SIMULATOR | ||
54 | #include <debug.h> | ||
55 | #ifdef WIN32 | ||
56 | #include "plugin-win32.h" | ||
57 | #else | ||
58 | #include <dlfcn.h> | ||
59 | #endif | ||
60 | #define PREFIX(_x_) sim_ ## _x_ | ||
61 | #else | ||
62 | #define PREFIX(_x_) _x_ | ||
63 | #endif | ||
64 | |||
65 | #if MEM >= 32 | 53 | #if MEM >= 32 |
66 | #define PLUGIN_BUFFER_SIZE 0xC0000 | 54 | #define PLUGIN_BUFFER_SIZE 0xC0000 |
67 | #else | 55 | #else |
@@ -70,7 +58,9 @@ | |||
70 | 58 | ||
71 | #ifdef SIMULATOR | 59 | #ifdef SIMULATOR |
72 | static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE]; | 60 | static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE]; |
61 | void *sim_plugin_load(char *plugin, int *fd); | ||
73 | #else | 62 | #else |
63 | #define sim_plugin_close(x) | ||
74 | extern unsigned char pluginbuf[]; | 64 | extern unsigned char pluginbuf[]; |
75 | #include "bitswap.h" | 65 | #include "bitswap.h" |
76 | #endif | 66 | #endif |
@@ -142,16 +132,16 @@ static const struct plugin_api rockbox_api = { | |||
142 | 132 | ||
143 | /* file */ | 133 | /* file */ |
144 | (open_func)PREFIX(open), | 134 | (open_func)PREFIX(open), |
145 | PREFIX(close), | 135 | close, |
146 | (read_func)read, | 136 | (read_func)read, |
147 | lseek, | 137 | lseek, |
148 | (creat_func)PREFIX(creat), | 138 | (creat_func)PREFIX(creat), |
149 | (write_func)write, | 139 | (write_func)write, |
150 | PREFIX(remove), | 140 | PREFIX(remove), |
151 | PREFIX(rename), | 141 | PREFIX(rename), |
152 | ftruncate, | 142 | PREFIX(ftruncate), |
153 | PREFIX(filesize), | 143 | PREFIX(filesize), |
154 | fprintf, | 144 | fdprintf, |
155 | read_line, | 145 | read_line, |
156 | settings_parseline, | 146 | settings_parseline, |
157 | #ifndef SIMULATOR | 147 | #ifndef SIMULATOR |
@@ -189,6 +179,9 @@ static const struct plugin_api rockbox_api = { | |||
189 | memcpy, | 179 | memcpy, |
190 | _ctype_, | 180 | _ctype_, |
191 | atoi, | 181 | atoi, |
182 | strchr, | ||
183 | strcat, | ||
184 | memcmp, | ||
192 | 185 | ||
193 | /* sound */ | 186 | /* sound */ |
194 | mpeg_sound_set, | 187 | mpeg_sound_set, |
@@ -201,7 +194,7 @@ static const struct plugin_api rockbox_api = { | |||
201 | #endif | 194 | #endif |
202 | 195 | ||
203 | /* playback control */ | 196 | /* playback control */ |
204 | mpeg_play, | 197 | PREFIX(mpeg_play), |
205 | mpeg_stop, | 198 | mpeg_stop, |
206 | mpeg_pause, | 199 | mpeg_pause, |
207 | mpeg_resume, | 200 | mpeg_resume, |
@@ -264,10 +257,6 @@ static const struct plugin_api rockbox_api = { | |||
264 | 257 | ||
265 | /* new stuff at the end, sort into place next time | 258 | /* new stuff at the end, sort into place next time |
266 | the API gets incompatible */ | 259 | the API gets incompatible */ |
267 | |||
268 | strchr, | ||
269 | strcat, | ||
270 | memcmp | ||
271 | }; | 260 | }; |
272 | 261 | ||
273 | int plugin_load(const char* plugin, void* parameter) | 262 | int plugin_load(const char* plugin, void* parameter) |
@@ -275,12 +264,8 @@ int plugin_load(const char* plugin, void* parameter) | |||
275 | enum plugin_status (*plugin_start)(struct plugin_api* api, void* param); | 264 | enum plugin_status (*plugin_start)(struct plugin_api* api, void* param); |
276 | int rc; | 265 | int rc; |
277 | char buf[64]; | 266 | char buf[64]; |
278 | #ifdef SIMULATOR | ||
279 | void* pd; | ||
280 | char path[256]; | ||
281 | #else | ||
282 | int fd; | 267 | int fd; |
283 | #endif | 268 | |
284 | #ifdef HAVE_LCD_BITMAP | 269 | #ifdef HAVE_LCD_BITMAP |
285 | int xm,ym; | 270 | int xm,ym; |
286 | #endif | 271 | #endif |
@@ -301,26 +286,9 @@ int plugin_load(const char* plugin, void* parameter) | |||
301 | lcd_clear_display(); | 286 | lcd_clear_display(); |
302 | #endif | 287 | #endif |
303 | #ifdef SIMULATOR | 288 | #ifdef SIMULATOR |
304 | snprintf(path, sizeof path, "archos%s", plugin); | 289 | plugin_start = sim_plugin_load(plugin, &fd); |
305 | 290 | if(!plugin_start) | |
306 | pd = dlopen(path, RTLD_NOW); | ||
307 | if (!pd) { | ||
308 | snprintf(buf, sizeof buf, str(LANG_PLUGIN_CANT_OPEN), plugin); | ||
309 | splash(HZ*2, true, buf); | ||
310 | DEBUGF("dlopen(%s): %s\n",path,dlerror()); | ||
311 | dlclose(pd); | ||
312 | return -1; | 291 | return -1; |
313 | } | ||
314 | |||
315 | plugin_start = dlsym(pd, "plugin_start"); | ||
316 | if (!plugin_start) { | ||
317 | plugin_start = dlsym(pd, "_plugin_start"); | ||
318 | if (!plugin_start) { | ||
319 | splash(HZ*2, true, "Can't find entry point"); | ||
320 | dlclose(pd); | ||
321 | return -1; | ||
322 | } | ||
323 | } | ||
324 | #else | 292 | #else |
325 | fd = open(plugin, O_RDONLY); | 293 | fd = open(plugin, O_RDONLY); |
326 | if (fd < 0) { | 294 | if (fd < 0) { |
@@ -379,9 +347,7 @@ int plugin_load(const char* plugin, void* parameter) | |||
379 | break; | 347 | break; |
380 | } | 348 | } |
381 | 349 | ||
382 | #ifdef SIMULATOR | 350 | sim_plugin_close(fd); |
383 | dlclose(pd); | ||
384 | #endif | ||
385 | 351 | ||
386 | #ifdef HAVE_LCD_BITMAP | 352 | #ifdef HAVE_LCD_BITMAP |
387 | /* restore margins */ | 353 | /* restore margins */ |
diff --git a/apps/plugin.h b/apps/plugin.h index 96a9aabe1d..896565e9a0 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <stdbool.h> | 32 | #include <stdbool.h> |
33 | #include <stdio.h> | 33 | #include <stdio.h> |
34 | #include <stdlib.h> | 34 | #include <stdlib.h> |
35 | #include <sys/types.h> | ||
35 | #include "config.h" | 36 | #include "config.h" |
36 | #include "dir.h" | 37 | #include "dir.h" |
37 | #include "kernel.h" | 38 | #include "kernel.h" |
@@ -51,7 +52,9 @@ | |||
51 | 52 | ||
52 | #ifdef PLUGIN | 53 | #ifdef PLUGIN |
53 | #if defined(DEBUG) || defined(SIMULATOR) | 54 | #if defined(DEBUG) || defined(SIMULATOR) |
55 | #undef DEBUGF | ||
54 | #define DEBUGF rb->debugf | 56 | #define DEBUGF rb->debugf |
57 | #undef LDEBUGF | ||
55 | #define LDEBUGF rb->debugf | 58 | #define LDEBUGF rb->debugf |
56 | #else | 59 | #else |
57 | #define DEBUGF(...) | 60 | #define DEBUGF(...) |
@@ -59,13 +62,19 @@ | |||
59 | #endif | 62 | #endif |
60 | #endif | 63 | #endif |
61 | 64 | ||
65 | #ifdef SIMULATOR | ||
66 | #define PREFIX(_x_) sim_ ## _x_ | ||
67 | #else | ||
68 | #define PREFIX(_x_) _x_ | ||
69 | #endif | ||
70 | |||
62 | /* increase this every time the api struct changes */ | 71 | /* increase this every time the api struct changes */ |
63 | #define PLUGIN_API_VERSION 31 | 72 | #define PLUGIN_API_VERSION 32 |
64 | 73 | ||
65 | /* update this to latest version if a change to the api struct breaks | 74 | /* update this to latest version if a change to the api struct breaks |
66 | backwards compatibility (and please take the opportunity to sort in any | 75 | backwards compatibility (and please take the opportunity to sort in any |
67 | new function which are "waiting" at the end of the function table) */ | 76 | new function which are "waiting" at the end of the function table) */ |
68 | #define PLUGIN_MIN_API_VERSION 29 | 77 | #define PLUGIN_MIN_API_VERSION 32 |
69 | 78 | ||
70 | /* plugin return codes */ | 79 | /* plugin return codes */ |
71 | enum plugin_status { | 80 | enum plugin_status { |
@@ -165,17 +174,17 @@ struct plugin_api { | |||
165 | void (*button_clear_queue)(void); | 174 | void (*button_clear_queue)(void); |
166 | 175 | ||
167 | /* file */ | 176 | /* file */ |
168 | int (*open)(const char* pathname, int flags); | 177 | int (*PREFIX(open))(const char* pathname, int flags); |
169 | int (*close)(int fd); | 178 | int (*close)(int fd); |
170 | ssize_t (*read)(int fd, void* buf, size_t count); | 179 | ssize_t (*read)(int fd, void* buf, size_t count); |
171 | off_t (*lseek)(int fd, off_t offset, int whence); | 180 | off_t (*lseek)(int fd, off_t offset, int whence); |
172 | int (*creat)(const char *pathname, mode_t mode); | 181 | int (*PREFIX(creat))(const char *pathname, mode_t mode); |
173 | ssize_t (*write)(int fd, const void* buf, size_t count); | 182 | ssize_t (*write)(int fd, const void* buf, size_t count); |
174 | int (*remove)(const char* pathname); | 183 | int (*PREFIX(remove))(const char* pathname); |
175 | int (*rename)(const char* path, const char* newname); | 184 | int (*PREFIX(rename))(const char* path, const char* newname); |
176 | int (*ftruncate)(int fd, off_t length); | 185 | int (*PREFIX(ftruncate))(int fd, off_t length); |
177 | off_t (*filesize)(int fd); | 186 | off_t (*PREFIX(filesize))(int fd); |
178 | int (*fprintf)(int fd, const char *fmt, ...); | 187 | int (*fdprintf)(int fd, const char *fmt, ...); |
179 | int (*read_line)(int fd, char* buffer, int buffer_size); | 188 | int (*read_line)(int fd, char* buffer, int buffer_size); |
180 | bool (*settings_parseline)(char* line, char** name, char** value); | 189 | bool (*settings_parseline)(char* line, char** name, char** value); |
181 | #ifndef SIMULATOR | 190 | #ifndef SIMULATOR |
@@ -188,7 +197,7 @@ struct plugin_api { | |||
188 | struct dirent* (*readdir)(DIR* dir); | 197 | struct dirent* (*readdir)(DIR* dir); |
189 | 198 | ||
190 | /* kernel/ system */ | 199 | /* kernel/ system */ |
191 | void (*sleep)(int ticks); | 200 | void (*PREFIX(sleep))(int ticks); |
192 | void (*yield)(void); | 201 | void (*yield)(void); |
193 | long* current_tick; | 202 | long* current_tick; |
194 | long (*default_event_handler)(long event); | 203 | long (*default_event_handler)(long event); |
@@ -213,6 +222,9 @@ struct plugin_api { | |||
213 | void* (*memcpy)(void *out, const void *in, size_t n); | 222 | void* (*memcpy)(void *out, const void *in, size_t n); |
214 | const char *_ctype_; | 223 | const char *_ctype_; |
215 | int (*atoi)(const char *str); | 224 | int (*atoi)(const char *str); |
225 | char *(*strchr)(const char *s, int c); | ||
226 | char *(*strcat)(char *s1, const char *s2); | ||
227 | int (*memcmp)(const void *s1, const void *s2, size_t n); | ||
216 | 228 | ||
217 | /* sound */ | 229 | /* sound */ |
218 | void (*mpeg_sound_set)(int setting, int value); | 230 | void (*mpeg_sound_set)(int setting, int value); |
@@ -225,7 +237,7 @@ struct plugin_api { | |||
225 | #endif | 237 | #endif |
226 | 238 | ||
227 | /* playback control */ | 239 | /* playback control */ |
228 | void (*mpeg_play)(int offset); | 240 | void (*PREFIX(mpeg_play))(int offset); |
229 | void (*mpeg_stop)(void); | 241 | void (*mpeg_stop)(void); |
230 | void (*mpeg_pause)(void); | 242 | void (*mpeg_pause)(void); |
231 | void (*mpeg_resume)(void); | 243 | void (*mpeg_resume)(void); |
@@ -295,10 +307,6 @@ struct plugin_api { | |||
295 | 307 | ||
296 | /* new stuff at the end, sort into place next time | 308 | /* new stuff at the end, sort into place next time |
297 | the API gets incompatible */ | 309 | the API gets incompatible */ |
298 | |||
299 | char *(*strchr)(const char *s, int c); | ||
300 | char *(*strcat)(char *s1, const char *s2); | ||
301 | int (*memcmp)(const void *s1, const void *s2, size_t n); | ||
302 | }; | 310 | }; |
303 | 311 | ||
304 | /* defined by the plugin loader (plugin.c) */ | 312 | /* defined by the plugin loader (plugin.c) */ |
diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile index 9549959bbd..ef506a9c4a 100644 --- a/apps/plugins/Makefile +++ b/apps/plugins/Makefile | |||
@@ -71,7 +71,13 @@ $(OBJDIR)/%.rock : $(OBJDIR)/%.o $(APPSDIR)/plugin.h | |||
71 | @echo "DLL $@" | 71 | @echo "DLL $@" |
72 | @$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $< | 72 | @$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $< |
73 | @$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $< $(OBJDIR)/libplugin.a -o $@ | 73 | @$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $< $(OBJDIR)/libplugin.a -o $@ |
74 | ifeq ($(UNAME),CYGWIN) | ||
75 | # 'x' must be kept or you'll have "Win32 error 5" | ||
76 | # $ fgrep 5 /usr/include/w32api/winerror.h | head -1 | ||
77 | # #define ERROR_ACCESS_DENIED 5L | ||
78 | else | ||
74 | @chmod -x $@ | 79 | @chmod -x $@ |
80 | endif | ||
75 | endif # end of win32-simulator | 81 | endif # end of win32-simulator |
76 | 82 | ||
77 | endif # end of simulator section | 83 | endif # end of simulator section |
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 44b3685c40..8627c9a558 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c | |||
@@ -325,13 +325,13 @@ static bool save_memo(int changed, bool new_mod, struct shown *shown) | |||
325 | } | 325 | } |
326 | if (new_mod) | 326 | if (new_mod) |
327 | { | 327 | { |
328 | rb->fprintf(fq, "%02d%02d%04d%01d%01d%s\n", | 328 | rb->fdprintf(fq, "%02d%02d%04d%01d%01d%s\n", |
329 | memos[changed].day, | 329 | memos[changed].day, |
330 | memos[changed].month, | 330 | memos[changed].month, |
331 | memos[changed].year, | 331 | memos[changed].year, |
332 | memos[changed].wday, | 332 | memos[changed].wday, |
333 | memos[changed].type, | 333 | memos[changed].type, |
334 | memos[changed].message); | 334 | memos[changed].message); |
335 | } | 335 | } |
336 | rb->lseek(fp, memos[changed].file_pointer_end, SEEK_SET); | 336 | rb->lseek(fp, memos[changed].file_pointer_end, SEEK_SET); |
337 | for (i = memos[changed].file_pointer_end; | 337 | for (i = memos[changed].file_pointer_end; |
diff --git a/apps/plugins/lib/configfile.c b/apps/plugins/lib/configfile.c index ff4809a3f4..f2f0a39da0 100644 --- a/apps/plugins/lib/configfile.c +++ b/apps/plugins/lib/configfile.c | |||
@@ -38,24 +38,24 @@ int configfile_save(const char *filename, struct configdata *cfg, | |||
38 | if(fd < 0) | 38 | if(fd < 0) |
39 | return fd*10 - 1; | 39 | return fd*10 - 1; |
40 | 40 | ||
41 | cfg_rb->fprintf(fd, "file version: %d\n", version); | 41 | cfg_rb->fdprintf(fd, "file version: %d\n", version); |
42 | 42 | ||
43 | for(i = 0;i < num_items;i++) { | 43 | for(i = 0;i < num_items;i++) { |
44 | switch(cfg[i].type) { | 44 | switch(cfg[i].type) { |
45 | case TYPE_INT: | 45 | case TYPE_INT: |
46 | cfg_rb->fprintf(fd, "%s: %d\n", | 46 | cfg_rb->fdprintf(fd, "%s: %d\n", |
47 | cfg[i].name, | 47 | cfg[i].name, |
48 | *cfg[i].val); | 48 | *cfg[i].val); |
49 | break; | 49 | break; |
50 | 50 | ||
51 | case TYPE_ENUM: | 51 | case TYPE_ENUM: |
52 | cfg_rb->fprintf(fd, "%s: %s\n", | 52 | cfg_rb->fdprintf(fd, "%s: %s\n", |
53 | cfg[i].name, | 53 | cfg[i].name, |
54 | cfg[i].values[*cfg[i].val]); | 54 | cfg[i].values[*cfg[i].val]); |
55 | break; | 55 | break; |
56 | 56 | ||
57 | case TYPE_STRING: | 57 | case TYPE_STRING: |
58 | cfg_rb->fprintf(fd, "%s: %s\n", | 58 | cfg_rb->fdprintf(fd, "%s: %s\n", |
59 | cfg[i].name, | 59 | cfg[i].name, |
60 | cfg[i].string); | 60 | cfg[i].string); |
61 | break; | 61 | break; |
diff --git a/apps/settings.c b/apps/settings.c index ba80bfb9d9..86c1178745 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -1127,13 +1127,13 @@ static void save_cfg_table(const struct bit_entry* p_table, int count, int fd) | |||
1127 | 1127 | ||
1128 | if (p_run->cfg_val == NULL) /* write as number */ | 1128 | if (p_run->cfg_val == NULL) /* write as number */ |
1129 | { | 1129 | { |
1130 | fprintf(fd, "%s: %ld\r\n", p_run->cfg_name, value); | 1130 | fdprintf(fd, "%s: %ld\r\n", p_run->cfg_name, value); |
1131 | } | 1131 | } |
1132 | else /* write as item */ | 1132 | else /* write as item */ |
1133 | { | 1133 | { |
1134 | const char* p = p_run->cfg_val; | 1134 | const char* p = p_run->cfg_val; |
1135 | 1135 | ||
1136 | fprintf(fd, "%s: ", p_run->cfg_name); | 1136 | fdprintf(fd, "%s: ", p_run->cfg_name); |
1137 | 1137 | ||
1138 | while(value >= 0) | 1138 | while(value >= 0) |
1139 | { | 1139 | { |
@@ -1146,9 +1146,9 @@ static void save_cfg_table(const struct bit_entry* p_table, int count, int fd) | |||
1146 | write(fd, &c, 1); /* char by char, this is lame, OK */ | 1146 | write(fd, &c, 1); /* char by char, this is lame, OK */ |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | fprintf(fd, "\r\n"); | 1149 | fdprintf(fd, "\r\n"); |
1150 | if (p_run->cfg_val != off_on) /* explaination for non-bool */ | 1150 | if (p_run->cfg_val != off_on) /* explaination for non-bool */ |
1151 | fprintf(fd, "# (possible values: %s)\r\n", p_run->cfg_val); | 1151 | fdprintf(fd, "# (possible values: %s)\r\n", p_run->cfg_val); |
1152 | } | 1152 | } |
1153 | } | 1153 | } |
1154 | } | 1154 | } |
@@ -1195,21 +1195,21 @@ bool settings_save_config(void) | |||
1195 | return false; | 1195 | return false; |
1196 | } | 1196 | } |
1197 | 1197 | ||
1198 | fprintf(fd, "# >>> .cfg file created by rockbox %s <<<\r\n", appsversion); | 1198 | fdprintf(fd, "# .cfg file created by rockbox %s - ", appsversion); |
1199 | fprintf(fd, "# >>> http://rockbox.haxx.se <<<\r\n#\r\n"); | 1199 | fdprintf(fd, "http://www.rockbox.org\r\n#\r\n"); |
1200 | fprintf(fd, "#\r\n# wps / language / font \r\n#\r\n"); | 1200 | fdprintf(fd, "#\r\n# wps / language / font \r\n#\r\n"); |
1201 | 1201 | ||
1202 | if (global_settings.wps_file[0] != 0) | 1202 | if (global_settings.wps_file[0] != 0) |
1203 | fprintf(fd, "wps: %s/%s.wps\r\n", ROCKBOX_DIR, | 1203 | fdprintf(fd, "wps: %s/%s.wps\r\n", ROCKBOX_DIR, |
1204 | global_settings.wps_file); | 1204 | global_settings.wps_file); |
1205 | 1205 | ||
1206 | if (global_settings.lang_file[0] != 0) | 1206 | if (global_settings.lang_file[0] != 0) |
1207 | fprintf(fd, "lang: %s/%s.lng\r\n", ROCKBOX_DIR LANG_DIR, | 1207 | fdprintf(fd, "lang: %s/%s.lng\r\n", ROCKBOX_DIR LANG_DIR, |
1208 | global_settings.lang_file); | 1208 | global_settings.lang_file); |
1209 | 1209 | ||
1210 | #ifdef HAVE_LCD_BITMAP | 1210 | #ifdef HAVE_LCD_BITMAP |
1211 | if (global_settings.font_file[0] != 0) | 1211 | if (global_settings.font_file[0] != 0) |
1212 | fprintf(fd, "font: %s/%s.fnt\r\n", ROCKBOX_DIR FONT_DIR, | 1212 | fdprintf(fd, "font: %s/%s.fnt\r\n", ROCKBOX_DIR FONT_DIR, |
1213 | global_settings.font_file); | 1213 | global_settings.font_file); |
1214 | #endif | 1214 | #endif |
1215 | 1215 | ||
diff --git a/firmware/common/sprintf.c b/firmware/common/sprintf.c index 8683945211..3518a1ba5e 100644 --- a/firmware/common/sprintf.c +++ b/firmware/common/sprintf.c | |||
@@ -231,7 +231,7 @@ static int fprfunc(void *pr, unsigned char letter) | |||
231 | } | 231 | } |
232 | 232 | ||
233 | 233 | ||
234 | int fprintf(int fd, const char *fmt, ...) | 234 | int fdprintf(int fd, const char *fmt, ...) |
235 | { | 235 | { |
236 | bool ok; | 236 | bool ok; |
237 | va_list ap; | 237 | va_list ap; |
diff --git a/firmware/debug.c b/firmware/debug.c index 0989e80b17..e3be2de168 100644 --- a/firmware/debug.c +++ b/firmware/debug.c | |||
@@ -216,28 +216,4 @@ void debugf(const char *fmt, ...) | |||
216 | #endif | 216 | #endif |
217 | } | 217 | } |
218 | 218 | ||
219 | |||
220 | #else /* SIMULATOR code coming up */ | ||
221 | |||
222 | void debug_init(void) | ||
223 | { | ||
224 | } | ||
225 | extern void *stderr; | ||
226 | |||
227 | void debugf(const char *fmt, ...) | ||
228 | { | ||
229 | va_list ap; | ||
230 | va_start( ap, fmt ); | ||
231 | vfprintf( stderr, fmt, ap ); | ||
232 | va_end( ap ); | ||
233 | } | ||
234 | |||
235 | void ldebugf(const char* file, int line, const char *fmt, ...) | ||
236 | { | ||
237 | va_list ap; | ||
238 | va_start( ap, fmt ); | ||
239 | fprintf( stderr, "%s:%d ", file, line ); | ||
240 | vfprintf( stderr, fmt, ap ); | ||
241 | va_end( ap ); | ||
242 | } | ||
243 | #endif | 219 | #endif |
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h index 8a4a642a86..bbb4c68ff9 100644 --- a/firmware/export/kernel.h +++ b/firmware/export/kernel.h | |||
@@ -65,6 +65,10 @@ struct mutex | |||
65 | /* global tick variable */ | 65 | /* global tick variable */ |
66 | extern long current_tick; | 66 | extern long current_tick; |
67 | 67 | ||
68 | #ifdef SIMULATOR | ||
69 | #define sleep(x) sim_sleep(x) | ||
70 | #endif | ||
71 | |||
68 | /* kernel functions */ | 72 | /* kernel functions */ |
69 | extern void kernel_init(void); | 73 | extern void kernel_init(void); |
70 | extern void yield(void); | 74 | extern void yield(void); |
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 6d485c2f43..98e2a58a53 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -27,6 +27,10 @@ | |||
27 | #define STYLE_DEFAULT 0 | 27 | #define STYLE_DEFAULT 0 |
28 | #define STYLE_INVERT 1 | 28 | #define STYLE_INVERT 1 |
29 | 29 | ||
30 | #ifdef SIMULATOR | ||
31 | #define lcd_icon(x,y) sim_lcd_icon(x,y) | ||
32 | #endif | ||
33 | |||
30 | /* common functions */ | 34 | /* common functions */ |
31 | extern void lcd_init(void); | 35 | extern void lcd_init(void); |
32 | extern void lcd_clear_display(void); | 36 | extern void lcd_clear_display(void); |
@@ -61,10 +65,6 @@ extern void lcd_update_rect(int x, int y, int width, int height); | |||
61 | #define lcd_update_rect(x,y,w,h) | 65 | #define lcd_update_rect(x,y,w,h) |
62 | #endif | 66 | #endif |
63 | 67 | ||
64 | #if defined(SIMULATOR) | ||
65 | #include "sim_icons.h" | ||
66 | #endif | ||
67 | |||
68 | #ifdef HAVE_LCD_CHARCELLS | 68 | #ifdef HAVE_LCD_CHARCELLS |
69 | 69 | ||
70 | /* Icon definitions for lcd_icon() */ | 70 | /* Icon definitions for lcd_icon() */ |
diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h index 671f9389f0..479c5f2317 100644 --- a/firmware/export/mpeg.h +++ b/firmware/export/mpeg.h | |||
@@ -42,6 +42,10 @@ | |||
42 | /* For ID3 info and VBR header */ | 42 | /* For ID3 info and VBR header */ |
43 | #define MPEG_RESERVED_HEADER_SPACE (4096 + 1500) | 43 | #define MPEG_RESERVED_HEADER_SPACE (4096 + 1500) |
44 | 44 | ||
45 | #ifdef SIMULATOR | ||
46 | #define mpeg_play(x) sim_mpeg_play(x) | ||
47 | #endif | ||
48 | |||
45 | struct mpeg_debug | 49 | struct mpeg_debug |
46 | { | 50 | { |
47 | int mp3buflen; | 51 | int mp3buflen; |
diff --git a/firmware/include/dir.h b/firmware/include/dir.h index 12ec724692..26ccd03ed3 100644 --- a/firmware/include/dir.h +++ b/firmware/include/dir.h | |||
@@ -30,6 +30,16 @@ | |||
30 | #define ATTR_ARCHIVE 0x20 | 30 | #define ATTR_ARCHIVE 0x20 |
31 | #define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */ | 31 | #define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */ |
32 | 32 | ||
33 | #ifdef SIMULATOR | ||
34 | #define dirent sim_dirent | ||
35 | #define DIR SIM_DIR | ||
36 | #define opendir(x) sim_opendir(x) | ||
37 | #define readdir(x) sim_readdir(x) | ||
38 | #define closedir(x) sim_closedir(x) | ||
39 | #define mkdir(x, y) sim_mkdir(x, y) | ||
40 | #define rmdir(x) sim_rmdir(x) | ||
41 | #endif | ||
42 | |||
33 | #ifndef DIRENT_DEFINED | 43 | #ifndef DIRENT_DEFINED |
34 | 44 | ||
35 | struct dirent { | 45 | struct dirent { |
@@ -42,12 +52,10 @@ struct dirent { | |||
42 | }; | 52 | }; |
43 | #endif | 53 | #endif |
44 | 54 | ||
45 | |||
46 | #ifndef SIMULATOR | ||
47 | |||
48 | #include "fat.h" | 55 | #include "fat.h" |
49 | 56 | ||
50 | typedef struct { | 57 | typedef struct { |
58 | #ifndef SIMULATOR | ||
51 | bool busy; | 59 | bool busy; |
52 | int startcluster; | 60 | int startcluster; |
53 | struct fat_dir fatdir; | 61 | struct fat_dir fatdir; |
@@ -56,25 +64,13 @@ typedef struct { | |||
56 | #ifdef HAVE_MULTIVOLUME | 64 | #ifdef HAVE_MULTIVOLUME |
57 | int volumecounter; /* running counter for faked volume entries */ | 65 | int volumecounter; /* running counter for faked volume entries */ |
58 | #endif | 66 | #endif |
67 | #else | ||
68 | /* simulator: */ | ||
69 | void *dir; /* actually a DIR* dir */ | ||
70 | char *name; | ||
71 | #endif | ||
59 | } DIR; | 72 | } DIR; |
60 | 73 | ||
61 | #else /* SIMULATOR */ | ||
62 | |||
63 | #ifdef WIN32 | ||
64 | #ifndef __MINGW32__ | ||
65 | #include <io.h> | ||
66 | #endif /* __MINGW32__ */ | ||
67 | |||
68 | typedef struct DIRtag | ||
69 | { | ||
70 | struct dirent fd; | ||
71 | int handle; | ||
72 | } DIR; | ||
73 | |||
74 | #endif /* WIN32 */ | ||
75 | |||
76 | #endif /* SIMULATOR */ | ||
77 | |||
78 | #ifndef DIRFUNCTIONS_DEFINED | 74 | #ifndef DIRFUNCTIONS_DEFINED |
79 | 75 | ||
80 | extern DIR* opendir(const char* name); | 76 | extern DIR* opendir(const char* name); |
diff --git a/firmware/include/file.h b/firmware/include/file.h index af1ad72be9..694de48348 100644 --- a/firmware/include/file.h +++ b/firmware/include/file.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #ifndef _FILE_H_ | 20 | #ifndef _FILE_H_ |
21 | #define _FILE_H_ | 21 | #define _FILE_H_ |
22 | 22 | ||
23 | #include <sys/types.h> | ||
24 | |||
23 | #undef MAX_PATH /* this avoids problems when building simulator */ | 25 | #undef MAX_PATH /* this avoids problems when building simulator */ |
24 | #define MAX_PATH 260 | 26 | #define MAX_PATH 260 |
25 | 27 | ||
@@ -42,30 +44,14 @@ | |||
42 | #define O_TRUNC 0x10 | 44 | #define O_TRUNC 0x10 |
43 | #endif | 45 | #endif |
44 | 46 | ||
45 | #if !defined(__ssize_t_defined) && !defined(_SSIZE_T_) && !defined(ssize_t) | 47 | #ifdef SIMULATOR |
46 | #define __ssize_t_defined | 48 | #define open(x,y) sim_open(x,y) |
47 | #define _SSIZE_T_ | 49 | #define creat(x,y) sim_creat(x,y) |
48 | #define ssize_t ssize_t | 50 | #define remove(x) sim_remove(x) |
49 | typedef signed long ssize_t; | 51 | #define rename(x,y) sim_rename(x,y) |
50 | #endif | 52 | #define filesize(x) sim_filesize(x) |
51 | 53 | #define fsync(x) sim_fsync(x) | |
52 | #if !defined(__off_t_defined) && !defined(_OFF_T_) && !defined(off_t) | 54 | #define ftruncate(x,y) sim_ftruncate(x,y) |
53 | #define __off_t_defined | ||
54 | #define _OFF_T_ | ||
55 | #define off_t off_t | ||
56 | typedef signed long off_t; | ||
57 | #endif | ||
58 | |||
59 | #if !defined(__mode_t_defined) && !defined(_MODE_T_) && !defined(mode_t) | ||
60 | #define __mode_t_defined | ||
61 | #define _MODE_T_ | ||
62 | #define mode_t mode_t | ||
63 | typedef unsigned int mode_t; | ||
64 | #endif | ||
65 | |||
66 | #ifndef _SIZE_T | ||
67 | #define _SIZE_T | ||
68 | typedef unsigned long size_t; | ||
69 | #endif | 55 | #endif |
70 | 56 | ||
71 | typedef int (*open_func)(const char* pathname, int flags); | 57 | typedef int (*open_func)(const char* pathname, int flags); |
@@ -75,7 +61,6 @@ typedef ssize_t (*write_func)(int fd, const void *buf, size_t count); | |||
75 | typedef void (*qsort_func)(void *base, size_t nmemb, size_t size, | 61 | typedef void (*qsort_func)(void *base, size_t nmemb, size_t size, |
76 | int(*_compar)(const void *, const void *)); | 62 | int(*_compar)(const void *, const void *)); |
77 | 63 | ||
78 | #ifndef SIMULATOR | ||
79 | extern int open(const char* pathname, int flags); | 64 | extern int open(const char* pathname, int flags); |
80 | extern int close(int fd); | 65 | extern int close(int fd); |
81 | extern int fsync(int fd); | 66 | extern int fsync(int fd); |
@@ -88,6 +73,5 @@ extern int rename(const char* path, const char* newname); | |||
88 | extern int ftruncate(int fd, off_t length); | 73 | extern int ftruncate(int fd, off_t length); |
89 | extern off_t filesize(int fd); | 74 | extern off_t filesize(int fd); |
90 | extern int release_files(int volume); | 75 | extern int release_files(int volume); |
91 | #endif /* SIMULATOR */ | ||
92 | 76 | ||
93 | #endif | 77 | #endif |
diff --git a/firmware/include/sprintf.h b/firmware/include/sprintf.h index d68647ee72..b667a0406b 100644 --- a/firmware/include/sprintf.h +++ b/firmware/include/sprintf.h | |||
@@ -33,7 +33,7 @@ int snprintf (char *buf, size_t size, const char *fmt, ...) | |||
33 | ATTRIBUTE_PRINTF(3, 4); | 33 | ATTRIBUTE_PRINTF(3, 4); |
34 | 34 | ||
35 | int vsnprintf (char *buf, int size, const char *fmt, va_list ap); | 35 | int vsnprintf (char *buf, int size, const char *fmt, va_list ap); |
36 | int fprintf (int fd, const char *fmt, ...) | 36 | int fdprintf (int fd, const char *fmt, ...) |
37 | ATTRIBUTE_PRINTF(2, 3); | 37 | ATTRIBUTE_PRINTF(2, 3); |
38 | 38 | ||
39 | #endif /* __SPRINTF_H__ */ | 39 | #endif /* __SPRINTF_H__ */ |
diff --git a/firmware/include/stdio.h b/firmware/include/stdio.h index dd22f7d5b1..968bd59aab 100644 --- a/firmware/include/stdio.h +++ b/firmware/include/stdio.h | |||
@@ -39,7 +39,6 @@ int vsnprintf (char *buf, int size, const char *fmt, __VALIST ap); | |||
39 | #ifdef SIMULATOR | 39 | #ifdef SIMULATOR |
40 | typedef void FILE; | 40 | typedef void FILE; |
41 | int vfprintf(FILE *stream, const char *format, __VALIST ap); | 41 | int vfprintf(FILE *stream, const char *format, __VALIST ap); |
42 | int fprintf(FILE *stream, const char *format, ...); | ||
43 | #ifdef WIN32 | 42 | #ifdef WIN32 |
44 | #define FILENAME_MAX 260 /* ugly hard-coded value of a limit that is set | 43 | #define FILENAME_MAX 260 /* ugly hard-coded value of a limit that is set |
45 | in file.h */ | 44 | in file.h */ |
diff --git a/uisimulator/x11/kernel.h b/firmware/include/sys/types.h index f165d92eb3..7bca33b78d 100644 --- a/uisimulator/x11/kernel.h +++ b/firmware/include/sys/types.h | |||
@@ -1,13 +1,13 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * __________ __ ___. | 2 | * __________ __ ___. |
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se> | 10 | * Copyright (C) 2005 by Daniel Stenberg |
11 | * | 11 | * |
12 | * All files in this archive are subject to the GNU General Public License. | 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. | 13 | * See the file COPYING in the source tree root for full license agreement. |
@@ -17,15 +17,33 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | #include "../../firmware/export/kernel.h" | 20 | #ifndef _SYS_TYPES_H_ |
21 | #define _SYS_TYPES_H_ | ||
21 | 22 | ||
22 | #ifndef NO_REDEFINES_PLEASE | 23 | #if !defined(__ssize_t_defined) && !defined(_SSIZE_T_) && !defined(ssize_t) |
24 | #define __ssize_t_defined | ||
25 | #define _SSIZE_T_ | ||
26 | #define ssize_t ssize_t | ||
27 | typedef signed long ssize_t; | ||
28 | #endif | ||
29 | |||
30 | #if !defined(__off_t_defined) && !defined(_OFF_T_) && !defined(off_t) | ||
31 | #define __off_t_defined | ||
32 | #define _OFF_T_ | ||
33 | #define off_t off_t | ||
34 | typedef signed long off_t; | ||
35 | #endif | ||
23 | 36 | ||
24 | #define sleep(x) sim_sleep(x) | 37 | #if !defined(__mode_t_defined) && !defined(_MODE_T_) && !defined(mode_t) |
25 | #define mutex_init(x) (void)x | 38 | #define __mode_t_defined |
26 | #define mutex_lock(x) (void)x | 39 | #define _MODE_T_ |
27 | #define mutex_unlock(x) (void)x | 40 | #define mode_t mode_t |
41 | typedef unsigned int mode_t; | ||
42 | #endif | ||
28 | 43 | ||
44 | #ifndef _SIZE_T | ||
45 | #define _SIZE_T | ||
46 | typedef unsigned long size_t; | ||
29 | #endif | 47 | #endif |
30 | 48 | ||
31 | void sim_sleep(int); | 49 | #endif /* _SYS_TYPES_H */ |
diff --git a/firmware/kernel.c b/firmware/kernel.c index 1306b4b524..d21244202f 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c | |||
@@ -352,6 +352,11 @@ int tick_remove_task(void (*f)(void)) | |||
352 | return -1; | 352 | return -1; |
353 | } | 353 | } |
354 | 354 | ||
355 | #ifndef SIMULATOR | ||
356 | /* | ||
357 | * Simulator versions in uisimulator/SIMVER/ | ||
358 | */ | ||
359 | |||
355 | /**************************************************************************** | 360 | /**************************************************************************** |
356 | * Simple mutex functions | 361 | * Simple mutex functions |
357 | ****************************************************************************/ | 362 | ****************************************************************************/ |
@@ -375,3 +380,5 @@ void mutex_unlock(struct mutex *m) | |||
375 | { | 380 | { |
376 | m->locked = false; | 381 | m->locked = false; |
377 | } | 382 | } |
383 | |||
384 | #endif | ||
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 8673da9980..5d4c5daa5c 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -39,8 +39,6 @@ | |||
39 | #include "usb.h" | 39 | #include "usb.h" |
40 | #include "file.h" | 40 | #include "file.h" |
41 | #include "hwcompat.h" | 41 | #include "hwcompat.h" |
42 | #else | ||
43 | #include "mpegplay.h" | ||
44 | #endif /* #ifndef SIMULATOR */ | 42 | #endif /* #ifndef SIMULATOR */ |
45 | 43 | ||
46 | #include "bitswap.h" | 44 | #include "bitswap.h" |
diff --git a/tools/configure b/tools/configure index 364a3d707e..c56f28edba 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -48,19 +48,29 @@ simcc () { | |||
48 | # default tool setup for native building | 48 | # default tool setup for native building |
49 | prefixtools "" | 49 | prefixtools "" |
50 | 50 | ||
51 | GCCOPTS='-W -Wall -g -fno-builtin -I$(ROOTDIR)/uisimulator/common -I$(ROOTDIR)/uisimulator/$(SIMVER)' | 51 | GCCOPTS='-W -Wall -g -fno-builtin' |
52 | 52 | ||
53 | output="rockboxui" # use this as default output binary name | 53 | output="rockboxui" # use this as default output binary name |
54 | 54 | ||
55 | case $uname in | 55 | case $uname in |
56 | CYGWIN*) | 56 | CYGWIN*) |
57 | echo "Cygwin host detected" | 57 | echo "Cygwin host detected" |
58 | LDOPTS='-L/usr/X11R6/lib -lSM -lICE -lXt -lX11 -lXmu -lSM -lICE -lX11 -lpthread' | 58 | |
59 | if [ "$simver" = "win32" ]; then | ||
60 | # win32 version | ||
61 | GCCOPTS="$GCCOPTS -mno-cygwin -DNOCYGWIN" | ||
62 | LDOPTS="-lgdi32 -luser32 -mno-cygwin" | ||
63 | else | ||
64 | # x11 version | ||
65 | GCCOPTS="$GCCOPTS -DNOCYGWIN" | ||
66 | LDOPTS='-L/usr/X11R6/lib -lSM -lICE -lXt -lX11 -lXmu -lSM -lICE -lX11 -lpthread' | ||
67 | fi | ||
59 | output="rockboxui.exe" # use this as output binary name | 68 | output="rockboxui.exe" # use this as output binary name |
60 | ;; | 69 | ;; |
61 | 70 | ||
62 | Linux) | 71 | Linux) |
63 | echo "Linux host detected" | 72 | echo "Linux host detected" |
73 | GCCOPTS="$GCCOPTS" | ||
64 | LDOPTS='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -lnsl -ldl -lpthread' | 74 | LDOPTS='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -lnsl -ldl -lpthread' |
65 | if [ "$simver" = "win32" ]; then | 75 | if [ "$simver" = "win32" ]; then |
66 | crosswincc # setup cross-compiler | 76 | crosswincc # setup cross-compiler |
diff --git a/tools/make.inc b/tools/make.inc index 0da7a8b17c..7823d08b67 100644 --- a/tools/make.inc +++ b/tools/make.inc | |||
@@ -3,7 +3,7 @@ | |||
3 | $(OBJDIR)/%.o: %.c | 3 | $(OBJDIR)/%.o: %.c |
4 | @mkdir -p `dirname $@` | 4 | @mkdir -p `dirname $@` |
5 | @echo "CC $<" | 5 | @echo "CC $<" |
6 | @$(CC) $(CFLAGS) -c $< -o $@ | 6 | $(CC) $(CFLAGS) -c $< -o $@ |
7 | 7 | ||
8 | $(OBJDIR)/%.o: %.S | 8 | $(OBJDIR)/%.o: %.S |
9 | @mkdir -p `dirname $@` | 9 | @mkdir -p `dirname $@` |
diff --git a/uisimulator/common/Makefile b/uisimulator/common/Makefile index b044440adf..e2b6b2a4f8 100644 --- a/uisimulator/common/Makefile +++ b/uisimulator/common/Makefile | |||
@@ -23,7 +23,7 @@ RM = rm -f | |||
23 | DEBUG = -g | 23 | DEBUG = -g |
24 | 24 | ||
25 | # Use this for simulator-only files | 25 | # Use this for simulator-only files |
26 | INCLUDES = -I. -I$(OBJDIR) -I$(FIRMDIR)/export -I$(APPSDIR) | 26 | INCLUDES = -I. -I$(OBJDIR) -I$(FIRMDIR)/export -I$(APPSDIR) -I$(ROOTDIR)/uisimulator/$(SIMVER) |
27 | 27 | ||
28 | SRC := $(shell cat SOURCES | gcc -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \ | 28 | SRC := $(shell cat SOURCES | gcc -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \ |
29 | $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - ) | 29 | $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - ) |
@@ -38,7 +38,7 @@ DIRS = . | |||
38 | 38 | ||
39 | CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) $(GCCOPTS) | 39 | CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) $(GCCOPTS) |
40 | 40 | ||
41 | OUTFILE = $(OBJDIR)/libsim.a | 41 | OUTFILE = $(OBJDIR)/libcomsim.a |
42 | 42 | ||
43 | all: $(OUTFILE) | 43 | all: $(OUTFILE) |
44 | 44 | ||
@@ -46,7 +46,7 @@ include $(TOOLSDIR)/make.inc | |||
46 | 46 | ||
47 | clean: | 47 | clean: |
48 | @echo "cleaning commonsim" | 48 | @echo "cleaning commonsim" |
49 | @$(RM) $(OBJS) *~ core $(DEPFILE) | 49 | @$(RM) $(OBJS) *~ core $(DEPFILE) $(OUTFILE) |
50 | 50 | ||
51 | $(OUTFILE): $(OBJS) | 51 | $(OUTFILE): $(OBJS) |
52 | @echo "AR+RANLIB $@" | 52 | @echo "AR+RANLIB $@" |
diff --git a/uisimulator/common/dir.h b/uisimulator/common/dir.h deleted file mode 100644 index 18cfbb3736..0000000000 --- a/uisimulator/common/dir.h +++ /dev/null | |||
@@ -1,45 +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 | #ifndef _SIM_DIR_H_ | ||
20 | #define _SIM_DIR_H_ | ||
21 | |||
22 | #include <sys/types.h> | ||
23 | |||
24 | #define DIRFUNCTIONS_DEFINED /* prevent those prototypes */ | ||
25 | #define dirent sim_dirent | ||
26 | #include "../../firmware/include/dir.h" | ||
27 | #undef dirent | ||
28 | |||
29 | typedef void * MYDIR; | ||
30 | |||
31 | extern MYDIR *sim_opendir(const char *name); | ||
32 | extern struct sim_dirent* sim_readdir(MYDIR* dir); | ||
33 | extern int sim_closedir(MYDIR *dir); | ||
34 | extern int sim_mkdir(const char *name, int mode); | ||
35 | extern int sim_rmdir(char *name); | ||
36 | |||
37 | #define DIR MYDIR | ||
38 | #define dirent sim_dirent | ||
39 | #define opendir(x) sim_opendir(x) | ||
40 | #define readdir(x) sim_readdir(x) | ||
41 | #define closedir(x) sim_closedir(x) | ||
42 | #define mkdir(x, y) sim_mkdir(x, y) | ||
43 | #define rmdir(x) sim_rmdir(x) | ||
44 | |||
45 | #endif | ||
diff --git a/uisimulator/common/file.h b/uisimulator/common/file.h deleted file mode 100644 index 7ea59a0b74..0000000000 --- a/uisimulator/common/file.h +++ /dev/null | |||
@@ -1,76 +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 _SIM_FILE_H_ | ||
21 | #define _SIM_FILE_H_ | ||
22 | |||
23 | #ifdef WIN32 | ||
24 | #include <io.h> | ||
25 | #include <fcntl.h> | ||
26 | #else | ||
27 | #include <stdio.h> | ||
28 | #endif | ||
29 | |||
30 | #include <sys/types.h> | ||
31 | |||
32 | #ifdef WIN32 | ||
33 | #ifndef _commit | ||
34 | extern int _commit( int handle ); | ||
35 | |||
36 | #ifdef _MSC_VER | ||
37 | typedef unsigned int mode_t; | ||
38 | #endif | ||
39 | |||
40 | #endif | ||
41 | #endif | ||
42 | |||
43 | int sim_open(const char *name, int opts); | ||
44 | int sim_close(int fd); | ||
45 | int sim_rename(const char *oldpath, const char *newpath); | ||
46 | off_t sim_filesize(int fd); | ||
47 | int sim_creat(const char *name, mode_t mode); | ||
48 | int sim_remove(const char *name); | ||
49 | |||
50 | #ifndef NO_REDEFINES_PLEASE | ||
51 | #define open(x,y) sim_open(x,y) | ||
52 | #define close(x) sim_close(x) | ||
53 | #define filesize(x) sim_filesize(x) | ||
54 | #define creat(x,y) sim_creat(x,y) | ||
55 | #define remove(x) sim_remove(x) | ||
56 | #define rename(x,y) sim_rename(x,y) | ||
57 | #ifdef WIN32 | ||
58 | #define fsync _commit | ||
59 | #endif | ||
60 | #endif | ||
61 | |||
62 | #include "../../firmware/include/file.h" | ||
63 | |||
64 | #ifndef WIN32 | ||
65 | int open(const char* pathname, int flags); | ||
66 | int close(int fd); | ||
67 | int printf(const char *format, ...); | ||
68 | int ftruncate(int fd, off_t length); | ||
69 | int fsync(int fd); | ||
70 | |||
71 | off_t lseek(int fildes, off_t offset, int whence); | ||
72 | ssize_t read(int fd, void *buf, size_t count); | ||
73 | ssize_t write(int fd, const void *buf, size_t count); | ||
74 | #endif | ||
75 | |||
76 | #endif | ||
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index 6335735f8f..48b888a027 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <stdio.h> | 20 | #include <stdio.h> |
21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
22 | #include <string.h> | 22 | #include <string.h> |
23 | #include <stdarg.h> | ||
23 | #include <sys/stat.h> | 24 | #include <sys/stat.h> |
24 | #ifdef __FreeBSD__ | 25 | #ifdef __FreeBSD__ |
25 | #include <sys/param.h> | 26 | #include <sys/param.h> |
@@ -28,6 +29,10 @@ | |||
28 | #include <sys/vfs.h> | 29 | #include <sys/vfs.h> |
29 | #endif | 30 | #endif |
30 | 31 | ||
32 | #ifdef WIN32 | ||
33 | #include <windows.h> | ||
34 | #endif | ||
35 | |||
31 | #ifndef _MSC_VER | 36 | #ifndef _MSC_VER |
32 | #include <dirent.h> | 37 | #include <dirent.h> |
33 | #include <unistd.h> | 38 | #include <unistd.h> |
@@ -35,18 +40,27 @@ | |||
35 | #include "dir-win32.h" | 40 | #include "dir-win32.h" |
36 | #endif | 41 | #endif |
37 | 42 | ||
43 | #define MAX_PATH 260 | ||
44 | |||
38 | #include <fcntl.h> | 45 | #include <fcntl.h> |
39 | #include "debug.h" | 46 | #include "debug.h" |
40 | 47 | ||
41 | #define DIRFUNCTIONS_DEFINED /* prevent those prototypes */ | ||
42 | #define dirent sim_dirent | ||
43 | #define DIR SIMDIR | ||
44 | #include "../../firmware/include/dir.h" | ||
45 | #undef dirent | ||
46 | #undef DIR | ||
47 | |||
48 | #define SIMULATOR_ARCHOS_ROOT "archos" | 48 | #define SIMULATOR_ARCHOS_ROOT "archos" |
49 | 49 | ||
50 | struct sim_dirent { | ||
51 | unsigned char d_name[MAX_PATH]; | ||
52 | int attribute; | ||
53 | int size; | ||
54 | int startcluster; | ||
55 | unsigned short wrtdate; /* Last write date */ | ||
56 | unsigned short wrttime; /* Last write time */ | ||
57 | }; | ||
58 | |||
59 | struct dirstruct { | ||
60 | void *dir; /* actually a DIR* dir */ | ||
61 | char *name; | ||
62 | } SIM_DIR; | ||
63 | |||
50 | struct mydir { | 64 | struct mydir { |
51 | DIR *dir; | 65 | DIR *dir; |
52 | char *name; | 66 | char *name; |
@@ -113,6 +127,8 @@ struct sim_dirent *sim_readdir(MYDIR *dir) | |||
113 | dir->name, x11->d_name); | 127 | dir->name, x11->d_name); |
114 | stat(buffer, &s); /* get info */ | 128 | stat(buffer, &s); /* get info */ |
115 | 129 | ||
130 | #define ATTR_DIRECTORY 0x10 | ||
131 | |||
116 | secret.attribute = S_ISDIR(s.st_mode)?ATTR_DIRECTORY:0; | 132 | secret.attribute = S_ISDIR(s.st_mode)?ATTR_DIRECTORY:0; |
117 | secret.size = s.st_size; | 133 | secret.size = s.st_size; |
118 | secret.wrtdate = (unsigned short)(s.st_mtime >> 16); | 134 | secret.wrtdate = (unsigned short)(s.st_mtime >> 16); |
@@ -181,6 +197,7 @@ int sim_mkdir(const char *name, mode_t mode) | |||
181 | 197 | ||
182 | debugf("We create the real directory '%s'\n", buffer); | 198 | debugf("We create the real directory '%s'\n", buffer); |
183 | #ifdef WIN32 | 199 | #ifdef WIN32 |
200 | /* since we build with -DNOCYGWIN we have the plain win32 version */ | ||
184 | return (mkdir)(buffer); | 201 | return (mkdir)(buffer); |
185 | #else | 202 | #else |
186 | return (mkdir)(buffer, 0666); | 203 | return (mkdir)(buffer, 0666); |
@@ -260,3 +277,96 @@ void fat_size(unsigned int* size, unsigned int* free) | |||
260 | } | 277 | } |
261 | #endif | 278 | #endif |
262 | } | 279 | } |
280 | |||
281 | int sim_fsync(int fd) | ||
282 | { | ||
283 | #ifdef WIN32 | ||
284 | return _commit(fd); | ||
285 | #else | ||
286 | return fsync(fd); | ||
287 | #endif | ||
288 | } | ||
289 | |||
290 | #ifdef WIN32 | ||
291 | /* sim-win32 */ | ||
292 | typedef enum plugin_status (*plugin_fn)(void* api, void* param); | ||
293 | #define dlopen(_x_, _y_) LoadLibrary(_x_) | ||
294 | #define dlsym(_x_, _y_) (plugin_fn)GetProcAddress(_x_, _y_) | ||
295 | #define dlclose(_x_) FreeLibrary(_x_) | ||
296 | #define dlerror() "Unknown" | ||
297 | #else | ||
298 | /* sim-x11 */ | ||
299 | #include <dlfcn.h> | ||
300 | #endif | ||
301 | |||
302 | void *sim_plugin_load(char *plugin, int *fd) | ||
303 | { | ||
304 | void* pd; | ||
305 | char path[256]; | ||
306 | char buf[256]; | ||
307 | int (*plugin_start)(void * api, void* param); | ||
308 | |||
309 | snprintf(path, sizeof path, "archos%s", plugin); | ||
310 | |||
311 | *fd = -1; | ||
312 | |||
313 | pd = dlopen(path, RTLD_NOW); | ||
314 | if (!pd) { | ||
315 | snprintf(buf, sizeof buf, "failed to load %s", plugin); | ||
316 | DEBUGF("dlopen(%s): %s\n",path,dlerror()); | ||
317 | dlclose(pd); | ||
318 | return NULL; | ||
319 | } | ||
320 | |||
321 | plugin_start = dlsym(pd, "plugin_start"); | ||
322 | if (!plugin_start) { | ||
323 | plugin_start = dlsym(pd, "_plugin_start"); | ||
324 | if (!plugin_start) { | ||
325 | dlclose(pd); | ||
326 | return NULL; | ||
327 | } | ||
328 | } | ||
329 | *fd = pd; /* success */ | ||
330 | return plugin_start; | ||
331 | } | ||
332 | |||
333 | void sim_plugin_close(int pd) | ||
334 | { | ||
335 | dlclose(pd); | ||
336 | } | ||
337 | |||
338 | #ifndef WIN32 | ||
339 | /* the win32 version is in debug-win32.c */ | ||
340 | |||
341 | void debug_init(void) | ||
342 | { | ||
343 | /* nothing to be done */ | ||
344 | } | ||
345 | |||
346 | void debugf(const char *fmt, ...) | ||
347 | { | ||
348 | va_list ap; | ||
349 | va_start( ap, fmt ); | ||
350 | vfprintf( stderr, fmt, ap ); | ||
351 | va_end( ap ); | ||
352 | } | ||
353 | |||
354 | void ldebugf(const char* file, int line, const char *fmt, ...) | ||
355 | { | ||
356 | va_list ap; | ||
357 | va_start( ap, fmt ); | ||
358 | fprintf( stderr, "%s:%d ", file, line ); | ||
359 | vfprintf( stderr, fmt, ap ); | ||
360 | va_end( ap ); | ||
361 | } | ||
362 | |||
363 | #endif | ||
364 | |||
365 | int sim_ftruncate(int fd, off_t length) | ||
366 | { | ||
367 | #ifdef WIN32 | ||
368 | return _chsize(fd, length); | ||
369 | #else | ||
370 | return ftruncate(fd, length); | ||
371 | #endif | ||
372 | } | ||
diff --git a/uisimulator/common/lcd-common.c b/uisimulator/common/lcd-common.c index c69ef06f1f..95c42ad8db 100644 --- a/uisimulator/common/lcd-common.c +++ b/uisimulator/common/lcd-common.c | |||
@@ -25,9 +25,9 @@ | |||
25 | #include "lcd.h" | 25 | #include "lcd.h" |
26 | 26 | ||
27 | #ifdef WIN32 | 27 | #ifdef WIN32 |
28 | #include "lcd-win32.h" | 28 | #include "lcd-win32.h" |
29 | #else | 29 | #else |
30 | #include "lcd-x11.h" | 30 | #include "lcd-x11.h" |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | void lcd_blit(const unsigned char* p_data, int x, int y, int width, int height, | 33 | void lcd_blit(const unsigned char* p_data, int x, int y, int width, int height, |
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c index c43fb5f1f2..3ed16e8e34 100644 --- a/uisimulator/common/stubs.c +++ b/uisimulator/common/stubs.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #include "string.h" | 29 | #include "string.h" |
30 | #include "lcd.h" | 30 | #include "lcd.h" |
31 | #include "settings.h" | 31 | |
32 | #include "ata.h" /* for volume definitions */ | 32 | #include "ata.h" /* for volume definitions */ |
33 | 33 | ||
34 | extern char having_new_lcd; | 34 | extern char having_new_lcd; |
@@ -285,5 +285,6 @@ void remove_thread(int threadnum) | |||
285 | } | 285 | } |
286 | 286 | ||
287 | /* assure an unused place to direct virtual pointers to */ | 287 | /* assure an unused place to direct virtual pointers to */ |
288 | #define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */ | ||
288 | unsigned char vp_dummy[VIRT_SIZE]; | 289 | unsigned char vp_dummy[VIRT_SIZE]; |
289 | 290 | ||
diff --git a/uisimulator/win32/Makefile b/uisimulator/win32/Makefile index 4878d85bf1..f429cad8b5 100644 --- a/uisimulator/win32/Makefile +++ b/uisimulator/win32/Makefile | |||
@@ -29,8 +29,6 @@ INCLUDES = -I. -I$(SIMCOMMON) -I$(OBJDIR) -I$(FIRMDIR)/export -I$(APPSDIR) | |||
29 | DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \ | 29 | DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \ |
30 | $(TARGET) -DAPPSVERSION=\"$(VERSION)\" -DMEM=${MEMORYSIZE} $(EXTRA_DEFINES) | 30 | $(TARGET) -DAPPSVERSION=\"$(VERSION)\" -DMEM=${MEMORYSIZE} $(EXTRA_DEFINES) |
31 | 31 | ||
32 | LDFLAGS = -lgdi32 -luser32 | ||
33 | |||
34 | SRC := $(shell cat SOURCES | gcc -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \ | 32 | SRC := $(shell cat SOURCES | gcc -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \ |
35 | $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - ) | 33 | $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - ) |
36 | OBJS := $(SRC:%.c=$(OBJDIR)/%.o) | 34 | OBJS := $(SRC:%.c=$(OBJDIR)/%.o) |
@@ -40,20 +38,15 @@ DIRS = . | |||
40 | 38 | ||
41 | CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) -W -Wall -mno-cygwin | 39 | CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) -W -Wall -mno-cygwin |
42 | 40 | ||
43 | DLLTOOLFLAGS = --export-all | ||
44 | DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin | ||
45 | |||
46 | OUTFILE = $(OBJDIR)/libsim.a | 41 | OUTFILE = $(OBJDIR)/libsim.a |
47 | 42 | ||
48 | all: $(OUTFILE) | 43 | all: $(OUTFILE) |
49 | @echo "MAKE in common sim" | 44 | @echo "MAKE in common sim" |
50 | $(MAKE) -C $(SIMCOMMON) | 45 | $(MAKE) -C $(SIMCOMMON) |
51 | 46 | ||
52 | include $(TOOLSDIR)/make.inc | 47 | $(OUTFILE): $(OBJS) $(OBJDIR)/UI256.bmp $(OBJDIR)/uisw32-res.o |
53 | |||
54 | $(OUTFILE): $(OBJS) | ||
55 | @echo "AR+RANLIB $@" | 48 | @echo "AR+RANLIB $@" |
56 | @$(AR) ruv $@ $(OBJS) >/dev/null 2>&1 | 49 | @$(AR) ruv $@ $(OBJS) $(OBJDIR)/uisw32-res.o >/dev/null 2>&1 |
57 | @$(RANLIB) $@ | 50 | @$(RANLIB) $@ |
58 | 51 | ||
59 | clean: | 52 | clean: |
@@ -68,6 +61,8 @@ $(OBJDIR)/UI256.bmp: UI-$(ARCHOS).bmp | |||
68 | @cp $< $@ | 61 | @cp $< $@ |
69 | 62 | ||
70 | $(OBJDIR)/uisw32-res.o: uisw32.rc $(OBJDIR)/UI256.bmp | 63 | $(OBJDIR)/uisw32-res.o: uisw32.rc $(OBJDIR)/UI256.bmp |
71 | $(WINDRES) -I$(OBJDIR) -i $< -o $@ | 64 | $(WINDRES) --include-dir $(OBJDIR) -i $< -o $@ |
65 | |||
66 | include $(TOOLSDIR)/make.inc | ||
72 | 67 | ||
73 | -include $(DEPFILE) | 68 | -include $(DEPFILE) |
diff --git a/uisimulator/win32/SOURCES b/uisimulator/win32/SOURCES index 6a52c5ed5e..a88115ade6 100644 --- a/uisimulator/win32/SOURCES +++ b/uisimulator/win32/SOURCES | |||
@@ -1,6 +1,8 @@ | |||
1 | button.c | 1 | button.c |
2 | debug-win32.c | 2 | debug-win32.c |
3 | #if 0 /* this is only for non-cygwin simulator builds */ | ||
3 | dir-win32.c | 4 | dir-win32.c |
5 | #endif | ||
4 | kernel.c | 6 | kernel.c |
5 | lcd-win32.c | 7 | lcd-win32.c |
6 | mpeg-win32.c | 8 | mpeg-win32.c |
diff --git a/uisimulator/win32/dir-win32.h b/uisimulator/win32/dir-win32.h index 888a83767a..95ce326e9f 100644 --- a/uisimulator/win32/dir-win32.h +++ b/uisimulator/win32/dir-win32.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #define _DIR_WIN32_H_ | 20 | #define _DIR_WIN32_H_ |
21 | 21 | ||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | #include "file.h" | ||
24 | 23 | ||
25 | struct dirent { | 24 | struct dirent { |
26 | unsigned char d_name[MAX_PATH]; | 25 | unsigned char d_name[MAX_PATH]; |
diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile index 68815fe8d8..0c0c31183d 100644 --- a/uisimulator/x11/Makefile +++ b/uisimulator/x11/Makefile | |||
@@ -43,8 +43,7 @@ CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) $(GCCOPTS) | |||
43 | OUTFILE = $(OBJDIR)/libsim.a | 43 | OUTFILE = $(OBJDIR)/libsim.a |
44 | 44 | ||
45 | all: $(OUTFILE) | 45 | all: $(OUTFILE) |
46 | @echo "MAKE in common sim" | 46 | @$(MAKE) -C $(SIMCOMMON) |
47 | $(MAKE) -C $(SIMCOMMON) | ||
48 | 47 | ||
49 | include $(TOOLSDIR)/make.inc | 48 | include $(TOOLSDIR)/make.inc |
50 | 49 | ||
diff --git a/uisimulator/x11/thread.c b/uisimulator/x11/thread.c index e37373dc54..25adf6a3c0 100644 --- a/uisimulator/x11/thread.c +++ b/uisimulator/x11/thread.c | |||
@@ -94,3 +94,18 @@ void sim_sleep(int ticks) | |||
94 | 94 | ||
95 | pthread_mutex_lock(&mp); /* get it again */ | 95 | pthread_mutex_lock(&mp); /* get it again */ |
96 | } | 96 | } |
97 | |||
98 | void mutex_init(struct mutex *m) | ||
99 | { | ||
100 | (void)m; | ||
101 | } | ||
102 | |||
103 | void mutex_lock(struct mutex *m) | ||
104 | { | ||
105 | (void)m; | ||
106 | } | ||
107 | |||
108 | void mutex_unlock(struct mutex *m) | ||
109 | { | ||
110 | (void)m; | ||
111 | } | ||