diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-08-02 20:34:47 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-08-02 20:34:47 +0000 |
commit | 240923a801382c86545d10be167a15892a556fb6 (patch) | |
tree | 3c0e07ec3abf0c493a0b24b0b57e8bbd0200f7f6 /uisimulator/common/io.c | |
parent | 850efead04f10488b478a0f255a2464a01156a7f (diff) | |
download | rockbox-240923a801382c86545d10be167a15892a556fb6.tar.gz rockbox-240923a801382c86545d10be167a15892a556fb6.zip |
Rockbox as an application: Commit current Android port progress.
General state is: Rockbox is usable (plays music, saves configuration, touchscreen works too).
Problems:
- Playing music in the background (i.e. when switching to another app) doesn't work reliably, but I'm working on that now.
- no cabbiev2 (only some preliminary files for it), no other default theme.
- screen flickers sometimes if the updates are too frequent
- no multi screen apk/package
- strange behavior when a phone call comes in
The java files (and the eclipse project) resides in android/, which is also supposed to be the build folder.
I've put a small README in there for instructions. There are some steps needed after the make part, which are described there,
and which eclipse mostly handles. But there ought to be some script/makefile rules which do that instead in the future.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27668 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/common/io.c')
-rw-r--r-- | uisimulator/common/io.c | 37 |
1 files changed, 29 insertions, 8 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 */ |