Commit 3fbec58e authored by Sam Lantinga's avatar Sam Lantinga

Date: Fri, 31 Dec 2004 04:14:09 +0900

From: Hayashi Naoyuki
Subject: SDL patch for Tru64 UNIX 4.0X

SDL-1.2.8 support only Tru64 5.X.
This patch is for Tru64 UNIX 4.X.(tested on Tru64 UNIX 4.0G and 5.1B)

SDL-1.2.8/configure.in:
ld doesn't accept -pthread option.
cc -pthread has same effect as -D_REENTRANT when compiling,
and has same effect as -lpthread -lexc when linking.

SDL-1.2.8/include/begin_code.h:
Old Compaq C Compiler accept not inline but __inline.

SDL-1.2.8/src/audio/SDL_mixer_MMX.c:
SDL-1.2.8/src/audio/SDL_mixer_MMX.h:
Old Compaq C Compiler doesn't accept //.

SDL-1.2.8/src/cdrom/osf/SDL_syscdrom.c:
When becoming Tru64 v5.0 from Tru64 v4.0,
the arrangement of the cd-rom device was changed.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401020
parent caf8e783
...@@ -1280,12 +1280,11 @@ CheckPTHREAD() ...@@ -1280,12 +1280,11 @@ CheckPTHREAD()
pthread_lib="" pthread_lib=""
;; ;;
*-*-osf*) *-*-osf*)
pthread_cflags="-D_REENTRANT"
if test x$ac_cv_prog_gcc = xyes; then if test x$ac_cv_prog_gcc = xyes; then
pthread_cflags="-D_REENTRANT"
pthread_lib="-lpthread -lrt" pthread_lib="-lpthread -lrt"
else else
pthread_cflags="-pthread" pthread_lib="-lpthread -lexc -lrt"
pthread_lib="-lpthread -lrt"
fi fi
;; ;;
*) *)
......
...@@ -102,7 +102,8 @@ ...@@ -102,7 +102,8 @@
/* Add any special compiler-specific cases here */ /* Add any special compiler-specific cases here */
#if defined(_MSC_VER) || defined(__BORLANDC__) || \ #if defined(_MSC_VER) || defined(__BORLANDC__) || \
defined(__DMC__) || defined(__SC__) || \ defined(__DMC__) || defined(__SC__) || \
defined(__WATCOMC__) || defined(__LCC__) defined(__WATCOMC__) || defined(__LCC__) || \
defined(__DECC)
#ifndef __inline__ #ifndef __inline__
#define __inline__ __inline #define __inline__ __inline
#endif #endif
......
// MMX assembler version of SDL_MixAudio for signed little endian 16 bit samples and signed 8 bit samples /*
// Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr) MMX assembler version of SDL_MixAudio for signed little endian 16 bit samples and signed 8 bit samples
// This code is licensed under the LGPL (see COPYING for details) Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr)
// This code is licensed under the LGPL (see COPYING for details)
// Assumes buffer size in bytes is a multiple of 16
// Assumes SDL_MIX_MAXVOLUME = 128 Assumes buffer size in bytes is a multiple of 16
Assumes SDL_MIX_MAXVOLUME = 128
*/
////////////////////////////////////////////////
// Mixing for 16 bit signed buffers
//////////////////////////////////////////////// /***********************************************
* Mixing for 16 bit signed buffers
***********************************************/
#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
void SDL_MixAudio_MMX_S16(char* dst,char* src,unsigned int size,int volume) void SDL_MixAudio_MMX_S16(char* dst,char* src,unsigned int size,int volume)
......
// headers for MMX assembler version of SDL_MixAudio /*
// Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr) headers for MMX assembler version of SDL_MixAudio
// This code is licensed under the LGPL (see COPYING for details) Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr)
// This code is licensed under the LGPL (see COPYING for details)
// Assumes buffer size in bytes is a multiple of 16
// Assumes SDL_MIX_MAXVOLUME = 128 Assumes buffer size in bytes is a multiple of 16
Assumes SDL_MIX_MAXVOLUME = 128
*/
#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT) #if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
......
...@@ -22,9 +22,10 @@ ...@@ -22,9 +22,10 @@
/* Functions for system-level CD-ROM audio control */ /* Functions for system-level CD-ROM audio control */
//#define DEBUG_CDROM 1 /* #define DEBUG_CDROM 1 */
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <io/cam/cdrom.h> #include <io/cam/cdrom.h>
...@@ -141,11 +142,22 @@ static void AddDrive(char *drive, struct stat *stbuf) ...@@ -141,11 +142,22 @@ static void AddDrive(char *drive, struct stat *stbuf)
int SDL_SYS_CDInit(void) int SDL_SYS_CDInit(void)
{ {
/* checklist: /dev/rdisk/cdrom?c /* checklist:
*
* Tru64 5.X (/dev/rdisk/cdrom?c)
* dir: /dev/rdisk, name: cdrom
*
* Digital UNIX 4.0X (/dev/rrz?c)
* dir: /dev, name: rrz
* *
*/ */
static char *checklist[] = { struct {
"?0 rdisk/cdrom?",NULL}; char *dir;
char *name;
} checklist[] = {
{"/dev/rdisk", "cdrom"},
{"/dev", "rrz"},
{NULL, NULL}};
char drive[32]; char drive[32];
char *SDLcdrom; char *SDLcdrom;
int i, j, exists; int i, j, exists;
...@@ -195,37 +207,32 @@ int SDL_SYS_CDInit(void) ...@@ -195,37 +207,32 @@ int SDL_SYS_CDInit(void)
} }
} }
/* Scan the system for CD-ROM drives */ /* Scan the system for CD-ROM drives */
for ( i=0; checklist[i]; ++i ) { for ( i = 0; checklist[i].dir; ++i) {
if ( checklist[i][0] == '?' ) { DIR *devdir;
char *insert; struct dirent *devent;
exists = 1; int name_len;
for ( j=checklist[i][1]; exists; ++j ) {
sprintf(drive, "/dev/%sc", &checklist[i][3]); devdir = opendir(checklist[i].dir);
insert = strchr(drive, '?'); if (devdir) {
if ( insert != NULL ) { name_len = strlen(checklist[i].name);
*insert = j; while (devent = readdir(devdir))
} if (memcmp(checklist[i].name, devent->d_name, name_len) == 0)
switch (CheckDrive(drive, &stbuf)) { if (devent->d_name[devent->d_namlen-1] == 'c') {
/* Drive exists and is a CD-ROM */ sprintf(drive, "%s/%s", checklist[i].dir, devent->d_name);
case 1: #ifdef DEBUG_CDROM
AddDrive(drive, &stbuf); fprintf(stderr, "Try to add drive: %s\n", drive);
break; #endif
/* Drive exists, but isn't a CD-ROM */ if ( CheckDrive(drive, &stbuf) > 0 )
case 0: AddDrive(drive, &stbuf);
break; }
/* Drive doesn't exist */ closedir(devdir);
case -1:
exists = 0;
break;
}
}
} else { } else {
sprintf(drive, "/dev/%s", checklist[i]); #ifdef DEBUG_CDROM
if ( CheckDrive(drive, &stbuf) > 0 ) { fprintf(stderr, "cannot open dir: %s\n", checklist[i].dir);
AddDrive(drive, &stbuf); #endif
}
} }
} }
/* /*
SDLcdrom=malloc(sizeof(char) * 32); SDLcdrom=malloc(sizeof(char) * 32);
strcpy(SDLcdrom,"/dev/rdisk/cdrom0c"); strcpy(SDLcdrom,"/dev/rdisk/cdrom0c");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment