Previous 199869 Revisions Next

r31850 Sunday 31st August, 2014 at 20:55:48 UTC by R. Belmont
SDL: fall through to the baseline Win32 implementations for file, socket, and pty/named pipe I/O. [R. Belmont]

nw: This fixes laserdisc games and enables socket and named pipe I/O in SDL Windows builds.
[src/osd/sdl]sdldir.c sdlfile.c sdlptty_win32.c sdlsocket.c

trunk/src/osd/sdl/sdlptty_win32.c
r31849r31850
11//============================================================
22//
33//  sdlptty_win32 - SDL psuedo tty access functions
4//  (Win32 has no pttys - maybe named pipes?)
4//  (passthrough to Windows OSD version)
55//
6//  Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
6//  Copyright (c) 1996-2014, Nicola Salmoria and the MAME Team.
77//  Visit http://mamedev.org for licensing and usage restrictions.
88//
99//  SDLMAME by Olivier Galibert and R. Belmont
1010//
1111//============================================================
1212
13#include "sdlfile.h"
13#include "../windows/winptty.c"
1414
15const char *sdlfile_ptty_identifier  = "";
16
17file_error sdl_open_ptty(const char *path, UINT32 openflags, osd_file **file, UINT64 *filesize)
18{
19   return FILERR_ACCESS_DENIED;
20}
21
22file_error sdl_read_ptty(osd_file *file, void *buffer, UINT64 offset, UINT32 count, UINT32 *actual)
23{
24   return FILERR_ACCESS_DENIED;
25}
26
27file_error sdl_write_ptty(osd_file *file, const void *buffer, UINT64 offset, UINT32 count, UINT32 *actual)
28{
29   return FILERR_ACCESS_DENIED;
30}
31
32file_error sdl_close_ptty(osd_file *file)
33{
34   return FILERR_ACCESS_DENIED;
35}
trunk/src/osd/sdl/sdldir.c
r31849r31850
22//
33//  sdldir.c - SDL core directory access functions
44//
5//  Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
5//  Copyright (c) 1996-2014, Nicola Salmoria and the MAME Team.
66//  Visit http://mamedev.org for licensing and usage restrictions.
77//
88//  SDLMAME by Olivier Galibert and R. Belmont
99//
1010//============================================================
1111
12#ifdef SDLMAME_WIN32
13#include "../windows/windir.c"
14#else
15
1216#ifndef _LARGEFILE64_SOURCE
1317#define _LARGEFILE64_SOURCE
1418#endif
r31849r31850
230234   osd_free(dir->path);
231235   osd_free(dir);
232236}
237
238#endif
trunk/src/osd/sdl/sdlfile.c
r31849r31850
11//============================================================
22//
3//  fileio.c - SDL file access functions
3//  sdlfile.c - SDL file access functions
44//
5//  Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
5//  Copyright (c) 1996-2014, Nicola Salmoria and the MAME Team.
66//  Visit http://mamedev.org for licensing and usage restrictions.
77//
88//  SDLMAME by Olivier Galibert and R. Belmont
99//
1010//============================================================
1111
12#ifdef SDLMAME_WIN32
13#include "../windows/winfile.c"
14#include "../windows/winutil.c"
15#else
16
1217#ifndef _LARGEFILE64_SOURCE
1318#define _LARGEFILE64_SOURCE
1419#endif
r31849r31850
1621#ifdef SDLMAME_LINUX
1722#define __USE_LARGEFILE64
1823#endif
24
25#ifdef SDLMAME_WIN32
26#define _FILE_OFFSET_BITS 64
27#endif
28
1929#ifndef SDLMAME_BSD
2030#ifdef _XOPEN_SOURCE
2131#undef _XOPEN_SOURCE
r31849r31850
254264
255265   *filesize = (UINT64)st.st_size;
256266
267   fprintf(stderr, "SDL: opened file %s, size %I64d\n", tmpstr, *filesize);
257268
258269error:
259270   // cleanup
r31849r31850
500511
501512   return result;
502513}
514#endif
No newline at end of file
trunk/src/osd/sdl/sdlsocket.c
r31849r31850
22//
33//  sdlsocket.c - SDL socket (inet) access functions
44//
5//  Copyright (c) 1996-2013, Nicola Salmoria and the MAME Team.
5//  Copyright (c) 1996-2014, Nicola Salmoria and the MAME Team.
66//  Visit http://mamedev.org for licensing and usage restrictions.
77//
88//  SDLMAME by Olivier Galibert and R. Belmont
99//
1010//============================================================
1111
12#ifdef SDLMAME_WIN32
13#include "../windows/winsocket.c"
14#else
15
1216#include <stdio.h>
1317#include <stdlib.h>
1418#include <unistd.h>
1519#include <fcntl.h>
16#ifndef SDLMAME_WIN32
1720#include <sys/select.h>
1821#include <netinet/in.h>
1922#include <netinet/tcp.h>
2023#include <sys/socket.h>
2124#include <sys/types.h>
2225#include <netdb.h>
23#endif
2426#include <errno.h>
2527
2628#define NO_MEM_TRACKING
r31849r31850
3638*/
3739bool sdl_check_socket_path(const char *path)
3840{
39#ifndef SDLMAME_WIN32
4041   if (strlen(sdlfile_socket_identifier) > 0 &&
4142      strncmp(path, sdlfile_socket_identifier, strlen(sdlfile_socket_identifier)) == 0 &&
4243      strchr(path, ':') != NULL) return true;
43#endif
4444   return false;
4545}
4646
4747file_error sdl_open_socket(const char *path, UINT32 openflags, osd_file **file, UINT64 *filesize)
4848{
49#ifndef SDLMAME_WIN32
5049   char hostname[256];
5150   struct hostent *localhost;
5251   struct sockaddr_in sai;
r31849r31850
103102
104103   *filesize = 0;
105104   (*file)->handle = -1;
106#endif
107105   return FILERR_NONE;
108106}
109107
110108file_error sdl_read_socket(osd_file *file, void *buffer, UINT64 offset, UINT32 count, UINT32 *actual)
111109{
112#if (!defined(SDLMAME_WIN32)) && (!defined(SDLMAME_EMSCRIPTEN))
110#if (!defined(SDLMAME_EMSCRIPTEN))
113111   ssize_t result;
114112   char line[80];
115113   struct timeval timeout;
r31849r31850
172170
173171file_error sdl_write_socket(osd_file *file, const void *buffer, UINT64 offset, UINT32 count, UINT32 *actual)
174172{
175#ifndef SDLMAME_WIN32
176173   ssize_t result;
177174
178175   result = write(file->socket, buffer, count);
r31849r31850
186183   {
187184      *actual = result;
188185   }
189#endif
190186   return FILERR_NONE;
191187}
192188
193189file_error sdl_close_socket(osd_file *file)
194190{
195#ifndef SDLMAME_WIN32
196191   close(file->socket);
197192   osd_free(file);
198#endif
199193   return FILERR_NONE;
200194}
195#endif
No newline at end of file

Previous 199869 Revisions Next


© 1997-2024 The MAME Team