Commit c0aec157 authored by Sam Lantinga's avatar Sam Lantinga

Cleaning up warnings on MacOS X

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401491
parent 6ef737be
...@@ -48,7 +48,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo; ...@@ -48,7 +48,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
/* This is the structure for custom window manager events */ /* This is the structure for custom window manager events */
#if SDL_VIDEO_DRIVER_X11 #if SDL_VIDEO_DRIVER_X11
#if defined(__APPLE__) && defined(__MACH__) #if defined(__APPLE__) && defined(__MACH__)
// conflicts with Quickdraw.h /* conflicts with Quickdraw.h */
#define Cursor X11Cursor #define Cursor X11Cursor
#endif #endif
...@@ -56,7 +56,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo; ...@@ -56,7 +56,7 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
#include <X11/Xatom.h> #include <X11/Xatom.h>
#if defined(__APPLE__) && defined(__MACH__) #if defined(__APPLE__) && defined(__MACH__)
// matches the re-define above /* matches the re-define above */
#undef Cursor #undef Cursor
#endif #endif
......
...@@ -253,14 +253,14 @@ const SDL_version * SDL_Linked_Version(void) ...@@ -253,14 +253,14 @@ const SDL_version * SDL_Linked_Version(void)
} }
#if defined(__OS2__) #if defined(__OS2__)
// Building for OS/2 /* Building for OS/2 */
#ifdef __WATCOMC__ #ifdef __WATCOMC__
#define INCL_DOSERRORS #define INCL_DOSERRORS
#define INCL_DOSEXCEPTIONS #define INCL_DOSEXCEPTIONS
#include <os2.h> #include <os2.h>
// Exception handler to prevent the Audio thread hanging, making a zombie process! /* Exception handler to prevent the Audio thread hanging, making a zombie process! */
ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec, ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec,
PEXCEPTIONREGISTRATIONRECORD pERegRec, PEXCEPTIONREGISTRATIONRECORD pERegRec,
PCONTEXTRECORD pCtxRec, PCONTEXTRECORD pCtxRec,
...@@ -273,7 +273,7 @@ ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec, ...@@ -273,7 +273,7 @@ ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec,
if (pERepRec->fHandlerFlags & EH_NESTED_CALL) if (pERepRec->fHandlerFlags & EH_NESTED_CALL)
return XCPT_CONTINUE_SEARCH; return XCPT_CONTINUE_SEARCH;
// Do cleanup at every fatal exception! /* Do cleanup at every fatal exception! */
if (((pERepRec->ExceptionNum & XCPT_SEVERITY_CODE) == XCPT_FATAL_EXCEPTION) && if (((pERepRec->ExceptionNum & XCPT_SEVERITY_CODE) == XCPT_FATAL_EXCEPTION) &&
(pERepRec->ExceptionNum != XCPT_BREAKPOINT) && (pERepRec->ExceptionNum != XCPT_BREAKPOINT) &&
(pERepRec->ExceptionNum != XCPT_SINGLE_STEP) (pERepRec->ExceptionNum != XCPT_SINGLE_STEP)
...@@ -281,7 +281,7 @@ ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec, ...@@ -281,7 +281,7 @@ ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec,
{ {
if (SDL_initialized & SDL_INIT_AUDIO) if (SDL_initialized & SDL_INIT_AUDIO)
{ {
// This removes the zombie audio thread in case of emergency. /* This removes the zombie audio thread in case of emergency. */
#ifdef DEBUG_BUILD #ifdef DEBUG_BUILD
printf("[SDL_Main_ExceptionHandler] : Calling SDL_CloseAudio()!\n"); printf("[SDL_Main_ExceptionHandler] : Calling SDL_CloseAudio()!\n");
#endif #endif
...@@ -294,28 +294,28 @@ ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec, ...@@ -294,28 +294,28 @@ ULONG _System SDL_Main_ExceptionHandler(PEXCEPTIONREPORTRECORD pERepRec,
EXCEPTIONREGISTRATIONRECORD SDL_Main_xcpthand = {0, SDL_Main_ExceptionHandler}; EXCEPTIONREGISTRATIONRECORD SDL_Main_xcpthand = {0, SDL_Main_ExceptionHandler};
// The main DLL entry for DLL Initialization and Uninitialization: /* The main DLL entry for DLL Initialization and Uninitialization: */
unsigned _System LibMain(unsigned hmod, unsigned termination) unsigned _System LibMain(unsigned hmod, unsigned termination)
{ {
if (termination) if (termination)
{ {
#ifdef DEBUG_BUILD #ifdef DEBUG_BUILD
// printf("[SDL DLL Unintialization] : Removing exception handler\n"); /* printf("[SDL DLL Unintialization] : Removing exception handler\n"); */
#endif #endif
DosUnsetExceptionHandler(&SDL_Main_xcpthand); DosUnsetExceptionHandler(&SDL_Main_xcpthand);
return 1; return 1;
} else } else
{ {
#ifdef DEBUG_BUILD #ifdef DEBUG_BUILD
// Make stdout and stderr unbuffered! /* Make stdout and stderr unbuffered! */
setbuf(stdout, NULL); setbuf(stdout, NULL);
setbuf(stderr, NULL); setbuf(stderr, NULL);
#endif #endif
// Fire up exception handler /* Fire up exception handler */
#ifdef DEBUG_BUILD #ifdef DEBUG_BUILD
// printf("[SDL DLL Initialization] : Setting exception handler\n"); /* printf("[SDL DLL Initialization] : Setting exception handler\n"); */
#endif #endif
// Set exception handler /* Set exception handler */
DosSetExceptionHandler(&SDL_Main_xcpthand); DosSetExceptionHandler(&SDL_Main_xcpthand);
return 1; return 1;
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "SDL_sysaudio.h" #include "SDL_sysaudio.h"
#ifdef __OS2__ #ifdef __OS2__
// We'll need the DosSetPriority() API! /* We'll need the DosSetPriority() API! */
#define INCL_DOSPROCESS #define INCL_DOSPROCESS
#include <os2.h> #include <os2.h>
#endif #endif
...@@ -178,8 +178,8 @@ int SDL_RunAudio(void *audiop) ...@@ -178,8 +178,8 @@ int SDL_RunAudio(void *audiop)
#endif #endif
#ifdef __OS2__ #ifdef __OS2__
// Increase the priority of this thread to make sure that /* Increase the priority of this thread to make sure that
// the audio will be continuous all the time! the audio will be continuous all the time! */
#ifdef USE_DOSSETPRIORITY #ifdef USE_DOSSETPRIORITY
if (SDL_getenv("SDL_USE_TIMECRITICAL_AUDIO")) if (SDL_getenv("SDL_USE_TIMECRITICAL_AUDIO"))
{ {
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#if defined(__GNUC__) && defined(__i386__) && defined(SDL_ASSEMBLY_ROUTINES)
#if defined(i386) && defined(__GNUC__) && defined(USE_ASMBLIT)
void SDL_MixAudio_MMX_S16(char* ,char* ,unsigned int ,int ); void SDL_MixAudio_MMX_S16(char* ,char* ,unsigned int ,int );
void SDL_MixAudio_MMX_S8(char* ,char* ,unsigned int ,int ); void SDL_MixAudio_MMX_S8(char* ,char* ,unsigned int ,int );
#endif #endif
......
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
#if ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES) #if ((defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)) && defined(SDL_ASSEMBLY_ROUTINES)
// headers for MMX assembler version of SDL_MixAudio /* headers for MMX assembler version of SDL_MixAudio
// Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr) Copyright 2002 Stephane Marchesin (stephane.marchesin@wanadoo.fr)
// Converted to Intel ASM notation by Cth Converted to Intel ASM notation by Cth
// This code is licensed under the LGPL (see COPYING for details) This code is licensed under the LGPL (see COPYING for details)
//
// Assumes buffer size in bytes is a multiple of 16 Assumes buffer size in bytes is a multiple of 16
// Assumes SDL_MIX_MAXVOLUME = 128 Assumes SDL_MIX_MAXVOLUME = 128
*/
void SDL_MixAudio_MMX_S16_VC(char* ,char* ,unsigned int ,int ); void SDL_MixAudio_MMX_S16_VC(char* ,char* ,unsigned int ,int );
void SDL_MixAudio_MMX_S8_VC(char* ,char* ,unsigned int ,int ); void SDL_MixAudio_MMX_S8_VC(char* ,char* ,unsigned int ,int );
#endif #endif
...@@ -433,7 +433,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc, ...@@ -433,7 +433,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
was_error = 1; was_error = 1;
goto done; goto done;
} }
headerDiff += sizeof(Uint32); // for WAVE headerDiff += sizeof(Uint32); /* for WAVE */
/* Read the audio data format chunk */ /* Read the audio data format chunk */
chunk.data = NULL; chunk.data = NULL;
...@@ -446,7 +446,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc, ...@@ -446,7 +446,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
was_error = 1; was_error = 1;
goto done; goto done;
} }
// 2 Uint32's for chunk header+len, plus the lenread /* 2 Uint32's for chunk header+len, plus the lenread */
headerDiff += lenread + 2 * sizeof(Uint32); headerDiff += lenread + 2 * sizeof(Uint32);
} while ( (chunk.magic == FACT) || (chunk.magic == LIST) ); } while ( (chunk.magic == FACT) || (chunk.magic == LIST) );
...@@ -527,7 +527,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc, ...@@ -527,7 +527,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
*audio_buf = chunk.data; *audio_buf = chunk.data;
if(chunk.magic != DATA) headerDiff += lenread + 2 * sizeof(Uint32); if(chunk.magic != DATA) headerDiff += lenread + 2 * sizeof(Uint32);
} while ( chunk.magic != DATA ); } while ( chunk.magic != DATA );
headerDiff += 2 * sizeof(Uint32); // for the data chunk and len headerDiff += 2 * sizeof(Uint32); /* for the data chunk and len */
if ( MS_ADPCM_encoded ) { if ( MS_ADPCM_encoded ) {
if ( MS_ADPCM_decode(audio_buf, audio_len) < 0 ) { if ( MS_ADPCM_decode(audio_buf, audio_len) < 0 ) {
...@@ -554,7 +554,7 @@ done: ...@@ -554,7 +554,7 @@ done:
if ( freesrc ) { if ( freesrc ) {
SDL_RWclose(src); SDL_RWclose(src);
} else { } else {
// seek to the end of the file (given by the RIFF chunk) /* seek to the end of the file (given by the RIFF chunk) */
SDL_RWseek(src, wavelen - chunk.length - headerDiff, RW_SEEK_CUR); SDL_RWseek(src, wavelen - chunk.length - headerDiff, RW_SEEK_CUR);
} }
} }
......
...@@ -128,8 +128,8 @@ static OSStatus audioCallback (void *inRefCon, ...@@ -128,8 +128,8 @@ static OSStatus audioCallback (void *inRefCon,
len = bufferSize - bufferOffset; len = bufferSize - bufferOffset;
if (len > remaining) if (len > remaining)
len = remaining; len = remaining;
SDL_memcpy(ptr, buffer + bufferOffset, len); SDL_memcpy(ptr, (char *)buffer + bufferOffset, len);
ptr += len; ptr = (char *)ptr + len;
remaining -= len; remaining -= len;
bufferOffset += len; bufferOffset += len;
} }
......
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// AudioFilePlayer.cpp AudioFilePlayer.cpp
// */
#include "AudioFilePlayer.h" #include "AudioFilePlayer.h"
/* /*
...@@ -61,7 +61,7 @@ static void PrintStreamDesc (AudioStreamBasicDescription *inDesc) ...@@ -61,7 +61,7 @@ static void PrintStreamDesc (AudioStreamBasicDescription *inDesc)
static int AudioFilePlayer_SetDestination (AudioFilePlayer *afp, AudioUnit *inDestUnit) static int AudioFilePlayer_SetDestination (AudioFilePlayer *afp, AudioUnit *inDestUnit)
{ {
//if (afp->mConnected) throw static_cast<OSStatus>(-1); //can't set dest if already engaged /*if (afp->mConnected) throw static_cast<OSStatus>(-1);*/ /* can't set dest if already engaged */
if (afp->mConnected) if (afp->mConnected)
return 0 ; return 0 ;
...@@ -70,17 +70,17 @@ static int AudioFilePlayer_SetDestination (AudioFilePlayer *afp, AudioUnit *inD ...@@ -70,17 +70,17 @@ static int AudioFilePlayer_SetDestination (AudioFilePlayer *afp, AudioUnit *inD
OSStatus result = noErr; OSStatus result = noErr;
//we can "down" cast a component instance to a component /* we can "down" cast a component instance to a component */
ComponentDescription desc; ComponentDescription desc;
result = GetComponentInfo ((Component)*inDestUnit, &desc, 0, 0, 0); result = GetComponentInfo ((Component)*inDestUnit, &desc, 0, 0, 0);
if (result) return 0; //THROW_RESULT("GetComponentInfo") if (result) return 0; /*THROW_RESULT("GetComponentInfo")*/
// we're going to use this to know which convert routine to call /* we're going to use this to know which convert routine to call
// a v1 audio unit will have a type of 'aunt' a v1 audio unit will have a type of 'aunt'
// a v2 audio unit will have one of several different types. a v2 audio unit will have one of several different types. */
if (desc.componentType != kAudioUnitComponentType) { if (desc.componentType != kAudioUnitComponentType) {
result = badComponentInstance; result = badComponentInstance;
//THROW_RESULT("BAD COMPONENT") /*THROW_RESULT("BAD COMPONENT")*/
if (result) return 0; if (result) return 0;
} }
...@@ -91,7 +91,7 @@ static int AudioFilePlayer_SetDestination (AudioFilePlayer *afp, AudioUnit *inD ...@@ -91,7 +91,7 @@ static int AudioFilePlayer_SetDestination (AudioFilePlayer *afp, AudioUnit *inD
0, 0,
&afp->mFileDescription, &afp->mFileDescription,
sizeof (afp->mFileDescription)); sizeof (afp->mFileDescription));
//THROW_RESULT("AudioUnitSetProperty") /*THROW_RESULT("AudioUnitSetProperty")*/
if (result) return 0; if (result) return 0;
return 1; return 1;
} }
...@@ -170,7 +170,7 @@ static int AudioFilePlayer_Connect(AudioFilePlayer *afp) ...@@ -170,7 +170,7 @@ static int AudioFilePlayer_Connect(AudioFilePlayer *afp)
if (!afp->mAudioFileManager->DoConnect(afp->mAudioFileManager)) if (!afp->mAudioFileManager->DoConnect(afp->mAudioFileManager))
return 0; return 0;
// set the render callback for the file data to be supplied to the sound converter AU /* set the render callback for the file data to be supplied to the sound converter AU */
afp->mInputCallback.inputProc = afp->mAudioFileManager->FileInputProc; afp->mInputCallback.inputProc = afp->mAudioFileManager->FileInputProc;
afp->mInputCallback.inputProcRefCon = afp->mAudioFileManager; afp->mInputCallback.inputProcRefCon = afp->mAudioFileManager;
...@@ -180,15 +180,15 @@ static int AudioFilePlayer_Connect(AudioFilePlayer *afp) ...@@ -180,15 +180,15 @@ static int AudioFilePlayer_Connect(AudioFilePlayer *afp)
0, 0,
&afp->mInputCallback, &afp->mInputCallback,
sizeof(afp->mInputCallback)); sizeof(afp->mInputCallback));
if (result) return 0; //THROW_RESULT("AudioUnitSetProperty") if (result) return 0; /*THROW_RESULT("AudioUnitSetProperty")*/
afp->mConnected = 1; afp->mConnected = 1;
} }
return 1; return 1;
} }
// warning noted, now please go away ;-) /* warning noted, now please go away ;-) */
// #warning This should redirect the calling of notification code to some other thread /* #warning This should redirect the calling of notification code to some other thread */
static void AudioFilePlayer_DoNotification (AudioFilePlayer *afp, OSStatus inStatus) static void AudioFilePlayer_DoNotification (AudioFilePlayer *afp, OSStatus inStatus)
{ {
if (afp->mNotifier) { if (afp->mNotifier) {
...@@ -243,52 +243,53 @@ static int AudioFilePlayer_OpenFile (AudioFilePlayer *afp, const FSRef *inRef ...@@ -243,52 +243,53 @@ static int AudioFilePlayer_OpenFile (AudioFilePlayer *afp, const FSRef *inRef
ByteCount actual; ByteCount actual;
SInt64 offset; SInt64 offset;
// Open the data fork of the input file /* Open the data fork of the input file */
result = FSGetDataForkName(&dfName); result = FSGetDataForkName(&dfName);
if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): FSGetDataForkName") if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSGetDataForkName")*/
result = FSOpenFork(inRef, dfName.length, dfName.unicode, fsRdPerm, &afp->mForkRefNum); result = FSOpenFork(inRef, dfName.length, dfName.unicode, fsRdPerm, &afp->mForkRefNum);
if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): FSOpenFork") if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSOpenFork")*/
// Read the file header, and check if it's indeed an AIFC file /* Read the file header, and check if it's indeed an AIFC file */
result = FSReadFork(afp->mForkRefNum, fsAtMark, 0, sizeof(chunkHeader), &chunkHeader, &actual); result = FSReadFork(afp->mForkRefNum, fsAtMark, 0, sizeof(chunkHeader), &chunkHeader, &actual);
if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork") if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork")*/
if (chunkHeader.ckID != 'FORM') { if (chunkHeader.ckID != 'FORM') {
result = -1; result = -1;
if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): chunk id is not 'FORM'"); if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): chunk id is not 'FORM'");*/
} }
if (chunkHeader.formType != 'AIFC') { if (chunkHeader.formType != 'AIFC') {
result = -1; result = -1;
if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): file format is not 'AIFC'"); if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): file format is not 'AIFC'");*/
} }
// Search for the SSND chunk. We ignore all compression etc. information /* Search for the SSND chunk. We ignore all compression etc. information
// in other chunks. Of course that is kind of evil, but for now we are lazy in other chunks. Of course that is kind of evil, but for now we are lazy
// and rely on the cdfs to always give us the same fixed format. and rely on the cdfs to always give us the same fixed format.
// TODO: Parse the COMM chunk we currently skip to fill in mFileDescription. TODO: Parse the COMM chunk we currently skip to fill in mFileDescription.
*/
offset = 0; offset = 0;
do { do {
result = FSReadFork(afp->mForkRefNum, fsFromMark, offset, sizeof(chunk), &chunk, &actual); result = FSReadFork(afp->mForkRefNum, fsFromMark, offset, sizeof(chunk), &chunk, &actual);
if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork") if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork")*/
// Skip the chunk data /* Skip the chunk data */
offset = chunk.ckSize; offset = chunk.ckSize;
} while (chunk.ckID != 'SSND'); } while (chunk.ckID != 'SSND');
// Read the header of the SSND chunk. After this, we are positioned right /* Read the header of the SSND chunk. After this, we are positioned right
// at the start of the audio data. at the start of the audio data. */
result = FSReadFork(afp->mForkRefNum, fsAtMark, 0, sizeof(ssndData), &ssndData, &actual); result = FSReadFork(afp->mForkRefNum, fsAtMark, 0, sizeof(ssndData), &ssndData, &actual);
if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork") if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSReadFork")*/
result = FSSetForkPosition(afp->mForkRefNum, fsFromMark, ssndData.offset); result = FSSetForkPosition(afp->mForkRefNum, fsFromMark, ssndData.offset);
if (result) return 0; //THROW_RESULT("AudioFilePlayer::OpenFile(): FSSetForkPosition") if (result) return 0; /*THROW_RESULT("AudioFilePlayer::OpenFile(): FSSetForkPosition")*/
// Data size /* Data size */
*outFileDataSize = chunk.ckSize - ssndData.offset - 8; *outFileDataSize = chunk.ckSize - ssndData.offset - 8;
// File format /* File format */
afp->mFileDescription.mSampleRate = 44100; afp->mFileDescription.mSampleRate = 44100;
afp->mFileDescription.mFormatID = kAudioFormatLinearPCM; afp->mFileDescription.mFormatID = kAudioFormatLinearPCM;
afp->mFileDescription.mFormatFlags = kLinearPCMFormatFlagIsPacked | kLinearPCMFormatFlagIsSignedInteger; afp->mFileDescription.mFormatFlags = kLinearPCMFormatFlagIsPacked | kLinearPCMFormatFlagIsSignedInteger;
...@@ -331,7 +332,7 @@ AudioFilePlayer *new_AudioFilePlayer (const FSRef *inFileRef) ...@@ -331,7 +332,7 @@ AudioFilePlayer *new_AudioFilePlayer (const FSRef *inFileRef)
return NULL; return NULL;
} }
// we want about 4 seconds worth of data for the buffer /* we want about 4 seconds worth of data for the buffer */
int bytesPerSecond = (UInt32) (4 * afp->mFileDescription.mSampleRate * afp->mFileDescription.mBytesPerFrame); int bytesPerSecond = (UInt32) (4 * afp->mFileDescription.mSampleRate * afp->mFileDescription.mBytesPerFrame);
#if DEBUG #if DEBUG
......
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
*/ */
#include "SDL_config.h" #include "SDL_config.h"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// AudioFilePlayer.h AudioFilePlayer.h
// */
#ifndef __AudioFilePlayer_H__ #ifndef __AudioFilePlayer_H__
#define __AudioFilePlayer_H__ #define __AudioFilePlayer_H__
...@@ -62,12 +62,12 @@ struct S_AudioFileManager; ...@@ -62,12 +62,12 @@ struct S_AudioFileManager;
#pragma mark __________ AudioFilePlayer #pragma mark __________ AudioFilePlayer
typedef struct S_AudioFilePlayer typedef struct S_AudioFilePlayer
{ {
//public: /*public:*/
int (*SetDestination)(struct S_AudioFilePlayer *afp, AudioUnit *inDestUnit); int (*SetDestination)(struct S_AudioFilePlayer *afp, AudioUnit *inDestUnit);
void (*SetNotifier)(struct S_AudioFilePlayer *afp, AudioFilePlayNotifier inNotifier, void *inRefCon); void (*SetNotifier)(struct S_AudioFilePlayer *afp, AudioFilePlayNotifier inNotifier, void *inRefCon);
void (*SetStartFrame)(struct S_AudioFilePlayer *afp, int frame); // seek in the file void (*SetStartFrame)(struct S_AudioFilePlayer *afp, int frame); /* seek in the file */
int (*GetCurrentFrame)(struct S_AudioFilePlayer *afp); // get the current frame position int (*GetCurrentFrame)(struct S_AudioFilePlayer *afp); /* get the current frame position */
void (*SetStopFrame)(struct S_AudioFilePlayer *afp, int frame); // set limit in the file void (*SetStopFrame)(struct S_AudioFilePlayer *afp, int frame); /* set limit in the file */
int (*Connect)(struct S_AudioFilePlayer *afp); int (*Connect)(struct S_AudioFilePlayer *afp);
void (*Disconnect)(struct S_AudioFilePlayer *afp); void (*Disconnect)(struct S_AudioFilePlayer *afp);
void (*DoNotification)(struct S_AudioFilePlayer *afp, OSStatus inError); void (*DoNotification)(struct S_AudioFilePlayer *afp, OSStatus inError);
...@@ -75,7 +75,7 @@ typedef struct S_AudioFilePlayer ...@@ -75,7 +75,7 @@ typedef struct S_AudioFilePlayer
AudioUnit (*GetDestUnit)(struct S_AudioFilePlayer *afp); AudioUnit (*GetDestUnit)(struct S_AudioFilePlayer *afp);
void (*Print)(struct S_AudioFilePlayer *afp); void (*Print)(struct S_AudioFilePlayer *afp);
//private: /*private:*/
AudioUnit mPlayUnit; AudioUnit mPlayUnit;
SInt16 mForkRefNum; SInt16 mForkRefNum;
...@@ -106,19 +106,19 @@ void delete_AudioFilePlayer(AudioFilePlayer *afp); ...@@ -106,19 +106,19 @@ void delete_AudioFilePlayer(AudioFilePlayer *afp);
#pragma mark __________ AudioFileManager #pragma mark __________ AudioFileManager
typedef struct S_AudioFileManager typedef struct S_AudioFileManager
{ {
//public: /*public:*/
// this method should NOT be called by an object of this class /* this method should NOT be called by an object of this class
// as it is called by the parent's Disconnect() method as it is called by the parent's Disconnect() method */
void (*Disconnect)(struct S_AudioFileManager *afm); void (*Disconnect)(struct S_AudioFileManager *afm);
int (*DoConnect)(struct S_AudioFileManager *afm); int (*DoConnect)(struct S_AudioFileManager *afm);
OSStatus (*Read)(struct S_AudioFileManager *afm, char *buffer, UInt32 *len); OSStatus (*Read)(struct S_AudioFileManager *afm, char *buffer, UInt32 *len);
const char* (*GetFileBuffer)(struct S_AudioFileManager *afm); const char* (*GetFileBuffer)(struct S_AudioFileManager *afm);
const AudioFilePlayer *(*GetParent)(struct S_AudioFileManager *afm); const AudioFilePlayer *(*GetParent)(struct S_AudioFileManager *afm);
void (*SetPosition)(struct S_AudioFileManager *afm, SInt64 pos); // seek/rewind in the file void (*SetPosition)(struct S_AudioFileManager *afm, SInt64 pos); /* seek/rewind in the file */
int (*GetByteCounter)(struct S_AudioFileManager *afm); // return actual bytes streamed to audio hardware int (*GetByteCounter)(struct S_AudioFileManager *afm); /* return actual bytes streamed to audio hardware */
void (*SetEndOfFile)(struct S_AudioFileManager *afm, SInt64 pos); // set the "EOF" (will behave just like it reached eof) void (*SetEndOfFile)(struct S_AudioFileManager *afm, SInt64 pos); /* set the "EOF" (will behave just like it reached eof) */
//protected: /*protected:*/
AudioFilePlayer* mParent; AudioFilePlayer* mParent;
SInt16 mForkRefNum; SInt16 mForkRefNum;
SInt64 mAudioDataOffset; SInt64 mAudioDataOffset;
...@@ -137,20 +137,20 @@ typedef struct S_AudioFileManager ...@@ -137,20 +137,20 @@ typedef struct S_AudioFileManager
void* mTmpBuffer; void* mTmpBuffer;
UInt32 mBufferSize; UInt32 mBufferSize;
UInt32 mBufferOffset; UInt32 mBufferOffset;
//public: /*public:*/
UInt32 mChunkSize; UInt32 mChunkSize;
SInt64 mFileLength; SInt64 mFileLength;
SInt64 mReadFilePosition; SInt64 mReadFilePosition;
int mWriteToFirstBuffer; int mWriteToFirstBuffer;
int mFinishedReadingData; int mFinishedReadingData;
//protected: /*protected:*/
OSStatus (*Render)(struct S_AudioFileManager *afm, AudioBuffer *ioData); OSStatus (*Render)(struct S_AudioFileManager *afm, AudioBuffer *ioData);
OSStatus (*GetFileData)(struct S_AudioFileManager *afm, void** inOutData, UInt32 *inOutDataSize); OSStatus (*GetFileData)(struct S_AudioFileManager *afm, void** inOutData, UInt32 *inOutDataSize);
void (*AfterRender)(struct S_AudioFileManager *afm); void (*AfterRender)(struct S_AudioFileManager *afm);
//public: /*public:*/
//static /*static*/
OSStatus (*FileInputProc)(void *inRefCon, OSStatus (*FileInputProc)(void *inRefCon,
AudioUnitRenderActionFlags inActionFlags, AudioUnitRenderActionFlags inActionFlags,
const AudioTimeStamp *inTimeStamp, const AudioTimeStamp *inTimeStamp,
......
This diff is collapsed.
This diff is collapsed.
...@@ -44,7 +44,7 @@ void Lock (); ...@@ -44,7 +44,7 @@ void Lock ();
void Unlock(); void Unlock();
int LoadFile (const FSRef *ref, int startFrame, int endFrame); // pass -1 to do nothing int LoadFile (const FSRef *ref, int startFrame, int endFrame); /* pass -1 to do nothing */
int ReleaseFile (); int ReleaseFile ();
......
...@@ -66,9 +66,9 @@ ...@@ -66,9 +66,9 @@
=============================================================================*/ =============================================================================*/
//============================================================================= /*=============================================================================
// Includes Includes
//============================================================================= =============================================================================*/
/* /*
#include <stdio.h> #include <stdio.h>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
*/ */
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
//#define NDEBUG 1 /*#define NDEBUG 1*/
/* /*
#include <assert.h> #include <assert.h>
*/ */
...@@ -86,10 +86,10 @@ ...@@ -86,10 +86,10 @@
#include "SDLOSXCAGuard.h" #include "SDLOSXCAGuard.h"
//#warning Need a try-based Locker too /*#warning Need a try-based Locker too*/
//============================================================================= /*=============================================================================
// SDLOSXCAGuard SDLOSXCAGuard
//============================================================================= =============================================================================*/
static int SDLOSXCAGuard_Lock(SDLOSXCAGuard *cag) static int SDLOSXCAGuard_Lock(SDLOSXCAGuard *cag)
{ {
...@@ -98,6 +98,7 @@ static int SDLOSXCAGuard_Lock(SDLOSXCAGuard *cag) ...@@ -98,6 +98,7 @@ static int SDLOSXCAGuard_Lock(SDLOSXCAGuard *cag)
if(pthread_self() != cag->mOwner) if(pthread_self() != cag->mOwner)
{ {
OSStatus theError = pthread_mutex_lock(&cag->mMutex); OSStatus theError = pthread_mutex_lock(&cag->mMutex);
(void)theError;
assert(theError == 0); assert(theError == 0);
cag->mOwner = pthread_self(); cag->mOwner = pthread_self();
theAnswer = 1; theAnswer = 1;
...@@ -108,10 +109,12 @@ static int SDLOSXCAGuard_Lock(SDLOSXCAGuard *cag) ...@@ -108,10 +109,12 @@ static int SDLOSXCAGuard_Lock(SDLOSXCAGuard *cag)
static void SDLOSXCAGuard_Unlock(SDLOSXCAGuard *cag) static void SDLOSXCAGuard_Unlock(SDLOSXCAGuard *cag)
{ {
OSStatus theError;
assert(pthread_self() == cag->mOwner); assert(pthread_self() == cag->mOwner);
cag->mOwner = 0; cag->mOwner = 0;
OSStatus theError = pthread_mutex_unlock(&cag->mMutex); theError = pthread_mutex_unlock(&cag->mMutex);
(void)theError;
assert(theError == 0); assert(theError == 0);
} }
...@@ -137,11 +140,13 @@ static int SDLOSXCAGuard_Try (SDLOSXCAGuard *cag, int *outWasLocked) ...@@ -137,11 +140,13 @@ static int SDLOSXCAGuard_Try (SDLOSXCAGuard *cag, int *outWasLocked)
static void SDLOSXCAGuard_Wait(SDLOSXCAGuard *cag) static void SDLOSXCAGuard_Wait(SDLOSXCAGuard *cag)
{ {
OSStatus theError;
assert(pthread_self() == cag->mOwner); assert(pthread_self() == cag->mOwner);
cag->mOwner = 0; cag->mOwner = 0;
OSStatus theError = pthread_cond_wait(&cag->mCondVar, &cag->mMutex); theError = pthread_cond_wait(&cag->mCondVar, &cag->mMutex);
(void)theError;
assert(theError == 0); assert(theError == 0);
cag->mOwner = pthread_self(); cag->mOwner = pthread_self();
} }
...@@ -149,12 +154,14 @@ static void SDLOSXCAGuard_Wait(SDLOSXCAGuard *cag) ...@@ -149,12 +154,14 @@ static void SDLOSXCAGuard_Wait(SDLOSXCAGuard *cag)
static void SDLOSXCAGuard_Notify(SDLOSXCAGuard *cag) static void SDLOSXCAGuard_Notify(SDLOSXCAGuard *cag)
{ {
OSStatus theError = pthread_cond_signal(&cag->mCondVar); OSStatus theError = pthread_cond_signal(&cag->mCondVar);
(void)theError;
assert(theError == 0); assert(theError == 0);
} }
SDLOSXCAGuard *new_SDLOSXCAGuard(void) SDLOSXCAGuard *new_SDLOSXCAGuard(void)
{ {
OSStatus theError;
SDLOSXCAGuard *cag = (SDLOSXCAGuard *) SDL_malloc(sizeof (SDLOSXCAGuard)); SDLOSXCAGuard *cag = (SDLOSXCAGuard *) SDL_malloc(sizeof (SDLOSXCAGuard));
if (cag == NULL) if (cag == NULL)
return NULL; return NULL;
...@@ -168,10 +175,12 @@ SDLOSXCAGuard *new_SDLOSXCAGuard(void) ...@@ -168,10 +175,12 @@ SDLOSXCAGuard *new_SDLOSXCAGuard(void)
SET_SDLOSXCAGUARD_METHOD(Notify); SET_SDLOSXCAGUARD_METHOD(Notify);
#undef SET_SDLOSXCAGUARD_METHOD #undef SET_SDLOSXCAGUARD_METHOD
OSStatus theError = pthread_mutex_init(&cag->mMutex, NULL); theError = pthread_mutex_init(&cag->mMutex, NULL);
(void)theError;
assert(theError == 0); assert(theError == 0);
theError = pthread_cond_init(&cag->mCondVar, NULL); theError = pthread_cond_init(&cag->mCondVar, NULL);
(void)theError;
assert(theError == 0); assert(theError == 0);
cag->mOwner = 0; cag->mOwner = 0;
......
...@@ -69,41 +69,41 @@ ...@@ -69,41 +69,41 @@
#if !defined(__CAGuard_h__) #if !defined(__CAGuard_h__)
#define __CAGuard_h__ #define __CAGuard_h__
//============================================================================= /*=============================================================================
// Includes Includes
//============================================================================= =============================================================================*/
#include <CoreAudio/CoreAudioTypes.h> #include <CoreAudio/CoreAudioTypes.h>
#include <pthread.h> #include <pthread.h>
//============================================================================= /*=============================================================================
// CAGuard CAGuard
//
// This is your typical mutex with signalling implemented via pthreads. This is your typical mutex with signalling implemented via pthreads.
// Lock() will return true if and only if the guard is locked on that call. Lock() will return true if and only if the guard is locked on that call.
// A thread that already has the guard will receive 'false' if it locks it A thread that already has the guard will receive 'false' if it locks it
// again. Use of the stack-based CAGuard::Locker class is highly recommended again. Use of the stack-based CAGuard::Locker class is highly recommended
// to properly manage the recursive nesting. The Wait calls with timeouts to properly manage the recursive nesting. The Wait calls with timeouts
// will return true if and only if the timeout period expired. They will will return true if and only if the timeout period expired. They will
// return false if they receive notification any other way. return false if they receive notification any other way.
//============================================================================= =============================================================================*/
typedef struct S_SDLOSXCAGuard typedef struct S_SDLOSXCAGuard
{ {
// Construction/Destruction /* Construction/Destruction */
//public: /*public:*/
// Actions /* Actions */
//public: /*public:*/
int (*Lock)(struct S_SDLOSXCAGuard *cag); int (*Lock)(struct S_SDLOSXCAGuard *cag);
void (*Unlock)(struct S_SDLOSXCAGuard *cag); void (*Unlock)(struct S_SDLOSXCAGuard *cag);
int (*Try)(struct S_SDLOSXCAGuard *cag, int *outWasLocked); // returns true if lock is free, false if not int (*Try)(struct S_SDLOSXCAGuard *cag, int *outWasLocked); /* returns true if lock is free, false if not */
void (*Wait)(struct S_SDLOSXCAGuard *cag); void (*Wait)(struct S_SDLOSXCAGuard *cag);
void (*Notify)(struct S_SDLOSXCAGuard *cag); void (*Notify)(struct S_SDLOSXCAGuard *cag);
// Implementation /* Implementation */
//protected: /*protected:*/
pthread_mutex_t mMutex; pthread_mutex_t mMutex;
pthread_cond_t mCondVar; pthread_cond_t mCondVar;
pthread_t mOwner; pthread_t mOwner;
......
...@@ -472,7 +472,7 @@ static int SDL_SYS_CDEject(SDL_CD *cdrom) ...@@ -472,7 +472,7 @@ static int SDL_SYS_CDEject(SDL_CD *cdrom)
status = CD_STOPPED; status = CD_STOPPED;
// Eject the volume /* Eject the volume */
pb.ioParam.ioNamePtr = NULL; pb.ioParam.ioNamePtr = NULL;
pb.ioParam.ioVRefNum = volumes[cdrom->id]; pb.ioParam.ioVRefNum = volumes[cdrom->id];
err = PBUnmountVol((ParamBlockRec *) &pb); err = PBUnmountVol((ParamBlockRec *) &pb);
......
...@@ -26,13 +26,11 @@ ...@@ -26,13 +26,11 @@
#include "SDL.h" #include "SDL.h"
#include "SDL_cpuinfo.h" #include "SDL_cpuinfo.h"
#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
#include <signal.h>
#include <setjmp.h>
#endif
#ifdef __MACOSX__ #ifdef __MACOSX__
#include <sys/sysctl.h> /* For AltiVec check */ #include <sys/sysctl.h> /* For AltiVec check */
#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
#include <signal.h>
#include <setjmp.h>
#endif #endif
#define CPU_HAS_RDTSC 0x00000001 #define CPU_HAS_RDTSC 0x00000001
...@@ -44,7 +42,7 @@ ...@@ -44,7 +42,7 @@
#define CPU_HAS_SSE2 0x00000080 #define CPU_HAS_SSE2 0x00000080
#define CPU_HAS_ALTIVEC 0x00000100 #define CPU_HAS_ALTIVEC 0x00000100
#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP #if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__
/* This is the brute force way of detecting instruction sets... /* This is the brute force way of detecting instruction sets...
the idea is borrowed from the libmpeg2 library - thanks! the idea is borrowed from the libmpeg2 library - thanks!
*/ */
......
...@@ -48,42 +48,42 @@ ...@@ -48,42 +48,42 @@
struct recElement struct recElement
{ {
IOHIDElementCookie cookie; // unique value which identifies element, will NOT change IOHIDElementCookie cookie; /* unique value which identifies element, will NOT change */
long min; // reported min value possible long min; /* reported min value possible */
long max; // reported max value possible long max; /* reported max value possible */
/* #if 0
TODO: maybe should handle the following stuff somehow? /* TODO: maybe should handle the following stuff somehow? */
long scaledMin; // reported scaled min value possible long scaledMin; /* reported scaled min value possible */
long scaledMax; // reported scaled max value possible long scaledMax; /* reported scaled max value possible */
long size; // size in bits of data return from element long size; /* size in bits of data return from element */
Boolean relative; // are reports relative to last report (deltas) Boolean relative; /* are reports relative to last report (deltas) */
Boolean wrapping; // does element wrap around (one value higher than max is min) Boolean wrapping; /* does element wrap around (one value higher than max is min) */
Boolean nonLinear; // are the values reported non-linear relative to element movement Boolean nonLinear; /* are the values reported non-linear relative to element movement */
Boolean preferredState; // does element have a preferred state (such as a button) Boolean preferredState; /* does element have a preferred state (such as a button) */
Boolean nullState; // does element have null state Boolean nullState; /* does element have null state */
*/ #endif /* 0 */
/* runtime variables used for auto-calibration */ /* runtime variables used for auto-calibration */
long minReport; // min returned value long minReport; /* min returned value */
long maxReport; // max returned value long maxReport; /* max returned value */
struct recElement * pNext; // next element in list struct recElement * pNext; /* next element in list */
}; };
typedef struct recElement recElement; typedef struct recElement recElement;
struct joystick_hwdata struct joystick_hwdata
{ {
IOHIDDeviceInterface ** interface; // interface to device, NULL = no interface IOHIDDeviceInterface ** interface; /* interface to device, NULL = no interface */
char product[256]; // name of product char product[256]; /* name of product */
long usage; // usage page from IOUSBHID Parser.h which defines general usage long usage; /* usage page from IOUSBHID Parser.h which defines general usage */
long usagePage; // usage within above page from IOUSBHID Parser.h which defines specific usage long usagePage; /* usage within above page from IOUSBHID Parser.h which defines specific usage */
long axes; // number of axis (calculated, not reported by device) long axes; /* number of axis (calculated, not reported by device) */
long buttons; // number of buttons (calculated, not reported by device) long buttons; /* number of buttons (calculated, not reported by device) */
long hats; // number of hat switches (calculated, not reported by device) long hats; /* number of hat switches (calculated, not reported by device) */
long elements; // number of total elements (shouldbe total of above) (calculated, not reported by device) long elements; /* number of total elements (shouldbe total of above) (calculated, not reported by device) */
recElement* firstAxis; recElement* firstAxis;
recElement* firstButton; recElement* firstButton;
...@@ -92,7 +92,7 @@ struct joystick_hwdata ...@@ -92,7 +92,7 @@ struct joystick_hwdata
int removed; int removed;
int uncentered; int uncentered;
struct joystick_hwdata* pNext; // next device struct joystick_hwdata* pNext; /* next device */
}; };
typedef struct joystick_hwdata recDevice; typedef struct joystick_hwdata recDevice;
...@@ -131,32 +131,17 @@ static SInt32 HIDGetElementValue (recDevice *pDevice, recElement *pElement) ...@@ -131,32 +131,17 @@ static SInt32 HIDGetElementValue (recDevice *pDevice, recElement *pElement)
} }
} }
// auto user scale /* auto user scale */
return hidEvent.value; return hidEvent.value;
} }
/* similiar to HIDGetElementValue, but auto-calibrates the value before returning it */
static SInt32 HIDCalibratedValue (recDevice *pDevice, recElement *pElement)
{
float deviceScale = pElement->max - pElement->min;
float readScale = pElement->maxReport - pElement->minReport;
SInt32 value = HIDGetElementValue(pDevice, pElement);
if (readScale == 0)
return value; // no scaling at all
else
return ((value - pElement->minReport) * deviceScale / readScale) + pElement->min;
}
/* similiar to HIDCalibratedValue but calibrates to an arbitrary scale instead of the elements default scale */
static SInt32 HIDScaledCalibratedValue (recDevice *pDevice, recElement *pElement, long min, long max) static SInt32 HIDScaledCalibratedValue (recDevice *pDevice, recElement *pElement, long min, long max)
{ {
float deviceScale = max - min; float deviceScale = max - min;
float readScale = pElement->maxReport - pElement->minReport; float readScale = pElement->maxReport - pElement->minReport;
SInt32 value = HIDGetElementValue(pDevice, pElement); SInt32 value = HIDGetElementValue(pDevice, pElement);
if (readScale == 0) if (readScale == 0)
return value; // no scaling at all return value; /* no scaling at all */
else else
return ((value - pElement->minReport) * deviceScale / readScale) + min; return ((value - pElement->minReport) * deviceScale / readScale) + min;
} }
...@@ -191,7 +176,7 @@ static IOReturn HIDCreateOpenDeviceInterface (io_object_t hidDevice, recDevice * ...@@ -191,7 +176,7 @@ static IOReturn HIDCreateOpenDeviceInterface (io_object_t hidDevice, recDevice *
kIOCFPlugInInterfaceID, &ppPlugInInterface, &score); kIOCFPlugInInterfaceID, &ppPlugInInterface, &score);
if (kIOReturnSuccess == result) if (kIOReturnSuccess == result)
{ {
// Call a method of the intermediate plug-in to create the device interface /* Call a method of the intermediate plug-in to create the device interface */
plugInResult = (*ppPlugInInterface)->QueryInterface (ppPlugInInterface, plugInResult = (*ppPlugInInterface)->QueryInterface (ppPlugInInterface,
CFUUIDGetUUIDBytes (kIOHIDDeviceInterfaceID), (void *) &(pDevice->interface)); CFUUIDGetUUIDBytes (kIOHIDDeviceInterfaceID), (void *) &(pDevice->interface));
if (S_OK != plugInResult) if (S_OK != plugInResult)
...@@ -225,15 +210,15 @@ static IOReturn HIDCloseReleaseInterface (recDevice *pDevice) ...@@ -225,15 +210,15 @@ static IOReturn HIDCloseReleaseInterface (recDevice *pDevice)
if ((NULL != pDevice) && (NULL != pDevice->interface)) if ((NULL != pDevice) && (NULL != pDevice->interface))
{ {
// close the interface /* close the interface */
result = (*(pDevice->interface))->close (pDevice->interface); result = (*(pDevice->interface))->close (pDevice->interface);
if (kIOReturnNotOpen == result) if (kIOReturnNotOpen == result)
{ {
// do nothing as device was not opened, thus can't be closed /* do nothing as device was not opened, thus can't be closed */
} }
else if (kIOReturnSuccess != result) else if (kIOReturnSuccess != result)
HIDReportErrorNum ("Failed to close IOHIDDeviceInterface.", result); HIDReportErrorNum ("Failed to close IOHIDDeviceInterface.", result);
//release the interface /* release the interface */
result = (*(pDevice->interface))->Release (pDevice->interface); result = (*(pDevice->interface))->Release (pDevice->interface);
if (kIOReturnSuccess != result) if (kIOReturnSuccess != result)
HIDReportErrorNum ("Failed to release IOHIDDeviceInterface.", result); HIDReportErrorNum ("Failed to release IOHIDDeviceInterface.", result);
...@@ -559,7 +544,7 @@ static recDevice *HIDDisposeDevice (recDevice **ppDevice) ...@@ -559,7 +544,7 @@ static recDevice *HIDDisposeDevice (recDevice **ppDevice)
recDevice *pDeviceNext = NULL; recDevice *pDeviceNext = NULL;
if (*ppDevice) if (*ppDevice)
{ {
// save next device prior to disposing of this device /* save next device prior to disposing of this device */
pDeviceNext = (*ppDevice)->pNext; pDeviceNext = (*ppDevice)->pNext;
/* free element lists */ /* free element lists */
...@@ -658,8 +643,9 @@ int SDL_SYS_JoystickInit(void) ...@@ -658,8 +643,9 @@ int SDL_SYS_JoystickInit(void)
/* dump device object, it is no longer needed */ /* dump device object, it is no longer needed */
result = IOObjectRelease (ioHIDDeviceObject); result = IOObjectRelease (ioHIDDeviceObject);
// if (KERN_SUCCESS != result) /* if (KERN_SUCCESS != result)
// HIDReportErrorNum ("IOObjectRelease error with ioHIDDeviceObject.", result); HIDReportErrorNum ("IOObjectRelease error with ioHIDDeviceObject.", result);
*/
/* Filter device list to non-keyboard/mouse stuff */ /* Filter device list to non-keyboard/mouse stuff */
if ( (device->usagePage != kHIDPage_GenericDesktop) || if ( (device->usagePage != kHIDPage_GenericDesktop) ||
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#ifdef __MACOSX__ #ifdef __MACOSX__
#define USE_NAMED_SEMAPHORES 1 #define USE_NAMED_SEMAPHORES 1
#include <unistd.h>
#endif #endif
struct SDL_semaphore { struct SDL_semaphore {
......
...@@ -502,7 +502,7 @@ static vector unsigned char calc_swizzle32(const SDL_PixelFormat *srcfmt, ...@@ -502,7 +502,7 @@ static vector unsigned char calc_swizzle32(const SDL_PixelFormat *srcfmt,
if (!dstfmt) { if (!dstfmt) {
dstfmt = &default_pixel_format; dstfmt = &default_pixel_format;
} }
vector unsigned char plus = VECUINT8_LITERAL const vector unsigned char plus = VECUINT8_LITERAL
( 0x00, 0x00, 0x00, 0x00, ( 0x00, 0x00, 0x00, 0x00,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
...@@ -863,8 +863,8 @@ static void Blit32to32PixelAlphaAltivec(SDL_BlitInfo *info) ...@@ -863,8 +863,8 @@ static void Blit32to32PixelAlphaAltivec(SDL_BlitInfo *info)
} }
ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width); ONE_PIXEL_BLEND((UNALIGNED_PTR(dstp)) && (width), width);
if (width > 0) { if (width > 0) {
// vsrcPermute /* vsrcPermute */
// vdstPermute /* vdstPermute */
int extrawidth = (width % 4); int extrawidth = (width % 4);
vector unsigned char valigner = VEC_ALIGNER(srcp); vector unsigned char valigner = VEC_ALIGNER(srcp);
vector unsigned char vs = (vector unsigned char)vec_ld(0, srcp); vector unsigned char vs = (vector unsigned char)vec_ld(0, srcp);
......
...@@ -119,7 +119,7 @@ static vector unsigned char calc_swizzle32(const SDL_PixelFormat *srcfmt, ...@@ -119,7 +119,7 @@ static vector unsigned char calc_swizzle32(const SDL_PixelFormat *srcfmt,
if (!dstfmt) { if (!dstfmt) {
dstfmt = &default_pixel_format; dstfmt = &default_pixel_format;
} }
vector unsigned char plus = VECUINT8_LITERAL( const vector unsigned char plus = VECUINT8_LITERAL(
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
...@@ -559,10 +559,11 @@ static void Blit32to32KeyAltivec(SDL_BlitInfo *info) ...@@ -559,10 +559,11 @@ static void Blit32to32KeyAltivec(SDL_BlitInfo *info)
vpermute = calc_swizzle32(srcfmt, dstfmt); vpermute = calc_swizzle32(srcfmt, dstfmt);
if (info->d_width < 16) { if (info->d_width < 16) {
if(copy_alpha) { if(copy_alpha) {
return BlitNtoNKeyCopyAlpha(info); BlitNtoNKeyCopyAlpha(info);
} else { } else {
return BlitNtoNKey(info); BlitNtoNKey(info);
} }
return;
} }
vzero = vec_splat_u8(0); vzero = vec_splat_u8(0);
if (alpha) { if (alpha) {
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
#include "SDL_QuartzVideo.h" #include "SDL_QuartzVideo.h"
#include <IOKit/IOMessage.h> // For wake from sleep detection #include <IOKit/IOMessage.h> /* For wake from sleep detection */
#include <IOKit/pwr_mgt/IOPMLib.h> // For wake from sleep detection #include <IOKit/pwr_mgt/IOPMLib.h> /* For wake from sleep detection */
#include "SDL_QuartzKeys.h" #include "SDL_QuartzKeys.h"
/* /*
...@@ -681,26 +681,28 @@ void QZ_RegisterForSleepNotifications (_THIS) ...@@ -681,26 +681,28 @@ void QZ_RegisterForSleepNotifications (_THIS)
} }
// Try to map Quartz mouse buttons to SDL's lingo... /* Try to map Quartz mouse buttons to SDL's lingo... */
static int QZ_OtherMouseButtonToSDL(int button) static int QZ_OtherMouseButtonToSDL(int button)
{ {
switch (button) switch (button)
{ {
case 0: case 0:
return(SDL_BUTTON_LEFT); // 1 return(SDL_BUTTON_LEFT); /* 1 */
case 1: case 1:
return(SDL_BUTTON_RIGHT); // 3 return(SDL_BUTTON_RIGHT); /* 3 */
case 2: case 2:
return(SDL_BUTTON_MIDDLE); // 2 return(SDL_BUTTON_MIDDLE); /* 2 */
} }
// >= 3: skip 4 & 5, since those are the SDL mousewheel buttons. /* >= 3: skip 4 & 5, since those are the SDL mousewheel buttons. */
return(button + 3); return(button + 3);
} }
void QZ_PumpEvents (_THIS) void QZ_PumpEvents (_THIS)
{ {
static Uint32 screensaverTicks = 0;
Uint32 nowTicks;
int firstMouseEvent; int firstMouseEvent;
CGMouseDelta dx, dy; CGMouseDelta dx, dy;
...@@ -713,8 +715,7 @@ void QZ_PumpEvents (_THIS) ...@@ -713,8 +715,7 @@ void QZ_PumpEvents (_THIS)
return; /* don't do anything if there's no screen surface. */ return; /* don't do anything if there's no screen surface. */
/* Update activity every five seconds to prevent screensaver. --ryan. */ /* Update activity every five seconds to prevent screensaver. --ryan. */
static Uint32 screensaverTicks = 0; nowTicks = SDL_GetTicks();
Uint32 nowTicks = SDL_GetTicks();
if ((nowTicks - screensaverTicks) > 5000) if ((nowTicks - screensaverTicks) > 5000)
{ {
UpdateSystemActivity(UsrActivity); UpdateSystemActivity(UsrActivity);
......
...@@ -682,7 +682,7 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width, ...@@ -682,7 +682,7 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width,
return NULL; return NULL;
} }
//[ qz_window setReleasedWhenClosed:YES ]; /*[ qz_window setReleasedWhenClosed:YES ];*/
QZ_SetCaption(this, this->wm_title, this->wm_icon); QZ_SetCaption(this, this->wm_title, this->wm_icon);
[ qz_window setAcceptsMouseMovedEvents:YES ]; [ qz_window setAcceptsMouseMovedEvents:YES ];
[ qz_window setViewsNeedDisplay:NO ]; [ qz_window setViewsNeedDisplay:NO ];
...@@ -759,7 +759,7 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width, ...@@ -759,7 +759,7 @@ static SDL_Surface* QZ_SetVideoWindowed (_THIS, SDL_Surface *current, int width,
int hOffset = [ window_view frame ].origin.x; int hOffset = [ window_view frame ].origin.x;
current->pixels += (vOffset * current->pitch) + hOffset * (qdbpp/8); current->pixels = (Uint8 *)current->pixels + (vOffset * current->pitch) + hOffset * (qdbpp/8);
} }
this->UpdateRects = QZ_UpdateRects; this->UpdateRects = QZ_UpdateRects;
this->LockHWSurface = QZ_LockWindow; this->LockHWSurface = QZ_LockWindow;
...@@ -921,7 +921,7 @@ static int QZ_ThreadFlip (_THIS) { ...@@ -921,7 +921,7 @@ static int QZ_ThreadFlip (_THIS) {
* a fullscreen resolution smaller than the hardware could supply * a fullscreen resolution smaller than the hardware could supply
* so SDL is centering it in a bigger resolution)... * so SDL is centering it in a bigger resolution)...
*/ */
dst = CGDisplayBaseAddress (display_id) + SDL_VideoSurface->offset; dst = (Uint8 *)CGDisplayBaseAddress (display_id) + SDL_VideoSurface->offset;
src = current_buffer + SDL_VideoSurface->offset; src = current_buffer + SDL_VideoSurface->offset;
len = SDL_VideoSurface->w * SDL_VideoSurface->format->BytesPerPixel; len = SDL_VideoSurface->w * SDL_VideoSurface->format->BytesPerPixel;
h = SDL_VideoSurface->h; h = SDL_VideoSurface->h;
...@@ -1025,7 +1025,7 @@ static void QZ_DirectUpdate (_THIS, int num_rects, SDL_Rect *rects) { ...@@ -1025,7 +1025,7 @@ static void QZ_DirectUpdate (_THIS, int num_rects, SDL_Rect *rects) {
who supplied sample code for Carbon. who supplied sample code for Carbon.
*/ */
//#define TEST_OBSCURED 1 /*#define TEST_OBSCURED 1*/
#if TEST_OBSCURED #if TEST_OBSCURED
#include "CGS.h" #include "CGS.h"
...@@ -1075,7 +1075,6 @@ static int QZ_IsWindowObscured (NSWindow *window) { ...@@ -1075,7 +1075,6 @@ static int QZ_IsWindowObscured (NSWindow *window) {
CGSRect contentRect; CGSRect contentRect;
int windowNumber; int windowNumber;
//int isMainWindow;
int firstDockIcon; int firstDockIcon;
int dockIconCacheMiss; int dockIconCacheMiss;
int windowContentOffset; int windowContentOffset;
...@@ -1106,7 +1105,6 @@ static int QZ_IsWindowObscured (NSWindow *window) { ...@@ -1106,7 +1105,6 @@ static int QZ_IsWindowObscured (NSWindow *window) {
windowContentOffset = 0; windowContentOffset = 0;
windowNumber = [ window windowNumber ]; windowNumber = [ window windowNumber ];
//isMainWindow = [ window isMainWindow ];
/* The window list is sorted according to order on the screen */ /* The window list is sorted according to order on the screen */
count = 0; count = 0;
......
...@@ -144,7 +144,7 @@ static void QZ_SetPortAlphaOpaque () { ...@@ -144,7 +144,7 @@ static void QZ_SetPortAlphaOpaque () {
int hOffset = newViewFrame.origin.x; int hOffset = newViewFrame.origin.x;
SDL_VideoSurface->pixels += (vOffset * SDL_VideoSurface->pitch) + hOffset * (device_bpp/8); SDL_VideoSurface->pixels = (Uint8 *)SDL_VideoSurface->pixels + (vOffset * SDL_VideoSurface->pitch) + hOffset * (device_bpp/8);
} }
UnlockPortBits ( thePort ); UnlockPortBits ( thePort );
...@@ -177,7 +177,7 @@ static void QZ_SetPortAlphaOpaque () { ...@@ -177,7 +177,7 @@ static void QZ_SetPortAlphaOpaque () {
/* restore cached image, since it may not be current, post expose event too */ /* restore cached image, since it may not be current, post expose event too */
[ self restoreCachedImage ]; [ self restoreCachedImage ];
//SDL_PrivateExpose (); /*SDL_PrivateExpose ();*/
SDL_PrivateAppActive (1, SDL_APPACTIVE); SDL_PrivateAppActive (1, SDL_APPACTIVE);
} }
......
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