19682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* 29682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall SDL - Simple DirectMedia Layer 39682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Copyright (C) 1997-2012 Sam Lantinga 49682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 59682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is free software; you can redistribute it and/or 69682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall modify it under the terms of the GNU Library General Public 79682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License as published by the Free Software Foundation; either 89682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall version 2 of the License, or (at your option) any later version. 99682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall This library is distributed in the hope that it will be useful, 119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall but WITHOUT ANY WARRANTY; without even the implied warranty of 129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Library General Public License for more details. 149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall You should have received a copy of the GNU Library General Public 169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall License along with this library; if not, write to the Free 179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Sam Lantinga 209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall slouken@libsdl.org 219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall*/ 229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#include "SDL_config.h" 239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* This is the MacOS specific header for the SDL CD-ROM API 259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Contributed by Matt Slot 269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall */ 279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* AppleCD Control calls */ 299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kVerifyTheDisc 5 /* Returns noErr if there is disc inserted */ 309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kEjectTheDisc 7 /* Eject disc from drive */ 319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kUserEject 80 /* Enable/disable the CD-ROM eject button */ 329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kReadTOC 100 /* Extract various TOC information from the disc */ 339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kReadQ 101 /* Extract Q subcode info for the current track */ 349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kAudioTrackSearch 103 /* Start playback from the indicated position */ 359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kAudioPlay 104 /* Start playback from the indicated position */ 369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kAudioPause 105 /* Pause/continue the playback */ 379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kAudioStop 106 /* Stop playback at the indicated position */ 389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kAudioStatus 107 /* Return audio play status */ 399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kAudioControl 109 /* Set the output volume for the audio channels */ 409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kReadAudioVolume 112 /* Get the output volume for the audio channels */ 419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kSetTrackList 122 /* Set the track program for the audio CD to play */ 429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kGetTrackList 123 /* Get the track program the audio CD is playing */ 439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kGetTrackIndex 124 /* Get the track index the audio CD is playing */ 449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kSetPlayMode 125 /* Set the audio tracks play mode */ 459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kGetPlayMode 126 /* Get the audio tracks play mode */ 469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* AppleCD Status calls */ 489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kGetDriveType 96 /* Get the type of the physical CD-ROM drive */ 499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kWhoIsThere 97 /* Get a bitmap of SCSI IDs the driver controls */ 509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kGetBlockSize 98 /* Get current block size of the CD-ROM drive */ 519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* AppleCD other constants */ 539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kBlockPosition 0 /* Position at the specified logical block number */ 549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kAbsMSFPosition 1 /* Position at the specified Min/Sec/Frame (in BCD) */ 559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kTrackPosition 2 /* Position at the specified track number (in BCD) */ 569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kIndexPosition 3 /* Position at the nth track in program (in BCD) */ 579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kMutedPlayMode 0 /* Play the audio track with no output */ 599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kStereoPlayMode 9 /* Play the audio track in normal stereo */ 609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kControlFieldMask 0x0D /* Bits 3,2,0 in the nibble */ 629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kDataTrackMask 0x04 /* Indicates Data Track */ 639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kGetTrackRange 1 /* Query TOC for track numbers */ 659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kGetLeadOutArea 2 /* Query TOC for "Lead Out" end of audio data */ 669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kGetTrackEntries 3 /* Query TOC for track starts and data types */ 679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kStatusPlaying 0 /* Audio Play operation in progress */ 699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kStatusPaused 1 /* CD-ROM device in Hold Track ("Pause") state */ 709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kStatusMuted 2 /* MUTING-ON operation in progress */ 719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kStatusDone 3 /* Audio Play completed */ 729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kStatusError 4 /* Error occurred during audio play operation */ 739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kStatusStopped 5 /* Audio play operation not requested */ 749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kPlayModeSequential 0 /* Play tracks in order */ 769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kPlayModeShuffled 1 /* Play tracks randomly */ 779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kPlayModeProgrammed 2 /* Use custom playlist */ 789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* AppleCD Gestalt selectors */ 809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kGestaltAudioCDSelector 'aucd' 819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kDriverVersion52 0x00000520 829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kDriverVersion51 0x00000510 839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kDriverVersion50 0x00000500 849682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 859682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Drive type constants */ 869682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kDriveAppleCD_SC 1 879682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kDriveAppleCD_SCPlus_or_150 2 889682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kDriveAppleCD_300_or_300Plus 3 899682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 909682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* Misc constants */ 919682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kFirstSCSIDevice -33 929682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#define kLastSCSIDevice -40 939682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 949682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if PRAGMA_STRUCT_ALIGN 959682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #pragma options align=mac68k 969682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 979682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 989682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall/* AppleCD driver parameter block */ 999682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef struct CDCntrlParam { 1009682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall QElemPtr qLink; 1019682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall short qType; 1029682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall short ioTrap; 1039682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall Ptr ioCmdAddr; 1049682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall IOCompletionUPP ioCompletion; 1059682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall OSErr ioResult; 1069682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall StringPtr ioNamePtr; 1079682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall short ioVRefNum; 1089682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall short ioCRefNum; 1099682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall short csCode; 1109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall union { 1129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall long longs[6]; 1139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall short words[11]; 1149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char bytes[22]; 1159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall struct { 1169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char status; 1179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char play; 1189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char control; 1199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char minute; 1209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char second; 1219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char frame; 1229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } cd; 1239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } csParam; 1249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } CDCntrlParam, *CDCntrlParamPtr; 1269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halltypedef union CDTrackData { 1289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall long value; /* Treat as a longword value */ 1299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall struct { 1309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char reserved : 4; /* Unused by AppleCD driver */ 1319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char control : 4; /* Track flags (data track?) */ 1329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char min; /* Start of track (BCD) */ 1339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char sec; /* Start of track (BCD) */ 1349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall unsigned char frame; /* Start of track (BCD) */ 1359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } entry; /* Broken into fields */ 1369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall } CDTrackData, *CDTrackPtr; 1379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall 1389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#if PRAGMA_STRUCT_ALIGN 1399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall #pragma options align=reset 1409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall#endif 141