mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
SDL OS/2 fixes [K.O. Myung-Hun]
This commit is contained in:
parent
7e8ad4aae5
commit
2d32a07198
4 changed files with 103 additions and 1 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -4414,6 +4414,7 @@ src/osd/sdl/sdlos_unix.c svneol=native#text/plain
|
|||
src/osd/sdl/sdlos_win32.c svneol=native#text/plain
|
||||
src/osd/sdl/sdlprefix.h svneol=native#text/plain
|
||||
src/osd/sdl/sdlptty_macosx.c svneol=native#text/plain
|
||||
src/osd/sdl/sdlptty_os2.c svneol=native#text/plain
|
||||
src/osd/sdl/sdlptty_unix.c svneol=native#text/plain
|
||||
src/osd/sdl/sdlptty_win32.c svneol=native#text/plain
|
||||
src/osd/sdl/sdlsocket.c svneol=native#text/plain
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#include "xmlfile.h"
|
||||
#include <ctype.h>
|
||||
#include <zlib.h>
|
||||
#ifdef SDLMAME_FREEBSD
|
||||
#if defined(SDLMAME_FREEBSD) || defined(SDLMAME_OS2)
|
||||
# undef tolower
|
||||
#endif
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define INCL_DOS
|
||||
#include <os2.h>
|
||||
|
@ -240,3 +241,68 @@ char *osd_get_clipboard_text(void)
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
//============================================================
|
||||
// osd_stat
|
||||
//============================================================
|
||||
|
||||
osd_directory_entry *osd_stat(const char *path)
|
||||
{
|
||||
int err;
|
||||
osd_directory_entry *result = NULL;
|
||||
struct stat st;
|
||||
|
||||
err = stat(path, &st);
|
||||
|
||||
if( err == -1) return NULL;
|
||||
|
||||
// create an osd_directory_entry; be sure to make sure that the caller can
|
||||
// free all resources by just freeing the resulting osd_directory_entry
|
||||
result = (osd_directory_entry *) osd_malloc(sizeof(*result) + strlen(path)
|
||||
1);
|
||||
strcpy(((char *) result) + sizeof(*result), path);
|
||||
result->name = ((char *) result) + sizeof(*result);
|
||||
result->type = S_ISDIR(st.st_mode) ? ENTTYPE_DIR : ENTTYPE_FILE;
|
||||
result->size = (UINT64)st.st_size;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//============================================================
|
||||
// osd_get_volume_name
|
||||
//============================================================
|
||||
|
||||
const char *osd_get_volume_name(int idx)
|
||||
{
|
||||
static char szDrive[] = "A:\\";
|
||||
|
||||
ULONG ulCurDisk;
|
||||
ULONG ulDriveMap;
|
||||
|
||||
DosQueryCurrentDisk(&ulCurDisk, &ulDriveMap);
|
||||
|
||||
szDrive[ 0 ] = 'A';
|
||||
while(idx--) {
|
||||
do
|
||||
{
|
||||
ulDriveMap >>= 1;
|
||||
szDrive[ 0 ]++;
|
||||
} while(ulDriveMap && (ulDriveMap & 1) == 0);
|
||||
if (!ulDriveMap) return NULL;
|
||||
}
|
||||
|
||||
return szDrive;
|
||||
}
|
||||
|
||||
//============================================================
|
||||
// osd_get_full_path
|
||||
//============================================================
|
||||
|
||||
file_error osd_get_full_path(char **dst, const char *path)
|
||||
{
|
||||
*dst = (char *)osd_malloc(CCHMAXPATH + 1);
|
||||
if (*dst == NULL)
|
||||
return FILERR_OUT_OF_MEMORY;
|
||||
|
||||
_abspath(*dst, path, CCHMAXPATH + 1);
|
||||
return FILERR_NONE;
|
||||
|
|
35
src/osd/sdl/sdlptty_os2.c
Normal file
35
src/osd/sdl/sdlptty_os2.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
//============================================================
|
||||
//
|
||||
// sdlptty_os2 - SDL psuedo tty access functions
|
||||
// (OS/2 has no pttys - maybe named pipes?)
|
||||
//
|
||||
// Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team.
|
||||
// Visit http://mamedev.org for licensing and usage restrictions.
|
||||
//
|
||||
// SDLMAME by Olivier Galibert and R. Belmont
|
||||
//
|
||||
//============================================================
|
||||
|
||||
#include "sdlfile.h"
|
||||
|
||||
const char *sdlfile_ptty_identifier = "";
|
||||
|
||||
file_error sdl_open_ptty(const char *path, UINT32 openflags, osd_file **file, UINT64 *filesize)
|
||||
{
|
||||
return FILERR_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
file_error sdl_read_ptty(osd_file *file, void *buffer, UINT64 offset, UINT32 count, UINT32 *actual)
|
||||
{
|
||||
return FILERR_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
file_error sdl_write_ptty(osd_file *file, const void *buffer, UINT64 offset, UINT32 count, UINT32 *actual)
|
||||
{
|
||||
return FILERR_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
file_error sdl_close_ptty(osd_file *file)
|
||||
{
|
||||
return FILERR_ACCESS_DENIED;
|
||||
}
|
Loading…
Reference in a new issue