diff options
-rw-r--r-- | apps/plugin.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 5e7ac94665..16d7a76e27 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -59,12 +59,58 @@ | |||
59 | #include "usbstack/usb_hid.h" | 59 | #include "usbstack/usb_hid.h" |
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | #if (CONFIG_PLATFORM & PLATFORM_SDL) | 62 | #if defined (SIMULATOR) |
63 | #define PREFIX(_x_) sim_ ## _x_ | 63 | #define PREFIX(_x_) sim_ ## _x_ |
64 | #elif defined (APPLICATION) | ||
65 | #define PREFIX(_x_) app_ ## _x_ | ||
64 | #else | 66 | #else |
65 | #define PREFIX | 67 | #define PREFIX |
66 | #endif | 68 | #endif |
67 | 69 | ||
70 | #if defined (APPLICATION) | ||
71 | /* For symmetry reasons (we want app_ and sim_ to behave similarly), some | ||
72 | * wrappers are needed */ | ||
73 | static int app_close(int fd) | ||
74 | { | ||
75 | return close(fd); | ||
76 | } | ||
77 | |||
78 | static ssize_t app_read(int fd, void *buf, size_t count) | ||
79 | { | ||
80 | return read(fd,buf,count); | ||
81 | } | ||
82 | |||
83 | static off_t app_lseek(int fd, off_t offset, int whence) | ||
84 | { | ||
85 | return lseek(fd,offset,whence); | ||
86 | } | ||
87 | |||
88 | static ssize_t app_write(int fd, const void *buf, size_t count) | ||
89 | { | ||
90 | return write(fd,buf,count); | ||
91 | } | ||
92 | |||
93 | static int app_ftruncate(int fd, off_t length) | ||
94 | { | ||
95 | return ftruncate(fd,length); | ||
96 | } | ||
97 | |||
98 | static off_t app_filesize(int fd) | ||
99 | { | ||
100 | return filesize(fd); | ||
101 | } | ||
102 | |||
103 | static int app_closedir(DIR *dirp) | ||
104 | { | ||
105 | return closedir(dirp); | ||
106 | } | ||
107 | |||
108 | static struct dirent *app_readdir(DIR *dirp) | ||
109 | { | ||
110 | return readdir(dirp); | ||
111 | } | ||
112 | #endif | ||
113 | |||
68 | #if defined(HAVE_PLUGIN_CHECK_OPEN_CLOSE) && (MAX_OPEN_FILES>32) | 114 | #if defined(HAVE_PLUGIN_CHECK_OPEN_CLOSE) && (MAX_OPEN_FILES>32) |
69 | #warning "MAX_OPEN_FILES>32, disabling plugin file open/close checking" | 115 | #warning "MAX_OPEN_FILES>32, disabling plugin file open/close checking" |
70 | #undef HAVE_PLUGIN_CHECK_OPEN_CLOSE | 116 | #undef HAVE_PLUGIN_CHECK_OPEN_CLOSE |