trunk/src/osd/sdl/sdlptty_win32.c
| r31849 | r31850 | |
| 1 | 1 | //============================================================ |
| 2 | 2 | // |
| 3 | 3 | // sdlptty_win32 - SDL psuedo tty access functions |
| 4 | | // (Win32 has no pttys - maybe named pipes?) |
| 4 | // (passthrough to Windows OSD version) |
| 5 | 5 | // |
| 6 | | // Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team. |
| 6 | // Copyright (c) 1996-2014, Nicola Salmoria and the MAME Team. |
| 7 | 7 | // Visit http://mamedev.org for licensing and usage restrictions. |
| 8 | 8 | // |
| 9 | 9 | // SDLMAME by Olivier Galibert and R. Belmont |
| 10 | 10 | // |
| 11 | 11 | //============================================================ |
| 12 | 12 | |
| 13 | | #include "sdlfile.h" |
| 13 | #include "../windows/winptty.c" |
| 14 | 14 | |
| 15 | | const char *sdlfile_ptty_identifier = ""; |
| 16 | | |
| 17 | | file_error sdl_open_ptty(const char *path, UINT32 openflags, osd_file **file, UINT64 *filesize) |
| 18 | | { |
| 19 | | return FILERR_ACCESS_DENIED; |
| 20 | | } |
| 21 | | |
| 22 | | file_error sdl_read_ptty(osd_file *file, void *buffer, UINT64 offset, UINT32 count, UINT32 *actual) |
| 23 | | { |
| 24 | | return FILERR_ACCESS_DENIED; |
| 25 | | } |
| 26 | | |
| 27 | | file_error sdl_write_ptty(osd_file *file, const void *buffer, UINT64 offset, UINT32 count, UINT32 *actual) |
| 28 | | { |
| 29 | | return FILERR_ACCESS_DENIED; |
| 30 | | } |
| 31 | | |
| 32 | | file_error sdl_close_ptty(osd_file *file) |
| 33 | | { |
| 34 | | return FILERR_ACCESS_DENIED; |
| 35 | | } |
trunk/src/osd/sdl/sdldir.c
| r31849 | r31850 | |
| 2 | 2 | // |
| 3 | 3 | // sdldir.c - SDL core directory access functions |
| 4 | 4 | // |
| 5 | | // Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team. |
| 5 | // Copyright (c) 1996-2014, Nicola Salmoria and the MAME Team. |
| 6 | 6 | // Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | // |
| 8 | 8 | // SDLMAME by Olivier Galibert and R. Belmont |
| 9 | 9 | // |
| 10 | 10 | //============================================================ |
| 11 | 11 | |
| 12 | #ifdef SDLMAME_WIN32 |
| 13 | #include "../windows/windir.c" |
| 14 | #else |
| 15 | |
| 12 | 16 | #ifndef _LARGEFILE64_SOURCE |
| 13 | 17 | #define _LARGEFILE64_SOURCE |
| 14 | 18 | #endif |
| r31849 | r31850 | |
| 230 | 234 | osd_free(dir->path); |
| 231 | 235 | osd_free(dir); |
| 232 | 236 | } |
| 237 | |
| 238 | #endif |
trunk/src/osd/sdl/sdlfile.c
| r31849 | r31850 | |
| 1 | 1 | //============================================================ |
| 2 | 2 | // |
| 3 | | // fileio.c - SDL file access functions |
| 3 | // sdlfile.c - SDL file access functions |
| 4 | 4 | // |
| 5 | | // Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team. |
| 5 | // Copyright (c) 1996-2014, Nicola Salmoria and the MAME Team. |
| 6 | 6 | // Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | // |
| 8 | 8 | // SDLMAME by Olivier Galibert and R. Belmont |
| 9 | 9 | // |
| 10 | 10 | //============================================================ |
| 11 | 11 | |
| 12 | #ifdef SDLMAME_WIN32 |
| 13 | #include "../windows/winfile.c" |
| 14 | #include "../windows/winutil.c" |
| 15 | #else |
| 16 | |
| 12 | 17 | #ifndef _LARGEFILE64_SOURCE |
| 13 | 18 | #define _LARGEFILE64_SOURCE |
| 14 | 19 | #endif |
| r31849 | r31850 | |
| 16 | 21 | #ifdef SDLMAME_LINUX |
| 17 | 22 | #define __USE_LARGEFILE64 |
| 18 | 23 | #endif |
| 24 | |
| 25 | #ifdef SDLMAME_WIN32 |
| 26 | #define _FILE_OFFSET_BITS 64 |
| 27 | #endif |
| 28 | |
| 19 | 29 | #ifndef SDLMAME_BSD |
| 20 | 30 | #ifdef _XOPEN_SOURCE |
| 21 | 31 | #undef _XOPEN_SOURCE |
| r31849 | r31850 | |
| 254 | 264 | |
| 255 | 265 | *filesize = (UINT64)st.st_size; |
| 256 | 266 | |
| 267 | fprintf(stderr, "SDL: opened file %s, size %I64d\n", tmpstr, *filesize); |
| 257 | 268 | |
| 258 | 269 | error: |
| 259 | 270 | // cleanup |
| r31849 | r31850 | |
| 500 | 511 | |
| 501 | 512 | return result; |
| 502 | 513 | } |
| 514 | #endif |
| | No newline at end of file |
trunk/src/osd/sdl/sdlsocket.c
| r31849 | r31850 | |
| 2 | 2 | // |
| 3 | 3 | // sdlsocket.c - SDL socket (inet) access functions |
| 4 | 4 | // |
| 5 | | // Copyright (c) 1996-2013, Nicola Salmoria and the MAME Team. |
| 5 | // Copyright (c) 1996-2014, Nicola Salmoria and the MAME Team. |
| 6 | 6 | // Visit http://mamedev.org for licensing and usage restrictions. |
| 7 | 7 | // |
| 8 | 8 | // SDLMAME by Olivier Galibert and R. Belmont |
| 9 | 9 | // |
| 10 | 10 | //============================================================ |
| 11 | 11 | |
| 12 | #ifdef SDLMAME_WIN32 |
| 13 | #include "../windows/winsocket.c" |
| 14 | #else |
| 15 | |
| 12 | 16 | #include <stdio.h> |
| 13 | 17 | #include <stdlib.h> |
| 14 | 18 | #include <unistd.h> |
| 15 | 19 | #include <fcntl.h> |
| 16 | | #ifndef SDLMAME_WIN32 |
| 17 | 20 | #include <sys/select.h> |
| 18 | 21 | #include <netinet/in.h> |
| 19 | 22 | #include <netinet/tcp.h> |
| 20 | 23 | #include <sys/socket.h> |
| 21 | 24 | #include <sys/types.h> |
| 22 | 25 | #include <netdb.h> |
| 23 | | #endif |
| 24 | 26 | #include <errno.h> |
| 25 | 27 | |
| 26 | 28 | #define NO_MEM_TRACKING |
| r31849 | r31850 | |
| 36 | 38 | */ |
| 37 | 39 | bool sdl_check_socket_path(const char *path) |
| 38 | 40 | { |
| 39 | | #ifndef SDLMAME_WIN32 |
| 40 | 41 | if (strlen(sdlfile_socket_identifier) > 0 && |
| 41 | 42 | strncmp(path, sdlfile_socket_identifier, strlen(sdlfile_socket_identifier)) == 0 && |
| 42 | 43 | strchr(path, ':') != NULL) return true; |
| 43 | | #endif |
| 44 | 44 | return false; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | file_error sdl_open_socket(const char *path, UINT32 openflags, osd_file **file, UINT64 *filesize) |
| 48 | 48 | { |
| 49 | | #ifndef SDLMAME_WIN32 |
| 50 | 49 | char hostname[256]; |
| 51 | 50 | struct hostent *localhost; |
| 52 | 51 | struct sockaddr_in sai; |
| r31849 | r31850 | |
| 103 | 102 | |
| 104 | 103 | *filesize = 0; |
| 105 | 104 | (*file)->handle = -1; |
| 106 | | #endif |
| 107 | 105 | return FILERR_NONE; |
| 108 | 106 | } |
| 109 | 107 | |
| 110 | 108 | file_error sdl_read_socket(osd_file *file, void *buffer, UINT64 offset, UINT32 count, UINT32 *actual) |
| 111 | 109 | { |
| 112 | | #if (!defined(SDLMAME_WIN32)) && (!defined(SDLMAME_EMSCRIPTEN)) |
| 110 | #if (!defined(SDLMAME_EMSCRIPTEN)) |
| 113 | 111 | ssize_t result; |
| 114 | 112 | char line[80]; |
| 115 | 113 | struct timeval timeout; |
| r31849 | r31850 | |
| 172 | 170 | |
| 173 | 171 | file_error sdl_write_socket(osd_file *file, const void *buffer, UINT64 offset, UINT32 count, UINT32 *actual) |
| 174 | 172 | { |
| 175 | | #ifndef SDLMAME_WIN32 |
| 176 | 173 | ssize_t result; |
| 177 | 174 | |
| 178 | 175 | result = write(file->socket, buffer, count); |
| r31849 | r31850 | |
| 186 | 183 | { |
| 187 | 184 | *actual = result; |
| 188 | 185 | } |
| 189 | | #endif |
| 190 | 186 | return FILERR_NONE; |
| 191 | 187 | } |
| 192 | 188 | |
| 193 | 189 | file_error sdl_close_socket(osd_file *file) |
| 194 | 190 | { |
| 195 | | #ifndef SDLMAME_WIN32 |
| 196 | 191 | close(file->socket); |
| 197 | 192 | osd_free(file); |
| 198 | | #endif |
| 199 | 193 | return FILERR_NONE; |
| 200 | 194 | } |
| 195 | #endif |
| | No newline at end of file |