diff options
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/common/io.c | 37 | ||||
-rw-r--r-- | uisimulator/common/stubs.c | 6 | ||||
-rw-r--r-- | uisimulator/uisimulator.make | 1 |
3 files changed, 32 insertions, 12 deletions
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index 260e880b62..4c0fa33be5 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c | |||
@@ -25,7 +25,11 @@ | |||
25 | #include <stdarg.h> | 25 | #include <stdarg.h> |
26 | #include <sys/stat.h> | 26 | #include <sys/stat.h> |
27 | #include <time.h> | 27 | #include <time.h> |
28 | #ifndef WIN32 | 28 | #include "config.h" |
29 | |||
30 | #define HAVE_STATVFS (0 == (CONFIG_PLATFORM & PLATFORM_ANDROID) && !defined(WIN32)) | ||
31 | |||
32 | #if HAVE_STATVFS | ||
29 | #include <sys/statvfs.h> | 33 | #include <sys/statvfs.h> |
30 | #endif | 34 | #endif |
31 | 35 | ||
@@ -41,14 +45,18 @@ | |||
41 | #endif | 45 | #endif |
42 | 46 | ||
43 | #include <fcntl.h> | 47 | #include <fcntl.h> |
48 | #if (CONFIG_PLATFORM & PLATFORM_SDL) | ||
44 | #include <SDL.h> | 49 | #include <SDL.h> |
45 | #include <SDL_thread.h> | 50 | #include <SDL_thread.h> |
51 | #include "thread-sdl.h" | ||
52 | #else | ||
53 | #define sim_thread_unlock() NULL | ||
54 | #define sim_thread_lock(a) | ||
55 | #endif | ||
46 | #include "thread.h" | 56 | #include "thread.h" |
47 | #include "kernel.h" | 57 | #include "kernel.h" |
48 | #include "debug.h" | 58 | #include "debug.h" |
49 | #include "config.h" | ||
50 | #include "ata.h" /* for IF_MV2 et al. */ | 59 | #include "ata.h" /* for IF_MV2 et al. */ |
51 | #include "thread-sdl.h" | ||
52 | #include "rbpaths.h" | 60 | #include "rbpaths.h" |
53 | 61 | ||
54 | /* keep this in sync with file.h! */ | 62 | /* keep this in sync with file.h! */ |
@@ -193,7 +201,7 @@ static unsigned int rockbox2sim(int opt) | |||
193 | /** Simulator I/O engine routines **/ | 201 | /** Simulator I/O engine routines **/ |
194 | #define IO_YIELD_THRESHOLD 512 | 202 | #define IO_YIELD_THRESHOLD 512 |
195 | 203 | ||
196 | enum | 204 | enum io_dir |
197 | { | 205 | { |
198 | IO_READ, | 206 | IO_READ, |
199 | IO_WRITE, | 207 | IO_WRITE, |
@@ -225,7 +233,7 @@ int ata_spinup_time(void) | |||
225 | return HZ; | 233 | return HZ; |
226 | } | 234 | } |
227 | 235 | ||
228 | static ssize_t io_trigger_and_wait(int cmd) | 236 | static ssize_t io_trigger_and_wait(enum io_dir cmd) |
229 | { | 237 | { |
230 | void *mythread = NULL; | 238 | void *mythread = NULL; |
231 | ssize_t result; | 239 | ssize_t result; |
@@ -246,6 +254,9 @@ static ssize_t io_trigger_and_wait(int cmd) | |||
246 | case IO_WRITE: | 254 | case IO_WRITE: |
247 | result = write(io.fd, io.buf, io.count); | 255 | result = write(io.fd, io.buf, io.count); |
248 | break; | 256 | break; |
257 | /* shut up gcc */ | ||
258 | default: | ||
259 | result = -1; | ||
249 | } | 260 | } |
250 | 261 | ||
251 | /* Regain our status as current */ | 262 | /* Regain our status as current */ |
@@ -480,7 +491,7 @@ void fat_size(IF_MV2(int volume,) unsigned long* size, unsigned long* free) | |||
480 | if (free) | 491 | if (free) |
481 | *free = free_clusters * secperclus / 2 * (bytespersec / 512); | 492 | *free = free_clusters * secperclus / 2 * (bytespersec / 512); |
482 | } | 493 | } |
483 | #else | 494 | #elif HAVE_STATVFS |
484 | struct statvfs vfs; | 495 | struct statvfs vfs; |
485 | 496 | ||
486 | if (!statvfs(".", &vfs)) { | 497 | if (!statvfs(".", &vfs)) { |
@@ -490,9 +501,9 @@ void fat_size(IF_MV2(int volume,) unsigned long* size, unsigned long* free) | |||
490 | *size = vfs.f_blocks / 2 * (vfs.f_frsize / 512); | 501 | *size = vfs.f_blocks / 2 * (vfs.f_frsize / 512); |
491 | if (free) | 502 | if (free) |
492 | *free = vfs.f_bfree / 2 * (vfs.f_frsize / 512); | 503 | *free = vfs.f_bfree / 2 * (vfs.f_frsize / 512); |
493 | } | 504 | } else |
494 | #endif | 505 | #endif |
495 | else { | 506 | { |
496 | if (size) | 507 | if (size) |
497 | *size = 0; | 508 | *size = 0; |
498 | if (free) | 509 | if (free) |
@@ -537,9 +548,19 @@ void *sim_codec_load_ram(char* codecptr, int size, void **pd) | |||
537 | to find an unused filename */ | 548 | to find an unused filename */ |
538 | for (codec_count = 0; codec_count < 10; codec_count++) | 549 | for (codec_count = 0; codec_count < 10; codec_count++) |
539 | { | 550 | { |
551 | #if (CONFIG_PLATFORM & PLATFORM_ANDROID) | ||
552 | /* we need that path fixed, since get_user_file_path() | ||
553 | * gives us the folder on the sdcard where we cannot load libraries | ||
554 | * from (no exec permissions) | ||
555 | */ | ||
556 | snprintf(path, sizeof(path), | ||
557 | "/data/data/org.rockbox/app_rockbox/libtemp_codec_%d.so", | ||
558 | codec_count); | ||
559 | #else | ||
540 | char name[MAX_PATH]; | 560 | char name[MAX_PATH]; |
541 | const char *_name = get_user_file_path(ROCKBOX_DIR, 0, name, sizeof(name)); | 561 | const char *_name = get_user_file_path(ROCKBOX_DIR, 0, name, sizeof(name)); |
542 | snprintf(path, sizeof(path), "%s/_temp_codec%d.dll", get_sim_pathname(_name), codec_count); | 562 | snprintf(path, sizeof(path), "%s/_temp_codec%d.dll", get_sim_pathname(_name), codec_count); |
563 | #endif | ||
543 | fd = OPEN(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU); | 564 | fd = OPEN(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRWXU); |
544 | if (fd >= 0) | 565 | if (fd >= 0) |
545 | break; /* Created a file ok */ | 566 | break; /* Created a file ok */ |
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c index 6d7d7de06b..a9011b9aa5 100644 --- a/uisimulator/common/stubs.c +++ b/uisimulator/common/stubs.c | |||
@@ -21,8 +21,6 @@ | |||
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <time.h> | 22 | #include <time.h> |
23 | #include <stdbool.h> | 23 | #include <stdbool.h> |
24 | #include "thread-sdl.h" | ||
25 | |||
26 | #include "debug.h" | 24 | #include "debug.h" |
27 | 25 | ||
28 | #include "screens.h" | 26 | #include "screens.h" |
@@ -35,7 +33,6 @@ | |||
35 | 33 | ||
36 | #include "ata.h" /* for volume definitions */ | 34 | #include "ata.h" /* for volume definitions */ |
37 | 35 | ||
38 | extern char having_new_lcd; | ||
39 | static bool storage_spinning = false; | 36 | static bool storage_spinning = false; |
40 | 37 | ||
41 | #if CONFIG_CODEC != SWCODEC | 38 | #if CONFIG_CODEC != SWCODEC |
@@ -211,10 +208,13 @@ bool spdif_powered(void) | |||
211 | } | 208 | } |
212 | #endif | 209 | #endif |
213 | 210 | ||
211 | #ifdef ARCHOS_PLAYER | ||
214 | bool is_new_player(void) | 212 | bool is_new_player(void) |
215 | { | 213 | { |
214 | extern char having_new_lcd; | ||
216 | return having_new_lcd; | 215 | return having_new_lcd; |
217 | } | 216 | } |
217 | #endif | ||
218 | 218 | ||
219 | #ifdef HAVE_USB_POWER | 219 | #ifdef HAVE_USB_POWER |
220 | bool usb_powered(void) | 220 | bool usb_powered(void) |
diff --git a/uisimulator/uisimulator.make b/uisimulator/uisimulator.make index b06b48c0d2..dcbd79988f 100644 --- a/uisimulator/uisimulator.make +++ b/uisimulator/uisimulator.make | |||
@@ -30,7 +30,6 @@ $(SIMLIB): $$(SIMOBJ) $(UIBMP) | |||
30 | $(SILENT)$(shell rm -f $@) | 30 | $(SILENT)$(shell rm -f $@) |
31 | $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null | 31 | $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null |
32 | 32 | ||
33 | # SIMLIB needs to be linked twice for some reason | ||
34 | $(BUILDDIR)/$(BINARY): $$(OBJ) $(SIMLIB) $(VOICESPEEXLIB) $(FIRMLIB) $(SKINLIB) | 33 | $(BUILDDIR)/$(BINARY): $$(OBJ) $(SIMLIB) $(VOICESPEEXLIB) $(FIRMLIB) $(SKINLIB) |
35 | $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(SIMLIB) $(LDOPTS) $(GLOBAL_LDOPTS) | 34 | $(call PRINTS,LD $(BINARY))$(CC) -o $@ $^ $(SIMLIB) $(LDOPTS) $(GLOBAL_LDOPTS) |
36 | 35 | ||